summaryrefslogtreecommitdiff
path: root/tests/ovn-northd.at
blob: 954e2594210ee37a7e9cba6d273e9d561be0fd9e (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
AT_BANNER([OVN northd])
AT_SETUP([ovn -- check Gateway_Chassis propagation from NBDB to SBDB])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-nbctl create Logical_Router name=R1
ovn-sbctl chassis-add gw1 geneve 127.0.0.1
ovn-sbctl chassis-add gw2 geneve 1.2.4.8

# Connect alice to R1 as distributed router gateway port on hv2
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24

ovn-nbctl --wait=sb \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=20 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=10 -- \
    set Logical_Router_Port alice 'gateway_chassis=[@gc0,@gc1]'

nb_gwc1_uuid=`ovn-nbctl --bare --columns _uuid find Gateway_Chassis name="alice_gw1"`
gwc1_uuid=`ovn-sbctl --bare --columns _uuid find Gateway_Chassis name="alice_gw1"`
gwc2_uuid=`ovn-sbctl --bare --columns _uuid find Gateway_Chassis name="alice_gw2"`


echo "Port_Binding for cr-alice:"
ovn-sbctl find port_binding logical_port="cr-alice"
echo "Gateway_Chassis list:"
ovn-sbctl list Gateway_Chassis

AT_CHECK([ovn-sbctl --bare --columns gateway_chassis find port_binding logical_port="cr-alice" | grep $gwc1_uuid | wc -l], [0], [1
])
AT_CHECK([ovn-sbctl --bare --columns gateway_chassis find port_binding logical_port="cr-alice" | grep $gwc2_uuid | wc -l], [0], [1
])

# delete the 2nd Gateway_Chassis on NBDB for alice port

ovn-nbctl --wait=sb set Logical_Router_Port alice gateway_chassis=${nb_gwc1_uuid}

gwc1_uuid=`ovn-sbctl --bare --columns _uuid find Gateway_Chassis name="alice_gw1"`

AT_CHECK([ovn-sbctl --bare --columns gateway_chassis find port_binding logical_port="cr-alice" | grep $gwc1_uuid | wc -l], [0], [1
])

AT_CHECK([ovn-sbctl find Gateway_Chassis name=alice_gw2], [0], [])

# delete all the gateway_chassis on NBDB for alice port

ovn-nbctl --wait=sb clear Logical_Router_Port alice gateway_chassis

# expect that the Gateway_Chassis doesn't exist anymore

AT_CHECK([ovn-sbctl find Gateway_Chassis name=alice_gw1], [0], [])
AT_CHECK([ovn-sbctl find Gateway_Chassis name=alice_gw2], [0], [])

AT_CLEANUP

AT_SETUP([ovn -- check Gateway_Chassis propagation from NBDB to SBDB backwards compatibility])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-nbctl create Logical_Router name=R1
ovn-sbctl chassis-add gw1 geneve 127.0.0.1
ovn-sbctl chassis-add gw2 geneve 1.2.4.8

ovn-nbctl --wait=sb lrp-add R1 bob 00:00:02:01:02:03 172.16.1.1/24 \
    -- set Logical_Router_Port bob options:redirect-chassis="gw1"


# It should be converted to Gateway_Chassis entries in SBDB, and
# still redirect-chassis is kept for backwards compatibility

gwc1_uuid=`ovn-sbctl --bare --columns _uuid find Gateway_Chassis name="bob_gw1"`

AT_CHECK([ovn-sbctl --bare --columns gateway_chassis find port_binding logical_port="cr-bob" | grep $gwc1_uuid | wc -l], [0], [1
])

ovn-nbctl --wait=sb remove Logical_Router_Port bob options redirect-chassis

# expect that the Gateway_Chassis doesn't exist anymore

AT_CHECK([ovn-sbctl find Gateway_Chassis name=bob_gw1], [0], [])

AT_CLEANUP

AT_SETUP([ovn -- check up state of VIF LSP])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-vm1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xdown])

ovn-sbctl chassis-add hv1 geneve 127.0.0.1
ovn-sbctl lsp-bind S1-vm1 hv1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xup])

AT_CLEANUP

AT_SETUP([ovn -- check up state of router LSP linked to a distributed LR])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01
ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])

AT_CLEANUP

AT_SETUP([ovn -- check up state of router LSP linked to a gateway LR])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl create Logical_Router name=R1 options:chassis=gw1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01
ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1

ovn-sbctl lsp-bind S1-R1 gw1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])

AT_CLEANUP

AT_SETUP([ovn -- check up state of router LSP linked to an LRP with set Gateway Chassis])
AT_SKIP_IF([test $HAVE_PYTHON = no])
ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 router
ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])

AT_CLEANUP