Mastering NETCONF and RESTCONF: A Comprehensive Guide for the CCNP 350-401 ENCOR Exam

Mastering NETCONF and RESTCONF: A Comprehensive Guide for the CCNP 350-401 ENCOR Exam


Ah, the thrill of networking! For those of us nerdy enough to get a kick out of configuring routers and switches, the CCNP 350-401 ENCOR exam is nothing short of an exciting challenge. But let's not kid ourselves—passing this certification is no walk in the park. One of the trickiest areas, and one you absolutely must master, is configuring and verifying NETCONF and RESTCONF. You might be wondering, "What are these cryptic terminologies?" Well, my friend, buckle up because we're about to dive deep into the world of NETCONF and RESTCONF, where data models rule and configurations come alive!

Understanding NETCONF

First off, let's talk about NETCONF. Short for Network Configuration Protocol, NETCONF is your best friend when it comes to automating network device configuration. Picture this: you're a network admin juggling multiple devices that need to be configured. Doing it manually? Oh boy, you'll be at it for hours! That's where NETCONF steps in to save the day.

Developed by the IETF, NETCONF uses remote procedure calls (RPCs) to configure, query, and even delete configurations on network devices. The beauty of NETCONF lies in its use of XML for message encoding, making it both human-readable and machine-friendly.

Getting Started with NETCONF

So how do you get NETCONF up and running? First things first, you need a NETCONF-capable device. Most modern Cisco devices come with NETCONF functionality pre-installed. Your first task is to enable NETCONF on your device. Here's a basic rundown:

1. Enable NETCONF:

Device# configure terminal
Device(config)# netconf-yang
Device(config)# end
Device# write memory

With NETCONF enabled, you're ready to start configuring and querying your device. But hold your horses! You'll need a NETCONF client to communicate with your device. Popular ones include ncclient for Python and Net::Netconf for Perl. We'll use ncclient for this example.

2. Install ncclient:

pip install ncclient

Once installed, you can start scripting your configurations. Here's a tiny script to get you started:

from ncclient import manager

with manager.connect(
) as m:
    config = '''
    m.edit_config(target="running", config=config)

VoilĂ ! You've just configured an interface using NETCONF. Simple, isn't it? Let's get a bit fancy and verify our configuration.

3. Verify Configuration:

with manager.connect(
) as m:
    response = m.get_config(source="running").data_xml

The script will spit out the current configuration in XML format. Congrats, you've verified your configuration using NETCONF!

Grappling with RESTCONF

If NETCONF is the superhero of network configuration, RESTCONF is its trusty sidekick. RESTCONF, short for RESTful Configuration Protocol, offers another way to interact with network devices. It leverages HTTP methods like GET, POST, PUT, and DELETE to accomplish similar tasks as NETCONF but in a RESTful manner.

Why RESTCONF, you ask? Well, if you're comfortable with REST APIs, RESTCONF will feel like a breath of fresh air. It uses JSON or XML for data encoding and is perfect for those who prefer the simplicity of REST APIs over the intricacies of RPCs.

Getting Your Hands Dirty with RESTCONF

Ready to dive into RESTCONF? Here's how you can get started:

1. Enable RESTCONF:

Device# configure terminal
Device(config)# restconf
Device(config)# end
Device# write memory

Much like NETCONF, you'll need a REST client to interact with your device. There are numerous options available, from Postman to curl to Python requests. Let’s use Python requests for this example.

2. Install Python Requests Library:

pip install requests

Now, let's script a simple configuration using RESTCONF. We're going to enable an interface, similar to what we did with NETCONF.

3. Configure an Interface:

import requests
import json

url = ""

headers = {
    "Content-Type": "application/yang-data+json",
    "Accept": "application/yang-data+json"

payload = json.dumps({
    "ietf-interfaces:interface": {
        "name": "GigabitEthernet0/1",
        "enabled": True

response = requests.put(url, headers=headers, data=payload, auth=("admin", "admin"), verify=False)


Bam! You've just configured an interface using RESTCONF. The server's response will indicate whether the operation was successful.

Verifying RESTCONF Configuration

Verification is just as crucial. You want to ensure that your configuration changes have been applied correctly. Here's how you can verify using RESTCONF:

1. Verify Configuration:

url = ""

headers = {
    "Accept": "application/yang-data+json"

response = requests.get(url, headers=headers, auth=("admin", "admin"), verify=False)


The server’s response will give you the current configuration of the specified interface in JSON format. Easy peasy, right?


You might be scratching your head, wondering, "When should I use NETCONF, and when is RESTCONF the better choice?" Well, it boils down to your specific needs and comfort level. NETCONF provides more granular control and is better suited for complex configurations. If your workflow involves a lot of XML and RPCs, NETCONF is your go-to. RESTCONF, on the other hand, is simpler and integrates seamlessly with RESTful services. It's a fantastic choice for those who prefer working with JSON and HTTP methods.

Security Considerations

Both NETCONF and RESTCONF come with their own sets of security considerations. NETCONF usually uses SSH for transport, providing a secure channel for your configurations. RESTCONF leverages HTTPS to secure communication. Always ensure you're using strong authentication mechanisms and encrypting your data in transit to prevent any snooping or tampering.

Common Pitfalls and Troubleshooting

Even seasoned network admins can stumble into pitfalls when working with NETCONF and RESTCONF. Let's look at some common issues and how to troubleshoot them.

1. Connection Refused:

Make sure that NETCONF or RESTCONF is enabled on the device and that you're connecting to the correct port (830 for NETCONF and 443 for RESTCONF by default). Also, double-check your firewall settings.

2. Authentication Failure:

Ensure your credentials are correct and that the user account has the necessary permissions. For RESTCONF, make sure you're using the correct authentication method (Basic Auth, for example).

3. Schema Errors:

When sending payloads, ensure they are correctly formatted according to the YANG models the device supports. Errors usually indicate a mismatch between your data and the device's expected format.

Best Practices

To master NETCONF and RESTCONF, adhere to the following best practices:

1. Learn YANG:

Both NETCONF and RESTCONF rely heavily on YANG models for data representation. Familiarize yourself with these models to create accurate configurations.

2. Start Small:

Begin with simple configurations and gradually move to more complex tasks. This way, you can better understand how each protocol works and avoid overwhelming yourself.

3. Utilize Tools:

Use tools like Postman for RESTCONF and ncclient for NETCONF to streamline your workflow. These tools provide a user-friendly interface, making it easier to construct and test your configurations.

The Road Ahead

Mastering NETCONF and RESTCONF is a significant milestone in your journey to acing the CCNP 350-401 ENCOR exam. These protocols are not just exam topics but essential skills in modern network management. The more you practice, the more confident you'll become.

So, fire up those terminals, write some scripts, and dive into the world of automated network configuration. You've got this! And remember, every command you execute brings you one step closer to becoming a certified CCNP professional.

Good luck, network warriors! Until next time, happy configuring!