aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/objects.py
diff options
context:
space:
mode:
authorFeng Pan <fpan@redhat.com>2017-01-23 22:29:27 -0500
committerFeng Pan <fpan@redhat.com>2017-03-21 15:28:35 -0400
commitc5e11bbfcda78f021b38bf9177f0c661b8f59b20 (patch)
tree9560c4f3c1d0cb6dcd4f2cf80a463a9b1570f292 /os_net_config/objects.py
parent5f0145b88571b945b633f999c0d767ccefdce86b (diff)
Add support for VPP interface
Vector Packet Processing (VPP) is a high performance packet processing stack that runs in user space in Linux. VPP is used as an alternative to kernel networking stack for accelerated network data path. VPP uses DPDK poll-mode drivers to bind system interfaces rather than kernel drivers. VPP bound interfacees are not visible to kernel networking stack and therefore require different configuration steps in os-net-config. VPP interface will be used in Openstack by either Neutron ML2 driver networking-vpp as an alternative to OVS, or by Opendaylight SDN controller with Honeycomb agent. This patch adds interface configuration support to os-net-config. The kernel nic specified to be VPP interface type will be bound to VPP with a DPDK poll-mode driver. Note that os-net-config will only configure those settings that affect interface binding, all other configurations for VPP will be configured throught TripleO Heat Templates. Implements: blueprint fdio-integration-tripleo Change-Id: Iebb40b7c5b252c51e86b6f44bcf36ed206101390 Signed-off-by: Feng Pan <fpan@redhat.com>
Diffstat (limited to 'os_net_config/objects.py')
-rw-r--r--os_net_config/objects.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/os_net_config/objects.py b/os_net_config/objects.py
index 944aecd..ec915da 100644
--- a/os_net_config/objects.py
+++ b/os_net_config/objects.py
@@ -68,6 +68,8 @@ def object_from_json(json):
return OvsDpdkPort.from_json(json)
elif obj_type == "ovs_dpdk_bond":
return OvsDpdkBond.from_json(json)
+ elif obj_type == "vpp_interface":
+ return VppInterface.from_json(json)
def _get_required_field(json, name, object_name):
@@ -1131,3 +1133,57 @@ class OvsDpdkBond(_BaseOpts):
defroute=defroute, dhclient_args=dhclient_args,
dns_servers=dns_servers,
nm_controlled=nm_controlled)
+
+
+class VppInterface(_BaseOpts):
+ """Base class for VPP Interface.
+
+ Vector Packet Processing (VPP) is a high performance packet processing
+ stack that runs in user space in Linux. VPP is used as an alternative to
+ kernel networking stack for accelerated network data path. VPP uses DPDK
+ poll-mode drivers to bind system interfaces rather than kernel drivers.
+ VPP bound interfaces are not visible to kernel networking stack, so we
+ must handle them separately.
+
+ The following parameters can be specified in addition to base Interface:
+ - uio_driver: DPDK poll-mode driver name. Defaults to 'vfio-pci', valid
+ values are 'uio_pci_generic' and 'vfio-pci'.
+ - options: Interface options such as vlan stripping and tx/rx transmit
+ queues specification. Defaults to None. Reference for those
+ configurations can be found at
+ https://wiki.fd.io/view/VPP/Command-line_Arguments
+ Example: 'vlan-strip-offload on num-rx-queues 3'
+
+ Note that 'name' attribute is used to indicate the kernel nic that should
+ be bound to VPP. Once VPP binds the interface, a mapping file will be
+ updated with the interface's information, and this file will be used in
+ subsequent runs of os-net-config.
+ """
+ def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=None,
+ routes=None, mtu=None, primary=False, nic_mapping=None,
+ persist_mapping=False, defroute=True, dhclient_args=None,
+ dns_servers=None, nm_controlled=False, uio_driver='vfio-pci',
+ options=None):
+ addresses = addresses or []
+
+ super(VppInterface, self).__init__(name, use_dhcp, use_dhcpv6,
+ addresses, routes, mtu, primary,
+ nic_mapping, persist_mapping,
+ defroute, dhclient_args,
+ dns_servers, nm_controlled)
+ self.uio_driver = uio_driver
+ self.options = options
+ # pci_dev contains pci address for the interface, it will be populated
+ # when interface is added to config object. It will be determined
+ # either through ethtool or by looking up the dpdk mapping file.
+ self.pci_dev = None
+
+ @staticmethod
+ def from_json(json):
+ name = _get_required_field(json, 'name', 'VppInterface')
+ uio_driver = json.get('uio_driver', 'vfio-pci')
+ options = json.get('options', '')
+
+ opts = _BaseOpts.base_opts_from_json(json)
+ return VppInterface(name, *opts, uio_driver=uio_driver,
+ options=options)