Skip to content

Quick Start Guide

Installation

In most cases installation via pip is the simplest and best way to install scrapli_cfg. See here for advanced installation details.

1
pip install scrapli-cfg

A Simple Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
from scrapli import Scrapli
from scrapli_cfg import ScrapliCfg

device = {
   "host": "172.18.0.11",
   "auth_username": "vrnetlab",
   "auth_password": "VR-netlab9",
   "auth_strict_key": False,
   "platform": "cisco_iosxe"
}

with open("myconfig", "r") as f:
    my_config = f.read()

with Scrapli(**device) as conn:
    cfg_conn = ScrapliCfg(conn=conn)
    cfg_conn.prepare()
    cfg_conn.load_config(config=my_config, replace=True)
    diff = cfg_conn.diff_config()
    print(diff.side_by_side_diff)
    cfg_conn.commit_config()

More Examples