Skip to content

Commit

Permalink
[voq][chassis]fix recirc port admin status (#10769)
Browse files Browse the repository at this point in the history
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com

Why I did it
resolves #10761.
For VOQ chassis, the Recirc port, which was added for the Everflow, stays admin down after load minigraph.
This PR add the fix to make the recirc port as admin up

How I did it
The PR adds a change in minigraph.py,  if port has role as Rec make the the port as admin-status up.

How to verify it
UT

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
  • Loading branch information
arlakshm authored May 24, 2022
1 parent a6b1b0a commit 915f283
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 46 deletions.
6 changes: 6 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,12 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
if inband_port in ports.keys():
ports[inband_port]['admin_status'] = 'up'

# bring up the recirc port for voq chassis
for port, port_attributes in ports.items():
port_role = port_attributes.get('role', None)
if port_role == 'Rec':
ports[port]['admin_status'] = 'up'

results['PORT'] = ports
results['CONSOLE_PORT'] = console_ports

Expand Down
42 changes: 30 additions & 12 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,18 +896,36 @@ def test_minigraph_voq_inband_port(self):
output = self.run_script(argument)
output_dict = utils.to_dict(output.strip())
self.assertDictEqual(
output_dict['Ethernet-IB0'],
{'lanes': '133',
'alias': 'Recycle0',
'description': 'Recycle0',
'mtu': '9100',
'tpid': '0x8100',
'pfc_asym': 'off',
'admin_status': 'up',
'fec': 'rs',
'speed': '100000'
}
)
output_dict['Ethernet-IB0'], {
"lanes": "222",
"alias": "Recirc0/1",
"index": "52",
"role": "Inb",
"speed": "400000",
"description": "Recirc0/1",
"mtu": "9100",
"tpid": "0x8100",
"pfc_asym": "off",
"admin_status": "up"
})

def test_minigraph_voq_recirc_ports(self):
argument = "-m {} -p {} --var-json PORT".format(self.sample_graph_voq, self.voq_port_config)
output = self.run_script(argument)
output_dict = utils.to_dict(output.strip())
self.assertDictEqual(
output_dict['Ethernet-Rec0'], {
"lanes": "221",
"alias": "Recirc0/0",
"index": "51",
"role": "Rec",
"speed": "400000",
"description": "Recirc0/0",
"mtu": "9100",
"tpid": "0x8100",
"pfc_asym": "off",
"admin_status": "up"
})

def test_minigraph_dhcp(self):
argument = '-m "' + self.sample_graph_simple_case + '" -p "' + self.port_config + '" -v DHCP_RELAY'
Expand Down
45 changes: 11 additions & 34 deletions src/sonic-config-engine/tests/voq-sample-port-config.ini
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
# name lanes alias
Ethernet0 29,30,31,32 fortyGigE0/0
Ethernet4 25,26,27,28 fortyGigE0/4
Ethernet8 37,38,39,40 fortyGigE0/8
Ethernet12 33,34,35,36 fortyGigE0/12
Ethernet16 41,42,43,44 fortyGigE0/16
Ethernet20 45,46,47,48 fortyGigE0/20
Ethernet24 5,6,7,8 fortyGigE0/24
Ethernet28 1,2,3,4 fortyGigE0/28
Ethernet32 9,10,11,12 fortyGigE0/32
Ethernet36 13,14,15,16 fortyGigE0/36
Ethernet40 21,22,23,24 fortyGigE0/40
Ethernet44 17,18,19,20 fortyGigE0/44
Ethernet48 49,50,51,52 fortyGigE0/48
Ethernet52 53,54,55,56 fortyGigE0/52
Ethernet56 61,62,63,64 fortyGigE0/56
Ethernet60 57,58,59,60 fortyGigE0/60
Ethernet64 65,66,67,68 fortyGigE0/64
Ethernet68 69,70,71,72 fortyGigE0/68
Ethernet72 77,78,79,80 fortyGigE0/72
Ethernet76 73,74,75,76 fortyGigE0/76
Ethernet80 105,106,107,108 fortyGigE0/80
Ethernet84 109,110,111,112 fortyGigE0/84
Ethernet88 117,118,119,120 fortyGigE0/88
Ethernet92 113,114,115,116 fortyGigE0/92
Ethernet96 121,122,123,124 fortyGigE0/96
Ethernet100 125,126,127,128 fortyGigE0/100
Ethernet104 85,86,87,88 fortyGigE0/104
Ethernet108 81,82,83,84 fortyGigE0/108
Ethernet112 89,90,91,92 fortyGigE0/112
Ethernet116 93,94,95,96 fortyGigE0/116
Ethernet120 97,98,99,100 fortyGigE0/120
Ethernet124 101,102,103,104 fortyGigE0/124
Ethernet-IB0 133 Recycle0
# name lanes alias index role speed
Ethernet0 6,7 Ethernet1/1 1 Ext 100000
Ethernet4 2,3 Ethernet2/1 2 Ext 100000
Ethernet12 0,1 Ethernet4/1 4 Ext 100000
Ethernet8 4,5 Ethernet3/1 3 Ext 100000
Ethernet16 14,15 Ethernet5/1 5 Ext 100000
Ethernet20 10,11 Ethernet6/1 6 Ext 100000
Ethernet24 12,13 Ethernet7/1 7 Ext 100000
Ethernet28 8,9 Ethernet8/1 8 Ext 100000
Ethernet-Rec0 221 Recirc0/0 51 Rec 400000
Ethernet-IB0 222 Recirc0/1 52 Inb 400000

0 comments on commit 915f283

Please sign in to comment.