]>
Commit | Line | Data |
---|---|---|
c40b890f BP |
1 | AT_BANNER([bridge]) |
2 | ||
3 | dnl When a port disappears from a datapath, e.g. because an admin used | |
4 | dnl "ovs-dpctl del-port", the bridge code should be resilient enough to | |
5 | dnl notice and add it back the next time we reconfigure. A prior version | |
6 | dnl of the code failed to do this, so this test guards against regression. | |
7 | AT_SETUP([bridge - ports that disappear get added back]) | |
8 | OVS_VSWITCHD_START | |
9 | ||
10 | # Add some ports and make sure that they show up in the datapath. | |
ca5792f0 | 11 | add_of_ports br0 1 2 |
c40b890f BP |
12 | AT_CHECK([ovs-appctl dpif/show], [0], [dnl |
13 | dummy@ovs-dummy: hit:0 missed:0 | |
7be29a47 BP |
14 | br0: |
15 | br0 65534/100: (dummy-internal) | |
16 | p1 1/1: (dummy) | |
17 | p2 2/2: (dummy) | |
c40b890f BP |
18 | ]) |
19 | ||
71f634cf | 20 | # Delete p1 from the datapath with "ovs-dpctl del-if" |
c40b890f | 21 | # and check that it disappeared. |
71f634cf | 22 | AT_CHECK([ovs-appctl dpctl/del-if dummy@ovs-dummy p1]) |
c40b890f BP |
23 | AT_CHECK([ovs-appctl dpif/show], [0], [dnl |
24 | dummy@ovs-dummy: hit:0 missed:0 | |
7be29a47 BP |
25 | br0: |
26 | br0 65534/100: (dummy-internal) | |
27 | p2 2/2: (dummy) | |
c40b890f BP |
28 | ]) |
29 | ||
30 | # Force reconfiguration and make sure that p1 got added back. | |
31 | AT_CHECK([ovs-vsctl del-port p2]) | |
32 | AT_CHECK([ovs-appctl dpif/show], [0], [dnl | |
33 | dummy@ovs-dummy: hit:0 missed:0 | |
7be29a47 BP |
34 | br0: |
35 | br0 65534/100: (dummy-internal) | |
36 | p1 1/1: (dummy) | |
c40b890f | 37 | ]) |
d9c8c57c LR |
38 | OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) |
39 | OVS_APP_EXIT_AND_WAIT([ovsdb-server]) | |
c40b890f | 40 | AT_CLEANUP |
85c55772 AZ |
41 | |
42 | dnl When multiple bridges are connected to the same controller, make | |
43 | dnl sure their status are tracked independently. | |
44 | AT_SETUP([bridge - multiple bridges share a controller]) | |
45 | OVS_VSWITCHD_START( | |
46 | [add-br br1 -- \ | |
47 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
48 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 ]) | |
49 | ||
50 | dnl Start ovs-testcontroller | |
9a403b07 | 51 | AT_CHECK([ovs-testcontroller --detach --no-chdir punix:controller --pidfile], [0], [ignore]) |
1b4f56e0 | 52 | on_exit 'kill `cat ovs-testcontroller.pid`' |
a1a23d9a | 53 | OVS_WAIT_UNTIL([test -e controller]) |
85c55772 AZ |
54 | |
55 | dnl Add the controller to both bridges, 5 seconds apart. | |
56 | AT_CHECK([ovs-vsctl set-controller br0 unix:controller]) | |
a1a23d9a | 57 | AT_CHECK([ovs-vsctl set-fail-mode br0 secure]) |
85c55772 AZ |
58 | AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore]) |
59 | AT_CHECK([ovs-vsctl set-controller br1 unix:controller]) | |
a1a23d9a | 60 | AT_CHECK([ovs-vsctl set-fail-mode br1 secure]) |
85c55772 | 61 | |
a1a23d9a AZ |
62 | dnl Wait for the controller connectionsi to be up |
63 | for i in `seq 0 19` | |
85c55772 | 64 | do |
fee2e48a | 65 | if ovs-vsctl --columns=is_connected list controller |grep "false"; then |
a1a23d9a AZ |
66 | : |
67 | else | |
68 | break | |
69 | fi | |
70 | ovs-appctl time/warp 1100 | |
85c55772 AZ |
71 | done |
72 | ||
a1a23d9a AZ |
73 | dnl Make sure the connection status have two records and they are different. |
74 | dnl (The exact output contains timing information that are machine dependent.) | |
fee2e48a | 75 | AT_CHECK([ovs-vsctl --columns=status list controller | dnl |
a1a23d9a | 76 | grep "status" | sort -u |wc -l], [0], [2 |
85c55772 AZ |
77 | ]) |
78 | ||
79 | OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) | |
80 | OVS_APP_EXIT_AND_WAIT([ovsdb-server]) | |
81 | AT_CLEANUP | |
903f6c4f NS |
82 | |
83 | AT_SETUP([bridge - add port after stopping controller]) | |
84 | OVS_VSWITCHD_START | |
85 | ||
86 | dnl Start ovs-testcontroller | |
9a403b07 | 87 | AT_CHECK([ovs-testcontroller --no-chdir --detach punix:controller --pidfile], [0], [ignore]) |
903f6c4f NS |
88 | OVS_WAIT_UNTIL([test -e controller]) |
89 | ||
90 | AT_CHECK([ovs-vsctl set-controller br0 unix:controller]) | |
91 | AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=internal], [0], [ignore]) | |
92 | AT_CHECK([ovs-appctl -t ovs-vswitchd version], [0], [ignore]) | |
93 | ||
94 | # Now kill the ovs-testcontroller | |
95 | kill `cat ovs-testcontroller.pid` | |
039cf7d4 AGS |
96 | if test "$IS_WIN32" = "yes"; then |
97 | AT_CHECK([rm controller], [0], [ignore]) | |
98 | fi | |
903f6c4f NS |
99 | OVS_WAIT_UNTIL([! test -e controller]) |
100 | AT_CHECK([ovs-vsctl --no-wait add-port br0 p2 -- set Interface p2 type=internal], [0], [ignore]) | |
101 | AT_CHECK([ovs-appctl -t ovs-vswitchd version], [0], [ignore]) | |
102 | ||
103 | OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) | |
104 | OVS_APP_EXIT_AND_WAIT([ovsdb-server]) | |
105 | AT_CLEANUP |