Skip to content

Global Logic

Roman Elokhin edited this page Nov 25, 2018 · 9 revisions

Along with Psefbric Management Data Flow Model and Structure the Global Logic is a fundamental concept of PSEFABRIC.

To understand this point answer the question: "What should we do to automate some operations in our network?"

First of all, of course, we need to describe the algorithm how the automation will work. We have the same situation here.

In our case, we use python dictionaries for this purpose (see psef_logic.py). For example this part of code (p001 project) describes what PSEFABRIC has to do when we add or remove an address:

def mult_dict_address(str_dict, parameters):

##########  Description  #######
    '''
    '''
#############  BODY ############

    mult = []
    ...

    mult.append({})
    mult[1]['eq_addr'] = 'dc1_sw1'
    mult[1]['eq_parameter'] = ''
    mult[1]['cmd'] = {}
    mult[1]['cmd']['ad'] = []
    mult[1]['cmd']['rm'] = []
    mult[1]['cmd']['ad'].append('ctemplates.cisco_create_address')
    mult[1]['cmd']['rm'].append('ctemplates.cisco_delete_address')

    if ((str_dict[vocabulary.str_rvoc['device']] == 'dc1_sw1') and (parameters[vocabulary.par_rvoc["aggregation-addr"]] == 'false')):
        mult[1]['cmd']['rm'].append('ctemplates.cisco_remove_vlan_to_trunk')
        mult[1]['cmd']['rm'].append('ctemplates.cisco_delete_svi')
        mult[1]['cmd']['rm'].append('ctemplates.cisco_delete_vlan')
        mult[1]['cmd']['ad'].append('ctemplates.cisco_create_vlan')
        mult[1]['cmd']['ad'].append('ctemplates.cisco_create_svi')
        mult[1]['cmd']['ad'].append('ctemplates.cisco_add_vlan_to_trunk')
  ...
  return (mult)
Clone this wiki locally