[voq][minigraph] Add admin_status attribute for inband interface (#8050)
Why I did it In the config_db.json generated by minigraph "admin_status" attribute is missing for the VOQ inband interface port in the PORT table. How I did it Changes done to add admin_status attribute for voq inband interface port, if it exists in the PORT table keys.
This commit is contained in:
parent
2fe3d6231f
commit
8c599882da
@ -1488,6 +1488,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
||||
# make all neighbors connected ports to 'admin_up'
|
||||
ports[port]['admin_status'] = 'up'
|
||||
|
||||
# bring up the inband voq interfaces
|
||||
for inband_port in voq_inband_intfs:
|
||||
if inband_port in ports.keys():
|
||||
ports[inband_port]['admin_status'] = 'up'
|
||||
|
||||
results['PORT'] = ports
|
||||
results['CONSOLE_PORT'] = console_ports
|
||||
|
||||
|
@ -48,6 +48,11 @@
|
||||
<Type>Vlan</Type>
|
||||
<a:PrefixStr>1.1.1.1/24</a:PrefixStr>
|
||||
</a:VoqInbandInterface>
|
||||
<a:VoqInbandInterface>
|
||||
<Name>Ethernet-IB0</Name>
|
||||
<Type>port</Type>
|
||||
<a:PrefixStr>2.2.2.2/32</a:PrefixStr>
|
||||
</a:VoqInbandInterface>
|
||||
</VoqInbandInterfaces>
|
||||
<DataAcls/>
|
||||
<AclInterfaces/>
|
||||
|
@ -31,6 +31,7 @@ class TestCfgGen(TestCase):
|
||||
self.ecmp_graph = os.path.join(self.test_dir, 'fg-ecmp-sample-minigraph.xml')
|
||||
self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml')
|
||||
self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml')
|
||||
self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini')
|
||||
# To ensure that mock config_db data is used for unit-test cases
|
||||
os.environ["CFGGEN_UNIT_TESTING"] = "2"
|
||||
|
||||
@ -778,11 +779,44 @@ class TestCfgGen(TestCase):
|
||||
}
|
||||
)
|
||||
|
||||
def test_minigraph_voq_inband_interface(self):
|
||||
def test_minigraph_voq_inband_interface_vlan(self):
|
||||
argument = "-m {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq)
|
||||
output = self.run_script(argument)
|
||||
output_dict = utils.to_dict(output.strip())
|
||||
self.assertDictEqual(
|
||||
json.loads(self.run_script(argument)),
|
||||
{ 'Vlan3094': {'inband_type': 'Vlan'},
|
||||
'Vlan3094|1.1.1.1/24': {}
|
||||
output_dict['Vlan3094'],
|
||||
{'inband_type': 'Vlan'}
|
||||
)
|
||||
self.assertDictEqual(
|
||||
output_dict['Vlan3094|1.1.1.1/24'],
|
||||
{}
|
||||
)
|
||||
|
||||
def test_minigraph_voq_inband_interface_port(self):
|
||||
argument = "-m {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq)
|
||||
output = self.run_script(argument)
|
||||
output_dict = utils.to_dict(output.strip())
|
||||
self.assertDictEqual(
|
||||
output_dict['Ethernet-IB0'],
|
||||
{'inband_type': 'port'}
|
||||
)
|
||||
self.assertDictEqual(
|
||||
output_dict['Ethernet-IB0|2.2.2.2/32'],
|
||||
{}
|
||||
)
|
||||
|
||||
def test_minigraph_voq_inband_port(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-IB0'],
|
||||
{'lanes': '133',
|
||||
'alias': 'Recycle0',
|
||||
'description': 'Recycle0',
|
||||
'mtu': '9100',
|
||||
'tpid': '0x8100',
|
||||
'pfc_asym': 'off',
|
||||
'admin_status': 'up'
|
||||
}
|
||||
)
|
||||
|
34
src/sonic-config-engine/tests/voq-sample-port-config.ini
Normal file
34
src/sonic-config-engine/tests/voq-sample-port-config.ini
Normal file
@ -0,0 +1,34 @@
|
||||
# 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
|
Loading…
Reference in New Issue
Block a user