openapi: 3.0.0
info:
  title: NSO Sample API Requests
  description: >-
    This only covers a sub-set of the RESTCONF Northbound API, since
    auto-generated swagger from the application is 200,000 lines of
    documentation.


    Created using https://github.com/NSO-developer/nso-vagrant as a localhost
    NSO testing environment.
  version: 1.0.0
servers:
  - url: http://{{protocol}}
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
security:
  - basicAuth: []
tags:
  - name: Always-On Read Only Requests
  - name: >-
      Always-On Read Only Requests > NSO Root of the App Hierarchy Level Queries
      Copy
    description: >-
      Note: Root level queries have different headers than other queries. Return
      All Application and Device Config.
  - name: Always-On Read Only Requests > View Device Config
    description: >-
      If device config is very nested, you can use the depth=X parameter to see
      additional hidden layers of nesting.
  - name: Always-On Read Only Requests > NSO Device Groups
  - name: Always-On Read Only Requests > View Existing NSO Service Instances
    description: >-
      NSO allows you to create any service, with any inputs, to enforce any
      config, for any devices. 


      The details for the service can be seen on GitHub.


      Code for your reference on GitHub:

      https://github.com/jabelk/svi_verify_example
  - name: Always-On Read Only Requests > Operational Data
  - name: Reservable Sandbox Read / Write Access
  - name: >-
      Reservable Sandbox Read / Write Access > NSO Root of the App Hierarchy
      Level Queries
    description: >-
      Note: Root level queries have different headers than other queries. Return
      All Application and Device Config.
  - name: Reservable Sandbox Read / Write Access > View Device Config
    description: >-
      If device config is very nested, you can use the depth=X parameter to see
      additional hidden layers of nesting.
  - name: Reservable Sandbox Read / Write Access > Commit Dry-Run and Rollbacks
    description: >-
      Commit dry-run is NSO not making any change to the device, but telling you
      what the proposed change will be based on what is already existing on the
      device, calculating the difference. Rollbacks are when NSO calculates the
      minimum number of commands to return it to the previous state of
      configuration before the NSO commit transaction. 
  - name: Reservable Sandbox Read / Write Access > Device Config Templates
  - name: Reservable Sandbox Read / Write Access > NSO Device Groups
  - name: Reservable Sandbox Read / Write Access > Config Compliance Reporting
  - name: 'Reservable Sandbox Read / Write Access > NSO Services: SVI Verify Example'
    description: >-
      NSO allows you to create any service, with any inputs, to enforce any
      config, for any devices. 


      The details for the service can be seen on GitHub.


      Code for your reference on GitHub:

      https://github.com/jabelk/svi_verify_example
  - name: Reservable Sandbox Read / Write Access > Operational Data
  - name: Reservable Sandbox Read / Write Access > Device Config Management
    description: >-
      Any element of device configuration modeled in NSO can be configured over
      the API. The ones given here are just samples. NSO will translate it to
      the correct commands and can rollback if needed. 
  - name: Reservable Sandbox Read / Write Access > Adding / Removing a Device
    description: >-
      The production NSO already has all devices added, but you can delete one
      and re-add it. 
