Skip to content

Switchport Modes Port & Port Channel Config-Engine Support#17632

Closed
ridahanif96 wants to merge 11 commits intosonic-net:masterfrom
ridahanif96:switchport_config
Closed

Switchport Modes Port & Port Channel Config-Engine Support#17632
ridahanif96 wants to merge 11 commits intosonic-net:masterfrom
ridahanif96:switchport_config

Conversation

@ridahanif96
Copy link
Copy Markdown
Contributor

Why I did it

This PR is created in reference to add Switchport Modes Port & Port Channel config-engine changes

How I did it

I have added changes in sonic-config-engine related files.
Added support of mode attribute "routed or trunk" in minigraph.py. Default value will be routed and vlan membership for port and portchannel will have trunk

How to verify it

Port & Portchannel with vlan membership will have mode attribute with value trunk else it will be routed by default.

Description for the changelog

This PR is added to provide support for Switchport Modes Port & Port Channel Config-Engine changes

Link to config_db schema for YANG module changes

This PR is linked with PR which has YANG model support

@ganglyu
Copy link
Copy Markdown
Contributor

ganglyu commented Jan 22, 2024

I think we need to merge #13580 at first, and make sure PR checker can pass.

@ridahanif96
Copy link
Copy Markdown
Contributor Author

I think we need to merge #13580 at first, and make sure PR checker can pass.

Agree, waiting for PR#13580 to get merged so we can pass failures

@qiluo-msft
Copy link
Copy Markdown
Collaborator

qiluo-msft commented Jan 26, 2024

Could you merge the latest master? #Closed

@ridahanif96
Copy link
Copy Markdown
Contributor Author

Could you merge the latest master?

Let's me rerun this latest push to pass these failures. Thanks

@ridahanif96
Copy link
Copy Markdown
Contributor Author

@ganglyu can you please review this PR. All failures has been passed.

del pc_members[pc_mbr_del_key]

# set default port channel MTU as 9100 and admin status up and default TPID 0x8100
# set default port channel MTU as 9100 and admin status up and default TPID 0x8100
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at the end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"mode": "routed"
}
}
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix end of file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet124 101,102,103,104 fortyGigE0/124 on
# name lanes alias autoneg mode
Ethernet0 29,30,31,32 fortyGigE0/0 off routed
Ethernet4 25,26,27,28 fortyGigE0/4 off trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet0 29,30,31,32 fortyGigE0/0 off routed
Ethernet4 25,26,27,28 fortyGigE0/4 off trunk
Ethernet8 37,38,39,40 fortyGigE0/8 off trunk
Ethernet12 33,34,35,36 fortyGigE0/12 off trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet12 33,34,35,36 fortyGigE0/12 off trunk
Ethernet16 41,42,43,44 fortyGigE0/16 off trunk
Ethernet20 45,46,47,48 fortyGigE0/20 off trunk
Ethernet24 5,6,7,8 fortyGigE0/24 off trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet28 1,2,3,4 fortyGigE0/28 trunk
Ethernet32 9,10,11,12 fortyGigE0/32 trunk
Ethernet36 13,14,15,16 fortyGigE0/36 trunk
Ethernet40 21,22,23,24 fortyGigE0/40 trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet52 53,54,55,56 fortyGigE0/52 trunk
Ethernet56 61,62,63,64 fortyGigE0/56 trunk
Ethernet60 57,58,59,60 fortyGigE0/60 trunk
Ethernet64 65,66,67,68 fortyGigE0/64 trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet60 57,58,59,60 fortyGigE0/60 trunk
Ethernet64 65,66,67,68 fortyGigE0/64 trunk
Ethernet68 69,70,71,72 fortyGigE0/68 trunk
Ethernet72 77,78,79,80 fortyGigE0/72 trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Ethernet92 113,114,115,116 fortyGigE0/92 trunk
Ethernet96 121,122,123,124 fortyGigE0/96 trunk
Ethernet100 125,126,127,128 fortyGigE0/100 trunk
Ethernet104 85,86,87,88 fortyGigE0/104 trunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

)

def test_minigraph_neighbor_interfaces(self):
argument = ['-m', self.sample_graph_simple_case, '-p', self.port_config, '-v', "PORT"]
output = self.run_script(argument)

self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

)
)

def test_minigraph_neighbor_interfaces_config_db(self):
# test to check if PORT table is retrieved from config_db
argument = ['-m', self.sample_graph_simple_case, '-p', self.port_config, '-v', "PORT"]
output = self.run_script(argument)

self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

)
)

def test_minigraph_extra_ethernet_interfaces(self, **kwargs):
graph_file = kwargs.get('graph_file', self.sample_graph_simple)
argument = ['-m', graph_file, '-p', self.port_config, '-v', "PORT"]
output = self.run_script(argument)
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

