CSIT-775 HC Test: CRUD over IPv6 control-plane interface
[csit.git] / resources / libraries / python / VppConfigGenerator.py
index 039f629..7bd0175 100644 (file)
@@ -61,6 +61,23 @@ class VppConfigGenerator(object):
         """
         self._vpp_config_filename = filename
 
+    def get_config_filename(self):
+        """Get startup configuration filename.
+
+        :returns: Startup configuration filename.
+        :rtype: str
+        """
+        return self._vpp_config_filename
+
+    def get_config_str(self):
+        """Get dumped startup configuration in VPP config format.
+
+        :returns: Startup configuration in VPP config format.
+        :rtype: str
+        """
+        self.dump_config(self._nodeconfig)
+        return self._vpp_config
+
     def add_config_item(self, config, value, path):
         """Add startup configuration item.
 
@@ -123,13 +140,17 @@ class VppConfigGenerator(object):
         """
         path = ['unix', 'cli-listen']
         self.add_config_item(self._nodeconfig, value, path)
-        self._nodeconfig = {'unix': {'nodaemon': ''}}
 
     def add_unix_nodaemon(self):
         """Add UNIX nodaemon configuration."""
         path = ['unix', 'nodaemon']
         self.add_config_item(self._nodeconfig, '', path)
 
+    def add_unix_exec(self, value):
+        """Add UNIX exec configuration."""
+        path = ['unix', 'exec']
+        self.add_config_item(self._nodeconfig, value, path)
+
     def add_dpdk_dev(self, *devices):
         """Add DPDK PCI device configuration.
 
@@ -180,6 +201,25 @@ class VppConfigGenerator(object):
         path = ['dpdk', 'dev default', 'num-tx-queues']
         self.add_config_item(self._nodeconfig, value, path)
 
+    def add_dpdk_dev_default_rxd(self, value):
+        """Add DPDK dev default rxd configuration.
+
+        :param value: Default number of rxds.
+        :type value: str
+        """
+        path = ['dpdk', 'dev default', 'num-rx-desc']
+        self.add_config_item(self._nodeconfig, value, path)
+
+    def add_dpdk_dev_default_txd(self, value):
+        """Add DPDK dev default txd configuration.
+
+        :param value: Default number of txds.
+        :type value: str
+        """
+        path = ['dpdk', 'dev default', 'num-tx-desc']
+        self.add_config_item(self._nodeconfig, value, path)
+
+
     def add_dpdk_socketmem(self, value):
         """Add DPDK socket memory configuration.
 
@@ -228,7 +268,7 @@ class VppConfigGenerator(object):
     def add_api_trace(self):
         """Add API trace configuration."""
         path = ['api-trace', 'on']
-        self.add_config_item(self._nodeconfig, path, '')
+        self.add_config_item(self._nodeconfig, '', path)
 
     def add_ip6_hash_buckets(self, value):
         """Add IP6 hash buckets configuration.
@@ -248,18 +288,28 @@ class VppConfigGenerator(object):
         path = ['ip6', 'heap-size']
         self.add_config_item(self._nodeconfig, value, path)
 
+    def add_plugin_disable(self, *plugins):
+        """Add plugin disable for specific plugin.
+
+        :param plugins: Plugin(s) to disable.
+        :type plugins: list
+        """
+        for plugin in plugins:
+            path = ['plugins', 'plugin {0}'.format(plugin), 'disable']
+            self.add_config_item(self._nodeconfig, ' ', path)
+
     def add_dpdk_no_multi_seg(self):
         """Add DPDK no-multi-seg configuration."""
         path = ['dpdk', 'no-multi-seg']
         self.add_config_item(self._nodeconfig, '', path)
 
-    def add_snat(self, value='deterministic'):
-        """Add SNAT configuration.
+    def add_nat(self, value='deterministic'):
+        """Add NAT configuration.
 
-        :param value: SNAT mode.
+        :param value: NAT mode.
         :type value: str
         """
-        path = ['snat']
+        path = ['nat']
         self.add_config_item(self._nodeconfig, value, path)
 
     def apply_config(self, waittime=5, retries=12):