sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def update_port_precommit(self, context): """Update port pre-database transaction commit event.""" vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, context.bottom_bound_segment) orig_vlan_segment, orig_vxlan_segment = self._get_segments( contex...
Update port pre-database transaction commit event.
entailment
def update_port_postcommit(self, context): """Update port non-database commit event.""" 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_...
Update port non-database commit event.
entailment
def delete_port_precommit(self, context): """Delete port pre-database commit event.""" if self._is_supported_deviceowner(context.current): vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, ...
Delete port pre-database commit event.
entailment
def delete_port_postcommit(self, context): """Delete port non-database commit event.""" if self._is_supported_deviceowner(context.current): vlan_segment, vxlan_segment = self._get_segments( context.top_bound_segment, ...
Delete port non-database commit event.
entailment
def _detect_iplus(self): """Check the DCNM version and determine if it's for iplus""" 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)): ...
Check the DCNM version and determine if it's for iplus
entailment
def get_segmentid_range(self, orchestrator_id): """Get segment id range from DCNM. """ 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()
Get segment id range from DCNM.
entailment
def set_segmentid_range(self, orchestrator_id, segid_min, segid_max): """set segment id range in DCNM. """ url = self._segmentid_ranges_url payload = {'orchestratorId': orchestrator_id, 'segmentIdRanges': "%s-%s" % (segid_min, segid_max)} res = self._send_request('P...
set segment id range in DCNM.
entailment
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. """ try: cfgplist = self.con...
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.
entailment
def _create_network(self, network_info): """Send create network request to DCNM. :param network_info: network parameters to be created on DCNM """ url = self._create_network_url % (network_info['organizationName'], network_info['partitionName'])...
Send create network request to DCNM. :param network_info: network parameters to be created on DCNM
entailment
def _config_profile_get(self, thisprofile): """Get information of a config profile from DCNM. :param thisprofile: network config profile in request """ url = self._cfg_profile_get_url % (thisprofile) payload = {} res = self._send_request('GET', url, payload, 'config-pro...
Get information of a config profile from DCNM. :param thisprofile: network config profile in request
entailment
def _config_profile_list(self): """Get list of supported config profile from DCNM.""" 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: r...
Get list of supported config profile from DCNM.
entailment
def _get_settings(self): """Get global mobility domain from DCNM.""" 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()
Get global mobility domain from DCNM.
entailment
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 """ url = self._org_url payload = { "organizationName": name, ...
Create organization on the DCNM. :param orch_id: orchestrator ID :param name: Name of organization :param desc: Description of organization
entailment
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 t...
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
entailment
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 """ if part_name is None: part_name = self._part_name url = self._update_part_url % (org_n...
send get partition request to the DCNM. :param org_name: name of organization :param part_name: name of partition
entailment
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: na...
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
entailment
def _delete_org(self, org_name): """Send organization delete request to DCNM. :param org_name: name of organization to be deleted """ url = self._del_org_url % (org_name) return self._send_request('DELETE', url, '', 'organization')
Send organization delete request to DCNM. :param org_name: name of organization to be deleted
entailment
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 """ url = self._del_part % (org_name, partition_name) return self._send_request('DELETE', url, ...
Send partition delete request to DCNM. :param org_name: name of organization :param partition_name: name of partition
entailment
def _delete_network(self, network_info): """Send network delete request to DCNM. :param network_info: contains network info to be deleted. """ org_name = network_info.get('organizationName', '') part_name = network_info.get('partitionName', '') segment_id = network_info[...
Send network delete request to DCNM. :param network_info: contains network info to be deleted.
entailment
def _get_network(self, network_info): """Send network get request to DCNM. :param network_info: contains network info to query. """ org_name = network_info.get('organizationName', '') part_name = network_info.get('partitionName', '') segment_id = network_info['segmentId'...
Send network get request to DCNM. :param network_info: contains network info to query.
entailment
def _login_request(self, url_login): """Internal function to send login request. """ expiration_time = self._exp_time payload = {'expirationTime': expiration_time} # TODO(padkrish), after testing with certificates, make the # verify option configurable. res = requests.po...
Internal function to send login request.
entailment
def _logout_request(self, url_logout): """Internal logout request to DCNM. """ requests.post(url_logout, headers=self._req_headers, timeout=self.timeout_resp, verify=False)
Internal logout request to DCNM.
entailment
def _send_request(self, operation, url, payload, desc): """Send request to DCNM.""" res = None try: payload_json = None if payload and payload != '': payload_json = jsonutils.dumps(payload) self._login() desc_lookup = {'POST': ' cr...
Send request to DCNM.
entailment
def config_profile_list(self): """Return config profile list from DCNM.""" these_profiles = self._config_profile_list() or [] profile_list = [q for p in these_profiles for q in [p.get('profileName')]] return profile_list
Return config profile list from DCNM.
entailment
def config_profile_fwding_mode_get(self, profile_name): """Return forwarding mode of given config profile.""" 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 forwarding mode of given config profile.
entailment
def get_config_profile_for_network(self, net_name): """Get the list of profiles.""" cfgplist = self.config_profile_list() cfgname = net_name.partition(':')[2] cfgtuple = set() for cfg_prof in cfgplist: if cfg_prof.startswith('defaultNetwork'): cfg_al...
Get the list of profiles.
entailment
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 """ ...
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
entailment
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 ...
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
entailment
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 """ seg_id = network.segmentation_id network_info = { 'organizatio...
Delete network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: object that contains network parameters
entailment
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 """ network_info = {} part_name = network.part_name i...
Delete service network on the DCNM. :param tenant_name: name of tenant the network belongs to :param network: object that contains network parameters
entailment
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. """ res = self._delete_partition(tenant_name, part_name) if res and res.status_code in self._resp_ok: LO...
Delete project on the DCNM. :param tenant_name: name of project. :param part_name: name of partition.
entailment
def delete_partition(self, org_name, partition_name): """Send partition delete request to DCNM. :param partition_name: name of partition to be deleted """ res = self._delete_partition(org_name, partition_name) if res and res.status_code in self._resp_ok: LOG.debug("D...
Send partition delete request to DCNM. :param partition_name: name of partition to be deleted
entailment
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: ...
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.
entailment
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. ...
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.
entailment
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 ...
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:...
entailment
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 """ vrf_profile = None if part_info is None: part_info = s...
get VRF Profile for the partition from the DCNM. :param org_name: name of organization :param part_name: name of partition
entailment
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 """ if part_info is None: part_info = self._get_partition(org_name, part_name) L...
get DCI ID for the partition. :param org_name: name of organization :param part_name: name of partition
entailment
def list_networks(self, org, part): """Return list of networks from DCNM. :param org: name of organization. :param part: name of partition. """ if org and part: list_url = self._del_part + '/networks' list_url = list_url % (org, part) res = se...
Return list of networks from DCNM. :param org: name of organization. :param part: name of partition.
entailment
def list_organizations(self): """Return list of organizations from DCNM.""" 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: ...
Return list of organizations from DCNM.
entailment
def get_network(self, org, segid): """Return given network from DCNM. :param org: name of organization. :param segid: segmentation id of the network. """ network_info = { 'organizationName': org, 'partitionName': self._part_name, 'segmentId': ...
Return given network from DCNM. :param org: name of organization. :param segid: segmentation id of the network.
entailment
def get_version(self): """Get the DCNM version.""" 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: ret...
Get the DCNM version.
entailment
def fill_urls(self): """This assigns the URL's based on the protocol. """ 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) + ...
This assigns the URL's based on the protocol.
entailment
def get_resources(cls): """Returns Ext Resources.""" 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:...
Returns Ext Resources.
entailment
def get_inspector(): """Reuse inspector""" global _INSPECTOR if _INSPECTOR: return _INSPECTOR else: bind = op.get_bind() _INSPECTOR = sa.engine.reflection.Inspector.from_engine(bind) return _INSPECTOR
Reuse inspector
entailment
def get_data(): """Returns combined list of tuples: [(table, column)]. List is built, based on retrieved tables, where column with name ``tenant_id`` exists. """ output = [] tables = get_tables() for table in tables: columns = get_columns(table) for column in columns: ...
Returns combined list of tuples: [(table, column)]. List is built, based on retrieved tables, where column with name ``tenant_id`` exists.
entailment
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. """ return { sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()], sa.Index: get_tables() }
Special migration for the blueprint to support Keystone V3. We drop all tenant_id columns and create project_id columns instead.
entailment
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. """ admin_context = context.is_admin and cont...
Notify the Cisco cfg agent handling a particular hosting_device. A single notification can contain multiple routers.
entailment
def _notification(self, context, method, routers, operation, shuffle_agents): """Notify all or individual Cisco cfg agents.""" if extensions.is_extension_supported(self._l3plugin, L3AGENT_SCHED): adm_context = (context.is_admin and context or context.elevated()) ...
Notify all or individual Cisco cfg agents.
entailment
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. """ ...
Notify cfg agents about configuration changes to routers. This includes operations performed on the router like when a router interface is added or removed.
entailment
def router_removed_from_hosting_device(self, context, router): """Notify cfg agent about router removed from hosting device.""" self._notification(context, 'router_removed_from_hosting_device', [router], operation=None, shuffle_agents=False)
Notify cfg agent about router removed from hosting device.
entailment
def router_added_to_hosting_device(self, context, router): """Notify cfg agent about router added to hosting device.""" self._notification(context, 'router_added_to_hosting_device', [router], operation=None, shuffle_agents=False)
Notify cfg agent about router added to hosting device.
entailment
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 @p...
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
entailment
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. ...
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...
entailment
def process_amqp_msgs(self): """Process AMQP queue messages. It connects to AMQP server and calls callbacks to process DCNM events, i.e. routing key containing '.cisco.dcnm.', once they arrive in the queue. """ LOG.info('Starting process_amqp_msgs...') while Tru...
Process AMQP queue messages. It connects to AMQP server and calls callbacks to process DCNM events, i.e. routing key containing '.cisco.dcnm.', once they arrive in the queue.
entailment
def _is_pingable(ip): """Checks whether an IP address is reachable by pinging. Use linux utils to execute the ping (ICMP ECHO) command. Sends 5 packets with an interval of 0.2 seconds and timeout of 1 seconds. Runtime error implies unreachability else IP is pingable. :param ip: IP to check :ret...
Checks whether an IP address is reachable by pinging. Use linux utils to execute the ping (ICMP ECHO) command. Sends 5 packets with an interval of 0.2 seconds and timeout of 1 seconds. Runtime error implies unreachability else IP is pingable. :param ip: IP to check :return: bool - True or False dep...
entailment
def _can_connect(ip, port): """Checks if a TCP port at IP address is possible to connect to""" cs = socket.socket() try: cs.connect((ip, port)) cs.close() return True except socket.error: return False
Checks if a TCP port at IP address is possible to connect to
entailment
def get_dead_hosting_devices_info(self): """ Get a list of hosting devices that have been marked dead :return: List of dead hosting device ids """ res = [] for hd_id in self.hosting_devices_backlog: hd = self.hosting_devices_backlog[hd_id]['hd'] if...
Get a list of hosting devices that have been marked dead :return: List of dead hosting device ids
entailment
def get_monitored_hosting_devices_info(self, hd_state_filter=None): """ This function returns a list of all hosting devices monitored by this agent """ wait_time = datetime.timedelta( seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout) resp = [] fo...
This function returns a list of all hosting devices monitored by this agent
entailment
def is_hosting_device_reachable(self, hosting_device): """Check the hosting device which hosts this resource is reachable. If the resource is not reachable, it is added to the backlog. * heartbeat revision We want to enqueue all hosting-devices into the backlog for monitoring ...
Check the hosting device which hosts this resource is reachable. If the resource is not reachable, it is added to the backlog. * heartbeat revision We want to enqueue all hosting-devices into the backlog for monitoring purposes adds key/value pairs to hd (aka hosting_device ...
entailment
def check_backlogged_hosting_devices(self, driver_mgr): """Checks the status of backlogged hosting devices. Skips newly spun up instances during their booting time as specified in the boot time parameter. Each hosting-device tracked has a key, hd_state, that represents the last...
Checks the status of backlogged hosting devices. Skips newly spun up instances during their booting time as specified in the boot time parameter. Each hosting-device tracked has a key, hd_state, that represents the last known state for the hosting device. Valid values for hd_state ...
entailment
def create_floatingip(self, context, floatingip): """Create floating IP. :param context: Neutron request context :param floatingip: data for the floating IP being created :returns: A floating IP object on success As the l3 router plugin asynchronously creates floating IPs ...
Create floating IP. :param context: Neutron request context :param floatingip: data for the floating IP being created :returns: A floating IP object on success As the l3 router plugin asynchronously creates floating IPs leveraging the l3 agent and l3 cfg agent, the initial stat...
entailment
def attach_intf_router(self, tenant_id, tenant_name, router_id): """Routine to attach the interface to the router. """ in_sub = self.get_in_subnet_id(tenant_id) out_sub = self.get_out_subnet_id(tenant_id) # Modify Hard coded Name fixme subnet_lst = set() subnet_lst.add(in...
Routine to attach the interface to the router.
entailment
def get_router_id(self, tenant_id, tenant_name): """Retrieve the router ID. """ router_id = None if tenant_id in self.tenant_dict: router_id = self.tenant_dict.get(tenant_id).get('router_id') if not router_id: router_list = self.os_helper.get_rtr_by_name( ...
Retrieve the router ID.
entailment
def delete_intf_router(self, tenant_id, tenant_name, router_id): """Routine to delete the router. """ in_sub = self.get_in_subnet_id(tenant_id) out_sub = self.get_out_subnet_id(tenant_id) subnet_lst = set() subnet_lst.add(in_sub) subnet_lst.add(out_sub) router_id ...
Routine to delete the router.
entailment
def prepare_router_vm_msg(self, tenant_id, tenant_name, router_id, net_id, subnet_id, seg, status): """Prepare the message to be sent to Event queue for VDP trigger. This is actually called for a subnet add to a router. This function prepares a VM's VNIC create/del...
Prepare the message to be sent to Event queue for VDP trigger. This is actually called for a subnet add to a router. This function prepares a VM's VNIC create/delete message.
entailment
def send_router_port_msg(self, tenant_id, tenant_name, router_id, net_id, subnet_id, seg, status): """Sends the router port message to the queue. """ data = self.prepare_router_vm_msg(tenant_id, tenant_name, router_id, net_id, subnet...
Sends the router port message to the queue.
entailment
def update_dcnm_partition_static_route(self, tenant_id, arg_dict): """Add static route in DCNM's partition. This gets pushed to the relevant leaf switches. """ ip_list = self.os_helper.get_subnet_nwk_excl(tenant_id, arg_dict.get('excl...
Add static route in DCNM's partition. This gets pushed to the relevant leaf switches.
entailment
def _create_arg_dict(self, tenant_id, data, in_sub, out_sub): """Create the argument dictionary. """ in_seg, in_vlan = self.get_in_seg_vlan(tenant_id) out_seg, out_vlan = self.get_out_seg_vlan(tenant_id) in_ip_dict = self.get_in_ip_addr(tenant_id) out_ip_dict = self.get_out_ip_ad...
Create the argument dictionary.
entailment
def _create_fw(self, tenant_id, data): """Internal routine that gets called when a FW is created. """ LOG.debug("In creating Native FW data is %s", data) # TODO(padkrish): # Check if router is already added and only then add, needed for # restart cases since native doesn't have a...
Internal routine that gets called when a FW is created.
entailment
def create_fw(self, tenant_id, data): """Top level routine called when a FW is created. """ try: return self._create_fw(tenant_id, data) except Exception as exc: LOG.error("Failed to create FW for device native, tenant " "%(tenant)s data %(data)s Exc...
Top level routine called when a FW is created.
entailment
def _delete_fw(self, tenant_id, data): """Internal routine called when a FW is deleted. """ LOG.debug("In Delete fw data is %s", data) in_sub = self.get_in_subnet_id(tenant_id) out_sub = self.get_out_subnet_id(tenant_id) arg_dict = self._create_arg_dict(tenant_id, data, in_sub, o...
Internal routine called when a FW is deleted.
entailment
def delete_fw(self, tenant_id, data): """Top level routine called when a FW is deleted. """ try: ret = self._delete_fw(tenant_id, data) return ret except Exception as exc: LOG.error("Failed to delete FW for device native, tenant " "%(tena...
Top level routine called when a FW is deleted.
entailment
def _program_dcnm_static_route(self, tenant_id, tenant_name): """Program DCNM Static Route. """ in_ip_dict = self.get_in_ip_addr(tenant_id) in_gw = in_ip_dict.get('gateway') in_ip = in_ip_dict.get('subnet') if in_gw is None: LOG.error("No FW service GW present") ...
Program DCNM Static Route.
entailment
def network_create_notif(self, tenant_id, tenant_name, cidr): """Tenant Network create Notification. Restart is not supported currently for this. fixme(padkrish). """ router_id = self.get_router_id(tenant_id, tenant_name) if not router_id: LOG.error("Rout ID not pres...
Tenant Network create Notification. Restart is not supported currently for this. fixme(padkrish).
entailment
def network_delete_notif(self, tenant_id, tenant_name, network_id): """Tenant Network delete Notification. Restart is not supported currently for this. fixme(padkrish). """ router_id = self.get_router_id(tenant_id, tenant_name) if router_id is None: LOG.error("Rout I...
Tenant Network delete Notification. Restart is not supported currently for this. fixme(padkrish).
entailment
def create_hosting_device_resources(self, context, complementary_id, tenant_id, mgmt_context, max_hosted): """Create resources for a hosting device in a plugin specific way.""" mgmt_port = None if mgmt_context and mgmt_context.get('mgmt_nw_id') and tenant_...
Create resources for a hosting device in a plugin specific way.
entailment
def get_hosting_device_resources(self, context, id, complementary_id, tenant_id, mgmt_nw_id): """Returns information about all resources for a hosting device.""" mgmt_port = None # Ports for hosting device may not yet have 'device_id' set to # Nova as...
Returns information about all resources for a hosting device.
entailment
def delete_hosting_device_resources(self, context, tenant_id, mgmt_port, **kwargs): """Deletes resources for a hosting device in a plugin specific way.""" if mgmt_port is not None: try: self._cleanup_hosting_port(context, mgmt_port['id...
Deletes resources for a hosting device in a plugin specific way.
entailment
def setup_logical_port_connectivity(self, context, port_db, hosting_device_id): """Establishes connectivity for a logical port. This is done by hot plugging the interface(VIF) corresponding to the port from the VM. """ hosting_port = port_...
Establishes connectivity for a logical port. This is done by hot plugging the interface(VIF) corresponding to the port from the VM.
entailment
def teardown_logical_port_connectivity(self, context, port_db, hosting_device_id): """Removes connectivity for a logical port. Unplugs the corresponding data interface from the VM. """ if port_db is None or port_db.get('id') is None: ...
Removes connectivity for a logical port. Unplugs the corresponding data interface from the VM.
entailment
def allocate_hosting_port(self, context, router_id, port_db, network_type, hosting_device_id): """Allocates a hosting port for a logical port. We create a hosting port for the router port """ l3admin_tenant_id = self._dev_mgr.l3_tenant_id() hostingp...
Allocates a hosting port for a logical port. We create a hosting port for the router port
entailment
def disable(self, retain_port=False): """Teardown DHCP. Disable DHCP for this network by updating the remote server and then destroying any local device and namespace. """ self.update_server(disabled=True) if retain_port: return self.update_device(dis...
Teardown DHCP. Disable DHCP for this network by updating the remote server and then destroying any local device and namespace.
entailment
def recover_devices(cls): """Track devices. Creates global dict to track device names across driver invocations and populates based on current devices configured on the system. """ if "_devices" in globals(): return global _devices confs_dir = os.pa...
Track devices. Creates global dict to track device names across driver invocations and populates based on current devices configured on the system.
entailment
def check_version(cls): """Checks server version against minimum required version.""" super(SimpleCpnrDriver, cls).check_version() model.configure_pnr() cls.recover_networks() ver = model.get_version() if ver < cls.MIN_VERSION: LOG.warning("CPNR version does n...
Checks server version against minimum required version.
entailment
def existing_dhcp_networks(cls, conf): """Return a list of existing networks ids that we have configs for.""" global _networks sup = super(SimpleCpnrDriver, cls) superkeys = sup.existing_dhcp_networks(conf) return set(_networks.keys()) & set(superkeys)
Return a list of existing networks ids that we have configs for.
entailment
def _unsafe_update_server(self, disabled=False): """Update server with latest network configuration.""" id = self.network.id net = model.Network.from_neutron(self.network) if id not in _networks: if disabled: return _networks[id] = net ...
Update server with latest network configuration.
entailment
def create_network(self, name, tenant_id, subnet, gw=None): """Create the openstack network, including the subnet. """ try: body = {'network': {'name': name, 'tenant_id': tenant_id, 'admin_state_up': True}} netw = self.neutronclient.create_network...
Create the openstack network, including the subnet.
entailment
def delete_network(self, name, tenant_id, subnet_id, net_id): """Delete the openstack subnet and network. """ try: self.neutronclient.delete_subnet(subnet_id) except Exception as exc: LOG.error("Failed to delete subnet %(sub)s exc %(exc)s", {'sub': s...
Delete the openstack subnet and network.
entailment
def delete_network_all_subnets(self, net_id): """Delete the openstack network including all its subnets. """ try: body = {'network_id': net_id} subnet_list = self.neutronclient.list_subnets(body=body) subnet_list = subnet_list.get('subnets') for subnet in ...
Delete the openstack network including all its subnets.
entailment
def is_subnet_present(self, subnet_addr): """Returns if a subnet is present. """ try: subnet_list = self.neutronclient.list_subnets(body={}) subnet_dat = subnet_list.get('subnets') for sub in subnet_dat: if sub.get('cidr') == subnet_addr: ...
Returns if a subnet is present.
entailment
def get_all_subnets_cidr(self, no_mask=False): """Returns all the subnets. """ body = {} subnet_cidrs = [] try: subnet_list = self.neutronclient.list_subnets(body=body) subnet_dat = subnet_list.get('subnets') for sub in subnet_dat: if n...
Returns all the subnets.
entailment
def get_subnets_for_net(self, net): """Returns the subnets in a network. """ try: subnet_list = self.neutronclient.list_subnets(network_id=net) subnet_dat = subnet_list.get('subnets') return subnet_dat except Exception as exc: LOG.error("Failed to ...
Returns the subnets in a network.
entailment
def get_subnet_cidr(self, subnet_id): """retrieve the CIDR associated with a subnet, given its ID. """ try: subnet_list = self.neutronclient.list_subnets(id=subnet_id) subnet_dat = subnet_list.get('subnets')[0] return subnet_dat.get('cidr') except Exception as...
retrieve the CIDR associated with a subnet, given its ID.
entailment
def delete_network_subname(self, sub_name): """Delete the network by part of its name, use with caution. """ try: body = {} net_list = self.neutronclient.list_networks(body=body) for net in net_list: if net.get('name').find(sub_name) != -1: ...
Delete the network by part of its name, use with caution.
entailment
def get_network_by_name(self, nwk_name): """Search for a openstack network by name. """ ret_net_lst = [] try: body = {} net_list = self.neutronclient.list_networks(body=body) net_list = net_list.get('networks') for net in net_list: ...
Search for a openstack network by name.
entailment
def get_network_by_tenant(self, tenant_id): """Returns the network of a given tenant. """ ret_net_lst = [] try: net_list = self.neutronclient.list_networks(body={}) for net in net_list.get('networks'): if net.get('tenant_id') == tenant_id: ...
Returns the network of a given tenant.
entailment
def get_rtr_by_name(self, rtr_name): """Search a router by its name. """ upd_rtr_list = [] try: rtr_list = self.neutronclient.list_routers() for rtr in rtr_list.get('routers'): if rtr_name == rtr['name']: upd_rtr_list.append(rtr) ...
Search a router by its name.
entailment
def create_router(self, name, tenant_id, subnet_lst): """Create a openstack router and add the interfaces. """ try: body = {'router': {'name': name, 'tenant_id': tenant_id, 'admin_state_up': True}} router = self.neutronclient.create_router(body=body...
Create a openstack router and add the interfaces.
entailment
def add_intf_router(self, rout_id, tenant_id, subnet_lst): """Add the interfaces to a router. """ try: for subnet_id in subnet_lst: body = {'subnet_id': subnet_id} intf = self.neutronclient.add_interface_router(rout_id, ...
Add the interfaces to a router.
entailment
def delete_router(self, name, tenant_id, rout_id, subnet_lst): """Delete the openstack router. Delete the router and remove the interfaces attached to it. """ ret = self.delete_intf_router(name, tenant_id, rout_id, subnet_lst) if not ret: return False try: ...
Delete the openstack router. Delete the router and remove the interfaces attached to it.
entailment