- def vpp_set_lisp_locator_set(node, locator_sets):
- """Set lisp locator_sets on VPP node in topology.
-
- There are two ways how set lisp locator_set.
- One locator_set can contain multiple locators.
- Add new locator_set with same name as it already save in vpp
- will reset locator_set and his locator.
- To not reset locator_set, use "normal" type of generate data,
- where the locator_set is set just once.
- To test reset locator_set use "reset" type of generate data,
- where the locator_set will be set multiple times.
-
- :param node: VPP node.
- :param locator_sets: Dictionary containing information of locator_set.
- :type node: dict
- :type locator_sets: dict
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Lisp locator set, node is not DUT')
-
- lisp_locator_set = LispLocatorSet()
- lisp_locator = LispLocator()
- for locator_set_type, item in locator_sets.iteritems():
- if locator_set_type == 'normal':
- lsm_set = 1
- elif locator_set_type == 'reset':
- lsm_set = 0
- else:
- raise ValueError('Unknown locator_set_type value: '
- '{}'.format(locator_set_type))
-
- locator_set_list = []
- for locator_set in item:
- locator_name = locator_set.get('locator-set')
- sw_if_index = locator_set.get('locator')
- priority = locator_set.get('priority')
- weight = locator_set.get('weight')
- if lsm_set == 1:
- if locator_name not in locator_set_list:
- locator_set_list.append(locator_name)
- lisp_locator_set.vpp_add_lisp_locator_set(node,
- locator_name)
- else:
- lisp_locator_set.vpp_add_lisp_locator_set(node,
- locator_name)
- lisp_locator.vpp_add_lisp_locator(node,
- locator_name,
- sw_if_index,
- priority,
- weight)
-
- @staticmethod
- def vpp_unset_lisp_locator_set(node, locator_sets):
- """Unset lisp locator_sets on VPP node in topology.
-
- :param node: VPP node.
- :param locator_sets: Dictionary containing information of locator_set.
- :type node: dict
- :type locator_sets: dict
- """
-
- if node['type'] != NodeType.DUT:
- raise ValueError('Lisp locator set, node is not DUT')
-
- lisp_locator = LispLocator()
- lisp_locator_set = LispLocatorSet()
- for locator_set_type, item in locator_sets.iteritems():
- if locator_set_type == 'normal':
- lsm_set = 1
- elif locator_set_type == 'reset':
- lsm_set = 0
- else:
- raise ValueError('Unknown locator_set_type value: '
- '{}'.format(locator_set_type))
-
- locator_set_list = []
- for locator_set in item:
- locator_set_name = locator_set.get('locator-set')
- sw_if_index = locator_set.get('locator')
- priority = locator_set.get('priority')
- weight = locator_set.get('weight')
- if lsm_set == 1:
- if locator_set_name not in locator_set_list:
- locator_set_list.append(locator_set_name)
- else:
- lisp_locator.vpp_del_lisp_locator(node,
- locator_set_name,
- sw_if_index,
- priority,
- weight)
-
- 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_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('Lisp locator set, node is not DUT')
-
- lisp_locator_set = LispLocatorSet()
- lisp_eid = LispLocalEid()
- for eid in eid_table:
- eid_address = eid.get('eid address')
- 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,
- 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