The networking_cisco.apps.saf.server.services.firewall.native.fabric_setup_base Module

class networking_cisco.apps.saf.server.services.firewall.native.fabric_setup_base.FabricApi

Bases: object

Class for retrieving FW attributes, available to external modules.

classmethod del_obj(tenant_id, obj)

Delete the tenant obj.

classmethod get_dummy_router_net(tenant_id)

Retrieves the dummy router network info.

classmethod get_in_ip_addr(tenant_id)

Retrieves the ‘in’ service subnet attributes.

classmethod get_in_net_id(tenant_id)

Retrieve the network ID of IN network.

classmethod get_in_seg_vlan(tenant_id)

Retrieves the IN Seg, VLAN, mob domain.

classmethod get_in_srvc_node_ip_addr(tenant_id)

Retrieves the IN service node IP address.

classmethod get_in_subnet_id(tenant_id)

Retrieve the subnet ID of IN network.

classmethod get_out_ip_addr(tenant_id)

Retrieves the ‘out’ service subnet attributes.

classmethod get_out_net_id(tenant_id)

Retrieve the network ID of OUT network.

classmethod get_out_seg_vlan(tenant_id)

Retrieves the OUT Seg, VLAN, mob domain.

classmethod get_out_srvc_node_ip_addr(tenant_id)

Retrieves the OUT service node IP address.

classmethod get_out_subnet_id(tenant_id)

Retrieve the subnet ID of OUT network.

