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/services/firewall/native/fabric_setup_base.py | FabricApi.get_out_net_id | def get_out_net_id(cls, tenant_id):
"""Retrieve the network ID of OUT network. """
if 'out' not in cls.ip_db_obj:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return None
db_obj = cls.ip_db_obj.get('out')
out_subnet_dict = cls.get_out_ip_addr(tenant_i... | python | def get_out_net_id(cls, tenant_id):
"""Retrieve the network ID of OUT network. """
if 'out' not in cls.ip_db_obj:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return None
db_obj = cls.ip_db_obj.get('out')
out_subnet_dict = cls.get_out_ip_addr(tenant_i... | [
"def",
"get_out_net_id",
"(",
"cls",
",",
"tenant_id",
")",
":",
"if",
"'out'",
"not",
"in",
"cls",
".",
"ip_db_obj",
":",
"LOG",
".",
"error",
"(",
"\"Fabric not prepared for tenant %s\"",
",",
"tenant_id",
")",
"return",
"None",
"db_obj",
"=",
"cls",
".",
... | Retrieve the network ID of OUT network. | [
"Retrieve",
"the",
"network",
"ID",
"of",
"OUT",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L371-L379 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricApi.is_network_source_fw | def is_network_source_fw(cls, nwk, nwk_name):
"""Check if SOURCE is FIREWALL, if yes return TRUE.
If source is None or entry not in NWK DB, check from Name.
Name should have constant AND length should match.
"""
if nwk is not None:
if nwk.source == fw_const.FW_CONST:... | python | def is_network_source_fw(cls, nwk, nwk_name):
"""Check if SOURCE is FIREWALL, if yes return TRUE.
If source is None or entry not in NWK DB, check from Name.
Name should have constant AND length should match.
"""
if nwk is not None:
if nwk.source == fw_const.FW_CONST:... | [
"def",
"is_network_source_fw",
"(",
"cls",
",",
"nwk",
",",
"nwk_name",
")",
":",
"if",
"nwk",
"is",
"not",
"None",
":",
"if",
"nwk",
".",
"source",
"==",
"fw_const",
".",
"FW_CONST",
":",
"return",
"True",
"return",
"False",
"if",
"nwk_name",
"in",
"f... | Check if SOURCE is FIREWALL, if yes return TRUE.
If source is None or entry not in NWK DB, check from Name.
Name should have constant AND length should match. | [
"Check",
"if",
"SOURCE",
"is",
"FIREWALL",
"if",
"yes",
"return",
"TRUE",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L382-L404 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricApi.is_subnet_source_fw | def is_subnet_source_fw(cls, tenant_id, subnet):
"""Check if the subnet is created as a result of any FW operation. """
cfg = config.CiscoDFAConfig().cfg
subnet = subnet.split('/')[0]
in_sub_dict = cls.get_in_ip_addr(tenant_id)
if not in_sub_dict:
return False
... | python | def is_subnet_source_fw(cls, tenant_id, subnet):
"""Check if the subnet is created as a result of any FW operation. """
cfg = config.CiscoDFAConfig().cfg
subnet = subnet.split('/')[0]
in_sub_dict = cls.get_in_ip_addr(tenant_id)
if not in_sub_dict:
return False
... | [
"def",
"is_subnet_source_fw",
"(",
"cls",
",",
"tenant_id",
",",
"subnet",
")",
":",
"cfg",
"=",
"config",
".",
"CiscoDFAConfig",
"(",
")",
".",
"cfg",
"subnet",
"=",
"subnet",
".",
"split",
"(",
"'/'",
")",
"[",
"0",
"]",
"in_sub_dict",
"=",
"cls",
... | Check if the subnet is created as a result of any FW operation. | [
"Check",
"if",
"the",
"subnet",
"is",
"created",
"as",
"a",
"result",
"of",
"any",
"FW",
"operation",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L406-L422 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.initialize_create_state_map | def initialize_create_state_map(self):
"""This is a mapping of create result message string to state. """
self.fabric_state_map = {
fw_const.INIT_STATE_STR: fw_const.OS_IN_NETWORK_STATE,
fw_const.OS_IN_NETWORK_CREATE_FAIL:
fw_const.OS_IN_NETWORK_STATE,
... | python | def initialize_create_state_map(self):
"""This is a mapping of create result message string to state. """
self.fabric_state_map = {
fw_const.INIT_STATE_STR: fw_const.OS_IN_NETWORK_STATE,
fw_const.OS_IN_NETWORK_CREATE_FAIL:
fw_const.OS_IN_NETWORK_STATE,
... | [
"def",
"initialize_create_state_map",
"(",
"self",
")",
":",
"self",
".",
"fabric_state_map",
"=",
"{",
"fw_const",
".",
"INIT_STATE_STR",
":",
"fw_const",
".",
"OS_IN_NETWORK_STATE",
",",
"fw_const",
".",
"OS_IN_NETWORK_CREATE_FAIL",
":",
"fw_const",
".",
"OS_IN_NE... | This is a mapping of create result message string to state. | [
"This",
"is",
"a",
"mapping",
"of",
"create",
"result",
"message",
"string",
"to",
"state",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L485-L520 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.initialize_delete_state_map | def initialize_delete_state_map(self):
"""This is a mapping of delete result message string to state. """
self.fabric_state_del_map = {
fw_const.INIT_STATE_STR: fw_const.OS_IN_NETWORK_STATE,
fw_const.OS_IN_NETWORK_DEL_FAIL:
fw_const.OS_IN_NETWORK_STATE,
... | python | def initialize_delete_state_map(self):
"""This is a mapping of delete result message string to state. """
self.fabric_state_del_map = {
fw_const.INIT_STATE_STR: fw_const.OS_IN_NETWORK_STATE,
fw_const.OS_IN_NETWORK_DEL_FAIL:
fw_const.OS_IN_NETWORK_STATE,
... | [
"def",
"initialize_delete_state_map",
"(",
"self",
")",
":",
"self",
".",
"fabric_state_del_map",
"=",
"{",
"fw_const",
".",
"INIT_STATE_STR",
":",
"fw_const",
".",
"OS_IN_NETWORK_STATE",
",",
"fw_const",
".",
"OS_IN_NETWORK_DEL_FAIL",
":",
"fw_const",
".",
"OS_IN_N... | This is a mapping of delete result message string to state. | [
"This",
"is",
"a",
"mapping",
"of",
"delete",
"result",
"message",
"string",
"to",
"state",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L522-L557 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.initialize_fsm | def initialize_fsm(self):
"""Initializing the Finite State Machine.
This is a mapping of state to a dict of appropriate create and delete
functions.
"""
self.fabric_fsm = {
fw_const.INIT_STATE:
[self.init_state, self.init_state],
fw_const.... | python | def initialize_fsm(self):
"""Initializing the Finite State Machine.
This is a mapping of state to a dict of appropriate create and delete
functions.
"""
self.fabric_fsm = {
fw_const.INIT_STATE:
[self.init_state, self.init_state],
fw_const.... | [
"def",
"initialize_fsm",
"(",
"self",
")",
":",
"self",
".",
"fabric_fsm",
"=",
"{",
"fw_const",
".",
"INIT_STATE",
":",
"[",
"self",
".",
"init_state",
",",
"self",
".",
"init_state",
"]",
",",
"fw_const",
".",
"OS_IN_NETWORK_STATE",
":",
"[",
"self",
"... | Initializing the Finite State Machine.
This is a mapping of state to a dict of appropriate create and delete
functions. | [
"Initializing",
"the",
"Finite",
"State",
"Machine",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L559-L585 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_serv_obj | def create_serv_obj(self, tenant_id):
"""Creates and stores the service object associated with a tenant. """
self.service_attr[tenant_id] = ServiceIpSegTenantMap()
self.store_tenant_obj(tenant_id, self.service_attr[tenant_id]) | python | def create_serv_obj(self, tenant_id):
"""Creates and stores the service object associated with a tenant. """
self.service_attr[tenant_id] = ServiceIpSegTenantMap()
self.store_tenant_obj(tenant_id, self.service_attr[tenant_id]) | [
"def",
"create_serv_obj",
"(",
"self",
",",
"tenant_id",
")",
":",
"self",
".",
"service_attr",
"[",
"tenant_id",
"]",
"=",
"ServiceIpSegTenantMap",
"(",
")",
"self",
".",
"store_tenant_obj",
"(",
"tenant_id",
",",
"self",
".",
"service_attr",
"[",
"tenant_id"... | Creates and stores the service object associated with a tenant. | [
"Creates",
"and",
"stores",
"the",
"service",
"object",
"associated",
"with",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L595-L598 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_serv_obj | def delete_serv_obj(self, tenant_id):
"""Creates and stores the service object associated with a tenant. """
self.del_obj(tenant_id, self.service_attr[tenant_id])
del self.service_attr[tenant_id] | python | def delete_serv_obj(self, tenant_id):
"""Creates and stores the service object associated with a tenant. """
self.del_obj(tenant_id, self.service_attr[tenant_id])
del self.service_attr[tenant_id] | [
"def",
"delete_serv_obj",
"(",
"self",
",",
"tenant_id",
")",
":",
"self",
".",
"del_obj",
"(",
"tenant_id",
",",
"self",
".",
"service_attr",
"[",
"tenant_id",
"]",
")",
"del",
"self",
".",
"service_attr",
"[",
"tenant_id",
"]"
] | Creates and stores the service object associated with a tenant. | [
"Creates",
"and",
"stores",
"the",
"service",
"object",
"associated",
"with",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L600-L603 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.store_net_db | def store_net_db(self, tenant_id, net, net_dict, result):
"""Store service network in DB. """
network_dict = {'name': net_dict.get('name'),
'config_profile': net_dict.get('config_profile'),
'segmentation_id': net_dict.get('segmentation_id'),
... | python | def store_net_db(self, tenant_id, net, net_dict, result):
"""Store service network in DB. """
network_dict = {'name': net_dict.get('name'),
'config_profile': net_dict.get('config_profile'),
'segmentation_id': net_dict.get('segmentation_id'),
... | [
"def",
"store_net_db",
"(",
"self",
",",
"tenant_id",
",",
"net",
",",
"net_dict",
",",
"result",
")",
":",
"network_dict",
"=",
"{",
"'name'",
":",
"net_dict",
".",
"get",
"(",
"'name'",
")",
",",
"'config_profile'",
":",
"net_dict",
".",
"get",
"(",
... | Store service network in DB. | [
"Store",
"service",
"network",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L605-L613 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.store_fw_db | def store_fw_db(self, tenant_id, net, subnet_dict, direc):
"""Calls the service object routine to commit the FW entry to DB. """
serv_obj = self.get_service_obj(tenant_id)
sub = subnet_dict.get('allocation_pools')[0].get('start')
serv_obj.update_fw_local_cache(net, direc, sub)
se... | python | def store_fw_db(self, tenant_id, net, subnet_dict, direc):
"""Calls the service object routine to commit the FW entry to DB. """
serv_obj = self.get_service_obj(tenant_id)
sub = subnet_dict.get('allocation_pools')[0].get('start')
serv_obj.update_fw_local_cache(net, direc, sub)
se... | [
"def",
"store_fw_db",
"(",
"self",
",",
"tenant_id",
",",
"net",
",",
"subnet_dict",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"sub",
"=",
"subnet_dict",
".",
"get",
"(",
"'allocation_pools'",
")",
"[",... | Calls the service object routine to commit the FW entry to DB. | [
"Calls",
"the",
"service",
"object",
"routine",
"to",
"commit",
"the",
"FW",
"entry",
"to",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L615-L620 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_fw_db_result | def update_fw_db_result(self, tenant_id, os_status=None, dcnm_status=None,
dev_status=None):
"""Update the FW DB Result and commit it in DB.
Calls the service object routine to commit the result of a FW
operation in to DB
"""
serv_obj = self.get_servi... | python | def update_fw_db_result(self, tenant_id, os_status=None, dcnm_status=None,
dev_status=None):
"""Update the FW DB Result and commit it in DB.
Calls the service object routine to commit the result of a FW
operation in to DB
"""
serv_obj = self.get_servi... | [
"def",
"update_fw_db_result",
"(",
"self",
",",
"tenant_id",
",",
"os_status",
"=",
"None",
",",
"dcnm_status",
"=",
"None",
",",
"dev_status",
"=",
"None",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"serv_obj",
".",
... | Update the FW DB Result and commit it in DB.
Calls the service object routine to commit the result of a FW
operation in to DB | [
"Update",
"the",
"FW",
"DB",
"Result",
"and",
"commit",
"it",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L622-L631 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.store_fw_db_router | def store_fw_db_router(self, tenant_id, net_id, subnet_id, router_id,
os_status):
"""Store the result of FW router operation in DB.
Calls the service object routine to commit the result of router
operation in to DB, after updating the local cache.
"""
... | python | def store_fw_db_router(self, tenant_id, net_id, subnet_id, router_id,
os_status):
"""Store the result of FW router operation in DB.
Calls the service object routine to commit the result of router
operation in to DB, after updating the local cache.
"""
... | [
"def",
"store_fw_db_router",
"(",
"self",
",",
"tenant_id",
",",
"net_id",
",",
"subnet_id",
",",
"router_id",
",",
"os_status",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"serv_obj",
".",
"update_fw_local_router",
"(",
"... | Store the result of FW router operation in DB.
Calls the service object routine to commit the result of router
operation in to DB, after updating the local cache. | [
"Store",
"the",
"result",
"of",
"FW",
"router",
"operation",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L633-L644 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.store_net_fw_db | def store_net_fw_db(self, tenant_id, net, net_dict, subnet_dict,
direc, result, os_status=None, dcnm_status=None,
dev_status=None):
"""Save the entries in Network and Firewall DB.
Stores the entries into Network DB and Firewall DB as well as update
... | python | def store_net_fw_db(self, tenant_id, net, net_dict, subnet_dict,
direc, result, os_status=None, dcnm_status=None,
dev_status=None):
"""Save the entries in Network and Firewall DB.
Stores the entries into Network DB and Firewall DB as well as update
... | [
"def",
"store_net_fw_db",
"(",
"self",
",",
"tenant_id",
",",
"net",
",",
"net_dict",
",",
"subnet_dict",
",",
"direc",
",",
"result",
",",
"os_status",
"=",
"None",
",",
"dcnm_status",
"=",
"None",
",",
"dev_status",
"=",
"None",
")",
":",
"self",
".",
... | Save the entries in Network and Firewall DB.
Stores the entries into Network DB and Firewall DB as well as update
the result of operation into FWDB. Generally called by OS operations
that wants to modify both the Net DB and FW DB. | [
"Save",
"the",
"entries",
"in",
"Network",
"and",
"Firewall",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L646-L659 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.check_allocate_ip | def check_allocate_ip(self, obj, direc):
"""This function allocates a subnet from the pool.
It first checks to see if Openstack is already using the subnet.
If yes, it retries until it finds a free subnet not used by
Openstack.
"""
subnet_lst = self.os_helper.get_all_sub... | python | def check_allocate_ip(self, obj, direc):
"""This function allocates a subnet from the pool.
It first checks to see if Openstack is already using the subnet.
If yes, it retries until it finds a free subnet not used by
Openstack.
"""
subnet_lst = self.os_helper.get_all_sub... | [
"def",
"check_allocate_ip",
"(",
"self",
",",
"obj",
",",
"direc",
")",
":",
"subnet_lst",
"=",
"self",
".",
"os_helper",
".",
"get_all_subnets_cidr",
"(",
"no_mask",
"=",
"True",
")",
"ip_next",
"=",
"obj",
".",
"allocate_subnet",
"(",
"subnet_lst",
")",
... | This function allocates a subnet from the pool.
It first checks to see if Openstack is already using the subnet.
If yes, it retries until it finds a free subnet not used by
Openstack. | [
"This",
"function",
"allocates",
"a",
"subnet",
"from",
"the",
"pool",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L695-L707 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_next_ip | def get_next_ip(self, tenant_id, direc):
"""Retrieve the next available subnet.
Given a tenant, it returns the service subnet values assigned
to it based on direction.
"""
# TODO(padkrish) Put in a common functionality for services.
if direc == 'in':
subnet_d... | python | def get_next_ip(self, tenant_id, direc):
"""Retrieve the next available subnet.
Given a tenant, it returns the service subnet values assigned
to it based on direction.
"""
# TODO(padkrish) Put in a common functionality for services.
if direc == 'in':
subnet_d... | [
"def",
"get_next_ip",
"(",
"self",
",",
"tenant_id",
",",
"direc",
")",
":",
"# TODO(padkrish) Put in a common functionality for services.",
"if",
"direc",
"==",
"'in'",
":",
"subnet_dict",
"=",
"self",
".",
"get_in_ip_addr",
"(",
"tenant_id",
")",
"else",
":",
"s... | Retrieve the next available subnet.
Given a tenant, it returns the service subnet values assigned
to it based on direction. | [
"Retrieve",
"the",
"next",
"available",
"subnet",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L709-L731 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.release_subnet | def release_subnet(self, cidr, direc):
"""Routine to release a subnet from the DB. """
if direc == 'in':
self.service_in_ip.release_subnet(cidr)
else:
self.service_out_ip.release_subnet(cidr) | python | def release_subnet(self, cidr, direc):
"""Routine to release a subnet from the DB. """
if direc == 'in':
self.service_in_ip.release_subnet(cidr)
else:
self.service_out_ip.release_subnet(cidr) | [
"def",
"release_subnet",
"(",
"self",
",",
"cidr",
",",
"direc",
")",
":",
"if",
"direc",
"==",
"'in'",
":",
"self",
".",
"service_in_ip",
".",
"release_subnet",
"(",
"cidr",
")",
"else",
":",
"self",
".",
"service_out_ip",
".",
"release_subnet",
"(",
"c... | Routine to release a subnet from the DB. | [
"Routine",
"to",
"release",
"a",
"subnet",
"from",
"the",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L733-L738 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.fill_dcnm_subnet_info | def fill_dcnm_subnet_info(self, tenant_id, subnet, start, end, gateway,
sec_gateway, direc):
"""Fills the DCNM subnet parameters.
Function that fills the subnet parameters for a tenant required by
DCNM.
"""
serv_obj = self.get_service_obj(tenant_id)... | python | def fill_dcnm_subnet_info(self, tenant_id, subnet, start, end, gateway,
sec_gateway, direc):
"""Fills the DCNM subnet parameters.
Function that fills the subnet parameters for a tenant required by
DCNM.
"""
serv_obj = self.get_service_obj(tenant_id)... | [
"def",
"fill_dcnm_subnet_info",
"(",
"self",
",",
"tenant_id",
",",
"subnet",
",",
"start",
",",
"end",
",",
"gateway",
",",
"sec_gateway",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"fw_dict",
"=",
"ser... | Fills the DCNM subnet parameters.
Function that fills the subnet parameters for a tenant required by
DCNM. | [
"Fills",
"the",
"DCNM",
"subnet",
"parameters",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L740-L765 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.retrieve_dcnm_subnet_info | def retrieve_dcnm_subnet_info(self, tenant_id, direc):
"""Retrieves the DCNM subnet info for a tenant. """
serv_obj = self.get_service_obj(tenant_id)
subnet_dict = serv_obj.get_dcnm_subnet_dict(direc)
return subnet_dict | python | def retrieve_dcnm_subnet_info(self, tenant_id, direc):
"""Retrieves the DCNM subnet info for a tenant. """
serv_obj = self.get_service_obj(tenant_id)
subnet_dict = serv_obj.get_dcnm_subnet_dict(direc)
return subnet_dict | [
"def",
"retrieve_dcnm_subnet_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"subnet_dict",
"=",
"serv_obj",
".",
"get_dcnm_subnet_dict",
"(",
"direc",
")",
"return",
"subnet_d... | Retrieves the DCNM subnet info for a tenant. | [
"Retrieves",
"the",
"DCNM",
"subnet",
"info",
"for",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L767-L771 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.alloc_retrieve_subnet_info | def alloc_retrieve_subnet_info(self, tenant_id, direc):
"""Allocate and store Subnet.
This function initially checks if subnet is allocated for a tenant
for the in/out direction. If not, it calls routine to allocate a subnet
and stores it on tenant object.
"""
serv_obj =... | python | def alloc_retrieve_subnet_info(self, tenant_id, direc):
"""Allocate and store Subnet.
This function initially checks if subnet is allocated for a tenant
for the in/out direction. If not, it calls routine to allocate a subnet
and stores it on tenant object.
"""
serv_obj =... | [
"def",
"alloc_retrieve_subnet_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"subnet_dict",
"=",
"self",
".",
"retrieve_dcnm_subnet_info",
"(",
"tenant_id",
",",
"direc",
")",... | Allocate and store Subnet.
This function initially checks if subnet is allocated for a tenant
for the in/out direction. If not, it calls routine to allocate a subnet
and stores it on tenant object. | [
"Allocate",
"and",
"store",
"Subnet",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L773-L791 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.retrieve_dcnm_net_info | def retrieve_dcnm_net_info(self, tenant_id, direc):
"""Retrieves the DCNM network info for a tenant. """
serv_obj = self.get_service_obj(tenant_id)
net_dict = serv_obj.get_dcnm_net_dict(direc)
return net_dict | python | def retrieve_dcnm_net_info(self, tenant_id, direc):
"""Retrieves the DCNM network info for a tenant. """
serv_obj = self.get_service_obj(tenant_id)
net_dict = serv_obj.get_dcnm_net_dict(direc)
return net_dict | [
"def",
"retrieve_dcnm_net_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"net_dict",
"=",
"serv_obj",
".",
"get_dcnm_net_dict",
"(",
"direc",
")",
"return",
"net_dict"
] | Retrieves the DCNM network info for a tenant. | [
"Retrieves",
"the",
"DCNM",
"network",
"info",
"for",
"a",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L793-L797 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_dcnm_net_info | def update_dcnm_net_info(self, tenant_id, direc, vlan_id,
segmentation_id):
"""Update the DCNM net info with allocated values of seg/vlan. """
net_dict = self.retrieve_dcnm_net_info(tenant_id, direc)
if not net_dict:
return None
net_dict['vlan_id'... | python | def update_dcnm_net_info(self, tenant_id, direc, vlan_id,
segmentation_id):
"""Update the DCNM net info with allocated values of seg/vlan. """
net_dict = self.retrieve_dcnm_net_info(tenant_id, direc)
if not net_dict:
return None
net_dict['vlan_id'... | [
"def",
"update_dcnm_net_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
",",
"vlan_id",
",",
"segmentation_id",
")",
":",
"net_dict",
"=",
"self",
".",
"retrieve_dcnm_net_info",
"(",
"tenant_id",
",",
"direc",
")",
"if",
"not",
"net_dict",
":",
"return",
... | Update the DCNM net info with allocated values of seg/vlan. | [
"Update",
"the",
"DCNM",
"net",
"info",
"with",
"allocated",
"values",
"of",
"seg",
"/",
"vlan",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L799-L809 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.fill_dcnm_net_info | def fill_dcnm_net_info(self, tenant_id, direc, vlan_id=0,
segmentation_id=0):
"""Fill DCNM network parameters.
Function that fills the network parameters for a tenant required by
DCNM.
"""
serv_obj = self.get_service_obj(tenant_id)
fw_dict = se... | python | def fill_dcnm_net_info(self, tenant_id, direc, vlan_id=0,
segmentation_id=0):
"""Fill DCNM network parameters.
Function that fills the network parameters for a tenant required by
DCNM.
"""
serv_obj = self.get_service_obj(tenant_id)
fw_dict = se... | [
"def",
"fill_dcnm_net_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
",",
"vlan_id",
"=",
"0",
",",
"segmentation_id",
"=",
"0",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"fw_dict",
"=",
"serv_obj",
".",
"get_fw... | Fill DCNM network parameters.
Function that fills the network parameters for a tenant required by
DCNM. | [
"Fill",
"DCNM",
"network",
"parameters",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L811-L842 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.retrieve_network_info | def retrieve_network_info(self, tenant_id, direc):
"""Retrieve the DCNM Network information.
Retrieves DCNM net dict if already filled, else, it calls
routines to fill the net info and store it in tenant obj.
"""
serv_obj = self.get_service_obj(tenant_id)
net_dict = self... | python | def retrieve_network_info(self, tenant_id, direc):
"""Retrieve the DCNM Network information.
Retrieves DCNM net dict if already filled, else, it calls
routines to fill the net info and store it in tenant obj.
"""
serv_obj = self.get_service_obj(tenant_id)
net_dict = self... | [
"def",
"retrieve_network_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"net_dict",
"=",
"self",
".",
"retrieve_dcnm_net_info",
"(",
"tenant_id",
",",
"direc",
")",
"if",
... | Retrieve the DCNM Network information.
Retrieves DCNM net dict if already filled, else, it calls
routines to fill the net info and store it in tenant obj. | [
"Retrieve",
"the",
"DCNM",
"Network",
"information",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L844-L856 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.alloc_seg | def alloc_seg(self, net_id):
"""Allocates the segmentation ID. """
segmentation_id = self.service_segs.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return segmentation_id | python | def alloc_seg(self, net_id):
"""Allocates the segmentation ID. """
segmentation_id = self.service_segs.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return segmentation_id | [
"def",
"alloc_seg",
"(",
"self",
",",
"net_id",
")",
":",
"segmentation_id",
"=",
"self",
".",
"service_segs",
".",
"allocate_segmentation_id",
"(",
"net_id",
",",
"source",
"=",
"fw_const",
".",
"FW_CONST",
")",
"return",
"segmentation_id"
] | Allocates the segmentation ID. | [
"Allocates",
"the",
"segmentation",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L858-L862 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.alloc_vlan | def alloc_vlan(self, net_id):
"""Allocates the vlan ID. """
vlan_id = self.service_vlans.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return vlan_id | python | def alloc_vlan(self, net_id):
"""Allocates the vlan ID. """
vlan_id = self.service_vlans.allocate_segmentation_id(
net_id, source=fw_const.FW_CONST)
return vlan_id | [
"def",
"alloc_vlan",
"(",
"self",
",",
"net_id",
")",
":",
"vlan_id",
"=",
"self",
".",
"service_vlans",
".",
"allocate_segmentation_id",
"(",
"net_id",
",",
"source",
"=",
"fw_const",
".",
"FW_CONST",
")",
"return",
"vlan_id"
] | Allocates the vlan ID. | [
"Allocates",
"the",
"vlan",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L864-L868 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_subnet_db_info | def update_subnet_db_info(self, tenant_id, direc, net_id, subnet_id):
"""Update the subnet DB with Net and Subnet ID, given the subnet. """
subnet_dict = self.retrieve_dcnm_subnet_info(tenant_id, direc)
if not subnet_dict:
LOG.error("Subnet dict not found for tenant %s", tenant_id)
... | python | def update_subnet_db_info(self, tenant_id, direc, net_id, subnet_id):
"""Update the subnet DB with Net and Subnet ID, given the subnet. """
subnet_dict = self.retrieve_dcnm_subnet_info(tenant_id, direc)
if not subnet_dict:
LOG.error("Subnet dict not found for tenant %s", tenant_id)
... | [
"def",
"update_subnet_db_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
",",
"net_id",
",",
"subnet_id",
")",
":",
"subnet_dict",
"=",
"self",
".",
"retrieve_dcnm_subnet_info",
"(",
"tenant_id",
",",
"direc",
")",
"if",
"not",
"subnet_dict",
":",
"LOG",
... | Update the subnet DB with Net and Subnet ID, given the subnet. | [
"Update",
"the",
"subnet",
"DB",
"with",
"Net",
"and",
"Subnet",
"ID",
"given",
"the",
"subnet",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L870-L880 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_net_info | def update_net_info(self, tenant_id, direc, vlan_id, segmentation_id):
"""Update the DCNM netinfo with vlan and segmentation ID. """
serv_obj = self.get_service_obj(tenant_id)
net_dict = self.update_dcnm_net_info(tenant_id, direc, vlan_id,
segmentatio... | python | def update_net_info(self, tenant_id, direc, vlan_id, segmentation_id):
"""Update the DCNM netinfo with vlan and segmentation ID. """
serv_obj = self.get_service_obj(tenant_id)
net_dict = self.update_dcnm_net_info(tenant_id, direc, vlan_id,
segmentatio... | [
"def",
"update_net_info",
"(",
"self",
",",
"tenant_id",
",",
"direc",
",",
"vlan_id",
",",
"segmentation_id",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"net_dict",
"=",
"self",
".",
"update_dcnm_net_info",
"(",
"tenant_... | Update the DCNM netinfo with vlan and segmentation ID. | [
"Update",
"the",
"DCNM",
"netinfo",
"with",
"vlan",
"and",
"segmentation",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L882-L888 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._create_service_nwk | def _create_service_nwk(self, tenant_id, tenant_name, direc):
"""Function to create the service in network in DCNM. """
net_dict = self.retrieve_dcnm_net_info(tenant_id, direc)
net = utils.Dict2Obj(net_dict)
subnet_dict = self.retrieve_dcnm_subnet_info(tenant_id, direc)
subnet = ... | python | def _create_service_nwk(self, tenant_id, tenant_name, direc):
"""Function to create the service in network in DCNM. """
net_dict = self.retrieve_dcnm_net_info(tenant_id, direc)
net = utils.Dict2Obj(net_dict)
subnet_dict = self.retrieve_dcnm_subnet_info(tenant_id, direc)
subnet = ... | [
"def",
"_create_service_nwk",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"direc",
")",
":",
"net_dict",
"=",
"self",
".",
"retrieve_dcnm_net_info",
"(",
"tenant_id",
",",
"direc",
")",
"net",
"=",
"utils",
".",
"Dict2Obj",
"(",
"net_dict",
")",
... | Function to create the service in network in DCNM. | [
"Function",
"to",
"create",
"the",
"service",
"in",
"network",
"in",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L890-L901 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._delete_service_nwk | def _delete_service_nwk(self, tenant_id, tenant_name, direc):
"""Function to delete the service in network in DCNM. """
net_dict = {}
if direc == 'in':
seg, vlan = self.get_in_seg_vlan(tenant_id)
net_dict['part_name'] = None
else:
seg, vlan = self.get_... | python | def _delete_service_nwk(self, tenant_id, tenant_name, direc):
"""Function to delete the service in network in DCNM. """
net_dict = {}
if direc == 'in':
seg, vlan = self.get_in_seg_vlan(tenant_id)
net_dict['part_name'] = None
else:
seg, vlan = self.get_... | [
"def",
"_delete_service_nwk",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"direc",
")",
":",
"net_dict",
"=",
"{",
"}",
"if",
"direc",
"==",
"'in'",
":",
"seg",
",",
"vlan",
"=",
"self",
".",
"get_in_seg_vlan",
"(",
"tenant_id",
")",
"net_dic... | Function to delete the service in network in DCNM. | [
"Function",
"to",
"delete",
"the",
"service",
"in",
"network",
"in",
"DCNM",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L903-L921 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_dummy_router_net | def get_dummy_router_net(self, tenant_id):
"""Retrieves the dummy router information from service object. """
if tenant_id not in self.service_attr:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = self.get_service_obj(tenant_id)
retur... | python | def get_dummy_router_net(self, tenant_id):
"""Retrieves the dummy router information from service object. """
if tenant_id not in self.service_attr:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = self.get_service_obj(tenant_id)
retur... | [
"def",
"get_dummy_router_net",
"(",
"self",
",",
"tenant_id",
")",
":",
"if",
"tenant_id",
"not",
"in",
"self",
".",
"service_attr",
":",
"LOG",
".",
"error",
"(",
"\"Fabric not prepared for tenant %s\"",
",",
"tenant_id",
")",
"return",
"tenant_obj",
"=",
"self... | Retrieves the dummy router information from service object. | [
"Retrieves",
"the",
"dummy",
"router",
"information",
"from",
"service",
"object",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L923-L929 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._create_out_partition | def _create_out_partition(self, tenant_id, tenant_name):
"""Function to create a service partition. """
vrf_prof_str = self.serv_part_vrf_prof
self.dcnm_obj.create_partition(tenant_name, fw_const.SERV_PART_NAME,
None, vrf_prof_str,
... | python | def _create_out_partition(self, tenant_id, tenant_name):
"""Function to create a service partition. """
vrf_prof_str = self.serv_part_vrf_prof
self.dcnm_obj.create_partition(tenant_name, fw_const.SERV_PART_NAME,
None, vrf_prof_str,
... | [
"def",
"_create_out_partition",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"vrf_prof_str",
"=",
"self",
".",
"serv_part_vrf_prof",
"self",
".",
"dcnm_obj",
".",
"create_partition",
"(",
"tenant_name",
",",
"fw_const",
".",
"SERV_PART_NAME",
",",
... | Function to create a service partition. | [
"Function",
"to",
"create",
"a",
"service",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L931-L936 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._update_partition_srvc_node_ip | def _update_partition_srvc_node_ip(self, tenant_name, srvc_ip,
vrf_prof=None, part_name=None):
"""Function to update srvc_node address of partition. """
self.dcnm_obj.update_project(tenant_name, part_name,
service_node_ip=srvc_i... | python | def _update_partition_srvc_node_ip(self, tenant_name, srvc_ip,
vrf_prof=None, part_name=None):
"""Function to update srvc_node address of partition. """
self.dcnm_obj.update_project(tenant_name, part_name,
service_node_ip=srvc_i... | [
"def",
"_update_partition_srvc_node_ip",
"(",
"self",
",",
"tenant_name",
",",
"srvc_ip",
",",
"vrf_prof",
"=",
"None",
",",
"part_name",
"=",
"None",
")",
":",
"self",
".",
"dcnm_obj",
".",
"update_project",
"(",
"tenant_name",
",",
"part_name",
",",
"service... | Function to update srvc_node address of partition. | [
"Function",
"to",
"update",
"srvc_node",
"address",
"of",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L938-L944 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._update_partition_dci_id | def _update_partition_dci_id(self, tenant_name, dci_id,
vrf_prof=None, part_name=None):
"""Function to update DCI ID of partition. """
self.dcnm_obj.update_project(tenant_name, part_name, dci_id=dci_id,
vrf_prof=vrf_prof) | python | def _update_partition_dci_id(self, tenant_name, dci_id,
vrf_prof=None, part_name=None):
"""Function to update DCI ID of partition. """
self.dcnm_obj.update_project(tenant_name, part_name, dci_id=dci_id,
vrf_prof=vrf_prof) | [
"def",
"_update_partition_dci_id",
"(",
"self",
",",
"tenant_name",
",",
"dci_id",
",",
"vrf_prof",
"=",
"None",
",",
"part_name",
"=",
"None",
")",
":",
"self",
".",
"dcnm_obj",
".",
"update_project",
"(",
"tenant_name",
",",
"part_name",
",",
"dci_id",
"="... | Function to update DCI ID of partition. | [
"Function",
"to",
"update",
"DCI",
"ID",
"of",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L946-L950 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._update_partition_in_create | def _update_partition_in_create(self, tenant_id, tenant_name):
"""Function to update a partition. """
in_subnet_dict = self.get_in_ip_addr(tenant_id)
# self._update_partition(tenant_name, in_ip)
# Need more generic thinking on this one TODO(padkrish)
next_hop = str(netaddr.IPAdd... | python | def _update_partition_in_create(self, tenant_id, tenant_name):
"""Function to update a partition. """
in_subnet_dict = self.get_in_ip_addr(tenant_id)
# self._update_partition(tenant_name, in_ip)
# Need more generic thinking on this one TODO(padkrish)
next_hop = str(netaddr.IPAdd... | [
"def",
"_update_partition_in_create",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"in_subnet_dict",
"=",
"self",
".",
"get_in_ip_addr",
"(",
"tenant_id",
")",
"# self._update_partition(tenant_name, in_ip)",
"# Need more generic thinking on this one TODO(padkris... | Function to update a partition. | [
"Function",
"to",
"update",
"a",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L952-L958 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._update_partition_out_create | def _update_partition_out_create(self, tenant_id, tenant_name):
"""Function to update a partition. """
vrf_prof = self.serv_part_vrf_prof
seg = self.dcnm_obj.get_partition_segmentId(tenant_name,
fw_const.SERV_PART_NAME)
if seg is None:... | python | def _update_partition_out_create(self, tenant_id, tenant_name):
"""Function to update a partition. """
vrf_prof = self.serv_part_vrf_prof
seg = self.dcnm_obj.get_partition_segmentId(tenant_name,
fw_const.SERV_PART_NAME)
if seg is None:... | [
"def",
"_update_partition_out_create",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"vrf_prof",
"=",
"self",
".",
"serv_part_vrf_prof",
"seg",
"=",
"self",
".",
"dcnm_obj",
".",
"get_partition_segmentId",
"(",
"tenant_name",
",",
"fw_const",
".",
... | Function to update a partition. | [
"Function",
"to",
"update",
"a",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L964-L975 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._delete_partition | def _delete_partition(self, tenant_id, tenant_name):
"""Function to delete a service partition. """
self.dcnm_obj.delete_partition(tenant_name, fw_const.SERV_PART_NAME) | python | def _delete_partition(self, tenant_id, tenant_name):
"""Function to delete a service partition. """
self.dcnm_obj.delete_partition(tenant_name, fw_const.SERV_PART_NAME) | [
"def",
"_delete_partition",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
")",
":",
"self",
".",
"dcnm_obj",
".",
"delete_partition",
"(",
"tenant_name",
",",
"fw_const",
".",
"SERV_PART_NAME",
")"
] | Function to delete a service partition. | [
"Function",
"to",
"delete",
"a",
"service",
"partition",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L977-L979 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.allocate_seg_vlan | def allocate_seg_vlan(self, net_id, is_fw_virt, direc, tenant_id):
"""allocate segmentation ID and VLAN ID.
Allocate vlan, seg thereby storing NetID atomically.
This saves an extra step to update DB with NetID after allocation.
Also may save an extra step after restart, if process crash... | python | def allocate_seg_vlan(self, net_id, is_fw_virt, direc, tenant_id):
"""allocate segmentation ID and VLAN ID.
Allocate vlan, seg thereby storing NetID atomically.
This saves an extra step to update DB with NetID after allocation.
Also may save an extra step after restart, if process crash... | [
"def",
"allocate_seg_vlan",
"(",
"self",
",",
"net_id",
",",
"is_fw_virt",
",",
"direc",
",",
"tenant_id",
")",
":",
"seg",
"=",
"self",
".",
"alloc_seg",
"(",
"net_id",
")",
"vlan",
"=",
"0",
"# VLAN allocation is only needed for physical firewall case",
"if",
... | allocate segmentation ID and VLAN ID.
Allocate vlan, seg thereby storing NetID atomically.
This saves an extra step to update DB with NetID after allocation.
Also may save an extra step after restart, if process crashed
after allocation but before updating DB with NetID. Now, since
... | [
"allocate",
"segmentation",
"ID",
"and",
"VLAN",
"ID",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L981-L996 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_openstack_network | def create_openstack_network(self, subnet, network, tenant_id,
tenant_name, direction):
"""Helper function to create openstack network.
The net_id and subnet_id is returned. Upon failure, the subnet is
deallocated.
"""
try:
gw = str(n... | python | def create_openstack_network(self, subnet, network, tenant_id,
tenant_name, direction):
"""Helper function to create openstack network.
The net_id and subnet_id is returned. Upon failure, the subnet is
deallocated.
"""
try:
gw = str(n... | [
"def",
"create_openstack_network",
"(",
"self",
",",
"subnet",
",",
"network",
",",
"tenant_id",
",",
"tenant_name",
",",
"direction",
")",
":",
"try",
":",
"gw",
"=",
"str",
"(",
"netaddr",
".",
"IPAddress",
"(",
"subnet",
"[",
"'cidr'",
"]",
".",
"spli... | Helper function to create openstack network.
The net_id and subnet_id is returned. Upon failure, the subnet is
deallocated. | [
"Helper",
"function",
"to",
"create",
"openstack",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L998-L1019 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._create_os_nwk | def _create_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False):
"""Function to create Openstack network.
This function does the following:
1. Allocate an IP address with the net_id/subnet_id not filled in the
DB.
2. Fill network parameters w/o vlan, segmentation_id... | python | def _create_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False):
"""Function to create Openstack network.
This function does the following:
1. Allocate an IP address with the net_id/subnet_id not filled in the
DB.
2. Fill network parameters w/o vlan, segmentation_id... | [
"def",
"_create_os_nwk",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"direc",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"subnet",
"=",
"self",
".",
"alloc_retrieve_subnet_info",
"(",
"tenant_id",
",",
"direc",
")",
"network",
"=",
"self",
".",
... | Function to create Openstack network.
This function does the following:
1. Allocate an IP address with the net_id/subnet_id not filled in the
DB.
2. Fill network parameters w/o vlan, segmentation_id, because we don't
have net_id to store in DB.
3. Create a Openstac... | [
"Function",
"to",
"create",
"Openstack",
"network",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1021-L1045 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._attach_dummy_intf_rtr | def _attach_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id):
"""Function to create a dummy router and interface. """
serv_obj = self.get_service_obj(tenant_id)
fw_dict = serv_obj.get_fw_dict()
fw_id = fw_dict.get('fw_id')
rtr_nwk = fw_id[0:4] + fw_const.DUMMY_SERVICE_NWK + (... | python | def _attach_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id):
"""Function to create a dummy router and interface. """
serv_obj = self.get_service_obj(tenant_id)
fw_dict = serv_obj.get_fw_dict()
fw_id = fw_dict.get('fw_id')
rtr_nwk = fw_id[0:4] + fw_const.DUMMY_SERVICE_NWK + (... | [
"def",
"_attach_dummy_intf_rtr",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"rtr_id",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"fw_dict",
"=",
"serv_obj",
".",
"get_fw_dict",
"(",
")",
"fw_id",
"=",
"fw_d... | Function to create a dummy router and interface. | [
"Function",
"to",
"create",
"a",
"dummy",
"router",
"and",
"interface",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1047-L1072 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._delete_dummy_intf_rtr | def _delete_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id):
"""Function to delete a dummy interface of a router. """
dummy_router_dict = self.get_dummy_router_net(tenant_id)
ret = self.delete_os_dummy_rtr_nwk(dummy_router_dict.get('router_id'),
du... | python | def _delete_dummy_intf_rtr(self, tenant_id, tenant_name, rtr_id):
"""Function to delete a dummy interface of a router. """
dummy_router_dict = self.get_dummy_router_net(tenant_id)
ret = self.delete_os_dummy_rtr_nwk(dummy_router_dict.get('router_id'),
du... | [
"def",
"_delete_dummy_intf_rtr",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"rtr_id",
")",
":",
"dummy_router_dict",
"=",
"self",
".",
"get_dummy_router_net",
"(",
"tenant_id",
")",
"ret",
"=",
"self",
".",
"delete_os_dummy_rtr_nwk",
"(",
"dummy_route... | Function to delete a dummy interface of a router. | [
"Function",
"to",
"delete",
"a",
"dummy",
"interface",
"of",
"a",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1074-L1082 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_os_in_nwk | def create_os_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the Openstack IN network and stores the values in DB. """
tenant_name = fw_dict.get('tenant_name')
try:
net, subnet = self._create_os_nwk(tenant_id, tenant_name, "in",
... | python | def create_os_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the Openstack IN network and stores the values in DB. """
tenant_name = fw_dict.get('tenant_name')
try:
net, subnet = self._create_os_nwk(tenant_id, tenant_name, "in",
... | [
"def",
"create_os_in_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"try",
":",
"net",
",",
"subnet",
"=",
"self",
".",
"_create_os_nwk",... | Create the Openstack IN network and stores the values in DB. | [
"Create",
"the",
"Openstack",
"IN",
"network",
"and",
"stores",
"the",
"values",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1084-L1112 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._delete_os_nwk | def _delete_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False):
"""Delete the network created in Openstack.
Function to delete Openstack network, It also releases the associated
segmentation, VLAN and subnets.
"""
serv_obj = self.get_service_obj(tenant_id)
fw_... | python | def _delete_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False):
"""Delete the network created in Openstack.
Function to delete Openstack network, It also releases the associated
segmentation, VLAN and subnets.
"""
serv_obj = self.get_service_obj(tenant_id)
fw_... | [
"def",
"_delete_os_nwk",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"direc",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"fw_dict",
"=",
"serv_obj",
".",
"get_fw_dict",
"(",
... | Delete the network created in Openstack.
Function to delete Openstack network, It also releases the associated
segmentation, VLAN and subnets. | [
"Delete",
"the",
"network",
"created",
"in",
"Openstack",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1144-L1186 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_os_in_nwk | def delete_os_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Deletes the Openstack In network and update the DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
ret = self._delete_os_nwk(tenant_id, tenant_name, "in",
... | python | def delete_os_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Deletes the Openstack In network and update the DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
ret = self._delete_os_nwk(tenant_id, tenant_name, "in",
... | [
"def",
"delete_os_in_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"ret",
"=",
"True",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"try",
":",
"ret",
"=",
"self",
".",
"_delete_o... | Deletes the Openstack In network and update the DB. | [
"Deletes",
"the",
"Openstack",
"In",
"network",
"and",
"update",
"the",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1188-L1206 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_os_out_nwk | def delete_os_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Deletes the Openstack Out network and update the DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
ret = self._delete_os_nwk(tenant_id, tenant_name, "out",
... | python | def delete_os_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Deletes the Openstack Out network and update the DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
ret = self._delete_os_nwk(tenant_id, tenant_name, "out",
... | [
"def",
"delete_os_out_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"ret",
"=",
"True",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"try",
":",
"ret",
"=",
"self",
".",
"_delete_... | Deletes the Openstack Out network and update the DB. | [
"Deletes",
"the",
"Openstack",
"Out",
"network",
"and",
"update",
"the",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1208-L1226 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_os_dummy_rtr | def create_os_dummy_rtr(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the dummy interface and attach it to router.
Attach the dummy interface to the Openstack router and store the
info in DB.
"""
res = fw_const.OS_DUMMY_RTR_CREATE_SUCCESS
tenant_name = fw_dict.g... | python | def create_os_dummy_rtr(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the dummy interface and attach it to router.
Attach the dummy interface to the Openstack router and store the
info in DB.
"""
res = fw_const.OS_DUMMY_RTR_CREATE_SUCCESS
tenant_name = fw_dict.g... | [
"def",
"create_os_dummy_rtr",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"OS_DUMMY_RTR_CREATE_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"try",
":"... | Create the dummy interface and attach it to router.
Attach the dummy interface to the Openstack router and store the
info in DB. | [
"Create",
"the",
"dummy",
"interface",
"and",
"attach",
"it",
"to",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1228-L1260 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_os_dummy_rtr | def delete_os_dummy_rtr(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the Openstack Dummy router and store the info in DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
rtr_id = fw_dict.get('router_id')
if not rtr_id:
LOG.er... | python | def delete_os_dummy_rtr(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the Openstack Dummy router and store the info in DB. """
ret = True
tenant_name = fw_dict.get('tenant_name')
try:
rtr_id = fw_dict.get('router_id')
if not rtr_id:
LOG.er... | [
"def",
"delete_os_dummy_rtr",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"ret",
"=",
"True",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"try",
":",
"rtr_id",
"=",
"fw_dict",
".",
"... | Delete the Openstack Dummy router and store the info in DB. | [
"Delete",
"the",
"Openstack",
"Dummy",
"router",
"and",
"store",
"the",
"info",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1262-L1287 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_dcnm_in_nwk | def create_dcnm_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM In Network and store the result in DB. """
tenant_name = fw_dict.get('tenant_name')
ret = self._create_service_nwk(tenant_id, tenant_name, 'in')
if ret:
res = fw_const.DCNM_IN_NETWORK_CREAT... | python | def create_dcnm_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM In Network and store the result in DB. """
tenant_name = fw_dict.get('tenant_name')
ret = self._create_service_nwk(tenant_id, tenant_name, 'in')
if ret:
res = fw_const.DCNM_IN_NETWORK_CREAT... | [
"def",
"create_dcnm_in_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",
"self",
".",
"_create_service_nwk",
"(",
"tenant_id",
","... | Create the DCNM In Network and store the result in DB. | [
"Create",
"the",
"DCNM",
"In",
"Network",
"and",
"store",
"the",
"result",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1289-L1302 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_dcnm_in_nwk | def delete_dcnm_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM In Network and store the result in DB. """
tenant_name = fw_dict.get('tenant_name')
ret = self._delete_service_nwk(tenant_id, tenant_name, 'in')
if ret:
res = fw_const.DCNM_IN_NETWORK_DEL_S... | python | def delete_dcnm_in_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM In Network and store the result in DB. """
tenant_name = fw_dict.get('tenant_name')
ret = self._delete_service_nwk(tenant_id, tenant_name, 'in')
if ret:
res = fw_const.DCNM_IN_NETWORK_DEL_S... | [
"def",
"delete_dcnm_in_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",
"self",
".",
"_delete_service_nwk",
"(",
"tenant_id",
","... | Delete the DCNM In Network and store the result in DB. | [
"Delete",
"the",
"DCNM",
"In",
"Network",
"and",
"store",
"the",
"result",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1304-L1317 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_dcnm_in_part | def update_dcnm_in_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Update DCNM's in partition information.
Update the In partition service node IP address in DCNM and
update the result
"""
res = fw_const.DCNM_IN_PART_UPDATE_SUCCESS
tenant_name = fw_dict.get('tenant_... | python | def update_dcnm_in_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Update DCNM's in partition information.
Update the In partition service node IP address in DCNM and
update the result
"""
res = fw_const.DCNM_IN_PART_UPDATE_SUCCESS
tenant_name = fw_dict.get('tenant_... | [
"def",
"update_dcnm_in_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_IN_PART_UPDATE_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"="... | Update DCNM's in partition information.
Update the In partition service node IP address in DCNM and
update the result | [
"Update",
"DCNM",
"s",
"in",
"partition",
"information",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1319-L1338 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.clear_dcnm_in_part | def clear_dcnm_in_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Clear the DCNM in partition service information.
Clear the In partition service node IP address in DCNM and update the
result.
"""
res = fw_const.DCNM_IN_PART_UPDDEL_SUCCESS
tenant_name = fw_dict.get(... | python | def clear_dcnm_in_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Clear the DCNM in partition service information.
Clear the In partition service node IP address in DCNM and update the
result.
"""
res = fw_const.DCNM_IN_PART_UPDDEL_SUCCESS
tenant_name = fw_dict.get(... | [
"def",
"clear_dcnm_in_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_IN_PART_UPDDEL_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",... | Clear the DCNM in partition service information.
Clear the In partition service node IP address in DCNM and update the
result. | [
"Clear",
"the",
"DCNM",
"in",
"partition",
"service",
"information",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1340-L1359 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_dcnm_out_part | def create_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM OUT partition and update the result. """
res = fw_const.DCNM_OUT_PART_CREATE_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
self._create_out_partition(tenant_id,... | python | def create_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM OUT partition and update the result. """
res = fw_const.DCNM_OUT_PART_CREATE_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
self._create_out_partition(tenant_id,... | [
"def",
"create_dcnm_out_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_OUT_PART_CREATE_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"... | Create the DCNM OUT partition and update the result. | [
"Create",
"the",
"DCNM",
"OUT",
"partition",
"and",
"update",
"the",
"result",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1361-L1376 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_dcnm_out_part | def delete_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM OUT partition and update the result. """
res = fw_const.DCNM_OUT_PART_DEL_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
self._delete_partition(tenant_id, tenant... | python | def delete_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM OUT partition and update the result. """
res = fw_const.DCNM_OUT_PART_DEL_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
self._delete_partition(tenant_id, tenant... | [
"def",
"delete_dcnm_out_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_OUT_PART_DEL_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",... | Delete the DCNM OUT partition and update the result. | [
"Delete",
"the",
"DCNM",
"OUT",
"partition",
"and",
"update",
"the",
"result",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1378-L1393 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.create_dcnm_out_nwk | def create_dcnm_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM OUT Network and update the result. """
tenant_name = fw_dict.get('tenant_name')
ret = self._create_service_nwk(tenant_id, tenant_name, 'out')
if ret:
res = fw_const.DCNM_OUT_NETWORK_CREATE... | python | def create_dcnm_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Create the DCNM OUT Network and update the result. """
tenant_name = fw_dict.get('tenant_name')
ret = self._create_service_nwk(tenant_id, tenant_name, 'out')
if ret:
res = fw_const.DCNM_OUT_NETWORK_CREATE... | [
"def",
"create_dcnm_out_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",
"self",
".",
"_create_service_nwk",
"(",
"tenant_id",
",... | Create the DCNM OUT Network and update the result. | [
"Create",
"the",
"DCNM",
"OUT",
"Network",
"and",
"update",
"the",
"result",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1395-L1408 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_dcnm_out_nwk | def delete_dcnm_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM OUT network and update the result. """
tenant_name = fw_dict.get('tenant_name')
ret = self._delete_service_nwk(tenant_id, tenant_name, 'out')
if ret:
res = fw_const.DCNM_OUT_NETWORK_DEL_SU... | python | def delete_dcnm_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False):
"""Delete the DCNM OUT network and update the result. """
tenant_name = fw_dict.get('tenant_name')
ret = self._delete_service_nwk(tenant_id, tenant_name, 'out')
if ret:
res = fw_const.DCNM_OUT_NETWORK_DEL_SU... | [
"def",
"delete_dcnm_out_nwk",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"=",
"self",
".",
"_delete_service_nwk",
"(",
"tenant_id",
",... | Delete the DCNM OUT network and update the result. | [
"Delete",
"the",
"DCNM",
"OUT",
"network",
"and",
"update",
"the",
"result",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1410-L1423 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.update_dcnm_out_part | def update_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Update DCNM OUT partition service node IP address and result. """
res = fw_const.DCNM_OUT_PART_UPDATE_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
ret = self._update_partition... | python | def update_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Update DCNM OUT partition service node IP address and result. """
res = fw_const.DCNM_OUT_PART_UPDATE_SUCCESS
tenant_name = fw_dict.get('tenant_name')
ret = True
try:
ret = self._update_partition... | [
"def",
"update_dcnm_out_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_OUT_PART_UPDATE_SUCCESS",
"tenant_name",
"=",
"fw_dict",
".",
"get",
"(",
"'tenant_name'",
")",
"ret",
"... | Update DCNM OUT partition service node IP address and result. | [
"Update",
"DCNM",
"OUT",
"partition",
"service",
"node",
"IP",
"address",
"and",
"result",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1425-L1442 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.clear_dcnm_out_part | def clear_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Clear DCNM out partition information.
Clear the DCNM OUT partition service node IP address and update
the result
"""
res = fw_const.DCNM_OUT_PART_UPDDEL_SUCCESS
self.update_fw_db_result(tenant_id, dc... | python | def clear_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
"""Clear DCNM out partition information.
Clear the DCNM OUT partition service node IP address and update
the result
"""
res = fw_const.DCNM_OUT_PART_UPDDEL_SUCCESS
self.update_fw_db_result(tenant_id, dc... | [
"def",
"clear_dcnm_out_part",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
"=",
"False",
")",
":",
"res",
"=",
"fw_const",
".",
"DCNM_OUT_PART_UPDDEL_SUCCESS",
"self",
".",
"update_fw_db_result",
"(",
"tenant_id",
",",
"dcnm_status",
"=",
"r... | Clear DCNM out partition information.
Clear the DCNM OUT partition service node IP address and update
the result | [
"Clear",
"DCNM",
"out",
"partition",
"information",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1444-L1453 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_next_create_state | def get_next_create_state(self, state, ret):
"""Return the next create state from previous state. """
if ret:
if state == fw_const.FABRIC_PREPARE_DONE_STATE:
return state
else:
return state + 1
else:
return state | python | def get_next_create_state(self, state, ret):
"""Return the next create state from previous state. """
if ret:
if state == fw_const.FABRIC_PREPARE_DONE_STATE:
return state
else:
return state + 1
else:
return state | [
"def",
"get_next_create_state",
"(",
"self",
",",
"state",
",",
"ret",
")",
":",
"if",
"ret",
":",
"if",
"state",
"==",
"fw_const",
".",
"FABRIC_PREPARE_DONE_STATE",
":",
"return",
"state",
"else",
":",
"return",
"state",
"+",
"1",
"else",
":",
"return",
... | Return the next create state from previous state. | [
"Return",
"the",
"next",
"create",
"state",
"from",
"previous",
"state",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1463-L1471 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_next_del_state | def get_next_del_state(self, state, ret):
"""Return the next delete state from previous state. """
if ret:
if state == fw_const.INIT_STATE:
return state
else:
return state - 1
else:
return state | python | def get_next_del_state(self, state, ret):
"""Return the next delete state from previous state. """
if ret:
if state == fw_const.INIT_STATE:
return state
else:
return state - 1
else:
return state | [
"def",
"get_next_del_state",
"(",
"self",
",",
"state",
",",
"ret",
")",
":",
"if",
"ret",
":",
"if",
"state",
"==",
"fw_const",
".",
"INIT_STATE",
":",
"return",
"state",
"else",
":",
"return",
"state",
"-",
"1",
"else",
":",
"return",
"state"
] | Return the next delete state from previous state. | [
"Return",
"the",
"next",
"delete",
"state",
"from",
"previous",
"state",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1473-L1481 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_next_state | def get_next_state(self, state, ret, oper):
"""Returns the next state for a create or delete operation. """
if oper == fw_const.FW_CR_OP:
return self.get_next_create_state(state, ret)
else:
return self.get_next_del_state(state, ret) | python | def get_next_state(self, state, ret, oper):
"""Returns the next state for a create or delete operation. """
if oper == fw_const.FW_CR_OP:
return self.get_next_create_state(state, ret)
else:
return self.get_next_del_state(state, ret) | [
"def",
"get_next_state",
"(",
"self",
",",
"state",
",",
"ret",
",",
"oper",
")",
":",
"if",
"oper",
"==",
"fw_const",
".",
"FW_CR_OP",
":",
"return",
"self",
".",
"get_next_create_state",
"(",
"state",
",",
"ret",
")",
"else",
":",
"return",
"self",
"... | Returns the next state for a create or delete operation. | [
"Returns",
"the",
"next",
"state",
"for",
"a",
"create",
"or",
"delete",
"operation",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1483-L1488 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.run_create_sm | def run_create_sm(self, tenant_id, fw_dict, is_fw_virt):
"""Runs the create State Machine.
Goes through every state function until the end or when one state
returns failure.
"""
ret = True
serv_obj = self.get_service_obj(tenant_id)
state = serv_obj.get_state()
... | python | def run_create_sm(self, tenant_id, fw_dict, is_fw_virt):
"""Runs the create State Machine.
Goes through every state function until the end or when one state
returns failure.
"""
ret = True
serv_obj = self.get_service_obj(tenant_id)
state = serv_obj.get_state()
... | [
"def",
"run_create_sm",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
")",
":",
"ret",
"=",
"True",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"state",
"=",
"serv_obj",
".",
"get_state",
"(",
")",
"# Preserv... | Runs the create State Machine.
Goes through every state function until the end or when one state
returns failure. | [
"Runs",
"the",
"create",
"State",
"Machine",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1490-L1523 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.run_delete_sm | def run_delete_sm(self, tenant_id, fw_dict, is_fw_virt):
"""Runs the delete State Machine.
Goes through every state function until the end or when one state
returns failure.
"""
# Read the current state from the DB
ret = True
serv_obj = self.get_service_obj(tenan... | python | def run_delete_sm(self, tenant_id, fw_dict, is_fw_virt):
"""Runs the delete State Machine.
Goes through every state function until the end or when one state
returns failure.
"""
# Read the current state from the DB
ret = True
serv_obj = self.get_service_obj(tenan... | [
"def",
"run_delete_sm",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
")",
":",
"# Read the current state from the DB",
"ret",
"=",
"True",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"state",
"=",
"serv_obj",
".",... | Runs the delete State Machine.
Goes through every state function until the end or when one state
returns failure. | [
"Runs",
"the",
"delete",
"State",
"Machine",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1525-L1557 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.get_key_state | def get_key_state(self, status, state_dict):
"""Returns the key associated with the dict. """
for key, val in state_dict.items():
if val == status:
return key | python | def get_key_state(self, status, state_dict):
"""Returns the key associated with the dict. """
for key, val in state_dict.items():
if val == status:
return key | [
"def",
"get_key_state",
"(",
"self",
",",
"status",
",",
"state_dict",
")",
":",
"for",
"key",
",",
"val",
"in",
"state_dict",
".",
"items",
"(",
")",
":",
"if",
"val",
"==",
"status",
":",
"return",
"key"
] | Returns the key associated with the dict. | [
"Returns",
"the",
"key",
"associated",
"with",
"the",
"dict",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1559-L1563 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.pop_fw_state | def pop_fw_state(self, compl_result, os_status, dcnm_status):
"""Populate the state information in the cache.
Check if state information is embedded in result
If not:
a. It's still in Init state and no SM is called yet
b. The SM has completely run
c. Delete has started a... | python | def pop_fw_state(self, compl_result, os_status, dcnm_status):
"""Populate the state information in the cache.
Check if state information is embedded in result
If not:
a. It's still in Init state and no SM is called yet
b. The SM has completely run
c. Delete has started a... | [
"def",
"pop_fw_state",
"(",
"self",
",",
"compl_result",
",",
"os_status",
",",
"dcnm_status",
")",
":",
"res_list",
"=",
"compl_result",
".",
"split",
"(",
"'('",
")",
"state_num",
"=",
"None",
"if",
"len",
"(",
"res_list",
")",
">",
"1",
":",
"state_nu... | Populate the state information in the cache.
Check if state information is embedded in result
If not:
a. It's still in Init state and no SM is called yet
b. The SM has completely run
c. Delete has started and before any SM is run, it restarted. | [
"Populate",
"the",
"state",
"information",
"in",
"the",
"cache",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1565-L1588 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.pop_fw_local | def pop_fw_local(self, tenant_id, net_id, direc, node_ip):
"""Populate the local cache.
Read the Network DB and populate the local cache.
Read the subnet from the Subnet DB, given the net_id and populate the
cache.
"""
net = self.get_network(net_id)
serv_obj = se... | python | def pop_fw_local(self, tenant_id, net_id, direc, node_ip):
"""Populate the local cache.
Read the Network DB and populate the local cache.
Read the subnet from the Subnet DB, given the net_id and populate the
cache.
"""
net = self.get_network(net_id)
serv_obj = se... | [
"def",
"pop_fw_local",
"(",
"self",
",",
"tenant_id",
",",
"net_id",
",",
"direc",
",",
"node_ip",
")",
":",
"net",
"=",
"self",
".",
"get_network",
"(",
"net_id",
")",
"serv_obj",
"=",
"self",
".",
"get_service_obj",
"(",
"tenant_id",
")",
"serv_obj",
"... | Populate the local cache.
Read the Network DB and populate the local cache.
Read the subnet from the Subnet DB, given the net_id and populate the
cache. | [
"Populate",
"the",
"local",
"cache",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1590-L1614 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.populate_local_cache_tenant | def populate_local_cache_tenant(self, fw_id, fw_data):
"""Populate the cache for a given tenant.
Calls routines to Populate the in and out information.
Update the result information.
Populate the state information.
Populate the router information.
"""
tenant_id =... | python | def populate_local_cache_tenant(self, fw_id, fw_data):
"""Populate the cache for a given tenant.
Calls routines to Populate the in and out information.
Update the result information.
Populate the state information.
Populate the router information.
"""
tenant_id =... | [
"def",
"populate_local_cache_tenant",
"(",
"self",
",",
"fw_id",
",",
"fw_data",
")",
":",
"tenant_id",
"=",
"fw_data",
".",
"get",
"(",
"'tenant_id'",
")",
"self",
".",
"create_serv_obj",
"(",
"tenant_id",
")",
"serv_obj",
"=",
"self",
".",
"get_service_obj",... | Populate the cache for a given tenant.
Calls routines to Populate the in and out information.
Update the result information.
Populate the state information.
Populate the router information. | [
"Populate",
"the",
"cache",
"for",
"a",
"given",
"tenant",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1617-L1655 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.populate_local_cache | def populate_local_cache(self):
"""Populate the local cache from DB.
Read the entries from FW DB and Calls routines to populate the cache.
"""
fw_dict = self.get_all_fw_db()
for fw_id in fw_dict:
LOG.info("Populating cache for FW %s", fw_id)
fw_data = fw_... | python | def populate_local_cache(self):
"""Populate the local cache from DB.
Read the entries from FW DB and Calls routines to populate the cache.
"""
fw_dict = self.get_all_fw_db()
for fw_id in fw_dict:
LOG.info("Populating cache for FW %s", fw_id)
fw_data = fw_... | [
"def",
"populate_local_cache",
"(",
"self",
")",
":",
"fw_dict",
"=",
"self",
".",
"get_all_fw_db",
"(",
")",
"for",
"fw_id",
"in",
"fw_dict",
":",
"LOG",
".",
"info",
"(",
"\"Populating cache for FW %s\"",
",",
"fw_id",
")",
"fw_data",
"=",
"fw_dict",
"[",
... | Populate the local cache from DB.
Read the entries from FW DB and Calls routines to populate the cache. | [
"Populate",
"the",
"local",
"cache",
"from",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1657-L1666 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_os_dummy_rtr_nwk | def delete_os_dummy_rtr_nwk(self, rtr_id, net_id, subnet_id):
"""Delete the dummy interface to the router. """
subnet_lst = set()
subnet_lst.add(subnet_id)
ret = self.os_helper.delete_intf_router(None, None, rtr_id, subnet_lst)
if not ret:
return ret
return s... | python | def delete_os_dummy_rtr_nwk(self, rtr_id, net_id, subnet_id):
"""Delete the dummy interface to the router. """
subnet_lst = set()
subnet_lst.add(subnet_id)
ret = self.os_helper.delete_intf_router(None, None, rtr_id, subnet_lst)
if not ret:
return ret
return s... | [
"def",
"delete_os_dummy_rtr_nwk",
"(",
"self",
",",
"rtr_id",
",",
"net_id",
",",
"subnet_id",
")",
":",
"subnet_lst",
"=",
"set",
"(",
")",
"subnet_lst",
".",
"add",
"(",
"subnet_id",
")",
"ret",
"=",
"self",
".",
"os_helper",
".",
"delete_intf_router",
"... | Delete the dummy interface to the router. | [
"Delete",
"the",
"dummy",
"interface",
"to",
"the",
"router",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1668-L1675 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_os_nwk_db | def delete_os_nwk_db(self, net_id, seg, vlan):
"""Delete the Openstack Network from the database.
Release the segmentation ID, VLAN associated with the net.
Delete the network given the partial name.
Delete the entry from Network DB, given the net ID.
Delete the entry from Firew... | python | def delete_os_nwk_db(self, net_id, seg, vlan):
"""Delete the Openstack Network from the database.
Release the segmentation ID, VLAN associated with the net.
Delete the network given the partial name.
Delete the entry from Network DB, given the net ID.
Delete the entry from Firew... | [
"def",
"delete_os_nwk_db",
"(",
"self",
",",
"net_id",
",",
"seg",
",",
"vlan",
")",
":",
"if",
"seg",
"is",
"not",
"None",
":",
"self",
".",
"service_segs",
".",
"release_segmentation_id",
"(",
"seg",
")",
"if",
"vlan",
"is",
"not",
"None",
":",
"self... | Delete the Openstack Network from the database.
Release the segmentation ID, VLAN associated with the net.
Delete the network given the partial name.
Delete the entry from Network DB, given the net ID.
Delete the entry from Firewall DB, given the net ID.
Release the IN/OUT sug=b... | [
"Delete",
"the",
"Openstack",
"Network",
"from",
"the",
"database",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1677-L1699 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.correct_db_restart | def correct_db_restart(self):
"""Ensure DB is consistent after unexpected restarts. """
LOG.info("Checking consistency of DB")
# Any Segments allocated that's not in Network or FW DB, release it
seg_netid_dict = self.service_segs.get_seg_netid_src(fw_const.FW_CONST)
vlan_netid_di... | python | def correct_db_restart(self):
"""Ensure DB is consistent after unexpected restarts. """
LOG.info("Checking consistency of DB")
# Any Segments allocated that's not in Network or FW DB, release it
seg_netid_dict = self.service_segs.get_seg_netid_src(fw_const.FW_CONST)
vlan_netid_di... | [
"def",
"correct_db_restart",
"(",
"self",
")",
":",
"LOG",
".",
"info",
"(",
"\"Checking consistency of DB\"",
")",
"# Any Segments allocated that's not in Network or FW DB, release it",
"seg_netid_dict",
"=",
"self",
".",
"service_segs",
".",
"get_seg_netid_src",
"(",
"fw_... | Ensure DB is consistent after unexpected restarts. | [
"Ensure",
"DB",
"is",
"consistent",
"after",
"unexpected",
"restarts",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1702-L1793 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase._prepare_fabric_fw_internal | def _prepare_fabric_fw_internal(self, tenant_id, fw_dict, is_fw_virt,
result):
"""Internal routine to prepare the fabric.
This creates an entry in FW DB and runs the SM.
"""
if not self.auto_nwk_create:
LOG.info("Auto network creation disa... | python | def _prepare_fabric_fw_internal(self, tenant_id, fw_dict, is_fw_virt,
result):
"""Internal routine to prepare the fabric.
This creates an entry in FW DB and runs the SM.
"""
if not self.auto_nwk_create:
LOG.info("Auto network creation disa... | [
"def",
"_prepare_fabric_fw_internal",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
",",
"result",
")",
":",
"if",
"not",
"self",
".",
"auto_nwk_create",
":",
"LOG",
".",
"info",
"(",
"\"Auto network creation disabled\"",
")",
"return",
"Fals... | Internal routine to prepare the fabric.
This creates an entry in FW DB and runs the SM. | [
"Internal",
"routine",
"to",
"prepare",
"the",
"fabric",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1799-L1837 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.prepare_fabric_fw | def prepare_fabric_fw(self, tenant_id, fw_dict, is_fw_virt, result):
"""Top level routine to prepare the fabric. """
try:
with self.mutex_lock:
ret = self._prepare_fabric_fw_internal(tenant_id, fw_dict,
is_fw_virt, result... | python | def prepare_fabric_fw(self, tenant_id, fw_dict, is_fw_virt, result):
"""Top level routine to prepare the fabric. """
try:
with self.mutex_lock:
ret = self._prepare_fabric_fw_internal(tenant_id, fw_dict,
is_fw_virt, result... | [
"def",
"prepare_fabric_fw",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
",",
"result",
")",
":",
"try",
":",
"with",
"self",
".",
"mutex_lock",
":",
"ret",
"=",
"self",
".",
"_prepare_fabric_fw_internal",
"(",
"tenant_id",
",",
"fw_dict... | Top level routine to prepare the fabric. | [
"Top",
"level",
"routine",
"to",
"prepare",
"the",
"fabric",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1839-L1848 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_fabric_fw_internal | def delete_fabric_fw_internal(self, tenant_id, fw_dict, is_fw_virt,
result):
"""Internal routine to delete the fabric configuration.
This runs the SM and deletes the entries from DB and local cache.
"""
if not self.auto_nwk_create:
LOG.info(... | python | def delete_fabric_fw_internal(self, tenant_id, fw_dict, is_fw_virt,
result):
"""Internal routine to delete the fabric configuration.
This runs the SM and deletes the entries from DB and local cache.
"""
if not self.auto_nwk_create:
LOG.info(... | [
"def",
"delete_fabric_fw_internal",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
",",
"result",
")",
":",
"if",
"not",
"self",
".",
"auto_nwk_create",
":",
"LOG",
".",
"info",
"(",
"\"Auto network creation disabled\"",
")",
"return",
"False"... | Internal routine to delete the fabric configuration.
This runs the SM and deletes the entries from DB and local cache. | [
"Internal",
"routine",
"to",
"delete",
"the",
"fabric",
"configuration",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1850-L1893 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.delete_fabric_fw | def delete_fabric_fw(self, tenant_id, fw_dict, is_fw_virt, result):
"""Top level routine to unconfigure the fabric. """
try:
with self.mutex_lock:
ret = self.delete_fabric_fw_internal(tenant_id, fw_dict,
is_fw_virt, result)... | python | def delete_fabric_fw(self, tenant_id, fw_dict, is_fw_virt, result):
"""Top level routine to unconfigure the fabric. """
try:
with self.mutex_lock:
ret = self.delete_fabric_fw_internal(tenant_id, fw_dict,
is_fw_virt, result)... | [
"def",
"delete_fabric_fw",
"(",
"self",
",",
"tenant_id",
",",
"fw_dict",
",",
"is_fw_virt",
",",
"result",
")",
":",
"try",
":",
"with",
"self",
".",
"mutex_lock",
":",
"ret",
"=",
"self",
".",
"delete_fabric_fw_internal",
"(",
"tenant_id",
",",
"fw_dict",
... | Top level routine to unconfigure the fabric. | [
"Top",
"level",
"routine",
"to",
"unconfigure",
"the",
"fabric",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1895-L1904 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.retry_failure_internal | def retry_failure_internal(self, tenant_id, tenant_name, fw_data,
is_fw_virt, result):
"""Internal routine to retry the failed cases. """
if not self.auto_nwk_create:
LOG.info("Auto network creation disabled")
return False
try:
#... | python | def retry_failure_internal(self, tenant_id, tenant_name, fw_data,
is_fw_virt, result):
"""Internal routine to retry the failed cases. """
if not self.auto_nwk_create:
LOG.info("Auto network creation disabled")
return False
try:
#... | [
"def",
"retry_failure_internal",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"fw_data",
",",
"is_fw_virt",
",",
"result",
")",
":",
"if",
"not",
"self",
".",
"auto_nwk_create",
":",
"LOG",
".",
"info",
"(",
"\"Auto network creation disabled\"",
")",
... | Internal routine to retry the failed cases. | [
"Internal",
"routine",
"to",
"retry",
"the",
"failed",
"cases",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1906-L1934 |
openstack/networking-cisco | networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py | FabricBase.retry_failure | def retry_failure(self, tenant_id, tenant_name, fw_data, is_fw_virt,
result):
"""Top level retry failure routine. """
try:
with self.mutex_lock:
ret = self.retry_failure_internal(tenant_id, tenant_name,
f... | python | def retry_failure(self, tenant_id, tenant_name, fw_data, is_fw_virt,
result):
"""Top level retry failure routine. """
try:
with self.mutex_lock:
ret = self.retry_failure_internal(tenant_id, tenant_name,
f... | [
"def",
"retry_failure",
"(",
"self",
",",
"tenant_id",
",",
"tenant_name",
",",
"fw_data",
",",
"is_fw_virt",
",",
"result",
")",
":",
"try",
":",
"with",
"self",
".",
"mutex_lock",
":",
"ret",
"=",
"self",
".",
"retry_failure_internal",
"(",
"tenant_id",
... | Top level retry failure routine. | [
"Top",
"level",
"retry",
"failure",
"routine",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1936-L1946 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/config.py | get_specific_config | def get_specific_config(prefix):
"""Retrieve config based on the format [<prefix>:<value>].
returns: a dict, {<UUID>: {<key1>:<value1>, <key2>:<value2>, ...}}
"""
conf_dict = {}
for uuid, val in cfg.CONF.get(prefix, {}).items():
conf_dict[uuid] = dict(val)
return conf_dict | python | def get_specific_config(prefix):
"""Retrieve config based on the format [<prefix>:<value>].
returns: a dict, {<UUID>: {<key1>:<value1>, <key2>:<value2>, ...}}
"""
conf_dict = {}
for uuid, val in cfg.CONF.get(prefix, {}).items():
conf_dict[uuid] = dict(val)
return conf_dict | [
"def",
"get_specific_config",
"(",
"prefix",
")",
":",
"conf_dict",
"=",
"{",
"}",
"for",
"uuid",
",",
"val",
"in",
"cfg",
".",
"CONF",
".",
"get",
"(",
"prefix",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
":",
"conf_dict",
"[",
"uuid",
"]",
"="... | Retrieve config based on the format [<prefix>:<value>].
returns: a dict, {<UUID>: {<key1>:<value1>, <key2>:<value2>, ...}} | [
"Retrieve",
"config",
"based",
"on",
"the",
"format",
"[",
"<prefix",
">",
":",
"<value",
">",
"]",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L137-L145 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/config.py | verify_resource_dict | def verify_resource_dict(res_dict, is_create, attr_info):
"""Verifies required attributes are in resource dictionary, res_dict.
Also checking that an attribute is only specified if it is allowed
for the given operation (create/update).
Attribute with default values are considered to be optional.
... | python | def verify_resource_dict(res_dict, is_create, attr_info):
"""Verifies required attributes are in resource dictionary, res_dict.
Also checking that an attribute is only specified if it is allowed
for the given operation (create/update).
Attribute with default values are considered to be optional.
... | [
"def",
"verify_resource_dict",
"(",
"res_dict",
",",
"is_create",
",",
"attr_info",
")",
":",
"if",
"(",
"(",
"bc",
".",
"NEUTRON_VERSION",
">=",
"bc",
".",
"NEUTRON_NEWTON_VERSION",
")",
"and",
"'tenant_id'",
"in",
"res_dict",
")",
":",
"res_dict",
"[",
"'p... | Verifies required attributes are in resource dictionary, res_dict.
Also checking that an attribute is only specified if it is allowed
for the given operation (create/update).
Attribute with default values are considered to be optional.
This function contains code taken from function 'prepare_request_... | [
"Verifies",
"required",
"attributes",
"are",
"in",
"resource",
"dictionary",
"res_dict",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L148-L199 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/config.py | uuidify | def uuidify(val):
"""Takes an integer and transforms it to a UUID format.
returns: UUID formatted version of input.
"""
if uuidutils.is_uuid_like(val):
return val
else:
try:
int_val = int(val, 16)
except ValueError:
with excutils.save_and_reraise_exce... | python | def uuidify(val):
"""Takes an integer and transforms it to a UUID format.
returns: UUID formatted version of input.
"""
if uuidutils.is_uuid_like(val):
return val
else:
try:
int_val = int(val, 16)
except ValueError:
with excutils.save_and_reraise_exce... | [
"def",
"uuidify",
"(",
"val",
")",
":",
"if",
"uuidutils",
".",
"is_uuid_like",
"(",
"val",
")",
":",
"return",
"val",
"else",
":",
"try",
":",
"int_val",
"=",
"int",
"(",
"val",
",",
"16",
")",
"except",
"ValueError",
":",
"with",
"excutils",
".",
... | Takes an integer and transforms it to a UUID format.
returns: UUID formatted version of input. | [
"Takes",
"an",
"integer",
"and",
"transforms",
"it",
"to",
"a",
"UUID",
"format",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L202-L219 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/config.py | _ensure_format | def _ensure_format(rule, attribute, res_dict):
"""Verifies that attribute in res_dict is properly formatted.
Since, in the .ini-files, lists are specified as ':' separated text and
UUID values can be plain integers we need to transform any such values
into proper format. Empty strings are converted to ... | python | def _ensure_format(rule, attribute, res_dict):
"""Verifies that attribute in res_dict is properly formatted.
Since, in the .ini-files, lists are specified as ':' separated text and
UUID values can be plain integers we need to transform any such values
into proper format. Empty strings are converted to ... | [
"def",
"_ensure_format",
"(",
"rule",
",",
"attribute",
",",
"res_dict",
")",
":",
"if",
"rule",
"==",
"'type:uuid'",
"or",
"(",
"rule",
"==",
"'type:uuid_or_none'",
"and",
"res_dict",
"[",
"attribute",
"]",
")",
":",
"res_dict",
"[",
"attribute",
"]",
"="... | Verifies that attribute in res_dict is properly formatted.
Since, in the .ini-files, lists are specified as ':' separated text and
UUID values can be plain integers we need to transform any such values
into proper format. Empty strings are converted to None if validator
specifies that None value is acc... | [
"Verifies",
"that",
"attribute",
"in",
"res_dict",
"is",
"properly",
"formatted",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L222-L242 |
openstack/networking-cisco | networking_cisco/plugins/cisco/device_manager/config.py | obtain_hosting_device_credentials_from_config | def obtain_hosting_device_credentials_from_config():
"""Obtains credentials from config file and stores them in memory.
To be called before hosting device templates defined in the config file
are created.
"""
cred_dict = get_specific_config('cisco_hosting_device_credential')
attr_info = {
... | python | def obtain_hosting_device_credentials_from_config():
"""Obtains credentials from config file and stores them in memory.
To be called before hosting device templates defined in the config file
are created.
"""
cred_dict = get_specific_config('cisco_hosting_device_credential')
attr_info = {
... | [
"def",
"obtain_hosting_device_credentials_from_config",
"(",
")",
":",
"cred_dict",
"=",
"get_specific_config",
"(",
"'cisco_hosting_device_credential'",
")",
"attr_info",
"=",
"{",
"'name'",
":",
"{",
"'allow_post'",
":",
"True",
",",
"'allow_put'",
":",
"True",
",",... | Obtains credentials from config file and stores them in memory.
To be called before hosting device templates defined in the config file
are created. | [
"Obtains",
"credentials",
"from",
"config",
"file",
"and",
"stores",
"them",
"in",
"memory",
".",
"To",
"be",
"called",
"before",
"hosting",
"device",
"templates",
"defined",
"in",
"the",
"config",
"file",
"are",
"created",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/config.py#L245-L273 |
openstack/networking-cisco | networking_cisco/plugins/cisco/extensions/routertype.py | Routertype.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)
return resource_helpe... | 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)
return resource_helpe... | [
"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/routertype.py#L132-L140 |
openstack/networking-cisco | networking_cisco/plugins/cisco/extensions/routertype.py | RoutertypePluginBase.get_routertypes | def get_routertypes(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
"""Lists defined router types."""
pass | python | def get_routertypes(self, context, filters=None, fields=None,
sorts=None, limit=None, marker=None,
page_reverse=False):
"""Lists defined router types."""
pass | [
"def",
"get_routertypes",
"(",
"self",
",",
"context",
",",
"filters",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"sorts",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"page_reverse",
"=",
"False",
")",
":",
"pass"
] | Lists defined router types. | [
"Lists",
"defined",
"router",
"types",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/extensions/routertype.py#L213-L217 |
openstack/networking-cisco | networking_cisco/db/migration/alembic_migrations/env.py | run_migrations_online | def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
set_mysql_engine()
engine = session.create_engine(neutron_config.database.connection)
connection = engine.connect()
context.co... | python | def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
set_mysql_engine()
engine = session.create_engine(neutron_config.database.connection)
connection = engine.connect()
context.co... | [
"def",
"run_migrations_online",
"(",
")",
":",
"set_mysql_engine",
"(",
")",
"engine",
"=",
"session",
".",
"create_engine",
"(",
"neutron_config",
".",
"database",
".",
"connection",
")",
"connection",
"=",
"engine",
".",
"connect",
"(",
")",
"context",
".",
... | Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context. | [
"Run",
"migrations",
"in",
"online",
"mode",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/db/migration/alembic_migrations/env.py#L96-L119 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | ToolProvider.has_role | def has_role(self, role):
'''
Check whether the Launch Paramters set the role.
'''
return self.roles and any([re.search(role, our_role, re.I)
for our_role in self.roles]) | python | def has_role(self, role):
'''
Check whether the Launch Paramters set the role.
'''
return self.roles and any([re.search(role, our_role, re.I)
for our_role in self.roles]) | [
"def",
"has_role",
"(",
"self",
",",
"role",
")",
":",
"return",
"self",
".",
"roles",
"and",
"any",
"(",
"[",
"re",
".",
"search",
"(",
"role",
",",
"our_role",
",",
"re",
".",
"I",
")",
"for",
"our_role",
"in",
"self",
".",
"roles",
"]",
")"
] | Check whether the Launch Paramters set the role. | [
"Check",
"whether",
"the",
"Launch",
"Paramters",
"set",
"the",
"role",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L57-L62 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | ToolProvider.username | def username(self, default=None):
'''
Return the full, given, or family name if set.
'''
if self.lis_person_name_given:
return self.lis_person_name_given
elif self.lis_person_name_family:
return self.lis_person_name_family
elif self.lis_person_name... | python | def username(self, default=None):
'''
Return the full, given, or family name if set.
'''
if self.lis_person_name_given:
return self.lis_person_name_given
elif self.lis_person_name_family:
return self.lis_person_name_family
elif self.lis_person_name... | [
"def",
"username",
"(",
"self",
",",
"default",
"=",
"None",
")",
":",
"if",
"self",
".",
"lis_person_name_given",
":",
"return",
"self",
".",
"lis_person_name_given",
"elif",
"self",
".",
"lis_person_name_family",
":",
"return",
"self",
".",
"lis_person_name_fa... | Return the full, given, or family name if set. | [
"Return",
"the",
"full",
"given",
"or",
"family",
"name",
"if",
"set",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L96-L107 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | ToolProvider.post_replace_result | def post_replace_result(self, score, outcome_opts=defaultdict(lambda:None), result_data=None):
'''
POSTs the given score to the Tool Consumer with a replaceResult.
Returns OutcomeResponse object and stores it in self.outcome_request
OPTIONAL:
result_data must be a dictionar... | python | def post_replace_result(self, score, outcome_opts=defaultdict(lambda:None), result_data=None):
'''
POSTs the given score to the Tool Consumer with a replaceResult.
Returns OutcomeResponse object and stores it in self.outcome_request
OPTIONAL:
result_data must be a dictionar... | [
"def",
"post_replace_result",
"(",
"self",
",",
"score",
",",
"outcome_opts",
"=",
"defaultdict",
"(",
"lambda",
":",
"None",
")",
",",
"result_data",
"=",
"None",
")",
":",
"return",
"self",
".",
"new_request",
"(",
"outcome_opts",
")",
".",
"post_replace_r... | POSTs the given score to the Tool Consumer with a replaceResult.
Returns OutcomeResponse object and stores it in self.outcome_request
OPTIONAL:
result_data must be a dictionary
Note: ONLY ONE of these values can be in the dict at a time,
due to the Canvas specificat... | [
"POSTs",
"the",
"given",
"score",
"to",
"the",
"Tool",
"Consumer",
"with",
"a",
"replaceResult",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L109-L123 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | ToolProvider.build_return_url | def build_return_url(self):
'''
If the Tool Consumer sent a return URL, add any set messages to the
URL.
'''
if not self.launch_presentation_return_url:
return None
lti_message_fields = ['lti_errormsg', 'lti_errorlog',
'lti_msg',... | python | def build_return_url(self):
'''
If the Tool Consumer sent a return URL, add any set messages to the
URL.
'''
if not self.launch_presentation_return_url:
return None
lti_message_fields = ['lti_errormsg', 'lti_errorlog',
'lti_msg',... | [
"def",
"build_return_url",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"launch_presentation_return_url",
":",
"return",
"None",
"lti_message_fields",
"=",
"[",
"'lti_errormsg'",
",",
"'lti_errorlog'",
",",
"'lti_msg'",
",",
"'lti_log'",
"]",
"messages",
"=",
... | If the Tool Consumer sent a return URL, add any set messages to the
URL. | [
"If",
"the",
"Tool",
"Consumer",
"sent",
"a",
"return",
"URL",
"add",
"any",
"set",
"messages",
"to",
"the",
"URL",
"."
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L152-L181 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | DjangoToolProvider.success_redirect | def success_redirect(self, msg='', log=''):
'''
Shortcut for redirecting Django view to LTI Consumer with messages
'''
from django.shortcuts import redirect
self.lti_msg = msg
self.lti_log = log
return redirect(self.build_return_url()) | python | def success_redirect(self, msg='', log=''):
'''
Shortcut for redirecting Django view to LTI Consumer with messages
'''
from django.shortcuts import redirect
self.lti_msg = msg
self.lti_log = log
return redirect(self.build_return_url()) | [
"def",
"success_redirect",
"(",
"self",
",",
"msg",
"=",
"''",
",",
"log",
"=",
"''",
")",
":",
"from",
"django",
".",
"shortcuts",
"import",
"redirect",
"self",
".",
"lti_msg",
"=",
"msg",
"self",
".",
"lti_log",
"=",
"log",
"return",
"redirect",
"(",... | Shortcut for redirecting Django view to LTI Consumer with messages | [
"Shortcut",
"for",
"redirecting",
"Django",
"view",
"to",
"LTI",
"Consumer",
"with",
"messages"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L201-L208 |
tophatmonocle/ims_lti_py | ims_lti_py/tool_provider.py | DjangoToolProvider.error_redirect | def error_redirect(self, errormsg='', errorlog=''):
'''
Shortcut for redirecting Django view to LTI Consumer with errors
'''
from django.shortcuts import redirect
self.lti_errormsg = errormsg
self.lti_errorlog = errorlog
return redirect(self.build_return_url()) | python | def error_redirect(self, errormsg='', errorlog=''):
'''
Shortcut for redirecting Django view to LTI Consumer with errors
'''
from django.shortcuts import redirect
self.lti_errormsg = errormsg
self.lti_errorlog = errorlog
return redirect(self.build_return_url()) | [
"def",
"error_redirect",
"(",
"self",
",",
"errormsg",
"=",
"''",
",",
"errorlog",
"=",
"''",
")",
":",
"from",
"django",
".",
"shortcuts",
"import",
"redirect",
"self",
".",
"lti_errormsg",
"=",
"errormsg",
"self",
".",
"lti_errorlog",
"=",
"errorlog",
"r... | Shortcut for redirecting Django view to LTI Consumer with errors | [
"Shortcut",
"for",
"redirecting",
"Django",
"view",
"to",
"LTI",
"Consumer",
"with",
"errors"
] | train | https://github.com/tophatmonocle/ims_lti_py/blob/979244d83c2e6420d2c1941f58e52f641c56ad12/ims_lti_py/tool_provider.py#L210-L217 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client._notify_thing_lid_change | def _notify_thing_lid_change(self, from_lid, to_lid):
"""Used by Thing instances to indicate that a rename operation has happened"""
try:
with self.__private_things:
self.__private_things[to_lid] = self.__private_things.pop(from_lid)
except KeyError:
logge... | python | def _notify_thing_lid_change(self, from_lid, to_lid):
"""Used by Thing instances to indicate that a rename operation has happened"""
try:
with self.__private_things:
self.__private_things[to_lid] = self.__private_things.pop(from_lid)
except KeyError:
logge... | [
"def",
"_notify_thing_lid_change",
"(",
"self",
",",
"from_lid",
",",
"to_lid",
")",
":",
"try",
":",
"with",
"self",
".",
"__private_things",
":",
"self",
".",
"__private_things",
"[",
"to_lid",
"]",
"=",
"self",
".",
"__private_things",
".",
"pop",
"(",
... | Used by Thing instances to indicate that a rename operation has happened | [
"Used",
"by",
"Thing",
"instances",
"to",
"indicate",
"that",
"a",
"rename",
"operation",
"has",
"happened"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L235-L248 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_catchall_feeddata | def register_catchall_feeddata(self, callback, callback_parsed=None):
"""
Registers a callback that is called for all feeddata your Thing receives
`Example`
#!python
def feeddata_callback(data):
print(data)
...
client.register_cat... | python | def register_catchall_feeddata(self, callback, callback_parsed=None):
"""
Registers a callback that is called for all feeddata your Thing receives
`Example`
#!python
def feeddata_callback(data):
print(data)
...
client.register_cat... | [
"def",
"register_catchall_feeddata",
"(",
"self",
",",
"callback",
",",
"callback_parsed",
"=",
"None",
")",
":",
"if",
"callback_parsed",
":",
"callback",
"=",
"self",
".",
"_get_parsed_feed_callback",
"(",
"callback_parsed",
",",
"callback",
")",
"return",
"self... | Registers a callback that is called for all feeddata your Thing receives
`Example`
#!python
def feeddata_callback(data):
print(data)
...
client.register_catchall_feeddata(feeddata_callback)
`callback` (required) the function name that yo... | [
"Registers",
"a",
"callback",
"that",
"is",
"called",
"for",
"all",
"feeddata",
"your",
"Thing",
"receives"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L256-L283 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_catchall_controlreq | def register_catchall_controlreq(self, callback, callback_parsed=None):
"""
Registers a callback that is called for all control requests received by your Thing
`Example`
#!python
def controlreq_callback(data):
print(data)
...
clie... | python | def register_catchall_controlreq(self, callback, callback_parsed=None):
"""
Registers a callback that is called for all control requests received by your Thing
`Example`
#!python
def controlreq_callback(data):
print(data)
...
clie... | [
"def",
"register_catchall_controlreq",
"(",
"self",
",",
"callback",
",",
"callback_parsed",
"=",
"None",
")",
":",
"if",
"callback_parsed",
":",
"callback",
"=",
"self",
".",
"_get_parsed_control_callback",
"(",
"callback_parsed",
",",
"callback",
")",
"return",
... | Registers a callback that is called for all control requests received by your Thing
`Example`
#!python
def controlreq_callback(data):
print(data)
...
client.register_catchall_controlreq(controlreq_callback)
`callback` (required) the func... | [
"Registers",
"a",
"callback",
"that",
"is",
"called",
"for",
"all",
"control",
"requests",
"received",
"by",
"your",
"Thing"
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L285-L311 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_created | def register_callback_created(self, func, serialised=True):
"""
Register a callback for resource creation. This will be called when any *new* resource
is created within your agent. If `serialised` is not set, the callbacks might arrive
in a different order to they were requested.
... | python | def register_callback_created(self, func, serialised=True):
"""
Register a callback for resource creation. This will be called when any *new* resource
is created within your agent. If `serialised` is not set, the callbacks might arrive
in a different order to they were requested.
... | [
"def",
"register_callback_created",
"(",
"self",
",",
"func",
",",
"serialised",
"=",
"True",
")",
":",
"self",
".",
"__client",
".",
"register_callback_created",
"(",
"partial",
"(",
"self",
".",
"__callback_payload_only",
",",
"func",
")",
",",
"serialised",
... | Register a callback for resource creation. This will be called when any *new* resource
is created within your agent. If `serialised` is not set, the callbacks might arrive
in a different order to they were requested.
The payload passed to your callback is an OrderedDict with the following key... | [
"Register",
"a",
"callback",
"for",
"resource",
"creation",
".",
"This",
"will",
"be",
"called",
"when",
"any",
"*",
"new",
"*",
"resource",
"is",
"created",
"within",
"your",
"agent",
".",
"If",
"serialised",
"is",
"not",
"set",
"the",
"callbacks",
"might... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L350-L381 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_duplicate | def register_callback_duplicate(self, func, serialised=True):
"""
Register a callback for resource creation but where the resource already exists in Iotic Space.
In this case the existing reference is passed to you.
If `serialised` is not set, the callbacks might arrive in a different or... | python | def register_callback_duplicate(self, func, serialised=True):
"""
Register a callback for resource creation but where the resource already exists in Iotic Space.
In this case the existing reference is passed to you.
If `serialised` is not set, the callbacks might arrive in a different or... | [
"def",
"register_callback_duplicate",
"(",
"self",
",",
"func",
",",
"serialised",
"=",
"True",
")",
":",
"self",
".",
"__client",
".",
"register_callback_duplicate",
"(",
"partial",
"(",
"self",
".",
"__callback_payload_only",
",",
"func",
")",
",",
"serialised... | Register a callback for resource creation but where the resource already exists in Iotic Space.
In this case the existing reference is passed to you.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The payload passed to your callback is an Ord... | [
"Register",
"a",
"callback",
"for",
"resource",
"creation",
"but",
"where",
"the",
"resource",
"already",
"exists",
"in",
"Iotic",
"Space",
".",
"In",
"this",
"case",
"the",
"existing",
"reference",
"is",
"passed",
"to",
"you",
".",
"If",
"serialised",
"is",... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L383-L416 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_renamed | def register_callback_renamed(self, func, serialised=True):
"""
Register a callback for resource rename. This will be called when any resource
is renamed within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The p... | python | def register_callback_renamed(self, func, serialised=True):
"""
Register a callback for resource rename. This will be called when any resource
is renamed within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The p... | [
"def",
"register_callback_renamed",
"(",
"self",
",",
"func",
",",
"serialised",
"=",
"True",
")",
":",
"self",
".",
"__client",
".",
"register_callback_renamed",
"(",
"partial",
"(",
"self",
".",
"__callback_payload_only",
",",
"func",
")",
",",
"serialised",
... | Register a callback for resource rename. This will be called when any resource
is renamed within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The payload passed to your callback is an OrderedDict with the following keys
... | [
"Register",
"a",
"callback",
"for",
"resource",
"rename",
".",
"This",
"will",
"be",
"called",
"when",
"any",
"resource",
"is",
"renamed",
"within",
"your",
"agent",
".",
"If",
"serialised",
"is",
"not",
"set",
"the",
"callbacks",
"might",
"arrive",
"in",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L418-L451 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_deleted | def register_callback_deleted(self, func, serialised=True):
"""
Register a callback for resource deletion. This will be called when any resource
is deleted within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The... | python | def register_callback_deleted(self, func, serialised=True):
"""
Register a callback for resource deletion. This will be called when any resource
is deleted within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The... | [
"def",
"register_callback_deleted",
"(",
"self",
",",
"func",
",",
"serialised",
"=",
"True",
")",
":",
"self",
".",
"__client",
".",
"register_callback_deleted",
"(",
"partial",
"(",
"self",
".",
"__callback_payload_only",
",",
"func",
")",
",",
"serialised",
... | Register a callback for resource deletion. This will be called when any resource
is deleted within your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The payload passed to your callback is an OrderedDict with the following keys
... | [
"Register",
"a",
"callback",
"for",
"resource",
"deletion",
".",
"This",
"will",
"be",
"called",
"when",
"any",
"resource",
"is",
"deleted",
"within",
"your",
"agent",
".",
"If",
"serialised",
"is",
"not",
"set",
"the",
"callbacks",
"might",
"arrive",
"in",
... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L453-L483 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_reassigned | def register_callback_reassigned(self, func, serialised=True):
"""
Register a callback for resource reassignment. This will be called when any resource
is reassigned to or from your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested... | python | def register_callback_reassigned(self, func, serialised=True):
"""
Register a callback for resource reassignment. This will be called when any resource
is reassigned to or from your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested... | [
"def",
"register_callback_reassigned",
"(",
"self",
",",
"func",
",",
"serialised",
"=",
"True",
")",
":",
"self",
".",
"__client",
".",
"register_callback_reassigned",
"(",
"partial",
"(",
"self",
".",
"__callback_payload_only",
",",
"func",
")",
",",
"serialis... | Register a callback for resource reassignment. This will be called when any resource
is reassigned to or from your agent.
If `serialised` is not set, the callbacks might arrive in a different order to they were requested.
The payload passed to your callback is an OrderedDict with the following... | [
"Register",
"a",
"callback",
"for",
"resource",
"reassignment",
".",
"This",
"will",
"be",
"called",
"when",
"any",
"resource",
"is",
"reassigned",
"to",
"or",
"from",
"your",
"agent",
".",
"If",
"serialised",
"is",
"not",
"set",
"the",
"callbacks",
"might",... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L485-L521 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.register_callback_subscribed | def register_callback_subscribed(self, callback):
"""
Register a callback for new subscription. This gets called whenever one of *your* things subscribes to something
else.
`Note` it is not called when whenever something else subscribes to your thing.
The payload passed to your... | python | def register_callback_subscribed(self, callback):
"""
Register a callback for new subscription. This gets called whenever one of *your* things subscribes to something
else.
`Note` it is not called when whenever something else subscribes to your thing.
The payload passed to your... | [
"def",
"register_callback_subscribed",
"(",
"self",
",",
"callback",
")",
":",
"return",
"self",
".",
"__client",
".",
"register_callback_created",
"(",
"partial",
"(",
"self",
".",
"__callback_subscribed_filter",
",",
"callback",
")",
",",
"serialised",
"=",
"Fal... | Register a callback for new subscription. This gets called whenever one of *your* things subscribes to something
else.
`Note` it is not called when whenever something else subscribes to your thing.
The payload passed to your callback is either a
[RemoteControl](RemotePoint.m.html#Iotic... | [
"Register",
"a",
"callback",
"for",
"new",
"subscription",
".",
"This",
"gets",
"called",
"whenever",
"one",
"of",
"*",
"your",
"*",
"things",
"subscribes",
"to",
"something",
"else",
"."
] | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L529-L541 |
Iotic-Labs/py-IoticAgent | src/IoticAgent/IOT/Client.py | Client.simulate_feeddata | def simulate_feeddata(self, feedid, data, mime=None, time=None):
"""Simulate the last feeddata received for given feedid
Calls the registered callback for the feed with the last recieved feed data. Allows you to test your code
without having to wait for the remote thing to share again.
... | python | def simulate_feeddata(self, feedid, data, mime=None, time=None):
"""Simulate the last feeddata received for given feedid
Calls the registered callback for the feed with the last recieved feed data. Allows you to test your code
without having to wait for the remote thing to share again.
... | [
"def",
"simulate_feeddata",
"(",
"self",
",",
"feedid",
",",
"data",
",",
"mime",
"=",
"None",
",",
"time",
"=",
"None",
")",
":",
"self",
".",
"__client",
".",
"simulate_feeddata",
"(",
"feedid",
",",
"data",
",",
"mime",
",",
"time",
")"
] | Simulate the last feeddata received for given feedid
Calls the registered callback for the feed with the last recieved feed data. Allows you to test your code
without having to wait for the remote thing to share again.
`feedid` (required) (string) local id of your Feed
`data` (optional... | [
"Simulate",
"the",
"last",
"feeddata",
"received",
"for",
"given",
"feedid",
"Calls",
"the",
"registered",
"callback",
"for",
"the",
"feed",
"with",
"the",
"last",
"recieved",
"feed",
"data",
".",
"Allows",
"you",
"to",
"test",
"your",
"code",
"without",
"ha... | train | https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/IOT/Client.py#L543-L558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.