The neutron_taas.services.taas.drivers.linux.sriov_nic_utils Module

class neutron_taas.services.taas.drivers.linux.sriov_nic_utils.SriovNicUtils

Bases: object

execute_sysfs_command(command, ts_port_params, src_port_params, common_vlans_ranges_str, vf_to_vf_all_vlans, direction)

Execute the SRIOV NIC Switch Driver’s SysFs command.

# Mirror traffic from VF0 to VF3 on interface p2p1, ex. echo add 3 > /sys/class/net/p2p1/device/sriov/0/ingress_mirror echo add 3 > /sys/class/net/p2p1/device/sriov/0/egress_mirror

# Remove traffic mirroring from VF0 to VF3 on interface p2p1, ex. echo rem 3 > /sys/class/net/p2p1/device/sriov/0/ingress_mirror echo rem 3 > /sys/class/net/p2p1/device/sriov/0/egress_mirror

# Add VLANs 2,6,18-22 to Mirror traffic to VF3 (port p2p1), ex. echo add 2,6,18-22 > /sys/class/net/p2p1/device/sriov/3/vlan_mirror

# Remove VLANs 2,6,18-22 to Mirror traffic to VF3 (port p2p1), ex. echo rem 2,6,18-22 > /sys/class/net/p2p1/device/sriov/3/vlan_mirror

# Remove all VLANs from mirroring at VF3, ex. echo rem 0-4095 > /sys/class/net/p1p1/device/sriov/3/vlan_mirror

get_ifname_by_pci_address(pci_addr, pf_interface=False)

Get the interface name based on a VF’s pci address.

The returned interface name is either the parent PF’s or that of the VF itself based on the argument of pf_interface.

get_mac_by_pci_address(pci_addr, pf_interface=False)

Get the MAC address of the nic based on its PCI address.

Raises PciDeviceNotFoundById in case the pci device is not a NIC

get_net_name_by_vf_pci_address(vfaddress, pf_interface=False)

Given the VF PCI address, returns the net device name.

Every VF is associated to a PCI network device. This function returns the libvirt name given to this network device; e.g.:

<device>
<name>net_enp8s0f0_90_e2_ba_5e_a6_40</name>

In the libvirt parser information tree, the network device stores the network capabilities associated to this device.

get_sriov_port_params(sriov_port)

Returns a dict of common SRIOV parameters for a given SRIOV port

get_vf_num_by_pci_address(pci_addr)

Get the VF number based on a VF’s pci address

A VF is associated with an VF number, which ip link command uses to configure it. This can be obtained from the PCI device filesystem.