code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
if remote_port != self.remote_port: self.remote_port = remote_port return True return False
def remote_port_uneq_store(self, remote_port)
This function saves the port, if different from stored.
2.603203
2.192528
1.187306
if remote_chassis_id_mac != self.remote_chassis_id_mac: self.remote_chassis_id_mac = remote_chassis_id_mac return True return False
def remote_chassis_id_mac_uneq_store(self, remote_chassis_id_mac)
This function saves the Chassis MAC, if different from stored.
1.755766
1.652559
1.062452
if remote_port_id_mac != self.remote_port_id_mac: self.remote_port_id_mac = remote_port_id_mac return True return False
def remote_port_id_mac_uneq_store(self, remote_port_id_mac)
This function saves the port MAC, if different from stored.
1.87009
1.696668
1.102214
if intf not in cls.topo_intf_obj_dict: LOG.error("Interface %s not configured at all", intf) return False intf_obj = cls.topo_intf_obj_dict.get(intf) return intf_obj.get_lldp_status()
def get_lldp_status(cls, intf)
Retrieves the LLDP status.
3.133894
2.994461
1.046564
if not all_intf: self.intf_list = intf_list else: self.intf_list = sys_utils.get_all_run_phy_intf() self.cb = cb self.intf_attr = {} self.cfg_lldp_interface_list(self.intf_list)
def _init_cfg_interfaces(self, cb, intf_list=None, all_intf=True)
Configure the interfaces during init time.
4.631412
4.337686
1.067715
self.intf_list.append(protocol_interface) self.cfg_lldp_interface(protocol_interface, phy_interface)
def cfg_intf(self, protocol_interface, phy_interface=None)
Called by application to add an interface to the list.
4.42217
3.55864
1.242657
self.intf_attr[protocol_interface] = TopoIntfAttr( protocol_interface, phy_interface) self.store_obj(protocol_interface, self.intf_attr[protocol_interface])
def create_attr_obj(self, protocol_interface, phy_interface)
Creates the local interface attribute object and stores it.
4.468397
3.981828
1.122197
flag = False attr_obj = self.get_attr_obj(intf) remote_evb_mode = self.pub_lldp.get_remote_evb_mode(tlv_data) if attr_obj.remote_evb_mode_uneq_store(remote_evb_mode): flag = True remote_evb_cfgd = self.pub_lldp.get_remote_evb_cfgd(tlv_data) if attr_ob...
def cmp_store_tlv_params(self, intf, tlv_data)
Compare and store the received TLV. Compares the received TLV with stored TLV. Store the new TLV if it is different.
1.563102
1.570504
0.995287
if phy_interface is None: phy_interface = protocol_interface self.create_attr_obj(protocol_interface, phy_interface) ret = self.pub_lldp.enable_lldp(protocol_interface) attr_obj = self.get_attr_obj(protocol_interface) attr_obj.update_lldp_status(ret)
def cfg_lldp_interface(self, protocol_interface, phy_interface=None)
Cfg LLDP on interface and create object.
3.601166
3.216765
1.119499
try: self._periodic_task_int() except Exception as exc: LOG.error("Exception caught in periodic discovery task %s", str(exc))
def periodic_discovery_task(self)
Periodic task that checks the interface TLV attributes.
6.113123
5.35688
1.141172
bond_phy = sys_utils.get_bond_intf(phy_interface) if sys_utils.is_intf_bond(phy_interface): bond_intf = phy_interface else: bond_intf = bond_phy # This can be an addition or removal of the interface to a bond. bond_intf_change = attr_obj.cmp_updat...
def _check_bond_interface_change(self, phy_interface, attr_obj)
Check if there's any change in bond interface. First check if the interface passed itself is a bond-interface and then retrieve the member list and compare. Next, check if the interface passed is a part of the bond interface and then retrieve the member list and compare.
4.515141
4.816975
0.93734
for intf in self.intf_list: attr_obj = self.get_attr_obj(intf) status = attr_obj.get_lldp_status() if not status: ret = self.pub_lldp.enable_lldp(intf) attr_obj.update_lldp_status(ret) continue bond_intf_cha...
def _periodic_task_int(self)
Internal periodic discovery task routine to check TLV attributes. This routine retrieves the LLDP TLC's on all its configured interfaces. If the retrieved TLC is different than the stored TLV, it invokes the callback.
5.07933
4.828332
1.051985
if mgmt_ip not in self.credentials: return None security_data = self.credentials[mgmt_ip] verify = security_data[const.HTTPS_CERT_TUPLE] if not verify: verify = security_data[const.HTTPS_VERIFY_TUPLE] if not refresh and security_data[const.COOK...
def _get_cookie(self, mgmt_ip, config, refresh=False)
Performs authentication and retries cookie.
2.716905
2.701997
1.005517
try: # The following determines if the switch interfaces are # in place. If so, make sure they have a basic trunk # configuration applied to none. switch_ifs = self._mdriver._get_switch_interfaces( switch_ip, cfg_only=(False if replay el...
def _initialize_trunk_interfaces_to_none(self, switch_ip, replay=True)
Initialize all nexus interfaces to trunk allowed none.
5.363948
5.536074
0.968908
LOG.debug("Replaying config for switch ip %(switch_ip)s", {'switch_ip': switch_ip}) # Before replaying all config, initialize trunk interfaces # to none as required. If this fails, the switch may not # be up all the way. Quit and retry later. try: ...
def replay_config(self, switch_ip)
Sends pending config data in OpenStack to Nexus.
3.707212
3.68631
1.00567
switch_connections = self._mdriver.get_all_switch_ips() for switch_ip in switch_connections: state = self._mdriver.get_switch_ip_and_active_state(switch_ip) config_failure = self._mdriver.get_switch_replay_failure( const.FAIL_CONFIG, switch_ip) ...
def check_connections(self)
Check connection between OpenStack to Nexus device.
2.815733
2.766844
1.01767
try: loaded_class = runtime_utils.load_class_by_alias_or_classname( 'networking_cisco.ml2.nexus_driver', 'restapi') return loaded_class(CONF.ml2_cisco.nexus_switches) except ImportError: LOG.error("Error loading Nexus Config driver 'restapi'"...
def _load_nexus_cfg_driver(self)
Load Nexus Config driver. :raises SystemExit of 1 if driver cannot be loaded
6.131228
5.167556
1.186485
switch = cfg.CONF.ml2_cisco.nexus_switches.get(switch_ip) if switch and switch.username and switch.password: return True else: return False
def _switch_defined(self, switch_ip)
Verify this ip address is defined (for Nexus).
3.958572
3.360173
1.178086
vlan_range = self._get_switch_vlan_range(switch_ip) sized_range = '' fr = 0 to = 0 # if vlan_range not empty and haven't met requested size while size > 0 and vlan_range: vlan_id, vni = vlan_range.pop(0) size -= 1 if fr == 0 an...
def _pop_vlan_range(self, switch_ip, size)
Extract a specific number of vlans from storage. Purpose: Can only send a limited number of vlans to Nexus at a time. Sample Use Cases: 1) vlan_range is a list of vlans. If there is a list 1000, 1001, 1002, thru 2000 and size is 6, then the result is '1000-1005' and 10...
2.39132
2.502626
0.955524
switch_connections = [] try: bindings = nxos_db.get_reserved_switch_binding() except excep.NexusPortBindingNotFound: LOG.error("No switch bindings in the port data base") bindings = [] for switch in bindings: switch_connections.ap...
def get_all_switch_ips(self)
Using reserved switch binding get all switch ips.
5.938074
4.922875
1.206221
try: switch_info = link_info['switch_info'] if not isinstance(switch_info, dict): switch_info = jsonutils.loads(switch_info) except Exception as e: LOG.error("switch_info can't be decoded: %(exp)s", {"exp": e}) ...
def _get_baremetal_switch_info(self, link_info)
Get switch_info dictionary from context.
2.823255
2.489609
1.134015
port = context.current if self.trunk.is_trunk_subport_baremetal(port): return self._baremetal_set_binding(context) if not nexus_help.is_baremetal(port): return False if bc.portbindings.PROFILE not in port: return False profile = p...
def _supported_baremetal_transaction(self, context)
Verify transaction is complete and for us.
3.788552
3.767745
1.005522
all_switches = set() active_switches = set() all_link_info = port[bc.portbindings.PROFILE]['local_link_information'] for link_info in all_link_info: switch_info = self._get_baremetal_switch_info(link_info) if not switch_info: continue ...
def _get_baremetal_switches(self, port)
Get switch ip addresses from baremetal transaction. This method is used to extract switch information from the transaction where VNIC_TYPE is baremetal. :param port: Received port transaction :returns: list of all switches :returns: list of only switches which are active
2.982368
2.849273
1.046712
connections = [] is_native = False if self.trunk.is_trunk_subport(port) else True all_link_info = port[bc.portbindings.PROFILE]['local_link_information'] for link_info in all_link_info: # Extract port info intf_type, port = nexus_help.split_interface...
def _get_baremetal_connections(self, port, only_active_switch=False, from_segment=False)
Get switch ips and interfaces from baremetal transaction. This method is used to extract switch/interface information from transactions where VNIC_TYPE is baremetal. :param port: Received port transaction :param only_active_switch: Indicator for selecting c...
4.295836
4.048074
1.061205
# interfaces list requiring switch initialization and # reserved port and port_binding db entry creation list_to_init = [] # interfaces list requiring reserved port and port_binding # db entry creation inactive_switch = [] connections = self._get_barem...
def _init_baremetal_trunk_interfaces(self, port_seg, segment)
Initialize baremetal switch interfaces and DB entry. With baremetal transactions, the interfaces are not known during initialization so they must be initialized when the transactions are received. * Reserved switch entries are added if needed. * Reserved port entries are added. ...
4.439788
4.171437
1.064331
all_switches = set() active_switches = set() try: host_list = nxos_db.get_host_mappings(host_id) for mapping in host_list: all_switches.add(mapping.switch_ip) if self.is_switch_active(mapping.switch_ip): activ...
def _get_host_switches(self, host_id)
Get switch IPs from configured host mapping. This method is used to extract switch information from transactions where VNIC_TYPE is normal. Information is extracted from ini file which is stored in _nexus_switches. :param host_id: host_name from transaction :returns: li...
2.730201
2.463258
1.10837
host_found = False host_connections = [] try: host_ifs = nxos_db.get_host_mappings(host_id) except excep.NexusHostMappingNotFound: host_ifs = [] for ifs in host_ifs: host_found = True if (only_active_switch and ...
def _get_host_connections(self, host_id, only_active_switch=False)
Get switch IPs and interfaces from config host mapping. This method is used to extract switch/interface information from ini files when VNIC_TYPE is normal. The ini files contain host to interface mappings. :param host_id: Host name from transaction :param only_active_...
4.592664
3.945182
1.16412
switch_ifs = [] try: port_info = nxos_db.get_switch_host_mappings( requested_switch_ip) except excep.NexusHostMappingNotFound: port_info = [] for binding in port_info: if cfg_only and not binding.is_static: ...
def _get_switch_interfaces(self, requested_switch_ip, cfg_only=False)
Get switch interfaces from host mapping DB. For a given switch, this returns all known port interfaces for a given switch. These have been learned from received baremetal transactions and from configuration file. :param requested_switch_ip: switch_ip :returns: list of ...
5.785502
5.139845
1.125618
host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: if not nxos_db.get_nve_vni_member_bindings(vni, switch_ip, device_id): nxos_db.add_nexusnve_binding(vni, switch_ip,...
def _configure_nve_db(self, vni, device_id, mcast_group, host_id)
Create the nexus NVE database entry. Called during update precommit port event.
3.867462
3.586402
1.078368
host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: # If configured to set global VXLAN values then # If this is the first database entry for this switch_ip # then configure the "interface nve" entry on the s...
def _configure_nve_member(self, vni, device_id, mcast_group, host_id)
Add "member vni" configuration to the NVE interface. Called during update postcommit port event.
4.053643
3.946818
1.027066
rows = nxos_db.get_nve_vni_deviceid_bindings(vni, device_id) for row in rows: nxos_db.remove_nexusnve_binding(vni, row.switch_ip, device_id)
def _delete_nve_db(self, vni, device_id, mcast_group, host_id)
Delete the nexus NVE database entry. Called during delete precommit port event.
4.770232
4.387255
1.087293
host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: if not nxos_db.get_nve_vni_switch_bindings(vni, switch_ip): self.driver.delete_nve_member(switch_ip, const.NVE_INT_NUM, vni) if (cfg.CONF...
def _delete_nve_member(self, vni, device_id, mcast_group, host_id)
Remove "member vni" configuration from the NVE interface. Called during delete postcommit port event.
4.35369
4.28225
1.016683
connections = self._get_port_connections(port, host_id) for switch_ip, intf_type, nexus_port, is_native, ch_grp in connections: port_id = nexus_help.format_interface_name( intf_type, nexus_port, ch_grp) try: nxos_db.get_nexusport_binding(p...
def _configure_nxos_db(self, port, vlan_id, device_id, host_id, vni, is_provider_vlan)
Create the nexus database entry. Called during update precommit port event.
3.819573
3.590478
1.063806
if is_provider_vlan: auto_create = cfg.CONF.ml2_cisco.provider_vlan_auto_create auto_trunk = cfg.CONF.ml2_cisco.provider_vlan_auto_trunk else: auto_create = True auto_trunk = True return auto_create, auto_trunk
def _gather_config_parms(self, is_provider_vlan, vlan_id)
Collect auto_create, auto_trunk from config.
2.418327
1.829534
1.321827
# This implies VLAN, VNI, and Port are all duplicate. # Then there is nothing to configure in Nexus. if duplicate_type == const.DUPLICATE_PORT: return auto_create, auto_trunk = self._gather_config_parms( is_provider_vlan, vlan_id) # if type DUP...
def _configure_port_binding(self, is_provider_vlan, duplicate_type, is_native, switch_ip, vlan_id, intf_type, nexus_port, vni)
Conditionally calls vlan and port Nexus drivers.
3.090689
3.035302
1.018247
if not pvlan_ids: return [] pvlan_list = list(pvlan_ids) pvlan_list.sort() compressed_list = [] begin = -1 prev_vlan = -1 for port_vlan in pvlan_list: if prev_vlan == -1: prev_vlan = port_vlan else: ...
def _get_compressed_vlan_list(self, pvlan_ids)
Generate a compressed vlan list ready for XML using a vlan set. Sample Use Case: Input vlan set: -------------- 1 - s = set([11, 50, 25, 30, 15, 16, 3, 8, 2, 1]) 2 - s = set([87, 11, 50, 25, 30, 15, 16, 3, 8, 2, 1, 88]) Returned compressed XML list: -----------...
1.801401
1.839257
0.979417
intf_type, nexus_port = nexus_help.split_interface_name(port) # If native_vlan is configured, this is isolated since # two configs (native + trunk) must be sent for this vlan only. if native_vlan != 0: self.driver.send_enable_vlan_on_trunk_int( swit...
def _restore_port_binding(self, switch_ip, pvlan_ids, port, native_vlan)
Restores a set of vlans for a given port.
3.641649
3.61255
1.008055
count = 1 conf_str = '' vnsegment_sent = 0 path_str, conf_str = self.driver.start_create_vlan() # At this time, this will only configure vni information when needed while vnsegment_sent < const.CREATE_VLAN_BATCH and vlans: vlan_id, vni = vlans.pop(0)...
def _restore_vxlan_entries(self, switch_ip, vlans)
Restore vxlan entries on a Nexus switch.
3.981177
3.977637
1.00089
connections = self._get_active_port_connections(port, host_id) # (nexus_port,switch_ip) will be unique in each iteration. # But switch_ip will repeat if host has >1 connection to same switch. # So track which switch_ips already have vlan created in this loop. vlan_alrea...
def _configure_port_entries(self, port, vlan_id, device_id, host_id, vni, is_provider_vlan)
Create a nexus switch entry. if needed, create a VLAN in the appropriate switch or port and configure the appropriate interfaces for this VLAN. Called during update postcommit port event.
3.690048
3.684726
1.001444
next_range = self._pop_vlan_range( switch_ip, const.CREATE_VLAN_BATCH) if next_range: try: self.driver.set_all_vlan_states( switch_ip, next_range) except Exception: with excutils.save_and_rera...
def configure_next_batch_of_vlans(self, switch_ip)
Get next batch of vlans and send them to Nexus.
2.743973
2.705332
1.014283
prev_vlan = -1 prev_vni = -1 prev_port = None prev_native_vlan = 0 starttime = time.time() port_bindings.sort(key=lambda x: (x.port_id, x.vlan_id, x.vni)) self.driver.capture_and_print_timeshot( starttime, "replay_t2_aft_sort", sw...
def configure_switch_entries(self, switch_ip, port_bindings)
Create a nexus switch entry in Nexus. The port_bindings is sorted by vlan_id, vni, port_id. When there is a change in vlan_id or vni, then vlan data is configured in Nexus device. Otherwise we check if there is a change in port_id where we configure the port with vlan trunk conf...
3.022641
2.959743
1.021251
try: rows = nxos_db.get_nexusvm_bindings(vlan_id, device_id) for row in rows: nxos_db.remove_nexusport_binding(row.port_id, row.vlan_id, row.vni, row.switch_ip, row.instance_id) except excep.NexusPortBindingNotFound: ...
def _delete_nxos_db(self, unused, vlan_id, device_id, host_id, vni, is_provider_vlan)
Delete the nexus database entry. Called during delete precommit port event.
3.837581
3.73408
1.027718
'''This determines if port channel id needs to be freed.''' # if this connection is not a port-channel, nothing to do. if intf_type != 'port-channel': return # Check if this driver created it and its no longer needed. try: vpc = nxos_db.get_switch_vpc_al...
def _delete_port_channel_resources(self, host_id, switch_ip, intf_type, nexus_port, port_id)
This determines if port channel id needs to be freed.
4.190405
3.962011
1.057646
connections = self._get_active_port_connections(port, host_id) # (nexus_port,switch_ip) will be unique in each iteration. # But switch_ip will repeat if host has >1 connection to same switch. # So track which switch_ips already have vlan removed in this loop. vlan_alre...
def _delete_switch_entry(self, port, vlan_id, device_id, host_id, vni, is_provider_vlan)
Delete the nexus switch entry. By accessing the current db entries determine if switch configuration can be removed. Called during delete postcommit port event.
3.356126
3.315995
1.012102
# Verify segment. if not self._is_valid_segment(segment): return device_id = self._get_port_uuid(port) if nexus_help.is_baremetal(port): host_id = port.get('dns_name') else: host_id = port.get(bc.portbindings.HOST_ID) vlan_...
def _port_action_vlan(self, port, segment, func, vni)
Verify configuration and then process event.
3.584534
3.530159
1.015403
# If the segment is None, just log a warning message and return. if segment is None: self._log_missing_segment() return device_id = port.get('device_id') mcast_group = segment.get(api.PHYSICAL_NETWORK) host_id = port.get(bc.portbindings.HOST_ID)...
def _port_action_vxlan(self, port, segment, func)
Verify configuration and then process event.
2.923133
2.909736
1.004604
# No new events are handled until replay # thread has put the switch in active state. # If a switch is in active state, verify # the switch is still in active state # before accepting this new event. # # If create_port_postcommit fails, it causes ...
def create_port_postcommit(self, context)
Create port non-database commit event.
4.81355
4.773852
1.008316
vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, context.bottom_bound_segment) orig_vlan_segment, orig_vxlan_segment = self._get_segments( context.original_top_bound_segment, context.original_bottom_bound_segment) if (self...
def update_port_precommit(self, context)
Update port pre-database transaction commit event.
2.876115
2.864385
1.004095
vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, context.bottom_bound_segment) orig_vlan_segment, orig_vxlan_segment = self._get_segments( context.original_top_bound_segment, context.original_bottom_bound_segment) if (self...
def update_port_postcommit(self, context)
Update port non-database commit event.
3.735491
3.716337
1.005154
if self._is_supported_deviceowner(context.current): vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, context.bottom_bound_segment) vni = self._port_action_...
def delete_port_precommit(self, context)
Delete port pre-database commit event.
4.578654
4.533062
1.010058
if self._is_supported_deviceowner(context.current): vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, context.bottom_bound_segment) vni = self._port_action_...
def delete_port_postcommit(self, context)
Delete port non-database commit event.
4.857898
4.776517
1.017038
ver_expr = "([0-9]+)\.([0-9]+)\((.*)\)" re.compile(ver_expr) v1 = re.match(ver_expr, self._cur_ver) v2 = re.match(ver_expr, self._base_ver) if int(v1.group(1)) > int(v2.group(1)): self._is_iplus = True elif int(v1.group(1)) == int(v2.group(1)): ...
def _detect_iplus(self)
Check the DCNM version and determine if it's for iplus
2.179576
1.87223
1.16416
url = "%s/%s" % (self._segmentid_ranges_url, orchestrator_id) res = self._send_request('GET', url, None, 'segment-id range') if res and res.status_code in self._resp_ok: return res.json()
def get_segmentid_range(self, orchestrator_id)
Get segment id range from DCNM.
4.373398
4.118911
1.061785
url = self._segmentid_ranges_url payload = {'orchestratorId': orchestrator_id, 'segmentIdRanges': "%s-%s" % (segid_min, segid_max)} res = self._send_request('POST', url, payload, 'segment-id range') if not (res and res.status_code in self._resp_ok): ...
def set_segmentid_range(self, orchestrator_id, segid_min, segid_max)
set segment id range in DCNM.
4.131579
3.868797
1.067924
try: cfgplist = self.config_profile_list() if self.default_cfg_profile not in cfgplist: self.default_cfg_profile = ('defaultNetworkUniversalEfProfile' if self._is_iplus else '...
def _set_default_cfg_profile(self)
Set default network config profile. Check whether the default_cfg_profile value exist in the current version of DCNM. If not, set it to new default value which is supported by latest version.
8.856244
6.727198
1.316483
url = self._create_network_url % (network_info['organizationName'], network_info['partitionName']) payload = network_info LOG.info('url %(url)s payload %(payload)s', {'url': url, 'payload': payload}) return self._send_r...
def _create_network(self, network_info)
Send create network request to DCNM. :param network_info: network parameters to be created on DCNM
4.36817
4.346809
1.004914
url = self._cfg_profile_get_url % (thisprofile) payload = {} res = self._send_request('GET', url, payload, 'config-profile') if res and res.status_code in self._resp_ok: return res.json()
def _config_profile_get(self, thisprofile)
Get information of a config profile from DCNM. :param thisprofile: network config profile in request
4.469301
4.775981
0.935787
url = self._cfg_profile_list_url payload = {} try: res = self._send_request('GET', url, payload, 'config-profile') if res and res.status_code in self._resp_ok: return res.json() except dexc.DfaClientRequestFailed: LOG.error("F...
def _config_profile_list(self)
Get list of supported config profile from DCNM.
6.041853
4.772498
1.265973
url = self._global_settings_url payload = {} res = self._send_request('GET', url, payload, 'settings') if res and res.status_code in self._resp_ok: return res.json()
def _get_settings(self)
Get global mobility domain from DCNM.
5.117796
4.198516
1.218954
url = self._org_url payload = { "organizationName": name, "description": name if len(desc) == 0 else desc, "orchestrationSource": orch_id} return self._send_request('POST', url, payload, 'organization')
def _create_org(self, orch_id, name, desc)
Create organization on the DCNM. :param orch_id: orchestrator ID :param name: Name of organization :param desc: Description of organization
4.594086
5.48099
0.838185
if part_name is None: part_name = self._part_name if vrf_prof is None or dci_id == UNKNOWN_DCI_ID or ( service_node_ip == UNKNOWN_SRVN_NODE_IP): part_info = self._get_partition(org_name, part_name) if vrf_prof is None: vrf_prof = self.get_p...
def _create_or_update_partition(self, org_name, part_name, desc, dci_id=UNKNOWN_DCI_ID, vrf_prof=None, service_node_ip=UNKNOWN_SRVN_NODE_IP, operation='POST')
Send create or update partition request to the DCNM. :param org_name: name of organization :param part_name: name of partition :param desc: description of partition :dci_id: DCI ID for inter-DC :vrf_prof: VRF Profile Name :service_node_ip: Service Node's Address
2.559923
2.591029
0.987995
if part_name is None: part_name = self._part_name url = self._update_part_url % (org_name, part_name) res = self._send_request("GET", url, '', 'partition') if res and res.status_code in self._resp_ok: return res.json()
def _get_partition(self, org_name, part_name=None)
send get partition request to the DCNM. :param org_name: name of organization :param part_name: name of partition
3.595145
3.831105
0.938409
if part_name is None: part_name = self._part_name if vrf_prof is None: vrf_prof = self.default_vrf_profile operation = 'PUT' url = (self._update_part_url % (org_name, part_name)) ip_str = '' ip_cnt = 0 for ip in static_ip_list: ...
def update_partition_static_route(self, org_name, part_name, static_ip_list, vrf_prof=None, service_node_ip=None)
Send static route update requests to DCNM. :param org_name: name of organization :param part_name: name of partition :static_ip_list: List of static IP addresses :vrf_prof: VRF Profile :service_node_ip: Service Node IP address
3.731119
3.767075
0.990455
url = self._del_org_url % (org_name) return self._send_request('DELETE', url, '', 'organization')
def _delete_org(self, org_name)
Send organization delete request to DCNM. :param org_name: name of organization to be deleted
6.681447
7.692314
0.868587
url = self._del_part % (org_name, partition_name) return self._send_request('DELETE', url, '', 'partition')
def _delete_partition(self, org_name, partition_name)
Send partition delete request to DCNM. :param org_name: name of organization :param partition_name: name of partition
6.393898
7.438419
0.859578
org_name = network_info.get('organizationName', '') part_name = network_info.get('partitionName', '') segment_id = network_info['segmentId'] if 'mobDomainName' in network_info: vlan_id = network_info['vlanId'] mob_dom_name = network_info['mobDomainName'] ...
def _delete_network(self, network_info)
Send network delete request to DCNM. :param network_info: contains network info to be deleted.
2.96184
2.98249
0.993076
org_name = network_info.get('organizationName', '') part_name = network_info.get('partitionName', '') segment_id = network_info['segmentId'] url = self._network_url % (org_name, part_name, segment_id) return self._send_request('GET', url, '', 'network')
def _get_network(self, network_info)
Send network get request to DCNM. :param network_info: contains network info to query.
3.386567
3.371459
1.004481
expiration_time = self._exp_time payload = {'expirationTime': expiration_time} # TODO(padkrish), after testing with certificates, make the # verify option configurable. res = requests.post(url_login, data=jsonutils.dumps(payload), ...
def _login_request(self, url_login)
Internal function to send login request.
5.789779
5.561183
1.041106
requests.post(url_logout, headers=self._req_headers, timeout=self.timeout_resp, verify=False)
def _logout_request(self, url_logout)
Internal logout request to DCNM.
7.637072
6.573872
1.161731
res = None try: payload_json = None if payload and payload != '': payload_json = jsonutils.dumps(payload) self._login() desc_lookup = {'POST': ' creation', 'PUT': ' update', 'DELETE': ' deletion', 'GET':...
def _send_request(self, operation, url, payload, desc)
Send request to DCNM.
3.976036
3.576651
1.111665
these_profiles = self._config_profile_list() or [] profile_list = [q for p in these_profiles for q in [p.get('profileName')]] return profile_list
def config_profile_list(self)
Return config profile list from DCNM.
7.892429
5.875801
1.343209
profile_params = self._config_profile_get(profile_name) fwd_cli = 'fabric forwarding mode proxy-gateway' if profile_params and fwd_cli in profile_params['configCommands']: return 'proxy-gateway' else: return 'anycast-gateway'
def config_profile_fwding_mode_get(self, profile_name)
Return forwarding mode of given config profile.
6.606061
6.430925
1.027233
cfgplist = self.config_profile_list() cfgname = net_name.partition(':')[2] cfgtuple = set() for cfg_prof in cfgplist: if cfg_prof.startswith('defaultNetwork'): cfg_alias = (cfg_prof.split('defaultNetwork')[1]. split('Pro...
def get_config_profile_for_network(self, net_name)
Get the list of profiles.
4.018786
4.027565
0.99782
seg_id = str(network.segmentation_id) subnet_ip_mask = subnet.cidr.split('/') gw_ip = subnet.gateway_ip cfg_args = [ "$segmentId=" + seg_id, "$netMaskLength=" + subnet_ip_mask[1], "$gatewayIpAddress=" + gw_ip, "$networkName=" + net...
def create_network(self, tenant_name, network, subnet, dhcp_range=True)
Create network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: network parameters :param subnet: subnet parameters of the network
3.671568
3.696951
0.993134
network_info = {} subnet_ip_mask = subnet.cidr.split('/') if self._default_md is None: self._set_default_mobility_domain() vlan_id = '0' gw_ip = subnet.gateway_ip part_name = network.part_name if not part_name: part_name = self._pa...
def create_service_network(self, tenant_name, network, subnet, dhcp_range=True)
Create network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: network parameters :param subnet: subnet parameters of the network
3.386333
3.386798
0.999863
seg_id = network.segmentation_id network_info = { 'organizationName': tenant_name, 'partitionName': self._part_name, 'segmentId': seg_id, } LOG.debug("Deleting %s network in DCNM.", network_info) res = self._delete_network(network_inf...
def delete_network(self, tenant_name, network)
Delete network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: object that contains network parameters
3.662042
3.609391
1.014587
network_info = {} part_name = network.part_name if not part_name: part_name = self._part_name seg_id = str(network.segmentation_id) if network.vlan: vlan_id = str(network.vlan) if network.mob_domain_name is not None: m...
def delete_service_network(self, tenant_name, network)
Delete service network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: object that contains network parameters
3.298339
3.223927
1.023081
res = self._delete_partition(tenant_name, part_name) if res and res.status_code in self._resp_ok: LOG.debug("Deleted %s partition in DCNM.", part_name) else: LOG.error("Failed to delete %(part)s partition in DCNM." "Response: %(res)s", {'par...
def delete_project(self, tenant_name, part_name)
Delete project on the DCNM. :param tenant_name: name of project. :param part_name: name of partition.
2.205173
2.109925
1.045143
res = self._delete_partition(org_name, partition_name) if res and res.status_code in self._resp_ok: LOG.debug("Deleted %s partition in DCNM.", partition_name) else: LOG.error("Failed to delete %(part)s partition in DCNM." "Response: %(res)s"...
def delete_partition(self, org_name, partition_name)
Send partition delete request to DCNM. :param partition_name: name of partition to be deleted
4.302208
4.051321
1.061927
desc = desc or org_name res = self._create_org(orch_id, org_name, desc) if res and res.status_code in self._resp_ok: LOG.debug("Created %s organization in DCNM.", org_name) else: LOG.error("Failed to create %(org)s organization in DCNM." ...
def create_project(self, orch_id, org_name, part_name, dci_id, desc=None)
Create project on the DCNM. :param orch_id: orchestrator ID :param org_name: name of organization. :param part_name: name of partition. :param dci_id: Data Center interconnect id. :param desc: description of project.
4.026618
4.109191
0.979905
desc = desc or org_name res = self._create_or_update_partition(org_name, part_name, desc, dci_id=dci_id, service_node_ip=service_node_ip, vrf_prof=vrf_pro...
def update_project(self, org_name, part_name, dci_id=UNKNOWN_DCI_ID, service_node_ip=UNKNOWN_SRVN_NODE_IP, vrf_prof=None, desc=None)
Update project on the DCNM. :param org_name: name of organization. :param part_name: name of partition. :param dci_id: Data Center interconnect id. :param desc: description of project.
3.163119
3.350187
0.944162
desc = desc or org_name res = self._create_or_update_partition(org_name, part_name, desc, dci_id=dci_id, service_node_ip=service_node_ip, vrf_prof=vrf_pro...
def create_partition(self, org_name, part_name, dci_id, vrf_prof, service_node_ip=None, desc=None)
Create partition on the DCNM. :param org_name: name of organization to be created :param part_name: name of partition to be created :param dci_id: DCI ID :vrf_prof: VRF profile for the partition :param service_node_ip: Specifies the Default route IP address. :param desc:...
3.14028
3.351385
0.93701
vrf_profile = None if part_info is None: part_info = self._get_partition(org_name, part_name) LOG.info("query result from dcnm for partition info is %s", part_info) if ("vrfProfileName" in part_info): vrf_profile = part_info.get("...
def get_partition_vrfProf(self, org_name, part_name=None, part_info=None)
get VRF Profile for the partition from the DCNM. :param org_name: name of organization :param part_name: name of partition
3.231955
3.207496
1.007625
if part_info is None: part_info = self._get_partition(org_name, part_name) LOG.info("query result from dcnm for partition info is %s", part_info) if part_info is not None and "dciId" in part_info: return part_info.get("dciId")
def get_partition_dciId(self, org_name, part_name, part_info=None)
get DCI ID for the partition. :param org_name: name of organization :param part_name: name of partition
3.074533
3.360333
0.914949
if org and part: list_url = self._del_part + '/networks' list_url = list_url % (org, part) res = self._send_request('GET', list_url, '', 'networks') if res and res.status_code in self._resp_ok: return res.json()
def list_networks(self, org, part)
Return list of networks from DCNM. :param org: name of organization. :param part: name of partition.
4.35416
5.270286
0.826172
try: res = self._send_request('GET', self._org_url, '', 'organizations') if res and res.status_code in self._resp_ok: return res.json() except dexc.DfaClientRequestFailed: LOG.error("Failed to send request to DCNM.")
def list_organizations(self)
Return list of organizations from DCNM.
8.354967
6.389884
1.30753
network_info = { 'organizationName': org, 'partitionName': self._part_name, 'segmentId': segid, } res = self._get_network(network_info) if res and res.status_code in self._resp_ok: return res.json()
def get_network(self, org, segid)
Return given network from DCNM. :param org: name of organization. :param segid: segmentation id of the network.
4.157736
4.732732
0.878507
url = '%s://%s/rest/dcnm-version' % (self.dcnm_protocol, self._ip) payload = {} try: res = self._send_request('GET', url, payload, 'dcnm-version') if res and res.status_code in self._resp_ok: return res.json().get('Dcnm-Version') except ...
def get_version(self)
Get the DCNM version.
5.310132
4.473103
1.187125
protocol = self.dcnm_protocol self._org_url = '%s://%s/rest/auto-config/organizations' % ( (protocol, self._ip)) self._create_network_url = ('%s://%s/' % (protocol, self._ip) + 'rest/auto-config/organizations' ...
def fill_urls(self)
This assigns the URL's based on the protocol.
2.424364
2.38872
1.014922
plural_mappings = resource_helper.build_plural_mappings( {}, RESOURCE_ATTRIBUTE_MAP) if NEUTRON_VERSION.version[0] <= NEUTRON_NEWTON_VERSION.version[0]: attr.PLURALS.update(plural_mappings) action_map = {DEVICE: {'get_hosting_device_config': 'GET'}} retur...
def get_resources(cls)
Returns Ext Resources.
4.632615
4.374654
1.058967
global _INSPECTOR if _INSPECTOR: return _INSPECTOR else: bind = op.get_bind() _INSPECTOR = sa.engine.reflection.Inspector.from_engine(bind) return _INSPECTOR
def get_inspector()
Reuse inspector
4.051996
3.7851
1.070512
output = [] tables = get_tables() for table in tables: columns = get_columns(table) for column in columns: if column['name'] == 'tenant_id': output.append((table, column)) return output
def get_data()
Returns combined list of tuples: [(table, column)]. List is built, based on retrieved tables, where column with name ``tenant_id`` exists.
3.664904
2.307716
1.588109
return { sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()], sa.Index: get_tables() }
def contract_creation_exceptions()
Special migration for the blueprint to support Keystone V3. We drop all tenant_id columns and create project_id columns instead.
12.57741
7.747066
1.623506
admin_context = context.is_admin and context or context.elevated() dmplugin = bc.get_plugin(cisco_constants.DEVICE_MANAGER) if (hosting_device is not None and extensions.is_extension_supported( dmplugin, CFGAGENT_SCHED)): agents = dmplugin.get_cfg_agents_for_...
def _agent_notification_bulk(self, context, method, routers, hosting_device, operation)
Notify the Cisco cfg agent handling a particular hosting_device. A single notification can contain multiple routers.
4.108169
4.137105
0.993006
if extensions.is_extension_supported(self._l3plugin, L3AGENT_SCHED): adm_context = (context.is_admin and context or context.elevated()) # This is where hosting device gets scheduled to Cisco cfg agent self._l3plugin.schedule_routers(adm_context, routers) ...
def _notification(self, context, method, routers, operation, shuffle_agents)
Notify all or individual Cisco cfg agents.
5.261849
4.833843
1.088544
if routers: self._notification(context, 'routers_updated', routers, operation, shuffle_agents)
def routers_updated(self, context, routers, operation=None, data=None, shuffle_agents=False)
Notify cfg agents about configuration changes to routers. This includes operations performed on the router like when a router interface is added or removed.
4.522285
5.538845
0.816467
self._notification(context, 'router_removed_from_hosting_device', [router], operation=None, shuffle_agents=False)
def router_removed_from_hosting_device(self, context, router)
Notify cfg agent about router removed from hosting device.
10.408905
8.290003
1.255597
self._notification(context, 'router_added_to_hosting_device', [router], operation=None, shuffle_agents=False)
def router_added_to_hosting_device(self, context, router)
Notify cfg agent about router added to hosting device.
10.531413
8.280742
1.271796
self._agent_notification_bulk( context, 'router_removed_from_hosting_device', router_ids, hosting_device, operation=None)
def routers_removed_from_hosting_device(self, context, router_ids, hosting_device)
Notify cfg agent that routers have been removed from hosting device. @param: context - information about tenant, user etc @param: router-ids - list of ids @param: hosting_device - device hosting the routers
5.721251
5.979904
0.956746
LOG.debug('Routing_key: %(key)s, body: %(body)s.', {'key': method.routing_key, 'body': body}) partition_keyword = 'auto-config.organization.partition' network_keyword = partition_keyword + '.network' network_create_key = network_keyword + '.create' net...
def _cb_dcnm_msg(self, method, body)
Callback function to process DCNM network creation/update/deletion message received by AMQP. It also communicates with DCNM to extract info for CPNR record insertion/deletion. :param pika.channel.Channel ch: The channel instance. :param pika.Spec.Basic.Deliver method: The basic...
3.762241
3.688064
1.020113