@@ -970,6 +969,7 @@ def test_minigraph_voq_inband_port(self):
argument = ["-j", self.macsec_profile, "-m", self.sample_graph_voq, "-p", self.voq_port_config, "--var-json", "PORT"]
output = self.run_script(argument)
output_dict = utils.to_dict(output.strip())
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

@@ -1084,52 +1085,51 @@ def test_minigraph_packet_chassis_400g_zr_port_config(self):
def test_minigraph_400g_to_100G_speed(self):
argument = ["-j", self.macsec_profile, "-m", self.voq_sample_masic_graph, "-p", self.voq_port_config_400g, "-n", "asic0", "-v", "PORT"]
output = self.run_script(argument)
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

def test_minigraph_cisco_400g_to_100G_speed(self):
argument = ["-m", self.sample_cisco_100_graph, "-p", self.sample_cisco_port_config_400g, "-v", "PORT"]
self.assertTrue(self.yang.validate(argument))
output = self.run_script(argument)
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

def test_minigraph_cisco_400G_to_400G_speed(self):
argument = ["-m", self.sample_cisco_400_graph, "-p", self.sample_cisco_port_config_400g, "-v", "PORT"]
output = self.run_script(argument)
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

@@ -1138,10 +1138,11 @@ def test_minigraph_cisco_400g_to_100G_speed_no_lane_change(self):
argument = ["-m", self.sample_cisco_8111_graph, "-p", self.sample_cisco_8111_port_config, "-v", "PORT"]
self.assertTrue(self.yang.validate(argument))
output = self.run_script(argument)
self.maxDiff = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this change

output = self.run_script(argument)
self.assertEqual(
utils.liststr_to_dict(output.strip()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

)

def test_minigraph_neighbor_interfaces(self):
argument = ['-m', self.sample_graph_simple_case, '-p', self.port_config, '-v', "PORT"]
output = self.run_script(argument)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove space

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

"'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, "
"'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, "
"'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}"
utils.to_dict(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at the end of line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

{'PortChannel0002': {'admin_status': 'up', 'min_links': '2', 'mtu': '9100', 'tpid': '0x8100', 'lacp_key': 'auto'},
'PortChannel4001': {'admin_status': 'up', 'min_links': '2', 'mtu': '9100', 'tpid': '0x8100', 'lacp_key': 'auto'},
'PortChannel4002': {'admin_status': 'up', 'min_links': '2', 'mtu': '9100', 'tpid': '0x8100', 'lacp_key': 'auto'}})
{'PortChannel0002': {'admin_status': 'up', 'min_links': '2', 'mtu': '9100', 'tpid': '0x8100', 'mode': 'routed', 'lacp_key': 'auto' },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after 'auto'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@ridahanif96
Copy link
Copy Markdown
Contributor Author

@venkatmahalingam can you please help review this PR, thanks

@ridahanif96
Copy link
Copy Markdown
Contributor Author

@qiluo-msft can you pls help merge this PR. Thanks

@ridahanif96
Copy link
Copy Markdown
Contributor Author

ridahanif96 commented Feb 16, 2024

@qiluo-msft Can you please help merge this PR! Thanks

@ridahanif96
Copy link
Copy Markdown
Contributor Author

@qiluo-msft @zhangyanzhao can you please help to merge this PR, thanks.

@zhangyanzhao zhangyanzhao added the YANG YANG model related changes label Mar 19, 2024
@ridahanif96
Copy link
Copy Markdown
Contributor Author

@qiluo-msft can you also please help review this one, meanwhile i am fixing with other default disruptive change.

for port in ports.values():
port['mtu'] = '9100'
port['tpid'] = '0x8100'
# mode check for vlan membership in PORT table default mode is routed and for vlan membership it is trunk
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode check for vlan membership in PORT table default mode is routed and for vlan membership it is trunk

Since you can implement a conditional default value in relevant consuming component, no need to add explicit attribute during load_minigraph. We try to prevent any minigraph.py behavior change now. #Closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here in minigraph .py, we implemented conditional default value in relevant consuming component.
Do we need to remove all this conditional change as well from minigraph.py

Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block any minigraph.py behavior change. Feel free to reach me if any questions.

@ridahanif96
Copy link
Copy Markdown
Contributor Author

Block any minigraph.py behavior change. Feel free to reach me if any questions.

We have added conditional change in minigraph.py and relevant changes in other files, do we need to also remove this conditional change in minigraph.py

port['mtu'] = '9100'
port['tpid'] = '0x8100'

# asymmetric PFC is disabled by default
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need remove empty line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted

@qiluo-msft qiluo-msft dismissed their stale review March 27, 2024 20:20

Unblocked. However I see PR checkers fail. Is this PR still needed?

@qiluo-msft
Copy link
Copy Markdown
Collaborator

@ridahanif96 will double check and close this PR.

@ridahanif96
Copy link
Copy Markdown
Contributor Author

@ridahanif96 will double check and close this PR.

This PR is not required any more as we will not be using sonic-config-Engine changes for Switchport Modes Port HLD. Therefore i am closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

YANG YANG model related changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants