datapath-windows: Fix IP fragmentation
[cascardo/ovs.git] / tests / ovn-sbctl.at
1 AT_BANNER([ovn-sbctl])
2
3 # OVN_SBCTL_TEST_START
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])
8    done
9
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])
17
18    dnl Start ovn-northd.
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])
24 ])
25
26 # OVN_SBCTL_TEST_STOP
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])])
31
32 # ovn-sbctl test.
33 AT_SETUP([ovn-sbctl - test])
34 OVN_SBCTL_TEST_START
35
36 AT_CHECK([ovn-nbctl lswitch-add br-test])
37 AT_CHECK([ovn-nbctl lport-add br-test vif0])
38 AT_CHECK([ovn-nbctl lport-set-macs vif0 f0:ab:cd:ef:01:02])
39 AT_CHECK([ovn-sbctl chassis-add ch0 stt 1.2.3.5])
40 AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
41
42 AT_CHECK([ovn-sbctl show], [0], [dnl
43 Chassis "ch0"
44     Encap stt
45         ip: "1.2.3.5"
46     Port_Binding "vif0"
47 ])
48
49 # adds another 'vif1'
50 AT_CHECK([ovn-nbctl lport-add br-test vif1])
51 AT_CHECK([ovn-nbctl lport-set-macs vif1 f0:ab:cd:ef:01:03])
52 AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
53
54 AT_CHECK([ovn-sbctl show | sed 's/vif[[0-9]]/vif/'], [0], [dnl
55 Chassis "ch0"
56     Encap stt
57         ip: "1.2.3.5"
58     Port_Binding "vif"
59     Port_Binding "vif"
60 ])
61
62 # deletes 'vif1'
63 AT_CHECK([ovn-nbctl lport-del vif1])
64
65 AT_CHECK([ovn-sbctl show], [0], [dnl
66 Chassis "ch0"
67     Encap stt
68         ip: "1.2.3.5"
69     Port_Binding "vif0"
70 ])
71
72 uuid=$(ovn-sbctl --columns=_uuid list Chassis ch0 | cut -d ':' -f2 | tr -d ' ')
73 AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,chassis list Port_Binding], [0], [dnl
74 logical_port        : "vif0"
75 mac                 : [["f0:ab:cd:ef:01:02"]]
76 chassis             : ${uuid}
77 ])
78
79 # test the passing down of logical port type and options.
80 AT_CHECK([ovn-nbctl lport-add br-test vtep0])
81 AT_CHECK([ovn-nbctl lport-set-type vtep0 vtep])
82 AT_CHECK([ovn-nbctl lport-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0])
83
84 OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=logical_port list Port_Binding | grep vtep0`" ])
85 AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl
86 logical_port        : "vtep0"
87 mac                 : [[]]
88 type                : vtep
89 options             : {vtep_logical_switch="l0", vtep_physical_switch="p0"}
90 ])
91
92 OVN_SBCTL_TEST_STOP
93 AT_CLEANUP