Configuration Encapsulator - nihole/PSEFABRIC GitHub Wiki
module mult_cfg
Configuration Encapsulation
python function:
- mult_cfg.mult_cfg
Three purposes of this layer:
- some additional configuration manipulation, for example:
- removing duplicate lines
- restoring the correct order of commands if necessary
- encapsulation or adaptation of the configuration files to protocols or tools are used at Layer 6 (telnet/ssh, neconf, ansible etc.)
- saving of configuration files (folder $PSEFABRIC/PSEF_CONF/EQ_CONF/)
Encapsulation Scripts
Additional scripts may be used for the configuration manipulation.
For example, this script from p001 project (cisco_cfg_correction.py) adds conf t
line at the beginning of configuration for Cisco equipment:
import re
def cisco_cli_correction(cfg_txt):
config_ = 'conf t' + '\n' + cfg_txt + '\n' + 'exit' + '\n'
return (config_)