cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
829
Views
0
Helpful
2
Replies

python services that has many device with unique data for each device in on services instance

Hi all,

we are building a service for deploying a VRF across the entire network in one go.
the VRF services instance will be applied to many devices and many device types, the template has sections for IOS, XR and NX

the issue we are having is that we are using the router id of each devices to build the RD for the VRF, we pull the asn and the router id from the CDB then send that back in to the template, how ever when we do this for multiple devices the python code only get executed the once then that data is used for all deivce, how can this be set the the python code runs for every device ?

Thanks
Regards
Yale

1 Accepted Solution

Accepted Solutions

The big question is this: Where is your loop?

If you have multiple devices, where is your looping construct? Python or in the template? And where do you pull out the data that you need to be per device? That has to happen inside the loop.

View solution in original post

2 Replies 2

we have tried changing 

template = ncs.template.Template(service)
template.apply('vrf-template', vars)

 

to 

template = ncs.template.Template(device)
# Make the config Active
template.apply('vrf-template', vars)

 

which seems to work, the python code is run per device, and the services is saved inthe CBD, but no config gets pushed to the device ....

 

are we looking in the right area ??

 

Thanks

Regards

Yale

The big question is this: Where is your loop?

If you have multiple devices, where is your looping construct? Python or in the template? And where do you pull out the data that you need to be per device? That has to happen inside the loop.