paths:
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data:
    get:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Root of the App Hierarchy
          Level Queries
      summary: Root Level NSO XML returned
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > View Device Config
      summary: 'All Devices in Device List: Show Running-config Devices Device'
      description: >-
        Note: This can be a very large payload, since it is sending the parsed
        running config of every single device in the device list, and the NSO
        application configuration.
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > View Device Config
      summary: Single Device Config - Show devices device DEVICENAME
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
        - Reservable Sandbox Read / Write Access > Adding / Removing a Device
      summary: Delete a device from CDB Device List
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/platform:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > View Device Config
      summary: Single Device HW / SW Platform Info
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > View Device Config
      summary: show interfaces
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/GigabitEthernet=4:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > View Device Config
      summary: show interface Gig 4 config
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device-group:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > NSO Device Groups
      summary: List Device Groups
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: ''
          in: header
          schema:
            type: string
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device-group=IOS-DEVICES:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > NSO Device Groups
      summary: List Device Single Device Group Details
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/svi_verify_example:svi_verify_example:
    get:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Services: SVI Verify
          Example
      summary: Get List of Service Instances for a Service
      description: |-
        Note: this will only have data if service instances already exist.
        Shows all service instances. In this case we have just one. 
        CLI version:
        admin@ncs# show running-config simple-sample-snmp-server-service
        simple-sample-snmp-server-service first_service_instance
         device [ ios0 ]
         dummy  10.0.0.0
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/svi_verify_example:svi_verify_example=first-instance:
    get:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Services: SVI Verify
          Example
      summary: Get Service Info For Single Service Instance
      description: >-
        Note: this will only have data if service instances already exist.

        CLI version to do the same:

        admin@ncs# show running-config simple-sample-snmp-server-service
        first_service_instance
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
    patch:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Services: SVI Verify
          Example
      summary: Update an Existing Service Instance
      description: Updating the VLAN Name and Number
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n    \"svi_verify_example:svi_verify_example\": [\n       
                {\n            \"name\": \"first-instance\",\n           
                \"switches\": [\n                {\n                    \"id\":
                \"first-sw\",\n                    \"switch-device\":
                \"dist-sw01\"\n                },\n               
                {\n                    \"id\":
                \"second-sw\",\n                    \"switch-device\":
                \"dist-sw02\"\n                }\n            ],\n           
                \"firewalls\": [\n                {\n                    \"id\":
                \"first-fw\",\n                    \"firewall-device\":
                \"edge-firewall01\"\n                }\n           
                ],\n            \"vlan-id\": 1503,\n            \"vlan-name\":
                \"NEW-SVI-DEMO\"\n        }\n    ]\n}"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Services: SVI Verify
          Example
      summary: Remove Device from Service
      description: >-
        This will remove any configuration template based on the inputs stored
        in the service. 

        CLI way of doing the same thing:

        no simple-sample-snmp-server-service first_service_instance
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/live-status:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > Operational Data
      summary: View NSO Parsed Live Status
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 1. Create new Loopback
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                " <Loopback>\n   <name>1337</name>\n   <description>RESTCONF
                CREATED LOOPBACK</description>\n   <ip>\n     <address>\n      
                <primary>\n         <address>10.20.50.4</address>\n        
                <mask>255.255.255.255</mask>\n       </primary>\n    
                </address>\n   </ip>\n </Loopback>"
      security:
        - basicAuth: []
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '201':
          description: Created
          headers:
            Location:
              schema:
                type: string
                example: >-
                  https://10.10.20.49/restconf/data/tailf-ncs:devices/device=dist-rtr01/config/tailf-ned-cisco-ios:interface/Loopback=42518
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:36:12 GMT
            Last-Modified:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:36:12 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Etag:
              schema:
                type: string
                example: '"1600-90572-167270"'
            Content-Length:
              schema:
                type: integer
                example: '0'
            Content-Type:
              schema:
                type: string
                example: text/html; charset=UTF-8
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            text/plain:
              schema:
                type: string
              example: ''
        '409':
          description: Conflict
          headers:
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:41:59 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Content-Length:
              schema:
                type: integer
                example: '384'
            Content-Type:
              schema:
                type: string
                example: application/yang-data+json
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            application/json:
              schema:
                type: object
              example:
                errors:
                  error:
                    - error-message: >-
                        object already exists:
                        /ncs:devices/ncs:device[ncs:name='dist-rtr01']/ncs:config/ios:interface/ios:Loopback[ios:name='42518']
                      error-path: >-
                        /tailf-ncs:devices/device=dist-rtr01/config/tailf-ned-cisco-ios:interface
                      error-tag: data-exists
                      error-type: application
        '415':
          description: Unsupported Media Type
          headers:
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:35:47 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Content-Length:
              schema:
                type: integer
                example: '281'
            Content-Type:
              schema:
                type: string
                example: application/yang-data+json
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            application/json:
              schema:
                type: object
              example:
                errors:
                  error:
                    - error-message: >-
                        Unsupported media type: application/json ; Should be one
                        of: application/yang-data+xml,
                        application/yang-data+json.
                      error-tag: malformed-message
                      error-type: application
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/GigabitEthernet=4/ip/address:
    delete:
      tags:
        - Reservable Sandbox Read / Write Access > Commit Dry-Run and Rollbacks
      summary: Commit-Dry Run Remove IP address from interface
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: dry-run
          in: query
          schema:
            type: string
          example: native
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/:
    patch:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Templates
      summary: 1. Create a DNS Server Configuration Template
      description: |-
        sample CLI to do the same:
        devices template Standard_DNS_Servers
        ned-id cisco-ios-cli-6.42
        confi
        ip name-server name-server-list 8.8.8.8
        exit
        exit
        exit
        ned-id cisco-nx-cli-5.13 config
        ip name-server servers 8.8.8.8
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "<devices xmlns=\"http://tail-f.com/ns/ncs\">\n              
                <template>\n                
                <name>SET-DNS-SERVER</name>\n                
                <ned-id>\n                   <id
                xmlns:cisco-iosxr-cli-7.20=\"http://tail-f.com/ns/ned-id/cisco-iosxr-cli-7.20\">cisco-iosxr-cli-7.20:cisco-iosxr-cli-7.20</id>\n                  
                <config>\n                     <domain
                xmlns=\"http://tail-f.com/ned/cisco-ios-xr\">\n                      
                <name-server>\n                        
                <address>208.67.222.222</address>\n                      
                </name-server>\n                      
                <name-server>\n                        
                <address>208.67.220.220</address>\n                      
                </name-server>\n                    
                </domain>\n                   </config>\n                
                </ned-id>\n                 <ned-id>\n                   <id
                xmlns:cisco-asa-cli-6.8=\"http://tail-f.com/ns/ned-id/cisco-asa-cli-6.8\">cisco-asa-cli-6.8:cisco-asa-cli-6.8</id>\n                  
                <config>\n                     <dns
                xmlns=\"http://cisco.com/ned/asa\">\n                      
                <domain-lookup>\n                        
                <name>mgmt</name>\n                      
                </domain-lookup>\n                      
                <server-group>\n                        
                <name>DefaultDNS</name>\n                        
                <name-server>208.67.220.220</name-server>\n                        
                <name-server>208.67.222.222</name-server>\n                      
                </server-group>\n                     </dns>\n                  
                </config>\n                 </ned-id>\n                
                <ned-id>\n                   <id
                xmlns:cisco-ios-cli-6.44=\"http://tail-f.com/ns/ned-id/cisco-ios-cli-6.44\">cisco-ios-cli-6.44:cisco-ios-cli-6.44</id>\n                  
                <config>\n                     <ip
                xmlns=\"urn:ios\">\n                      
                <name-server>\n                        
                <name-server-list>\n                          
                <address>208.67.222.222</address>\n                        
                </name-server-list>\n                        
                <name-server-list>\n                          
                <address>208.67.220.220</address>\n                        
                </name-server-list>\n                      
                </name-server>\n                     </ip>\n                  
                </config>\n                 </ned-id>\n                
                <ned-id>\n                   <id
                xmlns:cisco-nx-cli-5.15=\"http://tail-f.com/ns/ned-id/cisco-nx-cli-5.15\">cisco-nx-cli-5.15:cisco-nx-cli-5.15</id>\n                  
                <config>\n                     <ip
                xmlns=\"http://tail-f.com/ned/cisco-nx\">\n                      
                <name-server>\n                        
                <servers>208.67.222.222</servers>\n                        
                <servers>208.67.220.220</servers>\n                      
                </name-server>\n                     </ip>\n                  
                </config>\n                 </ned-id>\n              
                </template>\n             </devices>"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/apply-template/:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Templates
      summary: 2. Apply DNS Server Device Template
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "<!--\ncli for same config\nconf\ndevices device dist-rtr01
                apply-template template-name
                SET-DNS-SERVER\n-->\n\n<input>\n\t<template-name>SET-DNS-SERVER</template-name>\n</input>\n\n"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices:
    patch:
      tags:
        - Reservable Sandbox Read / Write Access > NSO Device Groups
      summary: Configure Device Groups
      description: >-
        Groups are useful for organizing your devices in a way

        that makes sense to you.


        Devices can be a member of more than one group,

        and device groups can be nested.


        CLI Equivalent


        devices device-group campus-devices device-name [ ios0 nx0 ]

        top

        devices device-group backbone-devices device-name [ iosxr0 asa0 ]

        top

        devices device-group parent-group-all-devices device-group [
        campus-devices backbone-devices ]

        commit dry-run

        commit dry-run outformat xml

        top
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "<devices xmlns=\"http://tail-f.com/ns/ncs\">\n              
                <device-group>\n                
                <name>ALL</name>\n                
                <device-group>ASA-DEVICES</device-group>\n                
                <device-group>IOS-DEVICES</device-group>\n                
                <device-group>NXOS-DEVICES</device-group>\n                
                <device-group>XR-DEVICES</device-group>\n              
                </device-group>\n               <device-group>\n                
                <name>ASA-DEVICES</name>\n                
                <device-name>edge-firewall01</device-name>\n              
                </device-group>\n               <device-group>\n                
                <name>IOS-DEVICES</name>\n                
                <device-name>dist-rtr01</device-name>\n                
                <device-name>dist-rtr02</device-name>\n                
                <device-name>internet-rtr01</device-name>\n              
                </device-group>\n               <device-group>\n                
                <name>NXOS-DEVICES</name>\n                
                <device-name>dist-sw01</device-name>\n                
                <device-name>dist-sw02</device-name>\n              
                </device-group>\n               <device-group>\n                
                <name>XR-DEVICES</name>\n                
                <device-name>core-rtr01</device-name>\n                
                <device-name>core-rtr02</device-name>\n              
                </device-group>\n             </devices>"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Adding / Removing a Device
      summary: Step 0. Create a Device in the CDB
      description: >-
        Update the Payload with correct info. Sample XML can be used from Get on
        existing device or using commit dry run on CLI. Device names, NED-ID,
        Address and Ports will likely be different depending on your
        environment.
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "\n<!--\nSample CLI to do the same thing\ndevices device
                dist-rtr01\naddress   10.10.20.175\nauthgroup
                labadmin\ndevice-type cli ned-id cisco-ios-cli-6.44\ndevice-type
                cli protocol telnet\nstate admin-state
                unlocked\n-->\n\n\n<device>\n <name>dist-rtr01</name>\n
                <address>10.10.20.175</address>\n
                <authgroup>labadmin</authgroup>\n <device-type>\n   <cli>\n    
                <ned-id
                xmlns:cisco-ios-cli-6.44=\"http://tail-f.com/ns/ned-id/cisco-ios-cli-6.44\">cisco-ios-cli-6.44:cisco-ios-cli-6.44</ned-id>\n    
                <protocol>telnet</protocol>\n   </cli>\n </device-type>\n
                <state>\n   <admin-state>unlocked</admin-state>\n
                </state>\n</device>\n      "
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:compliance:
    patch:
      tags:
        - Reservable Sandbox Read / Write Access > Config Compliance Reporting
      summary: Configure DNS Server Compliance Report
      description: >-
        This compliance report uses the device config template SET-DNS-SERVER to
        see if the device has a DNS server per OS type. 

        It assumes you have the template in the CDB and have device groups set.
        The prod instance does not have these set by default.
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "<compliance xmlns=\"http://tail-f.com/ns/ncs\">\n              
                <reports>\n                 <report>\n                  
                <name>DNS_COMPLIANCE_REPORT</name>\n                  
                <compare-template>\n                    
                <template-name>SET-DNS-SERVER</template-name>\n                    
                <device-group>ALL</device-group>\n                  
                </compare-template>\n                 </report>\n              
                </reports>\n             </compliance>"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:compliance/reports/report=DNS_COMPLIANCE_REPORT/run:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Config Compliance Reporting
      summary: Run Compliance Report
      description: |-
        for a system install the report will be created here:
        /var/opt/ncs/state/compliance-reports
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '"<input>\n\t<outformat>html</outformat>\n</input>"'
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/svi_verify_example:svi_verify_example/:
    patch:
      tags:
        - >-
          Reservable Sandbox Read / Write Access > NSO Services: SVI Verify
          Example
      summary: Create Service Instance for Single Device
      description: >-
        Creates a service and applies the corresponding template. 


        to add a package on the sandbox system install do the following:


        cd /var/opt/ncs/packages

        ncs-make-package --service-skeleton template snmp-servers

        vi snmp-servers/src/yang/snmp-servers.yang


        ** add type string / remove type ip address **

        https://github.com/jabelk/snmp-servers/blob/main/src/yang/snmp-servers.yang#L31


        cd snmp-servers/src/

        make

        cd ..

        cd templates/

        vi snmp-servers-template.xml


        ** add in the templates **


        https://github.com/jabelk/snmp-servers/blob/main/templates/snmp-servers-template.xml#L19


        log into NSO

        ncs_cli -C

        packages reload
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n    \"svi_verify_example:svi_verify_example\": [\n       
                {\n            \"name\": \"first-instance\",\n           
                \"switches\": [\n                {\n                    \"id\":
                \"first-sw\",\n                    \"switch-device\":
                \"dist-sw01\"\n                },\n               
                {\n                    \"id\":
                \"second-sw\",\n                    \"switch-device\":
                \"dist-sw02\"\n                }\n            ],\n           
                \"firewalls\": [\n                {\n                    \"id\":
                \"first-fw\",\n                    \"firewall-device\":
                \"edge-firewall01\"\n                }\n           
                ],\n            \"vlan-id\": 1337,\n            \"vlan-name\":
                \"SVI-DEMO\"\n        }\n    ]\n}"
      security:
        - basicAuth: []
      parameters:
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Authorization
          in: header
          schema:
            type: string
          example: Basic YWRtaW46YWRtaW4=
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
      responses:
        '204':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/live-status/tailf-ned-cisco-ios-stats:arp:
    get:
      tags:
        - Reservable Sandbox Read / Write Access > Operational Data
      summary: View Arp Data
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/live-status/tailf-ned-cisco-ios-stats:exec/any:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Operational Data
      summary: 'Send any Command to Device: Show IP Interface Brief'
      description: any enable level command can be sent
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "{\n  \"input\":\n  {\n    \"args\": \"show ip interface
                brief\"\n  }\n}"
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/Loopback=1337/ip:
    patch:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 2. Edit New Loopback IP Address
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "\n                       <ip>\n                        
                <address>\n                          
                <primary>\n                            
                <address>10.0.0.5</address>\n                            
                <mask>255.255.255.255</mask>\n                          
                </primary>\n                        
                </address>\n                       </ip>\n"
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/Loopback=1337/ip/address:
    delete:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 3. Remove IP Address From Interface
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:interface/Loopback=1337:
    delete:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 4. Delete new Loopback
      security:
        - basicAuth: []
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '201':
          description: Created
          headers:
            Location:
              schema:
                type: string
                example: >-
                  https://10.10.20.49/restconf/data/tailf-ncs:devices/device=dist-rtr01/config/tailf-ned-cisco-ios:interface/Loopback=42518
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:36:12 GMT
            Last-Modified:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:36:12 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Etag:
              schema:
                type: string
                example: '"1600-90572-167270"'
            Content-Length:
              schema:
                type: integer
                example: '0'
            Content-Type:
              schema:
                type: string
                example: text/html; charset=UTF-8
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            text/plain:
              schema:
                type: string
              example: ''
        '409':
          description: Conflict
          headers:
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:41:59 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Content-Length:
              schema:
                type: integer
                example: '384'
            Content-Type:
              schema:
                type: string
                example: application/yang-data+json
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            application/json:
              schema:
                type: object
              example:
                errors:
                  error:
                    - error-message: >-
                        object already exists:
                        /ncs:devices/ncs:device[ncs:name='dist-rtr01']/ncs:config/ios:interface/ios:Loopback[ios:name='42518']
                      error-path: >-
                        /tailf-ncs:devices/device=dist-rtr01/config/tailf-ned-cisco-ios:interface
                      error-tag: data-exists
                      error-type: application
        '415':
          description: Unsupported Media Type
          headers:
            Date:
              schema:
                type: string
                example: Mon, 14 Sep 2020 13:35:47 GMT
            Cache-Control:
              schema:
                type: string
                example: private, no-cache, must-revalidate, proxy-revalidate
            Content-Length:
              schema:
                type: integer
                example: '281'
            Content-Type:
              schema:
                type: string
                example: application/yang-data+json
            Pragma:
              schema:
                type: string
                example: no-cache
            Content-Security-Policy:
              schema:
                type: string
                example: >-
                  default-src 'self'; block-all-mixed-content; base-uri 'self';
                  frame-ancestors 'none';
            Strict-Transport-Security:
              schema:
                type: string
                example: max-age=15552000; includeSubDomains
            X-Content-Type-Options:
              schema:
                type: string
                example: nosniff
            X-Frame-Options:
              schema:
                type: string
                example: DENY
            X-XSS-Protection:
              schema:
                type: string
                example: 1; mode=block
          content:
            application/json:
              schema:
                type: object
              example:
                errors:
                  error:
                    - error-message: >-
                        Unsupported media type: application/json ; Should be one
                        of: application/yang-data+xml,
                        application/yang-data+json.
                      error-tag: malformed-message
                      error-type: application
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/:
    patch:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 5. Add SNMP Community String
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: >-
                "                 <config>\n                   <snmp-server
                xmlns=\"urn:ios\">\n                    
                <community>\n                      
                <name>NSO-STRING</name>\n                      
                <RW/>\n                     </community>\n                  
                </snmp-server>\n                 </config>"
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/config/tailf-ned-cisco-ios:snmp-server:
    delete:
      tags:
        - Reservable Sandbox Read / Write Access > Device Config Management
      summary: 6. Remove SNMP Community String from Device
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: Content-Type
          in: header
          schema:
            type: string
          example: application/yang-data+xml
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/ssh/fetch-host-keys:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Adding / Removing a Device
      summary: (not needed on sandbox telent) Step 1. SSH Fetch-Host-Keys Device
      description: >-
        Since the sandbox is using telnet, we won't need to fetch SSH host keys,
        but this call is how you would do it if you were using SSH


        developer@ncs(config-device-dist-rtr01)# ssh fetch-host-keys

        result not-available

        info Not available for telnet

        is the error given
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '""'
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  //{NSO_IP}:{NSO_HTTP_PORT}/restconf/data/tailf-ncs:devices/device={SAMPLE_IOS_DEVICE}/sync-from:
    post:
      tags:
        - Reservable Sandbox Read / Write Access > Adding / Removing a Device
      summary: Step 2. Sync-from Device
      requestBody:
        content:
          '*/*':
            schema:
              type: string
              example: '""'
      parameters:
        - name: Accept
          in: header
          schema:
            type: string
          example: application/yang-data+json
        - name: NSO_IP
          in: path
          schema:
            type: string
          required: true
        - name: NSO_HTTP_PORT
          in: path
          schema:
            type: string
          required: true
        - name: SAMPLE_IOS_DEVICE
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
