Configurator - nihole/PSEFABRIC GitHub Wiki
module cfg
The goal of this layer is an equipment (MO) configuration creation.
Configuration Creation
python function:
- cfg.cfg
Two dictionaries from the Demultiplexer layer are used (see Demultiplexer Layer):
- cmd_for_host_full
- cmd_for_host_diff
The using of these two dictionaries is the result of the fact that for different vendors/equipment/configuration method (cli, netconf, ...) different approaches should be used. See comments in the cfg.cfg function.
Templates
For each command received from the Demultiplexer layer, a template has to be provided on the basis of which the equipment configuration will be created.
Here is an example of a template for VLAN creation/deleting for Cisco switches (project p001 file ctemplate.py):
######## vlan ###########
def cisco_create_vlan (name, ipv4_prefix, vlan, vrf, interface):
config_txt = '''
vlan %s
name %s''' % (vlan, name)
return config_txt
def cisco_delete_vlan (name, ipv4_prefix, vlan, vrf, interface):
config_txt = '''
no vlan %s''' % vlan
return config_txt