aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md54
-rw-r--r--netmodel/util/daemon.py4
-rwxr-xr-xsetup.py12
-rw-r--r--vicn/resource/icn/cicn.py4
-rw-r--r--vicn/resource/linux/file.py14
-rw-r--r--vicn/resource/lxd/lxc_container.py3
-rw-r--r--vicn/resource/vpp/interface.py2
-rw-r--r--vicn/resource/vpp/scripts.py8
-rw-r--r--vicn/resource/vpp/vpp.py21
-rw-r--r--vicn/resource/vpp/vpp_commands.py5
-rw-r--r--vicn/resource/vpp/vpp_host.py18
11 files changed, 75 insertions, 70 deletions
diff --git a/README.md b/README.md
index 08a1365d..c0fef87a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
-= vICN
+vICN
+=========
-== Description
+Description
+-------------
This application is an ICN experimental testbed orchestrator. It allows to
quickly deploy experiments in a cluster using linux containers, IP tunnels and
@@ -18,48 +20,40 @@ The master, vICN, controls the whole cluster of servers, by means of HTTPS REST
APIs and remote SSH.
-== Dependencies
+Dependencies
+-------------
vICN requires a version of Python >= 3.5, and has the following dependendies.
We refer to them using the name of debian/ubuntu packages:
-python3 (>= 3.5)
-python3-sympy
-python3-requests
-python3-websockets
-python3-networkx
-python3-pyparsing
-python3-autobahn
-python3-pylxd (>=2.2.2, use pip3 if necessary, depends on libssl-dev)
- python3-pbr
- python3-requests-unixsocket
+- python3 (>= 3.5)
+- libssl-dev
+- python3-pip
+- python3-daemon
+Installation on Ubuntu
+-------------
-== Installation
+Download vICN by cloning the git repositoy.
-Install vICN from either a debian package or by cloning the git repositoy.
+ git clone -b vicn/master https://gerrit.fd.io/r/cicn vicn
-Add the image server certificate to your trusted certificates:
+If you plan to use vICN with Linux Containers, get the latest version of lxd from the LXD ppa:
- sudo apt-get install ca-certificates
- wget https://46.105.122.213/cicn.crt
- sudo cp cicn.crt /usr/share/ca-certificates
- sudo dpkg-reconfigure ca-certificates
+ sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
+ sudo apt-get update
- # This should be done by the LXD remote add
- cp /usr/share/ca-certificates/cicn.crt ~/.config/lxc/servercerts/
+Install the dependencies. Beware to install the daemon module of python through repositories as the pip version is broken.
- lxc remote add cicn https://46.105.122.213 --protocol=simplestreams
+ sudo apt-get install python3-pip libssl-dev python3-daemon
-You can now list image with:
+You can now install vICN:
- lxc image list cicn:
+ cd vicn
+ sudo ./setup.py install
-or run containers:
-
- lxc launch cicn:cicn/1.0 test
-
-== Getting started
+Getting started
+--------------
You can have a look at the tutorials available in the fd.io wiki:
diff --git a/netmodel/util/daemon.py b/netmodel/util/daemon.py
index eb8cd1a2..5040a88e 100644
--- a/netmodel/util/daemon.py
+++ b/netmodel/util/daemon.py
@@ -53,10 +53,10 @@ class Daemon:
ret = True
except AttributeError as e:
# daemon and python-daemon conflict with each other
- log.critical("Please install python-daemon instead of daemon." \
+ log.critical("Please install python3-daemon instead of daemon." \
"Remove daemon first.")
except ImportError:
- log.critical("Please install python-daemon.")
+ log.critical("Please install python3-daemon.")
return ret
#--------------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 4ebd21c4..a12bcafc 100755
--- a/setup.py
+++ b/setup.py
@@ -34,13 +34,17 @@ with open('README.md') as f:
long_description = f.read()
# XXX TODO
-required_modules = list()
+required_modules = ["pylxd (>=2.2.2)",
+ "pyparsing",
+ "networkx (==1.11)",
+ "autobahn",
+ "pyOpenSSL"]
data_files = list()
data_files.extend([
- ("/lib/systemd/system/", ["etc/netmon.service"]),
- ("/etc/init/", ["etc/netmon.conf"]),
+ ("/lib/systemd/system", ["etc/netmon.service"]),
+ ("/etc/init", ["etc/netmon.conf"]),
])
@@ -71,7 +75,7 @@ setup(
packages = find_packages(),
data_files = data_files,
- install_requires = required_modules,
+ requires = required_modules,
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
diff --git a/vicn/resource/icn/cicn.py b/vicn/resource/icn/cicn.py
index 76dafe0e..8ab36ec9 100644
--- a/vicn/resource/icn/cicn.py
+++ b/vicn/resource/icn/cicn.py
@@ -31,7 +31,7 @@ from vicn.resource.vpp.vpp_commands import CMD_VPP_ENABLE_PLUGIN
CMD_VPP_CICN_GET = "vppctl_wrapper cicn show"
CMD_VPP_ADD_ICN_ROUTE = 'vppctl_wrapper cicn cfg fib add prefix {route.prefix} face {route.face.id}'
-CMD_VPP_ADD_ICN_FACE = 'vppctl_wrapper cicn cfg face add local {face.src_ip}:{face.src_port} remote {face.dst_ip}:{face.dst_port}'
+CMD_VPP_ADD_ICN_FACE = 'vppctl_wrapper cicn cfg face add local {face.src.ip4_address}:{face.src_port} remote {face.dst.ip4_address}:{face.dst_port}'
CMD_VPP_CICN_GET_CACHE_SIZE = 'vppctl_wrapper cicn show | grep "CS entries" | grep -Eo "[0-9]+"'
CMD_VPP_CICN_SET_CACHE_SIZE = 'vppctl_wrapper cicn control param cs size {self.cache_size}'
@@ -95,7 +95,7 @@ class CICNForwarder(Forwarder):
for face in self.faces:
face_task = face_task > BashTask(self.node, CMD_VPP_ADD_ICN_FACE,
{'face':face},
- parse = (lambda x : parse_face(x, face)), lock = lock)
+ parse = (lambda x, y=face : parse_face(x, y)), lock = lock)
if not self.routes:
from vicn.resource.icn.route import Route
diff --git a/vicn/resource/linux/file.py b/vicn/resource/linux/file.py
index 2a62f60e..24ead998 100644
--- a/vicn/resource/linux/file.py
+++ b/vicn/resource/linux/file.py
@@ -34,6 +34,10 @@ GREP_FILE_CMD = "cat {file.filename}"
CMD_PRINT_TO_FILE = 'echo -n "{file.content}" > {file.filename}'
+GET_FILE_EXEC_CMD = 'test -x {file.filename} && echo True || echo False'
+
+CMD_MAKE_FILE_EXEC = 'chmod +x {file.filename}'
+
class File(Resource):
"""
Resource: File
@@ -95,6 +99,9 @@ class TextFile(File):
"""
content = Attribute(String, default='')
+ executable = Attribute(Bool,
+ description = 'Determines whether the file has to be set as an executable',
+ default = False)
#--------------------------------------------------------------------------
# Resource lifecycle
@@ -115,3 +122,10 @@ class TextFile(File):
def _get_content(self):
return BashTask(self.node, GREP_FILE_CMD, {'file': self},
parse =( lambda x : x.stdout))
+
+ def _get_executable(self):
+ return BashTask(self.node, GET_FILE_EXEC_CMD, {'file': self},
+ parse =( lambda x : x.stdout))
+
+ def _set_executable(self):
+ return BashTask(self.node, CMD_MAKE_FILE_EXEC, {'file':self})
diff --git a/vicn/resource/lxd/lxc_container.py b/vicn/resource/lxd/lxc_container.py
index 5b1d4e3b..a9f8483d 100644
--- a/vicn/resource/lxd/lxc_container.py
+++ b/vicn/resource/lxd/lxc_container.py
@@ -18,6 +18,7 @@
import logging
import shlex
+import time
# Suppress logging from pylxd dependency on ws4py
# (this needs to be included before pylxd)
@@ -251,7 +252,7 @@ class LxcContainer(Node):
Method: Start the container
"""
self._container.start(wait = True)
- import time; time.sleep(1)
+ time.sleep(1)
@task
def __method_stop__(self):
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