Ansible and IOSXE - RESTCONF

Introduction General preparation [all:vars] ansible_python_interpreter="/usr/bin/python3" ansible_network_os=default [iosxe] ansible_port=8181 group_vars ansible_user: 'developer' ansible_password: 'C1sco12345' ansible_connection: "httpapi" ansible_network_os: "restconf" ansible_httpapi_use_ssl: true ansible_httpapi_port: 9443 ansible_httpapi_validate_certs: false ansible_httpapi_restconf_root: "/restconf" Ansible RESTCONF: retrieve IETF interfaces --- - name: Restconf - GET hosts: iosxe connection: local tasks: - name: Get interfaces from IETF YANG model restconf_get: content: config output: json path: /data/ietf-interfaces:interfaces/interface=GigabitEthernet1 register: output - name: display all debug: var: output In case you want to retrieve all interface, use the following path path: /data/ietf-interfaces:interfaces

RESTCONF with Python

Installation In this post, we went over a number of use cases. We used POSTMAN to understand the details. Here is the list of use cases for your convenience.

RESTCONF intro with Postman - Part 1

What is RESTCONF As per RFC 8040 (RESTCONF Protocol), the IETF describes RESTCONF as: an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in the Network Configuration Protocol (NETCONF).