cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2181
Views
3
Helpful
4
Replies

PnP using Python to create rule unable to select image

aevans
Level 1
Level 1

Hi All,

I am currently working on automating the configuration creation and configuring APIC-EM PnP through the API's. I have found some very helpful stuff on here but I'm struggling to specify the image in the rule creation. I should add I'm very new to all this I only started with python a few days ago.

Has anybody managed to specify this yet and if so could you possibly share how you have called the API.

I have tried using the "imageName", "imageVersion" & "imageId" When I execute my script with "imageId" set it fails to create the rule. I think this may be trying to find the image locally and upload it. I am not after, what I want is to reference the image already uploaded in APIC-EM. If I use the other two it configures the rule but doesn't show the image in the rule.

below is the output from the script

    "platformId": "WS-C2960X-48FPD-L",

    "hostName": "GB-N-RLH-SWA-02",

    "imageId": "c2960x-universalk9-mz.152-2.E5.bin",

    "pkiEnabled": true,

    "configId": "60ebfe3c-4ecf-456a-9b16-5c8f99f5f789",

    "serialNumber": "22345673276",

    "imageVersion": "c2960x-universalk9-mz.152-2.E5.bin"

  }

]

Waiting for Task 75e12e6d-5da8-4348-b88b-24c91886ed50

Task=75e12e6d-5da8-4348-b88b-24c91886ed50 has not completed yet. Sleeping 2 seconds...

{

  "progress": "Site Device (Rule) Creation Failed",

  "failureReason": "Failed to get the file",

  "startTime": 1481820555925,

  "errorCode": "InternalError",

  "rootId": "75e12e6d-5da8-4348-b88b-24c91886ed50",

  "version": 1481820555925,

  "id": "75e12e6d-5da8-4348-b88b-24c91886ed50",

  "serviceType": "Ztd Service",

  "isError": true,

  "endTime": 1481820555977

}

Any help appreciated

Ant

1 Accepted Solution

Accepted Solutions

aradford
Cisco Employee
Cisco Employee

Hi Anthony,

one of the fundamental principles is to reference objects by ID, not by name.  The IOS image needs to be referenced by is UUID (universally unique identifier), not by name.

You see UUID used everywhere in the example above...

your configId has a UUID of "60ebfe3c-4ecf-456a-9b16-5c8f99f5f789"

your task has a UUID of "75e12e6d-5da8-4348-b88b-24c91886ed50"

All you need to do is look up the image file, and get it's UUID and put that as the value.

Adam

View solution in original post

4 Replies 4

aradford
Cisco Employee
Cisco Employee

Hi Anthony,

one of the fundamental principles is to reference objects by ID, not by name.  The IOS image needs to be referenced by is UUID (universally unique identifier), not by name.

You see UUID used everywhere in the example above...

your configId has a UUID of "60ebfe3c-4ecf-456a-9b16-5c8f99f5f789"

your task has a UUID of "75e12e6d-5da8-4348-b88b-24c91886ed50"

All you need to do is look up the image file, and get it's UUID and put that as the value.

Adam

Hi Adam,

Thanks for the pointer. I have now modified my list config script to point to images and it works great.

Thanks

Ant

Great news.  Let us know if you have more questions.

Will do.

I would like to say a huge thank you to you for your blogs on PnP it's really helped me with the 1st iteration of what I want to achieve.

Cheers

Ant