summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-05-22 09:36:00 -0700
committerBen Pfaff <blp@nicira.com>2014-05-22 14:25:50 -0700
commitc40b890fd87e085e81d508bb114efd64683419f8 (patch)
tree1471ee1e477ec9ae5f8d9ee8079fd678a7f67757 /tests
parentd611866c67ba06213040b27186e402717f77d72e (diff)
downloadopenvswitch-c40b890fd87e085e81d508bb114efd64683419f8.tar.gz
bridge: Add test that ports that disappear get added back to the datapath.
The test added in this commit would have caught the bug fixed by commit 96be8de595150 (bridge: When ports disappear from a datapath, add them back.). With that commit reverted, the new test fails. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/automake.mk1
-rw-r--r--tests/bridge.at38
-rw-r--r--tests/testsuite.at3
3 files changed, 41 insertions, 1 deletions
diff --git a/tests/automake.mk b/tests/automake.mk
index a858148a7..9354fadfd 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -39,6 +39,7 @@ TESTSUITE_AT = \
tests/ovs-vswitchd.at \
tests/dpif-netdev.at \
tests/ofproto-dpif.at \
+ tests/bridge.at \
tests/vlan-splinters.at \
tests/ofproto-macros.at \
tests/ofproto.at \
diff --git a/tests/bridge.at b/tests/bridge.at
new file mode 100644
index 000000000..817931f87
--- /dev/null
+++ b/tests/bridge.at
@@ -0,0 +1,38 @@
+AT_BANNER([bridge])
+
+dnl When a port disappears from a datapath, e.g. because an admin used
+dnl "ovs-dpctl del-port", the bridge code should be resilient enough to
+dnl notice and add it back the next time we reconfigure. A prior version
+dnl of the code failed to do this, so this test guards against regression.
+AT_SETUP([bridge - ports that disappear get added back])
+OVS_VSWITCHD_START
+
+# Add some ports and make sure that they show up in the datapath.
+ADD_OF_PORTS([br0], 1, 2)
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
+dummy@ovs-dummy: hit:0 missed:0
+ br0:
+ br0 65534/100: (dummy)
+ p1 1/1: (dummy)
+ p2 2/2: (dummy)
+])
+
+# Delete p1 from the datapath as if by "ovs-dpctl del-port"
+# and check that it disappeared.
+AT_CHECK([ovs-appctl dpif-dummy/delete-port ovs-dummy p1])
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
+dummy@ovs-dummy: hit:0 missed:0
+ br0:
+ br0 65534/100: (dummy)
+ p2 2/2: (dummy)
+])
+
+# Force reconfiguration and make sure that p1 got added back.
+AT_CHECK([ovs-vsctl del-port p2])
+AT_CHECK([ovs-appctl dpif/show], [0], [dnl
+dummy@ovs-dummy: hit:0 missed:0
+ br0:
+ br0 65534/100: (dummy)
+ p1 1/1: (dummy)
+])
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 1911ac662..d7e5a7d70 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,6 +1,6 @@
AT_INIT
-AT_COPYRIGHT([Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+AT_COPYRIGHT([Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -147,6 +147,7 @@ m4_include([tests/ovs-vswitchd.at])
m4_include([tests/ofproto.at])
m4_include([tests/dpif-netdev.at])
m4_include([tests/ofproto-dpif.at])
+m4_include([tests/bridge.at])
m4_include([tests/vlan-splinters.at])
m4_include([tests/ovsdb.at])
m4_include([tests/ovs-vsctl.at])