Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add NetTester cucumber scenario #4

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
source 'https://rubygems.org'

gem 'aruba'
gem 'cucumber'
gem 'pio'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'phut'
35 changes: 31 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.5.1)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
aruba (0.14.1)
childprocess (~> 0.5.6)
contracts (~> 0.9)
cucumber (>= 1.3.19)
ffi (~> 1.9.10)
rspec-expectations (>= 2.99)
thor (~> 0.19)
ast (2.2.0)
bindata (2.1.0)
builder (3.2.2)
cucumber (2.3.2)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.1)
contracts (0.13.0)
cucumber (2.3.3)
builder (>= 2.1.2)
cucumber-core (~> 1.4.0)
cucumber-wire (~> 0.0.1)
Expand All @@ -22,25 +33,37 @@ GEM
gherkin (~> 3.2.0)
cucumber-wire (0.0.1)
diff-lcs (1.2.5)
ffi (1.9.10)
gherkin (3.2.0)
gli (2.13.4)
i18n (0.7.0)
json (1.8.3)
method_source (0.8.2)
minitest (5.8.4)
multi_json (1.11.2)
multi_test (0.1.2)
parser (2.3.0.6)
ast (~> 2.2)
phut (0.7.7)
activesupport (~> 4.2, >= 4.2.5)
gli (~> 2.13.4)
pio (~> 0.30.0)
pry (~> 0.10.3)
pio (0.30.0)
activesupport (~> 4.2, >= 4.2.4)
bindata (~> 2.1.0)
powerpack (0.1.1)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.1.0)
rake (10.5.0)
rake (11.1.1)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.3)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -56,6 +79,8 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.7.5)
slop (3.6.0)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
Expand All @@ -65,7 +90,9 @@ PLATFORMS
ruby

DEPENDENCIES
aruba
cucumber
phut
pio
rake
rspec
Expand Down
27 changes: 27 additions & 0 deletions features/net_tester.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# language: ja
フィーチャ: 最低限の NetTester 機能

ActiveFlow に必要な機能を洗い出すためのフィーチャ。
最小構成で NetTester を動かすのに必要な機能をテストする。
うまく動いたらこのフィーチャとステップを trema/net_tester に移動すべし。

シナリオ: テスト用ホストを 2 台、NetTester 用スイッチを 2 台起動する
前提 次の仮想ネットワーク設定ファイルで phut を起動する
"""ruby
# ホスト接続用の Open vSwitch
vswitch('host_sw') { datapath_id 0x1 }
# 物理 Open vSwitch
vswitch('physical_sw') { datapath_id 0x2 }
# テスト対象のスイッチ
# WIP: このスイッチは普通のイーサネットスイッチとして動かす必要あり
vswitch('testee_sw') { datapath_id 0x3 }

vhost ('host1') { ip '192.168.0.1' }
vhost ('host2') { ip '192.168.0.2' }

link 'host_sw', 'physical_sw'
link 'host_sw', 'host1'
link 'host_sw', 'host2'
link 'physical_sw', 'testee_sw'
link 'physical_sw', 'testee_sw'
"""
12 changes: 12 additions & 0 deletions features/step_definitions/active_flow_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
end
# rubocop:enable LineLength

Given(/^次の仮想ネットワーク設定ファイルで phut を起動する$/) do |config|
@config_file = 'phut.conf'
step %(a file named "#{@config_file}" with:), config
step %(I successfully run `phut run -L. -P. -S. #{@config_file}`)
end

Given(/^次のテーブルを定義:$/) do |code|
ActiveFlow.module_eval code
end
Expand Down Expand Up @@ -59,3 +65,9 @@
end
end
# rubocop:enable LineLength

Then(/^phut を停止する$/) do
if @config_file
step %(I successfully run `phut -v stop -L. -P. -S. #{@config_file}`)
end
end
1 change: 1 addition & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require 'active_flow'
require 'aruba/cucumber'
3 changes: 3 additions & 0 deletions features/support/hooks.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# coding: utf-8

After do
step %(phut を停止する)
system "sudo ovs-vsctl del-br br0x#{@dpid}" if @dpid
end