4 m4_define([OVN_NBCTL_TEST_START],
5 [dnl Create ovn-nb database.
7 AT_CHECK([ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn/ovn-nb.ovsschema])
9 dnl Start ovsdb-server.
10 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock ovn-nb.db], [0], [], [stderr])
11 on_exit "kill `cat ovsdb-server.pid`"
12 AT_CHECK([[sed < stderr '
13 /vlog|INFO|opened log file/d
14 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
15 AT_CAPTURE_FILE([ovsdb-server.log])
19 m4_define([OVN_NBCTL_TEST_STOP],
20 [# removes all 'Broken pipe' warning logs from ovsdb-server.log. this is in
21 # that *ctl command (e.g. ovn-nbctl) exits right after committing the change
22 # to database. however, in reaction, some daemon (e.g. ovn-controller-vtep)
23 # may immediately update the database. this later update may cause database
24 # sending update back to *ctl command if *ctl has not proceeded to exit yet.
25 # and if *ctl command exits before database calling send, the send from
26 # database will fail with 'Broken pipe' error.
27 AT_CHECK([check_logs "$1
29 AT_CHECK([ovs-appctl -t ovsdb-server exit])])
32 AT_SETUP([ovn-nbctl - basic lswitch commands])
35 AT_CHECK([ovn-nbctl lswitch-add ls0])
36 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
40 AT_CHECK([ovn-nbctl lswitch-add ls1])
41 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
46 AT_CHECK([ovn-nbctl lswitch-del ls0])
47 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
54 dnl ---------------------------------------------------------------------
56 AT_SETUP([ovn-nbctl - basic lport commands])
59 AT_CHECK([ovn-nbctl lswitch-add ls0])
60 AT_CHECK([ovn-nbctl lport-add ls0 lp0])
61 AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
65 AT_CHECK([ovn-nbctl lport-add ls0 lp1])
66 AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
71 AT_CHECK([ovn-nbctl lport-del lp1])
72 AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
79 dnl ---------------------------------------------------------------------
81 AT_SETUP([ovn-nbctl - addresses])
84 AT_CHECK([ovn-nbctl lswitch-add ls0])
85 AT_CHECK([ovn-nbctl lport-add ls0 lp0])
86 AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
89 AT_CHECK([ovn-nbctl lport-set-addresses lp0 00:11:22:33:44:55 unknown])
90 AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
95 AT_CHECK([ovn-nbctl lport-set-addresses lp0])
96 AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
102 dnl ---------------------------------------------------------------------
104 AT_SETUP([ovn-nbctl - port security])
107 AT_CHECK([ovn-nbctl lswitch-add ls0])
108 AT_CHECK([ovn-nbctl lport-add ls0 lp0])
109 AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
112 AT_CHECK([ovn-nbctl lport-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55])
113 AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl
118 AT_CHECK([ovn-nbctl lport-set-port-security lp0])
119 AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl
125 dnl ---------------------------------------------------------------------
127 AT_SETUP([ovn-nbctl - ACLs])
130 AT_CHECK([ovn-nbctl lswitch-add ls0])
131 AT_CHECK([ovn-nbctl --log acl-add ls0 from-lport 600 udp drop])
132 AT_CHECK([ovn-nbctl --log acl-add ls0 to-lport 500 udp drop])
133 AT_CHECK([ovn-nbctl acl-add ls0 from-lport 400 tcp drop])
134 AT_CHECK([ovn-nbctl acl-add ls0 to-lport 300 tcp drop])
135 AT_CHECK([ovn-nbctl acl-add ls0 from-lport 200 ip drop])
136 AT_CHECK([ovn-nbctl acl-add ls0 to-lport 100 ip drop])
138 AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl
139 from-lport 600 (udp) drop log
140 from-lport 400 (tcp) drop
141 from-lport 200 (ip) drop
142 to-lport 500 (udp) drop log
143 to-lport 300 (tcp) drop
144 to-lport 100 (ip) drop
147 dnl Delete in one direction.
148 AT_CHECK([ovn-nbctl acl-del ls0 to-lport])
149 AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl
150 from-lport 600 (udp) drop log
151 from-lport 400 (tcp) drop
152 from-lport 200 (ip) drop
156 AT_CHECK([ovn-nbctl acl-del ls0])
157 AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl
160 AT_CHECK([ovn-nbctl acl-add ls0 from-lport 600 udp drop])
161 AT_CHECK([ovn-nbctl acl-add ls0 from-lport 400 tcp drop])
162 AT_CHECK([ovn-nbctl acl-add ls0 from-lport 200 ip drop])
164 dnl Delete a single flow.
165 AT_CHECK([ovn-nbctl acl-del ls0 from-lport 400 tcp])
166 AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl
167 from-lport 600 (udp) drop
168 from-lport 200 (ip) drop