forked from ovn-org/ovn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ovn-northd.at
10824 lines (8844 loc) · 591 KB
/
ovn-northd.at
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AT_BANNER([OVN northd])
# _DUMP_DB_TABLES FILENAME
# Dumps important incremental processing related tables to FILENAME.
# More tables can be added based on CHECK_NO_CHANGE_AFTER_RECOMPUTE's needs.
m4_define([_DUMP_DB_TABLES], [
ovn-nbctl list logical_switch_port > $1
echo ======= >> $1
ovn-sbctl list logical_flow >> $1
ovn-sbctl list port_binding >> $1
ovn-sbctl list address_set >> $1
ovn-sbctl list meter >> $1
ovn-sbctl list meter_band >> $1
ovn-sbctl list port_group >> $1
])
# CHECK_NO_CHANGE_AFTER_RECOMPUTE
# Triggers a northd recompute and compares the DB content of certain tables
# related to incremental processing before and after the recompute, to make
# sure nothing is changed by the recompute. It is used for ensuring the
# correctness of incremental processing.
m4_define([CHECK_NO_CHANGE_AFTER_RECOMPUTE], [
_DUMP_DB_TABLES(before)
check as northd ovn-appctl -t NORTHD_TYPE inc-engine/recompute
check ovn-nbctl --wait=sb sync
_DUMP_DB_TABLES(after)
AT_CHECK([as northd diff before after], [0], [dnl
])
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check from NBDB to SBDB])
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"`
# With the new ha_chassis_group table added, there should be no rows in
# gateway_chassis table in SB DB.
check_row_count Gateway_Chassis 0
# There should be one ha_chassis_group with the name "alice"
check_row_count HA_Chassis_Group 1 name=alice
ha_chgrp_uuid=$(fetch_column HA_Chassis_Group _uuid name=alice)
check_row_count Port_Binding 1 logical_port=cr-alice ha_chassis_group=$ha_chgrp_uuid
ha_ch=$(fetch_column HA_Chassis_Group ha_chassis name=alice)
check_column "$ha_ch" HA_Chassis _uuid
ovn-sbctl list ha_chassis_group
# Delete chassis - gw2 in SB DB.
# ovn-northd should not recreate ha_chassis rows
# repeatedly when gw2 is deleted.
ovn-sbctl chassis-del gw2
ha_ch_list=$(fetch_column HA_Chassis _uuid)
check_column "$ha_ch_list" HA_Chassis _uuid
# Add back the gw2 chassis
ovn-sbctl chassis-add gw2 geneve 1.2.4.8
# delete the 2nd Gateway_Chassis on NBDB for alice port
check_column '' Port_Binding gateway_chassis logical_port=cr-alice
ha_ch=$(fetch_column HA_Chassis_Group ha_chassis)
check_column "$ha_ch" HA_Chassis _uuid
# delete the 2nd Gateway_Chassis on NBDB for alice port
ovn-nbctl --wait=sb set Logical_Router_Port alice gateway_chassis=${nb_gwc1_uuid}
# There should be only 1 row in ha_chassis SB DB table.
check_row_count HA_Chassis 1
check_row_count Gateway_Chassis 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 ha_chassis doesn't exist anymore
check_row_count HA_Chassis 0
check_row_count Gateway_Chassis 0
check_row_count Ha_Chassis_Group 0
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of VIF LSP])
ovn_start
ovn-nbctl ls-add S1
ovn-nbctl --wait=sb lsp-add S1 S1-vm1
wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up!=true'
ovn-sbctl chassis-add hv1 geneve 127.0.0.1
ovn-sbctl lsp-bind S1-vm1 hv1
wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up=true'
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of router LSP linked to a distributed LR])
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 --wait=sb lsp-set-options S1-R1 router-port=R1-S1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of router LSP linked to a gateway LR])
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 --wait=sb 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
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check up state of router LSP linked to an LRP with set Gateway Chassis])
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 --wait=sb lsp-set-options S1-R1 router-port=R1-S1
AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check Logical Router Port hosting-chassis status])
ovn_start
check ovn-sbctl chassis-add ch1 geneve 127.0.0.2
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp1 00:00:00:00:00:01 10.0.0.1/24
check ovn-nbctl ls-add ls1
check ovn-nbctl lsp-add ls1 lsp1 -- \
lsp-set-addresses lsp1 router -- \
lsp-set-type lsp1 router -- \
lsp-set-options lsp1 router-port=lrp1
# Make lrp a cr-port
check ovn-nbctl lrp-set-gateway-chassis lrp1 ch1
check ovn-nbctl --wait=sb sync
wait_row_count Port_Binding 1 logical_port=cr-lrp1 \
options:always-redirect="true" options:distributed-port="lrp1"
# Simulate cr-port being bound to ch1
ch1_uuid=`ovn-sbctl --bare --columns _uuid find Chassis name="ch1"`
check ovn-sbctl set Port_Binding cr-lrp1 chassis=${ch1_uuid}
check ovn-nbctl --wait=sb sync
# Check for the hosting-chassis status being set by northd
wait_row_count nb:Logical_Router_Port 1 name=lrp1 status:hosting-chassis=ch1
# Clear the hosting-chassis status from LRP and assert northd repopulates it
check ovn-nbctl remove logical_router_port lrp1 status hosting-chassis
check ovn-nbctl --wait=sb sync
wait_row_count nb:Logical_Router_Port 1 name=lrp1 status:hosting-chassis=ch1
# Now remove the chassis from the port binding record and assert that the
# hosting-chassis status was removed by northd
check ovn-sbctl clear Port_Binding cr-lrp1 chassis
check ovn-nbctl --wait=sb sync
wait_row_count nb:Logical_Router_Port 0 name=lrp1 status:hosting-chassis=ch1
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check LRP external id propagation to SBDB])
ovn_start
ovn-nbctl lr-add ro
ovn-nbctl lrp-add ro lrp0 00:00:00:00:00:01 192.168.1.1/24
ovn-nbctl --wait=sb set logical_router_port lrp0 external_ids=test=123
check_column "test=123" sb:Port_Binding external_ids logical_port=lrp0
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check IPv6 RA config propagation to SBDB])
ovn_start
ovn-nbctl lr-add ro
ovn-nbctl lrp-add ro ro-sw 00:00:00:00:00:01 aef0:0:0:0:0:0:0:1/64
ovn-nbctl ls-add sw
ovn-nbctl lsp-add sw sw-ro
ovn-nbctl lsp-set-type sw-ro router
ovn-nbctl lsp-set-options sw-ro router-port=ro-sw
ovn-nbctl lsp-set-addresses sw-ro 00:00:00:00:00:01
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:send_periodic=true
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=slaac
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:mtu=1280
uuid=$(ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=ro-sw)
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_send_periodic],
[0], ["true"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_address_mode],
[0], [slaac
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[0], ["600"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[0], ["200"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_mtu],
[0], ["1280"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_eth],
[0], ["00:00:00:00:00:01"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_addr],
[0], ["fe80::200:ff:fe00:1"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_prefixes],
[0], ["aef0::/64"
])
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=300
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=600
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[0], ["300"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[0], ["225"
])
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=300
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=250
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[0], ["300"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[0], ["225"
])
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=0
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=0
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[0], ["4"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[0], ["3"
])
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=3600
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=2400
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[0], ["1800"
])
AT_CHECK([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[0], ["1350"
])
ovn-nbctl --wait=sb set Logical_Router_port ro-sw ipv6_ra_configs:send_periodic=false
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_send_periodic],
[1], [], [ovn-sbctl: no key "ipv6_ra_send_periodic" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval],
[1], [], [ovn-sbctl: no key "ipv6_ra_max_interval" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval],
[1], [], [ovn-sbctl: no key "ipv6_ra_min_interval" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_mtu],
[1], [], [ovn-sbctl: no key "ipv6_ra_mtu" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_address_mode],
[1], [], [ovn-sbctl: no key "ipv6_ra_address_mode" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_eth],
[1], [], [ovn-sbctl: no key "ipv6_ra_src_eth" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_addr],
[1], [], [ovn-sbctl: no key "ipv6_ra_src_addr" in Port_Binding record "${uuid}" column options
])
AT_CHECK_UNQUOTED([ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_prefixes],
[1], [], [ovn-sbctl: no key "ipv6_ra_prefixes" in Port_Binding record "${uuid}" column options
])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([test unixctl])
ovn_init_db ovn-sb; ovn-sbctl init
ovn_init_db ovn-nb; ovn-nbctl init
# test unixctl option
mkdir "$ovs_base"/northd
as northd start_daemon NORTHD_TYPE --unixctl="$ovs_base"/northd/NORTHD_TYPE[].ctl --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock
ovn-nbctl ls-add sw
ovn-nbctl --wait=sb lsp-add sw p1
# northd created with unixctl option successfully created port_binding entry
check_row_count Port_Binding 1 logical_port=p1
AT_CHECK([ovn-nbctl --wait=sb lsp-del p1])
# ovs-appctl exit with unixctl option
OVS_APP_EXIT_AND_WAIT_BY_TARGET(["$ovs_base"/northd/]NORTHD_TYPE[.ctl], ["$ovs_base"/northd/]NORTHD_TYPE[.pid])
# Check no port_binding entry for new port as ovn-northd is not running
#
# 142 is 128+14, the exit status that the shell reports when a
# process exits due to SIGARLM (signal 14).
ovn-nbctl lsp-add sw p2
AT_CHECK([ovn-nbctl --timeout=10 --wait=sb sync], [142], [], [ignore])
check_row_count Port_Binding 0 logical_port=p2
# test default unixctl path
as northd start_daemon NORTHD_TYPE --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock
ovn-nbctl --wait=sb lsp-add sw p3
# northd created with default unixctl path successfully created port_binding entry
check_row_count Port_Binding 1 logical_port=p3
as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check HA_Chassis_Group propagation from NBDB to SBDB])
ovn_start
check ovn-nbctl --wait=sb ha-chassis-group-add hagrp1
# ovn-northd should not create HA chassis group and HA chassis rows
# unless the HA chassis group in OVN NB DB is associated to
# a logical router port or logical port of type external.
check_row_count HA_Chassis_Group 0 name=hagrp1
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10
# There should be no HA_Chassis rows in SB DB.
check_row_count HA_Chassis 0
# Add chassis ch1.
check ovn-sbctl chassis-add ch1 geneve 127.0.0.2
wait_row_count Chassis 1 name=ch1
# There should be no HA_Chassis rows
check_row_count HA_Chassis 0
# Create a logical router port and attach ha chassis group.
check ovn-nbctl lr-add lr0
check ovn-nbctl --wait=sb lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24
hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1`
echo "hagrp1_uuid=$hagrp1_uuid"
check ovn-nbctl --wait=sb set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid
wait_row_count HA_Chassis_Group 1 name=hagrp1
check_row_count HA_Chassis 3
# ovn-northd has a weird history regarding HA_Chassis and missing
# Chassis records, see commit f879850b5f2c ("ovn-northd: Fix the
# HA_Chassis sync issue in OVN SB DB").
#
# Make sure that ovn-northd doesn't recreate the ha_chassis
# records if the chassis record is missing in SB DB.
ha_ch_list=$(fetch_column HA_Chassis _uuid)
check_column "$ha_ch_list" HA_Chassis _uuid
# 2 HA chassis should be created with 'chassis' column empty because
# we have not added hv1 and hv2 chassis to the SB DB.
check_row_count HA_Chassis 2 'chassis=[[]]'
# We should have 1 ha chassis with 'chassis' column set for hv1
check_row_count HA_Chassis 1 'chassis!=[[]]'
# Create another logical router port and associate to the same ha_chasis_group
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:14 182.168.0.100/24
check ovn-nbctl set logical_router_port lr1-public ha_chassis_group=$hagrp1_uuid
# We should still have 1 HA chassis group and 3 HA chassis in SB DB.
wait_row_count HA_Chassis_Group 1 name=hagrp1
check_row_count HA_Chassis 3
# Change the priority of ch1 - ha chassis in NB DB. It should get
# reflected in SB DB.
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 100
wait_row_count HA_Chassis 1 priority=100
# Delete ch1 HA chassis in NB DB.
ovn-nbctl --wait=sb ha-chassis-group-remove-chassis hagrp1 ch1
wait_row_count HA_Chassis 2
# Add back the ha chassis
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 40
wait_row_count HA_Chassis 3
# Delete lr0-public. We should still have 1 HA chassis group and
# 3 HA chassis in SB DB.
ovn-nbctl --wait=sb lrp-del lr0-public
wait_row_count HA_Chassis_Group 1 name=hagrp1
wait_row_count HA_Chassis 3
# Delete lr1-public. There should be no HA chassis group in SB DB.
ovn-nbctl --wait=sb lrp-del lr1-public
wait_row_count HA_Chassis_Group 0 name=hagrp1
wait_row_count HA_Chassis 0
# Add lr0-public again
ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24
ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid
wait_row_count HA_Chassis_Group 1 name=hagrp1
wait_row_count HA_Chassis 3
# Create a Gateway chassis. ovn-northd should ignore this.
check ovn-nbctl --wait=sb lrp-set-gateway-chassis lr0-public ch1 20
# There should be only 1 HA chassis group in SB DB with the
# name hagrp1.
wait_row_count HA_Chassis_Group 1
wait_row_count HA_Chassis_Group 1 name=hagrp1
wait_row_count HA_Chassis 3
# Now delete HA chassis group. ovn-northd should create HA chassis group
# with the Gateway chassis name
ovn-nbctl clear logical_router_port lr0-public ha_chassis_group
ovn-nbctl ha-chassis-group-del hagrp1
wait_row_count HA_Chassis_Group 0 name=hagrp1
wait_row_count HA_Chassis_Group 1 name=lr0-public
wait_row_count HA_Chassis 1
ovn-nbctl lrp-set-gateway-chassis lr0-public ch2 10
wait_row_count HA_Chassis_Group 1 name=lr0-public
ovn-sbctl --bare --columns _uuid find ha_chassis
wait_row_count HA_Chassis 2
# Test if 'ref_chassis' column is properly set or not in
# SB DB ha_chassis_group.
check ovn-nbctl ls-add sw0
check ovn-nbctl lsp-add sw0 sw0-p1
check ovn-sbctl chassis-add ch2 geneve 127.0.0.3
check ovn-sbctl chassis-add ch3 geneve 127.0.0.4
check ovn-sbctl chassis-add comp1 geneve 127.0.0.5
check ovn-sbctl chassis-add comp2 geneve 127.0.0.6
check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24
check ovn-nbctl lsp-add sw0 sw0-lr0
check ovn-nbctl lsp-set-type sw0-lr0 router
check ovn-nbctl lsp-set-addresses sw0-lr0 router
check ovn-nbctl --wait=sb lsp-set-options sw0-lr0 router-port=lr0-sw0
ovn-sbctl lsp-bind sw0-p1 comp1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true
comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1)
comp2_ch_uuid=$(fetch_column Chassis _uuid name=comp2)
ch2_ch_uuid=$comp1_ch_uuid
# Check ref_chassis.
echo "comp1_ch_uuid = $comp1_ch_uuid"
wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis
# unbind sw0-p1
ovn-sbctl lsp-unbind sw0-p1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=false
wait_column "" HA_Chassis_Group ref_chassis
# Bind sw0-p1 in comp2
ovn-sbctl lsp-bind sw0-p1 comp2
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis
ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lr-add lr1
ovn-nbctl lrp-add lr1 lr1-sw1 00:00:20:20:12:15 20.0.0.1/24
ovn-nbctl lsp-add sw1 sw1-lr1
ovn-nbctl lsp-set-type sw1-lr1 router
ovn-nbctl lsp-set-addresses sw1-lr1 router
check ovn-nbctl --wait=sb lsp-set-options sw1-lr1 router-port=lr1-sw1
# Bind sw1-p1 in comp1.
check ovn-sbctl lsp-bind sw1-p1 comp1
# Wait until sw1-p1 is up
wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=true
# sw1-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis'
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis
# Now attach sw0 to lr1
check ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24
check ovn-nbctl lsp-add sw0 sw0-lr1
check ovn-nbctl lsp-set-type sw0-lr1 router
check ovn-nbctl lsp-set-addresses sw0-lr1 router
check ovn-nbctl --wait=sb lsp-set-options sw0-lr1 router-port=lr1-sw0
# Both comp1 and comp2 should be in 'ref_chassis' as sw1 is indirectly
# connected to lr0
exp_ref_ch_list="$comp1_ch_uuid $comp2_ch_uuid"
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis
# Unind sw1-p1. comp2 should not be in the ref_chassis.
ovn-sbctl lsp-unbind sw1-p1
wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=false
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis
# Create sw2 and attach it to lr2
check ovn-nbctl ls-add sw2
check ovn-nbctl lsp-add sw2 sw2-p1
check ovn-nbctl lr-add lr2
check ovn-nbctl lrp-add lr2 lr2-sw2 00:00:20:20:12:17 30.0.0.1/24
check ovn-nbctl lsp-add sw2 sw2-lr2
check ovn-nbctl lsp-set-type sw2-lr2 router
check ovn-nbctl lsp-set-addresses sw2-lr2 router
check ovn-nbctl --wait=sb lsp-set-options sw2-lr2 router-port=lr2-sw2
# Bind sw2-p1 to comp1
check ovn-sbctl lsp-bind sw2-p1 comp1
# Wait until sw2-p1 is up
wait_row_count nb:Logical_Switch_Port 1 name=sw2-p1 up=true
# sw2-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis'
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis
# Now attach sw1 to lr2. With this sw2-p1 is indirectly connected to lr0.
check ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24
check ovn-nbctl lsp-add sw1 sw1-lr2
check ovn-nbctl lsp-set-type sw1-lr2 router
check ovn-nbctl lsp-set-addresses sw1-lr2 router
check ovn-nbctl --wait=sb lsp-set-options sw1-lr2 router-port=lr2-sw1
# sw2-p1 is indirectly connected to lr0. So comp1 (and comp2) should be in
# 'ref_chassis'
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis
# Create sw0-p2 and bind it to comp1
check ovn-nbctl --wait=sb lsp-add sw0 sw0-p2
ovn-sbctl lsp-bind sw0-p2 comp1
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=true
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis
# unbind sw0-p2
ovn-sbctl lsp-unbind sw0-p2
wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=false
wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis
# Delete lr1-sw0. comp1 should be deleted from ref_chassis as there is no link
# from sw1 and sw2 to lr0.
check ovn-nbctl lrp-del lr1-sw0
wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis
# Delete one of the gateway chassises making the ha_chassis_group has only one
# chassis. In this case ref_chassis field should be empty for this
# ha_chassis_group. (ref_chassis is calculated only if there are more than 1
# chassises in the ha_chassis_group.
check ovn-nbctl --wait=sb lrp-del-gateway-chassis lr0-public ch2
wait_column "" HA_Chassis_Group ref_chassis
# Set redirect-chassis option to lr0-public. It should be ignored
# (because redirect-chassis is obsolete).
check ovn-nbctl set logical_router_port lr0-public options:redirect-chassis=ch1
wait_row_count HA_Chassis_Group 1
wait_row_count HA_Chassis_Group 1 name=lr0-public
wait_row_count HA_Chassis 1
# Delete the gateway chassis.
check ovn-nbctl clear logical_router_port lr0-public gateway_chassis
wait_row_count HA_Chassis_Group 0
check_row_count HA_Chassis 0
# Delete old sw0.
check ovn-nbctl --wait=sb ls-del sw0
# Create external logical ports and associate ha_chassis_group
check ovn-nbctl ls-add sw0
check ovn-nbctl lsp-add sw0 sw0-pext1
check ovn-nbctl lsp-add sw0 sw0-pext2
check ovn-nbctl lsp-add sw0 sw0-p1
check ovn-nbctl lsp-set-addresses sw0-pext1 "00:00:00:00:00:03 10.0.0.3"
check ovn-nbctl lsp-set-addresses sw0-pext2 "00:00:00:00:00:03 10.0.0.4"
check ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:03 10.0.0.5"
check ovn-nbctl --wait=sb ha-chassis-group-add hagrp1
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20
check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10
# ovn-northd should not create HA chassis group and HA chassis rows
# unless the HA chassis group in OVN NB DB is associated to
# a logical router port or logical port of type external.
wait_row_count HA_Chassis_Group 0
check_row_count HA_Chassis 0
hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group \
name=hagrp1`
# The type of the lsp - sw0-pext1 is still not set to external.
# So ha_chassis_group should be ignored.
ovn-nbctl set logical_switch_port sw0-pext1 ha_chassis_group=$hagrp1_uuid
wait_row_count HA_Chassis_Group 0 name=hagrp1
check_row_count HA_Chassis 0
# Set the type of sw0-pext1 to external
ovn-nbctl lsp-set-type sw0-pext1 external
wait_row_count HA_Chassis_Group 1 name=hagrp1
check_row_count HA_Chassis 3
sb_hagrp1_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group \
name=hagrp1`
check_row_count Port_Binding 1 logical_port=sw0-pext1 ha_chassis_group=$sb_hagrp1_uuid
# Set the type of sw0-pext2 to external and associate ha_chassis_group
ovn-nbctl lsp-set-type sw0-pext2 external
ovn-nbctl set logical_switch_port sw0-pext2 ha_chassis_group=$hagrp1_uuid
wait_row_count HA_Chassis_Group 1 name=hagrp1
check_row_count HA_Chassis 3
check_row_count Port_Binding 1 logical_port=sw0-pext1 ha_chassis_group=$sb_hagrp1_uuid
wait_row_count Port_Binding 1 logical_port=sw0-pext2 ha_chassis_group=$sb_hagrp1_uuid
# sw0-p1 is a normal port. So ha_chassis_group should not be set
# in port_binding.
ovn-nbctl --wait=sb set logical_switch_port sw0-p1 \
ha_chassis_group=$hagrp1_uuid
wait_row_count Port_Binding 0 logical_port=sw0-p1 'chassis!=[[]]'
# Clear ha_chassis_group for sw0-pext1
check ovn-nbctl --wait=sb clear logical_switch_port sw0-pext1 ha_chassis_group
wait_row_count Port_Binding 0 logical_port=sw0-pext1 'chassis!=[[]]'
wait_row_count HA_Chassis_Group 1 name=hagrp1
wait_row_count HA_Chassis 3
AS_BOX([Clear ha_chassis_group for sw0-pext2 and reset port type to normal in the same txn])
check ovn-nbctl --wait=sb clear logical_switch_port sw0-pext2 \
ha_chassis_group -- set logical_switch_port sw0-pext2 'type=""'
wait_row_count HA_Chassis_Group 0
wait_row_count Port_Binding 0 logical_port=sw0-pext2 'chassis!=[[]]'
check_row_count HA_Chassis 0
as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([ovn-northd pause and resume])
# By starting the backup northd paused, we ensure that the primary
# northd is active; otherwise, there's a race. (We also test that
# the ovn-northd --dry-run option works.)
ovn_start --backup-northd=paused
get_northd_status() {
as northd ovn-appctl -t NORTHD_TYPE is-paused
as northd ovn-appctl -t NORTHD_TYPE status
as northd-backup ovn-appctl -t NORTHD_TYPE is-paused
as northd-backup ovn-appctl -t NORTHD_TYPE status
}
AS_BOX([Check that the backup is paused])
OVS_WAIT_FOR_OUTPUT([get_northd_status], [0], [false
Status: active
true
Status: paused
])
AS_BOX([Resume the backup])
check as northd-backup ovs-appctl -t NORTHD_TYPE resume
OVS_WAIT_FOR_OUTPUT([get_northd_status], [0], [false
Status: active
false
Status: standby
])
AS_BOX([Check that ovn-northd is active])
# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
check_row_count Datapath_Binding 0
check ovn-nbctl --wait=sb ls-add sw0
check_row_count Datapath_Binding 1
check ovn-nbctl --wait=sb ls-del sw0
check_row_count Datapath_Binding 0
AS_BOX([Pause the main northd])
check as northd ovs-appctl -t NORTHD_TYPE pause
check as northd-backup ovs-appctl -t NORTHD_TYPE pause
AT_CHECK([get_northd_status], [0], [true
Status: paused
true
Status: paused
])
AS_BOX([Verify that ovn-northd is paused])
# Now ovn-northd won't respond by adding a datapath, because it's paused.
check ovn-nbctl ls-add sw0
check sleep 5
check_row_count Datapath_Binding 0
# Do not resume both main and backup right after each other
# as there would be no guarentee of which one would become active
AS_BOX([Resume the main northd])
check as northd ovs-appctl -t NORTHD_TYPE resume
OVS_WAIT_FOR_OUTPUT([get_northd_status], [0], [false
Status: active
true
Status: paused
])
AS_BOX([Resume the backup northd])
check as northd-backup ovs-appctl -t NORTHD_TYPE resume
OVS_WAIT_FOR_OUTPUT([get_northd_status], [0], [false
Status: active
false
Status: standby
])
check ovn-nbctl --wait=sb sync
check_row_count Datapath_Binding 1
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([ovn-northd restart])
ovn_start --backup-northd=none
# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
check_row_count Datapath_Binding 0
check ovn-nbctl --wait=sb ls-add sw0
check_row_count Datapath_Binding 1
# Kill northd.
as northd
OVS_APP_EXIT_AND_WAIT([NORTHD_TYPE])
# With ovn-northd gone, changes to nbdb won't be reflected into sbdb.
# Make sure.
check ovn-nbctl ls-add sw1
sleep 5
check_row_count Datapath_Binding 1
# Now resume ovn-northd. Changes should catch up.
ovn_start_northd primary
wait_row_count Datapath_Binding 2
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([northbound database reconnection])
ovn_start --backup-northd=none
# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
check_row_count Datapath_Binding 0
check ovn-nbctl --wait=sb ls-add sw0
check_row_count Datapath_Binding 1
dp1=$(fetch_column Datapath_Binding _uuid external_ids:name=sw0)
# Make nbdb ovsdb-server drop connection from ovn-northd.
conn=$(as ovn-nb ovs-appctl -t ovsdb-server ovsdb-server/list-remotes|grep ^punix)
check as ovn-nb ovs-appctl -t ovsdb-server ovsdb-server/remove-remote "$conn"
conn2=punix:`pwd`/special.sock
check as ovn-nb ovs-appctl -t ovsdb-server ovsdb-server/add-remote "$conn2"
# ovn-northd won't respond to changes (because the nbdb connection dropped).
check ovn-nbctl --db="${conn2#p}" ls-add sw1
sleep 5
check_row_count Datapath_Binding 1
# Now re-enable the nbdb connection and observe ovn-northd catch up.
check as ovn-nb ovs-appctl -t ovsdb-server ovsdb-server/add-remote "$conn"
wait_row_count Datapath_Binding 2
dp2=$(fetch_column Datapath_Binding _uuid external_ids:name=sw1)
wait_column "$dp1 $dp2" Logical_DP_Group datapaths
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([southbound database reconnection])
ovn_start --backup-northd=none
# Check that ovn-northd is active, by verifying that it creates and
# destroys southbound datapaths as one would expect.
check_row_count Datapath_Binding 0
check ovn-nbctl --wait=sb ls-add sw0
check_row_count Datapath_Binding 1
dp1=$(fetch_column Datapath_Binding _uuid external_ids:name=sw0)
# Make sbdb ovsdb-server drop connection from ovn-northd.
conn=$(as ovn-sb ovs-appctl -t ovsdb-server ovsdb-server/list-remotes|grep ^punix)
check as ovn-sb ovs-appctl -t ovsdb-server ovsdb-server/remove-remote "$conn"
conn2=punix:`pwd`/special.sock
check as ovn-sb ovs-appctl -t ovsdb-server ovsdb-server/add-remote "$conn2"
# ovn-northd can't respond to changes (because the sbdb connection dropped).
check ovn-nbctl ls-add sw1
sleep 5
OVN_SB_DB=${conn2#p} check_row_count Datapath_Binding 1
# Now re-enable the sbdb connection and observe ovn-northd catch up.
#
# It's important to check both Datapath_Binding and Logical_Flow.
check as ovn-sb ovs-appctl -t ovsdb-server ovsdb-server/add-remote "$conn"
wait_row_count Datapath_Binding 2
dp2=$(fetch_column Datapath_Binding _uuid external_ids:name=sw1)
wait_column "$dp1 $dp2" Logical_DP_Group datapaths
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check Redirect Chassis propagation from NB to SB])
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 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
check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1
ovn-nbctl lrp-set-redirect-type R1-S1 bridged
wait_row_count Port_Binding 1 logical_port=cr-R1-S1 options:redirect-type=bridged
ovn-nbctl lrp-set-redirect-type R1-S1 overlay
wait_row_count Port_Binding 1 logical_port=cr-R1-S1 options:redirect-type=overlay
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check stateless dnat_and_snat rule])
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 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
check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1
check_flow_matches() {
local regex=$1 count=$2
local found=$(grep -c "$1" r1-flows)
echo "checking for $count flows matching $regex... found $found"
AT_FAIL_IF([test $found != $count])
}
check_flow_match_sets() {
ovn-sbctl dump-flows R1 > r1-flows
AT_CAPTURE_FILE([r1-flows])
for regex in lr_in_unsnat ct_snat ct_dnat ip4.dst= ip4.src= ip6.dst= ip6.src=; do
check_flow_matches $regex $1
shift
done
}
echo
echo "IPv4: stateful"
ovn-nbctl --wait=sb lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11
check_flow_match_sets 2 2 2 0 0 0 0
ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1
echo
echo "IPv4: stateless"
ovn-nbctl --wait=sb --stateless lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11
check_flow_match_sets 2 0 0 1 1 0 0
ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1
echo
echo "IPv6: stateful"
ovn-nbctl --wait=sb lr-nat-add R1 dnat_and_snat fd01::1 fd11::2
check_flow_match_sets 2 2 2 0 0 0 0
ovn-nbctl lr-nat-del R1 dnat_and_snat fd01::1
echo
echo "IPv6: stateless"
ovn-nbctl --wait=sb --stateless lr-nat-add R1 dnat_and_snat fd01::1 fd11::2
check_flow_match_sets 2 0 0 0 0 1 1
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD_NO_HV([
AT_SETUP([check portrange dnat, snat and dnat_and_snat rules])
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