cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
104
Views
5
Helpful
2
Replies
Highlighted
Beginner

Python action result needs page refresh

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
Highlighted
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
Highlighted
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

Highlighted

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.