cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
953
Views
5
Helpful
2
Replies

Python action result needs page refresh

Islam_Hassanin
Level 1
Level 1

Dears,

used NSO ==> 5.3

 

i have created a simple python action that lists the interfaces of the device based on the type u choose as shown below

p2.PNG

, but when i click run it redirects me to the below page so i need to refresh page to see the outputp1.PNG

python Action:

p3.PNG

yang:

p4.PNG

how can i solve this to present the output within same page without reload it.

 

Thanks in advance!

1 Accepted Solution

Accepted Solutions

aelganzo
Cisco Employee
Cisco Employee

Hi Islam,

 

Why you need python for that?, You could use it from yang as below

 

leaf device {
tailf:info "device name";
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}


leaf interface-type {
type enumeration {
enum GigabitEthernet;
enum Ethernet;
enum FastEthernet;
enum loopback;
}
}
container interface-list {
// then you use a filter based on the interface xpath
// for ios-xr it's like
leaf GigabitEthernet {
when "current()/../../interface-type = 'GigabitEthernet'";
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
}
}

// do the same based on your device ned

}

 

 

View solution in original post

2 Replies 2

aelganzo
Cisco Employee
Cisco Employee

Hi Islam,

 

Why you need python for that?, You could use it from yang as below

 

leaf device {
tailf:info "device name";
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}


leaf interface-type {
type enumeration {
enum GigabitEthernet;
enum Ethernet;
enum FastEthernet;
enum loopback;
}
}
container interface-list {
// then you use a filter based on the interface xpath
// for ios-xr it's like
leaf GigabitEthernet {
when "current()/../../interface-type = 'GigabitEthernet'";
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";
}
}

// do the same based on your device ned

}

 

 

Thanks @aelganzo 

 

i was just trying to implement some actions using python for other cases, but i got same issue "need to refresh the page".

BTW i tried same action with another NSO version, and it works properly now.

 

Thanks a lot for your response.

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?