Papi: Rename methods argument 00/18100/1
authorTibor Frank <tifrank@cisco.com>
Thu, 7 Mar 2019 08:27:46 +0000 (09:27 +0100)
committerTibor Frank <tifrank@cisco.com>
Thu, 7 Mar 2019 08:30:32 +0000 (09:30 +0100)
The argument name 'csit_papi_command' must be unique enough as it cannot
be repeated in kwargs.
  - PapiExecutor.add(self, csit_papi_command, **kwargs)
  - PapiHistory.add_to_papi_history(node, csit_papi_command, papi=True, **kwargs)

Change-Id: I243a20d6f03befb149891c37a88e0e6359ea2940
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/libraries/python/PapiExecutor.py
resources/libraries/python/PapiHistory.py

index 928144e..a51cb76 100644 (file)
@@ -136,18 +136,22 @@ class PapiExecutor(object):
         self._api_command_list = list()
         return self
 
         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.
 
         """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.
         :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
         """
         :type kwargs: dict
         :returns: self, so that method chaining is possible.
         :rtype: PapiExecutor
         """
-        PapiHistory.add_to_papi_history(self._node, command, **kwargs)
-        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):
         return self
 
     def execute(self, process_reply=True, ignore_errors=False, timeout=120):
index 13c483b..eede0d2 100644 (file)
@@ -48,16 +48,19 @@ class PapiHistory(object):
                 PapiHistory.reset_papi_history(node)
 
     @staticmethod
                 PapiHistory.reset_papi_history(node)
 
     @staticmethod
-    def add_to_papi_history(node, cmd, papi=True, **kwargs):
+    def add_to_papi_history(node, csit_papi_command, papi=True, **kwargs):
         """Add command to PAPI command history on DUT node.
 
         """Add command to PAPI command history on DUT node.
 
+        The argument name 'csit_papi_command' must be unique enough as it cannot
+        be repeated in kwargs.
+
         :param node: DUT node to add command to PAPI command history for.
         :param node: DUT node to add command to PAPI command history for.
-        :param cmd: Command to be added to PAPI command history.
+        :param csit_papi_command: Command to be added to PAPI command history.
         :param papi: Says if the command to store is PAPi or VAT. Remove when
             VAT executor is completely removed.
         :param kwargs: Optional key-value arguments.
         :type node: dict
         :param papi: Says if the command to store is PAPi or VAT. Remove when
             VAT executor is completely removed.
         :param kwargs: Optional key-value arguments.
         :type node: dict
-        :type cmd: str
+        :type csit_papi_command: str
         :type papi: bool
         :type kwargs: dict
         """
         :type papi: bool
         :type kwargs: dict
         """
@@ -65,12 +68,13 @@ class PapiHistory(object):
             args = list()
             for key, val in kwargs.iteritems():
                 args.append("{key}={val}".format(key=key, val=val))
             args = list()
             for key, val in kwargs.iteritems():
                 args.append("{key}={val}".format(key=key, val=val))
-            item = "{cmd}({args})".format(cmd=cmd, args=",".join(args))
+            item = "{cmd}({args})".format(cmd=csit_papi_command,
+                                          args=",".join(args))
         else:
             # This else part is here to store VAT commands.
             # VAT history is not used.
             # TODO: Remove when VatExecutor is completely removed.
         else:
             # This else part is here to store VAT commands.
             # VAT history is not used.
             # TODO: Remove when VatExecutor is completely removed.
-            item = "{cmd}".format(cmd=cmd)
+            item = "{cmd}".format(cmd=csit_papi_command)
         DICT__DUTS_PAPI_HISTORY[node['host']].append(item)
 
     @staticmethod
         DICT__DUTS_PAPI_HISTORY[node['host']].append(item)
 
     @staticmethod