| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This example script uses the requests Python library to interact with a RESTCONF Agent.
This Python script leverages RESTCONF to:
This script has been tested with Python 3.5, however may work with other versions.
This script targets the RESTCONF DevNet Sandbox that leverages a CSR1000v as a target.
Find details on the Sandbox here.
To execute this script against a different device, update the variables that list the connectivity, management interface, and url_base for RESTCONF.
Python
Clone the Python Examples and change into the directory.
git clone //github.com/CiscoDevNet/python_code_samples_network
cd restconf_update_ipaddressCreate and activate a virtualenv
virtualenv venv --python=python3.5
source venv/bin/activate Install the requirements
pip install -r requirements.textRun the script
$ python updateip.py # Output The router has the following interfaces: * GigabitEthernet1 * GigabitEthernet2 * GigabitEthernet3 Which Interface do you want to configure? GigabitEthernet2 GigabitEthernet2 Starting Interface Configuration Name: GigabitEthernet2 IP Address: 101.101.10.10 / 255.255.255.0 What IP address do you want to set? 9.9.9.9 What Subnet Mask do you want to set? 255.255.255.0 Ending Interface Configuration Name: GigabitEthernet2 IP Address: 9.9.9.9 / 255.255.255.0
| Back | FazBrowse Home | New Git URL |