ip_db_obj = {}
classmethod is_network_source_fw(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.

is_subnet_source_fw(tenant_id, subnet)

Check if the subnet is created as a result of any FW operation.

serv_obj_dict = {}
classmethod store_db_obj(in_obj, out_obj)

Store the IP DB object.

classmethod store_tenant_obj(tenant_id, obj)

Store the tenant obj.

class networking_cisco.apps.saf.server.services.firewall.native.fabric_setup_base.FabricBase

Bases: networking_cisco.apps.saf.db.dfa_db_models.DfaDBMixin, networking_cisco.apps.saf.server.services.firewall.native.fabric_setup_base.FabricApi

Class to implement Fabric configuration for Physical FW.

alloc_retrieve_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.

alloc_seg(net_id)

Allocates the segmentation ID.

alloc_vlan(net_id)

Allocates the vlan ID.

allocate_seg_vlan(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 crashed after allocation but before updating DB with NetID. Now, since both steps are combined, Vlan/Seg won’t be allocated w/o NetID.

check_allocate_ip(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.

clear_dcnm_in_part(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.

clear_dcnm_out_part(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

correct_db_restart()

Ensure DB is consistent after unexpected restarts.

create_dcnm_in_nwk(tenant_id, fw_dict, is_fw_virt=False)

Create the DCNM In Network and store the result in DB.

create_dcnm_out_nwk(tenant_id, fw_dict, is_fw_virt=False)

Create the DCNM OUT Network and update the result.

create_dcnm_out_part(tenant_id, fw_dict, is_fw_virt=False)

Create the DCNM OUT partition and update the result.

create_openstack_network(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.

create_os_dummy_rtr(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.

create_os_in_nwk(tenant_id, fw_dict, is_fw_virt=False)

Create the Openstack IN network and stores the values in DB.

create_os_out_nwk(tenant_id, fw_dict, is_fw_virt=False)

Create the Openstack OUT network and stores the values in DB.

create_serv_obj(tenant_id)

Creates and stores the service object associated with a tenant.

delete_dcnm_in_nwk(tenant_id, fw_dict, is_fw_virt=False)

Delete the DCNM In Network and store the result in DB.

delete_dcnm_out_nwk(tenant_id, fw_dict, is_fw_virt=False)

Delete the DCNM OUT network and update the result.

delete_dcnm_out_part(tenant_id, fw_dict, is_fw_virt=False)

Delete the DCNM OUT partition and update the result.

delete_fabric_fw(tenant_id, fw_dict, is_fw_virt, result)

Top level routine to unconfigure the fabric.

delete_fabric_fw_internal(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.

delete_os_dummy_rtr(tenant_id, fw_dict, is_fw_virt=False)

Delete the Openstack Dummy router and store the info in DB.

delete_os_dummy_rtr_nwk(rtr_id, net_id, subnet_id)

Delete the dummy interface to the router.

delete_os_in_nwk(tenant_id, fw_dict, is_fw_virt=False)

Deletes the Openstack In network and update the DB.

delete_os_nwk_db(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 Firewall DB, given the net ID. Release the IN/OUT sug=bnets associated with the net.

delete_os_out_nwk(tenant_id, fw_dict, is_fw_virt=False)

Deletes the Openstack Out network and update the DB.

delete_serv_obj(tenant_id)

Creates and stores the service object associated with a tenant.

fill_dcnm_net_info(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.

fill_dcnm_subnet_info(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.

get_dummy_router_net(tenant_id)

Retrieves the dummy router information from service object.

get_end_ip(subnet)

Returns the end IP associated with a subnet.

It’s value is the second last address of the CIDR. i.e.. end IP address is -2 (from the end of the subnet)

get_gateway(subnet)

Retrieve the Gateway associated with the subnet.

Returns the Gateway associated with a subnet. This is also the Gateway address configured in the leaf switch or ToR. This value is subnet + 1. The Gateway created in Openstack is + 2, which is also the FW’s IN interface address and DCNM’s service node IP address.

get_key_state(status, state_dict)

Returns the key associated with the dict.

get_next_create_state(state, ret)

Return the next create state from previous state.

get_next_del_state(state, ret)

Return the next delete state from previous state.

get_next_ip(tenant_id, direc)

Retrieve the next available subnet.

Given a tenant, it returns the service subnet values assigned to it based on direction.

get_next_state(state, ret, oper)

Returns the next state for a create or delete operation.

get_secondary_gateway(subnet)

Returns the Secondary Gateway associated with a subnet.

This is the end IP address. The secondary GW IP address reuses the end IP address.

get_service_obj(tenant_id)

Retrieves the service object associated with a tenant.

get_start_ip(subnet)

Returns the starting IP associated with a subnet.

This value is start IP address is + 3.

init_state(tenant_id, fw_dict, is_fw_virt=False)

Dummy function called at the init stage.

initialize_create_state_map()

This is a mapping of create result message string to state.

initialize_delete_state_map()

This is a mapping of delete result message string to state.

initialize_fsm()

Initializing the Finite State Machine.

This is a mapping of state to a dict of appropriate create and delete functions.

pop_fw_local(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.

pop_fw_state(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 and before any SM is run, it restarted.

populate_local_cache()

Populate the local cache from DB.

Read the entries from FW DB and Calls routines to populate the cache.

populate_local_cache_tenant(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.

prepare_fabric_done(tenant_id, tenant_name, is_fw_virt=False)

Dummy function called at the final stage.

prepare_fabric_fw(tenant_id, fw_dict, is_fw_virt, result)

Top level routine to prepare the fabric.

release_subnet(cidr, direc)

Routine to release a subnet from the DB.

retrieve_dcnm_net_info(tenant_id, direc)

Retrieves the DCNM network info for a tenant.

retrieve_dcnm_subnet_info(tenant_id, direc)

Retrieves the DCNM subnet info for a tenant.

retrieve_network_info(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.

retry_failure(tenant_id, tenant_name, fw_data, is_fw_virt, result)

Top level retry failure routine.

retry_failure_internal(tenant_id, tenant_name, fw_data, is_fw_virt, result)

Internal routine to retry the failed cases.

run_create_sm(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.

run_delete_sm(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.

store_dcnm(dcnm_obj)

Stores the DCNM object.

store_fw_db(tenant_id, net, subnet_dict, direc)

Calls the service object routine to commit the FW entry to DB.

store_fw_db_router(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_net_db(tenant_id, net, net_dict, result)

Store service network in DB.

store_net_fw_db(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 the result of operation into FWDB. Generally called by OS operations that wants to modify both the Net DB and FW DB.

update_dcnm_in_part(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

update_dcnm_net_info(tenant_id, direc, vlan_id, segmentation_id)

Update the DCNM net info with allocated values of seg/vlan.

update_dcnm_out_part(tenant_id, fw_dict, is_fw_virt=False)

Update DCNM OUT partition service node IP address and result.

update_fw_db_result(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

update_net_info(tenant_id, direc, vlan_id, segmentation_id)

Update the DCNM netinfo with vlan and segmentation ID.

update_subnet_db_info(tenant_id, direc, net_id, subnet_id)

Update the subnet DB with Net and Subnet ID, given the subnet.

class networking_cisco.apps.saf.server.services.firewall.native.fabric_setup_base.ServiceIpSegTenantMap

Bases: networking_cisco.apps.saf.db.dfa_db_models.DfaDBMixin

Tenant Specific Service Attributes.

Class for storing/retrieving the tenant specific service attributes locally as well as from the FW DB

commit_fw_db()

Calls routine to update the FW DB.

commit_fw_db_result()

Calls routine to update the FW create/delete result in DB.

create_fw_db(fw_id, fw_name, tenant_id)

Create FW dict.

destroy_local_fw_db()

Delete the FW dict and its attributes.

fixup_state(from_str, state)

Fixup state after retart.

Fixup the state, if Delete is called when create SM is half-way through.

get_dcnm_net_dict(direc)

Retrieve the DCNM net dict.

get_dcnm_subnet_dict(direc)

Retrieve the DCNM subnet dict.

get_dummy_router_net()

Retrieve the dummy router attributes.

get_fw_dict()

retrieving the fw dict.

get_in_ip_addr()

Retrieve ‘in’ service subnet attributes.

get_in_seg_vlan()

Retrieve the seg, vlan, mod domain for IN network.

get_local_final_result()

Retrieve the final reult for FW create/delete.

get_out_ip_addr()

Retrieve ‘out’ service subnet attributes.

get_out_seg_vlan()

Retrieve the seg, vlan, mod domain for OUT network.

get_state()

Return the current state.

get_store_local_final_result()

Store/Retrieve the final result.

Retrieve the final result for FW create/delete from DB and store it locally.

is_fabric_create()

Retrieve the fabric create status.

set_fabric_create(status)

Store the fabric create status.

store_dcnm_net_dict(net_dict, direc)

Storing the DCNM net dict.

store_dcnm_subnet_dict(subnet_dict, direc)

Store the subnet attributes and dict.

store_dummy_router_net(net_id, subnet_id, rtr_id)

Storing the router attributes.

store_local_final_result(final_res)

Store the final reult for FW create/delete.

store_state(state, popl_db=True)

Store the state of FW create/del operation.

update_fw_dict(fw_dict)

updating the fw dict.

update_fw_local_cache(net, direc, start)

Update the fw dict with Net ID and service IP.

update_fw_local_result(os_result=None, dcnm_result=None, dev_result=None)

Retrieve and update the FW result in the dict.

update_fw_local_result_str(os_result=None, dcnm_result=None, dev_result=None)

Update the FW result in the dict.

update_fw_local_router(net_id, subnet_id, router_id, os_result)

Update the FW with router attributes.