Skip to content

Commit

Permalink
[sonic-config-gen] Modify lag names to enforce 15 chars limit (#10792)
Browse files Browse the repository at this point in the history
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 [email protected]

How I did it
Modify PortChannel01 to PortChannel1.
  • Loading branch information
lolyu authored May 15, 2022
1 parent 5ea244c commit 5eda219
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/sonic-config-engine/tests/sample-graph-resource-type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname>
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/>
</PortChannel>
Expand Down Expand Up @@ -228,12 +228,12 @@
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix>
</IPInterface>
<IPInterface>
Expand Down Expand Up @@ -265,7 +265,7 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
Expand Down
8 changes: 4 additions & 4 deletions src/sonic-config-engine/tests/sample-graph-subintf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname>
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/>
</PortChannel>
Expand Down Expand Up @@ -245,12 +245,12 @@
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix>
</IPInterface>
<IPInterface>
Expand All @@ -272,7 +272,7 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
Expand Down
8 changes: 4 additions & 4 deletions src/sonic-config-engine/tests/simple-sample-graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<Hostname>switch-t0</Hostname>
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel01</Name>
<Name>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/>
</PortChannel>
Expand Down Expand Up @@ -228,12 +228,12 @@
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:Name="true"/>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix>
</IPInterface>
<IPInterface>
Expand Down Expand Up @@ -265,7 +265,7 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>PortChannel01</AttachTo>
<AttachTo>PortChannel1</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
Expand Down
10 changes: 5 additions & 5 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_minigraph_portchannels(self, **kwargs):
output = self.run_script(argument)
self.assertEqual(
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):
Expand All @@ -349,7 +349,7 @@ def test_minigraph_portchannel_interfaces(self):
output = self.run_script(argument)
self.assertEqual(
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):
Expand Down Expand Up @@ -803,11 +803,11 @@ def verify_sub_intf(self, **kwargs):
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict(
"{('PortChannel01.10', '10.0.0.56/31'): {}, "
"{('PortChannel1.10', '10.0.0.56/31'): {}, "
"'Ethernet0.10': {'admin_status': 'up'}, "
"('Ethernet0.10', '10.0.0.58/31'): {}, "
"('PortChannel01.10', 'FC00::71/126'): {}, "
"'PortChannel01.10': {'admin_status': 'up'}, "
"('PortChannel1.10', 'FC00::71/126'): {}, "
"'PortChannel1.10': {'admin_status': 'up'}, "
"('Ethernet0.10', 'FC00::75/126'): {}}"
)
)
Expand Down

0 comments on commit 5eda219

Please sign in to comment.