Skip to content

Port Speed Configuration

Andriy Moroz edited this page Jun 9, 2017 · 4 revisions

Port Speed Configuration design

Overview

Currently Port speed is set...
Port Speed Configuration feature allows user to specify speed for each individual switch port.
If no speed specified, port will be configured to the default value(?) (add where is the default and how to change)
To configure port speed different from the default one, user is required specify a valid port speed value in the platform specific configuration file know as "minigraph".

General feature design

Components to be changed or added

Minigraph changes

Port speed property is specified in the corresponding platform specific xml file.
File location: sonic-mgmt/tree/master/ansible/minigraph
In the XML hierarchy speed is under DeviceMiniGraph/DeviceDataPlaneInfo/IPInterfaces/IPInterface
XML tag for spped is PortSpeed.

Sample of the minigraph with the speed set for port Ethernet100:
<DeviceMiniGraph ...>
	...
	<DeviceDataPlaneInfo>
	...
		<IPInterfaces>
			...
			<IPInterface>
				<Name i:Name="true"/>
				<AttachTo>Ethernet100</AttachTo>
				<Prefix>10.0.0.32/31</Prefix>
				<PortSpeed>100G</PortSpeed>			<-- [NEW]
				<CableLength>1.5m</CableLength>			<-- [NEW]
			</IPInterface>
			...
		</IPInterfaces>
	</DeviceDataPlaneInfo>
</DeviceMiniGraph ...>

Ports configuration JSON

sonic-cfggen will consume the minigraph file and the ports configuration template to generate port configuration json file.
Template location and name is sonic-buildimage/dockers/docker-orchagent/ports_config.json.j2

Sample of the ports configuration template:
[
{% for interface in interface_aux_properties %}
    {
        "PORT_TABLE:{{ interface['name'] }}": {
            "speed": "{{ interface['speed'] }}",
            "cable_length": "{{ interface['cable_length'] }}",
        },
        "OP": "SET"
    }
{% endfor %}
]
Sample of the produced ports_config.json
[
    {
        "PORT_TABLE:Ethernet100": {
            "speed": "100G",
            "cable_length": "1.5m",
        },
        "OP": "SET"
    },
    {
	...
    }
]

Applying generated configuration on the switch

Json file is applied using swssconfig utility after orchagent start similar to mirror, ipinip and other configs.
Command to be executed in the run-time to fetch port properties from the minigraph and create a ports configuration json file.

sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ports_config.json.j2 > /etc/swss/config.d/ports_config.json
An example of the PORT_TABLE content after applying the json:
127.0.0.1:6379> hgetall PORT_TABLE:Ethernet100
...
11) "speed"
12) "100G"
13) "cable_length"
14) "1.5m"

Orchagent update

Orchagent (portsorch) handles PORT_TABLE updates.

  • make sure table is updated not recreated
  • add support for speed field; validate and set to HW via SAI.

Open questions:

  • apply speed via /etc/network/interfaces like MTU?
  • cable length handling to be added at the same level?
Clone this wiki locally