4 m4_define([OVN_SBCTL_TEST_START],
5 [dnl Create databases (ovn-nb, ovn-sb).
6 for daemon in ovn-nb ovn-sb; do
7 AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
10 dnl Start ovsdb-server.
11 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock ovn-nb.db ovn-sb.db], [0], [], [stderr])
12 on_exit "kill `cat ovsdb-server.pid`"
13 AT_CHECK([[sed < stderr '
14 /vlog|INFO|opened log file/d
15 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
16 AT_CAPTURE_FILE([ovsdb-server.log])
19 AT_CHECK([ovn-northd --detach --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
20 on_exit "kill `cat ovn-northd.pid`"
21 AT_CHECK([[sed < stderr '
22 /vlog|INFO|opened log file/d']])
23 AT_CAPTURE_FILE([ovn-northd.log])
27 m4_define([OVN_SBCTL_TEST_STOP],
28 [AT_CHECK([check_logs $1])
29 AT_CHECK([ovs-appctl -t ovn-northd exit])
30 AT_CHECK([ovs-appctl -t ovsdb-server exit])])
32 dnl ---------------------------------------------------------------------
34 AT_SETUP([ovn-sbctl - chassis commands])
38 AT_CHECK([ovn-sbctl chassis-add ch0 geneve 1.2.3.4])
39 AT_CHECK([ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort],
44 AT_CHECK([ovn-sbctl chassis-add ch1 stt,geneve,vxlan 1.2.3.5])
45 AT_CHECK([ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort],
53 AT_CHECK([ovn-sbctl chassis-del ch0])
54 AT_CHECK([ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort],
64 dnl ---------------------------------------------------------------------
66 AT_SETUP([ovn-sbctl - test])
69 AT_CHECK([ovn-nbctl lswitch-add br-test])
70 AT_CHECK([ovn-nbctl lport-add br-test vif0])
71 AT_CHECK([ovn-nbctl lport-set-addresses vif0 f0:ab:cd:ef:01:02])
72 AT_CHECK([ovn-sbctl chassis-add ch0 stt 1.2.3.5])
73 AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
75 AT_CHECK([ovn-sbctl show], [0], [dnl
83 AT_CHECK([ovn-nbctl lport-add br-test vif1])
84 AT_CHECK([ovn-nbctl lport-set-addresses vif1 f0:ab:cd:ef:01:03])
85 AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
87 AT_CHECK([ovn-sbctl show | sed 's/vif[[0-9]]/vif/'], [0], [dnl
96 AT_CHECK([ovn-nbctl lport-del vif1])
98 AT_CHECK([ovn-sbctl show], [0], [dnl
105 uuid=$(ovn-sbctl --columns=_uuid list Chassis ch0 | cut -d ':' -f2 | tr -d ' ')
106 AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,chassis list Port_Binding], [0], [dnl
107 logical_port : "vif0"
108 mac : [["f0:ab:cd:ef:01:02"]]
112 # test the passing down of logical port type and options.
113 AT_CHECK([ovn-nbctl lport-add br-test vtep0])
114 AT_CHECK([ovn-nbctl lport-set-type vtep0 vtep])
115 AT_CHECK([ovn-nbctl lport-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0])
117 OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=logical_port list Port_Binding | grep vtep0`" ])
118 AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl
119 logical_port : "vtep0"
122 options : {vtep_logical_switch="l0", vtep_physical_switch="p0"}