CSIT-209 Add option enable-vhost-user into startup config 80/1980/5
authorpmikus <pmikus@cisco.com>
Mon, 18 Jul 2016 06:06:23 +0000 (07:06 +0100)
committerMiroslav Miklus <mmiklus@cisco.com>
Tue, 19 Jul 2016 12:21:37 +0000 (12:21 +0000)
- Add option enable-vhost-user into startup config

Change-Id: I2cf7952047ee749bd66e041b57aaee61c2687382
Signed-off-by: pmikus <pmikus@cisco.com>
resources/libraries/python/VppConfigGenerator.py
resources/libraries/robot/default.robot

index 24fb8ce..f255266 100644 (file)
@@ -58,6 +58,7 @@ dpdk {{
   }}
 {pciconfig}
 {nomultiseg}
   }}
 {pciconfig}
 {nomultiseg}
+{enablevhostuser}
 }}
 """
 # End VPP configuration template.
 }}
 """
 # End VPP configuration template.
@@ -209,6 +210,25 @@ class VppConfigGenerator(object):
         logger.debug('Setting hostname {} config with {}'.\
             format(hostname, "no-multi-seg"))
 
         logger.debug('Setting hostname {} config with {}'.\
             format(hostname, "no-multi-seg"))
 
+    def add_enable_vhost_user_config(self, node):
+        """Add enable-vhost-user configuration for node.
+
+        :param node: DUT node.
+        :type node: dict
+        :return: nothing
+        """
+        if node['type'] != NodeType.DUT:
+            raise ValueError('Node type is not a DUT')
+        hostname = Topology.get_node_hostname(node)
+        if not hostname in self._nodeconfig:
+            self._nodeconfig[hostname] = {}
+        if not 'enable_vhost_user' in self._nodeconfig[hostname]:
+            self._nodeconfig[hostname]['enable_vhost_user'] = []
+        self._nodeconfig[hostname]['enable_vhost_user'].append(
+            "enable-vhost-user")
+        logger.debug('Setting hostname {} config with {}'.\
+            format(hostname, "enable-vhost-user"))
+
     def remove_all_pci_devices(self, node):
         """Remove PCI device configuration from node.
 
     def remove_all_pci_devices(self, node):
         """Remove PCI device configuration from node.
 
@@ -299,6 +319,21 @@ class VppConfigGenerator(object):
         logger.debug('Clearing No Multi Seg config for hostname {}.'.\
             format(hostname))
 
         logger.debug('Clearing No Multi Seg config for hostname {}.'.\
             format(hostname))
 
+    def remove_enable_vhost_user_config(self, node):
+        """Remove enable-vhost-user configuration from node.
+
+        :param node: DUT node.
+        :type node: dict
+        :return: nothing
+        """
+        if node['type'] != NodeType.DUT:
+            raise ValueError('Node type is not a DUT')
+        hostname = Topology.get_node_hostname(node)
+        if hostname in self._nodeconfig:
+            self._nodeconfig[hostname]['enable_vhost_user'] = []
+        logger.debug('Clearing enable-vhost-user config for hostname {}.'.\
+            format(hostname))
+
     def apply_config(self, node, waittime=5, retries=12):
         """Generate and apply VPP configuration for node.
 
     def apply_config(self, node, waittime=5, retries=12):
         """Generate and apply VPP configuration for node.
 
@@ -324,6 +359,7 @@ class VppConfigGenerator(object):
         rxqueuesconfig = ""
         txqueuesconfig = ""
         nomultiseg = ""
         rxqueuesconfig = ""
         txqueuesconfig = ""
         nomultiseg = ""
+        enablevhostuser = ""
 
         if hostname in self._nodeconfig:
             cfg = self._nodeconfig[hostname]
 
         if hostname in self._nodeconfig:
             cfg = self._nodeconfig[hostname]
@@ -346,13 +382,16 @@ class VppConfigGenerator(object):
             if 'no_multi_seg_config' in cfg:
                 nomultiseg = "  " + "\n  ".join(cfg['no_multi_seg_config'])
 
             if 'no_multi_seg_config' in cfg:
                 nomultiseg = "  " + "\n  ".join(cfg['no_multi_seg_config'])
 
+            if 'enable_vhost_user' in cfg:
+                enablevhostuser = "  " + "\n  ".join(cfg['enable_vhost_user'])
+
         vppconfig = VPP_CONFIG_TEMPLATE.format(cpuconfig=cpuconfig,
                                                pciconfig=pciconfig,
                                                socketmemconfig=socketmemconfig,
         vppconfig = VPP_CONFIG_TEMPLATE.format(cpuconfig=cpuconfig,
                                                pciconfig=pciconfig,
                                                socketmemconfig=socketmemconfig,
-                                               heapsizeconfig=heapsizeconfig,
                                                rxqueuesconfig=rxqueuesconfig,
                                                txqueuesconfig=txqueuesconfig,
                                                rxqueuesconfig=rxqueuesconfig,
                                                txqueuesconfig=txqueuesconfig,
-                                               nomultiseg = nomultiseg)
+                                               nomultiseg=nomultiseg,
+                                               enablevhostuser=enablevhostuser)
 
         logger.debug('Writing VPP config to host {}: "{}"'.format(hostname,
                                                                   vppconfig))
 
         logger.debug('Writing VPP config to host {}: "{}"'.format(hostname,
                                                                   vppconfig))
index 6591b3c..ad5d69d 100644 (file)
 | | :FOR | ${dut} | IN | @{duts}
 | | | Add No Multi Seg Config | ${nodes['${dut}']}
 
 | | :FOR | ${dut} | IN | @{duts}
 | | | Add No Multi Seg Config | ${nodes['${dut}']}
 
+| Add Enable Vhost User to all DUTs
+| | [Documentation] | Add Enable Vhost User to VPP startup configuration to all
+| | ...             | DUTs
+| | ${duts}= | Get Matches | ${nodes} | DUT*
+| | :FOR | ${dut} | IN | @{duts}
+| | | Add Enable Vhost User Config | ${nodes['${dut}']}
+
 | Remove startup configuration of VPP from all DUTs
 | | [Documentation] | Remove VPP startup configuration from all DUTs
 | | ${duts}= | Get Matches | ${nodes} | DUT*
 | Remove startup configuration of VPP from all DUTs
 | | [Documentation] | Remove VPP startup configuration from all DUTs
 | | ${duts}= | Get Matches | ${nodes} | DUT*
 | | | Remove Heapsize Config | ${nodes['${dut}']}
 | | | Remove Rxqueues Config | ${nodes['${dut}']}
 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
 | | | Remove Heapsize Config | ${nodes['${dut}']}
 | | | Remove Rxqueues Config | ${nodes['${dut}']}
 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
+| | | Remove Enable Vhost User Config | ${nodes['${dut}']}
 
 | Setup default startup configuration of VPP on all DUTs
 | | [Documentation] | Setup default startup configuration of VPP to all DUTs
 
 | Setup default startup configuration of VPP on all DUTs
 | | [Documentation] | Setup default startup configuration of VPP to all DUTs