Skip to content

Commit b6e5c09

Browse files
author
Shu0T1an ChenG
committed
[swss]: Fix ports.json.j2 file and minigraph.py to exclude ports without speed
1 parent 389c3e1 commit b6e5c09

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[
22
{% if PORT %}
33
{% for port in PORT %}
4-
{% if PORT[port].has_key('speed') %}
54
{
65
"PORT_TABLE:{{ port }}": {
76
"speed": "{{ PORT[port]['speed'] }}",
@@ -10,7 +9,6 @@
109
"OP": "SET"
1110
}{% if not loop.last %},{% endif %}
1211

13-
{% endif %}
1412
{% endfor %}
1513
{% endif %}
1614
]

src/sonic-config-engine/minigraph.py

+3
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,13 @@ def parse_xml(filename, platform=None, port_config_file=None):
398398
results['VLAN_INTERFACE'] = vlan_intfs
399399
results['PORTCHANNEL_INTERFACE'] = pc_intfs
400400

401+
# TODO: the speed (if exits) in port_config.ini shall align with the speed in minigraph
401402
for port_name in port_speeds:
402403
ports.setdefault(port_name, {})['speed'] = port_speeds[port_name]
403404
for port_name in port_descriptions:
404405
ports.setdefault(port_name, {})['description'] = port_descriptions[port_name]
406+
# if the speed is not defined, the port shall be removed from the ports list
407+
ports = { key: value for key, value in ports.iteritems() if 'speed' in value.keys() }
405408

406409
results['PORT'] = ports
407410
results['PORTCHANNEL'] = pcs

0 commit comments

Comments
 (0)