Skip to content

Commit 7899108

Browse files
authored
[portchannel] Fix test_snmp_fdb/test_fib/test_tagged_arp failed due to config_db change (#7650)
What is the motivation for this PR? test_snmp_fdb/test_fib/test_tagged_arp failed due to "members" field removed by this PR: sonic-net/sonic-buildimage#13660 How did you do it? Add support for this change. How did you verify/test it? Run test Signed-off-by: Yaqiang Zhu <[email protected]>
1 parent 8c5821a commit 7899108

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/common/fixtures/duthost_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def ports_list(duthosts, rand_one_dut_hostname, rand_selected_dut, tbinfo):
170170
ptf_ports_available_in_topo = {
171171
port_index: 'eth{}'.format(port_index) for port_index in config_port_indices.values()
172172
}
173-
config_portchannels = cfg_facts.get('PORTCHANNEL', {})
174-
config_port_channel_members = [port_channel['members'] for port_channel in config_portchannels.values()]
173+
config_portchannels = cfg_facts.get('PORTCHANNEL_MEMBER', {})
174+
config_port_channel_members = [port_channel.keys() for port_channel in config_portchannels.values()]
175175
config_port_channel_member_ports = list(itertools.chain.from_iterable(config_port_channel_members))
176176
ports = [port for port in config_ports if config_port_indices[port] in ptf_ports_available_in_topo and
177177
config_ports[port].get('admin_status', 'down') == 'up' and port not in config_port_channel_member_ports]
@@ -266,7 +266,7 @@ def utils_vlan_ports_list(duthosts, rand_one_dut_hostname, rand_selected_dut, tb
266266
mg_facts = rand_selected_dut.get_extended_minigraph_facts(tbinfo)
267267
vlan_ports_list = []
268268
config_ports = {k: v for k, v in cfg_facts['PORT'].items() if v.get('admin_status', 'down') == 'up'}
269-
config_portchannels = cfg_facts.get('PORTCHANNEL', {})
269+
config_portchannels = cfg_facts.get('PORTCHANNEL_MEMBER', {})
270270
config_port_indices = {k: v for k, v in mg_facts['minigraph_ptf_indices'].items() if k in config_ports}
271271
config_ports_vlan = collections.defaultdict(list)
272272
vlan_members = cfg_facts.get('VLAN_MEMBER', {})
@@ -292,7 +292,7 @@ def utils_vlan_ports_list(duthosts, rand_one_dut_hostname, rand_selected_dut, tb
292292
for po in config_portchannels:
293293
vlan_port = {
294294
'dev': po,
295-
'port_index': [config_port_indices[member] for member in config_portchannels[po]['members']],
295+
'port_index': [config_port_indices[member] for member in config_portchannels[po].keys()],
296296
'permit_vlanid': []
297297
}
298298
if po in config_ports_vlan:

tests/common/fixtures/fib_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def get_fib_info(duthost, dut_cfg_facts, duts_mg_facts):
189189
asic.shell("{} redis-dump -d 0 -k 'ROUTE*' -y > /tmp/fib.{}.txt".format(asic.ns_arg, timestamp))
190190
duthost.fetch(src="/tmp/fib.{}.txt".format(timestamp), dest="/tmp/fib")
191191

192-
po = asic_cfg_facts.get('PORTCHANNEL', {})
192+
po = asic_cfg_facts.get('PORTCHANNEL_MEMBER', {})
193193
ports = asic_cfg_facts.get('PORT', {})
194194
sub_interfaces = asic_cfg_facts.get('VLAN_SUB_INTERFACE', {})
195195

@@ -206,14 +206,14 @@ def get_fib_info(duthost, dut_cfg_facts, duts_mg_facts):
206206
for ifname in ifnames:
207207
if ifname in po:
208208
# ignore the prefix, if the prefix nexthop is not a frontend port
209-
if 'members' in po[ifname]:
210-
if 'role' in ports[po[ifname]['members'][0]] and \
211-
ports[po[ifname]['members'][0]]['role'] == 'Int':
209+
if len(po[ifname].keys()) > 0:
210+
if 'role' in ports[po[ifname].keys()[0]] and \
211+
ports[po[ifname].keys()[0]]['role'] == 'Int':
212212
skip = True
213213
else:
214214
oports.append(
215215
[str(duts_mg_facts[list_index][1]['minigraph_ptf_indices'][x])
216-
for x in po[ifname]['members']]
216+
for x in po[ifname].keys()]
217217
)
218218
else:
219219
if ifname in sub_interfaces:

0 commit comments

Comments
 (0)