daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 58 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. def add_interface_group_to_segment(self, tenant_name, segment_name, interface_group_name, vlan_id):
  2.         segments = self.get_segments(tenant_name)
  3.         interface_groups = self.get_interface_groups()
  4.         segment_membership = self.get_segment_interface_groups(tenant_name, segment_name)
  5.         verb = self.verb_check(segment_membership)
  6.  
  7.         segment_exists, dummy = self.resource_exists(segments, 'name', segment_name)
  8.         interface_group_exists, dummy = self.resource_exists(interface_groups, 'name', interface_group_name)
  9.         interface_assigned_to_segment, dummy = self.resource_exists(segment_membership, 'interface-group', interface_group_name)
  10.  
  11.         if segment_exists and interface_group_exists and not interface_assigned_to_segment:
  12.             data = {"vlan": vlan_id, "interface-group": interface_group_name}
  13.             uri = '/api/v1/data/controller/applications/bcf/tenant[name="' + tenant_name + '"]/segment[name="%s"]/interface-group-membership-rule' % segment_name
  14.             self.api_call(uri, verb, data)
  15.             return True
  16.         else:
  17.             return False  # 'Interface already assigned to segment'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top