forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathovn-sbctl.at
More file actions
98 lines (82 loc) · 3.09 KB
/
Copy pathovn-sbctl.at
File metadata and controls
98 lines (82 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
AT_BANNER([ovn_controller_gw])
# OVN_SBCTL_TEST_START
m4_define([OVN_SBCTL_TEST_START],
[OVS_RUNDIR=`pwd`; export OVS_RUNDIR
OVS_LOGDIR=`pwd`; export OVS_LOGDIR
OVS_DBDIR=`pwd`; export OVS_DBDIR
OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
dnl Create databases (ovn-nb, ovn-sb).
for daemon in ovn-nb ovn-sb; do
AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon%%-*}/${daemon}.ovsschema])
done
dnl Start ovsdb-server.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock ovn-nb.db ovn-sb.db], [0], [], [stderr])
ON_EXIT_UNQUOTED([kill `cat ovsdb-server.pid`])
AT_CHECK([[sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
AT_CAPTURE_FILE([ovsdb-server.log])
dnl Start ovn-northd.
AT_CHECK([ovn-northd --detach --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
ON_EXIT_UNQUOTED([kill `cat ovn-northd.pid`])
AT_CHECK([[sed < stderr '
/vlog|INFO|opened log file/d']])
AT_CAPTURE_FILE([ovn-northd.log])
])
# OVN_SBCTL_TEST_STOP
m4_define([OVN_SBCTL_TEST_STOP],
[AT_CHECK([check_logs $1])
AT_CHECK([ovs-appctl -t ovn-northd exit])
AT_CHECK([ovs-appctl -t ovsdb-server exit])])
# ovn-sbctl test.
AT_SETUP([ovn-sbctl - test])
OVN_SBCTL_TEST_START
AT_CHECK([ovn-nbctl lswitch-add br-test])
AT_CHECK([ovn-nbctl lport-add br-test vif0])
AT_CHECK([ovn-nbctl lport-set-macs vif0 f0:ab:cd:ef:01:02])
AT_CHECK([ovn-sbctl chassis-add ch0 stt 1.2.3.5])
AT_CHECK([ovn-sbctl lport-bind vif0 ch0])
AT_CHECK([ovn-sbctl show], [0], [dnl
Chassis "ch0"
Encap stt
ip: "1.2.3.5"
Port_Binding "vif0"
])
# adds another 'vif1'
AT_CHECK([ovn-nbctl lport-add br-test vif1])
AT_CHECK([ovn-nbctl lport-set-macs vif1 f0:ab:cd:ef:01:03])
AT_CHECK([ovn-sbctl lport-bind vif1 ch0])
AT_CHECK([ovn-sbctl show | sed 's/vif[[0-9]]/vif/'], [0], [dnl
Chassis "ch0"
Encap stt
ip: "1.2.3.5"
Port_Binding "vif"
Port_Binding "vif"
])
# deletes 'vif1'
AT_CHECK([ovn-nbctl lport-del vif1])
AT_CHECK([ovn-sbctl show], [0], [dnl
Chassis "ch0"
Encap stt
ip: "1.2.3.5"
Port_Binding "vif0"
])
uuid=$(ovn-sbctl --columns=_uuid list Chassis ch0 | cut -d ':' -f2 | tr -d ' ')
AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,chassis list Port_Binding], [0], [dnl
logical_port : "vif0"
mac : [["f0:ab:cd:ef:01:02"]]
chassis : ${uuid}
])
# test the passing down of logical port type and options.
AT_CHECK([ovn-nbctl lport-add br-test vtep0])
AT_CHECK([ovn-nbctl lport-set-type vtep0 vtep])
AT_CHECK([ovn-nbctl lport-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0])
OVS_WAIT_UNTIL([test -n "`ovn-sbctl --columns=logical_port list Port_Binding | grep vtep0`" ])
AT_CHECK_UNQUOTED([ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0], [0], [dnl
logical_port : "vtep0"
mac : [[]]
type : vtep
options : {vtep_logical_switch="l0", vtep_physical_switch="p0"}
])
OVN_SBCTL_TEST_STOP
AT_CLEANUP