Code Monkey home page Code Monkey logo

xr-restztp's Introduction

xr-restztp

Fully automated, Crosswork Based Restful ZTP flow using Classic ZTP with IOS-XR 6.6.3+

The Basics

xr-restztp is a simple Hook server that implements a REST client for Cisco Crosswork (3.2+) to enable and add ZTP devices, profiles, configs and credentials. It also hosts a flask based REST server in a thread to listen for POST events from a python script executed by the IOS-XR device that is running ZTP. The python ZTP script itself is uploaded to Cisco Crosswork by the xr-restztp code during the initial set up.

The flow of events is showcased below:

demo-flow

Postman Collection

The Relevant APIs used for Cisco crosswork and to test the basic Flask server hosted by xr-restztp are captured in the Postman collection that can be found at the following URL:

https://www.getpostman.com/collections/d3a93409079076af3c7b

Some Snapshots of these APIs are given below. Click the link above to view the same in your Postman Dashboard:

postman

Running the Server

The code for the server is automatically built into a Docker image on Dockerhub here: https://hub.docker.com/repository/docker/akshshar/xr-restztp-hook

To run the server:

  1. Install docker on the selected host machine

  2. Clone the Git repo and drop into the repo directory:

    git clone https://akshshar/xr-restztp ~/
    cd ~/xr-restztp/
    
  3. Launch the server by using the docker run command inside the repo directory to correctly mount the sample config.json provided in /lib (exposing either port 5000 as shown below or modify based on your choice):

    docker run --rm -itd \
      --name xr-restztp -p 5000:5000 \
      -v ${PWD}/lib/config.json:/usr/local/lib/xr-restztp/config.json \
      akshshar/xr-restztp-hook
    
  4. View the logs generated by the server in real time, using docker logs -f

    cisco@ztphook:~/xr-restztp$ docker logs -f xr-restztp
    * Serving Flask app "restful_ztp_hook" (lazy loading)
    * Environment: production
      WARNING: This is a development server. Do not use it in a production deployment.
      Use a production WSGI server instead.
    * Debug mode: on
    * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
    
    Configuration successfully updated
    
    Profile Created successfully
    
    ZTP Credential Profile Created successfully
    
    Device Added successfully
    
    

xr-restztp's People

Contributors

akshshar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.