netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / tests / ovn-nbctl.at
1 AT_BANNER([ovn-nbctl])
2
3 # OVN_NBCTL_TEST_START
4 m4_define([OVN_NBCTL_TEST_START],
5   [dnl Create ovn-nb database.
6    AT_KEYWORDS([ovn])
7    AT_CHECK([ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn/ovn-nb.ovsschema])
8
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])
16 ])
17
18 # OVN_NBCTL_TEST_STOP
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
28 /Broken pipe/d"])
29    AT_CHECK([ovs-appctl -t ovsdb-server exit])])
30
31
32 AT_SETUP([ovn-nbctl - basic lswitch commands])
33 OVN_NBCTL_TEST_START
34
35 AT_CHECK([ovn-nbctl lswitch-add ls0])
36 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
37 <0> (ls0)
38 ])
39
40 AT_CHECK([ovn-nbctl lswitch-add ls1])
41 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
42 <0> (ls0)
43 <1> (ls1)
44 ])
45
46 AT_CHECK([ovn-nbctl lswitch-del ls0])
47 AT_CHECK([ovn-nbctl lswitch-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
48 <0> (ls1)
49 ])
50
51 OVN_NBCTL_TEST_STOP
52 AT_CLEANUP
53
54 dnl ---------------------------------------------------------------------
55
56 AT_SETUP([ovn-nbctl - basic lport commands])
57 OVN_NBCTL_TEST_START
58
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
62 <0> (lp0)
63 ])
64
65 AT_CHECK([ovn-nbctl lport-add ls0 lp1])
66 AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
67 <0> (lp0)
68 <1> (lp1)
69 ])
70
71 AT_CHECK([ovn-nbctl lport-del lp1])
72 AT_CHECK([ovn-nbctl lport-list ls0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
73 <0> (lp0)
74 ])
75
76 OVN_NBCTL_TEST_STOP
77 AT_CLEANUP
78
79 dnl ---------------------------------------------------------------------
80
81 AT_SETUP([ovn-nbctl - addresses])
82 OVN_NBCTL_TEST_START
83
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
87 ])
88
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
91 00:11:22:33:44:55
92 unknown
93 ])
94
95 AT_CHECK([ovn-nbctl lport-set-addresses lp0])
96 AT_CHECK([ovn-nbctl lport-get-addresses lp0], [0], [dnl
97 ])
98
99 OVN_NBCTL_TEST_STOP
100 AT_CLEANUP
101
102 dnl ---------------------------------------------------------------------
103
104 AT_SETUP([ovn-nbctl - port security])
105 OVN_NBCTL_TEST_START
106
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
110 ])
111
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
114 00:11:22:33:44:55
115 aa:bb:cc:dd:ee:ff
116 ])
117
118 AT_CHECK([ovn-nbctl lport-set-port-security lp0])
119 AT_CHECK([ovn-nbctl lport-get-port-security lp0], [0], [dnl
120 ])
121
122 OVN_NBCTL_TEST_STOP
123 AT_CLEANUP
124
125 dnl ---------------------------------------------------------------------
126
127 AT_SETUP([ovn-nbctl - ACLs])
128 OVN_NBCTL_TEST_START
129
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])
137
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
145 ])
146
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
153 ])
154
155 dnl Delete all ACLs.
156 AT_CHECK([ovn-nbctl acl-del ls0])
157 AT_CHECK([ovn-nbctl acl-list ls0], [0], [dnl
158 ])
159
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])
163
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
169 ])
170
171 OVN_NBCTL_TEST_STOP
172 AT_CLEANUP