Skip to content

Commit 642d80f

Browse files
Issue 20758: Changes to run telemetry/test_events.py on v6 topos
* extend bgp idle check to check ipv6 routes as well as ipv4 * use ipv6 mgmt addr in test_events.py when running on ipv6 topo * remove conditional skip for test_events.py on ipv6 topo
1 parent 793ccb8 commit 642d80f

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

tests/common/devices/sonic.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,23 +2200,26 @@ def is_bgp_state_idle(self):
22002200
Returns:
22012201
True or False
22022202
"""
2203-
bgp_summary = self.command("show ip bgp summary")["stdout_lines"]
2203+
for af in ["ip", "ipv6"]:
2204+
bgp_summary = self.command(f"show {af} bgp summary")["stdout_lines"]
22042205

2205-
idle_count = 0
2206-
expected_idle_count = 0
2207-
bgp_monitor_count = 0
2208-
for line in bgp_summary:
2209-
if "Idle (Admin)" in line:
2210-
idle_count += 1
2206+
idle_count = 0
2207+
expected_idle_count = 0
2208+
bgp_monitor_count = 0
2209+
for line in bgp_summary:
2210+
if "Idle (Admin)" in line:
2211+
idle_count += 1
22112212

2212-
if "Total number of neighbors" in line:
2213-
tokens = line.split()
2214-
expected_idle_count = int(tokens[-1])
2213+
if "Total number of neighbors" in line:
2214+
tokens = line.split()
2215+
expected_idle_count = int(tokens[-1])
22152216

2216-
if "BGPMonitor" in line:
2217-
bgp_monitor_count += 1
2217+
if "BGPMonitor" in line:
2218+
bgp_monitor_count += 1
22182219

2219-
return idle_count == (expected_idle_count - bgp_monitor_count)
2220+
if idle_count != (expected_idle_count - bgp_monitor_count):
2221+
return False
2222+
return True
22202223

22212224
def is_service_running(self, service_name, docker_name):
22222225
"""

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4818,14 +4818,6 @@ telemetry/test_events.py:
48184818
- "asic_type in ['vs']"
48194819
- https://github.com/sonic-net/sonic-buildimage/issues/19943
48204820

4821-
telemetry/test_events.py::test_events:
4822-
skip:
4823-
reason: "dut ipv6 mgmt ip not supported"
4824-
conditions_logical_operator: and
4825-
conditions:
4826-
- "is_mgmt_ipv6_only==True"
4827-
- "https://github.com/sonic-net/sonic-mgmt/issues/20395"
4828-
48294821
telemetry/test_telemetry.py:
48304822
skip:
48314823
reason: "Skip telemetry test for 201911 and older branches"

tests/telemetry/telemetry_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ def generate_client_cli(duthost, gnxi_path, method=METHOD_GET, xpath="COUNTERS/E
125125
# 3. Executes the py_gnmicli.py script.
126126
cmdFormat = '. /root/env-python3/bin/activate && cd {7}gnmi_cli_py' \
127127
' && python py_gnmicli.py -g -t {0} -p {1} -m {2} -x {3} -xt {4}{5} -o {6}'
128-
cmd = cmdFormat.format(duthost.mgmt_ip, env.gnmi_port,
128+
129+
dut_facts = duthost.dut_basic_facts()['ansible_facts']['dut_basic_facts']
130+
is_mgmt_ipv6_only = dut_facts.get('is_mgmt_ipv6_only', False)
131+
mgmt_ip = duthost.mgmt_ipv6 if is_mgmt_ipv6_only else duthost.mgmt_ip
132+
133+
cmd = cmdFormat.format(mgmt_ip, env.gnmi_port,
129134
method, xpath, target, ns,
130135
"ndastreamingservertest", gnxi_path)
131136

0 commit comments

Comments
 (0)