diff options
Diffstat (limited to 'vicn/resource/vpp')
-rw-r--r-- | vicn/resource/vpp/interface.py | 2 | ||||
-rw-r--r-- | vicn/resource/vpp/scripts.py | 8 | ||||
-rw-r--r-- | vicn/resource/vpp/vpp.py | 21 | ||||
-rw-r--r-- | vicn/resource/vpp/vpp_commands.py | 5 | ||||
-rw-r--r-- | vicn/resource/vpp/vpp_host.py | 18 |
5 files changed, 23 insertions, 31 deletions
diff --git a/vicn/resource/vpp/interface.py b/vicn/resource/vpp/interface.py index d0538661..9dbd7fc3 100644 --- a/vicn/resource/vpp/interface.py +++ b/vicn/resource/vpp/interface.py @@ -151,8 +151,6 @@ class VPPInterface(Resource): {'vpp_interface': self}, lock = self.vpp.vppctl_lock) - self.parent.set('ip4_address', None) - self.parent.set('ip6_address', None) self.parent.set('offload', False) self.parent.remote.set('offload', False) diff --git a/vicn/resource/vpp/scripts.py b/vicn/resource/vpp/scripts.py index d5130212..06da7404 100644 --- a/vicn/resource/vpp/scripts.py +++ b/vicn/resource/vpp/scripts.py @@ -285,3 +285,11 @@ APPARMOR_VPP_PROFILE = ''' lxc.aa_profile = lxc-dpdk lxc.mount.entry = hugetlbfs dev/hugepages hugetlbfs rw,relatime,create=dir 0 0 lxc.mount.auto = sys:rw''' + +FN_VPPCTL_WRAPPER_SCRIPT='/usr/bin/vppctl_wrapper' + +TPL_VPPCTL_WRAPPER_SCRIPT='''#!/bin/bash +TIMEOUT=5 + +flock /tmp/vppctl.lock -c \\"timeout \\$TIMEOUT vppctl \\$*\\" +''' diff --git a/vicn/resource/vpp/vpp.py b/vicn/resource/vpp/vpp.py index 8250f99a..9d4f7068 100644 --- a/vicn/resource/vpp/vpp.py +++ b/vicn/resource/vpp/vpp.py @@ -31,10 +31,11 @@ from vicn.resource.linux.file import TextFile from vicn.resource.vpp.dpdk_device import DpdkDevice from vicn.resource.vpp.scripts import FN_VPP_DPDK_SCRIPT from vicn.resource.vpp.scripts import TPL_VPP_DPDK_DAEMON_SCRIPT +from vicn.resource.vpp.scripts import FN_VPPCTL_WRAPPER_SCRIPT +from vicn.resource.vpp.scripts import TPL_VPPCTL_WRAPPER_SCRIPT from vicn.resource.vpp.vpp_commands import CMD_VPP_DISABLE, CMD_VPP_STOP from vicn.resource.vpp.vpp_commands import CMD_VPP_START from vicn.resource.vpp.vpp_commands import CMD_VPP_ENABLE_PLUGIN -from vicn.resource.vpp.vpp_commands import CMD_REMOVE_DPDK_PLUGIN from vicn.resource.vpp.vpp_host import VPPHost #------------------------------------------------------------------------------ @@ -136,8 +137,8 @@ class VPP(LinuxApplication): dpdk_list.append('dev ' + interface.pci_address) setup = setup + '''\n}\n\n''' + setup = setup + 'dpdk {' if dpdk_list: - setup = setup + 'dpdk {' # add socket_mem # On numa architecture socket-mem requires to set the amount of memory # to be reserved on each numa node @@ -156,13 +157,21 @@ class VPP(LinuxApplication): for dpdk_dev in dpdk_list: setup = setup + ''' \n ''' + dpdk_dev setup = setup + '''\n}''' + else: + setup = setup + '''\n no-pci \n}''' dpdk_setup_file = TextFile(node = self.node, filename = FN_VPP_DPDK_SCRIPT, content = setup, overwrite = True) - return dpdk_setup_file + vppctl_wrapper_file = TextFile(node = self.node, + filename = FN_VPPCTL_WRAPPER_SCRIPT, + content = TPL_VPPCTL_WRAPPER_SCRIPT, + executable = True, + overwrite = True) + + return dpdk_setup_file | vppctl_wrapper_file @inherit_parent def __create__(self): @@ -179,11 +188,7 @@ class VPP(LinuxApplication): found = True break - remove_dpdk_plugin = EmptyTask() - if (not found): - remove_dpdk_plugin = BashTask(self.node, CMD_REMOVE_DPDK_PLUGIN, lock = lock) - - return (((vpp_disable > vpp_stop) | enable_ip_forward) > (remove_dpdk_plugin > start_vpp)) + return (((vpp_disable > vpp_stop) | enable_ip_forward) > start_vpp) @inherit_parent def __delete__(self): diff --git a/vicn/resource/vpp/vpp_commands.py b/vicn/resource/vpp/vpp_commands.py index 30898eae..acc89640 100644 --- a/vicn/resource/vpp/vpp_commands.py +++ b/vicn/resource/vpp/vpp_commands.py @@ -13,11 +13,6 @@ flock /tmp/vppctl.lock -c "systemctl stop vpp" #killall -9 vpp_main || true CMD_VPP_ENABLE_PLUGIN = 'vppctl_wrapper {plugin} control start' -CMD_REMOVE_DPDK_PLUGIN = ''' -rm /usr/lib/vpp_api_test_plugins/dpdk_test_plugin.so -rm /usr/lib/vpp_plugins/dpdk_plugin.so -''' - ##### VPP INTERFACES ##### CMD_VPP_CREATE_IFACE = ''' diff --git a/vicn/resource/vpp/vpp_host.py b/vicn/resource/vpp/vpp_host.py index 29094451..60fdfd47 100644 --- a/vicn/resource/vpp/vpp_host.py +++ b/vicn/resource/vpp/vpp_host.py @@ -96,11 +96,7 @@ class VPPHost(LinuxApplication): filename = FN_APPARMOR_DPDK_SCRIPT, content = TPL_APPARMOR_DPDK_SCRIPT, overwrite = True) - startup_conf = TextFile(node = self.node, - filename = FN_VPP_DPDK_SCRIPT, - content = TPL_VPP_DPDK_DAEMON_SCRIPT, - overwrite = True) - return app_armor_file | startup_conf + return app_armor_file @inherit_parent @task @@ -118,23 +114,13 @@ class VPPHost(LinuxApplication): sysctl_hugepages = BashTask(self.node, CMD_SYSCTL_HUGEPAGES, {'nb_hp': DEFAULT_NB_HUGEPAGES}) - # Hook - # The following is needed to create uio devices in /dev. They are - # required to let vpp to use dpdk (or other compatibles) nics. From a - # container, vpp cannot create those devices, therefore we need to - # create them in the host and then mount them on each container running - # vpp (and using a physical nic) - stop_vpp = BashTask(self.node, CMD_VPP_STOP_SERVICE + " || true") - disable_vpp = BashTask(self.node, CMD_VPP_DISABLE + " || true") - disable_vpp = stop_vpp > disable_vpp - create_uio = EmptyTask() for device in self.dpdk_devices: create_uio = create_uio > BashTask(self.node, CMD_CREATE_UIO_DEVICES, {'pci_address' : device}) return ((modules | app_armor_reload) | sysctl_hugepages) > \ - (disable_vpp > create_uio) + create_uio #-------------------------------------------------------------------------- # Attributes |