Skip to content

Commit

Permalink
Removed check_nvgre_tunnel()
Browse files Browse the repository at this point in the history
Signed-off-by: Vadym Hlushko <[email protected]>
  • Loading branch information
vadymhlushko-mlnx committed Oct 26, 2021
1 parent ef6ccc5 commit fb9b075
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions tests/test_nvgre_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def check_object(db, table, key, expected_attributes):
(value, name, expected_attributes[name])


def create_nvgre_tunnel(dvs, tunnel_name, src_ip, tunnel_ids, tunnel_map_ids):
def create_nvgre_tunnel(dvs, tunnel_name, src_ip, tunnel_ids, tunnel_map_ids, loopback_id):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)

Expand All @@ -116,19 +116,6 @@ def create_nvgre_tunnel(dvs, tunnel_name, src_ip, tunnel_ids, tunnel_map_ids):

create_entry_tbl(conf_db, NVGRE_TUNNEL, '|', tunnel_name, attrs)


def remove_nvgre_tunnel(dvs, tunnel_name, tunnel_ids, tunnel_map_ids):
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)

delete_entry_tbl(conf_db, NVGRE_TUNNEL, tunnel_name)
time.sleep(1)
tunnel_ids = get_exist_entries(dvs, SAI_OBJECT_TYPE_TUNNEL)
tunnel_map_ids = get_exist_entries(dvs, SAI_OBJECT_TYPE_TUNNEL_MAP)


def check_nvgre_tunnel(dvs, src_ip, tunnel_ids, tunnel_map_ids, loopback_id):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)

tunnel_id = get_created_entry(asic_db, SAI_OBJECT_TYPE_TUNNEL, tunnel_ids)
tunnel_map_id = get_created_entry_mapid(asic_db, SAI_OBJECT_TYPE_TUNNEL_MAP, tunnel_map_ids)

Expand All @@ -155,6 +142,15 @@ def check_nvgre_tunnel(dvs, src_ip, tunnel_ids, tunnel_map_ids, loopback_id):
tunnel_ids.add(tunnel_id)


def remove_nvgre_tunnel(dvs, tunnel_name, tunnel_ids, tunnel_map_ids):
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)

delete_entry_tbl(conf_db, NVGRE_TUNNEL, tunnel_name)
time.sleep(1)
tunnel_ids = get_exist_entries(dvs, SAI_OBJECT_TYPE_TUNNEL)
tunnel_map_ids = get_exist_entries(dvs, SAI_OBJECT_TYPE_TUNNEL_MAP)


def create_nvgre_tunnel_entry(dvs, tunnel_name, tunnel_map_entry_name, vlan_id, vsid, tunnel_map_ids, tunnel_map_entry_ids):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
Expand Down Expand Up @@ -202,8 +198,7 @@ def test_nvgre_create_tunnel(self, dvs, testlog):
tunnel_map_ids = set()
loopback_id = get_lo(dvs)

create_nvgre_tunnel(dvs, NVGRE_TUNNEL_NAME, VALID_IP_ADDR, tunnel_ids, tunnel_map_ids)
check_nvgre_tunnel(dvs, VALID_IP_ADDR, tunnel_ids, tunnel_map_ids, loopback_id)
create_nvgre_tunnel(dvs, NVGRE_TUNNEL_NAME, VALID_IP_ADDR, tunnel_ids, tunnel_map_ids, loopback_id)
finally:
remove_nvgre_tunnel(dvs, NVGRE_TUNNEL_NAME, tunnel_ids, tunnel_map_ids)

Expand All @@ -216,7 +211,7 @@ def test_nvgre_create_tunnel_map_entry(self, dvs, testlog):
loopback_id = get_lo(dvs)

self.dvs_vlan.create_vlan(VLAN_ID)
create_nvgre_tunnel(dvs, NVGRE_TUNNEL_NAME, VALID_IP_ADDR, tunnel_ids, tunnel_map_ids)
create_nvgre_tunnel(dvs, NVGRE_TUNNEL_NAME, VALID_IP_ADDR, tunnel_ids, tunnel_map_ids, loopback_id)
create_nvgre_tunnel_entry(dvs, NVGRE_TUNNEL_NAME, NVGRE_TUNNEL_MAP_ENTRY_NAME, VLAN_ID, NVGRE_VSID, tunnel_map_ids, tunnel_map_entry_ids)
finally:
remove_nvgre_tunnel_map_entry(dvs, NVGRE_TUNNEL_NAME, NVGRE_TUNNEL_MAP_ENTRY_NAME, tunnel_map_entry_ids)
Expand Down

0 comments on commit fb9b075

Please sign in to comment.