@@ -485,7 +485,7 @@ def check_vxlan_tunnel_map_entry(self, dvs, tunnel_name, vidlist, vnidlist):
485
485
(exitcode , out ) = dvs .runcmd (iplinkcmd )
486
486
assert exitcode == 0 , "Kernel device not created"
487
487
488
- def check_vxlan_sip_tunnel_delete (self , dvs , tunnel_name , sip ):
488
+ def check_vxlan_sip_tunnel_delete (self , dvs , tunnel_name , sip , ignore_bp = True ):
489
489
asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
490
490
app_db = swsscommon .DBConnector (swsscommon .APPL_DB , dvs .redis_sock , 0 )
491
491
@@ -511,36 +511,35 @@ def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip):
511
511
status , fvs = tbl .get (self .tunnel_map_map [tunnel_name ][3 ])
512
512
assert status == False , "SIP Tunnel mapper3 not deleted from ASIC_DB"
513
513
514
- tbl = swsscommon .Table (asic_db , self .ASIC_BRIDGE_PORT )
515
- status , fvs = tbl .get (self .bridgeport_map [sip ])
516
- assert status == False , "Tunnel bridgeport entry not deleted"
514
+ if not ignore_bp :
515
+ tbl = swsscommon .Table (asic_db , self .ASIC_BRIDGE_PORT )
516
+ status , fvs = tbl .get (self .bridgeport_map [sip ])
517
+ assert status == False , "Tunnel bridgeport entry not deleted"
517
518
518
- def check_vxlan_sip_tunnel (self , dvs , tunnel_name , src_ip , vidlist , vnidlist , dst_ip = '0.0.0.0' , skip_dst_ip = 'True' ):
519
+ def check_vxlan_sip_tunnel (self , dvs , tunnel_name , src_ip , vidlist , vnidlist ,
520
+ dst_ip = '0.0.0.0' , skip_dst_ip = 'True' , ignore_bp = True ):
519
521
asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
520
522
app_db = swsscommon .DBConnector (swsscommon .APPL_DB , dvs .redis_sock , 0 )
521
523
522
524
tunnel_map_id = self .helper .get_created_entries (asic_db , self .ASIC_TUNNEL_MAP , self .tunnel_map_ids , 4 )
523
525
tunnel_id = self .helper .get_created_entry (asic_db , self .ASIC_TUNNEL_TABLE , self .tunnel_ids )
524
526
tunnel_term_id = self .helper .get_created_entry (asic_db , self .ASIC_TUNNEL_TERM_ENTRY , self .tunnel_term_ids )
525
- tunnel_map_entry_id = self .helper .get_created_entries (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , self .tunnel_map_entry_ids , 3 )
526
527
527
528
# check that the vxlan tunnel termination are there
528
529
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_MAP ) == (len (self .tunnel_map_ids ) + 4 ), "The TUNNEL_MAP wasn't created"
529
530
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ) == (len (self .tunnel_map_entry_ids ) + 3 ), "The TUNNEL_MAP_ENTRY is created"
530
531
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_TABLE ) == (len (self .tunnel_ids ) + 1 ), "The TUNNEL wasn't created"
531
532
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_TERM_ENTRY ) == (len (self .tunnel_term_ids ) + 1 ), "The TUNNEL_TERM_TABLE_ENTRY wasm't created"
532
533
533
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP , tunnel_map_id [2 ],
534
- {
535
- 'SAI_TUNNEL_MAP_ATTR_TYPE' : 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID' ,
536
- }
537
- )
534
+ expected_attributes_1 = {}
535
+ expected_attributes_1 ['SAI_TUNNEL_MAP_ATTR_TYPE' ] = 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID'
536
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP , expected_attributes_1 )
537
+ assert len (ret ) == 1 , "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
538
+
539
+ expected_attributes_1 ['SAI_TUNNEL_MAP_ATTR_TYPE' ] = 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI'
540
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP , expected_attributes_1 )
541
+ assert len (ret ) == 1 , "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
538
542
539
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP , tunnel_map_id [3 ],
540
- {
541
- 'SAI_TUNNEL_MAP_ATTR_TYPE' : 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI' ,
542
- }
543
- )
544
543
545
544
decapstr = '2:' + tunnel_map_id [0 ] + ',' + tunnel_map_id [2 ]
546
545
encapstr = '2:' + tunnel_map_id [1 ] + ',' + tunnel_map_id [3 ]
@@ -571,15 +570,15 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
571
570
572
571
expected_attributes_1 = {
573
572
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE' : 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VLAN_ID' ,
574
- 'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP' : tunnel_map_id [0 ],
575
573
'SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE' : vidlist [0 ],
576
574
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY' : vnidlist [0 ],
577
575
}
578
576
579
577
for x in range (len (vidlist )):
580
578
expected_attributes_1 ['SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE' ] = vidlist [x ]
581
579
expected_attributes_1 ['SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY' ] = vnidlist [x ]
582
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , tunnel_map_entry_id [x ], expected_attributes_1 )
580
+ self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , expected_attributes_1 )
581
+ assert len (ret ) == 1 , "Unexpected number of tunnel map entries created for VLAN to VNI mapping"
583
582
584
583
expected_siptnl_attributes = {
585
584
'src_ip' : src_ip ,
@@ -593,16 +592,18 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
593
592
assert len (ret ) == 1 , "More than 1 Tunn statetable entry created"
594
593
self .tunnel_appdb [tunnel_name ] = ret [0 ]
595
594
596
- expected_bridgeport_attributes = {
597
- 'SAI_BRIDGE_PORT_ATTR_TYPE' : 'SAI_BRIDGE_PORT_TYPE_TUNNEL' ,
598
- 'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID' : tunnel_id ,
599
- 'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE' : 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE' ,
600
- 'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE' : 'true' ,
601
- }
602
- ret = self .helper .get_key_with_attr (asic_db , self .ASIC_BRIDGE_PORT , expected_bridgeport_attributes )
603
- assert len (ret ) > 0 , "Bridgeport entry not created"
604
- assert len (ret ) == 1 , "More than 1 bridgeport entry created"
605
- self .bridgeport_map [src_ip ] = ret [0 ]
595
+ if not ignore_bp :
596
+ expected_bridgeport_attributes = {
597
+ 'SAI_BRIDGE_PORT_ATTR_TYPE' : 'SAI_BRIDGE_PORT_TYPE_TUNNEL' ,
598
+ 'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID' : tunnel_id ,
599
+ 'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE' : 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE' ,
600
+ 'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE' : 'true' ,
601
+ }
602
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_BRIDGE_PORT , expected_bridgeport_attributes )
603
+ assert len (ret ) > 0 , "Bridgeport entry not created"
604
+ assert len (ret ) == 1 , "More than 1 bridgeport entry created"
605
+ self .bridgeport_map [src_ip ] = ret [0 ]
606
+
606
607
self .tunnel_map_ids .update (tunnel_map_id )
607
608
self .tunnel_ids .add (tunnel_id )
608
609
self .tunnel_term_ids .add (tunnel_term_id )
@@ -797,37 +798,33 @@ def check_vxlan_tunnel_entry(self, dvs, tunnel_name, vnet_name, vni_id):
797
798
def check_vxlan_tunnel_vrf_map_entry (self , dvs , tunnel_name , vrf_name , vni_id ):
798
799
asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
799
800
800
- if (self .tunnel_map_map .get (tunnel_name ) is None ):
801
- tunnel_map_id = self .helper .get_created_entries (asic_db , self .ASIC_TUNNEL_MAP , self .tunnel_map_ids , 4 )
802
- else :
803
- tunnel_map_id = self .tunnel_map_map [tunnel_name ]
804
-
805
801
tunnel_map_entry_id = self .helper .get_created_entries (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , self .tunnel_map_entry_ids , 3 )
806
802
807
803
# check that the vxlan tunnel termination are there
808
804
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ) == (len (self .tunnel_map_entry_ids ) + 3 ), "The TUNNEL_MAP_ENTRY is created too early"
809
805
810
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , tunnel_map_entry_id [ 1 ] ,
806
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ,
811
807
{
812
808
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE' : 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI' ,
813
- 'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP' : tunnel_map_id [3 ],
814
809
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_KEY' : self .vr_map [vrf_name ].get ('ing' ),
815
810
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_VALUE' : vni_id ,
816
811
}
817
812
)
818
813
819
- self .tunnel_map_vrf_entry_ids .update (tunnel_map_entry_id [1 ])
814
+ assert len (ret ) == 1 , "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
815
+
816
+ self .tunnel_map_vrf_entry_ids .update (ret [0 ])
820
817
821
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , tunnel_map_entry_id [ 2 ] ,
818
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ,
822
819
{
823
820
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE' : 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID' ,
824
- 'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP' : tunnel_map_id [2 ],
825
821
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY' : vni_id ,
826
822
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_VALUE' : self .vr_map [vrf_name ].get ('egr' ),
827
823
}
828
824
)
829
825
830
- self .tunnel_map_vrf_entry_ids .update (tunnel_map_entry_id [2 ])
826
+ assert len (ret ) == 1 , "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
827
+ self .tunnel_map_vrf_entry_ids .update (ret [0 ])
831
828
self .tunnel_map_entry_ids .update (tunnel_map_entry_id )
832
829
833
830
def check_vxlan_tunnel_vrf_map_entry_remove (self , dvs , tunnel_name , vrf_name , vni_id ):
0 commit comments