sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
176 stars 703 forks source link

Snappi API does not identify port configuration for IXIA 4x100Gbps breakout links #12442

Open amitpawar12 opened 5 months ago

amitpawar12 commented 5 months ago

Description

We have following configuration in ansible/files/sonic_lab_links.csv:

StartDevice,StartPort,EndDevice,EndPort,BandWidth,VlanID,VlanMode dut-card,dut-port,sonic-API,Card1/Port9.1,100000,,Access

The snappi-API crashes when it reads the file info.

Steps to reproduce the issue:

  1. Add the end-port as card/Port.1 in the lab_links.csv

Describe the results you received: The snappi_api crashes.

Describe the results you expected: The snappi_api should be able to read the breakout link configuration.

@kamalsahu0001

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
kamalsahu0001 commented 2 months ago

Workaround is provided to support breakout ports. Will implement and fix will be available in later snappi versions

arlakshm commented 2 months ago

keysight team working on this issue.

kamalsahu0001 commented 2 months ago

Workaround:

Replace below fixture in snappi_helpers.py

def get_ports(self, peer_device=None): """This function returns list of ports that are (1) associated with a chassis (selected earlier using get_fanout_device_details() function) and (2) connected to a peer device (SONiC DUT) as a list of dictionary.

    Note: If you have not used get_fanout_device_details(), by default 0th
        (first) chassis remains selected. If you do not specify peer_device,
        this function will return all the ports of the chassis.

    Args:
        peer_device (str): hostname of the peer device

    Returns:
        Dictionary of chassis card port information.
    """
    retval = []
    for port in self.current_snappi_port_list:
        info_list = port.split('/')
        if 'Card' in port:
            dict_element = {
                'ip': info_list[0],
                'card_id': info_list[1].replace('Card', ''),
                'port_id': info_list[2].replace('Port', ''),
                'peer_port': info_list[3],
                'peer_device': info_list[4],
                'speed': info_list[5]
            }

            if peer_device is None or info_list[4] == peer_device:
                retval.append(dict_element)
        else:
            dict_element = {
                'ip': info_list[0],
                'port_id': info_list[1].replace('Port', ''),
                'peer_port': info_list[2],
                'peer_device': info_list[3],
                'speed': info_list[4]
            }

            if peer_device is None or info_list[3] == peer_device:
                retval.append(dict_element)

    return retval

And change the csv file to

Here under EndPort instead of "Card1/Port53", replace it with Port8.1

kamalsahu0001 commented 2 months ago

DeviceInterfaceLink BandWidth="100000" EndDevice="snapp-sonic" EndPort="Port8.1" StartDevice="sonic-s6100-dut" StartPort="Ethernet0"/

abdosi commented 2 months ago

@sdszhang @rraghav-cisco @kenneth-arista @ysmanman for viz.

sdszhang commented 1 month ago

@kamalsahu0001 Do we need to raise a new PR to change the fixture, or okay to close this one?