span: add feature (rx only) (VPP-185)
[vpp.git] / test / vpp_papi_provider.py
index 10445de..2148e94 100644 (file)
@@ -69,7 +69,8 @@ class VppPapiProvider(object):
         return reply
 
     def cli(self, cli):
-        """Execute a CLI, calling the before/after hooks appropriately
+        """
+        Execute a CLI, calling the before/after hooks appropriately.
 
         :param cli: CLI to execute
         :returns: CLI output
@@ -79,9 +80,18 @@ class VppPapiProvider(object):
         cli += '\n'
         r = vpp_papi.cli_inband(len(cli), cli)
         self.hook.after_cli(cli)
-        if(hasattr(r, 'reply')):
+        if hasattr(r, 'reply'):
             return r.reply[0].decode().rstrip('\x00')
 
+    def ppcli(self, cli):
+        """
+        Helping method to print CLI command in case of info logging level.
+
+        :param cli: CLI to execute
+        :returns: CLI output
+        """
+        return cli + "\n" + self.cli(cli)
+
     def show_version(self):
         """ """
         return vpp_papi.show_version()
@@ -391,3 +401,13 @@ class VppPapiProvider(object):
              dst_address
              )
         )
+
+    def sw_interface_span_enable_disable(self, sw_if_index_from, sw_if_index_to, enable=1):
+        """
+
+        :param sw_if_index_from:
+        :param sw_if_index_to:
+        :param enable
+
+        """
+        return self.api(vpp_papi.sw_interface_span_enable_disable, (sw_if_index_from, sw_if_index_to, enable ))