aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.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/impl_ifcfg.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/impl_ifcfg.py')
-rw-r--r--os_net_config/impl_ifcfg.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py
index cf3b257..8284ad5 100644
--- a/os_net_config/impl_ifcfg.py
+++ b/os_net_config/impl_ifcfg.py
@@ -54,6 +54,10 @@ def nfvswitch_config_path():
return "/etc/sysconfig/nfvswitch"
+def vpp_config_path():
+ return "/etc/vpp/startup.conf"
+
+
def route_config_path(name):
return "/etc/sysconfig/network-scripts/route-%s" % name
@@ -116,6 +120,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
self.linuxbond_data = {}
self.ib_interface_data = {}
self.linuxteam_data = {}
+ self.vpp_interface_data = {}
self.member_names = {}
self.renamed_interfaces = {}
self.bond_primary_ifaces = {}
@@ -626,6 +631,21 @@ class IfcfgNetConfig(os_net_config.NetConfig):
if ovs_dpdk_bond.routes:
self._add_routes(ovs_dpdk_bond.name, ovs_dpdk_bond.routes)
+ def add_vpp_interface(self, vpp_interface):
+ """Add a VppInterface object to the net config object
+
+ :param vpp_interface: The VppInterface object to add
+ """
+ vpp_interface.pci_dev = utils.get_pci_address(vpp_interface.name,
+ False)
+ vpp_interface.hwaddr = utils.interface_mac(vpp_interface.name)
+ if not self.noop:
+ self.ifdown(vpp_interface.name)
+ remove_ifcfg_config(vpp_interface.name)
+ logger.info('adding vpp interface: %s %s'
+ % (vpp_interface.name, vpp_interface.pci_dev))
+ self.vpp_interface_data[vpp_interface.name] = vpp_interface
+
def generate_ivs_config(self, ivs_uplinks, ivs_interfaces):
"""Generate configuration content for ivs."""
@@ -690,6 +710,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
restart_bridges = []
restart_linux_bonds = []
restart_linux_teams = []
+ restart_vpp = False
update_files = {}
all_file_names = []
ivs_uplinks = [] # ivs physical uplinks
@@ -698,6 +719,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
nfvswitch_internal_ifaces = [] # nfvswitch internal/management ports
stop_dhclient_interfaces = []
ovs_needs_restart = False
+ vpp_interfaces = self.vpp_interface_data.values()
for interface_name, iface_data in self.interface_data.items():
route_data = self.route_data.get(interface_name, '')
@@ -906,6 +928,15 @@ class IfcfgNetConfig(os_net_config.NetConfig):
logger.info('No changes required for InfiniBand iface: %s' %
interface_name)
+ if self.vpp_interface_data:
+ vpp_path = self.root_dir + vpp_config_path()
+ vpp_config = utils.generate_vpp_config(vpp_path, vpp_interfaces)
+ if utils.diff(vpp_path, vpp_config):
+ restart_vpp = True
+ update_files[vpp_path] = vpp_config
+ else:
+ logger.info('No changes required for VPP')
+
if cleanup:
for ifcfg_file in glob.iglob(cleanup_pattern()):
if ifcfg_file not in all_file_names:
@@ -932,6 +963,9 @@ class IfcfgNetConfig(os_net_config.NetConfig):
for bridge in restart_bridges:
self.ifdown(bridge, iftype='bridge')
+ for vpp_interface in vpp_interfaces:
+ self.ifdown(vpp_interface.name)
+
for oldname, newname in self.renamed_interfaces.items():
self.ifrename(oldname, newname)
@@ -1009,4 +1043,13 @@ class IfcfgNetConfig(os_net_config.NetConfig):
for vlan in restart_vlans:
self.ifup(vlan)
+ if not self.noop:
+ if restart_vpp:
+ logger.info('Restarting VPP')
+ utils.restart_vpp(vpp_interfaces)
+
+ if self.vpp_interface_data:
+ logger.info('Updating VPP mapping')
+ utils.update_vpp_mapping(vpp_interfaces)
+
return update_files