Description

On SONiC devices, in some scenarios config update cannot be performed on a physical interface while its member of a port-channel (LAG) interface. This is because, when an interface becomes a part of port-channel interface, the config changes are applied directly on the port-channel (LAG) interface. 
Hence, the workflow for configuration update on member interface requires first to remove the member interface from port-channel, update the configuration, and add the member interface back to port-channel.

Symptoms

For such scenarios, the configuration update on physical member port using Apstra cannot be performed directly, and could lead to deployment failures. Therefore the workaround to update interface configuration is via Configlets. 

This KB provides an example  Configlet for updating interface configuration using Apstra 4.1.2 with Sonic 4.1.2,
The example configlet contains Jinja expression to validate whether interface is part of port-channel, and accordingly render the config.

Solution

The Configlet validates if the interface is a member of a port-channel and updates the interface configuration  accordingly.
Below is one example of a Sonic System configlet, where interface speed configuration is change from hard coded to "speed auto". 
Here Ethernet24, Ethernet25, and Ethernet26 are used for reference and are part of port-channel.
 

Note: Configlets are users responsibility and therefore must be verified and tested in lab before deploying to production network.

Configlet Template Text:
{% set intf_arr = ['IF-Ethernet24','IF-Ethernet25','IF-Ethernet26'] %}
{% for if_name,if_param in interface.items() %}
{% if (if_name in intf_arr) and ('PortChannel' in if_param['part_of']) %}
sudo -u admin sonic-cli -c config -c 'interface {{if_name[3:]}}' -c 'no channel-group' -c 'speed auto' -c 'channel-group {{if_param['part_of'][11:]}}' < /dev/console
{% elif if_name in intf_arr %}
sudo -u admin sonic-cli -c config -c 'interface {{if_name[3:]}}' -c 'speed auto' < /dev/console
{% endif %}
{% endfor %}



This configlet will render the following config depending on whether interface is part of a PO.

- When interface Ethernet24 is part of port-channel, the config generated will be:

interface Ethernet24
no channel-group X
speed auto
channel-group X



- When interface Ethernet24 is not part of port-channel, the config generated will be:

interface Ethernet24
speed auto


Note: This example configlet is only for reference using Sonic Devices with Apstra. Customers can create a similar configlet on their own depending on the use case or contact Apstra JTAC for guidance.

Modification History

28 June 2023: initial version
ESC-449 / RFE-3388 (requested fix 6.2.0) added as internal comment