- using Sandbox version 1.2 and developing a demo app that uses the APIC-EM api. It works fine if used to POST a policy and update it (for example the Business Irrelevant part of the policy). It still works if used POST another policy (for example, the Business Relevant part of the policy) and update. But if you switch back to the first policy and try to update it, it doesn't work anymore.
- The code should work, it doesn't have a problem.
- Trying to use the APIC-EM and its API to update a policy, getting the error "BadRequest", with failureReason "Invalid Policy". The body in the PUT request is the following json:
[
{
"instanceUuid":"a298dfd7-1a21-4ab5-a223-df415906a681",
"policyName":"Test-Policy-1_BR",
"policyOwner":"devnetuser",
"policyPriority":4095,
"state":"Active",
"taskId":"f3a40f1d-a675-4cb8-acec-41b0625ac161",
"id":"96348dc5-a760-4ce3-9ee8-28b349ba6618",
"resource":{
"applications":[
{
"appName":"ptp",
"id":"0661d06e-99ad-41b6-93e0-e36ff02029af"
},
{
"appName":"twitch-tv",
"id":"019d6ce9-8e40-401c-9b11-14483d7d5f7d"
},
{
"appName":"distcc",
"id":"01b823bd-9a18-4891-8eed-8d40c2016abe"
},
{
"appName":"directv-soft",
"id":"012ac649-a306-4c0c-9098-da00bc91d510"
},
{
"appName":"windows-store",
"id":"00d2d0d4-1b31-43ff-845e-f4f1f0fd7b07"
}
]
},
"actions":[
"SET_PROPERTY"
],
"policyScope":"Test-Policy-1",
"actionProperty":{
"relevanceLevel":"Business-Rrelevant",
"pathControlFlag":false,
"pathPreferenceFlag":false
}
}
]
The json is getting as processing the task is this one:
{
"response":{
"startTime":1465576395397,
"endTime":1465576395403,
"progress":"Policy Update Failed",
"version":1465576395397,
"errorCode":"BadRequest",
"serviceType":"Policy Service",
"operationIdList":[
"669ea643-04ad-478e-abe9-322dc775e872"
],
"isError":true,
"failureReason":"Invalid Policy",
"rootId":"30e589a3-613c-4184-a681-6378cd201de0",
"id":"30e589a3-613c-4184-a681-6378cd201de0"
},
"version":"1.0"
}
Also, while trying to update a policy with this body:
[
{
"instanceUuid":"a298dfd7-1a21-4ab5-a223-df415906a681",
"policyName":"Test-Policy-1_IR",
"policyOwner":"devnetuser",
"policyPriority":4095,
"state":"Active",
"taskId":"9f3f7ece-10e8-4e9b-9476-c96b8280d343",
"id":"a298dfd7-1a21-4ab5-a223-df415906a681",
"resource":{
"applications":[
{
"appName":"wordreference-com",
"id":"218c7242-9455-42b8-aaf9-5e65f7a322ca"
},
{
"appName":"smakynet",
"id":"04fa6934-6e42-496a-93e6-1f5e4ccb464d"
}
]
},
"actions":[
"SET_PROPERTY"
],
"policyScope":"Test-Policy-1",
"actionProperty":{
"relevanceLevel":"Business-Irrelevant",
"pathControlFlag":false,
"pathPreferenceFlag":false
}
}
]
getting the following response:
{
"response":{
"startTime":1465577653334,
"endTime":1465577653415,
"progress":"Policy Update Failed",
"version":1465577653334,
"errorCode":"ResourceConflict",
"serviceType":"Policy Service",
"operationIdList":[
"360966c9-0306-47b9-94c8-7972e39f13e0"
],
"isError":true,
"failureReason":"Policy Conflict",
"rootId":"9eadc2d0-0eaf-4da0-92a6-71f86110ee20",
"id":"9eadc2d0-0eaf-4da0-92a6-71f86110ee20"
},
"version":"1.0"
}, having errorCode "ResourceConflict" and failureReason "Policy Conflict".
Trying to update the policy from the Cisco DevNet Sandbox.
- POST policy has no error tight .
- Always On Lab is using Data Base, not really connect to live network right ? So we can create a policy but cannot really activate the policy.
Want to demonstrate how you can create and update policies. The following is the POST json:
[
{
"policyName":"Test-Policy_D",
"policyOwner":"devnetuser",
"policyPriority":4095,
"resource":{
"applications":[
{
"appName":"avian",
"id":"05bafa0b-63ab-4a73-9a95-0a12cf9156cd"
}
]
},
"actions":[
"SET_PROPERTY"
],
"policyScope":"Test-Policy",
"actionProperty":{
"relevanceLevel":"Default"
}
}
]
Use get policy and select "Test-Policy" from existing policy to modify the response from "GET policy"
{
"instanceUuid": "1321f81e-acda-4830-8882-f434ace91231",
"policyPriority": 4095,
"policyName": "Test-Policy_BR",
"actionProperty": {
"pathPreferenceFlag": false,
"relevanceLevel": "Business-Relevant",
"pathControlFlag": false
},
"actions": [
"SET_PROPERTY"
],
"state": "Active",
"policyScope": "Test-Policy",
"taskId": "47b1e3e9-4b6e-423a-b007-3230b5f8a36d",
"id": "1321f81e-acda-4830-8882-f434ace91231",
"policyOwner": "devnetuser",
"resource": {
"applications": [
{
"appName": "twitch-tv",
"id": "019d6ce9-8e40-401c-9b11-14483d7d5f7d"
},
{
"appName": "sntp-heartbeat",
"id": "02d81471-2c4f-497d-b000-f6ae3e32c96f"
}
]
}
}
change "policyPriority": 4095 to "policyPriority": 4099 so JSON will be as below..
[{
"id": "1321f81e-acda-4830-8882-f434ace91231",
"policyPriority": 4999,
"policyName": "Test-Policy_BR",
"actionProperty": {
"relevanceLevel": "Business-Relevant",
},
"actions": [
"SET_PROPERTY"
],
"state": "Active",
"policyScope": "Test-Policy",
"policyOwner": "devnetuser",
"resource": {
"applications": [
{
"appName": "twitch-tv",
"id": "019d6ce9-8e40-401c-9b11-14483d7d5f7d"
},
{
"appName": "sntp-heartbeat",
"id": "02d81471-2c4f-497d-b000-f6ae3e32c96f"
}
]
}
}]
Here is the result of PUT task, no error.
{ |
"response": {
"startTime": 1465930102747, | |
"endTime": 1465930102955, | |
"version": 1465930102747, | |
"serviceType": "Policy Service", | |
"operationIdList": [ | |
"49a4da31-3649-4746-95e7-19f583a21656" | |
], | |
"isError": false, | |
"rootId": "632eefa4-7754-43ad-be94-b7bb97c647cb", | |
"id": "632eefa4-7754-43ad-be94-b7bb97c647cb" |
},
"version": "1.0"
}
Do the GET policy again. From the response we can see the policyPriority changed to 4999
{
"actions": [
"SET_PROPERTY"
],
"state": "Active",
"policyOwner": "devnetuser",
"resource": {
"applications": [
{
"appName": "twitch-tv",
"id": "019d6ce9-8e40-401c-9b11-14483d7d5f7d"
},
{
"appName": "sntp-heartbeat",
"id": "02d81471-2c4f-497d-b000-f6ae3e32c96f"
}
]
},
"instanceUuid": "1321f81e-acda-4830-8882-f434ace91231",
"taskId": "632eefa4-7754-43ad-be94-b7bb97c647cb",
"actionProperty": {
"relevanceLevel": "Business-Relevant",
"pathPreferenceFlag": false,
"pathControlFlag": false
},
"id": "1321f81e-acda-4830-8882-f434ace91231",
"policyName": "Test-Policy_BR",
"policyPriority": 4999,
"policyScope": "Test-Policy"
}
Policy Conflict may due to duplicate of policy name or something else. I think "Invalid Policy" is a little bit more difficult to find the reason.
Comments
0 comments
Please sign in to leave a comment.