I'm attempting to follow this in a lab environment. DNA 2.2.3.5
Cisco DNA Center Network Automation with Template Programmer API – Part 1 - Cisco Blogs
I have python 3.10 and the dna api installed and can see all my templates in DNA center.
As per the example I have created this simple velocity template:
interface ${interface}
switchport access vlan ${vlan}
However when attempting to run the following with Python 3.10:
python template.py --template Testing/TEST --device 192.168.1.10 --params '{"vlan":"120","interface":"gig1/0/1"}'
I get the following error:
Executing template on:192.168.1.10, with Params:'{vlan:10,interface:gig1/0/1}'
Traceback (most recent call last):
File "D:\Templates\template.py", line 244, in <module>
response = execute(id, params, bindings, args.device, inputParams, args.force)
File "D:\Templates\template.py", line 62, in execute
"params": json.loads(params)
File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Can anyone help with this one? Is it the velocity template? Or is it the syntax of the command? Is it Python version? Or DNA?
Thanks