- 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)
+ lisp_locator_set = LispLocatorSet()
+ for locator_set in locator_set_list:
+ locator_set_name = locator_set.get(u"locator-set")
+ locator_list = locator_set.get(u"locator")
+ lisp_locator_set.vpp_add_lisp_locator_set(node, locator_set_name)
+ for locator in locator_list:
+ sw_if_index = locator.get(u"locator-index")
+ priority = locator.get(u"priority")
+ weight = locator.get(u"weight")
+ lisp_locator.vpp_add_lisp_locator(
+ node, locator_set_name, sw_if_index, priority, weight
+ )