cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
417
Views
0
Helpful
1
Replies

JINJA - monitor session configuration

peter.lazok
Level 1
Level 1

Hello,

is it possible to build jinja variable in DNA-C for erspan monitoring configuraiton?

name internal_erspan
monitor session 12 type erspan-source
source interface Gi1/0/6 - 7 , Gi1/0/13 , Gi1/0/20 , Gi1/0/27 , Gi1/0/29 , Gi1/0/31 , Gi1/0/34 , Gi1/0/36 , Gi1/0/39 - 48
destination
erspan-id 2
mtu 9000
ip address X.X.X.X
origin ip address X.X.X.Y

I have tried to do something like:

monitor session {{ session_id }} type erspan-source
source interface {{ test_interface }} both # where interface has been binded to source as portName with option to select multiple options
destination
erspan-id 2
mtu 9000
ip address X.X.X.X
origin ip address X.X.X.Y

but I got an output: 

source interface [GigabitEthernet1/0/13, GigabitEthernet1/0/12, GigabitEthernet1/0/17, GigabitEthernet1/0/9, GigabitEthernet1/0/15, GigabitEthernet1/0/2, GigabitEthernet1/0/10, GigabitEthernet1/0/3, GigabitEthernet1/0/4, GigabitEthernet1/0/14, GigabitEthernet1/0/8, GigabitEthernet1/0/11, GigabitEthernet1/0/16, GigabitEthernet1/0/5, GigabitEthernet1/0/7, GigabitEthernet1/0/6] both

As is visible from output above, there are characters "[" and "]" and it is not consumed by switch of course.

I tried to remove it using:

source interface {{ test_interface|replace('[','')|replace(']','') }} both
or 
source interface {{ test_interface|regex_replace('\[|\]','') }} both
or
source interface {{ test_interface.replace('[','').replace(']','').split(', ')|join(', ') }} both
or
source interface {{ test_interface.split(', ')|map('regex_replace', '\[|\]','')|join(', ') }} both
None from above worked, there is an issue with Syntax error.
Would someone provide piece of advice how to solve my problem, please?
 
Thank you,
Peter
1 Reply 1

Nikolas Lymperis
Cisco Employee
Cisco Employee

Hello Peter,

Yes it's possible to apply erspan monitoring configuraiton using jinja.

You can do this by using network templates as you already did. After replicating your configuration, it seems that the issue comes from the "source interface" command. More specifically, try to run it again without using "-" for interface range. You can include all the desired interfaces by separating them with commas. 

After that, you provision the device and the configuration will be pushed.

If you find my reply solved your question or issue, kindly click the 'Accept as Solution' button and vote it as helpful.

You can also learn more about Cisco DNA Center through our live Ask the Experts (ATXs) session. Check out Cisco DNA Center ATXs Resources [https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-ask-the-experts-resources/ta-p/4394489] to view the latest schedule for upcoming sessions, as well as the useful references, e.g. online guides, FAQs.

Kind Regards,

Nikolas

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card