Skip to content

Commit

Permalink
dpctl: Add tests.
Browse files Browse the repository at this point in the history
These tests prevent regressions against the problems fixed by the previous
two commits.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
blp committed Apr 16, 2015
1 parent 1705061 commit 5acf2e9
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 8 deletions.
1 change: 1 addition & 0 deletions tests/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ TESTSUITE_AT = \
tests/reconnect.at \
tests/ovs-vswitchd.at \
tests/dpif-netdev.at \
tests/dpctl.at \
tests/ofproto-dpif.at \
tests/bridge.at \
tests/vlan-splinters.at \
Expand Down
80 changes: 80 additions & 0 deletions tests/dpctl.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
AT_BANNER([dpctl])

AT_SETUP([dpctl - add-dp del-dp])
OVS_VSWITCHD_START
AT_CHECK([ovs-appctl dpctl/add-dp dummy@br0])
AT_CHECK([ovs-appctl dpctl/add-dp dummy@br0], [2], [],
[ovs-vswitchd: add_dp (File exists)
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/del-dp dummy@br0])
AT_CHECK([ovs-appctl dpctl/del-dp dummy@br0], [2], [],
[ovs-vswitchd: opening datapath (No such device)
ovs-appctl: ovs-vswitchd: server returned an error
])
OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([dpctl - add-if set-if del-if])
OVS_VSWITCHD_START([], [], [=override])
AT_CHECK([ovs-appctl dpctl/add-dp dummy@br0])
AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
port 0: br0 (internal)
])
AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=tap,port_no=5])
AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
port 0: br0 (internal)
port 5: vif1.0 (tap)
])
AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=tap], [2], [],
[ovs-vswitchd: adding vif1.0 to dummy@br0 failed (File exists)
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 vif1.0,port_no=5])
AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 vif1.0,type=system], [2], [],
[ovs-vswitchd: vif1.0: can't change type from tap to system
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=tap], [2], [],
[ovs-vswitchd: br0: can't change type from internal to tap
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0])
AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
port 0: br0 (internal)
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0], [2], [],
[ovs-vswitchd: no port named vif1.0
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
port 0: br0 (internal)
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 nonexistent], [2], [],
[ovs-vswitchd: no port named nonexistent
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 br0], [2], [],
[ovs-vswitchd: deleting port br0 from dummy@br0 failed (Invalid argument)
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/del-dp dummy@br0])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 br0], [2], [],
[ovs-vswitchd: opening datapath (No such device)
ovs-appctl: ovs-vswitchd: server returned an error
])
OVS_VSWITCHD_STOP(["/dummy@br0: port_del failed (Invalid argument)/d
/dummy@br0: failed to add vif1.0 as port: File exists/d"])
AT_CLEANUP
8 changes: 0 additions & 8 deletions tests/dpif-netdev.at
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,3 @@ skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:

OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([dpif-netdev - Datapath removal])
OVS_VSWITCHD_START()
AT_CHECK([ovs-appctl dpctl/add-dp dummy@br0])
AT_CHECK([ovs-appctl dpctl/del-dp dummy@br0])

OVS_VSWITCHD_STOP
AT_CLEANUP
1 change: 1 addition & 0 deletions tests/testsuite.at
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ m4_include([tests/reconnect.at])
m4_include([tests/ovs-vswitchd.at])
m4_include([tests/ofproto.at])
m4_include([tests/dpif-netdev.at])
m4_include([tests/dpctl.at])
m4_include([tests/ofproto-dpif.at])
m4_include([tests/bridge.at])
m4_include([tests/vlan-splinters.at])
Expand Down

0 comments on commit 5acf2e9

Please sign in to comment.