- VatExecutor.cmd_from_template(node,
- 'lisp/del_lisp_locator_set.vat',
- lisp_name=name)
-
-
-class LispSetup(object):
- """Lisp setup in topology."""
-
- def __init__(self):
- pass
-
- @staticmethod
- def vpp_set_lisp_locator_set(node, locator_set_list):
- """Set lisp locator_sets on VPP node in topology.
-
- :param node: VPP node.
- :param locator_set_list: List of locator_set.
- :type node: dict
- :type locator_set_list: list
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Node is not DUT')
-
- lisp_locator = LispLocator()
- lisp_locator_set = LispLocatorSet()
- for locator_set in locator_set_list:
- locator_set_name = locator_set.get('locator-set')
- locator_list = locator_set.get('locator')
- lisp_locator_set.vpp_add_lisp_locator_set(node,
- locator_set_name)
- for locator in locator_list:
- sw_if_index = locator.get('locator-index')
- priority = locator.get('priority')
- weight = locator.get('weight')
- lisp_locator.vpp_add_lisp_locator(node,
- locator_set_name,
- sw_if_index,
- priority,
- weight)
-
- @staticmethod
- def vpp_unset_lisp_locator_set(node, locator_set_list):
- """Unset lisp locator_sets on VPP node in topology.
-
- :param node: VPP node.
- :param locator_set_list: List of locator_set.
- :type node: dict
- :type locator_set_list: list
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Lisp locator set, node is not DUT')
-
- lisp_locator = LispLocator()
- lisp_locator_set = LispLocatorSet()
- for locator_set in locator_set_list:
- locator_set_name = locator_set.get('locator-set')
- locator_list = locator_set.get('locator')
- for locator in locator_list:
- sw_if_index = locator.get('locator-index')
- priority = locator.get('priority')
- weight = locator.get('weight')
- lisp_locator.vpp_del_lisp_locator(node,
- locator_set_name,
- sw_if_index,
- priority,
- weight)
-
- lisp_locator_set.vpp_del_lisp_locator_set(node,
- locator_set_name)
-
- @staticmethod
- def vpp_set_lisp_eid_table(node, eid_table):
- """Set lisp eid tables on VPP node in topology.
-
- :param node: VPP node.
- :param eid_table: Dictionary containing information of eid_table.
- :type node: dict
- :type eid_table: dict
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Node is not DUT')
-
- lisp_locator_set = LispLocatorSet()
- lisp_eid = LispLocalEid()
- for eid in eid_table:
- vni = eid.get('vni')
- eid_address = eid.get('eid')
- eid_prefix_len = eid.get('eid-prefix-len')
- locator_set_name = eid.get('locator-set')
- lisp_locator_set.vpp_add_lisp_locator_set(node, locator_set_name)
- lisp_eid.vpp_add_lisp_local_eid(node,
- locator_set_name,
- vni,
- eid_address,
- eid_prefix_len)
-
- @staticmethod
- def vpp_unset_lisp_eid_table(node, eid_table):
- """Unset lisp eid tables on VPP node in topology.
-
- :param node: VPP node.
- :param eid_table: Dictionary containing information of eid_table.
- :type node: dict
- :type eid_table: dict
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Node is not DUT')
-
- locator_set_list = []
- lisp_locator_set = LispLocatorSet()
- lisp_eid = LispLocalEid()
- for eid in eid_table:
- vni = eid.get('vni')
- eid_address = eid.get('eid')
- eid_prefix_len = eid.get('eid-prefix-len')
- locator_set_name = eid.get('locator-set')
- if locator_set_name not in locator_set_list:
- locator_set_list.append(locator_set_name)
-
- lisp_eid.vpp_del_lisp_local_eid(node,
- locator_set_name,
- vni,
- eid_address,
- eid_prefix_len)
-
- for locator_set_name in locator_set_list:
- lisp_locator_set.vpp_del_lisp_locator_set(node, locator_set_name)
-
- @staticmethod
- def vpp_set_lisp_map_resolver(node, map_resolver):
- """Set lisp map resolvers on VPP node in topology.
-
- :param node: VPP node.
- :param map_resolver: Dictionary containing information of map resolver.
- :type node: dict
- :type map_resolver: dict
- """
-
- lisp_map_res = LispMapResolver()
- for map_ip in map_resolver:
- lisp_map_res.vpp_add_map_resolver(node, map_ip.get('map resolver'))
-
- @staticmethod
- def vpp_unset_lisp_map_resolver(node, map_resolver):
- """Unset lisp map resolvers on VPP node in topology.
-
- :param node: VPP node.
- :param map_resolver: Dictionary containing information of map resolver.
- :type node: dict
- :type map_resolver: dict
- """
-
- lisp_map_res = LispMapResolver()
- for map_ip in map_resolver:
- lisp_map_res.vpp_del_map_resolver(node, map_ip.get('map resolver'))
-
- @staticmethod
- def vpp_lisp_gpe_interface_status(node, state):
- """Set lisp gpe interface status on VPP node in topology.
-
- :param node: VPP node.
- :param state: State of the gpe iface, up or down
- :type node: dict
- :type state: str
- """
-
- lgi = LispGpeIface()
- lgi.vpp_lisp_gpe_iface(node, state)