ā11-19-2021 01:39 AM
Hi,
I am currently trying to build a l3vpn service which requests several parameters. Some of these mandatory parameters are interfaces.
Instead of having to input a string i would have liked to modelize the devices and their interfaces to let me select the first available one from a dropdown menu. A criteria to select the first available interface could be both the admin state of the interface and a specific description like "free" or "available".
Can you please help me in achieving that ?
Thanks in advance for your help.
Best Regards,
Jerems
Solved! Go to Solution.
ā11-19-2021 03:30 AM
If by dropdown list you mean ability to use tab completion in the NSO CLI you can try something like this:
container ios {ā when "deref(../name)/../ncs:module[1]/ncs:name='tailf-ned-cisco-ios'" {ā tailf:dependency "../name";ā }ā tailf:cli-drop-node-name;ā list interface {ā tailf:info "GigabitEthernet interface";ā key intf-id;ā leaf intf-id{ā tailf:info "GigabitEthernet Interface ID";ā mandatory true;ā type leafref {ā path "deref(../../../name)/../ncs:config/ios:interface/ios:GigabitEthernet/ios:name";ā }ā }ā }
}
This roughly translates to:
* This container is only applicable if device-type is IOS
* tailf:dependency ensure that when statement is re-evaluated when device is changed
* tailf:cli-drop-node-name hides ios so you are configuring interfaces directly
* Point to the existing interfaces on the devices by:
deref(../../../name)../ -> evaluates to /devices/device[name]/ncs:config/ios:interface/ios:GigabitEthernet/ios:name
Then you repeat the whole thing with appropriate paths for other device types you want to support. Use model above just as guidance, if you are using NSO with CDM, paths will be probably different. By expanding the leafref you can probably achieve what you want by looking into the description.
Note that having references to device models in your service model is kinda antipattern, since service models should be device agnostic.
ā11-19-2021 03:30 AM
If by dropdown list you mean ability to use tab completion in the NSO CLI you can try something like this:
container ios {ā when "deref(../name)/../ncs:module[1]/ncs:name='tailf-ned-cisco-ios'" {ā tailf:dependency "../name";ā }ā tailf:cli-drop-node-name;ā list interface {ā tailf:info "GigabitEthernet interface";ā key intf-id;ā leaf intf-id{ā tailf:info "GigabitEthernet Interface ID";ā mandatory true;ā type leafref {ā path "deref(../../../name)/../ncs:config/ios:interface/ios:GigabitEthernet/ios:name";ā }ā }ā }
}
This roughly translates to:
* This container is only applicable if device-type is IOS
* tailf:dependency ensure that when statement is re-evaluated when device is changed
* tailf:cli-drop-node-name hides ios so you are configuring interfaces directly
* Point to the existing interfaces on the devices by:
deref(../../../name)../ -> evaluates to /devices/device[name]/ncs:config/ios:interface/ios:GigabitEthernet/ios:name
Then you repeat the whole thing with appropriate paths for other device types you want to support. Use model above just as guidance, if you are using NSO with CDM, paths will be probably different. By expanding the leafref you can probably achieve what you want by looking into the description.
Note that having references to device models in your service model is kinda antipattern, since service models should be device agnostic.
ā11-19-2021 06:01 AM
Hi bdolenc01 !
Thanks a lot for your quick answer ! Looking at your last note, i guess this is where SLA (CFS/RFS) comes in
Thanks,
Jerems
ā11-19-2021 06:16 AM
I aim to have specific packages for each type of devices. In my case there could be Cisco and Juniper devices.
How should i proceed when i have to call an external package called "interface" in my "upper" service package where i need to populate my template with an interface ? Moreover Would you create a specific package per vendor interface implementation ? cisco-interface, juniper-interface and so on...
Thanks again !
Jerems
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide