aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/resource/vpp/vpp_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'vicn/resource/vpp/vpp_commands.py')
-rw-r--r--vicn/resource/vpp/vpp_commands.py50
1 files changed, 27 insertions, 23 deletions
diff --git a/vicn/resource/vpp/vpp_commands.py b/vicn/resource/vpp/vpp_commands.py
index 40315c19..30898eae 100644
--- a/vicn/resource/vpp/vpp_commands.py
+++ b/vicn/resource/vpp/vpp_commands.py
@@ -5,37 +5,41 @@ CMD_VPP_DISABLE = 'systemctl disable vpp.service'
# 'sleep 1' ensures that VPP has enough time to start
CMD_VPP_START = '''
-systemctl start vpp
-sleep 1
+flock /tmp/vppctl.lock -c "systemctl start vpp"
'''
CMD_VPP_STOP = '''
-systemctl stop vpp
-killall -9 vpp_main || true
+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
'''
-CMD_VPP_ENABLE_PLUGIN = 'vppctl {plugin} enable'
##### VPP INTERFACES #####
CMD_VPP_CREATE_IFACE = '''
-# Create vpp interface from netmodel.network.interface.device_name} with mac {self.parent.mac_address}
-vppctl create host-interface name {vpp_interface.parent.device_name} hw-addr {vpp_interface.parent.mac_address}
-vppctl set interface state {vpp_interface.device_name} up
+# Create vpp interface from {vpp_interface.parent.device_name} with mac {vpp_interface.parent.mac_address}
+vppctl_wrapper create host-interface name {vpp_interface.parent.device_name} hw-addr {vpp_interface.parent.mac_address}
+vppctl_wrapper set interface state {vpp_interface.device_name} up
'''
-CMD_VPP_SET_IP = 'vppctl set int ip address {netdevice.device_name} {netdevice.ip4_address}/{netdevice.prefix_len}'
-CMD_VPP_SET_UP = 'vppctl set int state {netdevice.device_name} up'
-
-##### VPP IP ROUTING #####
-CMD_VPP_ADD_ROUTE = 'vppctl set ip arp static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
-CMD_VPP_DEL_ROUTE = 'vppctl set ip arp del static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
-CMD_VPP_ADD_ROUTE_GW = 'vppctl ip route add {route.ip_address}/32 via {route.gateway} {route.interface.vppinterface.device_name}'
-CMD_VPP_DEL_ROUTE_GW = 'vppctl ip route del {route.ip_address}/32 via {route.gateway} {route.interface.vppinterface.device_name}'
-
-##### VPP CICN PLUGIN #####
+# It is important to pass the mac address so that it does not get randomly
+# generated by VPP, preventing any reboot of VPP and recreation of commands
+CMD_VPP_CREATE_MEMIFACE = '''
+# Create vpp interface from shared_memory
+vppctl_wrapper create memif key {key} socket {vpp_interface.parent.path_unix_socket}{vpp_interface.parent.socket_name} hw-addr {vpp_interface.parent.mac_address} {master_slave}
+'''
+CMD_VPP_SET_IP = 'vppctl_wrapper set int ip address {device_name} {ip_address}/{prefix_len}'
+CMD_VPP_SET_UP = 'vppctl_wrapper set int state {netdevice.device_name} {state}'
-CMD_VPP_CICN_GET = "timeout 1 vppctl cicn show" #We timeout if vpp is not started
-CMD_VPP_ADD_ICN_ROUTE = 'vppctl cicn cfg fib add prefix {route.prefix} face {route.face.id}'
-CMD_VPP_ADD_ICN_FACE = 'vppctl cicn cfg face add local {face.src_ip}:{face.src_port} remote {face.dst_ip}:{face.dst_port}'
+##### VPP IP ROUTING #####
-CMD_VPP_CICN_GET_CACHE_SIZE = 'vppctl cicn show | grep "CS entries" | grep -Eo "[0-9]+"'
-CMD_VPP_CICN_SET_CACHE_SIZE = 'vppctl cicn control param cs size {self.cache_size}'
+CMD_VPP_ADD_ARP = 'vppctl_wrapper set ip arp static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
+CMD_VPP_DEL_ARP = 'vppctl_wrapper set ip arp del static {route.interface.vppinterface.device_name} {route.ip_address} {route.mac_address}'
+CMD_VPP_ADD_ROUTE = 'vppctl_wrapper ip route add {route.ip_address}/{route.ip_address.prefix_len} via {route.interface.vppinterface.device_name}'
+CMD_VPP_DEL_ROUTE = 'vppctl_wrapper ip route del {route.ip_address}/{route.ip_address.prefix_len} via {route.interface.vppinterface.device_name}'
+CMD_VPP_ADD_ROUTE_GW = 'vppctl_wrapper ip route add {route.ip_address}/{route.ip_address.prefix_len} via {route.gateway} {route.interface.vppinterface.device_name}'
+CMD_VPP_DEL_ROUTE_GW = 'vppctl_wrapper ip route del {route.ip_address}/{route.ip_address.prefix_len} via {route.gateway} {route.interface.vppinterface.device_name}'