Skip to content

Commit 78cc9ac

Browse files
committed
[Chassis] Added multi Asics support to everflow
(cherry picked from commit 654f93c2e6adb01c785f4a18a296a67c590ea157)
1 parent 1122a69 commit 78cc9ac

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

tests/everflow/everflow_test_utilities.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,15 @@ def check_rule_active(self, duthost, table_name):
992992
for line in res[2:]:
993993
if len(line) < status_index:
994994
continue
995-
if line[status_index:] != 'Active':
996-
return False
995+
if duthost.is_multi_asic:
996+
st = eval(line[status_index:])
997+
namespace_list = duthost.get_asic_namespace_list()
998+
for namespace in namespace_list:
999+
if st[namespace] != 'Active':
1000+
return False
1001+
else:
1002+
if line[status_index:] != 'Active':
1003+
return False
9971004
return True
9981005

9991006
def apply_non_openconfig_acl_rule(self, duthost, extra_vars, rule_file, table_name):
@@ -1010,7 +1017,12 @@ def apply_non_openconfig_acl_rule(self, duthost, extra_vars, rule_file, table_na
10101017
duthost.host.options['variable_manager'].extra_vars.update(extra_vars)
10111018
duthost.file(path=dest_path, state='absent')
10121019
duthost.template(src=os.path.join(FILE_DIR, rule_file), dest=dest_path)
1013-
duthost.shell("config load -y {}".format(dest_path))
1020+
dest_paths = dest_path
1021+
if duthost.is_multi_asic:
1022+
num_asics = duthost.facts['num_asic']
1023+
for num_asic in range(num_asics):
1024+
dest_paths = dest_paths + "," + dest_path
1025+
duthost.shell("config load -y {}".format(dest_paths))
10141026

10151027
if duthost.facts['asic_type'] != 'vs':
10161028
pytest_assert(wait_until(60, 2, 0, self.check_rule_active, duthost, table_name),

tests/everflow/files/test_rules_ip_type_v6.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"ACL_RULE": {
33
"{{ table_name }}|rule_999": {
44
"PRIORITY": "999",
5-
"IP_TYPE": "ANY",
5+
"IP_TYPE": "IPV6ANY",
66
"{{ action }}": "test_session_1",
77
"DST_IPV6": "2002:0225:7c6b:a982:d48b:230e:f271:0011"
88
},

tests/everflow/test_everflow_ipv6.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def everflow_dut(self, setup_info): # noqa F811
103103
dut = setup_info[UP_STREAM]['everflow_dut']
104104
else:
105105
dut = setup_info[DOWN_STREAM]['everflow_dut']
106-
106+
107107
yield dut
108108

109109
@pytest.fixture(scope='class')
@@ -201,7 +201,7 @@ def setup_acl_table(self, setup_info, setup_mirror_session, config_method, setup
201201
everflow_dut = setup_info[DOWN_STREAM]['everflow_dut']
202202
remote_dut = setup_info[DOWN_STREAM]['remote_dut']
203203

204-
table_name = self._get_table_name(everflow_dut)
204+
table_name = self._get_table_name(everflow_dut, self.acl_stage())
205205
temporary_table = False
206206

207207
duthost_set = set()
@@ -214,7 +214,10 @@ def setup_acl_table(self, setup_info, setup_mirror_session, config_method, setup
214214

215215
for duthost in duthost_set:
216216
if temporary_table:
217-
self.apply_acl_table_config(duthost, table_name, "MIRRORV6", config_method)
217+
inst_list = duthost.get_sonic_host_and_frontend_asic_instance()
218+
for inst in inst_list:
219+
self.apply_acl_table_config(duthost, table_name, "MIRRORV6", config_method,
220+
bind_namespace=getattr(inst, 'namespace', None))
218221

219222
self.apply_acl_rule_config(duthost, table_name, setup_mirror_session["session_name"],
220223
config_method, rules=EVERFLOW_V6_RULES)
@@ -229,16 +232,17 @@ def setup_acl_table(self, setup_info, setup_mirror_session, config_method, setup
229232
self.remove_acl_table_config(duthost, table_name, config_method)
230233

231234
# TODO: This can probably be refactored into a common utility method later.
232-
def _get_table_name(self, duthost):
235+
def _get_table_name(self, duthost, acl_stage="ingress"):
233236
show_output = duthost.command("show acl table")
234237

235238
table_name = None
236239
for line in show_output["stdout_lines"]:
237240
if "MIRRORV6" in line:
238-
# NOTE: Once we branch out the sonic-mgmt repo we can skip the version check.
239-
if "201811" in duthost.os_version or self.acl_stage() in line:
240-
table_name = line.split()[0]
241-
break
241+
if acl_stage in line:
242+
# NOTE: Once we branch out the sonic-mgmt repo we can skip the version check.
243+
if "201811" in duthost.os_version or self.acl_stage() in line:
244+
table_name = line.split()[0]
245+
break
242246

243247
return table_name
244248

0 commit comments

Comments
 (0)