cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
670
Views
2
Helpful
4
Replies

REST API for CLI "default interface"

smansor
Cisco Employee
Cisco Employee

Hi,

Apologies if I'm asking silly question - but there is no mechanism for REST api to send command "default interface xxx", am I right?

Reason I'm asking is currently I'm trying to apply rule policies, and one of the requirement from customer is REST api must not reset interface loopback config (CLI = "default interface Loopback xx").

So it's safe to say since REST can't issue that CLI, it should be fine?

I can apply rule to cover "no interface Loopback xx" scenario - just hoping that I don't have to create another policy rule for restricting "default interface Loopback xx"?


Thanks in advance!

4 Replies 4

KJ Rossavik
Cisco Employee
Cisco Employee

If the command is supported by the NED, then you can do this over the REST interface. If the command is missing in the NED, then you can request it: Detailed process regarding NSO and NED support

Akira Iwamoto
Cisco Employee
Cisco Employee

NSO REST can send the command by live-status feature.

admin@ncs# conf
Entering configuration mode terminal
admin@ncs(config)# devices device csr1kv config default interface Loopback 100
result
Interface Loopback100 set to default configuration
CSR1000v(config)#
admin@ncs(config)#

This is an action, and you can exec it from REST as well.

$ curl -X POST -u admin:admin  \
http://localhost:8080/api/operations/devices/device/csr1kv/config/ios:EXEC/default \
-H "Content-Type: application/vnd.yang.data+json" \
-d '{"input": {"args" : "interface Loopback 100"}}'
{
  "tailf-ned-cisco-ios:output": {
      "result": "\r\nInterface Loopback100 set to default configuration\r\nCSR1000v(config)#"
    }
 }

You would need to perform sync-from after the execution, otherwise the config may be out-of-sync.

Regards,

Akira

Ah - ok so REST will be able to send CLI command directly on top of using NED.

Ok I think another way for me is to use AAA - rule list to restrict it then.

Thank you Akira-san!

You may also wish to review this post:

https://communities.cisco.com/thread/84801

where the discussion was about restricting certain device configs using NSO tfcp:policy rules...

there were several nice examples provided.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: