@@ -530,17 +530,15 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
530
530
assert self .helper .how_many_entries_exist (asic_db , self .ASIC_TUNNEL_TABLE ) == (len (self .tunnel_ids ) + 1 ), "The TUNNEL wasn't created"
531
531
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
532
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
- )
533
+ expected_attributes_1 = {}
534
+ expected_attributes_1 ['SAI_TUNNEL_MAP_ATTR_TYPE' ] = 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID'
535
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP , expected_attributes_1 )
536
+ assert len (ret ) == 1 , "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
537
+
538
+ expected_attributes_1 ['SAI_TUNNEL_MAP_ATTR_TYPE' ] = 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI'
539
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP , expected_attributes_1 )
540
+ assert len (ret ) == 1 , "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
538
541
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
542
545
543
decapstr = '2:' + tunnel_map_id [0 ] + ',' + tunnel_map_id [2 ]
546
544
encapstr = '2:' + tunnel_map_id [1 ] + ',' + tunnel_map_id [3 ]
@@ -571,15 +569,15 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
571
569
572
570
expected_attributes_1 = {
573
571
'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
572
'SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE' : vidlist [0 ],
576
573
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY' : vnidlist [0 ],
577
574
}
578
575
579
576
for x in range (len (vidlist )):
580
577
expected_attributes_1 ['SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE' ] = vidlist [x ]
581
578
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 )
579
+ self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , expected_attributes_1 )
580
+ assert len (ret ) == 1 , "Unexpected number of tunnel map entries created for VLAN to VNI mapping"
583
581
584
582
expected_siptnl_attributes = {
585
583
'src_ip' : src_ip ,
@@ -807,27 +805,28 @@ def check_vxlan_tunnel_vrf_map_entry(self, dvs, tunnel_name, vrf_name, vni_id):
807
805
# check that the vxlan tunnel termination are there
808
806
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
807
810
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , tunnel_map_entry_id [ 1 ] ,
808
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ,
811
809
{
812
810
'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
811
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_KEY' : self .vr_map [vrf_name ].get ('ing' ),
815
812
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_VALUE' : vni_id ,
816
813
}
817
814
)
818
815
819
- self .tunnel_map_vrf_entry_ids .update (tunnel_map_entry_id [1 ])
816
+ assert len (ret ) == 1 , "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
817
+
818
+ self .tunnel_map_vrf_entry_ids .update (ret [0 ])
820
819
821
- self .helper .check_object (asic_db , self .ASIC_TUNNEL_MAP_ENTRY , tunnel_map_entry_id [ 2 ] ,
820
+ ret = self .helper .get_key_with_attr (asic_db , self .ASIC_TUNNEL_MAP_ENTRY ,
822
821
{
823
822
'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
823
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY' : vni_id ,
826
824
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_VALUE' : self .vr_map [vrf_name ].get ('egr' ),
827
825
}
828
826
)
829
827
830
- self .tunnel_map_vrf_entry_ids .update (tunnel_map_entry_id [2 ])
828
+ assert len (ret ) == 1 , "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
829
+ self .tunnel_map_vrf_entry_ids .update (ret [0 ])
831
830
self .tunnel_map_entry_ids .update (tunnel_map_entry_id )
832
831
833
832
def check_vxlan_tunnel_vrf_map_entry_remove (self , dvs , tunnel_name , vrf_name , vni_id ):
0 commit comments