X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FLispUtil.py;h=c50e626b80f6e90c32e41244b1f105473a131a33;hp=b21e1ae5119c2c86b941d700e924685b6433b5da;hb=c3bf9f6ad20223998c1103ba3061a5e338979e2b;hpb=021f8d100444281caf176b33f6dcc12bfba09f1f diff --git a/resources/libraries/python/LispUtil.py b/resources/libraries/python/LispUtil.py index b21e1ae511..c50e626b80 100644 --- a/resources/libraries/python/LispUtil.py +++ b/resources/libraries/python/LispUtil.py @@ -15,7 +15,7 @@ from resources.libraries.python.parsers.JsonParser import JsonParser from resources.libraries.python.topology import Topology -from resources.libraries.python.VatExecutor import VatExecutor +from resources.libraries.python.VatExecutor import VatExecutor, VatTerminal class LispUtil(object): @@ -40,22 +40,29 @@ class LispUtil(object): return JsonParser().parse_data(vat.get_script_stdout()) @staticmethod - def vpp_show_lisp_locator_set(node): + def vpp_show_lisp_locator_set(node, items_filter): """Get lisp locator_set from VPP node. :param node: VPP node. + :param items_filter: Filter which specifies which items should be + retrieved - local, remote, empty string = both. :type node: dict + :type items_filter: str :return: Lisp locator_set data as python list. :rtype: list """ - vat = VatExecutor() - vat.execute_script_json_out('lisp/show_lisp_locator_set.vat', node) - return JsonParser().parse_data(vat.get_script_stdout()) + try: + with VatTerminal(node) as vat: + response = vat.vat_terminal_exec_cmd_from_template( + 'lisp/show_lisp_locator_set.vat', filter=items_filter) + return response[0] + except ValueError: + return [] @staticmethod - def vpp_show_lisp_local_eid_table(node): - """Get lisp local eid table from VPP node. + def vpp_show_lisp_eid_table(node): + """Get lisp eid table from VPP node. :param node: VPP node. :type node: dict @@ -64,7 +71,7 @@ class LispUtil(object): """ vat = VatExecutor() - vat.execute_script_json_out('lisp/show_lisp_local_eid_table.vat', node) + vat.execute_script_json_out('lisp/show_lisp_eid_table.vat', node) return JsonParser().parse_data(vat.get_script_stdout()) @staticmethod @@ -101,7 +108,7 @@ class LispUtil(object): for tmp in lisp_val1: if tmp not in lisp_val2: - raise RuntimeError('Value {} is not find in vpp:\n' + raise RuntimeError('Value {} not found in vpp:\n' '{}'.format(tmp, lisp_val2)) def lisp_locator_s_should_be_equal(self, locator_set1, locator_set2):