Papi: Rename methods argument
[csit.git] / resources / libraries / python / PapiExecutor.py
index 0313284..a51cb76 100644 (file)
@@ -20,12 +20,10 @@ from robot.api import logger
 
 from resources.libraries.python.Constants import Constants
 from resources.libraries.python.ssh import SSH, SSHTimeout
+from resources.libraries.python.PapiHistory import PapiHistory
 
 __all__ = ["PapiExecutor", "PapiResponse"]
 
-# TODO: Implement Papi History
-# from resources.libraries.python.PapiHistory import PapiHistory
-
 
 class PapiResponse(object):
     """Class for metadata specifying the Papi reply, stdout, stderr and return
@@ -138,17 +136,22 @@ class PapiExecutor(object):
         self._api_command_list = list()
         return self
 
-    def add(self, command, **kwargs):
+    def add(self, csit_papi_command, **kwargs):
         """Add next command to internal command list; return self.
 
-        :param command: VPP API command.
+        The argument name 'csit_papi_command' must be unique enough as it cannot
+        be repeated in kwargs.
+
+        :param csit_papi_command: VPP API command.
         :param kwargs: Optional key-value arguments.
-        :type command: str
+        :type csit_papi_command: str
         :type kwargs: dict
         :returns: self, so that method chaining is possible.
         :rtype: PapiExecutor
         """
-        self._api_command_list.append(dict(api_name=command, api_args=kwargs))
+        PapiHistory.add_to_papi_history(self._node, csit_papi_command, **kwargs)
+        self._api_command_list.append(dict(api_name=csit_papi_command,
+                                           api_args=kwargs))
         return self
 
     def execute(self, process_reply=True, ignore_errors=False, timeout=120):