Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tests/common/devices/sonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3240,13 +3240,21 @@ def get_mgmt_ip(self):
ipv4_regex = re.compile(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/\d+")
ipv6_regex = re.compile(r"([a-fA-F0-9:]+)/\d+")

mgmt_interface = self.shell("show ip interface | egrep '^eth0 '", module_ignore_errors=True)["stdout"]
# Use 'ip addr' instead of 'show ip[v6] interface' because the latter
# filters out site-local v6 addresses (fec0::/10) that may legitimately
# be configured as mgmt.
mgmt_interface = self.shell(
"ip -4 -o addr show eth0 scope global", module_ignore_errors=True
)["stdout"]
if mgmt_interface:
match = ipv4_regex.search(mgmt_interface)
if match:
return {"mgmt_ip": match.group(1), "version": "v4"}

mgmt_interface = self.shell("show ipv6 interface | egrep '^eth0 '", module_ignore_errors=True)["stdout"]
# Exclude link-local (fe80::/10) — not routable, can't be the mgmt addr.
mgmt_interface = self.shell(
"ip -6 -o addr show eth0 | grep -v 'scope link'", module_ignore_errors=True
)["stdout"]
if mgmt_interface:
match = ipv6_regex.search(mgmt_interface)
if match:
Expand Down
12 changes: 0 additions & 12 deletions tests/common/plugins/conditional_mark/tests_mark_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5455,18 +5455,6 @@ telemetry/test_events.py:
- "asic_type in ['vs']"
- https://github.com/sonic-net/sonic-buildimage/issues/19943

telemetry/test_events.py::test_events:
xfail:
reason: "xfail for IPv6-only topologies, issue https://github.com/sonic-net/sonic-mgmt/issues/20758"
conditions:
- "https://github.com/sonic-net/sonic-mgmt/issues/20758 and '-v6-' in topo_name"
skip:
reason: "dut ipv6 mgmt ip not supported"
conditions_logical_operator: and
conditions:
- "is_mgmt_ipv6_only==True"
- "https://github.com/sonic-net/sonic-mgmt/issues/20395"

telemetry/test_telemetry.py:
skip:
reason: "Skip telemetry test for 201911 and older branches"
Expand Down
3 changes: 2 additions & 1 deletion tests/telemetry/telemetry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def generate_client_cli(duthost, gnxi_path, method=METHOD_GET, xpath="COUNTERS/E
# 3. Executes the py_gnmicli.py script.
cmdFormat = '. /root/env-python3/bin/activate && cd {7}gnmi_cli_py' \
' && python py_gnmicli.py -g -t {0} -p {1} -m {2} -x {3} -xt {4}{5} -o {6}'
cmd = cmdFormat.format(duthost.mgmt_ip, env.gnmi_port,
mgmt_ip = duthost.get_mgmt_ip()["mgmt_ip"]
cmd = cmdFormat.format(mgmt_ip, env.gnmi_port,
method, xpath, target, ns,
"ndastreamingservertest", gnxi_path)

Expand Down
Loading