cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2731
Views
1
Helpful
7
Replies

REST API for config push onto NSO device

Chitra
Cisco Employee
Cisco Employee

Hi! Is there a REST API to push configuration on to NSO device equivalent to NETCONF edit config?

For example create a interface by using below XMLin request body

           <config>

                   <interface xmlns="urn:ios">

                     <Loopback>

                       <name>1175</name>

                       <ip>

                         <address>

                           <primary>

                             <address>10.172.19.88</address>

                             <mask>255.255.255.255</mask>

                           </primary>

                         </address>

                       </ip>

                     </Loopback>

                   </interface>

                 </config>

1 Accepted Solution

Accepted Solutions
7 Replies 7

frjansso
Cisco Employee
Cisco Employee

Hi!

Thanks much ! The link was helpful but have a basic doubt in flow. can anyone please help?

1)How do we find correct namespace ?

2) how to find complete yang model definition( i.e xml format ) for the device and its corresponding namespace?

Doing GET request wont give all possible tags which can be configured. All i need to achieve is  to generalize this xml request body so any configuration can be pushed in one shot.

i used http://localhost:port/api/running/ncs:devices/ncs:device/ios_xr with below PATCH request body

<device xmlns="http://tail-f.com/ns/ncs" xmlns:y="http://tail-f.com/ns/rest"  xmlns:ncs="http://tail-f.com/ns/ncs">

   <port>23</port>

   <state>

        <admin-state>unlocked</admin-state>

    </state>

    <config>

                   <logging xmlns="http://tail-f.com/ned/cisco-ios-xr">

                    <host>

                <address>9.9.9.9</address>

            </host>

            </logging>

            <interface xmlns="http://tail-f.com/ned/cisco-ios-xr">

            <Loopback>

                <id>1007</id>

            </Loopback>

            </interface>

      </config>

      </device>

Easiest is to do this using the CLI:

"show configuration device device foo | display xml"

- or -

"show configuration device device foo | display xml | save foo.xml"

This command doesn't work for me. It says show configuration works can only be followed by commit  or rollback.

show configuration gives only interface tag and doesn't give possible configuration tags for example <router> ,<snmp-server> etc.

I want the skeleton XML which can be configured irrespective of whether its already configured or not configured at all.

Basically all  sub tree tags under <config> tag for a device.

Please comment !

You may be in Cisco-style CLI, please try:

show running-config devices device foo config | display xml

or if you're in config mode

show full-configuration devices device foo config | display xml

or by REST

curl -u admin:admin http://localhost:8080/api/running/devices/device/foo/config\?deep

Cheers,

Fredrik

Hi !

can anyone please help answering below ?

1) where can  i find device specific yang files in NSO managed devices?

a)Is it same as ned yang files(eg: ncs-4.4.2\packages\neds\cisco-ios\src\yang)?

b)Does this mean for all ios device <ncs-4.4.2\packages\neds\cisco-ios\src\yang> is the yang model used ?

note : I am trying to push configuration patch request using pyang -f sample-xml-skeleton output of this file on to device

2)I can see four

tailf-ned-cisco-ios,tailf-ned-cisco-ios-id,tailf-ned-cisco-ios-meta,tailf-ned-cisco-ios-oper,tailf-ned-cisco-ios-stats files in package yang folder.

a)What does each mean ?

b)Which file should i complie using pyang -f sample-xml-skeleton in order to use its output as request body for

http://localhost:8080/api/running/devices/device/ios_192.168.99.194/config\?deep

to change configuration of ios device.

Please start a new thread for this question.