repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
openstack/networking-cisco | networking_cisco/apps/saf/common/dfa_sys_lib.py | is_intf_up | 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",
... | python | 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",
... | [
"def",
"is_intf_up",
"(",
"intf",
")",
":",
"intf_path",
"=",
"'/'",
".",
"join",
"(",
"(",
"'/sys/class/net'",
",",
"intf",
")",
")",
"intf_exist",
"=",
"os",
".",
"path",
".",
"exists",
"(",
"intf_path",
")",
"if",
"not",
"intf_exist",
":",
"LOG",
... | Function to check if a interface is up. | [
"Function",
"to",
"check",
"if",
"a",
"interface",
"is",
"up",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/common/dfa_sys_lib.py#L393-L410 |
openstack/networking-cisco | networking_cisco/apps/saf/common/dfa_sys_lib.py | get_all_run_phy_intf | 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... | python | 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... | [
"def",
"get_all_run_phy_intf",
"(",
")",
":",
"intf_list",
"=",
"[",
"]",
"base_dir",
"=",
"'/sys/class/net'",
"dir_exist",
"=",
"os",
".",
"path",
".",
"exists",
"(",
"base_dir",
")",
"if",
"not",
"dir_exist",
":",
"LOG",
".",
"error",
"(",
"\"Unable to g... | Retrieve all physical interfaces that are operationally up. | [
"Retrieve",
"all",
"physical",
"interfaces",
"that",
"are",
"operationally",
"up",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/common/dfa_sys_lib.py#L413-L433 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.check_vnic_type_and_vendor_info | 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 ... | python | 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 ... | [
"def",
"check_vnic_type_and_vendor_info",
"(",
"self",
",",
"vnic_type",
",",
"profile",
")",
":",
"# Check for vnic_type",
"if",
"vnic_type",
"not",
"in",
"self",
".",
"supported_sriov_vnic_types",
":",
"LOG",
".",
"info",
"(",
"'Non SR-IOV vnic_type: %s.'",
",",
"... | 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. | [
"Checks",
"if",
"this",
"vnic_type",
"and",
"vendor",
"device",
"info",
"are",
"supported",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L60-L79 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._check_for_supported_vendor | 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... | python | 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... | [
"def",
"_check_for_supported_vendor",
"(",
"self",
",",
"profile",
")",
":",
"vendor_info",
"=",
"profile",
".",
"get",
"(",
"'pci_vendor_info'",
")",
"if",
"not",
"vendor_info",
":",
"return",
"False",
"if",
"vendor_info",
"not",
"in",
"self",
".",
"supported... | Checks if the port belongs to a supported vendor.
Returns True for supported_pci_devs. | [
"Checks",
"if",
"the",
"port",
"belongs",
"to",
"a",
"supported",
"vendor",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L81-L91 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._import_ucsmsdk | 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.
... | python | 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.
... | [
"def",
"_import_ucsmsdk",
"(",
"self",
")",
":",
"# Check if SSL certificate checking has been disabled.",
"# If so, warn the user before proceeding.",
"if",
"not",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsm_https_verify",
":",
"LOG",
".",
"warning",
"(",
"const",
".",
"SS... | 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",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L103-L124 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._get_server_name | 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_... | python | 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_... | [
"def",
"_get_server_name",
"(",
"self",
",",
"handle",
",",
"service_profile_mo",
",",
"ucsm_ip",
")",
":",
"try",
":",
"resolved_dest",
"=",
"handle",
".",
"ConfigResolveDn",
"(",
"service_profile_mo",
".",
"PnDn",
")",
"server_list",
"=",
"resolved_dest",
".",... | 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. | [
"Get",
"the",
"contents",
"of",
"the",
"Name",
"field",
"associated",
"with",
"UCS",
"Server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L179-L194 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._create_ucsm_host_to_service_profile_mapping | 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:
... | python | 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:
... | [
"def",
"_create_ucsm_host_to_service_profile_mapping",
"(",
"self",
")",
":",
"ucsm_ips",
"=",
"list",
"(",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsms",
")",
"for",
"ucsm_ip",
"in",
"ucsm_ips",
":",
"with",
"self",
".",
"ucsm_connect_disconnect",
"(",
"ucsm_ip",
... | Reads list of Service profiles and finds associated Server. | [
"Reads",
"list",
"of",
"Service",
"profiles",
"and",
"finds",
"associated",
"Server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L196-L219 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._create_vlanprofile | 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:
... | python | 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:
... | [
"def",
"_create_vlanprofile",
"(",
"self",
",",
"handle",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"vlan_name",
"=",
"self",
".",
"make_vlan_name",
"(",
"vlan_id",
")",
"vlan_profile_dest",
"=",
"(",
"const",
".",
"VLAN_PATH",
"+",
"const",
".",
"VLAN_PROFI... | Creates VLAN profile to be assosiated with the Port Profile. | [
"Creates",
"VLAN",
"profile",
"to",
"be",
"assosiated",
"with",
"the",
"Port",
"Profile",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L265-L304 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._create_port_profile | 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... | python | 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... | [
"def",
"_create_port_profile",
"(",
"self",
",",
"handle",
",",
"profile_name",
",",
"vlan_id",
",",
"vnic_type",
",",
"ucsm_ip",
",",
"trunk_vlans",
",",
"qos_policy",
")",
":",
"port_profile_dest",
"=",
"(",
"const",
".",
"PORT_PROFILESETDN",
"+",
"const",
"... | 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.... | [
"Creates",
"a",
"Port",
"Profile",
"on",
"the",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L306-L432 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.create_portprofile | 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
... | python | 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
... | [
"def",
"create_portprofile",
"(",
"self",
",",
"profile_name",
",",
"vlan_id",
",",
"vnic_type",
",",
"host_id",
",",
"trunk_vlans",
")",
":",
"ucsm_ip",
"=",
"self",
".",
"get_ucsm_ip_for_host",
"(",
"host_id",
")",
"if",
"not",
"ucsm_ip",
":",
"LOG",
".",
... | 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. | [
"Top",
"level",
"method",
"to",
"create",
"Port",
"Profiles",
"on",
"the",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L434-L476 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._update_service_profile | 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... | python | 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... | [
"def",
"_update_service_profile",
"(",
"self",
",",
"handle",
",",
"service_profile",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"virtio_port_list",
"=",
"(",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsms",
"[",
"ucsm_ip",
"]",
".",
"ucsm_virtio_eth_ports",
")",
"... | 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. | [
"Updates",
"Service",
"Profile",
"on",
"the",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L478-L536 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.update_serviceprofile | 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... | python | 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... | [
"def",
"update_serviceprofile",
"(",
"self",
",",
"host_id",
",",
"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 I... | 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. | [
"Top",
"level",
"method",
"to",
"update",
"Service",
"Profiles",
"on",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L604-L644 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.update_vnic_template | 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 '
... | python | 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 '
... | [
"def",
"update_vnic_template",
"(",
"self",
",",
"host_id",
",",
"vlan_id",
",",
"physnet",
",",
"vnic_template_path",
",",
"vnic_template",
")",
":",
"ucsm_ip",
"=",
"self",
".",
"get_ucsm_ip_for_host",
"(",
"host_id",
")",
"if",
"not",
"ucsm_ip",
":",
"LOG",... | Updates VNIC Template with the vlan_id. | [
"Updates",
"VNIC",
"Template",
"with",
"the",
"vlan_id",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L646-L704 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._delete_vlan_profile | 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... | python | 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... | [
"def",
"_delete_vlan_profile",
"(",
"self",
",",
"handle",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"vlan_name",
"=",
"self",
".",
"make_vlan_name",
"(",
"vlan_id",
")",
"vlan_profile_dest",
"=",
"(",
"const",
".",
"VLAN_PATH",
"+",
"const",
".",
"VLAN_PROF... | Deletes VLAN Profile from UCS Manager. | [
"Deletes",
"VLAN",
"Profile",
"from",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L706-L727 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._delete_port_profile_from_ucsm | 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... | python | 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... | [
"def",
"_delete_port_profile_from_ucsm",
"(",
"self",
",",
"handle",
",",
"port_profile",
",",
"ucsm_ip",
")",
":",
"port_profile_dest",
"=",
"(",
"const",
".",
"PORT_PROFILESETDN",
"+",
"const",
".",
"VNIC_PATH_PREFIX",
"+",
"port_profile",
")",
"handle",
".",
... | Deletes Port Profile from UCS Manager. | [
"Deletes",
"Port",
"Profile",
"from",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L756-L776 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._delete_port_profile | 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.
... | python | 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.
... | [
"def",
"_delete_port_profile",
"(",
"self",
",",
"handle",
",",
"port_profile",
",",
"ucsm_ip",
")",
":",
"try",
":",
"self",
".",
"_delete_port_profile_from_ucsm",
"(",
"handle",
",",
"port_profile",
",",
"ucsm_ip",
")",
"except",
"Exception",
"as",
"e",
":",... | 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",
... | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L778-L792 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._remove_vlan_from_all_service_profiles | 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... | python | 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... | [
"def",
"_remove_vlan_from_all_service_profiles",
"(",
"self",
",",
"handle",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"service_profile_list",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"ucsm_sp_dict",
")",
":... | Deletes VLAN Profile config from server's ethernet ports. | [
"Deletes",
"VLAN",
"Profile",
"config",
"from",
"server",
"s",
"ethernet",
"ports",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L794-L846 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._remove_vlan_from_all_sp_templates | 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_... | python | 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_... | [
"def",
"_remove_vlan_from_all_sp_templates",
"(",
"self",
",",
"handle",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"sp_template_info_list",
"=",
"(",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsms",
"[",
"ucsm_ip",
"]",
".",
"sp_template_list",
".",
"values",
"(",
... | Deletes VLAN config from all SP Templates that have it. | [
"Deletes",
"VLAN",
"config",
"from",
"all",
"SP",
"Templates",
"that",
"have",
"it",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L848-L908 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver._remove_vlan_from_vnic_templates | 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... | python | 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... | [
"def",
"_remove_vlan_from_vnic_templates",
"(",
"self",
",",
"handle",
",",
"vlan_id",
",",
"ucsm_ip",
")",
":",
"ucsm",
"=",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsms",
"[",
"ucsm_ip",
"]",
"vnic_template_info",
"=",
"ucsm",
".",
"vnic_template_list",
".",
"... | Removes VLAN from all VNIC templates that have it enabled. | [
"Removes",
"VLAN",
"from",
"all",
"VNIC",
"templates",
"that",
"have",
"it",
"enabled",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L910-L962 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.delete_all_config_for_vlan | 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... | python | 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... | [
"def",
"delete_all_config_for_vlan",
"(",
"self",
",",
"vlan_id",
",",
"port_profile",
",",
"trunk_vlans",
")",
":",
"ucsm_ips",
"=",
"list",
"(",
"CONF",
".",
"ml2_cisco_ucsm",
".",
"ucsms",
")",
"for",
"ucsm_ip",
"in",
"ucsm_ips",
":",
"with",
"self",
".",... | Top level method to delete all config for vlan_id. | [
"Top",
"level",
"method",
"to",
"delete",
"all",
"config",
"for",
"vlan_id",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L964-L993 |
openstack/networking-cisco | networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py | CiscoUcsmDriver.ucs_manager_disconnect | 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... | python | 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... | [
"def",
"ucs_manager_disconnect",
"(",
"self",
",",
"handle",
",",
"ucsm_ip",
")",
":",
"try",
":",
"handle",
".",
"Logout",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"# Raise a Neutron exception. Include a description of",
"# the original exception.",
"raise",... | Disconnects from the UCS Manager.
After the disconnect, the handle associated with this connection
is no longer valid. | [
"Disconnects",
"from",
"the",
"UCS",
"Manager",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L1009-L1020 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_fail_recovery.py | DfaFailureRecovery.add_events | 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... | python | 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... | [
"def",
"add_events",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"event_q",
"=",
"kwargs",
".",
"get",
"(",
"'event_queue'",
")",
"pri",
"=",
"kwargs",
".",
"get",
"(",
"'priority'",
")",
"if",
"not",
"event_q",
"or",
"not",
"pri",
":",
"return",... | Add failure event into the queue. | [
"Add",
"failure",
"event",
"into",
"the",
"queue",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_fail_recovery.py#L39-L57 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_fail_recovery.py | DfaFailureRecovery.failure_recovery | 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 ... | python | 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 ... | [
"def",
"failure_recovery",
"(",
"self",
",",
"fail_info",
")",
":",
"# Read failed entries from project database and send request",
"# (create/delete - depends on failure type) to DCNM",
"# 1. Try failure recovery for create project.",
"LOG",
".",
"info",
"(",
"\"Started failure_recove... | 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. | [
"Failure",
"recovery",
"task",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_fail_recovery.py#L59-L254 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.init_params | 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 ... | python | 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 ... | [
"def",
"init_params",
"(",
"self",
",",
"protocol_interface",
",",
"phy_interface",
")",
":",
"self",
".",
"lldp_cfgd",
"=",
"False",
"self",
".",
"local_intf",
"=",
"protocol_interface",
"self",
".",
"phy_interface",
"=",
"phy_interface",
"self",
".",
"remote_e... | Initializing parameters. | [
"Initializing",
"parameters",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L41-L65 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.cmp_update_bond_intf | 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... | python | 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... | [
"def",
"cmp_update_bond_intf",
"(",
"self",
",",
"bond_interface",
")",
":",
"if",
"bond_interface",
"!=",
"self",
".",
"bond_interface",
":",
"self",
".",
"bond_interface",
"=",
"bond_interface",
"self",
".",
"bond_member_ports",
"=",
"sys_utils",
".",
"get_membe... | 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. | [
"Update",
"the",
"bond",
"interface",
"and",
"its",
"members",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L71-L81 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_evb_mode_uneq_store | 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 | python | 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 | [
"def",
"remote_evb_mode_uneq_store",
"(",
"self",
",",
"remote_evb_mode",
")",
":",
"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. | [
"Saves",
"the",
"EVB",
"mode",
"if",
"it",
"is",
"not",
"the",
"same",
"as",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L114-L119 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_evb_cfgd_uneq_store | 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 | python | 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 | [
"def",
"remote_evb_cfgd_uneq_store",
"(",
"self",
",",
"remote_evb_cfgd",
")",
":",
"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. | [
"This",
"saves",
"the",
"EVB",
"cfg",
"if",
"it",
"is",
"not",
"the",
"same",
"as",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L121-L126 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_mgmt_addr_uneq_store | 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 | python | 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 | [
"def",
"remote_mgmt_addr_uneq_store",
"(",
"self",
",",
"remote_mgmt_addr",
")",
":",
"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. | [
"This",
"function",
"saves",
"the",
"MGMT",
"address",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L128-L133 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_sys_desc_uneq_store | 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 | python | 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 | [
"def",
"remote_sys_desc_uneq_store",
"(",
"self",
",",
"remote_system_desc",
")",
":",
"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. | [
"This",
"function",
"saves",
"the",
"system",
"desc",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L135-L140 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_sys_name_uneq_store | 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 | python | 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 | [
"def",
"remote_sys_name_uneq_store",
"(",
"self",
",",
"remote_system_name",
")",
":",
"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. | [
"This",
"function",
"saves",
"the",
"system",
"name",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L142-L147 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_port_uneq_store | 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 | python | 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 | [
"def",
"remote_port_uneq_store",
"(",
"self",
",",
"remote_port",
")",
":",
"if",
"remote_port",
"!=",
"self",
".",
"remote_port",
":",
"self",
".",
"remote_port",
"=",
"remote_port",
"return",
"True",
"return",
"False"
] | This function saves the port, if different from stored. | [
"This",
"function",
"saves",
"the",
"port",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L149-L154 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_chassis_id_mac_uneq_store | 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 | python | 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 | [
"def",
"remote_chassis_id_mac_uneq_store",
"(",
"self",
",",
"remote_chassis_id_mac",
")",
":",
"if",
"remote_chassis_id_mac",
"!=",
"self",
".",
"remote_chassis_id_mac",
":",
"self",
".",
"remote_chassis_id_mac",
"=",
"remote_chassis_id_mac",
"return",
"True",
"return",
... | This function saves the Chassis MAC, if different from stored. | [
"This",
"function",
"saves",
"the",
"Chassis",
"MAC",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L156-L161 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoIntfAttr.remote_port_id_mac_uneq_store | 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 | python | 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 | [
"def",
"remote_port_id_mac_uneq_store",
"(",
"self",
",",
"remote_port_id_mac",
")",
":",
"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. | [
"This",
"function",
"saves",
"the",
"port",
"MAC",
"if",
"different",
"from",
"stored",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L163-L168 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDiscPubApi.get_lldp_status | 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() | python | 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() | [
"def",
"get_lldp_status",
"(",
"cls",
",",
"intf",
")",
":",
"if",
"intf",
"not",
"in",
"cls",
".",
"topo_intf_obj_dict",
":",
"LOG",
".",
"error",
"(",
"\"Interface %s not configured at all\"",
",",
"intf",
")",
"return",
"False",
"intf_obj",
"=",
"cls",
".... | Retrieves the LLDP status. | [
"Retrieves",
"the",
"LLDP",
"status",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L180-L186 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc._init_cfg_interfaces | 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 = {}
... | python | 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 = {}
... | [
"def",
"_init_cfg_interfaces",
"(",
"self",
",",
"cb",
",",
"intf_list",
"=",
"None",
",",
"all_intf",
"=",
"True",
")",
":",
"if",
"not",
"all_intf",
":",
"self",
".",
"intf_list",
"=",
"intf_list",
"else",
":",
"self",
".",
"intf_list",
"=",
"sys_utils... | Configure the interfaces during init time. | [
"Configure",
"the",
"interfaces",
"during",
"init",
"time",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L208-L216 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc.cfg_intf | 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) | python | 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) | [
"def",
"cfg_intf",
"(",
"self",
",",
"protocol_interface",
",",
"phy_interface",
"=",
"None",
")",
":",
"self",
".",
"intf_list",
".",
"append",
"(",
"protocol_interface",
")",
"self",
".",
"cfg_lldp_interface",
"(",
"protocol_interface",
",",
"phy_interface",
"... | Called by application to add an interface to the list. | [
"Called",
"by",
"application",
"to",
"add",
"an",
"interface",
"to",
"the",
"list",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L218-L221 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc.create_attr_obj | 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]... | python | 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]... | [
"def",
"create_attr_obj",
"(",
"self",
",",
"protocol_interface",
",",
"phy_interface",
")",
":",
"self",
".",
"intf_attr",
"[",
"protocol_interface",
"]",
"=",
"TopoIntfAttr",
"(",
"protocol_interface",
",",
"phy_interface",
")",
"self",
".",
"store_obj",
"(",
... | Creates the local interface attribute object and stores it. | [
"Creates",
"the",
"local",
"interface",
"attribute",
"object",
"and",
"stores",
"it",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L239-L243 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc.cmp_store_tlv_params | 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_... | python | 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_... | [
"def",
"cmp_store_tlv_params",
"(",
"self",
",",
"intf",
",",
"tlv_data",
")",
":",
"flag",
"=",
"False",
"attr_obj",
"=",
"self",
".",
"get_attr_obj",
"(",
"intf",
")",
"remote_evb_mode",
"=",
"self",
".",
"pub_lldp",
".",
"get_remote_evb_mode",
"(",
"tlv_d... | Compare and store the received TLV.
Compares the received TLV with stored TLV. Store the new TLV if it is
different. | [
"Compare",
"and",
"store",
"the",
"received",
"TLV",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L249-L282 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc.cfg_lldp_interface | 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_... | python | 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_... | [
"def",
"cfg_lldp_interface",
"(",
"self",
",",
"protocol_interface",
",",
"phy_interface",
"=",
"None",
")",
":",
"if",
"phy_interface",
"is",
"None",
":",
"phy_interface",
"=",
"protocol_interface",
"self",
".",
"create_attr_obj",
"(",
"protocol_interface",
",",
... | Cfg LLDP on interface and create object. | [
"Cfg",
"LLDP",
"on",
"interface",
"and",
"create",
"object",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L284-L291 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc.periodic_discovery_task | 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)) | python | 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)) | [
"def",
"periodic_discovery_task",
"(",
"self",
")",
":",
"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. | [
"Periodic",
"task",
"that",
"checks",
"the",
"interface",
"TLV",
"attributes",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L298-L304 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc._check_bond_interface_change | 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... | python | 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... | [
"def",
"_check_bond_interface_change",
"(",
"self",
",",
"phy_interface",
",",
"attr_obj",
")",
":",
"bond_phy",
"=",
"sys_utils",
".",
"get_bond_intf",
"(",
"phy_interface",
")",
"if",
"sys_utils",
".",
"is_intf_bond",
"(",
"phy_interface",
")",
":",
"bond_intf",... | 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. | [
"Check",
"if",
"there",
"s",
"any",
"change",
"in",
"bond",
"interface",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L306-L321 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/topo_disc/topo_disc.py | TopoDisc._periodic_task_int | 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... | python | 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... | [
"def",
"_periodic_task_int",
"(",
"self",
")",
":",
"for",
"intf",
"in",
"self",
".",
"intf_list",
":",
"attr_obj",
"=",
"self",
".",
"get_attr_obj",
"(",
"intf",
")",
"status",
"=",
"attr_obj",
".",
"get_lldp_status",
"(",
")",
"if",
"not",
"status",
":... | 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. | [
"Internal",
"periodic",
"discovery",
"task",
"routine",
"to",
"check",
"TLV",
"attributes",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L323-L351 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_restapi_client.py | CiscoNexusRestapiClient._get_cookie | 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:
... | python | 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:
... | [
"def",
"_get_cookie",
"(",
"self",
",",
"mgmt_ip",
",",
"config",
",",
"refresh",
"=",
"False",
")",
":",
"if",
"mgmt_ip",
"not",
"in",
"self",
".",
"credentials",
":",
"return",
"None",
"security_data",
"=",
"self",
".",
"credentials",
"[",
"mgmt_ip",
"... | Performs authentication and retries cookie. | [
"Performs",
"authentication",
"and",
"retries",
"cookie",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_restapi_client.py#L61-L105 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_restapi_client.py | CiscoNexusRestapiClient.send_request | 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... | python | 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... | [
"def",
"send_request",
"(",
"self",
",",
"method",
",",
"action",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"ipaddr",
"=",
"None",
")",
":",
"action",
"=",
"''",
".",
"join",
"(",
"[",
"self",
".",
"scheme",
",",
"'://%s/'",
",",
... | 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 ... | [
"Perform",
"the",
"HTTP",
"request",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_restapi_client.py#L107-L229 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusCfgMonitor._initialize_trunk_interfaces_to_none | 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... | python | 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... | [
"def",
"_initialize_trunk_interfaces_to_none",
"(",
"self",
",",
"switch_ip",
",",
"replay",
"=",
"True",
")",
":",
"try",
":",
"# The following determines if the switch interfaces are",
"# in place. If so, make sure they have a basic trunk",
"# configuration applied to none.",
"s... | Initialize all nexus interfaces to trunk allowed none. | [
"Initialize",
"all",
"nexus",
"interfaces",
"to",
"trunk",
"allowed",
"none",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L121-L146 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusCfgMonitor.replay_config | 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... | python | 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... | [
"def",
"replay_config",
"(",
"self",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Replaying config for switch ip %(switch_ip)s\"",
",",
"{",
"'switch_ip'",
":",
"switch_ip",
"}",
")",
"# Before replaying all config, initialize trunk interfaces",
"# to none as re... | Sends pending config data in OpenStack to Nexus. | [
"Sends",
"pending",
"config",
"data",
"in",
"OpenStack",
"to",
"Nexus",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L148-L203 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusCfgMonitor.check_connections | 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... | python | 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... | [
"def",
"check_connections",
"(",
"self",
")",
":",
"switch_connections",
"=",
"self",
".",
"_mdriver",
".",
"get_all_switch_ips",
"(",
")",
"for",
"switch_ip",
"in",
"switch_connections",
":",
"state",
"=",
"self",
".",
"_mdriver",
".",
"get_switch_ip_and_active_s... | Check connection between OpenStack to Nexus device. | [
"Check",
"connection",
"between",
"OpenStack",
"to",
"Nexus",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L205-L277 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._load_nexus_cfg_driver | 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... | python | 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... | [
"def",
"_load_nexus_cfg_driver",
"(",
"self",
")",
":",
"try",
":",
"loaded_class",
"=",
"runtime_utils",
".",
"load_class_by_alias_or_classname",
"(",
"'networking_cisco.ml2.nexus_driver'",
",",
"'restapi'",
")",
"return",
"loaded_class",
"(",
"CONF",
".",
"ml2_cisco",... | Load Nexus Config driver.
:raises SystemExit of 1 if driver cannot be loaded | [
"Load",
"Nexus",
"Config",
"driver",
".",
":",
"raises",
"SystemExit",
"of",
"1",
"if",
"driver",
"cannot",
"be",
"loaded"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L284-L295 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._switch_defined | 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 | python | 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 | [
"def",
"_switch_defined",
"(",
"self",
",",
"switch_ip",
")",
":",
"switch",
"=",
"cfg",
".",
"CONF",
".",
"ml2_cisco",
".",
"nexus_switches",
".",
"get",
"(",
"switch_ip",
")",
"if",
"switch",
"and",
"switch",
".",
"username",
"and",
"switch",
".",
"pas... | Verify this ip address is defined (for Nexus). | [
"Verify",
"this",
"ip",
"address",
"is",
"defined",
"(",
"for",
"Nexus",
")",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L456-L462 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._pop_vlan_range | 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... | python | 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... | [
"def",
"_pop_vlan_range",
"(",
"self",
",",
"switch_ip",
",",
"size",
")",
":",
"vlan_range",
"=",
"self",
".",
"_get_switch_vlan_range",
"(",
"switch_ip",
")",
"sized_range",
"=",
"''",
"fr",
"=",
"0",
"to",
"=",
"0",
"# if vlan_range not empty and haven't met ... | 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... | [
"Extract",
"a",
"specific",
"number",
"of",
"vlans",
"from",
"storage",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L505-L552 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.get_all_switch_ips | 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")
... | python | 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")
... | [
"def",
"get_all_switch_ips",
"(",
"self",
")",
":",
"switch_connections",
"=",
"[",
"]",
"try",
":",
"bindings",
"=",
"nxos_db",
".",
"get_reserved_switch_binding",
"(",
")",
"except",
"excep",
".",
"NexusPortBindingNotFound",
":",
"LOG",
".",
"error",
"(",
"\... | Using reserved switch binding get all switch ips. | [
"Using",
"reserved",
"switch",
"binding",
"get",
"all",
"switch",
"ips",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L578-L590 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_baremetal_switch_info | 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:
... | python | 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:
... | [
"def",
"_get_baremetal_switch_info",
"(",
"self",
",",
"link_info",
")",
":",
"try",
":",
"switch_info",
"=",
"link_info",
"[",
"'switch_info'",
"]",
"if",
"not",
"isinstance",
"(",
"switch_info",
",",
"dict",
")",
":",
"switch_info",
"=",
"jsonutils",
".",
... | Get switch_info dictionary from context. | [
"Get",
"switch_info",
"dictionary",
"from",
"context",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L620-L632 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._supported_baremetal_transaction | 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... | python | 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... | [
"def",
"_supported_baremetal_transaction",
"(",
"self",
",",
"context",
")",
":",
"port",
"=",
"context",
".",
"current",
"if",
"self",
".",
"trunk",
".",
"is_trunk_subport_baremetal",
"(",
"port",
")",
":",
"return",
"self",
".",
"_baremetal_set_binding",
"(",
... | Verify transaction is complete and for us. | [
"Verify",
"transaction",
"is",
"complete",
"and",
"for",
"us",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L658-L709 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_baremetal_switches | 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... | python | 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... | [
"def",
"_get_baremetal_switches",
"(",
"self",
",",
"port",
")",
":",
"all_switches",
"=",
"set",
"(",
")",
"active_switches",
"=",
"set",
"(",
")",
"all_link_info",
"=",
"port",
"[",
"bc",
".",
"portbindings",
".",
"PROFILE",
"]",
"[",
"'local_link_informat... | 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 | [
"Get",
"switch",
"ip",
"addresses",
"from",
"baremetal",
"transaction",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L711-L739 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_baremetal_connections | 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... | python | 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... | [
"def",
"_get_baremetal_connections",
"(",
"self",
",",
"port",
",",
"only_active_switch",
"=",
"False",
",",
"from_segment",
"=",
"False",
")",
":",
"connections",
"=",
"[",
"]",
"is_native",
"=",
"False",
"if",
"self",
".",
"trunk",
".",
"is_trunk_subport",
... | 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... | [
"Get",
"switch",
"ips",
"and",
"interfaces",
"from",
"baremetal",
"transaction",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L741-L804 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._init_baremetal_trunk_interfaces | 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... | python | 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... | [
"def",
"_init_baremetal_trunk_interfaces",
"(",
"self",
",",
"port_seg",
",",
"segment",
")",
":",
"# interfaces list requiring switch initialization and",
"# reserved port and port_binding db entry creation",
"list_to_init",
"=",
"[",
"]",
"# interfaces list requiring reserved port ... | 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.
... | [
"Initialize",
"baremetal",
"switch",
"interfaces",
"and",
"DB",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L806-L862 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_host_switches | 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... | python | 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... | [
"def",
"_get_host_switches",
"(",
"self",
",",
"host_id",
")",
":",
"all_switches",
"=",
"set",
"(",
")",
"active_switches",
"=",
"set",
"(",
")",
"try",
":",
"host_list",
"=",
"nxos_db",
".",
"get_host_mappings",
"(",
"host_id",
")",
"for",
"mapping",
"in... | 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... | [
"Get",
"switch",
"IPs",
"from",
"configured",
"host",
"mapping",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L864-L889 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_host_connections | 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... | python | 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... | [
"def",
"_get_host_connections",
"(",
"self",
",",
"host_id",
",",
"only_active_switch",
"=",
"False",
")",
":",
"host_found",
"=",
"False",
"host_connections",
"=",
"[",
"]",
"try",
":",
"host_ifs",
"=",
"nxos_db",
".",
"get_host_mappings",
"(",
"host_id",
")"... | 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_... | [
"Get",
"switch",
"IPs",
"and",
"interfaces",
"from",
"config",
"host",
"mapping",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L891-L928 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_switch_interfaces | 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... | python | 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... | [
"def",
"_get_switch_interfaces",
"(",
"self",
",",
"requested_switch_ip",
",",
"cfg_only",
"=",
"False",
")",
":",
"switch_ifs",
"=",
"[",
"]",
"try",
":",
"port_info",
"=",
"nxos_db",
".",
"get_switch_host_mappings",
"(",
"requested_switch_ip",
")",
"except",
"... | 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 ... | [
"Get",
"switch",
"interfaces",
"from",
"host",
"mapping",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L940-L968 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._configure_nve_db | 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... | python | 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... | [
"def",
"_configure_nve_db",
"(",
"self",
",",
"vni",
",",
"device_id",
",",
"mcast_group",
",",
"host_id",
")",
":",
"host_nve_connections",
"=",
"self",
".",
"_get_switch_nve_info",
"(",
"host_id",
")",
"for",
"switch_ip",
"in",
"host_nve_connections",
":",
"if... | Create the nexus NVE database entry.
Called during update precommit port event. | [
"Create",
"the",
"nexus",
"NVE",
"database",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L992-L1002 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._configure_nve_member | 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:
... | python | 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:
... | [
"def",
"_configure_nve_member",
"(",
"self",
",",
"vni",
",",
"device_id",
",",
"mcast_group",
",",
"host_id",
")",
":",
"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. | [
"Add",
"member",
"vni",
"configuration",
"to",
"the",
"NVE",
"interface",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1008-L1035 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._delete_nve_db | 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... | python | 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... | [
"def",
"_delete_nve_db",
"(",
"self",
",",
"vni",
",",
"device_id",
",",
"mcast_group",
",",
"host_id",
")",
":",
"rows",
"=",
"nxos_db",
".",
"get_nve_vni_deviceid_bindings",
"(",
"vni",
",",
"device_id",
")",
"for",
"row",
"in",
"rows",
":",
"nxos_db",
"... | Delete the nexus NVE database entry.
Called during delete precommit port event. | [
"Delete",
"the",
"nexus",
"NVE",
"database",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1037-L1044 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._delete_nve_member | 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:
... | python | 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:
... | [
"def",
"_delete_nve_member",
"(",
"self",
",",
"vni",
",",
"device_id",
",",
"mcast_group",
",",
"host_id",
")",
":",
"host_nve_connections",
"=",
"self",
".",
"_get_switch_nve_info",
"(",
"host_id",
")",
"for",
"switch_ip",
"in",
"host_nve_connections",
":",
"i... | Remove "member vni" configuration from the NVE interface.
Called during delete postcommit port event. | [
"Remove",
"member",
"vni",
"configuration",
"from",
"the",
"NVE",
"interface",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1046-L1059 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._configure_nxos_db | 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,... | python | 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,... | [
"def",
"_configure_nxos_db",
"(",
"self",
",",
"port",
",",
"vlan_id",
",",
"device_id",
",",
"host_id",
",",
"vni",
",",
"is_provider_vlan",
")",
":",
"connections",
"=",
"self",
".",
"_get_port_connections",
"(",
"port",
",",
"host_id",
")",
"for",
"switch... | Create the nexus database entry.
Called during update precommit port event. | [
"Create",
"the",
"nexus",
"database",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1061-L1077 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._gather_config_parms | 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... | python | 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... | [
"def",
"_gather_config_parms",
"(",
"self",
",",
"is_provider_vlan",
",",
"vlan_id",
")",
":",
"if",
"is_provider_vlan",
":",
"auto_create",
"=",
"cfg",
".",
"CONF",
".",
"ml2_cisco",
".",
"provider_vlan_auto_create",
"auto_trunk",
"=",
"cfg",
".",
"CONF",
".",
... | Collect auto_create, auto_trunk from config. | [
"Collect",
"auto_create",
"auto_trunk",
"from",
"config",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1079-L1087 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._configure_port_binding | 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... | python | 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... | [
"def",
"_configure_port_binding",
"(",
"self",
",",
"is_provider_vlan",
",",
"duplicate_type",
",",
"is_native",
",",
"switch_ip",
",",
"vlan_id",
",",
"intf_type",
",",
"nexus_port",
",",
"vni",
")",
":",
"# This implies VLAN, VNI, and Port are all duplicate.",
"# Then... | Conditionally calls vlan and port Nexus drivers. | [
"Conditionally",
"calls",
"vlan",
"and",
"port",
"Nexus",
"drivers",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1089-L1119 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._get_compressed_vlan_list | 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])... | python | 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])... | [
"def",
"_get_compressed_vlan_list",
"(",
"self",
",",
"pvlan_ids",
")",
":",
"if",
"not",
"pvlan_ids",
":",
"return",
"[",
"]",
"pvlan_list",
"=",
"list",
"(",
"pvlan_ids",
")",
"pvlan_list",
".",
"sort",
"(",
")",
"compressed_list",
"=",
"[",
"]",
"begin"... | 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:
-----------... | [
"Generate",
"a",
"compressed",
"vlan",
"list",
"ready",
"for",
"XML",
"using",
"a",
"vlan",
"set",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1121-L1166 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._restore_port_binding | 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... | python | 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... | [
"def",
"_restore_port_binding",
"(",
"self",
",",
"switch_ip",
",",
"pvlan_ids",
",",
"port",
",",
"native_vlan",
")",
":",
"intf_type",
",",
"nexus_port",
"=",
"nexus_help",
".",
"split_interface_name",
"(",
"port",
")",
"# If native_vlan is configured, this is isola... | Restores a set of vlans for a given port. | [
"Restores",
"a",
"set",
"of",
"vlans",
"for",
"a",
"given",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1168-L1205 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._restore_vxlan_entries | 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
... | python | 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
... | [
"def",
"_restore_vxlan_entries",
"(",
"self",
",",
"switch_ip",
",",
"vlans",
")",
":",
"count",
"=",
"1",
"conf_str",
"=",
"''",
"vnsegment_sent",
"=",
"0",
"path_str",
",",
"conf_str",
"=",
"self",
".",
"driver",
".",
"start_create_vlan",
"(",
")",
"# At... | Restore vxlan entries on a Nexus switch. | [
"Restore",
"vxlan",
"entries",
"on",
"a",
"Nexus",
"switch",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1207-L1238 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._configure_port_entries | 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 ... | python | 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 ... | [
"def",
"_configure_port_entries",
"(",
"self",
",",
"port",
",",
"vlan_id",
",",
"device_id",
",",
"host_id",
",",
"vni",
",",
"is_provider_vlan",
")",
":",
"connections",
"=",
"self",
".",
"_get_active_port_connections",
"(",
"port",
",",
"host_id",
")",
"# (... | 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. | [
"Create",
"a",
"nexus",
"switch",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1240-L1296 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.configure_next_batch_of_vlans | 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(
... | python | 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(
... | [
"def",
"configure_next_batch_of_vlans",
"(",
"self",
",",
"switch_ip",
")",
":",
"next_range",
"=",
"self",
".",
"_pop_vlan_range",
"(",
"switch_ip",
",",
"const",
".",
"CREATE_VLAN_BATCH",
")",
"if",
"next_range",
":",
"try",
":",
"self",
".",
"driver",
".",
... | Get next batch of vlans and send them to Nexus. | [
"Get",
"next",
"batch",
"of",
"vlans",
"and",
"send",
"them",
"to",
"Nexus",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1298-L1336 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.configure_switch_entries | 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... | python | 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... | [
"def",
"configure_switch_entries",
"(",
"self",
",",
"switch_ip",
",",
"port_bindings",
")",
":",
"prev_vlan",
"=",
"-",
"1",
"prev_vni",
"=",
"-",
"1",
"prev_port",
"=",
"None",
"prev_native_vlan",
"=",
"0",
"starttime",
"=",
"time",
".",
"time",
"(",
")"... | 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... | [
"Create",
"a",
"nexus",
"switch",
"entry",
"in",
"Nexus",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1338-L1436 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._delete_nxos_db | 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 ... | python | 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 ... | [
"def",
"_delete_nxos_db",
"(",
"self",
",",
"unused",
",",
"vlan_id",
",",
"device_id",
",",
"host_id",
",",
"vni",
",",
"is_provider_vlan",
")",
":",
"try",
":",
"rows",
"=",
"nxos_db",
".",
"get_nexusvm_bindings",
"(",
"vlan_id",
",",
"device_id",
")",
"... | Delete the nexus database entry.
Called during delete precommit port event. | [
"Delete",
"the",
"nexus",
"database",
"entry",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1438-L1450 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._delete_port_channel_resources | 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':
... | python | 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':
... | [
"def",
"_delete_port_channel_resources",
"(",
"self",
",",
"host_id",
",",
"switch_ip",
",",
"intf_type",
",",
"nexus_port",
",",
"port_id",
")",
":",
"# if this connection is not a port-channel, nothing to do.",
"if",
"intf_type",
"!=",
"'port-channel'",
":",
"return",
... | This determines if port channel id needs to be freed. | [
"This",
"determines",
"if",
"port",
"channel",
"id",
"needs",
"to",
"be",
"freed",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1452-L1522 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._delete_switch_entry | 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.
... | python | 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.
... | [
"def",
"_delete_switch_entry",
"(",
"self",
",",
"port",
",",
"vlan_id",
",",
"device_id",
",",
"host_id",
",",
"vni",
",",
"is_provider_vlan",
")",
":",
"connections",
"=",
"self",
".",
"_get_active_port_connections",
"(",
"port",
",",
"host_id",
")",
"# (nex... | 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",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1524-L1596 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._port_action_vlan | 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 = ... | python | 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 = ... | [
"def",
"_port_action_vlan",
"(",
"self",
",",
"port",
",",
"segment",
",",
"func",
",",
"vni",
")",
":",
"# Verify segment.",
"if",
"not",
"self",
".",
"_is_valid_segment",
"(",
"segment",
")",
":",
"return",
"device_id",
"=",
"self",
".",
"_get_port_uuid",
... | Verify configuration and then process event. | [
"Verify",
"configuration",
"and",
"then",
"process",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1638-L1664 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver._port_action_vxlan | 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')
... | python | 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')
... | [
"def",
"_port_action_vxlan",
"(",
"self",
",",
"port",
",",
"segment",
",",
"func",
")",
":",
"# If the segment is None, just log a warning message and return.",
"if",
"segment",
"is",
"None",
":",
"self",
".",
"_log_missing_segment",
"(",
")",
"return",
"device_id",
... | Verify configuration and then process event. | [
"Verify",
"configuration",
"and",
"then",
"process",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1666-L1687 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.create_port_postcommit | 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... | python | 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... | [
"def",
"create_port_postcommit",
"(",
"self",
",",
"context",
")",
":",
"# No new events are handled until replay",
"# thread has put the switch in active state.",
"# If a switch is in active state, verify",
"# the switch is still in active state",
"# before accepting this new event.",
"#"... | Create port non-database commit event. | [
"Create",
"port",
"non",
"-",
"database",
"commit",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1700-L1757 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.update_port_precommit | 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... | python | 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... | [
"def",
"update_port_precommit",
"(",
"self",
",",
"context",
")",
":",
"vlan_segment",
",",
"vxlan_segment",
"=",
"self",
".",
"_get_segments",
"(",
"context",
".",
"top_bound_segment",
",",
"context",
".",
"bottom_bound_segment",
")",
"orig_vlan_segment",
",",
"o... | Update port pre-database transaction commit event. | [
"Update",
"port",
"pre",
"-",
"database",
"transaction",
"commit",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1760-L1779 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.update_port_postcommit | 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_... | python | 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_... | [
"def",
"update_port_postcommit",
"(",
"self",
",",
"context",
")",
":",
"vlan_segment",
",",
"vxlan_segment",
"=",
"self",
".",
"_get_segments",
"(",
"context",
".",
"top_bound_segment",
",",
"context",
".",
"bottom_bound_segment",
")",
"orig_vlan_segment",
",",
"... | Update port non-database commit event. | [
"Update",
"port",
"non",
"-",
"database",
"commit",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1782-L1815 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.delete_port_precommit | 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,
... | python | 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,
... | [
"def",
"delete_port_precommit",
"(",
"self",
",",
"context",
")",
":",
"if",
"self",
".",
"_is_supported_deviceowner",
"(",
"context",
".",
"current",
")",
":",
"vlan_segment",
",",
"vxlan_segment",
"=",
"self",
".",
"_get_segments",
"(",
"context",
".",
"top_... | Delete port pre-database commit event. | [
"Delete",
"port",
"pre",
"-",
"database",
"commit",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1818-L1827 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py | CiscoNexusMechanismDriver.delete_port_postcommit | 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,
... | python | 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,
... | [
"def",
"delete_port_postcommit",
"(",
"self",
",",
"context",
")",
":",
"if",
"self",
".",
"_is_supported_deviceowner",
"(",
"context",
".",
"current",
")",
":",
"vlan_segment",
",",
"vxlan_segment",
"=",
"self",
".",
"_get_segments",
"(",
"context",
".",
"top... | Delete port non-database commit event. | [
"Delete",
"port",
"non",
"-",
"database",
"commit",
"event",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1830-L1839 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._detect_iplus | 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)):
... | python | 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)):
... | [
"def",
"_detect_iplus",
"(",
"self",
")",
":",
"ver_expr",
"=",
"\"([0-9]+)\\.([0-9]+)\\((.*)\\)\"",
"re",
".",
"compile",
"(",
"ver_expr",
")",
"v1",
"=",
"re",
".",
"match",
"(",
"ver_expr",
",",
"self",
".",
"_cur_ver",
")",
"v2",
"=",
"re",
".",
"mat... | Check the DCNM version and determine if it's for iplus | [
"Check",
"the",
"DCNM",
"version",
"and",
"determine",
"if",
"it",
"s",
"for",
"iplus"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L75-L92 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_segmentid_range | 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() | python | 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() | [
"def",
"get_segmentid_range",
"(",
"self",
",",
"orchestrator_id",
")",
":",
"url",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"_segmentid_ranges_url",
",",
"orchestrator_id",
")",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
",",
"url",
",",
"None"... | Get segment id range from DCNM. | [
"Get",
"segment",
"id",
"range",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L97-L104 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.set_segmentid_range | 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... | python | 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... | [
"def",
"set_segmentid_range",
"(",
"self",
",",
"orchestrator_id",
",",
"segid_min",
",",
"segid_max",
")",
":",
"url",
"=",
"self",
".",
"_segmentid_ranges_url",
"payload",
"=",
"{",
"'orchestratorId'",
":",
"orchestrator_id",
",",
"'segmentIdRanges'",
":",
"\"%s... | set segment id range in DCNM. | [
"set",
"segment",
"id",
"range",
"in",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L106-L119 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._set_default_cfg_profile | 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... | python | 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... | [
"def",
"_set_default_cfg_profile",
"(",
"self",
")",
":",
"try",
":",
"cfgplist",
"=",
"self",
".",
"config_profile_list",
"(",
")",
"if",
"self",
".",
"default_cfg_profile",
"not",
"in",
"cfgplist",
":",
"self",
".",
"default_cfg_profile",
"=",
"(",
"'default... | 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. | [
"Set",
"default",
"network",
"config",
"profile",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L135-L150 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._create_network | 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'])... | python | 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'])... | [
"def",
"_create_network",
"(",
"self",
",",
"network_info",
")",
":",
"url",
"=",
"self",
".",
"_create_network_url",
"%",
"(",
"network_info",
"[",
"'organizationName'",
"]",
",",
"network_info",
"[",
"'partitionName'",
"]",
")",
"payload",
"=",
"network_info",... | Send create network request to DCNM.
:param network_info: network parameters to be created on DCNM | [
"Send",
"create",
"network",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L152-L163 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._config_profile_get | 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... | python | 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... | [
"def",
"_config_profile_get",
"(",
"self",
",",
"thisprofile",
")",
":",
"url",
"=",
"self",
".",
"_cfg_profile_get_url",
"%",
"(",
"thisprofile",
")",
"payload",
"=",
"{",
"}",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
",",
"url",
",",
"pa... | Get information of a config profile from DCNM.
:param thisprofile: network config profile in request | [
"Get",
"information",
"of",
"a",
"config",
"profile",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L165-L175 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._config_profile_list | 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... | python | 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... | [
"def",
"_config_profile_list",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_cfg_profile_list_url",
"payload",
"=",
"{",
"}",
"try",
":",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
",",
"url",
",",
"payload",
",",
"'config-profile'",
")",
... | Get list of supported config profile from DCNM. | [
"Get",
"list",
"of",
"supported",
"config",
"profile",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L177-L187 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._get_settings | 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() | python | 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() | [
"def",
"_get_settings",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_global_settings_url",
"payload",
"=",
"{",
"}",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
",",
"url",
",",
"payload",
",",
"'settings'",
")",
"if",
"res",
"and",
"r... | Get global mobility domain from DCNM. | [
"Get",
"global",
"mobility",
"domain",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L189-L195 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._create_org | 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,
... | python | 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,
... | [
"def",
"_create_org",
"(",
"self",
",",
"orch_id",
",",
"name",
",",
"desc",
")",
":",
"url",
"=",
"self",
".",
"_org_url",
"payload",
"=",
"{",
"\"organizationName\"",
":",
"name",
",",
"\"description\"",
":",
"name",
"if",
"len",
"(",
"desc",
")",
"=... | Create organization on the DCNM.
:param orch_id: orchestrator ID
:param name: Name of organization
:param desc: Description of organization | [
"Create",
"organization",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L208-L221 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._create_or_update_partition | 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... | python | 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... | [
"def",
"_create_or_update_partition",
"(",
"self",
",",
"org_name",
",",
"part_name",
",",
"desc",
",",
"dci_id",
"=",
"UNKNOWN_DCI_ID",
",",
"vrf_prof",
"=",
"None",
",",
"service_node_ip",
"=",
"UNKNOWN_SRVN_NODE_IP",
",",
"operation",
"=",
"'POST'",
")",
":",... | Send create or update partition request to the DCNM.
:param org_name: name of organization
:param part_name: name of partition
:param desc: description of partition
:dci_id: DCI ID for inter-DC
:vrf_prof: VRF Profile Name
:service_node_ip: Service Node's Address | [
"Send",
"create",
"or",
"update",
"partition",
"request",
"to",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L223-L271 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._get_partition | 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... | python | 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... | [
"def",
"_get_partition",
"(",
"self",
",",
"org_name",
",",
"part_name",
"=",
"None",
")",
":",
"if",
"part_name",
"is",
"None",
":",
"part_name",
"=",
"self",
".",
"_part_name",
"url",
"=",
"self",
".",
"_update_part_url",
"%",
"(",
"org_name",
",",
"pa... | send get partition request to the DCNM.
:param org_name: name of organization
:param part_name: name of partition | [
"send",
"get",
"partition",
"request",
"to",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L273-L284 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.update_partition_static_route | 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... | python | 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... | [
"def",
"update_partition_static_route",
"(",
"self",
",",
"org_name",
",",
"part_name",
",",
"static_ip_list",
",",
"vrf_prof",
"=",
"None",
",",
"service_node_ip",
"=",
"None",
")",
":",
"if",
"part_name",
"is",
"None",
":",
"part_name",
"=",
"self",
".",
"... | 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 | [
"Send",
"static",
"route",
"update",
"requests",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L286-L323 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._delete_org | 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') | python | 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') | [
"def",
"_delete_org",
"(",
"self",
",",
"org_name",
")",
":",
"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 | [
"Send",
"organization",
"delete",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L325-L331 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._delete_partition | def _delete_partition(self, org_name, partition_name):
"""Send partition delete request to DCNM.
:param org_name: name of organization
:param partition_name: name of partition
"""
url = self._del_part % (org_name, partition_name)
return self._send_request('DELETE', url, ... | python | 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, ... | [
"def",
"_delete_partition",
"(",
"self",
",",
"org_name",
",",
"partition_name",
")",
":",
"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 | [
"Send",
"partition",
"delete",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L333-L340 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._delete_network | 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[... | python | 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[... | [
"def",
"_delete_network",
"(",
"self",
",",
"network_info",
")",
":",
"org_name",
"=",
"network_info",
".",
"get",
"(",
"'organizationName'",
",",
"''",
")",
"part_name",
"=",
"network_info",
".",
"get",
"(",
"'partitionName'",
",",
"''",
")",
"segment_id",
... | Send network delete request to DCNM.
:param network_info: contains network info to be deleted. | [
"Send",
"network",
"delete",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L342-L357 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._get_network | 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'... | python | 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'... | [
"def",
"_get_network",
"(",
"self",
",",
"network_info",
")",
":",
"org_name",
"=",
"network_info",
".",
"get",
"(",
"'organizationName'",
",",
"''",
")",
"part_name",
"=",
"network_info",
".",
"get",
"(",
"'partitionName'",
",",
"''",
")",
"segment_id",
"="... | Send network get request to DCNM.
:param network_info: contains network info to query. | [
"Send",
"network",
"get",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L359-L368 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._login_request | 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... | python | 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... | [
"def",
"_login_request",
"(",
"self",
",",
"url_login",
")",
":",
"expiration_time",
"=",
"self",
".",
"_exp_time",
"payload",
"=",
"{",
"'expirationTime'",
":",
"expiration_time",
"}",
"# TODO(padkrish), after testing with certificates, make the",
"# verify option configur... | Internal function to send login request. | [
"Internal",
"function",
"to",
"send",
"login",
"request",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L370-L385 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient._logout_request | 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) | python | 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) | [
"def",
"_logout_request",
"(",
"self",
",",
"url_logout",
")",
":",
"requests",
".",
"post",
"(",
"url_logout",
",",
"headers",
"=",
"self",
".",
"_req_headers",
",",
"timeout",
"=",
"self",
".",
"timeout_resp",
",",
"verify",
"=",
"False",
")"
] | Internal logout request to DCNM. | [
"Internal",
"logout",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L392-L397 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.