@@ -103,7 +103,7 @@ def check_object(db, table, key, expected_attributes):
103103 (value , name , expected_attributes [name ])
104104
105105
106- def create_nvgre_tunnel (dvs , tunnel_name , src_ip , tunnel_ids , tunnel_map_ids ):
106+ def create_nvgre_tunnel (dvs , tunnel_name , src_ip , tunnel_ids , tunnel_map_ids , loopback_id ):
107107 asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
108108 conf_db = swsscommon .DBConnector (swsscommon .CONFIG_DB , dvs .redis_sock , 0 )
109109
@@ -116,19 +116,6 @@ def create_nvgre_tunnel(dvs, tunnel_name, src_ip, tunnel_ids, tunnel_map_ids):
116116
117117 create_entry_tbl (conf_db , NVGRE_TUNNEL , '|' , tunnel_name , attrs )
118118
119-
120- def remove_nvgre_tunnel (dvs , tunnel_name , tunnel_ids , tunnel_map_ids ):
121- conf_db = swsscommon .DBConnector (swsscommon .CONFIG_DB , dvs .redis_sock , 0 )
122-
123- delete_entry_tbl (conf_db , NVGRE_TUNNEL , tunnel_name )
124- time .sleep (1 )
125- tunnel_ids = get_exist_entries (dvs , SAI_OBJECT_TYPE_TUNNEL )
126- tunnel_map_ids = get_exist_entries (dvs , SAI_OBJECT_TYPE_TUNNEL_MAP )
127-
128-
129- def check_nvgre_tunnel (dvs , src_ip , tunnel_ids , tunnel_map_ids , loopback_id ):
130- asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
131-
132119 tunnel_id = get_created_entry (asic_db , SAI_OBJECT_TYPE_TUNNEL , tunnel_ids )
133120 tunnel_map_id = get_created_entry_mapid (asic_db , SAI_OBJECT_TYPE_TUNNEL_MAP , tunnel_map_ids )
134121
@@ -155,6 +142,15 @@ def check_nvgre_tunnel(dvs, src_ip, tunnel_ids, tunnel_map_ids, loopback_id):
155142 tunnel_ids .add (tunnel_id )
156143
157144
145+ def remove_nvgre_tunnel (dvs , tunnel_name , tunnel_ids , tunnel_map_ids ):
146+ conf_db = swsscommon .DBConnector (swsscommon .CONFIG_DB , dvs .redis_sock , 0 )
147+
148+ delete_entry_tbl (conf_db , NVGRE_TUNNEL , tunnel_name )
149+ time .sleep (1 )
150+ tunnel_ids = get_exist_entries (dvs , SAI_OBJECT_TYPE_TUNNEL )
151+ tunnel_map_ids = get_exist_entries (dvs , SAI_OBJECT_TYPE_TUNNEL_MAP )
152+
153+
158154def create_nvgre_tunnel_entry (dvs , tunnel_name , tunnel_map_entry_name , vlan_id , vsid , tunnel_map_ids , tunnel_map_entry_ids ):
159155 asic_db = swsscommon .DBConnector (swsscommon .ASIC_DB , dvs .redis_sock , 0 )
160156 conf_db = swsscommon .DBConnector (swsscommon .CONFIG_DB , dvs .redis_sock , 0 )
@@ -202,8 +198,7 @@ def test_nvgre_create_tunnel(self, dvs, testlog):
202198 tunnel_map_ids = set ()
203199 loopback_id = get_lo (dvs )
204200
205- create_nvgre_tunnel (dvs , NVGRE_TUNNEL_NAME , VALID_IP_ADDR , tunnel_ids , tunnel_map_ids )
206- check_nvgre_tunnel (dvs , VALID_IP_ADDR , tunnel_ids , tunnel_map_ids , loopback_id )
201+ create_nvgre_tunnel (dvs , NVGRE_TUNNEL_NAME , VALID_IP_ADDR , tunnel_ids , tunnel_map_ids , loopback_id )
207202 finally :
208203 remove_nvgre_tunnel (dvs , NVGRE_TUNNEL_NAME , tunnel_ids , tunnel_map_ids )
209204
@@ -216,7 +211,7 @@ def test_nvgre_create_tunnel_map_entry(self, dvs, testlog):
216211 loopback_id = get_lo (dvs )
217212
218213 self .dvs_vlan .create_vlan (VLAN_ID )
219- create_nvgre_tunnel (dvs , NVGRE_TUNNEL_NAME , VALID_IP_ADDR , tunnel_ids , tunnel_map_ids )
214+ create_nvgre_tunnel (dvs , NVGRE_TUNNEL_NAME , VALID_IP_ADDR , tunnel_ids , tunnel_map_ids , loopback_id )
220215 create_nvgre_tunnel_entry (dvs , NVGRE_TUNNEL_NAME , NVGRE_TUNNEL_MAP_ENTRY_NAME , VLAN_ID , NVGRE_VSID , tunnel_map_ids , tunnel_map_entry_ids )
221216 finally :
222217 remove_nvgre_tunnel_map_entry (dvs , NVGRE_TUNNEL_NAME , NVGRE_TUNNEL_MAP_ENTRY_NAME , tunnel_map_entry_ids )
0 commit comments