sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def create_fw_db(self, fw_id, fw_name, tenant_id):
"""Create FW dict. """
fw_dict = {'fw_id': fw_id, 'name': fw_name, 'tenant_id': tenant_id}
# FW DB is already created by FW Mgr
# self.add_fw_db(fw_id, fw_dict)
self.update_fw_dict(fw_dict) | Create FW dict. | entailment |
def destroy_local_fw_db(self):
"""Delete the FW dict and its attributes. """
del self.fw_dict
del self.in_dcnm_net_dict
del self.in_dcnm_subnet_dict
del self.out_dcnm_net_dict
del self.out_dcnm_subnet_dict | Delete the FW dict and its attributes. | entailment |
def update_fw_local_cache(self, net, direc, start):
"""Update the fw dict with Net ID and service IP. """
fw_dict = self.get_fw_dict()
if direc == 'in':
fw_dict.update({'in_network_id': net, 'in_service_ip': start})
else:
fw_dict.update({'out_network_id': net, 'ou... | Update the fw dict with Net ID and service IP. | entailment |
def update_fw_local_result_str(self, os_result=None, dcnm_result=None,
dev_result=None):
"""Update the FW result in the dict. """
fw_dict = self.get_fw_dict()
if os_result is not None:
fw_dict['os_status'] = os_result
if dcnm_result is not N... | Update the FW result in the dict. | entailment |
def update_fw_local_result(self, os_result=None, dcnm_result=None,
dev_result=None):
"""Retrieve and update the FW result in the dict. """
self.update_fw_local_result_str(os_result=os_result,
dcnm_result=dcnm_result,
... | Retrieve and update the FW result in the dict. | entailment |
def update_fw_local_router(self, net_id, subnet_id, router_id, os_result):
"""Update the FW with router attributes. """
fw_dict = self.get_fw_dict()
fw_dict.update({'router_id': router_id, 'router_net_id': net_id,
'router_subnet_id': subnet_id})
self.store_dummy_r... | Update the FW with router attributes. | entailment |
def commit_fw_db(self):
"""Calls routine to update the FW DB. """
fw_dict = self.get_fw_dict()
self.update_fw_db(fw_dict.get('fw_id'), fw_dict) | Calls routine to update the FW DB. | entailment |
def commit_fw_db_result(self):
"""Calls routine to update the FW create/delete result in DB. """
fw_dict = self.get_fw_dict()
self.update_fw_db_result(fw_dict.get('fw_id'), fw_dict) | Calls routine to update the FW create/delete result in DB. | entailment |
def get_store_local_final_result(self):
"""Store/Retrieve the final result.
Retrieve the final result for FW create/delete from DB and store it
locally.
"""
fw_dict = self.get_fw_dict()
fw_data, fw_data_dict = self.get_fw(fw_dict.get('fw_id'))
res = fw_data.resul... | Store/Retrieve the final result.
Retrieve the final result for FW create/delete from DB and store it
locally. | entailment |
def store_state(self, state, popl_db=True):
"""Store the state of FW create/del operation. """
self.state = state
if popl_db:
fw_dict = self.get_fw_dict()
self.append_state_final_result(fw_dict.get('fw_id'),
self.get_local_final_... | Store the state of FW create/del operation. | entailment |
def fixup_state(self, from_str, state):
"""Fixup state after retart.
Fixup the state, if Delete is called when create SM is half-way
through.
"""
result = self.get_local_final_result()
if from_str == fw_const.FW_CR_OP:
if result == fw_const.RESULT_FW_DELETE_I... | Fixup state after retart.
Fixup the state, if Delete is called when create SM is half-way
through. | entailment |
def store_db_obj(cls, in_obj, out_obj):
"""Store the IP DB object. """
cls.ip_db_obj['in'] = in_obj
cls.ip_db_obj['out'] = out_obj | Store the IP DB object. | entailment |
def get_in_ip_addr(cls, tenant_id):
"""Retrieves the 'in' service subnet attributes. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = cls.serv_obj_dict.get(tenant_id)
return tenant_obj.get_in_... | Retrieves the 'in' service subnet attributes. | entailment |
def get_out_ip_addr(cls, tenant_id):
"""Retrieves the 'out' service subnet attributes. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = cls.serv_obj_dict.get(tenant_id)
return tenant_obj.get_o... | Retrieves the 'out' service subnet attributes. | entailment |
def get_in_srvc_node_ip_addr(cls, tenant_id):
"""Retrieves the IN service node IP address. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = cls.serv_obj_dict.get(tenant_id)
in_subnet_dict = te... | Retrieves the IN service node IP address. | entailment |
def get_out_srvc_node_ip_addr(cls, tenant_id):
"""Retrieves the OUT service node IP address. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = cls.serv_obj_dict.get(tenant_id)
out_subnet_dict =... | Retrieves the OUT service node IP address. | entailment |
def get_dummy_router_net(cls, tenant_id):
"""Retrieves the dummy router network info. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return
tenant_obj = cls.serv_obj_dict.get(tenant_id)
return tenant_obj.get_du... | Retrieves the dummy router network info. | entailment |
def get_in_seg_vlan(cls, tenant_id):
"""Retrieves the IN Seg, VLAN, mob domain. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return None, None
tenant_obj = cls.serv_obj_dict.get(tenant_id)
return tenant_obj.g... | Retrieves the IN Seg, VLAN, mob domain. | entailment |
def get_out_seg_vlan(cls, tenant_id):
"""Retrieves the OUT Seg, VLAN, mob domain. """
if tenant_id not in cls.serv_obj_dict:
LOG.error("Fabric not prepared for tenant %s", tenant_id)
return None, None
tenant_obj = cls.serv_obj_dict.get(tenant_id)
return tenant_obj... | Retrieves the OUT Seg, VLAN, mob domain. | entailment |
def get_in_subnet_id(cls, tenant_id):
"""Retrieve the subnet ID of IN network. """
if 'in' 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('in')
in_subnet_dict = cls.get_in_ip_addr(tenant_id)
... | Retrieve the subnet ID of IN network. | entailment |
def get_out_subnet_id(cls, tenant_id):
"""Retrieve the subnet 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... | Retrieve the subnet ID of OUT network. | entailment |
def get_in_net_id(cls, tenant_id):
"""Retrieve the network ID of IN network. """
if 'in' 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('in')
in_subnet_dict = cls.get_in_ip_addr(tenant_id)
... | Retrieve the network ID of IN network. | entailment |
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... | Retrieve the network ID of OUT network. | entailment |
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:... | 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. | entailment |
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
... | Check if the subnet is created as a result of any FW operation. | entailment |
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,
... | This is a mapping of create result message string to state. | entailment |
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,
... | This is a mapping of delete result message string to state. | entailment |
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.... | Initializing the Finite State Machine.
This is a mapping of state to a dict of appropriate create and delete
functions. | entailment |
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]) | Creates and stores the service object associated with a tenant. | entailment |
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] | Creates and stores the service object associated with a tenant. | entailment |
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'),
... | Store service network in DB. | entailment |
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... | Calls the service object routine to commit the FW entry to DB. | entailment |
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... | 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 | entailment |
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.
"""
... | 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. | entailment |
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
... | 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. | entailment |
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... | 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. | entailment |
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... | Retrieve the next available subnet.
Given a tenant, it returns the service subnet values assigned
to it based on direction. | entailment |
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) | Routine to release a subnet from the DB. | entailment |
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)... | Fills the DCNM subnet parameters.
Function that fills the subnet parameters for a tenant required by
DCNM. | entailment |
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 | Retrieves the DCNM subnet info for a tenant. | entailment |
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 =... | 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. | entailment |
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 | Retrieves the DCNM network info for a tenant. | entailment |
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'... | Update the DCNM net info with allocated values of seg/vlan. | entailment |
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... | Fill DCNM network parameters.
Function that fills the network parameters for a tenant required by
DCNM. | entailment |
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... | 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. | entailment |
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 | Allocates the segmentation ID. | entailment |
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 | Allocates the vlan ID. | entailment |
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)
... | Update the subnet DB with Net and Subnet ID, given the subnet. | entailment |
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... | Update the DCNM netinfo with vlan and segmentation ID. | entailment |
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 = ... | Function to create the service in network in DCNM. | entailment |
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_... | Function to delete the service in network in DCNM. | entailment |
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... | Retrieves the dummy router information from service object. | entailment |
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,
... | Function to create a service partition. | entailment |
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... | Function to update srvc_node address of partition. | entailment |
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) | Function to update DCI ID of partition. | entailment |
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... | Function to update a partition. | entailment |
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:... | Function to update a partition. | entailment |
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) | Function to delete a service partition. | entailment |
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... | 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
... | entailment |
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... | Helper function to create openstack network.
The net_id and subnet_id is returned. Upon failure, the subnet is
deallocated. | entailment |
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... | 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... | entailment |
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 + (... | Function to create a dummy router and interface. | entailment |
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... | Function to delete a dummy interface of a router. | entailment |
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",
... | Create the Openstack IN network and stores the values in DB. | entailment |
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_... | Delete the network created in Openstack.
Function to delete Openstack network, It also releases the associated
segmentation, VLAN and subnets. | entailment |
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",
... | Deletes the Openstack In network and update the DB. | entailment |
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",
... | Deletes the Openstack Out network and update the DB. | entailment |
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... | Create the dummy interface and attach it to router.
Attach the dummy interface to the Openstack router and store the
info in DB. | entailment |
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... | Delete the Openstack Dummy router and store the info in DB. | entailment |
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... | Create the DCNM In Network and store the result in DB. | entailment |
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... | Delete the DCNM In Network and store the result in DB. | entailment |
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_... | Update DCNM's in partition information.
Update the In partition service node IP address in DCNM and
update the result | entailment |
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(... | Clear the DCNM in partition service information.
Clear the In partition service node IP address in DCNM and update the
result. | entailment |
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,... | Create the DCNM OUT partition and update the result. | entailment |
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... | Delete the DCNM OUT partition and update the result. | entailment |
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... | Create the DCNM OUT Network and update the result. | entailment |
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... | Delete the DCNM OUT network and update the result. | entailment |
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... | Update DCNM OUT partition service node IP address and result. | entailment |
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... | Clear DCNM out partition information.
Clear the DCNM OUT partition service node IP address and update
the result | entailment |
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 | Return the next create state from previous state. | entailment |
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 | Return the next delete state from previous state. | entailment |
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) | Returns the next state for a create or delete operation. | entailment |
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()
... | Runs the create State Machine.
Goes through every state function until the end or when one state
returns failure. | entailment |
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... | Runs the delete State Machine.
Goes through every state function until the end or when one state
returns failure. | entailment |
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 | Returns the key associated with the dict. | entailment |
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... | 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. | entailment |
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... | 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. | entailment |
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 =... | 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. | entailment |
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_... | Populate the local cache from DB.
Read the entries from FW DB and Calls routines to populate the cache. | entailment |
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... | Delete the dummy interface to the router. | entailment |
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... | 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... | entailment |
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... | Ensure DB is consistent after unexpected restarts. | entailment |
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... | Internal routine to prepare the fabric.
This creates an entry in FW DB and runs the SM. | entailment |
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... | Top level routine to prepare the fabric. | entailment |
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(... | Internal routine to delete the fabric configuration.
This runs the SM and deletes the entries from DB and local cache. | entailment |
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)... | Top level routine to unconfigure the fabric. | entailment |
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:
#... | Internal routine to retry the failed cases. | entailment |
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... | Top level retry failure routine. | entailment |
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 | Retrieve config based on the format [<prefix>:<value>].
returns: a dict, {<UUID>: {<key1>:<value1>, <key2>:<value2>, ...}} | entailment |
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.
... | 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_... | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.