cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
998
Views
14
Helpful
7
Replies

Unable to update QOS policy via API

mbrainar
Cisco Employee
Cisco Employee

I am trying to use the API to affect a policy change to a QOS policy. Every time I try, I get the following response:

{

  "response": {

    "startTime": 1471831412988,

    "endTime": 1471831413121,

    "progress": "Apply Policy Version Diff Failed",

    "version": 1471831413121,

    "errorCode": "BadRequest",

    "serviceType": "Policy Service",

    "operationIdList": [

      "90523c17-e13a-429f-97aa-290639e25178"

    ],

    "isError": true,

    "failureReason": "Invalid Policy",

    "rootId": "eeef89e1-3cf8-4d7b-b13d-b2c51ecc437f",

    "id": "eeef89e1-3cf8-4d7b-b13d-b2c51ecc437f"

  },

  "version": "1.0"

}

I have tried it using both (PUT) /api/v1/policy and (POST) /api/v1/policy/diff. Neither seem to work.

Anyone have any ideas?

7 Replies 7

yawming
Cisco Employee
Cisco Employee

Can you please share your JSON input ?

my input to policy/diff looks like:

{

  "policies": [

    {

      "policy": {

        "policyScope": "ed-qos",

        "resource": {

          "applicationDiffs": [

            {

              "operation": "DELETE",

              "policyApplication": {

                "id": "3db738bd-a01a-4d6a-8bad-c23b39c78c23",

                "appName": "facebook"

              }

            }

          ]

        },

        "id": "d36e817e-7dbf-4f0c-8217-a23e86ccfecd",

        "state": "Active",

        "instanceUuid": "d36e817e-7dbf-4f0c-8217-a23e86ccfecd",

        "policyName": "default",

        "taskId": "8c2f2989-92a7-4643-8492-d098ad640273",

        "actionProperty": {

          "relevanceLevel": "Business-Irrelevant",

          "pathControlFlag": false,

          "pathPreferenceFlag": false,

          "priorityLevel": "0",

          "experienceLevel": "experiencelevel",

          "pathPreference": "pathpreference",

          "trustLevel": "trustlevel"

        },

        "policyPriority": 0,

        "actions": [

          "SET_PROPERTY"

        ],

        "policyOwner": "admin"

      },

      "operation": "UPDATE"

    }

  ]

}

I am using the DevNet sandbox APIC for testing, so feel free to try it out and see if you get the same error.

To be honest I still not quite sure about the usage of "

/policy/diff"

But I was able to manage the right JSON for that


{

  "response": {

    "startTime": 1471903345551,

    "endTime": 1471903345840,

    "progress": "Policy version diff applied successfully",

    "version": 1471903345551,

    "serviceType": "Policy Service",

    "operationIdList": [

      "410b5745-2544-4666-838f-ec5a0834a83a"

    ],

    "isError": false,

    "rootId": "276b1083-a582-4773-9b15-f8255ea6f91d",

    "id": "276b1083-a582-4773-9b15-f8255ea6f91d"

  },

  "version": "1.0"

}

JSON for POST /policy/diff:

{

    "id": "83c70179-719c-4ce3-af6b-68ff61efcffc",

    "policies": [

      {

        "operation": "UPDATE",

        "policy": {

          "instanceUuid": "35646f3a-f84a-4766-8569-c9a79ac1d500",

          "policyName": "Dev_policy-D",

          "policyOwner": "devnetuser",

          "policyPriority": 4095,

          "state": "Active",

          "taskId": "f5204a21-4401-4da8-91ca-90549fe3eb26",

          "id": "35646f3a-f84a-4766-8569-c9a79ac1d500",

          "resource": {

            "applicationDiffs": [

              {

                "operation": "UPDATE",

                "policyApplication": {

                  "appName": "disney",

                  "id": "64ae9f46-ea00-459d-9bd7-c449ac42971f"

                }

              }

            ]

          },

          "actions": [

            "SET_PROPERTY"

          ],

          "policyScope": "DevNet",

          "actionProperty": {

            "relevanceLevel": "Default",

            "pathControlFlag": false,

            "pathPreferenceFlag": false

          }

        }

      }

    ]

  }

I just toggle  between appName and it's id and I can see the app name changed when I query get /policy API.

              "appName": "dev_app",
              "id": "e5e4bedb-4ad1-424c-ba8c-f9fe65029bf7"

Here is the input from SME:

If the intention to update a policy, the customer can perform a PUT on Policy.

The policy/diff API is useful to compare the difference between two versions of a Policy. The policy/diff API also returns an id, which is helpful if someone wants to rollback to an older version of the Policy.

I tried that as well, with no success, that is when I started looking into the policy/diff API. Perhaps I should clarify my end goal: I am trying to take one application and move it from business-irrelevant to business-relevant.

When I do a PUT to /policy, I get an error as well.

{

  "response": {

    "startTime": 1471909537625,

    "endTime": 1471909537726,

    "progress": "Policy Update Failed",

    "version": 1471909537625,

    "errorCode": "ResourceConflict",

    "serviceType": "Policy Service",

    "operationIdList": [

      "e8ca35e3-bde2-47a8-9ff3-adb5eb555631"

    ],

    "isError": true,

    "failureReason": "Policy Conflict",

    "rootId": "c4eadd93-a27e-475a-85be-601a38095728",

    "id": "c4eadd93-a27e-475a-85be-601a38095728"

  },

  "version": "1.0"

}

JSON input as follows:

[

  {

    "policyScope": "ed-qos",

    "resource": {

      "applications": [

        {

          "id": "3db738bd-a01a-4d6a-8bad-c23b39c78c23",

          "appName": "facebook"

        }

      ]

    },

    "id": "2c461559-63b6-47c8-a0de-a78a2e12f17a",

    "state": "Active",

    "instanceUuid": "2c461559-63b6-47c8-a0de-a78a2e12f17a",

    "policyName": "default",

    "taskId": "85d280f1-502a-4c14-a224-aa08abf4db06",

    "actionProperty": {

      "relevanceLevel": "Business-Relevant",

      "pathControlFlag": false,

      "pathPreferenceFlag": false

    },

    "policyPriority": 0,

    "actions": [

      "SET_PROPERTY"

    ],

    "policyOwner": "devnetuser"

  }

]

"I am trying to take one application and move it from business-irrelevant to business-relevant."

I feel like we can use PUT, will try out and let you know.

Ok, if you were using PUT and didn't us [ and ] you will get error

I just GET policy Dev_policy-D with it's ID. Use the response I change   "relevanceLevel" attribute from "default" to  "Business-Relevant" and do the PUT. Check task, no error, GET policy "Dev_policy-D" again, the attributed is changed to "Business-Relevant".

[{

    "instanceUuid": "35646f3a-f84a-4766-8569-c9a79ac1d500",

    "policyName": "Dev_policy-D",

    "policyOwner": "devnetuser",

    "policyPriority": 4095,

    "state": "Active",

    "taskId": "276b1083-a582-4773-9b15-f8255ea6f91d",

    "id": "35646f3a-f84a-4766-8569-c9a79ac1d500",

    "resource": {

      "applications": [

        {

          "appName": "disney",

          "id": "64ae9f46-ea00-459d-9bd7-c449ac42971f"

        }

      ]

    },

    "actions": [

      "SET_PROPERTY"

    ],

    "policyScope": "DevNet",

    "actionProperty": {

      "relevanceLevel": "Business-Relevant",

      "pathControlFlag": false,

      "pathPreferenceFlag": false

    }

  }]

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:


This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community