[sonic-config-gen] Modify lag names to enforce 15 chars limit (#10792)

Why I did it
Previous subport unit tests uses port channel names like PortChannel01, so for subport name generated PortChannel01.10, it exceeds Linux network interface name 15 char limit.

Signed-off-by: Longxiang Lyu lolv@microsoft.com

How I did it
Modify PortChannel01 to PortChannel1.
This commit is contained in:
Longxiang Lyu 2022-05-15 13:02:49 +08:00 committed by GitHub
parent 5ea244cac8
commit 5eda219bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 17 deletions

View File

@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname> <Hostname>switch-t0</Hostname>
<PortChannelInterfaces> <PortChannelInterfaces>
<PortChannel> <PortChannel>
<Name>PortChannel01</Name> <Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo> <AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/> <SubInterface/>
</PortChannel> </PortChannel>
@ -228,12 +228,12 @@
<IPInterfaces> <IPInterfaces>
<IPInterface> <IPInterface>
<Name i:nil="true"/> <Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix> <Prefix>10.0.0.56/31</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
<Name i:Name="true"/> <Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix> <Prefix>FC00::71/126</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
@ -265,7 +265,7 @@
<DataAcls/> <DataAcls/>
<AclInterfaces> <AclInterfaces>
<AclInterface> <AclInterface>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl> <InAcl>DataAcl</InAcl>
<Type>DataPlane</Type> <Type>DataPlane</Type>
</AclInterface> </AclInterface>

View File

@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname> <Hostname>switch-t0</Hostname>
<PortChannelInterfaces> <PortChannelInterfaces>
<PortChannel> <PortChannel>
<Name>PortChannel01</Name> <Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo> <AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/> <SubInterface/>
</PortChannel> </PortChannel>
@ -245,12 +245,12 @@
<IPInterfaces> <IPInterfaces>
<IPInterface> <IPInterface>
<Name i:nil="true"/> <Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix> <Prefix>10.0.0.56/31</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
<Name i:Name="true"/> <Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix> <Prefix>FC00::71/126</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
@ -272,7 +272,7 @@
<DataAcls/> <DataAcls/>
<AclInterfaces> <AclInterfaces>
<AclInterface> <AclInterface>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl> <InAcl>DataAcl</InAcl>
<Type>DataPlane</Type> <Type>DataPlane</Type>
</AclInterface> </AclInterface>

View File

@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname> <Hostname>switch-t0</Hostname>
<PortChannelInterfaces> <PortChannelInterfaces>
<PortChannel> <PortChannel>
<Name>PortChannel01</Name> <Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo> <AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/> <SubInterface/>
</PortChannel> </PortChannel>
@ -228,12 +228,12 @@
<IPInterfaces> <IPInterfaces>
<IPInterface> <IPInterface>
<Name i:nil="true"/> <Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix> <Prefix>10.0.0.56/31</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
<Name i:Name="true"/> <Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix> <Prefix>FC00::71/126</Prefix>
</IPInterface> </IPInterface>
<IPInterface> <IPInterface>
@ -265,7 +265,7 @@
<DataAcls/> <DataAcls/>
<AclInterfaces> <AclInterfaces>
<AclInterface> <AclInterface>
<AttachTo>PortChannel01</AttachTo> <AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl> <InAcl>DataAcl</InAcl>
<Type>DataPlane</Type> <Type>DataPlane</Type>
</AclInterface> </AclInterface>

View File

@ -325,7 +325,7 @@ class TestCfgGen(TestCase):
output = self.run_script(argument) output = self.run_script(argument)
self.assertEqual( self.assertEqual(
utils.to_dict(output.strip()), utils.to_dict(output.strip()),
utils.to_dict("{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100', 'tpid': '0x8100'}}") utils.to_dict("{'PortChannel1': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100', 'tpid': '0x8100'}}")
) )
def test_minigraph_portchannel_with_more_member(self): def test_minigraph_portchannel_with_more_member(self):
@ -349,7 +349,7 @@ class TestCfgGen(TestCase):
output = self.run_script(argument) output = self.run_script(argument)
self.assertEqual( self.assertEqual(
utils.liststr_to_dict(output.strip()), utils.liststr_to_dict(output.strip()),
utils.liststr_to_dict("['PortChannel01', ('PortChannel01', '10.0.0.56/31'), ('PortChannel01', 'FC00::71/126')]") utils.liststr_to_dict("['PortChannel1', ('PortChannel1', '10.0.0.56/31'), ('PortChannel1', 'FC00::71/126')]")
) )
def test_minigraph_neighbors(self): def test_minigraph_neighbors(self):
@ -803,11 +803,11 @@ class TestCfgGen(TestCase):
self.assertEqual( self.assertEqual(
utils.to_dict(output.strip()), utils.to_dict(output.strip()),
utils.to_dict( utils.to_dict(
"{('PortChannel01.10', '10.0.0.56/31'): {}, " "{('PortChannel1.10', '10.0.0.56/31'): {}, "
"'Ethernet0.10': {'admin_status': 'up'}, " "'Ethernet0.10': {'admin_status': 'up'}, "
"('Ethernet0.10', '10.0.0.58/31'): {}, " "('Ethernet0.10', '10.0.0.58/31'): {}, "
"('PortChannel01.10', 'FC00::71/126'): {}, " "('PortChannel1.10', 'FC00::71/126'): {}, "
"'PortChannel01.10': {'admin_status': 'up'}, " "'PortChannel1.10': {'admin_status': 'up'}, "
"('Ethernet0.10', 'FC00::75/126'): {}}" "('Ethernet0.10', 'FC00::75/126'): {}}"
) )
) )