1 AT_BANNER([ovs-xapi-sync])
3 AT_SETUP([ovs-xapi-sync])
4 AT_SKIP_IF([test $HAVE_PYTHON = no])
7 cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
8 PYTHONPATH=`pwd`:$PYTHONPATH
11 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
12 OVS_PKGDATADIR=`pwd`; export OVS_PKGDATADIR
13 cp "$top_srcdir/vswitchd/vswitch.ovsschema" .
15 cp "$top_srcdir/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync" \
18 trap 'kill `cat pid ovs-xapi-sync.pid`' 0
21 touch var/run/xapi_init_complete.cookie
24 ovs-vsctl --timeout=5 --no-wait -vreconnect:emer --db=unix:socket "$@"
30 # Start ovs-xapi-sync.
31 AT_CHECK([$PYTHON ./ovs-xapi-sync "--pidfile=`pwd`/ovs-xapi-sync.pid" \
32 "--root-prefix=`pwd`" unix:socket >log 2>&1 &])
33 AT_CAPTURE_FILE([log])
35 # Add bridges and check ovs-xapi-sync's work.
36 AT_CHECK([ovs_vsctl -- add-br xenbr0 -- add-br xenbr1])
37 OVS_WAIT_UNTIL([test "X`ovs_vsctl get bridge xenbr0 fail-mode`" != "X[[]]"])
39 -- get bridge xenbr0 fail-mode other-config external-ids \
40 -- get bridge xenbr1 fail-mode other-config external-ids], [0],
43 {bridge-id="custom bridge ID"}
45 {disable-in-band="true"}
49 # Add vif and check daemon's work.
51 -- add-port xenbr0 vif1.0 \
52 -- 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"'}])
53 OVS_WAIT_UNTIL([ovs_vsctl get interface vif1.0 external-ids:iface-id >/dev/null 2>&1])
54 AT_CHECK([ovs_vsctl get interface vif1.0 external-ids], [0],
55 [{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"}
58 # Add corresponding tap and check daemon's work.
59 AT_CHECK([ovs_vsctl add-port xenbr0 tap1.0])
60 OVS_WAIT_UNTIL([ovs_vsctl get interface tap1.0 external-ids:iface-id >/dev/null 2>&1])
62 -- get interface vif1.0 external-ids \
63 -- get interface tap1.0 external-ids], [0],
64 [{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"}
65 {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"}
68 # Remove corresponding tap and check daemon's work.
69 AT_CHECK([ovs_vsctl del-port tap1.0])
70 OVS_WAIT_UNTIL([test `ovs_vsctl get interface vif1.0 external-ids:iface-status` = active])
71 AT_CHECK([ovs_vsctl get interface vif1.0 external-ids], [0],
72 [{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"}