sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def get_remote_chassis_id_mac(self, tlv_data):
"""Returns Remote Chassis ID MAC from the TLV. """
ret, parsed_val = self._check_common_tlv_format(
tlv_data, "MAC:", "Chassis ID TLV")
if not ret:
return None
mac = parsed_val[1].split('\n')
return mac[0].str... | Returns Remote Chassis ID MAC from the TLV. | entailment |
def get_remote_port_id_local(self, tlv_data):
"""Returns Remote Port ID Local from the TLV. """
ret, parsed_val = self._check_common_tlv_format(
tlv_data, "Local:", "Port ID TLV")
if not ret:
return None
local = parsed_val[1].split('\n')
return local[0].st... | Returns Remote Port ID Local from the TLV. | entailment |
def format_interface_name(intf_type, port, ch_grp=0):
"""Method to format interface name given type, port.
Given interface type, port, and channel-group, this
method formats an interface name. If channel-group is
non-zero, then port-channel is configured.
:param intf_type: Such as 'ethernet' or '... | Method to format interface name given type, port.
Given interface type, port, and channel-group, this
method formats an interface name. If channel-group is
non-zero, then port-channel is configured.
:param intf_type: Such as 'ethernet' or 'port-channel'
:param port: unique identification -- 1/32 ... | entailment |
def split_interface_name(interface, ch_grp=0):
"""Method to split interface type, id from name.
Takes an interface name or just interface suffix
and returns interface type and number separately.
:param interface: interface name or just suffix
:param ch_grp: if non-zero, ignore interface
... | Method to split interface type, id from name.
Takes an interface name or just interface suffix
and returns interface type and number separately.
:param interface: interface name or just suffix
:param ch_grp: if non-zero, ignore interface
name and return 'port-channel' grp
:retur... | entailment |
def _host_notification(self, context, method, payload, host):
"""Notify the cfg agent that is handling the hosting device."""
LOG.debug('Notify Cisco cfg agent at %(host)s the message '
'%(method)s', {'host': host, 'method': method})
cctxt = self.client.prepare(server=host)
... | Notify the cfg agent that is handling the hosting device. | entailment |
def _agent_notification(self, context, method, hosting_devices, operation):
"""Notify individual Cisco cfg agents."""
admin_context = context.is_admin and context or context.elevated()
for hosting_device in hosting_devices:
agents = self._dmplugin.get_cfg_agents_for_hosting_devices(
... | Notify individual Cisco cfg agents. | entailment |
def agent_updated(self, context, admin_state_up, host):
"""Updates cfg agent on <host> to enable or disable it."""
self._host_notification(context, 'agent_updated',
{'admin_state_up': admin_state_up}, host) | Updates cfg agent on <host> to enable or disable it. | entailment |
def hosting_devices_unassigned_from_cfg_agent(self, context, ids, host):
"""Notify cfg agent to no longer handle some hosting devices.
This notification relieves the cfg agent in <host> of responsibility
to monitor and configure hosting devices with id specified in <ids>.
"""
se... | Notify cfg agent to no longer handle some hosting devices.
This notification relieves the cfg agent in <host> of responsibility
to monitor and configure hosting devices with id specified in <ids>. | entailment |
def hosting_devices_assigned_to_cfg_agent(self, context, ids, host):
"""Notify cfg agent to now handle some hosting devices.
This notification relieves the cfg agent in <host> of responsibility
to monitor and configure hosting devices with id specified in <ids>.
"""
self._host_n... | Notify cfg agent to now handle some hosting devices.
This notification relieves the cfg agent in <host> of responsibility
to monitor and configure hosting devices with id specified in <ids>. | entailment |
def hosting_devices_removed(self, context, hosting_data, deconfigure,
host):
"""Notify cfg agent that some hosting devices have been removed.
This notification informs the cfg agent in <host> that the
hosting devices in the <hosting_data> dictionary have been rem... | Notify cfg agent that some hosting devices have been removed.
This notification informs the cfg agent in <host> that the
hosting devices in the <hosting_data> dictionary have been removed
from the hosting device pool. The <hosting_data> dictionary also
contains the ids of the affected l... | entailment |
def get_hosting_device_configuration(self, context, id):
"""Fetch configuration of hosting device with id.
The configuration agent should respond with the running config of
the hosting device.
"""
admin_context = context.is_admin and context or context.elevated()
agents ... | Fetch configuration of hosting device with id.
The configuration agent should respond with the running config of
the hosting device. | entailment |
def store_policy(self, pol_id, policy):
"""Store the policy.
Policy is maintained as a dictionary of pol ID.
"""
if pol_id not in self.policies:
self.policies[pol_id] = policy
self.policy_cnt += 1 | Store the policy.
Policy is maintained as a dictionary of pol ID. | entailment |
def store_rule(self, rule_id, rule):
"""Store the rules.
Policy is maintained as a dictionary of Rule ID.
"""
if rule_id not in self.rules:
self.rules[rule_id] = rule
self.rule_cnt += 1 | Store the rules.
Policy is maintained as a dictionary of Rule ID. | entailment |
def delete_rule(self, rule_id):
"""Delete the specific Rule from dictionary indexed by rule id. """
if rule_id not in self.rules:
LOG.error("No Rule id present for deleting %s", rule_id)
return
del self.rules[rule_id]
self.rule_cnt -= 1 | Delete the specific Rule from dictionary indexed by rule id. | entailment |
def rule_update(self, rule_id, rule):
"""Update the rule. """
if rule_id not in self.rules:
LOG.error("Rule ID not present %s", rule_id)
return
self.rules[rule_id].update(rule) | Update the rule. | entailment |
def is_fw_present(self, fw_id):
"""Returns if firewall index by ID is present in dictionary. """
if self.fw_id is None or self.fw_id != fw_id:
return False
else:
return True | Returns if firewall index by ID is present in dictionary. | entailment |
def create_fw(self, proj_name, pol_id, fw_id, fw_name, fw_type, rtr_id):
"""Fills up the local attributes when FW is created. """
self.tenant_name = proj_name
self.fw_id = fw_id
self.fw_name = fw_name
self.fw_created = True
self.active_pol_id = pol_id
self.fw_type... | Fills up the local attributes when FW is created. | entailment |
def delete_fw(self, fw_id):
"""Deletes the FW local attributes. """
self.fw_id = None
self.fw_name = None
self.fw_created = False
self.active_pol_id = None | Deletes the FW local attributes. | entailment |
def delete_policy(self, pol_id):
"""Deletes the policy from the local dictionary. """
if pol_id not in self.policies:
LOG.error("Invalid policy %s", pol_id)
return
del self.policies[pol_id]
self.policy_cnt -= 1 | Deletes the policy from the local dictionary. | entailment |
def is_fw_complete(self):
"""This API returns the completion status of FW.
This returns True if a FW is created with a active policy that has
more than one rule associated with it and if a driver init is done
successfully.
"""
LOG.info("In fw_complete needed %(fw_created... | This API returns the completion status of FW.
This returns True if a FW is created with a active policy that has
more than one rule associated with it and if a driver init is done
successfully. | entailment |
def one_rule_present(self, pol_id):
"""Returns if atleast one rule is present in the policy. """
pol_dict = self.policies[pol_id]
for rule in pol_dict['rule_dict']:
if self.is_rule_present(rule):
return True
return False | Returns if atleast one rule is present in the policy. | entailment |
def get_fw_dict(self):
"""This API creates a FW dictionary from the local attributes. """
fw_dict = {}
if self.fw_id is None:
return fw_dict
fw_dict = {'rules': {}, 'tenant_name': self.tenant_name,
'tenant_id': self.tenant_id, 'fw_id': self.fw_id,
... | This API creates a FW dictionary from the local attributes. | entailment |
def update_fw_params(self, rtr_id=-1, fw_type=-1):
"""Updates the FW parameters. """
if rtr_id != -1:
self.router_id = rtr_id
if fw_type != -1:
self.fw_type = fw_type | Updates the FW parameters. | entailment |
def populate_cfg_dcnm(self, cfg, dcnm_obj):
"""This routine stores the DCNM object. """
if not self.fw_init:
return
self.dcnm_obj = dcnm_obj
self.fabric.store_dcnm(dcnm_obj)
self.populate_dcnm_obj(dcnm_obj) | This routine stores the DCNM object. | entailment |
def populate_event_queue(self, cfg, que_obj):
"""This routine is for storing the Event Queue obj. """
if not self.fw_init:
return
self.que_obj = que_obj
self.populate_event_que(que_obj) | This routine is for storing the Event Queue obj. | entailment |
def network_sub_create_notif(self, tenant_id, tenant_name, cidr):
"""Network create notification. """
if not self.fw_init:
return
self.network_create_notif(tenant_id, tenant_name, cidr) | Network create notification. | entailment |
def network_del_notif(self, tenant_id, tenant_name, net_id):
"""Network delete notification. """
if not self.fw_init:
return
self.network_delete_notif(tenant_id, tenant_name, net_id) | Network delete notification. | entailment |
def project_create_notif(self, tenant_id, tenant_name):
"""Tenant Create notification. """
if not self.fw_init:
return
self.os_helper.create_router('_'.join([fw_constants.TENANT_EDGE_RTR,
tenant_name]),
... | Tenant Create notification. | entailment |
def project_delete_notif(self, tenant_id, tenant_name):
"""Tenant Delete notification. """
if not self.fw_init:
return
rtr_name = '_'.join([fw_constants.TENANT_EDGE_RTR, tenant_name])
self.os_helper.delete_router_by_name(rtr_name, tenant_id) | Tenant Delete notification. | entailment |
def _create_fw_fab_dev_te(self, tenant_id, drvr_name, fw_dict):
"""Prepares the Fabric and configures the device.
This routine calls the fabric class to prepare the fabric when
a firewall is created. It also calls the device manager to
configure the device. It updates the database with ... | Prepares the Fabric and configures the device.
This routine calls the fabric class to prepare the fabric when
a firewall is created. It also calls the device manager to
configure the device. It updates the database with the final
result. | entailment |
def _create_fw_fab_dev(self, tenant_id, drvr_name, fw_dict):
"""This routine calls the Tenant Edge routine if FW Type is TE. """
if fw_dict.get('fw_type') == fw_constants.FW_TENANT_EDGE:
self._create_fw_fab_dev_te(tenant_id, drvr_name, fw_dict) | This routine calls the Tenant Edge routine if FW Type is TE. | entailment |
def _check_create_fw(self, tenant_id, drvr_name):
"""Creates the Firewall, if all conditions are met.
This function first checks if all the configuration are done
for a FW to be launched. After that it creates the FW entry in the
DB. After that, it calls the routine to prepare the fabri... | Creates the Firewall, if all conditions are met.
This function first checks if all the configuration are done
for a FW to be launched. After that it creates the FW entry in the
DB. After that, it calls the routine to prepare the fabric and
configure the device. | entailment |
def _delete_fw_fab_dev(self, tenant_id, drvr_name, fw_dict):
"""Deletes the Firewall.
This routine calls the fabric class to delete the fabric when
a firewall is deleted. It also calls the device manager to
unconfigure the device. It updates the database with the final
result.
... | Deletes the Firewall.
This routine calls the fabric class to delete the fabric when
a firewall is deleted. It also calls the device manager to
unconfigure the device. It updates the database with the final
result. | entailment |
def _check_delete_fw(self, tenant_id, drvr_name):
"""Deletes the Firewall, if all conditioms are met.
This function after modifying the DB with delete operation status,
calls the routine to remove the fabric cfg from DB and unconfigure
the device.
"""
fw_dict = self.fwid... | Deletes the Firewall, if all conditioms are met.
This function after modifying the DB with delete operation status,
calls the routine to remove the fabric cfg from DB and unconfigure
the device. | entailment |
def _check_update_fw(self, tenant_id, drvr_name):
"""Update the Firewall config by calling the driver.
This function calls the device manager routine to update the device
with modified FW cfg.
"""
if self.fwid_attr[tenant_id].is_fw_complete():
fw_dict = self.fwid_att... | Update the Firewall config by calling the driver.
This function calls the device manager routine to update the device
with modified FW cfg. | entailment |
def _fw_create(self, drvr_name, data, cache):
"""Firewall create routine.
This function updates its local cache with FW parameters.
It checks if local cache has information about the Policy
associated with the FW. If not, it means a restart has happened.
It retrieves the policy ... | Firewall create routine.
This function updates its local cache with FW parameters.
It checks if local cache has information about the Policy
associated with the FW. If not, it means a restart has happened.
It retrieves the policy associated with the FW by calling
Openstack API's... | entailment |
def fw_create(self, data, fw_name=None, cache=False):
"""Top level FW create function. """
LOG.debug("FW create %s", data)
try:
self._fw_create(fw_name, data, cache)
except Exception as exc:
LOG.error("Exception in fw_create %s", str(exc)) | Top level FW create function. | entailment |
def _fw_update(self, drvr_name, data):
"""Update routine for the Firewall.
Check if FW is already cfgd using the below function
if self.fwid_attr[tenant_id].is_fw_complete() or
is_fw_drvr_create_needed():
The above two functions will take care of whether FW is already
cf... | Update routine for the Firewall.
Check if FW is already cfgd using the below function
if self.fwid_attr[tenant_id].is_fw_complete() or
is_fw_drvr_create_needed():
The above two functions will take care of whether FW is already
cfgd or about to be cfgd in case of error.
I... | entailment |
def fw_update(self, data, fw_name=None):
"""Top level FW update function. """
LOG.debug("FW Update %s", data)
self._fw_update(fw_name, data) | Top level FW update function. | entailment |
def _fw_delete(self, drvr_name, data):
"""Firewall Delete routine.
This function calls routines to remove FW from fabric and device.
It also updates its local cache.
"""
fw_id = data.get('firewall_id')
tenant_id = self.tenant_db.get_fw_tenant(fw_id)
if tenant_id... | Firewall Delete routine.
This function calls routines to remove FW from fabric and device.
It also updates its local cache. | entailment |
def _fw_rule_decode_store(self, data):
"""Misc function to decode the firewall rule from Openstack. """
fw_rule = data.get('firewall_rule')
rule = {'protocol': fw_rule.get('protocol'),
'source_ip_address': fw_rule.get('source_ip_address'),
'destination_ip_address'... | Misc function to decode the firewall rule from Openstack. | entailment |
def _fw_rule_create(self, drvr_name, data, cache):
"""Firewall Rule create routine.
This function updates its local cache with rule parameters.
It checks if local cache has information about the Policy
associated with the rule. If not, it means a restart has happened.
It retriev... | Firewall Rule create routine.
This function updates its local cache with rule parameters.
It checks if local cache has information about the Policy
associated with the rule. If not, it means a restart has happened.
It retrieves the policy associated with the FW by calling
Openst... | entailment |
def fw_rule_create(self, data, fw_name=None, cache=False):
"""Top level rule creation routine. """
LOG.debug("FW Rule create %s", data)
self._fw_rule_create(fw_name, data, cache) | Top level rule creation routine. | entailment |
def _fw_rule_delete(self, drvr_name, data):
"""Function that updates its local cache after a rule is deleted. """
rule_id = data.get('firewall_rule_id')
tenant_id = self.tenant_db.get_rule_tenant(rule_id)
if tenant_id not in self.fwid_attr:
LOG.error("Invalid tenant id for F... | Function that updates its local cache after a rule is deleted. | entailment |
def fw_rule_delete(self, data, fw_name=None):
"""Top level rule delete function. """
LOG.debug("FW Rule delete %s", data)
self._fw_rule_delete(fw_name, data) | Top level rule delete function. | entailment |
def _fw_rule_update(self, drvr_name, data):
"""Firewall Rule update routine.
Function to decode the updated rules and call routines that
in turn calls the device routines to update rules.
"""
LOG.debug("FW Update %s", data)
tenant_id = data.get('firewall_rule').get('tena... | Firewall Rule update routine.
Function to decode the updated rules and call routines that
in turn calls the device routines to update rules. | entailment |
def fw_rule_update(self, data, fw_name=None):
"""Top level rule update routine. """
LOG.debug("FW Update Debug")
self._fw_rule_update(fw_name, data) | Top level rule update routine. | entailment |
def _fw_policy_delete(self, drvr_name, data):
"""Routine to delete the policy from local cache. """
policy_id = data.get('firewall_policy_id')
tenant_id = self.tenant_db.get_policy_tenant(policy_id)
if tenant_id not in self.fwid_attr:
LOG.error("Invalid tenant id for FW dele... | Routine to delete the policy from local cache. | entailment |
def fw_policy_delete(self, data, fw_name=None):
"""Top level policy delete routine. """
LOG.debug("FW Policy Debug")
self._fw_policy_delete(fw_name, data) | Top level policy delete routine. | entailment |
def _fw_policy_create(self, drvr_name, data, cache):
"""Firewall Policy create routine.
This function updates its local cache with policy parameters.
It checks if local cache has information about the rules
associated with the policy. If not, it means a restart has
happened. It ... | Firewall Policy create routine.
This function updates its local cache with policy parameters.
It checks if local cache has information about the rules
associated with the policy. If not, it means a restart has
happened. It retrieves the rules associated with the policy by
callin... | entailment |
def fw_policy_create(self, data, fw_name=None, cache=False):
"""Top level policy create routine. """
LOG.debug("FW Policy Debug")
self._fw_policy_create(fw_name, data, cache) | Top level policy create routine. | entailment |
def convert_fwdb_event_msg(self, rule, tenant_id, rule_id, policy_id):
"""Convert the Firewall DB to a event message format.
From inputs from DB, this will create a FW rule dictionary that
resembles the actual data from Openstack when a rule is created.
This is usually called after rest... | Convert the Firewall DB to a event message format.
From inputs from DB, this will create a FW rule dictionary that
resembles the actual data from Openstack when a rule is created.
This is usually called after restart, in order to populate local
cache. | entailment |
def convert_fwdb(self, tenant_id, name, policy_id, fw_id):
"""Convert the Firewall DB to a query response.
From FWDB inputs, this will create a FW message that resembles the
actual data from Openstack, when a query for FW is done.
"""
fw_dict = {'tenant_id': tenant_id, 'name': n... | Convert the Firewall DB to a query response.
From FWDB inputs, this will create a FW message that resembles the
actual data from Openstack, when a query for FW is done. | entailment |
def populate_local_cache(self):
"""This populates the local cache after reading the Database.
It calls the appropriate rule create, fw create routines.
It doesn't actually call the routine to prepare the fabric or cfg the
device since it will be handled by retry module.
"""
... | This populates the local cache after reading the Database.
It calls the appropriate rule create, fw create routines.
It doesn't actually call the routine to prepare the fabric or cfg the
device since it will be handled by retry module. | entailment |
def retry_failure_fab_dev_create(self, tenant_id, fw_data, fw_dict):
"""This module calls routine in fabric to retry the failure cases.
If device is not successfully cfg/uncfg, it calls the device manager
routine to cfg/uncfg the device.
"""
result = fw_data.get('result').split(... | This module calls routine in fabric to retry the failure cases.
If device is not successfully cfg/uncfg, it calls the device manager
routine to cfg/uncfg the device. | entailment |
def retry_failure_fab_dev_delete(self, tenant_id, fw_data, fw_dict):
"""Retry the failure cases for delete.
This module calls routine in fabric to retry the failure cases for
delete.
If device is not successfully cfg/uncfg, it calls the device manager
routine to cfg/uncfg the de... | Retry the failure cases for delete.
This module calls routine in fabric to retry the failure cases for
delete.
If device is not successfully cfg/uncfg, it calls the device manager
routine to cfg/uncfg the device. | entailment |
def fw_retry_failures_create(self):
"""This module is called for retrying the create cases. """
for tenant_id in self.fwid_attr:
try:
with self.fwid_attr[tenant_id].mutex_lock:
if self.fwid_attr[tenant_id].is_fw_drvr_create_needed():
... | This module is called for retrying the create cases. | entailment |
def fill_fw_dict_from_db(self, fw_data):
"""
This routine is called to create a local fw_dict with data from DB.
"""
rule_dict = fw_data.get('rules').get('rules')
fw_dict = {'fw_id': fw_data.get('fw_id'),
'fw_name': fw_data.get('name'),
'fire... | This routine is called to create a local fw_dict with data from DB. | entailment |
def fw_retry_failures_delete(self):
"""This routine is called for retrying the delete cases. """
for tenant_id in self.fwid_attr:
try:
with self.fwid_attr[tenant_id].mutex_lock:
# For both create and delete case
fw_data = self.get_fw_by... | This routine is called for retrying the delete cases. | entailment |
def fw_retry_failures(self):
"""Top level retry routine called. """
if not self.fw_init:
return
try:
self.fw_retry_failures_create()
self.fw_retry_failures_delete()
except Exception as exc:
LOG.error("Exception in retry failures %s", str(ex... | Top level retry routine called. | entailment |
def _find_starts(self, linespec):
"""
Finds the start points.
Start points matching the linespec regex are returned as list in the
following format:
[(item, index), (item, index).....
"""
linespec += ".*"
start_points = []
for item in self._inden... | Finds the start points.
Start points matching the linespec regex are returned as list in the
following format:
[(item, index), (item, index)..... | entailment |
def find_lines(self, linespec):
"""Find lines that match the linespec regex."""
res = []
linespec += ".*"
for line in self.cfg:
match = re.search(linespec, line)
if match:
res.append(match.group(0))
return res | Find lines that match the linespec regex. | entailment |
def find_objects(self, linespec):
"""Find lines that match the linespec regex.
:param linespec: regular expression of line to match
:return: list of LineItem objects
"""
# Note(asr1kteam): In this code we are only adding children one-level
# deep to a given parent (lines... | Find lines that match the linespec regex.
:param linespec: regular expression of line to match
:return: list of LineItem objects | entailment |
def find_children(self, linespec):
"""Find lines and immediate children that match the linespec regex.
:param linespec: regular expression of line to match
:returns: list of lines. These correspond to the lines that were
matched and their immediate children
"""
res =... | Find lines and immediate children that match the linespec regex.
:param linespec: regular expression of line to match
:returns: list of lines. These correspond to the lines that were
matched and their immediate children | entailment |
def enable_lldp(self, port_name, is_ncb=True, is_nb=False):
"""Function to enable LLDP on the interface. """
if is_ncb:
self.run_lldptool(["-L", "-i", port_name, "-g", "ncb",
"adminStatus=rxtx"])
if is_nb:
self.run_lldptool(["-L", "-i", port_name, "-g", "nb",
... | Function to enable LLDP on the interface. | entailment |
def enable_lldp(self):
"""Function to enable LLDP on the interface. """
if self.is_ncb:
self.run_lldptool(["-L", "-i", self.port_name, "-g", "ncb",
"adminStatus=rxtx"])
if self.is_nb:
self.run_lldptool(["-L", "-i", self.port_name, "-g", "nb"... | Function to enable LLDP on the interface. | entailment |
def enable_evb(self):
"""Function to enable EVB on the interface. """
if self.is_ncb:
self.run_lldptool(["-T", "-i", self.port_name, "-g", "ncb",
"-V", "evb", "enableTx=yes"])
ret = self.enable_gpid()
return ret
else:
... | Function to enable EVB on the interface. | entailment |
def enable_gpid(self):
"""Function to enable Group ID on the interface.
This is needed to use the MAC, GID, VID Filter.
"""
if self.is_ncb:
self.run_lldptool(["-T", "-i", self.port_name, "-g", "ncb",
"-V", "evb", "-c", "evbgpid=yes"])
... | Function to enable Group ID on the interface.
This is needed to use the MAC, GID, VID Filter. | entailment |
def _vdp_refrsh_hndlr(self):
"""Periodic refresh of vNIC events to VDP.
VDP daemon itself has keepalives. This is needed on top of it
to keep Orchestrator like OpenStack, VDP daemon and the physical
switch in sync.
"""
LOG.debug("Refresh handler")
try:
... | Periodic refresh of vNIC events to VDP.
VDP daemon itself has keepalives. This is needed on top of it
to keep Orchestrator like OpenStack, VDP daemon and the physical
switch in sync. | entailment |
def run_lldptool(self, args):
"""Function for invoking the lldptool utility. """
full_args = ['lldptool'] + args
try:
utils.execute(full_args, root_helper=self.root_helper)
except Exception as e:
LOG.error("Unable to execute %(cmd)s. "
"Excep... | Function for invoking the lldptool utility. | entailment |
def store_oui(self, port_uuid, oui_type, oui_data):
"""Function for storing the OUI.
param uuid: UUID of the vNIC
param oui_type: OUI ID
param oui_data: OUI Opaque Data
"""
self.oui_vif_map[port_uuid] = {'oui_id': oui_type,
'oui_dat... | Function for storing the OUI.
param uuid: UUID of the vNIC
param oui_type: OUI ID
param oui_data: OUI Opaque Data | entailment |
def store_vdp_vsi(self, port_uuid, mgrid, typeid, typeid_ver,
vsiid_frmt, vsiid, filter_frmt, gid, mac, vlan,
new_network, reply, oui_id, oui_data, vsw_cb_fn,
vsw_cb_data, reason):
"""Stores the vNIC specific info for VDP Refresh.
:param... | Stores the vNIC specific info for VDP Refresh.
:param uuid: vNIC UUID
:param mgrid: MGR ID
:param typeid: Type ID
:param typeid_ver: Version of the Type ID
:param vsiid_frmt: Format of the following VSI argument
:param vsiid: VSI value
:param filter_frmt: Filter ... | entailment |
def clear_oui(self, port_uuid):
"""Clears the OUI specific info.
:param uuid: vNIC UUID
Currently only one OUI per VSI fixme(padkrish)
"""
if port_uuid in self.oui_vif_map:
del self.oui_vif_map[port_uuid]
else:
LOG.debug("OUI does not exist") | Clears the OUI specific info.
:param uuid: vNIC UUID
Currently only one OUI per VSI fixme(padkrish) | entailment |
def clear_vdp_vsi(self, port_uuid):
"""Stores the vNIC specific info for VDP Refresh.
:param uuid: vNIC UUID
"""
try:
LOG.debug("Clearing VDP VSI MAC %(mac)s UUID %(uuid)s",
{'mac': self.vdp_vif_map[port_uuid].get('mac'),
'uuid': ... | Stores the vNIC specific info for VDP Refresh.
:param uuid: vNIC UUID | entailment |
def gen_cisco_vdp_oui(self, oui_id, oui_data):
"""Cisco specific handler for constructing OUI arguments. """
oui_list = []
vm_name = oui_data.get('vm_name')
if vm_name is not None:
oui_str = "oui=%s," % oui_id
oui_name_str = oui_str + "vm_name=" + vm_name
... | Cisco specific handler for constructing OUI arguments. | entailment |
def gen_oui_str(self, oui_list):
"""Generate the OUI string for vdptool. """
oui_str = []
for oui in oui_list:
oui_str.append('-c')
oui_str.append(oui)
return oui_str | Generate the OUI string for vdptool. | entailment |
def construct_vdp_dict(self, mode, mgrid, typeid, typeid_ver, vsiid_frmt,
vsiid, filter_frmt, gid, mac, vlan, oui_id,
oui_data):
"""Constructs the VDP Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more det... | Constructs the VDP Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param mode: Associate or De-associate
:param mgrid: MGR ID
:param typeid: Type ID
:param typeid_ver: Version of the Type ID
:param vsii... | entailment |
def send_vdp_query_msg(self, mode, mgrid, typeid, typeid_ver, vsiid_frmt,
vsiid, filter_frmt, gid, mac, vlan, oui_id,
oui_data):
"""Constructs and Sends the VDP Query Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Sect... | Constructs and Sends the VDP Query Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param mode: Associate or De-associate
:param mgrid: MGR ID
:param typeid: Type ID
:param typeid_ver: Version of the Type ID
... | entailment |
def send_vdp_msg(self, mode, mgrid, typeid, typeid_ver, vsiid_frmt,
vsiid, filter_frmt, gid, mac, vlan, oui_id, oui_data,
sw_resp):
"""Constructs and Sends the VDP Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more de... | Constructs and Sends the VDP Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param mode: Associate or De-associate
:param mgrid: MGR ID
:param typeid: Type ID
:param typeid_ver: Version of the Type ID
:... | entailment |
def crosscheck_query_vsiid_mac(self, reply, vsiid, mac):
"""Cross Check the reply against the input vsiid,mac for get query. """
vsiid_reply = reply.partition("uuid")[2].split()[0][4:]
if vsiid != vsiid_reply:
fail_reason = vdp_const.vsi_mismatch_failure_reason % (
vs... | Cross Check the reply against the input vsiid,mac for get query. | entailment |
def get_vdp_failure_reason(self, reply):
"""Parse the failure reason from VDP. """
try:
fail_reason = reply.partition(
"filter")[0].replace('\t', '').split('\n')[-2]
if len(fail_reason) == 0:
fail_reason = vdp_const.retrieve_failure_reason % (reply... | Parse the failure reason from VDP. | entailment |
def check_filter_validity(self, reply, filter_str):
"""Check for the validify of the filter. """
try:
f_ind = reply.index(filter_str)
l_ind = reply.rindex(filter_str)
except Exception:
fail_reason = vdp_const.filter_failure_reason % (reply)
LOG.err... | Check for the validify of the filter. | entailment |
def get_vlan_from_associate_reply(self, reply, vsiid, mac):
"""Parse the associate reply from VDP daemon to get the VLAN value. """
try:
verify_flag, fail_reason = self.crosscheck_reply_vsiid_mac(
reply, vsiid, mac)
if not verify_flag:
return const... | Parse the associate reply from VDP daemon to get the VLAN value. | entailment |
def check_hints(self, reply):
"""Parse the hints to check for errors. """
try:
f_ind = reply.index("hints")
l_ind = reply.rindex("hints")
except Exception:
fail_reason = vdp_const.hints_failure_reason % (reply)
LOG.error("%s", fail_reason)
... | Parse the hints to check for errors. | entailment |
def get_vlan_from_query_reply(self, reply, vsiid, mac):
"""Parse the query reply from VDP daemon to get the VLAN value. """
hints_ret, fail_reason = self.check_hints(reply)
if not hints_ret:
LOG.error("Incorrect hints found %s", reply)
return constants.INVALID_VLAN, fail_... | Parse the query reply from VDP daemon to get the VLAN value. | entailment |
def send_vdp_assoc(self, vsiid=None, mgrid=None, typeid=None,
typeid_ver=None, vsiid_frmt=vdp_const.VDP_VSIFRMT_UUID,
filter_frmt=vdp_const.VDP_FILTER_GIDMACVID, gid=0,
mac="", vlan=0, oui_id="", oui_data="", sw_resp=False):
"""Sends the VDP A... | Sends the VDP Associate Message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param vsiid: VSI value, Only UUID supported for now
:param mgrid: MGR ID
:param typeid: Type ID
:param typeid_ver: Version of the Type ID
... | entailment |
def send_vdp_vnic_up(self, port_uuid=None, vsiid=None,
mgrid=None, typeid=None, typeid_ver=None,
vsiid_frmt=vdp_const.VDP_VSIFRMT_UUID,
filter_frmt=vdp_const.VDP_FILTER_GIDMACVID,
gid=0, mac="", vlan=0, oui=None,
... | Interface function to apps, called for a vNIC UP.
This currently sends an VDP associate message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param uuid: uuid of the vNIC
:param vsiid: VSI value, Only UUID supported for now
... | entailment |
def send_vdp_vnic_down(self, port_uuid=None, vsiid=None, mgrid=None,
typeid=None, typeid_ver=None,
vsiid_frmt=vdp_const.VDP_VSIFRMT_UUID,
filter_frmt=vdp_const.VDP_FILTER_GIDMACVID,
gid=0, mac="", vlan=0, oui="")... | Interface function to apps, called for a vNIC DOWN.
This currently sends an VDP dis-associate message.
Please refer http://www.ieee802.org/1/pages/802.1bg.html VDP
Section for more detailed information
:param uuid: uuid of the vNIC
:param vsiid: VSI value, Only UUID supported fo... | entailment |
def run_vdptool(self, args, oui_args=None):
"""Function that runs the vdptool utility. """
if oui_args is None:
oui_args = []
full_args = ['vdptool'] + args + oui_args
try:
return utils.execute(full_args, root_helper=self.root_helper)
except Exception as e... | Function that runs the vdptool utility. | entailment |
def get_routers(self, context, router_ids=None, hd_ids=None):
"""Make a remote process call to retrieve the sync data for routers.
:param context: session context
:param router_ids: list of routers to fetch
:param hd_ids: hosting device ids, only routers assigned to these
... | Make a remote process call to retrieve the sync data for routers.
:param context: session context
:param router_ids: list of routers to fetch
:param hd_ids: hosting device ids, only routers assigned to these
hosting devices will be returned. | entailment |
def update_floatingip_statuses(self, context, router_id, fip_statuses):
"""Make a remote process call to update operational status for one or
several floating IPs.
@param context: contains user information
@param router_id: id of router associated with the floatingips
@param fip... | Make a remote process call to update operational status for one or
several floating IPs.
@param context: contains user information
@param router_id: id of router associated with the floatingips
@param fip_statuses: dict with floatingip_id as key and status as value | entailment |
def send_update_port_statuses(self, context, port_ids, status):
"""Call the pluging to update the port status which updates the DB.
:param context: contains user information
:param port_ids: list of ids of the ports associated with the status
:param status: value of the status for the g... | Call the pluging to update the port status which updates the DB.
:param context: contains user information
:param port_ids: list of ids of the ports associated with the status
:param status: value of the status for the given port list (port_ids) | entailment |
def router_deleted(self, context, routers):
"""Deal with router deletion RPC message."""
LOG.debug('Got router deleted notification for %s', routers)
self._update_removed_routers_cache(routers) | Deal with router deletion RPC message. | entailment |
def routers_updated(self, context, routers):
"""Deal with routers modification and creation RPC message."""
LOG.debug('Got routers updated notification :%s', routers)
if routers:
# This is needed for backward compatibility
if isinstance(routers[0], dict):
... | Deal with routers modification and creation RPC message. | entailment |
def collect_state(self, configurations):
"""Collect state from this helper.
A set of attributes which summarizes the state of the routers and
configurations managed by this config agent.
:param configurations: dict of configuration values
:return dict of updated configuration va... | Collect state from this helper.
A set of attributes which summarizes the state of the routers and
configurations managed by this config agent.
:param configurations: dict of configuration values
:return dict of updated configuration values | entailment |
def _fetch_router_info(self, router_ids=None, device_ids=None,
all_routers=False):
"""Fetch router dict from the routing plugin.
:param router_ids: List of router_ids of routers to fetch
:param device_ids: List of device_ids whose routers to fetch
:param all_r... | Fetch router dict from the routing plugin.
:param router_ids: List of router_ids of routers to fetch
:param device_ids: List of device_ids whose routers to fetch
:param all_routers: If True fetch all the routers for this agent.
:return: List of router dicts of format:
... | entailment |
def _fetch_router_chunk_data(self, router_ids=None):
"""Fetch router data from the routing plugin in chunks.
:param router_ids: List of router_ids of routers to fetch
:return: List of router dicts of format:
[ {router_dict1}, {router_dict2},.....]
... | Fetch router data from the routing plugin in chunks.
:param router_ids: List of router_ids of routers to fetch
:return: List of router dicts of format:
[ {router_dict1}, {router_dict2},.....] | entailment |
def _handle_sync_devices(self, routers):
"""
Handles routers during a device_sync.
This method performs post-processing on routers fetched from the
routing plugin during a device sync. Routers are first fetched
from the plugin based on the list of device_ids. Since fetched
... | Handles routers during a device_sync.
This method performs post-processing on routers fetched from the
routing plugin during a device sync. Routers are first fetched
from the plugin based on the list of device_ids. Since fetched
routers take precedence over pending work, matching rout... | entailment |
def _get_router_ids_from_removed_devices_info(removed_devices_info):
"""Extract router_ids from the removed devices info dict.
:param removed_devices_info: Dict of removed devices and their
associated resources.
Format:
{
'hosting_data': {'hd_id1... | Extract router_ids from the removed devices info dict.
:param removed_devices_info: Dict of removed devices and their
associated resources.
Format:
{
'hosting_data': {'hd_id1': {'routers': [id1, id2, ...]},
'hd_id2': {'... | entailment |
def _sort_resources_per_hosting_device(resources):
"""This function will sort the resources on hosting device.
The sorting on hosting device is done by looking up the
`hosting_device` attribute of the resource, and its `id`.
:param resources: a dict with key of resource name
:r... | This function will sort the resources on hosting device.
The sorting on hosting device is done by looking up the
`hosting_device` attribute of the resource, and its `id`.
:param resources: a dict with key of resource name
:return dict sorted on the hosting device of input resource. For... | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.