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/server/cisco_dfa_rest.py | DFARESTClient._send_request | def _send_request(self, operation, url, payload, desc):
"""Send request to DCNM."""
res = None
try:
payload_json = None
if payload and payload != '':
payload_json = jsonutils.dumps(payload)
self._login()
desc_lookup = {'POST': ' cr... | python | def _send_request(self, operation, url, payload, desc):
"""Send request to DCNM."""
res = None
try:
payload_json = None
if payload and payload != '':
payload_json = jsonutils.dumps(payload)
self._login()
desc_lookup = {'POST': ' cr... | [
"def",
"_send_request",
"(",
"self",
",",
"operation",
",",
"url",
",",
"payload",
",",
"desc",
")",
":",
"res",
"=",
"None",
"try",
":",
"payload_json",
"=",
"None",
"if",
"payload",
"and",
"payload",
"!=",
"''",
":",
"payload_json",
"=",
"jsonutils",
... | Send request to DCNM. | [
"Send",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L404-L429 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.config_profile_list | def config_profile_list(self):
"""Return config profile list from DCNM."""
these_profiles = self._config_profile_list() or []
profile_list = [q for p in these_profiles for q in
[p.get('profileName')]]
return profile_list | python | def config_profile_list(self):
"""Return config profile list from DCNM."""
these_profiles = self._config_profile_list() or []
profile_list = [q for p in these_profiles for q in
[p.get('profileName')]]
return profile_list | [
"def",
"config_profile_list",
"(",
"self",
")",
":",
"these_profiles",
"=",
"self",
".",
"_config_profile_list",
"(",
")",
"or",
"[",
"]",
"profile_list",
"=",
"[",
"q",
"for",
"p",
"in",
"these_profiles",
"for",
"q",
"in",
"[",
"p",
".",
"get",
"(",
"... | Return config profile list from DCNM. | [
"Return",
"config",
"profile",
"list",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L431-L437 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.config_profile_fwding_mode_get | def config_profile_fwding_mode_get(self, profile_name):
"""Return forwarding mode of given config profile."""
profile_params = self._config_profile_get(profile_name)
fwd_cli = 'fabric forwarding mode proxy-gateway'
if profile_params and fwd_cli in profile_params['configCommands']:
... | python | def config_profile_fwding_mode_get(self, profile_name):
"""Return forwarding mode of given config profile."""
profile_params = self._config_profile_get(profile_name)
fwd_cli = 'fabric forwarding mode proxy-gateway'
if profile_params and fwd_cli in profile_params['configCommands']:
... | [
"def",
"config_profile_fwding_mode_get",
"(",
"self",
",",
"profile_name",
")",
":",
"profile_params",
"=",
"self",
".",
"_config_profile_get",
"(",
"profile_name",
")",
"fwd_cli",
"=",
"'fabric forwarding mode proxy-gateway'",
"if",
"profile_params",
"and",
"fwd_cli",
... | Return forwarding mode of given config profile. | [
"Return",
"forwarding",
"mode",
"of",
"given",
"config",
"profile",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L439-L447 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_config_profile_for_network | def get_config_profile_for_network(self, net_name):
"""Get the list of profiles."""
cfgplist = self.config_profile_list()
cfgname = net_name.partition(':')[2]
cfgtuple = set()
for cfg_prof in cfgplist:
if cfg_prof.startswith('defaultNetwork'):
cfg_al... | python | def get_config_profile_for_network(self, net_name):
"""Get the list of profiles."""
cfgplist = self.config_profile_list()
cfgname = net_name.partition(':')[2]
cfgtuple = set()
for cfg_prof in cfgplist:
if cfg_prof.startswith('defaultNetwork'):
cfg_al... | [
"def",
"get_config_profile_for_network",
"(",
"self",
",",
"net_name",
")",
":",
"cfgplist",
"=",
"self",
".",
"config_profile_list",
"(",
")",
"cfgname",
"=",
"net_name",
".",
"partition",
"(",
"':'",
")",
"[",
"2",
"]",
"cfgtuple",
"=",
"set",
"(",
")",
... | Get the list of profiles. | [
"Get",
"the",
"list",
"of",
"profiles",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L449-L468 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.create_network | def create_network(self, tenant_name, network, subnet,
dhcp_range=True):
"""Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network
"""
... | python | def create_network(self, tenant_name, network, subnet,
dhcp_range=True):
"""Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network
"""
... | [
"def",
"create_network",
"(",
"self",
",",
"tenant_name",
",",
"network",
",",
"subnet",
",",
"dhcp_range",
"=",
"True",
")",
":",
"seg_id",
"=",
"str",
"(",
"network",
".",
"segmentation_id",
")",
"subnet_ip_mask",
"=",
"subnet",
".",
"cidr",
".",
"split"... | Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network | [
"Create",
"network",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L470-L531 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.create_service_network | def create_service_network(self, tenant_name, network, subnet,
dhcp_range=True):
"""Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network
... | python | def create_service_network(self, tenant_name, network, subnet,
dhcp_range=True):
"""Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network
... | [
"def",
"create_service_network",
"(",
"self",
",",
"tenant_name",
",",
"network",
",",
"subnet",
",",
"dhcp_range",
"=",
"True",
")",
":",
"network_info",
"=",
"{",
"}",
"subnet_ip_mask",
"=",
"subnet",
".",
"cidr",
".",
"split",
"(",
"'/'",
")",
"if",
"... | Create network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: network parameters
:param subnet: subnet parameters of the network | [
"Create",
"network",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L533-L613 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.delete_network | def delete_network(self, tenant_name, network):
"""Delete network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters
"""
seg_id = network.segmentation_id
network_info = {
'organizatio... | python | def delete_network(self, tenant_name, network):
"""Delete network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters
"""
seg_id = network.segmentation_id
network_info = {
'organizatio... | [
"def",
"delete_network",
"(",
"self",
",",
"tenant_name",
",",
"network",
")",
":",
"seg_id",
"=",
"network",
".",
"segmentation_id",
"network_info",
"=",
"{",
"'organizationName'",
":",
"tenant_name",
",",
"'partitionName'",
":",
"self",
".",
"_part_name",
",",... | Delete network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters | [
"Delete",
"network",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L615-L635 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.delete_service_network | def delete_service_network(self, tenant_name, network):
"""Delete service network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters
"""
network_info = {}
part_name = network.part_name
i... | python | def delete_service_network(self, tenant_name, network):
"""Delete service network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters
"""
network_info = {}
part_name = network.part_name
i... | [
"def",
"delete_service_network",
"(",
"self",
",",
"tenant_name",
",",
"network",
")",
":",
"network_info",
"=",
"{",
"}",
"part_name",
"=",
"network",
".",
"part_name",
"if",
"not",
"part_name",
":",
"part_name",
"=",
"self",
".",
"_part_name",
"seg_id",
"=... | Delete service network on the DCNM.
:param tenant_name: name of tenant the network belongs to
:param network: object that contains network parameters | [
"Delete",
"service",
"network",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L637-L681 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.delete_project | def delete_project(self, tenant_name, part_name):
"""Delete project on the DCNM.
:param tenant_name: name of project.
:param part_name: name of partition.
"""
res = self._delete_partition(tenant_name, part_name)
if res and res.status_code in self._resp_ok:
LO... | python | def delete_project(self, tenant_name, part_name):
"""Delete project on the DCNM.
:param tenant_name: name of project.
:param part_name: name of partition.
"""
res = self._delete_partition(tenant_name, part_name)
if res and res.status_code in self._resp_ok:
LO... | [
"def",
"delete_project",
"(",
"self",
",",
"tenant_name",
",",
"part_name",
")",
":",
"res",
"=",
"self",
".",
"_delete_partition",
"(",
"tenant_name",
",",
"part_name",
")",
"if",
"res",
"and",
"res",
".",
"status_code",
"in",
"self",
".",
"_resp_ok",
":"... | Delete project on the DCNM.
:param tenant_name: name of project.
:param part_name: name of partition. | [
"Delete",
"project",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L683-L703 |
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 partition_name: name of partition to be deleted
"""
res = self._delete_partition(org_name, partition_name)
if res and res.status_code in self._resp_ok:
LOG.debug("D... | python | def delete_partition(self, org_name, partition_name):
"""Send partition delete request to DCNM.
:param partition_name: name of partition to be deleted
"""
res = self._delete_partition(org_name, partition_name)
if res and res.status_code in self._resp_ok:
LOG.debug("D... | [
"def",
"delete_partition",
"(",
"self",
",",
"org_name",
",",
"partition_name",
")",
":",
"res",
"=",
"self",
".",
"_delete_partition",
"(",
"org_name",
",",
"partition_name",
")",
"if",
"res",
"and",
"res",
".",
"status_code",
"in",
"self",
".",
"_resp_ok",... | Send partition delete request to DCNM.
:param partition_name: name of partition to be deleted | [
"Send",
"partition",
"delete",
"request",
"to",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L705-L717 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.create_project | def create_project(self, orch_id, org_name, part_name, dci_id, desc=None):
"""Create project on the DCNM.
:param orch_id: orchestrator ID
:param org_name: name of organization.
:param part_name: name of partition.
:param dci_id: Data Center interconnect id.
:param desc: ... | python | def create_project(self, orch_id, org_name, part_name, dci_id, desc=None):
"""Create project on the DCNM.
:param orch_id: orchestrator ID
:param org_name: name of organization.
:param part_name: name of partition.
:param dci_id: Data Center interconnect id.
:param desc: ... | [
"def",
"create_project",
"(",
"self",
",",
"orch_id",
",",
"org_name",
",",
"part_name",
",",
"dci_id",
",",
"desc",
"=",
"None",
")",
":",
"desc",
"=",
"desc",
"or",
"org_name",
"res",
"=",
"self",
".",
"_create_org",
"(",
"orch_id",
",",
"org_name",
... | Create project on the DCNM.
:param orch_id: orchestrator ID
:param org_name: name of organization.
:param part_name: name of partition.
:param dci_id: Data Center interconnect id.
:param desc: description of project. | [
"Create",
"project",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L719-L738 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.update_project | def update_project(self, org_name, part_name, dci_id=UNKNOWN_DCI_ID,
service_node_ip=UNKNOWN_SRVN_NODE_IP,
vrf_prof=None, desc=None):
"""Update project on the DCNM.
:param org_name: name of organization.
:param part_name: name of partition.
... | python | def update_project(self, org_name, part_name, dci_id=UNKNOWN_DCI_ID,
service_node_ip=UNKNOWN_SRVN_NODE_IP,
vrf_prof=None, desc=None):
"""Update project on the DCNM.
:param org_name: name of organization.
:param part_name: name of partition.
... | [
"def",
"update_project",
"(",
"self",
",",
"org_name",
",",
"part_name",
",",
"dci_id",
"=",
"UNKNOWN_DCI_ID",
",",
"service_node_ip",
"=",
"UNKNOWN_SRVN_NODE_IP",
",",
"vrf_prof",
"=",
"None",
",",
"desc",
"=",
"None",
")",
":",
"desc",
"=",
"desc",
"or",
... | Update project on the DCNM.
:param org_name: name of organization.
:param part_name: name of partition.
:param dci_id: Data Center interconnect id.
:param desc: description of project. | [
"Update",
"project",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L740-L761 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.create_partition | def create_partition(self, org_name, part_name, dci_id, vrf_prof,
service_node_ip=None, desc=None):
"""Create partition on the DCNM.
:param org_name: name of organization to be created
:param part_name: name of partition to be created
:param dci_id: DCI ID
... | python | def create_partition(self, org_name, part_name, dci_id, vrf_prof,
service_node_ip=None, desc=None):
"""Create partition on the DCNM.
:param org_name: name of organization to be created
:param part_name: name of partition to be created
:param dci_id: DCI ID
... | [
"def",
"create_partition",
"(",
"self",
",",
"org_name",
",",
"part_name",
",",
"dci_id",
",",
"vrf_prof",
",",
"service_node_ip",
"=",
"None",
",",
"desc",
"=",
"None",
")",
":",
"desc",
"=",
"desc",
"or",
"org_name",
"res",
"=",
"self",
".",
"_create_o... | Create partition on the DCNM.
:param org_name: name of organization to be created
:param part_name: name of partition to be created
:param dci_id: DCI ID
:vrf_prof: VRF profile for the partition
:param service_node_ip: Specifies the Default route IP address.
:param desc:... | [
"Create",
"partition",
"on",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L763-L784 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_partition_vrfProf | def get_partition_vrfProf(self, org_name, part_name=None, part_info=None):
"""get VRF Profile for the partition from the DCNM.
:param org_name: name of organization
:param part_name: name of partition
"""
vrf_profile = None
if part_info is None:
part_info = s... | python | def get_partition_vrfProf(self, org_name, part_name=None, part_info=None):
"""get VRF Profile for the partition from the DCNM.
:param org_name: name of organization
:param part_name: name of partition
"""
vrf_profile = None
if part_info is None:
part_info = s... | [
"def",
"get_partition_vrfProf",
"(",
"self",
",",
"org_name",
",",
"part_name",
"=",
"None",
",",
"part_info",
"=",
"None",
")",
":",
"vrf_profile",
"=",
"None",
"if",
"part_info",
"is",
"None",
":",
"part_info",
"=",
"self",
".",
"_get_partition",
"(",
"o... | get VRF Profile for the partition from the DCNM.
:param org_name: name of organization
:param part_name: name of partition | [
"get",
"VRF",
"Profile",
"for",
"the",
"partition",
"from",
"the",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L786-L799 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_partition_dciId | def get_partition_dciId(self, org_name, part_name, part_info=None):
"""get DCI ID for the partition.
:param org_name: name of organization
:param part_name: name of partition
"""
if part_info is None:
part_info = self._get_partition(org_name, part_name)
L... | python | def get_partition_dciId(self, org_name, part_name, part_info=None):
"""get DCI ID for the partition.
:param org_name: name of organization
:param part_name: name of partition
"""
if part_info is None:
part_info = self._get_partition(org_name, part_name)
L... | [
"def",
"get_partition_dciId",
"(",
"self",
",",
"org_name",
",",
"part_name",
",",
"part_info",
"=",
"None",
")",
":",
"if",
"part_info",
"is",
"None",
":",
"part_info",
"=",
"self",
".",
"_get_partition",
"(",
"org_name",
",",
"part_name",
")",
"LOG",
"."... | get DCI ID for the partition.
:param org_name: name of organization
:param part_name: name of partition | [
"get",
"DCI",
"ID",
"for",
"the",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L801-L812 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.list_networks | def list_networks(self, org, part):
"""Return list of networks from DCNM.
:param org: name of organization.
:param part: name of partition.
"""
if org and part:
list_url = self._del_part + '/networks'
list_url = list_url % (org, part)
res = se... | python | def list_networks(self, org, part):
"""Return list of networks from DCNM.
:param org: name of organization.
:param part: name of partition.
"""
if org and part:
list_url = self._del_part + '/networks'
list_url = list_url % (org, part)
res = se... | [
"def",
"list_networks",
"(",
"self",
",",
"org",
",",
"part",
")",
":",
"if",
"org",
"and",
"part",
":",
"list_url",
"=",
"self",
".",
"_del_part",
"+",
"'/networks'",
"list_url",
"=",
"list_url",
"%",
"(",
"org",
",",
"part",
")",
"res",
"=",
"self"... | Return list of networks from DCNM.
:param org: name of organization.
:param part: name of partition. | [
"Return",
"list",
"of",
"networks",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L840-L851 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.list_organizations | def list_organizations(self):
"""Return list of organizations from DCNM."""
try:
res = self._send_request('GET', self._org_url, '', 'organizations')
if res and res.status_code in self._resp_ok:
return res.json()
except dexc.DfaClientRequestFailed:
... | python | def list_organizations(self):
"""Return list of organizations from DCNM."""
try:
res = self._send_request('GET', self._org_url, '', 'organizations')
if res and res.status_code in self._resp_ok:
return res.json()
except dexc.DfaClientRequestFailed:
... | [
"def",
"list_organizations",
"(",
"self",
")",
":",
"try",
":",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
",",
"self",
".",
"_org_url",
",",
"''",
",",
"'organizations'",
")",
"if",
"res",
"and",
"res",
".",
"status_code",
"in",
"self",
"... | Return list of organizations from DCNM. | [
"Return",
"list",
"of",
"organizations",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L853-L861 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_network | def get_network(self, org, segid):
"""Return given network from DCNM.
:param org: name of organization.
:param segid: segmentation id of the network.
"""
network_info = {
'organizationName': org,
'partitionName': self._part_name,
'segmentId': ... | python | def get_network(self, org, segid):
"""Return given network from DCNM.
:param org: name of organization.
:param segid: segmentation id of the network.
"""
network_info = {
'organizationName': org,
'partitionName': self._part_name,
'segmentId': ... | [
"def",
"get_network",
"(",
"self",
",",
"org",
",",
"segid",
")",
":",
"network_info",
"=",
"{",
"'organizationName'",
":",
"org",
",",
"'partitionName'",
":",
"self",
".",
"_part_name",
",",
"'segmentId'",
":",
"segid",
",",
"}",
"res",
"=",
"self",
"."... | Return given network from DCNM.
:param org: name of organization.
:param segid: segmentation id of the network. | [
"Return",
"given",
"network",
"from",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L863-L876 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.get_version | def get_version(self):
"""Get the DCNM version."""
url = '%s://%s/rest/dcnm-version' % (self.dcnm_protocol, self._ip)
payload = {}
try:
res = self._send_request('GET', url, payload, 'dcnm-version')
if res and res.status_code in self._resp_ok:
ret... | python | def get_version(self):
"""Get the DCNM version."""
url = '%s://%s/rest/dcnm-version' % (self.dcnm_protocol, self._ip)
payload = {}
try:
res = self._send_request('GET', url, payload, 'dcnm-version')
if res and res.status_code in self._resp_ok:
ret... | [
"def",
"get_version",
"(",
"self",
")",
":",
"url",
"=",
"'%s://%s/rest/dcnm-version'",
"%",
"(",
"self",
".",
"dcnm_protocol",
",",
"self",
".",
"_ip",
")",
"payload",
"=",
"{",
"}",
"try",
":",
"res",
"=",
"self",
".",
"_send_request",
"(",
"'GET'",
... | Get the DCNM version. | [
"Get",
"the",
"DCNM",
"version",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L878-L890 |
openstack/networking-cisco | networking_cisco/apps/saf/server/cisco_dfa_rest.py | DFARESTClient.fill_urls | def fill_urls(self):
"""This assigns the URL's based on the protocol. """
protocol = self.dcnm_protocol
self._org_url = '%s://%s/rest/auto-config/organizations' % (
(protocol, self._ip))
self._create_network_url = ('%s://%s/' % (protocol, self._ip) +
... | python | def fill_urls(self):
"""This assigns the URL's based on the protocol. """
protocol = self.dcnm_protocol
self._org_url = '%s://%s/rest/auto-config/organizations' % (
(protocol, self._ip))
self._create_network_url = ('%s://%s/' % (protocol, self._ip) +
... | [
"def",
"fill_urls",
"(",
"self",
")",
":",
"protocol",
"=",
"self",
".",
"dcnm_protocol",
"self",
".",
"_org_url",
"=",
"'%s://%s/rest/auto-config/organizations'",
"%",
"(",
"(",
"protocol",
",",
"self",
".",
"_ip",
")",
")",
"self",
".",
"_create_network_url"... | This assigns the URL's based on the protocol. | [
"This",
"assigns",
"the",
"URL",
"s",
"based",
"on",
"the",
"protocol",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L923-L958 |
openstack/networking-cisco | networking_cisco/plugins/cisco/extensions/ciscohostingdevicemanager.py | Ciscohostingdevicemanager.get_resources | def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
if NEUTRON_VERSION.version[0] <= NEUTRON_NEWTON_VERSION.version[0]:
attr.PLURALS.update(plural_mappings)
action_map = {DEVICE:... | python | def get_resources(cls):
"""Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
if NEUTRON_VERSION.version[0] <= NEUTRON_NEWTON_VERSION.version[0]:
attr.PLURALS.update(plural_mappings)
action_map = {DEVICE:... | [
"def",
"get_resources",
"(",
"cls",
")",
":",
"plural_mappings",
"=",
"resource_helper",
".",
"build_plural_mappings",
"(",
"{",
"}",
",",
"RESOURCE_ATTRIBUTE_MAP",
")",
"if",
"NEUTRON_VERSION",
".",
"version",
"[",
"0",
"]",
"<=",
"NEUTRON_NEWTON_VERSION",
".",
... | Returns Ext Resources. | [
"Returns",
"Ext",
"Resources",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/extensions/ciscohostingdevicemanager.py#L232-L242 |
openstack/networking-cisco | networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py | get_inspector | def get_inspector():
"""Reuse inspector"""
global _INSPECTOR
if _INSPECTOR:
return _INSPECTOR
else:
bind = op.get_bind()
_INSPECTOR = sa.engine.reflection.Inspector.from_engine(bind)
return _INSPECTOR | python | def get_inspector():
"""Reuse inspector"""
global _INSPECTOR
if _INSPECTOR:
return _INSPECTOR
else:
bind = op.get_bind()
_INSPECTOR = sa.engine.reflection.Inspector.from_engine(bind)
return _INSPECTOR | [
"def",
"get_inspector",
"(",
")",
":",
"global",
"_INSPECTOR",
"if",
"_INSPECTOR",
":",
"return",
"_INSPECTOR",
"else",
":",
"bind",
"=",
"op",
".",
"get_bind",
"(",
")",
"_INSPECTOR",
"=",
"sa",
".",
"engine",
".",
"reflection",
".",
"Inspector",
".",
"... | Reuse inspector | [
"Reuse",
"inspector"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py#L35-L47 |
openstack/networking-cisco | networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py | get_data | def get_data():
"""Returns combined list of tuples: [(table, column)].
List is built, based on retrieved tables, where column with name
``tenant_id`` exists.
"""
output = []
tables = get_tables()
for table in tables:
columns = get_columns(table)
for column in columns:
... | python | def get_data():
"""Returns combined list of tuples: [(table, column)].
List is built, based on retrieved tables, where column with name
``tenant_id`` exists.
"""
output = []
tables = get_tables()
for table in tables:
columns = get_columns(table)
for column in columns:
... | [
"def",
"get_data",
"(",
")",
":",
"output",
"=",
"[",
"]",
"tables",
"=",
"get_tables",
"(",
")",
"for",
"table",
"in",
"tables",
":",
"columns",
"=",
"get_columns",
"(",
"table",
")",
"for",
"column",
"in",
"columns",
":",
"if",
"column",
"[",
"'nam... | Returns combined list of tuples: [(table, column)].
List is built, based on retrieved tables, where column with name
``tenant_id`` exists. | [
"Returns",
"combined",
"list",
"of",
"tuples",
":",
"[",
"(",
"table",
"column",
")",
"]",
".",
"List",
"is",
"built",
"based",
"on",
"retrieved",
"tables",
"where",
"column",
"with",
"name",
"tenant_id",
"exists",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py#L81-L96 |
openstack/networking-cisco | networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py | contract_creation_exceptions | def contract_creation_exceptions():
"""Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead.
"""
return {
sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()],
sa.Index: get_tables()
} | python | def contract_creation_exceptions():
"""Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead.
"""
return {
sa.Column: ['.'.join([table, 'project_id']) for table in get_tables()],
sa.Index: get_tables()
} | [
"def",
"contract_creation_exceptions",
"(",
")",
":",
"return",
"{",
"sa",
".",
"Column",
":",
"[",
"'.'",
".",
"join",
"(",
"[",
"table",
",",
"'project_id'",
"]",
")",
"for",
"table",
"in",
"get_tables",
"(",
")",
"]",
",",
"sa",
".",
"Index",
":",... | Special migration for the blueprint to support Keystone V3.
We drop all tenant_id columns and create project_id columns instead. | [
"Special",
"migration",
"for",
"the",
"blueprint",
"to",
"support",
"Keystone",
"V3",
".",
"We",
"drop",
"all",
"tenant_id",
"columns",
"and",
"create",
"project_id",
"columns",
"instead",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/9148d96f9b39_rename_tenantid_to_projectid.py#L133-L140 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI._agent_notification_bulk | def _agent_notification_bulk(self, context, method, routers,
hosting_device, operation):
"""Notify the Cisco cfg agent handling a particular hosting_device.
A single notification can contain multiple routers.
"""
admin_context = context.is_admin and cont... | python | def _agent_notification_bulk(self, context, method, routers,
hosting_device, operation):
"""Notify the Cisco cfg agent handling a particular hosting_device.
A single notification can contain multiple routers.
"""
admin_context = context.is_admin and cont... | [
"def",
"_agent_notification_bulk",
"(",
"self",
",",
"context",
",",
"method",
",",
"routers",
",",
"hosting_device",
",",
"operation",
")",
":",
"admin_context",
"=",
"context",
".",
"is_admin",
"and",
"context",
"or",
"context",
".",
"elevated",
"(",
")",
... | Notify the Cisco cfg agent handling a particular hosting_device.
A single notification can contain multiple routers. | [
"Notify",
"the",
"Cisco",
"cfg",
"agent",
"handling",
"a",
"particular",
"hosting_device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L43-L66 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI._notification | def _notification(self, context, method, routers, operation,
shuffle_agents):
"""Notify all or individual Cisco cfg agents."""
if extensions.is_extension_supported(self._l3plugin, L3AGENT_SCHED):
adm_context = (context.is_admin and context or context.elevated())
... | python | def _notification(self, context, method, routers, operation,
shuffle_agents):
"""Notify all or individual Cisco cfg agents."""
if extensions.is_extension_supported(self._l3plugin, L3AGENT_SCHED):
adm_context = (context.is_admin and context or context.elevated())
... | [
"def",
"_notification",
"(",
"self",
",",
"context",
",",
"method",
",",
"routers",
",",
"operation",
",",
"shuffle_agents",
")",
":",
"if",
"extensions",
".",
"is_extension_supported",
"(",
"self",
".",
"_l3plugin",
",",
"L3AGENT_SCHED",
")",
":",
"adm_contex... | Notify all or individual Cisco cfg agents. | [
"Notify",
"all",
"or",
"individual",
"Cisco",
"cfg",
"agents",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L92-L103 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI.routers_updated | def routers_updated(self, context, routers, operation=None, data=None,
shuffle_agents=False):
"""Notify cfg agents about configuration changes to routers.
This includes operations performed on the router like when a
router interface is added or removed.
"""
... | python | def routers_updated(self, context, routers, operation=None, data=None,
shuffle_agents=False):
"""Notify cfg agents about configuration changes to routers.
This includes operations performed on the router like when a
router interface is added or removed.
"""
... | [
"def",
"routers_updated",
"(",
"self",
",",
"context",
",",
"routers",
",",
"operation",
"=",
"None",
",",
"data",
"=",
"None",
",",
"shuffle_agents",
"=",
"False",
")",
":",
"if",
"routers",
":",
"self",
".",
"_notification",
"(",
"context",
",",
"'rout... | Notify cfg agents about configuration changes to routers.
This includes operations performed on the router like when a
router interface is added or removed. | [
"Notify",
"cfg",
"agents",
"about",
"configuration",
"changes",
"to",
"routers",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L110-L119 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI.router_removed_from_hosting_device | def router_removed_from_hosting_device(self, context, router):
"""Notify cfg agent about router removed from hosting device."""
self._notification(context, 'router_removed_from_hosting_device',
[router], operation=None, shuffle_agents=False) | python | def router_removed_from_hosting_device(self, context, router):
"""Notify cfg agent about router removed from hosting device."""
self._notification(context, 'router_removed_from_hosting_device',
[router], operation=None, shuffle_agents=False) | [
"def",
"router_removed_from_hosting_device",
"(",
"self",
",",
"context",
",",
"router",
")",
":",
"self",
".",
"_notification",
"(",
"context",
",",
"'router_removed_from_hosting_device'",
",",
"[",
"router",
"]",
",",
"operation",
"=",
"None",
",",
"shuffle_agen... | Notify cfg agent about router removed from hosting device. | [
"Notify",
"cfg",
"agent",
"about",
"router",
"removed",
"from",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L121-L124 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI.router_added_to_hosting_device | def router_added_to_hosting_device(self, context, router):
"""Notify cfg agent about router added to hosting device."""
self._notification(context, 'router_added_to_hosting_device',
[router], operation=None, shuffle_agents=False) | python | def router_added_to_hosting_device(self, context, router):
"""Notify cfg agent about router added to hosting device."""
self._notification(context, 'router_added_to_hosting_device',
[router], operation=None, shuffle_agents=False) | [
"def",
"router_added_to_hosting_device",
"(",
"self",
",",
"context",
",",
"router",
")",
":",
"self",
".",
"_notification",
"(",
"context",
",",
"'router_added_to_hosting_device'",
",",
"[",
"router",
"]",
",",
"operation",
"=",
"None",
",",
"shuffle_agents",
"... | Notify cfg agent about router added to hosting device. | [
"Notify",
"cfg",
"agent",
"about",
"router",
"added",
"to",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L126-L129 |
openstack/networking-cisco | networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py | L3RouterCfgAgentNotifyAPI.routers_removed_from_hosting_device | def routers_removed_from_hosting_device(self, context, router_ids,
hosting_device):
"""Notify cfg agent that routers have been removed from hosting device.
@param: context - information about tenant, user etc
@param: router-ids - list of ids
@p... | python | def routers_removed_from_hosting_device(self, context, router_ids,
hosting_device):
"""Notify cfg agent that routers have been removed from hosting device.
@param: context - information about tenant, user etc
@param: router-ids - list of ids
@p... | [
"def",
"routers_removed_from_hosting_device",
"(",
"self",
",",
"context",
",",
"router_ids",
",",
"hosting_device",
")",
":",
"self",
".",
"_agent_notification_bulk",
"(",
"context",
",",
"'router_removed_from_hosting_device'",
",",
"router_ids",
",",
"hosting_device",
... | Notify cfg agent that routers have been removed from hosting device.
@param: context - information about tenant, user etc
@param: router-ids - list of ids
@param: hosting_device - device hosting the routers | [
"Notify",
"cfg",
"agent",
"that",
"routers",
"have",
"been",
"removed",
"from",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_rpc_cfg_agent_api.py#L131-L140 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_listen_dcnm.py | DCNMListener._cb_dcnm_msg | def _cb_dcnm_msg(self, method, body):
"""Callback function to process DCNM network creation/update/deletion
message received by AMQP.
It also communicates with DCNM to extract info for CPNR record
insertion/deletion.
:param pika.channel.Channel ch: The channel instance.
... | python | def _cb_dcnm_msg(self, method, body):
"""Callback function to process DCNM network creation/update/deletion
message received by AMQP.
It also communicates with DCNM to extract info for CPNR record
insertion/deletion.
:param pika.channel.Channel ch: The channel instance.
... | [
"def",
"_cb_dcnm_msg",
"(",
"self",
",",
"method",
",",
"body",
")",
":",
"LOG",
".",
"debug",
"(",
"'Routing_key: %(key)s, body: %(body)s.'",
",",
"{",
"'key'",
":",
"method",
".",
"routing_key",
",",
"'body'",
":",
"body",
"}",
")",
"partition_keyword",
"=... | Callback function to process DCNM network creation/update/deletion
message received by AMQP.
It also communicates with DCNM to extract info for CPNR record
insertion/deletion.
:param pika.channel.Channel ch: The channel instance.
:param pika.Spec.Basic.Deliver method: The basic... | [
"Callback",
"function",
"to",
"process",
"DCNM",
"network",
"creation",
"/",
"update",
"/",
"deletion",
"message",
"received",
"by",
"AMQP",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_listen_dcnm.py#L102-L147 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_listen_dcnm.py | DCNMListener.process_amqp_msgs | def process_amqp_msgs(self):
"""Process AMQP queue messages.
It connects to AMQP server and calls callbacks to process DCNM events,
i.e. routing key containing '.cisco.dcnm.', once they arrive in the
queue.
"""
LOG.info('Starting process_amqp_msgs...')
while Tru... | python | def process_amqp_msgs(self):
"""Process AMQP queue messages.
It connects to AMQP server and calls callbacks to process DCNM events,
i.e. routing key containing '.cisco.dcnm.', once they arrive in the
queue.
"""
LOG.info('Starting process_amqp_msgs...')
while Tru... | [
"def",
"process_amqp_msgs",
"(",
"self",
")",
":",
"LOG",
".",
"info",
"(",
"'Starting process_amqp_msgs...'",
")",
"while",
"True",
":",
"(",
"mtd_fr",
",",
"hdr_fr",
",",
"body",
")",
"=",
"(",
"None",
",",
"None",
",",
"None",
")",
"try",
":",
"if",... | Process AMQP queue messages.
It connects to AMQP server and calls callbacks to process DCNM events,
i.e. routing key containing '.cisco.dcnm.', once they arrive in the
queue. | [
"Process",
"AMQP",
"queue",
"messages",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_listen_dcnm.py#L149-L184 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | _is_pingable | def _is_pingable(ip):
"""Checks whether an IP address is reachable by pinging.
Use linux utils to execute the ping (ICMP ECHO) command.
Sends 5 packets with an interval of 0.2 seconds and timeout of 1
seconds. Runtime error implies unreachability else IP is pingable.
:param ip: IP to check
:ret... | python | def _is_pingable(ip):
"""Checks whether an IP address is reachable by pinging.
Use linux utils to execute the ping (ICMP ECHO) command.
Sends 5 packets with an interval of 0.2 seconds and timeout of 1
seconds. Runtime error implies unreachability else IP is pingable.
:param ip: IP to check
:ret... | [
"def",
"_is_pingable",
"(",
"ip",
")",
":",
"ping_cmd",
"=",
"[",
"'ping'",
",",
"'-c'",
",",
"'5'",
",",
"'-W'",
",",
"'1'",
",",
"'-i'",
",",
"'0.2'",
",",
"ip",
"]",
"try",
":",
"linux_utils",
".",
"execute",
"(",
"ping_cmd",
",",
"check_exit_code... | Checks whether an IP address is reachable by pinging.
Use linux utils to execute the ping (ICMP ECHO) command.
Sends 5 packets with an interval of 0.2 seconds and timeout of 1
seconds. Runtime error implies unreachability else IP is pingable.
:param ip: IP to check
:return: bool - True or False dep... | [
"Checks",
"whether",
"an",
"IP",
"address",
"is",
"reachable",
"by",
"pinging",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L46-L65 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | _can_connect | def _can_connect(ip, port):
"""Checks if a TCP port at IP address is possible to connect to"""
cs = socket.socket()
try:
cs.connect((ip, port))
cs.close()
return True
except socket.error:
return False | python | def _can_connect(ip, port):
"""Checks if a TCP port at IP address is possible to connect to"""
cs = socket.socket()
try:
cs.connect((ip, port))
cs.close()
return True
except socket.error:
return False | [
"def",
"_can_connect",
"(",
"ip",
",",
"port",
")",
":",
"cs",
"=",
"socket",
".",
"socket",
"(",
")",
"try",
":",
"cs",
".",
"connect",
"(",
"(",
"ip",
",",
"port",
")",
")",
"cs",
".",
"close",
"(",
")",
"return",
"True",
"except",
"socket",
... | Checks if a TCP port at IP address is possible to connect to | [
"Checks",
"if",
"a",
"TCP",
"port",
"at",
"IP",
"address",
"is",
"possible",
"to",
"connect",
"to"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L68-L76 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | DeviceStatus.get_dead_hosting_devices_info | def get_dead_hosting_devices_info(self):
"""
Get a list of hosting devices that have been marked dead
:return: List of dead hosting device ids
"""
res = []
for hd_id in self.hosting_devices_backlog:
hd = self.hosting_devices_backlog[hd_id]['hd']
if... | python | def get_dead_hosting_devices_info(self):
"""
Get a list of hosting devices that have been marked dead
:return: List of dead hosting device ids
"""
res = []
for hd_id in self.hosting_devices_backlog:
hd = self.hosting_devices_backlog[hd_id]['hd']
if... | [
"def",
"get_dead_hosting_devices_info",
"(",
"self",
")",
":",
"res",
"=",
"[",
"]",
"for",
"hd_id",
"in",
"self",
".",
"hosting_devices_backlog",
":",
"hd",
"=",
"self",
".",
"hosting_devices_backlog",
"[",
"hd_id",
"]",
"[",
"'hd'",
"]",
"if",
"hd",
"[",... | Get a list of hosting devices that have been marked dead
:return: List of dead hosting device ids | [
"Get",
"a",
"list",
"of",
"hosting",
"devices",
"that",
"have",
"been",
"marked",
"dead",
":",
"return",
":",
"List",
"of",
"dead",
"hosting",
"device",
"ids"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L122-L132 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | DeviceStatus.get_monitored_hosting_devices_info | def get_monitored_hosting_devices_info(self, hd_state_filter=None):
"""
This function returns a list of all hosting devices monitored
by this agent
"""
wait_time = datetime.timedelta(
seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout)
resp = []
fo... | python | def get_monitored_hosting_devices_info(self, hd_state_filter=None):
"""
This function returns a list of all hosting devices monitored
by this agent
"""
wait_time = datetime.timedelta(
seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout)
resp = []
fo... | [
"def",
"get_monitored_hosting_devices_info",
"(",
"self",
",",
"hd_state_filter",
"=",
"None",
")",
":",
"wait_time",
"=",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"cfg",
".",
"CONF",
".",
"cfg_agent",
".",
"hosting_device_dead_timeout",
")",
"resp",
"... | This function returns a list of all hosting devices monitored
by this agent | [
"This",
"function",
"returns",
"a",
"list",
"of",
"all",
"hosting",
"devices",
"monitored",
"by",
"this",
"agent"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L134-L167 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | DeviceStatus.is_hosting_device_reachable | def is_hosting_device_reachable(self, hosting_device):
"""Check the hosting device which hosts this resource is reachable.
If the resource is not reachable, it is added to the backlog.
* heartbeat revision
We want to enqueue all hosting-devices into the backlog for
monitoring ... | python | def is_hosting_device_reachable(self, hosting_device):
"""Check the hosting device which hosts this resource is reachable.
If the resource is not reachable, it is added to the backlog.
* heartbeat revision
We want to enqueue all hosting-devices into the backlog for
monitoring ... | [
"def",
"is_hosting_device_reachable",
"(",
"self",
",",
"hosting_device",
")",
":",
"ret_val",
"=",
"False",
"hd",
"=",
"hosting_device",
"hd_id",
"=",
"hosting_device",
"[",
"'id'",
"]",
"hd_mgmt_ip",
"=",
"hosting_device",
"[",
"'management_ip_address'",
"]",
"d... | Check the hosting device which hosts this resource is reachable.
If the resource is not reachable, it is added to the backlog.
* heartbeat revision
We want to enqueue all hosting-devices into the backlog for
monitoring purposes
adds key/value pairs to hd (aka hosting_device ... | [
"Check",
"the",
"hosting",
"device",
"which",
"hosts",
"this",
"resource",
"is",
"reachable",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L169-L221 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_status.py | DeviceStatus.check_backlogged_hosting_devices | def check_backlogged_hosting_devices(self, driver_mgr):
"""Checks the status of backlogged hosting devices.
Skips newly spun up instances during their booting time as specified
in the boot time parameter.
Each hosting-device tracked has a key, hd_state, that represents the
last... | python | def check_backlogged_hosting_devices(self, driver_mgr):
"""Checks the status of backlogged hosting devices.
Skips newly spun up instances during their booting time as specified
in the boot time parameter.
Each hosting-device tracked has a key, hd_state, that represents the
last... | [
"def",
"check_backlogged_hosting_devices",
"(",
"self",
",",
"driver_mgr",
")",
":",
"response_dict",
"=",
"{",
"'reachable'",
":",
"[",
"]",
",",
"'revived'",
":",
"[",
"]",
",",
"'dead'",
":",
"[",
"]",
"}",
"LOG",
".",
"debug",
"(",
"\"Current Backlogge... | Checks the status of backlogged hosting devices.
Skips newly spun up instances during their booting time as specified
in the boot time parameter.
Each hosting-device tracked has a key, hd_state, that represents the
last known state for the hosting device. Valid values for hd_state
... | [
"Checks",
"the",
"status",
"of",
"backlogged",
"hosting",
"devices",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_status.py#L223-L344 |
openstack/networking-cisco | networking_cisco/plugins/cisco/service_plugins/cisco_router_plugin.py | CiscoRouterPlugin.create_floatingip | def create_floatingip(self, context, floatingip):
"""Create floating IP.
:param context: Neutron request context
:param floatingip: data for the floating IP being created
:returns: A floating IP object on success
As the l3 router plugin asynchronously creates floating IPs
... | python | def create_floatingip(self, context, floatingip):
"""Create floating IP.
:param context: Neutron request context
:param floatingip: data for the floating IP being created
:returns: A floating IP object on success
As the l3 router plugin asynchronously creates floating IPs
... | [
"def",
"create_floatingip",
"(",
"self",
",",
"context",
",",
"floatingip",
")",
":",
"return",
"super",
"(",
"CiscoRouterPlugin",
",",
"self",
")",
".",
"create_floatingip",
"(",
"context",
",",
"floatingip",
",",
"initial_status",
"=",
"bc",
".",
"constants"... | Create floating IP.
:param context: Neutron request context
:param floatingip: data for the floating IP being created
:returns: A floating IP object on success
As the l3 router plugin asynchronously creates floating IPs
leveraging the l3 agent and l3 cfg agent, the initial stat... | [
"Create",
"floating",
"IP",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/service_plugins/cisco_router_plugin.py#L109-L122 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.attach_intf_router | def attach_intf_router(self, tenant_id, tenant_name, router_id):
"""Routine to attach the interface to the router. """
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
# Modify Hard coded Name fixme
subnet_lst = set()
subnet_lst.add(in... | python | def attach_intf_router(self, tenant_id, tenant_name, router_id):
"""Routine to attach the interface to the router. """
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
# Modify Hard coded Name fixme
subnet_lst = set()
subnet_lst.add(in... | [
"def",
"attach_intf_router",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"router_id",
")",
":",
"in_sub",
"=",
"self",
".",
"get_in_subnet_id",
"(",
"tenant_id",
")",
"out_sub",
"=",
"self",
".",
"get_out_subnet_id",
"(",
"tenant_id",
")",
"# Modif... | Routine to attach the interface to the router. | [
"Routine",
"to",
"attach",
"the",
"interface",
"to",
"the",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L82-L91 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.get_router_id | def get_router_id(self, tenant_id, tenant_name):
"""Retrieve the router ID. """
router_id = None
if tenant_id in self.tenant_dict:
router_id = self.tenant_dict.get(tenant_id).get('router_id')
if not router_id:
router_list = self.os_helper.get_rtr_by_name(
... | python | def get_router_id(self, tenant_id, tenant_name):
"""Retrieve the router ID. """
router_id = None
if tenant_id in self.tenant_dict:
router_id = self.tenant_dict.get(tenant_id).get('router_id')
if not router_id:
router_list = self.os_helper.get_rtr_by_name(
... | [
"def",
"get_router_id",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"router_id",
"=",
"None",
"if",
"tenant_id",
"in",
"self",
".",
"tenant_dict",
":",
"router_id",
"=",
"self",
".",
"tenant_dict",
".",
"get",
"(",
"tenant_id",
")",
".",
... | Retrieve the router ID. | [
"Retrieve",
"the",
"router",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L93-L103 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.delete_intf_router | def delete_intf_router(self, tenant_id, tenant_name, router_id):
"""Routine to delete the router. """
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
subnet_lst = set()
subnet_lst.add(in_sub)
subnet_lst.add(out_sub)
router_id ... | python | def delete_intf_router(self, tenant_id, tenant_name, router_id):
"""Routine to delete the router. """
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
subnet_lst = set()
subnet_lst.add(in_sub)
subnet_lst.add(out_sub)
router_id ... | [
"def",
"delete_intf_router",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"router_id",
")",
":",
"in_sub",
"=",
"self",
".",
"get_in_subnet_id",
"(",
"tenant_id",
")",
"out_sub",
"=",
"self",
".",
"get_out_subnet_id",
"(",
"tenant_id",
")",
"subnet_... | Routine to delete the router. | [
"Routine",
"to",
"delete",
"the",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L105-L122 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.prepare_router_vm_msg | def prepare_router_vm_msg(self, tenant_id, tenant_name, router_id, net_id,
subnet_id, seg, status):
"""Prepare the message to be sent to Event queue for VDP trigger.
This is actually called for a subnet add to a router. This function
prepares a VM's VNIC create/del... | python | def prepare_router_vm_msg(self, tenant_id, tenant_name, router_id, net_id,
subnet_id, seg, status):
"""Prepare the message to be sent to Event queue for VDP trigger.
This is actually called for a subnet add to a router. This function
prepares a VM's VNIC create/del... | [
"def",
"prepare_router_vm_msg",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"router_id",
",",
"net_id",
",",
"subnet_id",
",",
"seg",
",",
"status",
")",
":",
"max_get_router_info_retry",
"=",
"True",
"attempt",
"=",
"0",
"while",
"max_get_router_inf... | Prepare the message to be sent to Event queue for VDP trigger.
This is actually called for a subnet add to a router. This function
prepares a VM's VNIC create/delete message. | [
"Prepare",
"the",
"message",
"to",
"be",
"sent",
"to",
"Event",
"queue",
"for",
"VDP",
"trigger",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L124-L173 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.send_router_port_msg | def send_router_port_msg(self, tenant_id, tenant_name, router_id, net_id,
subnet_id, seg, status):
"""Sends the router port message to the queue. """
data = self.prepare_router_vm_msg(tenant_id, tenant_name, router_id,
net_id, subnet... | python | def send_router_port_msg(self, tenant_id, tenant_name, router_id, net_id,
subnet_id, seg, status):
"""Sends the router port message to the queue. """
data = self.prepare_router_vm_msg(tenant_id, tenant_name, router_id,
net_id, subnet... | [
"def",
"send_router_port_msg",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"router_id",
",",
"net_id",
",",
"subnet_id",
",",
"seg",
",",
"status",
")",
":",
"data",
"=",
"self",
".",
"prepare_router_vm_msg",
"(",
"tenant_id",
",",
"tenant_name",
... | Sends the router port message to the queue. | [
"Sends",
"the",
"router",
"port",
"message",
"to",
"the",
"queue",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L175-L187 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.update_dcnm_partition_static_route | def update_dcnm_partition_static_route(self, tenant_id, arg_dict):
"""Add static route in DCNM's partition.
This gets pushed to the relevant leaf switches.
"""
ip_list = self.os_helper.get_subnet_nwk_excl(tenant_id,
arg_dict.get('excl... | python | def update_dcnm_partition_static_route(self, tenant_id, arg_dict):
"""Add static route in DCNM's partition.
This gets pushed to the relevant leaf switches.
"""
ip_list = self.os_helper.get_subnet_nwk_excl(tenant_id,
arg_dict.get('excl... | [
"def",
"update_dcnm_partition_static_route",
"(",
"self",
",",
"tenant_id",
",",
"arg_dict",
")",
":",
"ip_list",
"=",
"self",
".",
"os_helper",
".",
"get_subnet_nwk_excl",
"(",
"tenant_id",
",",
"arg_dict",
".",
"get",
"(",
"'excl_list'",
")",
")",
"srvc_node_i... | Add static route in DCNM's partition.
This gets pushed to the relevant leaf switches. | [
"Add",
"static",
"route",
"in",
"DCNM",
"s",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L275-L293 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall._create_arg_dict | def _create_arg_dict(self, tenant_id, data, in_sub, out_sub):
"""Create the argument dictionary. """
in_seg, in_vlan = self.get_in_seg_vlan(tenant_id)
out_seg, out_vlan = self.get_out_seg_vlan(tenant_id)
in_ip_dict = self.get_in_ip_addr(tenant_id)
out_ip_dict = self.get_out_ip_ad... | python | def _create_arg_dict(self, tenant_id, data, in_sub, out_sub):
"""Create the argument dictionary. """
in_seg, in_vlan = self.get_in_seg_vlan(tenant_id)
out_seg, out_vlan = self.get_out_seg_vlan(tenant_id)
in_ip_dict = self.get_in_ip_addr(tenant_id)
out_ip_dict = self.get_out_ip_ad... | [
"def",
"_create_arg_dict",
"(",
"self",
",",
"tenant_id",
",",
"data",
",",
"in_sub",
",",
"out_sub",
")",
":",
"in_seg",
",",
"in_vlan",
"=",
"self",
".",
"get_in_seg_vlan",
"(",
"tenant_id",
")",
"out_seg",
",",
"out_vlan",
"=",
"self",
".",
"get_out_seg... | Create the argument dictionary. | [
"Create",
"the",
"argument",
"dictionary",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L295-L312 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall._create_fw | def _create_fw(self, tenant_id, data):
"""Internal routine that gets called when a FW is created. """
LOG.debug("In creating Native FW data is %s", data)
# TODO(padkrish):
# Check if router is already added and only then add, needed for
# restart cases since native doesn't have a... | python | def _create_fw(self, tenant_id, data):
"""Internal routine that gets called when a FW is created. """
LOG.debug("In creating Native FW data is %s", data)
# TODO(padkrish):
# Check if router is already added and only then add, needed for
# restart cases since native doesn't have a... | [
"def",
"_create_fw",
"(",
"self",
",",
"tenant_id",
",",
"data",
")",
":",
"LOG",
".",
"debug",
"(",
"\"In creating Native FW data is %s\"",
",",
"data",
")",
"# TODO(padkrish):",
"# Check if router is already added and only then add, needed for",
"# restart cases since nativ... | Internal routine that gets called when a FW is created. | [
"Internal",
"routine",
"that",
"gets",
"called",
"when",
"a",
"FW",
"is",
"created",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L314-L352 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.create_fw | def create_fw(self, tenant_id, data):
"""Top level routine called when a FW is created. """
try:
return self._create_fw(tenant_id, data)
except Exception as exc:
LOG.error("Failed to create FW for device native, tenant "
"%(tenant)s data %(data)s Exc... | python | def create_fw(self, tenant_id, data):
"""Top level routine called when a FW is created. """
try:
return self._create_fw(tenant_id, data)
except Exception as exc:
LOG.error("Failed to create FW for device native, tenant "
"%(tenant)s data %(data)s Exc... | [
"def",
"create_fw",
"(",
"self",
",",
"tenant_id",
",",
"data",
")",
":",
"try",
":",
"return",
"self",
".",
"_create_fw",
"(",
"tenant_id",
",",
"data",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"error",
"(",
"\"Failed to create FW for dev... | Top level routine called when a FW is created. | [
"Top",
"level",
"routine",
"called",
"when",
"a",
"FW",
"is",
"created",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L354-L362 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall._delete_fw | def _delete_fw(self, tenant_id, data):
"""Internal routine called when a FW is deleted. """
LOG.debug("In Delete fw data is %s", data)
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
arg_dict = self._create_arg_dict(tenant_id, data, in_sub, o... | python | def _delete_fw(self, tenant_id, data):
"""Internal routine called when a FW is deleted. """
LOG.debug("In Delete fw data is %s", data)
in_sub = self.get_in_subnet_id(tenant_id)
out_sub = self.get_out_subnet_id(tenant_id)
arg_dict = self._create_arg_dict(tenant_id, data, in_sub, o... | [
"def",
"_delete_fw",
"(",
"self",
",",
"tenant_id",
",",
"data",
")",
":",
"LOG",
".",
"debug",
"(",
"\"In Delete fw data is %s\"",
",",
"data",
")",
"in_sub",
"=",
"self",
".",
"get_in_subnet_id",
"(",
"tenant_id",
")",
"out_sub",
"=",
"self",
".",
"get_o... | Internal routine called when a FW is deleted. | [
"Internal",
"routine",
"called",
"when",
"a",
"FW",
"is",
"deleted",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L364-L393 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.delete_fw | def delete_fw(self, tenant_id, data):
"""Top level routine called when a FW is deleted. """
try:
ret = self._delete_fw(tenant_id, data)
return ret
except Exception as exc:
LOG.error("Failed to delete FW for device native, tenant "
"%(tena... | python | def delete_fw(self, tenant_id, data):
"""Top level routine called when a FW is deleted. """
try:
ret = self._delete_fw(tenant_id, data)
return ret
except Exception as exc:
LOG.error("Failed to delete FW for device native, tenant "
"%(tena... | [
"def",
"delete_fw",
"(",
"self",
",",
"tenant_id",
",",
"data",
")",
":",
"try",
":",
"ret",
"=",
"self",
".",
"_delete_fw",
"(",
"tenant_id",
",",
"data",
")",
"return",
"ret",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"error",
"(",
"\"Fa... | Top level routine called when a FW is deleted. | [
"Top",
"level",
"routine",
"called",
"when",
"a",
"FW",
"is",
"deleted",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L395-L404 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall._program_dcnm_static_route | def _program_dcnm_static_route(self, tenant_id, tenant_name):
"""Program DCNM Static Route. """
in_ip_dict = self.get_in_ip_addr(tenant_id)
in_gw = in_ip_dict.get('gateway')
in_ip = in_ip_dict.get('subnet')
if in_gw is None:
LOG.error("No FW service GW present")
... | python | def _program_dcnm_static_route(self, tenant_id, tenant_name):
"""Program DCNM Static Route. """
in_ip_dict = self.get_in_ip_addr(tenant_id)
in_gw = in_ip_dict.get('gateway')
in_ip = in_ip_dict.get('subnet')
if in_gw is None:
LOG.error("No FW service GW present")
... | [
"def",
"_program_dcnm_static_route",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"in_ip_dict",
"=",
"self",
".",
"get_in_ip_addr",
"(",
"tenant_id",
")",
"in_gw",
"=",
"in_ip_dict",
".",
"get",
"(",
"'gateway'",
")",
"in_ip",
"=",
"in_ip_dict"... | Program DCNM Static Route. | [
"Program",
"DCNM",
"Static",
"Route",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L414-L443 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.network_create_notif | def network_create_notif(self, tenant_id, tenant_name, cidr):
"""Tenant Network create Notification.
Restart is not supported currently for this. fixme(padkrish).
"""
router_id = self.get_router_id(tenant_id, tenant_name)
if not router_id:
LOG.error("Rout ID not pres... | python | def network_create_notif(self, tenant_id, tenant_name, cidr):
"""Tenant Network create Notification.
Restart is not supported currently for this. fixme(padkrish).
"""
router_id = self.get_router_id(tenant_id, tenant_name)
if not router_id:
LOG.error("Rout ID not pres... | [
"def",
"network_create_notif",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"cidr",
")",
":",
"router_id",
"=",
"self",
".",
"get_router_id",
"(",
"tenant_id",
",",
"tenant_name",
")",
"if",
"not",
"router_id",
":",
"LOG",
".",
"error",
"(",
"\"... | Tenant Network create Notification.
Restart is not supported currently for this. fixme(padkrish). | [
"Tenant",
"Network",
"create",
"Notification",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L445-L472 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py | NativeFirewall.network_delete_notif | def network_delete_notif(self, tenant_id, tenant_name, network_id):
"""Tenant Network delete Notification.
Restart is not supported currently for this. fixme(padkrish).
"""
router_id = self.get_router_id(tenant_id, tenant_name)
if router_id is None:
LOG.error("Rout I... | python | def network_delete_notif(self, tenant_id, tenant_name, network_id):
"""Tenant Network delete Notification.
Restart is not supported currently for this. fixme(padkrish).
"""
router_id = self.get_router_id(tenant_id, tenant_name)
if router_id is None:
LOG.error("Rout I... | [
"def",
"network_delete_notif",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"network_id",
")",
":",
"router_id",
"=",
"self",
".",
"get_router_id",
"(",
"tenant_id",
",",
"tenant_name",
")",
"if",
"router_id",
"is",
"None",
":",
"LOG",
".",
"error... | Tenant Network delete Notification.
Restart is not supported currently for this. fixme(padkrish). | [
"Tenant",
"Network",
"delete",
"Notification",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/native.py#L474-L510 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.create_hosting_device_resources | def create_hosting_device_resources(self, context, complementary_id,
tenant_id, mgmt_context, max_hosted):
"""Create resources for a hosting device in a plugin specific way."""
mgmt_port = None
if mgmt_context and mgmt_context.get('mgmt_nw_id') and tenant_... | python | def create_hosting_device_resources(self, context, complementary_id,
tenant_id, mgmt_context, max_hosted):
"""Create resources for a hosting device in a plugin specific way."""
mgmt_port = None
if mgmt_context and mgmt_context.get('mgmt_nw_id') and tenant_... | [
"def",
"create_hosting_device_resources",
"(",
"self",
",",
"context",
",",
"complementary_id",
",",
"tenant_id",
",",
"mgmt_context",
",",
"max_hosted",
")",
":",
"mgmt_port",
"=",
"None",
"if",
"mgmt_context",
"and",
"mgmt_context",
".",
"get",
"(",
"'mgmt_nw_id... | Create resources for a hosting device in a plugin specific way. | [
"Create",
"resources",
"for",
"a",
"hosting",
"device",
"in",
"a",
"plugin",
"specific",
"way",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L59-L86 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.get_hosting_device_resources | def get_hosting_device_resources(self, context, id, complementary_id,
tenant_id, mgmt_nw_id):
"""Returns information about all resources for a hosting device."""
mgmt_port = None
# Ports for hosting device may not yet have 'device_id' set to
# Nova as... | python | def get_hosting_device_resources(self, context, id, complementary_id,
tenant_id, mgmt_nw_id):
"""Returns information about all resources for a hosting device."""
mgmt_port = None
# Ports for hosting device may not yet have 'device_id' set to
# Nova as... | [
"def",
"get_hosting_device_resources",
"(",
"self",
",",
"context",
",",
"id",
",",
"complementary_id",
",",
"tenant_id",
",",
"mgmt_nw_id",
")",
":",
"mgmt_port",
"=",
"None",
"# Ports for hosting device may not yet have 'device_id' set to",
"# Nova assigned uuid of VM insta... | Returns information about all resources for a hosting device. | [
"Returns",
"information",
"about",
"all",
"resources",
"for",
"a",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L88-L105 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.delete_hosting_device_resources | def delete_hosting_device_resources(self, context, tenant_id, mgmt_port,
**kwargs):
"""Deletes resources for a hosting device in a plugin specific way."""
if mgmt_port is not None:
try:
self._cleanup_hosting_port(context, mgmt_port['id... | python | def delete_hosting_device_resources(self, context, tenant_id, mgmt_port,
**kwargs):
"""Deletes resources for a hosting device in a plugin specific way."""
if mgmt_port is not None:
try:
self._cleanup_hosting_port(context, mgmt_port['id... | [
"def",
"delete_hosting_device_resources",
"(",
"self",
",",
"context",
",",
"tenant_id",
",",
"mgmt_port",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mgmt_port",
"is",
"not",
"None",
":",
"try",
":",
"self",
".",
"_cleanup_hosting_port",
"(",
"context",
",",
... | Deletes resources for a hosting device in a plugin specific way. | [
"Deletes",
"resources",
"for",
"a",
"hosting",
"device",
"in",
"a",
"plugin",
"specific",
"way",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L107-L119 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.setup_logical_port_connectivity | def setup_logical_port_connectivity(self, context, port_db,
hosting_device_id):
"""Establishes connectivity for a logical port.
This is done by hot plugging the interface(VIF) corresponding to the
port from the VM.
"""
hosting_port = port_... | python | def setup_logical_port_connectivity(self, context, port_db,
hosting_device_id):
"""Establishes connectivity for a logical port.
This is done by hot plugging the interface(VIF) corresponding to the
port from the VM.
"""
hosting_port = port_... | [
"def",
"setup_logical_port_connectivity",
"(",
"self",
",",
"context",
",",
"port_db",
",",
"hosting_device_id",
")",
":",
"hosting_port",
"=",
"port_db",
".",
"hosting_info",
".",
"hosting_port",
"if",
"hosting_port",
":",
"try",
":",
"self",
".",
"_dev_mgr",
"... | Establishes connectivity for a logical port.
This is done by hot plugging the interface(VIF) corresponding to the
port from the VM. | [
"Establishes",
"connectivity",
"for",
"a",
"logical",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L164-L189 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.teardown_logical_port_connectivity | def teardown_logical_port_connectivity(self, context, port_db,
hosting_device_id):
"""Removes connectivity for a logical port.
Unplugs the corresponding data interface from the VM.
"""
if port_db is None or port_db.get('id') is None:
... | python | def teardown_logical_port_connectivity(self, context, port_db,
hosting_device_id):
"""Removes connectivity for a logical port.
Unplugs the corresponding data interface from the VM.
"""
if port_db is None or port_db.get('id') is None:
... | [
"def",
"teardown_logical_port_connectivity",
"(",
"self",
",",
"context",
",",
"port_db",
",",
"hosting_device_id",
")",
":",
"if",
"port_db",
"is",
"None",
"or",
"port_db",
".",
"get",
"(",
"'id'",
")",
"is",
"None",
":",
"LOG",
".",
"warning",
"(",
"\"Po... | Removes connectivity for a logical port.
Unplugs the corresponding data interface from the VM. | [
"Removes",
"connectivity",
"for",
"a",
"logical",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L191-L214 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py | VIFHotPlugPluggingDriver.allocate_hosting_port | def allocate_hosting_port(self, context, router_id, port_db, network_type,
hosting_device_id):
"""Allocates a hosting port for a logical port.
We create a hosting port for the router port
"""
l3admin_tenant_id = self._dev_mgr.l3_tenant_id()
hostingp... | python | def allocate_hosting_port(self, context, router_id, port_db, network_type,
hosting_device_id):
"""Allocates a hosting port for a logical port.
We create a hosting port for the router port
"""
l3admin_tenant_id = self._dev_mgr.l3_tenant_id()
hostingp... | [
"def",
"allocate_hosting_port",
"(",
"self",
",",
"context",
",",
"router_id",
",",
"port_db",
",",
"network_type",
",",
"hosting_device_id",
")",
":",
"l3admin_tenant_id",
"=",
"self",
".",
"_dev_mgr",
".",
"l3_tenant_id",
"(",
")",
"hostingport_name",
"=",
"'h... | Allocates a hosting port for a logical port.
We create a hosting port for the router port | [
"Allocates",
"a",
"hosting",
"port",
"for",
"a",
"logical",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L221-L252 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/dhcp_driver.py | RemoteServerDriver.disable | def disable(self, retain_port=False):
"""Teardown DHCP.
Disable DHCP for this network by updating the remote server
and then destroying any local device and namespace.
"""
self.update_server(disabled=True)
if retain_port:
return
self.update_device(dis... | python | def disable(self, retain_port=False):
"""Teardown DHCP.
Disable DHCP for this network by updating the remote server
and then destroying any local device and namespace.
"""
self.update_server(disabled=True)
if retain_port:
return
self.update_device(dis... | [
"def",
"disable",
"(",
"self",
",",
"retain_port",
"=",
"False",
")",
":",
"self",
".",
"update_server",
"(",
"disabled",
"=",
"True",
")",
"if",
"retain_port",
":",
"return",
"self",
".",
"update_device",
"(",
"disabled",
"=",
"True",
")",
"if",
"self",... | Teardown DHCP.
Disable DHCP for this network by updating the remote server
and then destroying any local device and namespace. | [
"Teardown",
"DHCP",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/dhcp_driver.py#L98-L115 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/dhcp_driver.py | RemoteServerDriver.recover_devices | def recover_devices(cls):
"""Track devices.
Creates global dict to track device names across driver invocations
and populates based on current devices configured on the system.
"""
if "_devices" in globals():
return
global _devices
confs_dir = os.pa... | python | def recover_devices(cls):
"""Track devices.
Creates global dict to track device names across driver invocations
and populates based on current devices configured on the system.
"""
if "_devices" in globals():
return
global _devices
confs_dir = os.pa... | [
"def",
"recover_devices",
"(",
"cls",
")",
":",
"if",
"\"_devices\"",
"in",
"globals",
"(",
")",
":",
"return",
"global",
"_devices",
"confs_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"cfg",
".",
"CONF",... | Track devices.
Creates global dict to track device names across driver invocations
and populates based on current devices configured on the system. | [
"Track",
"devices",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/dhcp_driver.py#L160-L183 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/dhcp_driver.py | SimpleCpnrDriver.check_version | def check_version(cls):
"""Checks server version against minimum required version."""
super(SimpleCpnrDriver, cls).check_version()
model.configure_pnr()
cls.recover_networks()
ver = model.get_version()
if ver < cls.MIN_VERSION:
LOG.warning("CPNR version does n... | python | def check_version(cls):
"""Checks server version against minimum required version."""
super(SimpleCpnrDriver, cls).check_version()
model.configure_pnr()
cls.recover_networks()
ver = model.get_version()
if ver < cls.MIN_VERSION:
LOG.warning("CPNR version does n... | [
"def",
"check_version",
"(",
"cls",
")",
":",
"super",
"(",
"SimpleCpnrDriver",
",",
"cls",
")",
".",
"check_version",
"(",
")",
"model",
".",
"configure_pnr",
"(",
")",
"cls",
".",
"recover_networks",
"(",
")",
"ver",
"=",
"model",
".",
"get_version",
"... | Checks server version against minimum required version. | [
"Checks",
"server",
"version",
"against",
"minimum",
"required",
"version",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/dhcp_driver.py#L263-L273 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/dhcp_driver.py | SimpleCpnrDriver.existing_dhcp_networks | def existing_dhcp_networks(cls, conf):
"""Return a list of existing networks ids that we have configs for."""
global _networks
sup = super(SimpleCpnrDriver, cls)
superkeys = sup.existing_dhcp_networks(conf)
return set(_networks.keys()) & set(superkeys) | python | def existing_dhcp_networks(cls, conf):
"""Return a list of existing networks ids that we have configs for."""
global _networks
sup = super(SimpleCpnrDriver, cls)
superkeys = sup.existing_dhcp_networks(conf)
return set(_networks.keys()) & set(superkeys) | [
"def",
"existing_dhcp_networks",
"(",
"cls",
",",
"conf",
")",
":",
"global",
"_networks",
"sup",
"=",
"super",
"(",
"SimpleCpnrDriver",
",",
"cls",
")",
"superkeys",
"=",
"sup",
".",
"existing_dhcp_networks",
"(",
"conf",
")",
"return",
"set",
"(",
"_networ... | Return a list of existing networks ids that we have configs for. | [
"Return",
"a",
"list",
"of",
"existing",
"networks",
"ids",
"that",
"we",
"have",
"configs",
"for",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/dhcp_driver.py#L276-L281 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/dhcp_driver.py | SimpleCpnrDriver._unsafe_update_server | def _unsafe_update_server(self, disabled=False):
"""Update server with latest network configuration."""
id = self.network.id
net = model.Network.from_neutron(self.network)
if id not in _networks:
if disabled:
return
_networks[id] = net
... | python | def _unsafe_update_server(self, disabled=False):
"""Update server with latest network configuration."""
id = self.network.id
net = model.Network.from_neutron(self.network)
if id not in _networks:
if disabled:
return
_networks[id] = net
... | [
"def",
"_unsafe_update_server",
"(",
"self",
",",
"disabled",
"=",
"False",
")",
":",
"id",
"=",
"self",
".",
"network",
".",
"id",
"net",
"=",
"model",
".",
"Network",
".",
"from_neutron",
"(",
"self",
".",
"network",
")",
"if",
"id",
"not",
"in",
"... | Update server with latest network configuration. | [
"Update",
"server",
"with",
"latest",
"network",
"configuration",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/dhcp_driver.py#L291-L305 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.create_network | def create_network(self, name, tenant_id, subnet, gw=None):
"""Create the openstack network, including the subnet. """
try:
body = {'network': {'name': name, 'tenant_id': tenant_id,
'admin_state_up': True}}
netw = self.neutronclient.create_network... | python | def create_network(self, name, tenant_id, subnet, gw=None):
"""Create the openstack network, including the subnet. """
try:
body = {'network': {'name': name, 'tenant_id': tenant_id,
'admin_state_up': True}}
netw = self.neutronclient.create_network... | [
"def",
"create_network",
"(",
"self",
",",
"name",
",",
"tenant_id",
",",
"subnet",
",",
"gw",
"=",
"None",
")",
":",
"try",
":",
"body",
"=",
"{",
"'network'",
":",
"{",
"'name'",
":",
"name",
",",
"'tenant_id'",
":",
"tenant_id",
",",
"'admin_state_u... | Create the openstack network, including the subnet. | [
"Create",
"the",
"openstack",
"network",
"including",
"the",
"subnet",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L40-L80 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_network | def delete_network(self, name, tenant_id, subnet_id, net_id):
"""Delete the openstack subnet and network. """
try:
self.neutronclient.delete_subnet(subnet_id)
except Exception as exc:
LOG.error("Failed to delete subnet %(sub)s exc %(exc)s",
{'sub': s... | python | def delete_network(self, name, tenant_id, subnet_id, net_id):
"""Delete the openstack subnet and network. """
try:
self.neutronclient.delete_subnet(subnet_id)
except Exception as exc:
LOG.error("Failed to delete subnet %(sub)s exc %(exc)s",
{'sub': s... | [
"def",
"delete_network",
"(",
"self",
",",
"name",
",",
"tenant_id",
",",
"subnet_id",
",",
"net_id",
")",
":",
"try",
":",
"self",
".",
"neutronclient",
".",
"delete_subnet",
"(",
"subnet_id",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"e... | Delete the openstack subnet and network. | [
"Delete",
"the",
"openstack",
"subnet",
"and",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L82-L94 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_network_all_subnets | def delete_network_all_subnets(self, net_id):
"""Delete the openstack network including all its subnets. """
try:
body = {'network_id': net_id}
subnet_list = self.neutronclient.list_subnets(body=body)
subnet_list = subnet_list.get('subnets')
for subnet in ... | python | def delete_network_all_subnets(self, net_id):
"""Delete the openstack network including all its subnets. """
try:
body = {'network_id': net_id}
subnet_list = self.neutronclient.list_subnets(body=body)
subnet_list = subnet_list.get('subnets')
for subnet in ... | [
"def",
"delete_network_all_subnets",
"(",
"self",
",",
"net_id",
")",
":",
"try",
":",
"body",
"=",
"{",
"'network_id'",
":",
"net_id",
"}",
"subnet_list",
"=",
"self",
".",
"neutronclient",
".",
"list_subnets",
"(",
"body",
"=",
"body",
")",
"subnet_list",
... | Delete the openstack network including all its subnets. | [
"Delete",
"the",
"openstack",
"network",
"including",
"all",
"its",
"subnets",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L97-L117 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.is_subnet_present | def is_subnet_present(self, subnet_addr):
"""Returns if a subnet is present. """
try:
subnet_list = self.neutronclient.list_subnets(body={})
subnet_dat = subnet_list.get('subnets')
for sub in subnet_dat:
if sub.get('cidr') == subnet_addr:
... | python | def is_subnet_present(self, subnet_addr):
"""Returns if a subnet is present. """
try:
subnet_list = self.neutronclient.list_subnets(body={})
subnet_dat = subnet_list.get('subnets')
for sub in subnet_dat:
if sub.get('cidr') == subnet_addr:
... | [
"def",
"is_subnet_present",
"(",
"self",
",",
"subnet_addr",
")",
":",
"try",
":",
"subnet_list",
"=",
"self",
".",
"neutronclient",
".",
"list_subnets",
"(",
"body",
"=",
"{",
"}",
")",
"subnet_dat",
"=",
"subnet_list",
".",
"get",
"(",
"'subnets'",
")",
... | Returns if a subnet is present. | [
"Returns",
"if",
"a",
"subnet",
"is",
"present",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L119-L131 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_all_subnets_cidr | def get_all_subnets_cidr(self, no_mask=False):
"""Returns all the subnets. """
body = {}
subnet_cidrs = []
try:
subnet_list = self.neutronclient.list_subnets(body=body)
subnet_dat = subnet_list.get('subnets')
for sub in subnet_dat:
if n... | python | def get_all_subnets_cidr(self, no_mask=False):
"""Returns all the subnets. """
body = {}
subnet_cidrs = []
try:
subnet_list = self.neutronclient.list_subnets(body=body)
subnet_dat = subnet_list.get('subnets')
for sub in subnet_dat:
if n... | [
"def",
"get_all_subnets_cidr",
"(",
"self",
",",
"no_mask",
"=",
"False",
")",
":",
"body",
"=",
"{",
"}",
"subnet_cidrs",
"=",
"[",
"]",
"try",
":",
"subnet_list",
"=",
"self",
".",
"neutronclient",
".",
"list_subnets",
"(",
"body",
"=",
"body",
")",
... | Returns all the subnets. | [
"Returns",
"all",
"the",
"subnets",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L133-L147 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_subnets_for_net | def get_subnets_for_net(self, net):
"""Returns the subnets in a network. """
try:
subnet_list = self.neutronclient.list_subnets(network_id=net)
subnet_dat = subnet_list.get('subnets')
return subnet_dat
except Exception as exc:
LOG.error("Failed to ... | python | def get_subnets_for_net(self, net):
"""Returns the subnets in a network. """
try:
subnet_list = self.neutronclient.list_subnets(network_id=net)
subnet_dat = subnet_list.get('subnets')
return subnet_dat
except Exception as exc:
LOG.error("Failed to ... | [
"def",
"get_subnets_for_net",
"(",
"self",
",",
"net",
")",
":",
"try",
":",
"subnet_list",
"=",
"self",
".",
"neutronclient",
".",
"list_subnets",
"(",
"network_id",
"=",
"net",
")",
"subnet_dat",
"=",
"subnet_list",
".",
"get",
"(",
"'subnets'",
")",
"re... | Returns the subnets in a network. | [
"Returns",
"the",
"subnets",
"in",
"a",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L149-L158 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_subnet_cidr | def get_subnet_cidr(self, subnet_id):
"""retrieve the CIDR associated with a subnet, given its ID. """
try:
subnet_list = self.neutronclient.list_subnets(id=subnet_id)
subnet_dat = subnet_list.get('subnets')[0]
return subnet_dat.get('cidr')
except Exception as... | python | def get_subnet_cidr(self, subnet_id):
"""retrieve the CIDR associated with a subnet, given its ID. """
try:
subnet_list = self.neutronclient.list_subnets(id=subnet_id)
subnet_dat = subnet_list.get('subnets')[0]
return subnet_dat.get('cidr')
except Exception as... | [
"def",
"get_subnet_cidr",
"(",
"self",
",",
"subnet_id",
")",
":",
"try",
":",
"subnet_list",
"=",
"self",
".",
"neutronclient",
".",
"list_subnets",
"(",
"id",
"=",
"subnet_id",
")",
"subnet_dat",
"=",
"subnet_list",
".",
"get",
"(",
"'subnets'",
")",
"["... | retrieve the CIDR associated with a subnet, given its ID. | [
"retrieve",
"the",
"CIDR",
"associated",
"with",
"a",
"subnet",
"given",
"its",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L160-L169 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_network_subname | def delete_network_subname(self, sub_name):
"""Delete the network by part of its name, use with caution. """
try:
body = {}
net_list = self.neutronclient.list_networks(body=body)
for net in net_list:
if net.get('name').find(sub_name) != -1:
... | python | def delete_network_subname(self, sub_name):
"""Delete the network by part of its name, use with caution. """
try:
body = {}
net_list = self.neutronclient.list_networks(body=body)
for net in net_list:
if net.get('name').find(sub_name) != -1:
... | [
"def",
"delete_network_subname",
"(",
"self",
",",
"sub_name",
")",
":",
"try",
":",
"body",
"=",
"{",
"}",
"net_list",
"=",
"self",
".",
"neutronclient",
".",
"list_networks",
"(",
"body",
"=",
"body",
")",
"for",
"net",
"in",
"net_list",
":",
"if",
"... | Delete the network by part of its name, use with caution. | [
"Delete",
"the",
"network",
"by",
"part",
"of",
"its",
"name",
"use",
"with",
"caution",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L171-L182 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_network_by_name | def get_network_by_name(self, nwk_name):
"""Search for a openstack network by name. """
ret_net_lst = []
try:
body = {}
net_list = self.neutronclient.list_networks(body=body)
net_list = net_list.get('networks')
for net in net_list:
... | python | def get_network_by_name(self, nwk_name):
"""Search for a openstack network by name. """
ret_net_lst = []
try:
body = {}
net_list = self.neutronclient.list_networks(body=body)
net_list = net_list.get('networks')
for net in net_list:
... | [
"def",
"get_network_by_name",
"(",
"self",
",",
"nwk_name",
")",
":",
"ret_net_lst",
"=",
"[",
"]",
"try",
":",
"body",
"=",
"{",
"}",
"net_list",
"=",
"self",
".",
"neutronclient",
".",
"list_networks",
"(",
"body",
"=",
"body",
")",
"net_list",
"=",
... | Search for a openstack network by name. | [
"Search",
"for",
"a",
"openstack",
"network",
"by",
"name",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L184-L198 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_network_by_tenant | def get_network_by_tenant(self, tenant_id):
"""Returns the network of a given tenant. """
ret_net_lst = []
try:
net_list = self.neutronclient.list_networks(body={})
for net in net_list.get('networks'):
if net.get('tenant_id') == tenant_id:
... | python | def get_network_by_tenant(self, tenant_id):
"""Returns the network of a given tenant. """
ret_net_lst = []
try:
net_list = self.neutronclient.list_networks(body={})
for net in net_list.get('networks'):
if net.get('tenant_id') == tenant_id:
... | [
"def",
"get_network_by_tenant",
"(",
"self",
",",
"tenant_id",
")",
":",
"ret_net_lst",
"=",
"[",
"]",
"try",
":",
"net_list",
"=",
"self",
".",
"neutronclient",
".",
"list_networks",
"(",
"body",
"=",
"{",
"}",
")",
"for",
"net",
"in",
"net_list",
".",
... | Returns the network of a given tenant. | [
"Returns",
"the",
"network",
"of",
"a",
"given",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L200-L212 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_rtr_by_name | def get_rtr_by_name(self, rtr_name):
"""Search a router by its name. """
upd_rtr_list = []
try:
rtr_list = self.neutronclient.list_routers()
for rtr in rtr_list.get('routers'):
if rtr_name == rtr['name']:
upd_rtr_list.append(rtr)
... | python | def get_rtr_by_name(self, rtr_name):
"""Search a router by its name. """
upd_rtr_list = []
try:
rtr_list = self.neutronclient.list_routers()
for rtr in rtr_list.get('routers'):
if rtr_name == rtr['name']:
upd_rtr_list.append(rtr)
... | [
"def",
"get_rtr_by_name",
"(",
"self",
",",
"rtr_name",
")",
":",
"upd_rtr_list",
"=",
"[",
"]",
"try",
":",
"rtr_list",
"=",
"self",
".",
"neutronclient",
".",
"list_routers",
"(",
")",
"for",
"rtr",
"in",
"rtr_list",
".",
"get",
"(",
"'routers'",
")",
... | Search a router by its name. | [
"Search",
"a",
"router",
"by",
"its",
"name",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L215-L227 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.create_router | def create_router(self, name, tenant_id, subnet_lst):
"""Create a openstack router and add the interfaces. """
try:
body = {'router': {'name': name, 'tenant_id': tenant_id,
'admin_state_up': True}}
router = self.neutronclient.create_router(body=body... | python | def create_router(self, name, tenant_id, subnet_lst):
"""Create a openstack router and add the interfaces. """
try:
body = {'router': {'name': name, 'tenant_id': tenant_id,
'admin_state_up': True}}
router = self.neutronclient.create_router(body=body... | [
"def",
"create_router",
"(",
"self",
",",
"name",
",",
"tenant_id",
",",
"subnet_lst",
")",
":",
"try",
":",
"body",
"=",
"{",
"'router'",
":",
"{",
"'name'",
":",
"name",
",",
"'tenant_id'",
":",
"tenant_id",
",",
"'admin_state_up'",
":",
"True",
"}",
... | Create a openstack router and add the interfaces. | [
"Create",
"a",
"openstack",
"router",
"and",
"add",
"the",
"interfaces",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L229-L250 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.add_intf_router | def add_intf_router(self, rout_id, tenant_id, subnet_lst):
"""Add the interfaces to a router. """
try:
for subnet_id in subnet_lst:
body = {'subnet_id': subnet_id}
intf = self.neutronclient.add_interface_router(rout_id,
... | python | def add_intf_router(self, rout_id, tenant_id, subnet_lst):
"""Add the interfaces to a router. """
try:
for subnet_id in subnet_lst:
body = {'subnet_id': subnet_id}
intf = self.neutronclient.add_interface_router(rout_id,
... | [
"def",
"add_intf_router",
"(",
"self",
",",
"rout_id",
",",
"tenant_id",
",",
"subnet_lst",
")",
":",
"try",
":",
"for",
"subnet_id",
"in",
"subnet_lst",
":",
"body",
"=",
"{",
"'subnet_id'",
":",
"subnet_id",
"}",
"intf",
"=",
"self",
".",
"neutronclient"... | Add the interfaces to a router. | [
"Add",
"the",
"interfaces",
"to",
"a",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L252-L264 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_router | def delete_router(self, name, tenant_id, rout_id, subnet_lst):
"""Delete the openstack router.
Delete the router and remove the interfaces attached to it.
"""
ret = self.delete_intf_router(name, tenant_id, rout_id, subnet_lst)
if not ret:
return False
try:
... | python | def delete_router(self, name, tenant_id, rout_id, subnet_lst):
"""Delete the openstack router.
Delete the router and remove the interfaces attached to it.
"""
ret = self.delete_intf_router(name, tenant_id, rout_id, subnet_lst)
if not ret:
return False
try:
... | [
"def",
"delete_router",
"(",
"self",
",",
"name",
",",
"tenant_id",
",",
"rout_id",
",",
"subnet_lst",
")",
":",
"ret",
"=",
"self",
".",
"delete_intf_router",
"(",
"name",
",",
"tenant_id",
",",
"rout_id",
",",
"subnet_lst",
")",
"if",
"not",
"ret",
":"... | Delete the openstack router.
Delete the router and remove the interfaces attached to it. | [
"Delete",
"the",
"openstack",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L267-L283 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_intf_router | def delete_intf_router(self, name, tenant_id, rout_id, subnet_lst):
"""Delete the openstack router and remove the interfaces attached. """
try:
for subnet_id in subnet_lst:
body = {'subnet_id': subnet_id}
intf = self.neutronclient.remove_interface_router(rout_... | python | def delete_intf_router(self, name, tenant_id, rout_id, subnet_lst):
"""Delete the openstack router and remove the interfaces attached. """
try:
for subnet_id in subnet_lst:
body = {'subnet_id': subnet_id}
intf = self.neutronclient.remove_interface_router(rout_... | [
"def",
"delete_intf_router",
"(",
"self",
",",
"name",
",",
"tenant_id",
",",
"rout_id",
",",
"subnet_lst",
")",
":",
"try",
":",
"for",
"subnet_id",
"in",
"subnet_lst",
":",
"body",
"=",
"{",
"'subnet_id'",
":",
"subnet_id",
"}",
"intf",
"=",
"self",
".... | Delete the openstack router and remove the interfaces attached. | [
"Delete",
"the",
"openstack",
"router",
"and",
"remove",
"the",
"interfaces",
"attached",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L285-L297 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.delete_router_by_name | def delete_router_by_name(self, rtr_name, tenant_id):
"""Delete the openstack router and its interfaces given its name.
The interfaces should be already removed prior to calling this
function.
"""
try:
routers = self.neutronclient.list_routers()
rtr_list ... | python | def delete_router_by_name(self, rtr_name, tenant_id):
"""Delete the openstack router and its interfaces given its name.
The interfaces should be already removed prior to calling this
function.
"""
try:
routers = self.neutronclient.list_routers()
rtr_list ... | [
"def",
"delete_router_by_name",
"(",
"self",
",",
"rtr_name",
",",
"tenant_id",
")",
":",
"try",
":",
"routers",
"=",
"self",
".",
"neutronclient",
".",
"list_routers",
"(",
")",
"rtr_list",
"=",
"routers",
".",
"get",
"(",
"'routers'",
")",
"for",
"rtr",
... | Delete the openstack router and its interfaces given its name.
The interfaces should be already removed prior to calling this
function. | [
"Delete",
"the",
"openstack",
"router",
"and",
"its",
"interfaces",
"given",
"its",
"name",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L299-L316 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_router_intf | def get_router_intf(self, router_id):
"""Retrieve the router interfaces. Incomplete, TODO(padkrish). """
try:
body = {}
self.neutronclient.show_router(router_id, body=body)
except Exception as exc:
LOG.error("Failed to show router interface %(id)s "
... | python | def get_router_intf(self, router_id):
"""Retrieve the router interfaces. Incomplete, TODO(padkrish). """
try:
body = {}
self.neutronclient.show_router(router_id, body=body)
except Exception as exc:
LOG.error("Failed to show router interface %(id)s "
... | [
"def",
"get_router_intf",
"(",
"self",
",",
"router_id",
")",
":",
"try",
":",
"body",
"=",
"{",
"}",
"self",
".",
"neutronclient",
".",
"show_router",
"(",
"router_id",
",",
"body",
"=",
"body",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
"."... | Retrieve the router interfaces. Incomplete, TODO(padkrish). | [
"Retrieve",
"the",
"router",
"interfaces",
".",
"Incomplete",
"TODO",
"(",
"padkrish",
")",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L318-L326 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_rtr_name | def get_rtr_name(self, router_id):
"""Retrieve the router name. Incomplete. """
try:
body = {}
router = self.neutronclient.show_router(router_id, body=body)
return router.get('router').get('name')
except Exception as exc:
LOG.error("Failed to show ... | python | def get_rtr_name(self, router_id):
"""Retrieve the router name. Incomplete. """
try:
body = {}
router = self.neutronclient.show_router(router_id, body=body)
return router.get('router').get('name')
except Exception as exc:
LOG.error("Failed to show ... | [
"def",
"get_rtr_name",
"(",
"self",
",",
"router_id",
")",
":",
"try",
":",
"body",
"=",
"{",
"}",
"router",
"=",
"self",
".",
"neutronclient",
".",
"show_router",
"(",
"router_id",
",",
"body",
"=",
"body",
")",
"return",
"router",
".",
"get",
"(",
... | Retrieve the router name. Incomplete. | [
"Retrieve",
"the",
"router",
"name",
".",
"Incomplete",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L344-L352 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.find_rtr_namespace | def find_rtr_namespace(self, rout_id):
"""Find the namespace associated with the router. """
if rout_id is None:
return None
args = ['ip', 'netns', 'list']
try:
ns_list = utils.execute(args, root_helper=self.root_helper)
except Exception as exc:
... | python | def find_rtr_namespace(self, rout_id):
"""Find the namespace associated with the router. """
if rout_id is None:
return None
args = ['ip', 'netns', 'list']
try:
ns_list = utils.execute(args, root_helper=self.root_helper)
except Exception as exc:
... | [
"def",
"find_rtr_namespace",
"(",
"self",
",",
"rout_id",
")",
":",
"if",
"rout_id",
"is",
"None",
":",
"return",
"None",
"args",
"=",
"[",
"'ip'",
",",
"'netns'",
",",
"'list'",
"]",
"try",
":",
"ns_list",
"=",
"utils",
".",
"execute",
"(",
"args",
... | Find the namespace associated with the router. | [
"Find",
"the",
"namespace",
"associated",
"with",
"the",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L354-L367 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.program_rtr | def program_rtr(self, args, rout_id, namespace=None):
"""Execute the command against the namespace. """
if namespace is None:
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s", rout_id)
return... | python | def program_rtr(self, args, rout_id, namespace=None):
"""Execute the command against the namespace. """
if namespace is None:
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s", rout_id)
return... | [
"def",
"program_rtr",
"(",
"self",
",",
"args",
",",
"rout_id",
",",
"namespace",
"=",
"None",
")",
":",
"if",
"namespace",
"is",
"None",
":",
"namespace",
"=",
"self",
".",
"find_rtr_namespace",
"(",
"rout_id",
")",
"if",
"namespace",
"is",
"None",
":",... | Execute the command against the namespace. | [
"Execute",
"the",
"command",
"against",
"the",
"namespace",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L369-L384 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.program_rtr_default_gw | def program_rtr_default_gw(self, tenant_id, rout_id, gw):
"""Program the default gateway of a router. """
args = ['route', 'add', 'default', 'gw', gw]
ret = self.program_rtr(args, rout_id)
if not ret:
LOG.error("Program router returned error for %s", rout_id)
retu... | python | def program_rtr_default_gw(self, tenant_id, rout_id, gw):
"""Program the default gateway of a router. """
args = ['route', 'add', 'default', 'gw', gw]
ret = self.program_rtr(args, rout_id)
if not ret:
LOG.error("Program router returned error for %s", rout_id)
retu... | [
"def",
"program_rtr_default_gw",
"(",
"self",
",",
"tenant_id",
",",
"rout_id",
",",
"gw",
")",
":",
"args",
"=",
"[",
"'route'",
",",
"'add'",
",",
"'default'",
",",
"'gw'",
",",
"gw",
"]",
"ret",
"=",
"self",
".",
"program_rtr",
"(",
"args",
",",
"... | Program the default gateway of a router. | [
"Program",
"the",
"default",
"gateway",
"of",
"a",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L402-L409 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_subnet_nwk_excl | def get_subnet_nwk_excl(self, tenant_id, excl_list, excl_part=False):
"""Retrieve the subnets of a network.
Get the subnets inside a network after applying the exclusion
list.
"""
net_list = self.get_network_by_tenant(tenant_id)
ret_subnet_list = []
for net in ne... | python | def get_subnet_nwk_excl(self, tenant_id, excl_list, excl_part=False):
"""Retrieve the subnets of a network.
Get the subnets inside a network after applying the exclusion
list.
"""
net_list = self.get_network_by_tenant(tenant_id)
ret_subnet_list = []
for net in ne... | [
"def",
"get_subnet_nwk_excl",
"(",
"self",
",",
"tenant_id",
",",
"excl_list",
",",
"excl_part",
"=",
"False",
")",
":",
"net_list",
"=",
"self",
".",
"get_network_by_tenant",
"(",
"tenant_id",
")",
"ret_subnet_list",
"=",
"[",
"]",
"for",
"net",
"in",
"net_... | Retrieve the subnets of a network.
Get the subnets inside a network after applying the exclusion
list. | [
"Retrieve",
"the",
"subnets",
"of",
"a",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L411-L431 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.program_rtr_all_nwk_next_hop | def program_rtr_all_nwk_next_hop(self, tenant_id, rout_id, next_hop,
excl_list):
"""Program the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for r... | python | def program_rtr_all_nwk_next_hop(self, tenant_id, rout_id, next_hop,
excl_list):
"""Program the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for r... | [
"def",
"program_rtr_all_nwk_next_hop",
"(",
"self",
",",
"tenant_id",
",",
"rout_id",
",",
"next_hop",
",",
"excl_list",
")",
":",
"namespace",
"=",
"self",
".",
"find_rtr_namespace",
"(",
"rout_id",
")",
"if",
"namespace",
"is",
"None",
":",
"LOG",
".",
"er... | Program the next hop for all networks of a tenant. | [
"Program",
"the",
"next",
"hop",
"for",
"all",
"networks",
"of",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L433-L455 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.program_rtr_nwk_next_hop | def program_rtr_nwk_next_hop(self, rout_id, next_hop, cidr):
"""Program the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s", rout_id)
return False
arg... | python | def program_rtr_nwk_next_hop(self, rout_id, next_hop, cidr):
"""Program the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s", rout_id)
return False
arg... | [
"def",
"program_rtr_nwk_next_hop",
"(",
"self",
",",
"rout_id",
",",
"next_hop",
",",
"cidr",
")",
":",
"namespace",
"=",
"self",
".",
"find_rtr_namespace",
"(",
"rout_id",
")",
"if",
"namespace",
"is",
"None",
":",
"LOG",
".",
"error",
"(",
"\"Unable to fin... | Program the next hop for all networks of a tenant. | [
"Program",
"the",
"next",
"hop",
"for",
"all",
"networks",
"of",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L457-L469 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.remove_rtr_nwk_next_hop | def remove_rtr_nwk_next_hop(self, rout_id, next_hop, subnet_lst,
excl_list):
"""Remove the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s",... | python | def remove_rtr_nwk_next_hop(self, rout_id, next_hop, subnet_lst,
excl_list):
"""Remove the next hop for all networks of a tenant. """
namespace = self.find_rtr_namespace(rout_id)
if namespace is None:
LOG.error("Unable to find namespace for router %s",... | [
"def",
"remove_rtr_nwk_next_hop",
"(",
"self",
",",
"rout_id",
",",
"next_hop",
",",
"subnet_lst",
",",
"excl_list",
")",
":",
"namespace",
"=",
"self",
".",
"find_rtr_namespace",
"(",
"rout_id",
")",
"if",
"namespace",
"is",
"None",
":",
"LOG",
".",
"error"... | Remove the next hop for all networks of a tenant. | [
"Remove",
"the",
"next",
"hop",
"for",
"all",
"networks",
"of",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L471-L500 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_fw | def get_fw(self, fw_id):
"""Return the Firewall given its ID. """
fw = None
try:
fw = self.neutronclient.show_firewall(fw_id)
except Exception as exc:
LOG.error("Failed to get firewall list for id %(id)s, "
"Exc %(exc)s", {'id': fw_id, 'exc':... | python | def get_fw(self, fw_id):
"""Return the Firewall given its ID. """
fw = None
try:
fw = self.neutronclient.show_firewall(fw_id)
except Exception as exc:
LOG.error("Failed to get firewall list for id %(id)s, "
"Exc %(exc)s", {'id': fw_id, 'exc':... | [
"def",
"get_fw",
"(",
"self",
",",
"fw_id",
")",
":",
"fw",
"=",
"None",
"try",
":",
"fw",
"=",
"self",
".",
"neutronclient",
".",
"show_firewall",
"(",
"fw_id",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"error",
"(",
"\"Failed to get f... | Return the Firewall given its ID. | [
"Return",
"the",
"Firewall",
"given",
"its",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L502-L510 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_fw_rule | def get_fw_rule(self, rule_id):
"""Return the firewall rule, given its ID. """
rule = None
try:
rule = self.neutronclient.show_firewall_rule(rule_id)
except Exception as exc:
LOG.error("Failed to get firewall rule for id %(id)s "
"Exc %(exc)s... | python | def get_fw_rule(self, rule_id):
"""Return the firewall rule, given its ID. """
rule = None
try:
rule = self.neutronclient.show_firewall_rule(rule_id)
except Exception as exc:
LOG.error("Failed to get firewall rule for id %(id)s "
"Exc %(exc)s... | [
"def",
"get_fw_rule",
"(",
"self",
",",
"rule_id",
")",
":",
"rule",
"=",
"None",
"try",
":",
"rule",
"=",
"self",
".",
"neutronclient",
".",
"show_firewall_rule",
"(",
"rule_id",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"error",
"(",
... | Return the firewall rule, given its ID. | [
"Return",
"the",
"firewall",
"rule",
"given",
"its",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L513-L521 |
openstack/networking-cisco | networking_cisco/apps/saf/server/dfa_openstack_helper.py | DfaNeutronHelper.get_fw_policy | def get_fw_policy(self, policy_id):
"""Return the firewall policy, given its ID. """
policy = None
try:
policy = self.neutronclient.show_firewall_policy(policy_id)
except Exception as exc:
LOG.error("Failed to get firewall plcy for id %(id)s "
... | python | def get_fw_policy(self, policy_id):
"""Return the firewall policy, given its ID. """
policy = None
try:
policy = self.neutronclient.show_firewall_policy(policy_id)
except Exception as exc:
LOG.error("Failed to get firewall plcy for id %(id)s "
... | [
"def",
"get_fw_policy",
"(",
"self",
",",
"policy_id",
")",
":",
"policy",
"=",
"None",
"try",
":",
"policy",
"=",
"self",
".",
"neutronclient",
".",
"show_firewall_policy",
"(",
"policy_id",
")",
"except",
"Exception",
"as",
"exc",
":",
"LOG",
".",
"error... | Return the firewall policy, given its ID. | [
"Return",
"the",
"firewall",
"policy",
"given",
"its",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L524-L533 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._ensure_create_ha_compliant | def _ensure_create_ha_compliant(self, router, router_type):
"""To be called in create_router() BEFORE router is created in DB."""
details = router.pop(ha.DETAILS, {})
if details == ATTR_NOT_SPECIFIED:
details = {}
res = {ha.ENABLED: router.pop(ha.ENABLED, ATTR_NOT_SPECIFIED),... | python | def _ensure_create_ha_compliant(self, router, router_type):
"""To be called in create_router() BEFORE router is created in DB."""
details = router.pop(ha.DETAILS, {})
if details == ATTR_NOT_SPECIFIED:
details = {}
res = {ha.ENABLED: router.pop(ha.ENABLED, ATTR_NOT_SPECIFIED),... | [
"def",
"_ensure_create_ha_compliant",
"(",
"self",
",",
"router",
",",
"router_type",
")",
":",
"details",
"=",
"router",
".",
"pop",
"(",
"ha",
".",
"DETAILS",
",",
"{",
"}",
")",
"if",
"details",
"==",
"ATTR_NOT_SPECIFIED",
":",
"details",
"=",
"{",
"}... | To be called in create_router() BEFORE router is created in DB. | [
"To",
"be",
"called",
"in",
"create_router",
"()",
"BEFORE",
"router",
"is",
"created",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L202-L232 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._create_redundancy_routers | def _create_redundancy_routers(self, context, new_router, ha_settings,
new_router_db, ports=None, expire_db=False):
"""To be called in create_router() AFTER router has been
created in DB.
"""
if (ha.ENABLED not in ha_settings or
not ha_s... | python | def _create_redundancy_routers(self, context, new_router, ha_settings,
new_router_db, ports=None, expire_db=False):
"""To be called in create_router() AFTER router has been
created in DB.
"""
if (ha.ENABLED not in ha_settings or
not ha_s... | [
"def",
"_create_redundancy_routers",
"(",
"self",
",",
"context",
",",
"new_router",
",",
"ha_settings",
",",
"new_router_db",
",",
"ports",
"=",
"None",
",",
"expire_db",
"=",
"False",
")",
":",
"if",
"(",
"ha",
".",
"ENABLED",
"not",
"in",
"ha_settings",
... | To be called in create_router() AFTER router has been
created in DB. | [
"To",
"be",
"called",
"in",
"create_router",
"()",
"AFTER",
"router",
"has",
"been",
"created",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L234-L269 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._ensure_update_ha_compliant | def _ensure_update_ha_compliant(self, router, current_router,
r_hd_binding_db):
"""To be called in update_router() BEFORE router has been
updated in DB.
"""
if r_hd_binding_db.role == ROUTER_ROLE_HA_REDUNDANCY:
return {ha.ENABLED: False}
... | python | def _ensure_update_ha_compliant(self, router, current_router,
r_hd_binding_db):
"""To be called in update_router() BEFORE router has been
updated in DB.
"""
if r_hd_binding_db.role == ROUTER_ROLE_HA_REDUNDANCY:
return {ha.ENABLED: False}
... | [
"def",
"_ensure_update_ha_compliant",
"(",
"self",
",",
"router",
",",
"current_router",
",",
"r_hd_binding_db",
")",
":",
"if",
"r_hd_binding_db",
".",
"role",
"==",
"ROUTER_ROLE_HA_REDUNDANCY",
":",
"return",
"{",
"ha",
".",
"ENABLED",
":",
"False",
"}",
"auto... | To be called in update_router() BEFORE router has been
updated in DB. | [
"To",
"be",
"called",
"in",
"update_router",
"()",
"BEFORE",
"router",
"has",
"been",
"updated",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L271-L307 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._teardown_redundancy_router_gw_connectivity | def _teardown_redundancy_router_gw_connectivity(self, context, router,
router_db,
plugging_driver):
"""To be called in update_router() if the router gateway is to change
BEFORE router has been updated... | python | def _teardown_redundancy_router_gw_connectivity(self, context, router,
router_db,
plugging_driver):
"""To be called in update_router() if the router gateway is to change
BEFORE router has been updated... | [
"def",
"_teardown_redundancy_router_gw_connectivity",
"(",
"self",
",",
"context",
",",
"router",
",",
"router_db",
",",
"plugging_driver",
")",
":",
"if",
"not",
"router",
"[",
"ha",
".",
"ENABLED",
"]",
":",
"# No HA currently enabled so we're done",
"return",
"e_... | To be called in update_router() if the router gateway is to change
BEFORE router has been updated in DB . | [
"To",
"be",
"called",
"in",
"update_router",
"()",
"if",
"the",
"router",
"gateway",
"is",
"to",
"change",
"BEFORE",
"router",
"has",
"been",
"updated",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L309-L334 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._update_redundancy_routers | def _update_redundancy_routers(self, context, updated_router,
update_specification, requested_ha_settings,
updated_router_db, gateway_changed):
"""To be called in update_router() AFTER router has been
updated in DB.
"""
... | python | def _update_redundancy_routers(self, context, updated_router,
update_specification, requested_ha_settings,
updated_router_db, gateway_changed):
"""To be called in update_router() AFTER router has been
updated in DB.
"""
... | [
"def",
"_update_redundancy_routers",
"(",
"self",
",",
"context",
",",
"updated_router",
",",
"update_specification",
",",
"requested_ha_settings",
",",
"updated_router_db",
",",
"gateway_changed",
")",
":",
"router_requested",
"=",
"update_specification",
"[",
"'router'"... | To be called in update_router() AFTER router has been
updated in DB. | [
"To",
"be",
"called",
"in",
"update_router",
"()",
"AFTER",
"router",
"has",
"been",
"updated",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L336-L425 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._add_redundancy_routers | def _add_redundancy_routers(self, context, start_index, stop_index,
user_visible_router, ports=None,
ha_settings_db=None, create_ha_group=True):
"""Creates a redundancy router and its interfaces on
the specified subnets.
"""
... | python | def _add_redundancy_routers(self, context, start_index, stop_index,
user_visible_router, ports=None,
ha_settings_db=None, create_ha_group=True):
"""Creates a redundancy router and its interfaces on
the specified subnets.
"""
... | [
"def",
"_add_redundancy_routers",
"(",
"self",
",",
"context",
",",
"start_index",
",",
"stop_index",
",",
"user_visible_router",
",",
"ports",
"=",
"None",
",",
"ha_settings_db",
"=",
"None",
",",
"create_ha_group",
"=",
"True",
")",
":",
"priority",
"=",
"("... | Creates a redundancy router and its interfaces on
the specified subnets. | [
"Creates",
"a",
"redundancy",
"router",
"and",
"its",
"interfaces",
"on",
"the",
"specified",
"subnets",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L469-L513 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._remove_redundancy_routers | def _remove_redundancy_routers(self, context, router_ids, ports,
delete_ha_groups=False):
"""Deletes all interfaces of the specified redundancy routers
and then the redundancy routers themselves.
"""
subnets_info = [{'subnet_id': port['fixed_ips'][0]['s... | python | def _remove_redundancy_routers(self, context, router_ids, ports,
delete_ha_groups=False):
"""Deletes all interfaces of the specified redundancy routers
and then the redundancy routers themselves.
"""
subnets_info = [{'subnet_id': port['fixed_ips'][0]['s... | [
"def",
"_remove_redundancy_routers",
"(",
"self",
",",
"context",
",",
"router_ids",
",",
"ports",
",",
"delete_ha_groups",
"=",
"False",
")",
":",
"subnets_info",
"=",
"[",
"{",
"'subnet_id'",
":",
"port",
"[",
"'fixed_ips'",
"]",
"[",
"0",
"]",
"[",
"'su... | Deletes all interfaces of the specified redundancy routers
and then the redundancy routers themselves. | [
"Deletes",
"all",
"interfaces",
"of",
"the",
"specified",
"redundancy",
"routers",
"and",
"then",
"the",
"redundancy",
"routers",
"themselves",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L515-L532 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/l3/ha_db.py | HA_db_mixin._delete_redundancy_routers | def _delete_redundancy_routers(self, context, router_db):
"""To be called in delete_router() BEFORE router has been
deleted in DB. The router should have not interfaces.
"""
e_context = context.elevated()
for binding in router_db.redundancy_bindings:
self.delete_route... | python | def _delete_redundancy_routers(self, context, router_db):
"""To be called in delete_router() BEFORE router has been
deleted in DB. The router should have not interfaces.
"""
e_context = context.elevated()
for binding in router_db.redundancy_bindings:
self.delete_route... | [
"def",
"_delete_redundancy_routers",
"(",
"self",
",",
"context",
",",
"router_db",
")",
":",
"e_context",
"=",
"context",
".",
"elevated",
"(",
")",
"for",
"binding",
"in",
"router_db",
".",
"redundancy_bindings",
":",
"self",
".",
"delete_router",
"(",
"e_co... | To be called in delete_router() BEFORE router has been
deleted in DB. The router should have not interfaces. | [
"To",
"be",
"called",
"in",
"delete_router",
"()",
"BEFORE",
"router",
"has",
"been",
"deleted",
"in",
"DB",
".",
"The",
"router",
"should",
"have",
"not",
"interfaces",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L539-L550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.