In this lesson, we will cover:
- What is Scrapli Cfg?
- Scrapli Cfg connections.
- Scrapli Cfg getters.
- Scrapli Cfg config operations (load, replace, merge, abort).
- Scrapli Cfg diff.
What is Scrapli Cfg?
Scrapli Cfg is a Scrapli extension that provides a set of common (vendor-agnostic) methods for merging, replacing and diff`ing device configuration via Telnet or SSH. It abstracts and removes much of the heavy lifting and complexities required when performing config operations in a multi-vendor environment.
To install Scrapli Cfg, simply run the following:
$ pip3 install scrapli-cfg
Note: You may find that this is already installed if you completed the Scrapli AsyncIO lesson.
Scrapli Cfg Connections
- Performing the required imports.
- Preparing the connection via
from scrapli_cfg import ScrapliCfg with Scrapli(**device) as conn: # Instantiate Scrapli Cfg cfg_conn = ScrapliCfg(conn=conn) # Prepare Scrapli connection, call prepare_on() etc cfg_conn.prepare()
on_prepare method (which is called during
prepare) allows you to perform additional actions on the device before performing your configuration operations.
If we now perform this against one of our lab devices, we can see the available properties and methods available to us, which we will be exploring in the upcoming sections!