sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def get_port_switch_bindings(port_id, switch_ip): """List all vm/vlan bindings on a Nexus switch port.""" LOG.debug("get_port_switch_bindings() called, " "port:'%(port_id)s', switch:'%(switch_ip)s'", {'port_id': port_id, 'switch_ip': switch_ip}) try: return _lookup_all_ne...
List all vm/vlan bindings on a Nexus switch port.
entailment
def _lookup_nexus_bindings(query_type, session=None, **bfilter): """Look up 'query_type' Nexus bindings matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param bfilter: filter for bindings query :returns: bindings if query gave a result, else r...
Look up 'query_type' Nexus bindings matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param bfilter: filter for bindings query :returns: bindings if query gave a result, else raise NexusPortBindingNotFound.
entailment
def add_nexusnve_binding(vni, switch_ip, device_id, mcast_group): """Adds a nexus nve binding.""" LOG.debug("add_nexusnve_binding() called") session = bc.get_writer_session() binding = nexus_models_v2.NexusNVEBinding(vni=vni, switch_ip=switch_ip, ...
Adds a nexus nve binding.
entailment
def remove_nexusnve_binding(vni, switch_ip, device_id): """Remove the nexus nve binding.""" LOG.debug("remove_nexusnve_binding() called") session = bc.get_writer_session() binding = (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_ip, ...
Remove the nexus nve binding.
entailment
def remove_all_nexusnve_bindings(): """Removes all nexusnve bindings.""" LOG.debug("remove_all_nexusport_bindings() called") session = bc.get_writer_session() session.query(nexus_models_v2.NexusNVEBinding).delete() session.flush()
Removes all nexusnve bindings.
entailment
def get_nve_vni_switch_bindings(vni, switch_ip): """Return the nexus nve binding(s) per switch.""" LOG.debug("get_nve_vni_switch_bindings() called") session = bc.get_reader_session() try: return (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_...
Return the nexus nve binding(s) per switch.
entailment
def _lookup_host_mappings(query_type, session=None, **bfilter): """Look up 'query_type' Nexus mappings matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param bfilter: filter for mappings query :returns: mappings if query gave a result, else ra...
Look up 'query_type' Nexus mappings matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param bfilter: filter for mappings query :returns: mappings if query gave a result, else raise NexusHostMappingNotFound.
entailment
def add_host_mapping(host_id, nexus_ip, interface, ch_grp, is_static): """Add Host to interface mapping entry into mapping data base. :param host_id: is the name of the host to add :param interface: is the interface for this host :param nexus_ip: is the ip addr of the nexus switch for this interface ...
Add Host to interface mapping entry into mapping data base. :param host_id: is the name of the host to add :param interface: is the interface for this host :param nexus_ip: is the ip addr of the nexus switch for this interface :param ch_grp: is the port channel this interface belos :param is_static...
entailment
def update_host_mapping(host_id, interface, nexus_ip, new_ch_grp): """Change channel_group in host/interface mapping data base.""" LOG.debug("update_host_mapping called") session = bc.get_writer_session() mapping = _lookup_one_host_mapping( session=session, host_id=h...
Change channel_group in host/interface mapping data base.
entailment
def remove_host_mapping(interface, nexus_ip): """Remove host to interface mapping entry from mapping data base.""" LOG.debug("remove_host_mapping() called") session = bc.get_writer_session() try: mapping = _lookup_one_host_mapping( session=session, if...
Remove host to interface mapping entry from mapping data base.
entailment
def remove_all_static_host_mappings(): """Remove all entries defined in config file from mapping data base.""" LOG.debug("remove_host_mapping() called") session = bc.get_writer_session() try: mapping = _lookup_all_host_mappings( session=session, is_st...
Remove all entries defined in config file from mapping data base.
entailment
def _lookup_vpc_allocs(query_type, session=None, order=None, **bfilter): """Look up 'query_type' Nexus VPC Allocs matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param order: select what field to order data :param bfilter: filter for mappings query :r...
Look up 'query_type' Nexus VPC Allocs matching the filter. :param query_type: 'all', 'one' or 'first' :param session: db session :param order: select what field to order data :param bfilter: filter for mappings query :returns: VPCs if query gave a result, else raise NexusVPCAllocNotFou...
entailment
def _lookup_vpc_count_min_max(session=None, **bfilter): """Look up count/min/max Nexus VPC Allocs for given switch. :param session: db session :param bfilter: filter for mappings query :returns: number of VPCs and min value if query gave a result, else raise NexusVPCAllocNotFound. """ ...
Look up count/min/max Nexus VPC Allocs for given switch. :param session: db session :param bfilter: filter for mappings query :returns: number of VPCs and min value if query gave a result, else raise NexusVPCAllocNotFound.
entailment
def _get_free_vpcids_on_switches(switch_ip_list): '''Get intersect list of free vpcids in list of switches.''' session = bc.get_reader_session() prev_view = aliased(nexus_models_v2.NexusVPCAlloc) query = session.query(prev_view.vpc_id) prev_swip = switch_ip_list[0] for ip in switch_ip_list[1:...
Get intersect list of free vpcids in list of switches.
entailment
def init_vpc_entries(nexus_ip, vpc_list): """Initialize switch/vpc entries in vpc alloc data base. param: nexus_ip ip addr of the nexus switch for this interface param: vpc_list list of vpc integers to create """ LOG.debug("init_vpc_entries() called") if not vpc_list: return ses...
Initialize switch/vpc entries in vpc alloc data base. param: nexus_ip ip addr of the nexus switch for this interface param: vpc_list list of vpc integers to create
entailment
def update_vpc_entry(nexus_ips, vpc_id, learned, active): """Change active state in vpc_allocate data base.""" LOG.debug("update_vpc_entry called") session = bc.get_writer_session() with session.begin(): for n_ip in nexus_ips: flipit = not active x = session.execute( ...
Change active state in vpc_allocate data base.
entailment
def alloc_vpcid(nexus_ips): """Allocate a vpc id for the given list of switch_ips.""" LOG.debug("alloc_vpc() called") vpc_id = 0 intersect = _get_free_vpcids_on_switches(nexus_ips) for intersect_tuple in intersect: try: update_vpc_entry(nexus_ips, intersect_tuple.vpc_id, ...
Allocate a vpc id for the given list of switch_ips.
entailment
def free_vpcid_for_switch_list(vpc_id, nexus_ips): """Free a vpc id for the given list of switch_ips.""" LOG.debug("free_vpcid_for_switch_list() called") if vpc_id != 0: update_vpc_entry(nexus_ips, vpc_id, False, False)
Free a vpc id for the given list of switch_ips.
entailment
def free_vpcid_for_switch(vpc_id, nexus_ip): """Free a vpc id for the given switch_ip.""" LOG.debug("free_vpcid_for_switch() called") if vpc_id != 0: update_vpc_entry([nexus_ip], vpc_id, False, False)
Free a vpc id for the given switch_ip.
entailment
def delete_vpcid_for_switch(vpc_id, switch_ip): """Removes unused vpcid for a switch. :param vpc_id: vpc id to remove :param switch_ip: ip address of the switch """ LOG.debug("delete_vpcid_for_switch called") session = bc.get_writer_session() vpc = _lookup_one_vpc_allocs(vpc_id=vpc_id, ...
Removes unused vpcid for a switch. :param vpc_id: vpc id to remove :param switch_ip: ip address of the switch
entailment
def get_resources(cls): """Returns Ext Resources.""" exts = [] parent = dict(member_name="agent", collection_name="agents") controller = resource.Resource(HostingDeviceSchedulerController(), cb_faults.FAULT_MAP) exts.ap...
Returns Ext Resources.
entailment
def create_process(cmd, root_helper=None, addl_env=None, log_output=True): """Create a process object for the given command. The return value will be a tuple of the process object and the list of command arguments used to create it. """ if root_helper: cmd = shlex.split(root_helper) + cmd ...
Create a process object for the given command. The return value will be a tuple of the process object and the list of command arguments used to create it.
entailment
def is_intf_up(intf): """Function to check if a interface is up. """ intf_path = '/'.join(('/sys/class/net', intf)) intf_exist = os.path.exists(intf_path) if not intf_exist: LOG.error("Unable to get interface %(intf)s, Interface dir " "%(dir)s does not exist", ...
Function to check if a interface is up.
entailment
def get_all_run_phy_intf(): """Retrieve all physical interfaces that are operationally up. """ intf_list = [] base_dir = '/sys/class/net' dir_exist = os.path.exists(base_dir) if not dir_exist: LOG.error("Unable to get interface list :Base dir %s does not " "exist", base_dir...
Retrieve all physical interfaces that are operationally up.
entailment
def check_vnic_type_and_vendor_info(self, vnic_type, profile): """Checks if this vnic_type and vendor device info are supported. Returns True if: 1. the port vnic_type is direct or macvtap and 2. the vendor_id and product_id of the port is supported by this MD Useful in ...
Checks if this vnic_type and vendor device info are supported. Returns True if: 1. the port vnic_type is direct or macvtap and 2. the vendor_id and product_id of the port is supported by this MD Useful in determining if this MD should bind the current port.
entailment
def _check_for_supported_vendor(self, profile): """Checks if the port belongs to a supported vendor. Returns True for supported_pci_devs. """ vendor_info = profile.get('pci_vendor_info') if not vendor_info: return False if vendor_info not in self.supported_pc...
Checks if the port belongs to a supported vendor. Returns True for supported_pci_devs.
entailment
def _import_ucsmsdk(self): """Imports the Ucsm SDK module. This module is not installed as part of the normal Neutron distributions. It is imported dynamically in this module so that the import can be mocked, allowing unit testing without requiring the installation of UcsSdk. ...
Imports the Ucsm SDK module. This module is not installed as part of the normal Neutron distributions. It is imported dynamically in this module so that the import can be mocked, allowing unit testing without requiring the installation of UcsSdk.
entailment
def _get_server_name(self, handle, service_profile_mo, ucsm_ip): """Get the contents of the 'Name' field associated with UCS Server. When a valid connection hande to UCS Manager is handed in, the Name field associated with a UCS Server is returned. """ try: resolved_...
Get the contents of the 'Name' field associated with UCS Server. When a valid connection hande to UCS Manager is handed in, the Name field associated with a UCS Server is returned.
entailment
def _create_ucsm_host_to_service_profile_mapping(self): """Reads list of Service profiles and finds associated Server.""" ucsm_ips = list(CONF.ml2_cisco_ucsm.ucsms) for ucsm_ip in ucsm_ips: with self.ucsm_connect_disconnect(ucsm_ip) as handle: try: ...
Reads list of Service profiles and finds associated Server.
entailment
def _create_vlanprofile(self, handle, vlan_id, ucsm_ip): """Creates VLAN profile to be assosiated with the Port Profile.""" vlan_name = self.make_vlan_name(vlan_id) vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX + vlan_name) try: ...
Creates VLAN profile to be assosiated with the Port Profile.
entailment
def _create_port_profile(self, handle, profile_name, vlan_id, vnic_type, ucsm_ip, trunk_vlans, qos_policy): """Creates a Port Profile on the UCS Manager. Significant parameters set in the port profile are: 1. Port profile name - Should match what was set in vif_deta...
Creates a Port Profile on the UCS Manager. Significant parameters set in the port profile are: 1. Port profile name - Should match what was set in vif_details 2. High performance mode - For VM-FEX to be enabled/configured on the port using this port profile, this mode should be enabled....
entailment
def create_portprofile(self, profile_name, vlan_id, vnic_type, host_id, trunk_vlans): """Top level method to create Port Profiles on the UCS Manager. Calls all the methods responsible for the individual tasks that ultimately result in the creation of the Port Profile on the UCS ...
Top level method to create Port Profiles on the UCS Manager. Calls all the methods responsible for the individual tasks that ultimately result in the creation of the Port Profile on the UCS Manager.
entailment
def _update_service_profile(self, handle, service_profile, vlan_id, ucsm_ip): """Updates Service Profile on the UCS Manager. Each of the ethernet ports on the Service Profile representing the UCS Server, is updated with the VLAN profile corresponding to t...
Updates Service Profile on the UCS Manager. Each of the ethernet ports on the Service Profile representing the UCS Server, is updated with the VLAN profile corresponding to the vlan_id passed in.
entailment
def update_serviceprofile(self, host_id, vlan_id): """Top level method to update Service Profiles on UCS Manager. Calls all the methods responsible for the individual tasks that ultimately result in a vlan_id getting programed on a server's ethernet ports and the Fabric Interconnect's n...
Top level method to update Service Profiles on UCS Manager. Calls all the methods responsible for the individual tasks that ultimately result in a vlan_id getting programed on a server's ethernet ports and the Fabric Interconnect's network ports.
entailment
def update_vnic_template(self, host_id, vlan_id, physnet, vnic_template_path, vnic_template): """Updates VNIC Template with the vlan_id.""" ucsm_ip = self.get_ucsm_ip_for_host(host_id) if not ucsm_ip: LOG.info('UCS Manager network driver does not have UCSM IP ' ...
Updates VNIC Template with the vlan_id.
entailment
def _delete_vlan_profile(self, handle, vlan_id, ucsm_ip): """Deletes VLAN Profile from UCS Manager.""" vlan_name = self.make_vlan_name(vlan_id) vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX + vlan_name) try: handle.StartTra...
Deletes VLAN Profile from UCS Manager.
entailment
def _delete_port_profile_from_ucsm(self, handle, port_profile, ucsm_ip): """Deletes Port Profile from UCS Manager.""" port_profile_dest = (const.PORT_PROFILESETDN + const.VNIC_PATH_PREFIX + port_profile) handle.StartTransaction() # Find port profile on the U...
Deletes Port Profile from UCS Manager.
entailment
def _delete_port_profile(self, handle, port_profile, ucsm_ip): """Calls method to delete Port Profile from UCS Manager. If exception is raised by UCSM, then the PP is added to a DB table. The delete timer thread, tried to delete all PPs added to this table when it wakes up. ...
Calls method to delete Port Profile from UCS Manager. If exception is raised by UCSM, then the PP is added to a DB table. The delete timer thread, tried to delete all PPs added to this table when it wakes up.
entailment
def _remove_vlan_from_all_service_profiles(self, handle, vlan_id, ucsm_ip): """Deletes VLAN Profile config from server's ethernet ports.""" service_profile_list = [] for key, value in six.iteritems(self.ucsm_sp_dict): if (ucsm_ip in key) and value: service_profile_lis...
Deletes VLAN Profile config from server's ethernet ports.
entailment
def _remove_vlan_from_all_sp_templates(self, handle, vlan_id, ucsm_ip): """Deletes VLAN config from all SP Templates that have it.""" sp_template_info_list = ( CONF.ml2_cisco_ucsm.ucsms[ucsm_ip].sp_template_list.values()) vlan_name = self.make_vlan_name(vlan_id) virtio_port_...
Deletes VLAN config from all SP Templates that have it.
entailment
def _remove_vlan_from_vnic_templates(self, handle, vlan_id, ucsm_ip): """Removes VLAN from all VNIC templates that have it enabled.""" ucsm = CONF.ml2_cisco_ucsm.ucsms[ucsm_ip] vnic_template_info = ucsm.vnic_template_list.values() vlan_name = self.make_vlan_name(vlan_id) if not...
Removes VLAN from all VNIC templates that have it enabled.
entailment
def delete_all_config_for_vlan(self, vlan_id, port_profile, trunk_vlans): """Top level method to delete all config for vlan_id.""" ucsm_ips = list(CONF.ml2_cisco_ucsm.ucsms) for ucsm_ip in ucsm_ips: with self.ucsm_connect_disconnect(ucsm_ip) as han...
Top level method to delete all config for vlan_id.
entailment
def ucs_manager_disconnect(self, handle, ucsm_ip): """Disconnects from the UCS Manager. After the disconnect, the handle associated with this connection is no longer valid. """ try: handle.Logout() except Exception as e: # Raise a Neutron exceptio...
Disconnects from the UCS Manager. After the disconnect, the handle associated with this connection is no longer valid.
entailment
def add_events(self, **kwargs): """Add failure event into the queue.""" event_q = kwargs.get('event_queue') pri = kwargs.get('priority') if not event_q or not pri: return try: event_type = 'server.failure.recovery' payload = {} ti...
Add failure event into the queue.
entailment
def failure_recovery(self, fail_info): """Failure recovery task. In case of failure in projects, network and VM create/delete, this task goes through all failure cases and try the request. """ # Read failed entries from project database and send request # (create/delete ...
Failure recovery task. In case of failure in projects, network and VM create/delete, this task goes through all failure cases and try the request.
entailment
def init_params(self, protocol_interface, phy_interface): """Initializing parameters. """ self.lldp_cfgd = False self.local_intf = protocol_interface self.phy_interface = phy_interface self.remote_evb_cfgd = False self.remote_evb_mode = None self.remote_mgmt_addr ...
Initializing parameters.
entailment
def cmp_update_bond_intf(self, bond_interface): """Update the bond interface and its members. Update the bond interface, if this interface is a part of bond Return True if there's a change. """ if bond_interface != self.bond_interface: self.bond_interface = bond_inte...
Update the bond interface and its members. Update the bond interface, if this interface is a part of bond Return True if there's a change.
entailment
def remote_evb_mode_uneq_store(self, remote_evb_mode): """Saves the EVB mode, if it is not the same as stored. """ if remote_evb_mode != self.remote_evb_mode: self.remote_evb_mode = remote_evb_mode return True return False
Saves the EVB mode, if it is not the same as stored.
entailment
def remote_evb_cfgd_uneq_store(self, remote_evb_cfgd): """This saves the EVB cfg, if it is not the same as stored. """ if remote_evb_cfgd != self.remote_evb_cfgd: self.remote_evb_cfgd = remote_evb_cfgd return True return False
This saves the EVB cfg, if it is not the same as stored.
entailment
def remote_mgmt_addr_uneq_store(self, remote_mgmt_addr): """This function saves the MGMT address, if different from stored. """ if remote_mgmt_addr != self.remote_mgmt_addr: self.remote_mgmt_addr = remote_mgmt_addr return True return False
This function saves the MGMT address, if different from stored.
entailment
def remote_sys_desc_uneq_store(self, remote_system_desc): """This function saves the system desc, if different from stored. """ if remote_system_desc != self.remote_system_desc: self.remote_system_desc = remote_system_desc return True return False
This function saves the system desc, if different from stored.
entailment
def remote_sys_name_uneq_store(self, remote_system_name): """This function saves the system name, if different from stored. """ if remote_system_name != self.remote_system_name: self.remote_system_name = remote_system_name return True return False
This function saves the system name, if different from stored.
entailment
def remote_port_uneq_store(self, remote_port): """This function saves the port, if different from stored. """ if remote_port != self.remote_port: self.remote_port = remote_port return True return False
This function saves the port, if different from stored.
entailment
def remote_chassis_id_mac_uneq_store(self, remote_chassis_id_mac): """This function saves the Chassis MAC, if different from stored. """ if remote_chassis_id_mac != self.remote_chassis_id_mac: self.remote_chassis_id_mac = remote_chassis_id_mac return True return False
This function saves the Chassis MAC, if different from stored.
entailment
def remote_port_id_mac_uneq_store(self, remote_port_id_mac): """This function saves the port MAC, if different from stored. """ if remote_port_id_mac != self.remote_port_id_mac: self.remote_port_id_mac = remote_port_id_mac return True return False
This function saves the port MAC, if different from stored.
entailment
def get_lldp_status(cls, intf): """Retrieves the LLDP status. """ 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()
Retrieves the LLDP status.
entailment
def _init_cfg_interfaces(self, cb, intf_list=None, all_intf=True): """Configure the interfaces during init time. """ 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 = {} ...
Configure the interfaces during init time.
entailment
def cfg_intf(self, protocol_interface, phy_interface=None): """Called by application to add an interface to the list. """ self.intf_list.append(protocol_interface) self.cfg_lldp_interface(protocol_interface, phy_interface)
Called by application to add an interface to the list.
entailment
def create_attr_obj(self, protocol_interface, phy_interface): """Creates the local interface attribute object and stores it. """ self.intf_attr[protocol_interface] = TopoIntfAttr( protocol_interface, phy_interface) self.store_obj(protocol_interface, self.intf_attr[protocol_interface]...
Creates the local interface attribute object and stores it.
entailment
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. """ flag = False attr_obj = self.get_attr_obj(intf) remote_evb_mode = self.pub_lldp.get_remote_...
Compare and store the received TLV. Compares the received TLV with stored TLV. Store the new TLV if it is different.
entailment
def cfg_lldp_interface(self, protocol_interface, phy_interface=None): """Cfg LLDP on interface and create object. """ if phy_interface is None: phy_interface = protocol_interface self.create_attr_obj(protocol_interface, phy_interface) ret = self.pub_lldp.enable_lldp(protocol_...
Cfg LLDP on interface and create object.
entailment
def periodic_discovery_task(self): """Periodic task that checks the interface TLV attributes. """ try: self._periodic_task_int() except Exception as exc: LOG.error("Exception caught in periodic discovery task %s", str(exc))
Periodic task that checks the interface TLV attributes.
entailment
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 inte...
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.
entailment
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. """ for intf in 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.
entailment
def _get_cookie(self, mgmt_ip, config, refresh=False): """Performs authentication and retries cookie.""" 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: ...
Performs authentication and retries cookie.
entailment
def send_request(self, method, action, body=None, headers=None, ipaddr=None): """Perform the HTTP request. The response is in either JSON format or plain text. A GET method will invoke a JSON response while a PUT/POST/DELETE returns message from the the server in pla...
Perform the HTTP request. The response is in either JSON format or plain text. A GET method will invoke a JSON response while a PUT/POST/DELETE returns message from the the server in plain text format. Exception is raised when server replies with an INTERNAL SERVER ERROR status ...
entailment
def _initialize_trunk_interfaces_to_none(self, switch_ip, replay=True): """Initialize all nexus interfaces to trunk allowed none.""" try: # The following determines if the switch interfaces are # in place. If so, make sure they have a basic trunk # configuration app...
Initialize all nexus interfaces to trunk allowed none.
entailment
def replay_config(self, switch_ip): """Sends pending config data in OpenStack to Nexus.""" 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 fai...
Sends pending config data in OpenStack to Nexus.
entailment
def check_connections(self): """Check connection between OpenStack to Nexus device.""" 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._mdri...
Check connection between OpenStack to Nexus device.
entailment
def _load_nexus_cfg_driver(self): """Load Nexus Config driver. :raises SystemExit of 1 if driver cannot be loaded """ try: loaded_class = runtime_utils.load_class_by_alias_or_classname( 'networking_cisco.ml2.nexus_driver', 'restapi') return loaded...
Load Nexus Config driver. :raises SystemExit of 1 if driver cannot be loaded
entailment
def _switch_defined(self, switch_ip): """Verify this ip address is defined (for Nexus).""" switch = cfg.CONF.ml2_cisco.nexus_switches.get(switch_ip) if switch and switch.username and switch.password: return True else: return False
Verify this ip address is defined (for Nexus).
entailment
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 s...
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...
entailment
def get_all_switch_ips(self): """Using reserved switch binding get all switch ips.""" switch_connections = [] try: bindings = nxos_db.get_reserved_switch_binding() except excep.NexusPortBindingNotFound: LOG.error("No switch bindings in the port data base") ...
Using reserved switch binding get all switch ips.
entailment
def _get_baremetal_switch_info(self, link_info): """Get switch_info dictionary from context.""" try: switch_info = link_info['switch_info'] if not isinstance(switch_info, dict): switch_info = jsonutils.loads(switch_info) except Exception as e: ...
Get switch_info dictionary from context.
entailment
def _supported_baremetal_transaction(self, context): """Verify transaction is complete and for us.""" 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...
Verify transaction is complete and for us.
entailment
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 :re...
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
entailment
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 transacti...
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...
entailment
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 switc...
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. ...
entailment
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_i...
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...
entailment
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 t...
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_...
entailment
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 configurati...
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 ...
entailment
def _configure_nve_db(self, vni, device_id, mcast_group, host_id): """Create the nexus NVE database entry. Called during update precommit port event. """ host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: if not nxos_db.g...
Create the nexus NVE database entry. Called during update precommit port event.
entailment
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. """ host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: ...
Add "member vni" configuration to the NVE interface. Called during update postcommit port event.
entailment
def _delete_nve_db(self, vni, device_id, mcast_group, host_id): """Delete the nexus NVE database entry. Called during delete precommit port event. """ rows = nxos_db.get_nve_vni_deviceid_bindings(vni, device_id) for row in rows: nxos_db.remove_nexusnve_binding(vni, r...
Delete the nexus NVE database entry. Called during delete precommit port event.
entailment
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. """ host_nve_connections = self._get_switch_nve_info(host_id) for switch_ip in host_nve_connections: ...
Remove "member vni" configuration from the NVE interface. Called during delete postcommit port event.
entailment
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. """ connections = self._get_port_connections(port, host_id) for switch_ip, intf_type,...
Create the nexus database entry. Called during update precommit port event.
entailment
def _gather_config_parms(self, is_provider_vlan, vlan_id): """Collect auto_create, auto_trunk from config.""" 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_cr...
Collect auto_create, auto_trunk from config.
entailment
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.""" # This implies VLAN, VNI...
Conditionally calls vlan and port Nexus drivers.
entailment
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])...
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: -----------...
entailment
def _restore_port_binding(self, switch_ip, pvlan_ids, port, native_vlan): """Restores a set of vlans for a given port.""" intf_type, nexus_port = nexus_help.split_interface_name(port) # If native_vlan is configured, this is isolated sin...
Restores a set of vlans for a given port.
entailment
def _restore_vxlan_entries(self, switch_ip, vlans): """Restore vxlan entries on a Nexus switch.""" 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 ...
Restore vxlan entries on a Nexus switch.
entailment
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 ...
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.
entailment
def configure_next_batch_of_vlans(self, switch_ip): """Get next batch of vlans and send them to Nexus.""" next_range = self._pop_vlan_range( switch_ip, const.CREATE_VLAN_BATCH) if next_range: try: self.driver.set_all_vlan_states( ...
Get next batch of vlans and send them to Nexus.
entailment
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 c...
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...
entailment
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. """ try: rows = nxos_db.get_nexusvm_bindings(vlan_id, device_id) for row ...
Delete the nexus database entry. Called during delete precommit port event.
entailment
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.''' # if this connection is not a port-channel, nothing to do. if intf_type != 'port-channel': ...
This determines if port channel id needs to be freed.
entailment
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. ...
Delete the nexus switch entry. By accessing the current db entries determine if switch configuration can be removed. Called during delete postcommit port event.
entailment
def _port_action_vlan(self, port, segment, func, vni): """Verify configuration and then process event.""" # 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 = ...
Verify configuration and then process event.
entailment
def _port_action_vxlan(self, port, segment, func): """Verify configuration and then process event.""" # 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') ...
Verify configuration and then process event.
entailment
def create_port_postcommit(self, context): """Create port non-database commit event.""" # 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...
Create port non-database commit event.
entailment