-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Port Speed Configuration
Port Speed Configuration feature allows user to specify speed for each individual switch port in the minigraph config file.
To configure port speed, user is required specify a valid port speed value in the platform specific minigraph config file.
If no speed specified, port will remain configured to the default value specified in SAI profile.
Port speed specified in the minigraph will be processed by the sonic-cfggen
which using a ports configuration template will generate port configuration json file. 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.json.j2 > /etc/swss/config.d/ports.json
Port speed property is specified in the corresponding platform specific xml file.
File location: sonic-mgmt/ansible/minigraph
In the XML hierarchy speed is under DeviceInfos/DeviceInfo/EthernetInterfaces/EthernetInterface
XML tag to set speed is Speed
.
Speed should be specified in Mbits per second. E.g. for 100G need to specify 100000.
...
<DeviceInfos>
...
<DeviceInfo>
<EthernetInterfaces>
...
<EthernetInterface>
<InterfaceName>Ethernet1/1</InterfaceName>
...
<Speed>40000</PortSpeed>
...
</EthernetInterface>
...
</EthernetInterfaces>
</DeviceInfo>
</DeviceInfos>
src/sonic-config-engine/minigraph.py
updated to parse new minigraph section. Result stored in the exported variable ethernet_interfaces
of type list. Elements of the list are dictionaries which contains so far only two key-value records:
'name' : '<interface name>'
'speed' : '<interface speed>'
More records will likely be added as minigraph has other values in this section (negotiation, interface type, index, priority, etc).
A new unit test in src/sonic-config-engine/tests/test_cfggen.py
is added to validate new parser functionality. Unit tests for minigraph parser executed during the sonic image build.
Template location and name is sonic-buildimage/dockers/docker-orchagent/ports.json.j2
[
{% for interface in interface_aux_properties %}
{
"PORT_TABLE:{{ interface['name'] }}": {
"speed": "{{ interface['speed'] }}",
},
"OP": "SET"
}
{% endfor %}
]
[
{
"PORT_TABLE:Ethernet100": {
"speed": "40000",
},
"OP": "SET"
},
{
...
}
]
Json file is applied using swssconfig utility after orchagent start similar to mirror, ipinip and other configs.
swssconfig.sh is updated to apply generated ports.json
127.0.0.1:6379> hgetall PORT_TABLE:Ethernet100
...
7) "admin_status"
8) "up"
9) "mtu"
10) "9216"
11) "speed"
12) "40000"
Orchagent (portsorch) handles PORT_TABLE
updates.
Function PortsOrch::doPortTask(Consumer &consumer)
need to be updated to handle port speed updates in PORT_TABLE
table and set speed on hardware via SAI:
sai_port_api->set_port_attribute(port, SAI_PORT_ATTR_SPEED = speed)
Before applying speed on port Orchestration Agent will perform input string validation. This includes the following:
- speed string could be converted to integer without errors
- speed value is in the list of supported port speeds (requested via SAI using attribute SAI_PORT_ATTR_SUPPORTED_SPEED). If SAI returns result indicating this attribute is not supported, orchagent will attempt to apply the speed anyway.
-
For Users
-
For Developers
-
Subgroups/Working Groups
-
Presentations
-
Join Us