Fix Tap failing tests
[csit.git] / resources / libraries / python / LispUtil.py
index 556ae1b..786dac4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
+# Copyright (c) 2018 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -30,7 +30,7 @@ class LispUtil(object):
 
         :param node: VPP node.
         :type node: dict
-        :return: Lisp gpe state.
+        :returns: Lisp gpe state.
         :rtype: list
         """
 
@@ -45,10 +45,10 @@ class LispUtil(object):
 
         :param node: VPP node.
         :param items_filter: Filter which specifies which items should be
-        retrieved - local, remote, empty string = both.
+            retrieved - local, remote, empty string = both.
         :type node: dict
         :type items_filter: str
-        :return: Lisp locator_set data as python list.
+        :returns: Lisp locator_set data as python list.
         :rtype: list
         """
 
@@ -66,7 +66,7 @@ class LispUtil(object):
 
         :param node: VPP node.
         :type node: dict
-        :return: Lisp eid table as python list.
+        :returns: Lisp eid table as python list.
         :rtype: list
         """
 
@@ -80,7 +80,7 @@ class LispUtil(object):
 
         :param node: VPP node.
         :type node: dict
-        :return: Lisp map resolver as python list.
+        :returns: Lisp map resolver as python list.
         :rtype: list
         """
 
@@ -88,6 +88,90 @@ class LispUtil(object):
         vat.execute_script_json_out('lisp/show_lisp_map_resolver.vat', node)
         return JsonParser().parse_data(vat.get_script_stdout())
 
+    @staticmethod
+    def vpp_show_lisp_map_register(node):
+        """Get LISP Map Register from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: LISP Map Register as python list.
+        :rtype: list
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_map_register.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
+    @staticmethod
+    def vpp_show_lisp_map_request_mode(node):
+        """Get LISP Map Request mode from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: LISP Map Request mode as python list.
+        :rtype: list
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_map_request_mode.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
+    @staticmethod
+    def vpp_show_lisp_map_server(node):
+        """Get LISP Map Server from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: LISP Map Server as python list.
+        :rtype: list
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_map_server.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
+    @staticmethod
+    def vpp_show_lisp_petr_config(node):
+        """Get LISP PETR configuration from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: LISP PETR configuration as python list.
+        :rtype: list
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_petr_config.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
+    @staticmethod
+    def vpp_show_lisp_rloc_config(node):
+        """Get LISP RLOC configuration from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: LISP RLOC configuration as python list.
+        :rtype: list
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_rloc_config.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
+    @staticmethod
+    def vpp_show_lisp_pitr(node):
+        """Get Lisp PITR feature config from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: Lisp PITR config data.
+        :rtype: dict
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_pitr.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
     @staticmethod
     def lisp_should_be_equal(lisp_val1, lisp_val2):
         """Fail if the lisp values are not equal.
@@ -135,8 +219,8 @@ class LispUtil(object):
         :param locator_set_number: Generate n locator_set.
         :type node: dict
         :type locator_set_number: str
-        :return: list of lisp locator_set, list of lisp locator_set expected
-        from VAT.
+        :returns: list of lisp locator_set, list of lisp locator_set expected
+            from VAT.
         :rtype: tuple
         """
 
@@ -181,8 +265,8 @@ class LispUtil(object):
         :param locator_set_number: Generate n locator_set.
         :type node: dict
         :type locator_set_number: str
-        :return: list of lisp locator_set, list of lisp locator_set expected
-        from VAT.
+        :returns: list of lisp locator_set, list of lisp locator_set expected
+            from VAT.
         :rtype: tuple
         """
 
@@ -211,7 +295,7 @@ class LispUtil(object):
                     locator_set_list.append(locator_set)
 
                     locator_set_vat = {"ls_name": l_name,
-                               "ls_index": num}
+                                       "ls_index": num}
                     locator_set_list_vat.append(locator_set_vat)
 
         return locator_set_list, locator_set_list_vat