]> git.proxmox.com Git - ovs.git/blob - tests/ovs-xapi-sync.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[ovs.git] / tests / ovs-xapi-sync.at
1 AT_BANNER([ovs-xapi-sync])
2
3 AT_SETUP([ovs-xapi-sync])
4
5 # Mock up the XenAPI.
6 cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
7 PYTHONPATH=`pwd`:$PYTHONPATH
8 export PYTHONPATH
9
10 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
11
12 cp "$top_srcdir/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync" \
13 ovs-xapi-sync
14
15 on_exit 'kill `cat pid ovs-xapi-sync.pid`'
16
17 mkdir var var/run
18 touch var/run/xapi_init_complete.cookie
19
20 ovs_vsctl () {
21 ovs-vsctl --no-wait -vreconnect:emer "$@"
22 }
23
24 # Start ovsdb-server.
25 OVS_VSCTL_SETUP
26
27 # Start ovs-xapi-sync.
28 AT_CHECK([$PYTHON3 ./ovs-xapi-sync "--pidfile=ovs-xapi-sync.pid" \
29 "--root-prefix=`pwd`" unix:db.sock >log 2>&1 &])
30 AT_CAPTURE_FILE([log])
31
32 # Add bridges and check ovs-xapi-sync's work.
33 AT_CHECK([ovs_vsctl -- add-br xenbr0 -- add-br xenbr1])
34 OVS_WAIT_UNTIL([test "X`ovs_vsctl get bridge xenbr0 fail-mode`" != "X[[]]"])
35 AT_CHECK([ovs_vsctl \
36 -- get bridge xenbr0 fail-mode other-config external-ids \
37 -- get bridge xenbr1 fail-mode other-config external-ids], [0],
38 [[secure
39 {}
40 {bridge-id="custom bridge ID"}
41 secure
42 {disable-in-band="true"}
43 {}
44 ]])
45
46 # Add vif and check daemon's work.
47 AT_CHECK([ovs_vsctl \
48 -- add-port xenbr0 vif1.0 \
49 -- set Interface vif1.0 'external-ids={attached-mac="00:11:22:33:44:55", xs-network-uuid="9b66c68b-a74e-4d34-89a5-20a8ab352d1e", xs-vif-uuid="6ab1b260-398e-49ba-827b-c7696108964c", xs-vm-uuid="fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8"'}])
50 OVS_WAIT_UNTIL([ovs_vsctl get interface vif1.0 external-ids:iface-id >/dev/null 2>&1])
51 AT_CHECK([ovs_vsctl get interface vif1.0 external-ids], [0],
52 [{attached-mac="00:11:22:33:44:55", iface-id="custom iface ID", iface-status=active, vm-id="custom vm ID", xs-network-uuid="9b66c68b-a74e-4d34-89a5-20a8ab352d1e", xs-vif-uuid="6ab1b260-398e-49ba-827b-c7696108964c", xs-vm-uuid="fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8"}
53 ])
54
55 # Add corresponding tap and check daemon's work.
56 AT_CHECK([ovs_vsctl add-port xenbr0 tap1.0])
57 OVS_WAIT_UNTIL([ovs_vsctl get interface tap1.0 external-ids:iface-id >/dev/null 2>&1])
58 AT_CHECK([ovs_vsctl \
59 -- get interface vif1.0 external-ids \
60 -- get interface tap1.0 external-ids], [0],
61 [{attached-mac="00:11:22:33:44:55", iface-id="custom iface ID", iface-status=inactive, vm-id="custom vm ID", xs-network-uuid="9b66c68b-a74e-4d34-89a5-20a8ab352d1e", xs-vif-uuid="6ab1b260-398e-49ba-827b-c7696108964c", xs-vm-uuid="fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8"}
62 {attached-mac="00:11:22:33:44:55", iface-id="custom iface ID", iface-status=active, vm-id="custom vm ID", xs-network-uuid="9b66c68b-a74e-4d34-89a5-20a8ab352d1e", xs-vif-uuid="6ab1b260-398e-49ba-827b-c7696108964c", xs-vm-uuid="fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8"}
63 ])
64
65 # Remove corresponding tap and check daemon's work.
66 AT_CHECK([ovs_vsctl del-port tap1.0])
67 OVS_WAIT_UNTIL([test `ovs_vsctl get interface vif1.0 external-ids:iface-status` = active])
68 AT_CHECK([ovs_vsctl get interface vif1.0 external-ids], [0],
69 [{attached-mac="00:11:22:33:44:55", iface-id="custom iface ID", iface-status=active, vm-id="custom vm ID", xs-network-uuid="9b66c68b-a74e-4d34-89a5-20a8ab352d1e", xs-vif-uuid="6ab1b260-398e-49ba-827b-c7696108964c", xs-vm-uuid="fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8"}
70 ])
71
72 OVSDB_SERVER_SHUTDOWN
73
74 AT_CLEANUP