Closed Abhishek-121 closed 4 months ago
Hi @Abhishek-121 same here, activate the debug and send me all the output I tried with the payload that you passed and it did not give me an error.
payload = [
{
"name": "Syslog playbook demo",
"subscriptionEndpoints": [
{
"instanceId": "fc0e6daa-2b15-4ee5-b509-e3268b43d497",
"subscriptionDetails": {
"connectorType": "SYSLOG"
}
}
],
"filter": {
"eventIds": [
"NETWORK-DEVICES-3-107",
"NETWORK-DEVICES-3-105"
],
"siteIds": [
"bf561bf3-95d6-4da1-bf49-26887955fa2e",
"69f31d51-9e0d-48f4-8546-4935253f9a67"
]
}
}
]
try:
response = dnac.event_management.create_syslog_event_subscription(payload=payload)
print(response)
except Exception as e:
print("Error: ", e)
Attempt 1
Request
URL: https://{}/dna/intent/api/v1/event/subscription/syslog
Method: POST
Headers:
User-Agent: python-requests/2.27.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Auth-Token: eyJhbGciOiJSUzI1NiIsInR5cCI6Ik
Content-type: application/json;charset=utf-8
Params:
{}
Body:
[
{
"name": "Syslog playbook demo",
"subscriptionEndpoints": [
{
"instanceId": "fc0e6daa-2b15-4ee5-b509-e3268b43d497",
"subscriptionDetails": {
"connectorType": "SYSLOG"
}
}
],
"filter": {
"eventIds": [
"NETWORK-DEVICES-3-107",
"NETWORK-DEVICES-3-105"
],
"siteIds": [
"bf561bf3-95d6-4da1-bf49-26887955fa2e",
"69f31d51-9e0d-48f4-8546-4935253f9a67"
]
}
}
]
Response
Status: 202 - Accepted
Headers:
Content-Type: application/json
Content-Length: 88
Connection: keep-alive
Date: Thu, 09 May 2024 21:20:35 GMT
X-Correlation-Id: bbf3ebc3-d8dd-4a16-8a2e-ef0056a32620
Via: api-gateway
Cache-Control: no-store
Pragma: no-cache
Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:
X-Content-Type-Options: nosniff
X-XSS-Protection: 1
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
Body:
{
"statusUri": "/dna/intent/api/v1/event/api-status/ee997933-7d53-4465-b72c-b7db6804cb70"
}
{'statusUri': '/dna/intent/api/v1/event/api-status/ee997933-7d53-4465-b72c-b7db6804cb70'}
Hi @bvargasre, attaching log file for your reference for creating syslog event subscription.
You can check the payload by filtering the given string - "Requested payload for create_syslog_event_subscription"
Hi @bvargasre , this issue gets fixed as it required some changed in the payload while calling the sdk. We can close this issue.
Prerequisites
Describe the bug
While working on automation of creating the Syslog Event Notification using Ansible, I encountered an issue in the SDK API 'create_syslog_event_subscription' return response and using the same payload I am able to create the Syslog Notification in DNAC (Platform --> Developer Toolkit).
Dnacentersdk version - 2.9.1 API Used - ('/dna/intent/api/v1/event/subscription/syslog')
Payload passed to the 'create_syslog_event_subscription' API -
[ { "name": "Syslog playbook demo", "subscriptionEndpoints": [ { "instanceId": "fc0e6daa-2b15-4ee5-b509-e3268b43d497", "subscriptionDetails": { "connectorType": "SYSLOG" } } ], "filter": { "eventIds": [ "NETWORK-DEVICES-3-107", "NETWORK-DEVICES-3-105" ], "siteIds": [ "bf561bf3-95d6-4da1-bf49-26887955fa2e", "69f31d51-9e0d-48f4-8546-4935253f9a67" ] } } ]
With the above payload only I am able to create Syslog Notification Event using the API Create Syslog Event Subscription present in DNAC --> Platform --> Developer Tookit.
When I execute the playbook, I got this error from the API response -
Expected behavior As per the Cisco Catalyst GUI we can create Syslog Event Notification, so we are expecting the same using the Ansible by passing input in the playbook.
Screenshots
Environment (please complete the following information):
Additional context Add any other context about the problem here.