Closed Abhishek-121 closed 4 months ago
Hello @Abhishek-121, it was a bug, currently our sdk supports custom headers for the request, what happens is that here there is a headers field, causing this error because both had the same name. Upload a new version 2.9.1, try with that and tell me if it worked or not.
Hi @bvargasre , with the new sdk version 2.9.1. I am able to execute the playbook with headers but the problem is headers are still not reflected in the DNAC GUI as a result the problem still exists to add/update headers while configuring webhook destination.
Hi @Abhishek-121, could you activate the debug in ansible with dnac_debug: True or export DNAC_DEBUG=True and send me the whole output Also to clarify headers is a list
Also, from user we taking input as headers as dict only but in our module code before invoking 'add_webhook_destination' API in the payload we convert headers --> customHeaders.
You can check the payload by filtering the given string - " Payload for creating webhook destination"
Hi @Abhishek-121 , in the log you sent me I don't see debug enabled. What I need is that you activate the debug to be able to observe the api calls. The debug in ansible can be activated in two ways:
export DNAC_DEBUG=True
tasks:
With this you should notice that in the logs will appear the calls to the Catalys lab api.
Finally if you can pass me the output of those logs together with the playbook used for the test, so I can check the behavior and detect if the problem is the playbook or ansible or sdk. The same would be for issue #151. I remain available for any further assistance.
Hi @bvargasre , able to add headers via Ansible and it appear on the GUI as well. Instead of customHeader I need to pass payload in the headers parameters as a list only. You can close the issue. Thanks.
Prerequisites
Describe the bug While working on adding headers during the creation/updation of Webhook Destination, I observed that in the DNAC --> Platform --> Developer Toolkit.
API's - Create Rest Webhook Destination/ Update Rest Webhook Destination are accepting headers as a list of dictionary in the payload and able to create/update with mentioned payload.
Dnacentersdk version - 2.9.0, API Used - '/dna/intent/api/v1/event/webhook'
But when I try same by giving the input payload in the playbook as list of dictionary using the below playbook
I got this error -
"msg": "Error while Adding the Webhook destination with the name 'webhook Iac2' in Cisco Catalyst Center: We were expecting to receive an instance of one of the following types: 'dict'or 'None'; but instead we received [{'name': 'X-Auth-Token', 'value': 'qejfkq;ejwf;kqjrfkjewqkfjdekwlqjfdklqwe;j', 'defaultValue': None, 'encrypt': None}] which is a 'list'.",
And also when I try to change by passing headers as a dictionary instead of list of dictionary using the below input in playbook -
I got this error -
"errors": ["Create WebhookConfig failed due to Parsing WebhookConfig failed Cannot deserialize instance of
java.util.ArrayList<com.cisco.dna.event.common.models.flow.Parameter>
out of START_OBJECT token\n at [Source: (String)\"{\"name\": \"webhook Iac2\", \"description\": \"webhhok description for iac2.0\", \"url\": [https://10.195.227.14/dna\](https://10.195.227.14/dna/), \"method\": \"POST\", \"trustCert\": false, \"headers\": {\"name\": \"X-Auth-Token\", \"value\": \"qejfkq;ejwf;kqjrfkjewqkfjdekwlqjfdklqwe;j\", \"default_value\": null, \"encrypt\": null}, \"isProxyRoute\": true}\"; line: 1, column: 160] (through reference chain: com.cisco.dna.event.common.models.event.artifact.WebhookConfig[\"headers\"])"]Upon looking more into the Dnacentersdk version - 2.9.0, I got to know that there is ambiguity in both Create/Update Webhook Destination as there in arguments it's mentioned that headers can be list of dictionaries or it can be dictionary only.
Also in the Args description of both SDK API we are supporting both types that is headers as dict and headers as list.
Expected behavior
As per the Cisco Catalyst GUI we can add only one type of header and if we are try to add other it will give the error -
Screenshots
Environment (please complete the following information):