cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1341
Views
10
Helpful
8
Replies

Interface operational state with NSO

RichardD2
Level 1
Level 1

Hi,

We have a need to determine if a particular interface is down (not admin-down, but operationally) with NSO.

It seems trivial to detect admin-state like this, but oddly, oper-status isn't available.

The goal would to use this state in a service template and make logic decisions based on it.

thanks

R

show devices device mydevice live-status interfaces-state interface TenGigE0/0/0/0 admin-status admin-status up 
show devices device mydevice live-status interfaces-state interface TenGigE0/0/0/0 oper-status % No entries found.

 

4 Accepted Solutions

Accepted Solutions

u.avsec
Spotlight
Spotlight

If nothing else works, and if the NED is CLI perhaps do exec

admin@ncs(config)# devices device rtr live-status cisco-ios-xr-stats:exec any "command you want"

The output would have to be parsed though as it will be a string I think.

This two threads do it in python:

https://community.cisco.com/t5/nso-developer-hub-discussions/how-do-i-call-the-devices-device-foo-config-exec-action-from/td-p/3750061

https://community.cisco.com/t5/nso-developer-hub-discussions/execute-show-command-from-nso-action/td-p/3711082

 

View solution in original post

RichardD2
Level 1
Level 1

Slight modification to the above, gives us:

admin@nso-lab(config)# devices device mydevice live-status exec any "show interface TenGigE 0/0/0/0" | include line
TenGigE0/0/0/0 is up, line protocol is up

We'll check out the python posts, much appreciated.

View solution in original post

hazad
Cisco Employee
Cisco Employee

It looks like there might be a mismatch between the device output and what the NED expects. In /cisco-iosxr-cli-7.39/src/gili/if:interfaces-state_interface.gili you see that the NED expects "Line protocol is" with an uppercase L, while the output of the device is "line protocol is" with a lowercase l. You can try to correct it and recompile the NED.

View solution in original post

hazad
Cisco Employee
Cisco Employee

Awesome! Yes, please go ahead and open a TAC case

View solution in original post

8 Replies 8

Nabsch
Spotlight
Spotlight

Hello ,

 

Which NED are you using ?

can you provide NSO , Ned version ?


Can you execute this command and post the output that you get  .

 

 

show devices device mydevice live-status interfaces-state interface TenGigE0/0/0/0

RichardD2
Level 1
Level 1

Thanks for the reply,

Running NSO 5.6.5 with cisco-iosxr-cli-7.38 NED

Result of command above:

live-status interfaces-state interface TenGigE0/0/0/0
 admin-status up
 phys-address d4:6a:35:f4:44:00
 speed        10000000000
 statistics in-octets 35334763881
 statistics in-unicast-pkts 7046572
 statistics in-broadcast-pkts 2
 statistics in-multicast-pkts 4058647
 statistics in-discards 0
 statistics in-errors 1
 statistics in-unknown-protos 0
 statistics out-octets 35249134129
 statistics out-unicast-pkts 6023956
 statistics out-broadcast-pkts 3
 statistics out-multicast-pkts 4050900
 statistics out-discards 0
 statistics out-errors 0
 ipv4 forwarding true
 ipv4 mtu   9180
IP             NETMASK          ORIGIN
----------------------------------------
1.2.3.4  255.255.255.252  -

 ipv6 forwarding true
 ipv6 mtu   9180

u.avsec
Spotlight
Spotlight

If nothing else works, and if the NED is CLI perhaps do exec

admin@ncs(config)# devices device rtr live-status cisco-ios-xr-stats:exec any "command you want"

The output would have to be parsed though as it will be a string I think.

This two threads do it in python:

https://community.cisco.com/t5/nso-developer-hub-discussions/how-do-i-call-the-devices-device-foo-config-exec-action-from/td-p/3750061

https://community.cisco.com/t5/nso-developer-hub-discussions/execute-show-command-from-nso-action/td-p/3711082

 

RichardD2
Level 1
Level 1

Slight modification to the above, gives us:

admin@nso-lab(config)# devices device mydevice live-status exec any "show interface TenGigE 0/0/0/0" | include line
TenGigE0/0/0/0 is up, line protocol is up

We'll check out the python posts, much appreciated.

hazad
Cisco Employee
Cisco Employee

It looks like there might be a mismatch between the device output and what the NED expects. In /cisco-iosxr-cli-7.39/src/gili/if:interfaces-state_interface.gili you see that the NED expects "Line protocol is" with an uppercase L, while the output of the device is "line protocol is" with a lowercase l. You can try to correct it and recompile the NED.

RichardD2
Level 1
Level 1

Thank you, we will give it a go and see what happens.

RichardD2
Level 1
Level 1

@hazad - You nailed it, that was exactly the issue. Should I open a TAC case and provide this info, or another approach?

thanks

R

hazad
Cisco Employee
Cisco Employee

Awesome! Yes, please go ahead and open a TAC case

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: