In step 1, we import the usual Python standard library and PyEZ frameworks. The notable additions, compared with previous recipes, are:
|jnpr.junos.utils.config.Config||Models a JUNOS candidate configuration|
|jnpr.junos.exception.ConfigLoadError||Represents an error that can occur during configuration load|
argparse is used, as usual, to parse the command line arguments. We make use of the action=“Append” direction to the add_argument() method to ensure that the –a and –d switches can take on multiple values. In return, argparse will build a list of values rather than a single token. We make sure that the prefix-list and the target router are mandatory items by setting the attribute required=True ...