- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2019 04:51 AM - edited 03-01-2019 04:15 AM
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
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2019 08:13 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2019 08:02 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2019 08:13 AM
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.
