NETCONF was developed in 2006 in RFC 4741 and its sole purposed was to replace SNMP. Although it wasn't effective until YANG data models were introducted in 2010 and NETCONF was revised in RFC6241.
NETCONF is a network protocol used to transmit data from network devices to another system and vice versea, it's built on top of ssh however uses port TCP 830 and uses XML Encoding Data format.
3 Key things it can do is:
-
GET Opertaional State
-
GET Configuration State
-
Edit Configuration State
Message Composed of the compotents
- Transport = TCP/SSH 830
- Message =
<rpc>is a message id and is expecte don return - Operation Type =
<get> <get-config> <edit-config> - Content = Data Payload i.e YANG data model
NETCONF Communcation Process
- Connect to device and say hello
- Server returns capabilites
- Determin model to use
- Compose Operation i.e
- Send Message
- Client Recieves devices
- Client Processes data.
Insturcutions on setting up NETCONF on a IOS-XE device and using NETCONF
Configuring
enable
conf t
hostname blah
ip domain name byu.edu.au
##Set authentication##
crypto key generate rsa 1024
ip ssh version 2
line vty 0 4
transport input ssh
## Configure IP Connectivity
netconf ssh
netconf-yang
Basic Python Script to connect
from ncclient import manager
from netconf_router import router
config_template = open(
"D:/Documents/Git Hub Project/CBT-Nuggets-DevNet-1/netconf-editconfig.xml").read()
netconf_config = config_template.format(
interface_name="GigabitEthernet2", interface_desc="Hello World"
)
with manager.connect(host=router["host"], port=router["port"], username=router["username"], password=router["password"],
hostkey_verify=False) as m:
device_reply = m.edit_config(netconf_config, target="running")
print(device_reply)