cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
763
Views
0
Helpful
0
Replies

DNA-C Config push using REST API and Template Runner

rasithug
Cisco Employee
Cisco Employee

HI All ,

 

I’m trying to do config push using DNA-C , we have local  DNA-C instance

 

Please verify below steps and confirm what went wrong

 

Request 1 : ( getting project details)

 

https://10.126.78.99:443/api/v1/template-programmer/project

 

[

    {

        "name": "CustomTemplate",

        "id": "12380ce9-54fa-42ba-bcec-8d672868d311",

        "templates": [

            {

                "name": "DNA-Template",

                "composite": false,

                "id": "e14dccff-1cfe-4707-a88f-ed311bd1f01d"

            },

            {

                "name": "TestTemplate",

                "composite": false,

                "id": "d5777a20-1459-42b6-a6d8-70726383ebc4"

            }

        ]

    },

    {

        "name": "avinash",

        "id": "8f054592-25ad-4a1d-9363-047649fe899d",

        "templates": [

            {

                "name": "Regular_template",

                "composite": false,

                "id": "358c44e3-6401-4095-a26c-b2762f93f56b"

            },

            {

                "name": "IOS",

                "composite": false,

                "id": "8a2d5f8b-1466-41c3-9406-c984b3d983af"

            }

        ]

    }

]

 

Request 2: ( Getting version IDs)

 

https://10.126.78.99:443/api/v1/template-programmer/template/version/d5777a20-1459-42b6-a6d8-70726383ebc4

 

[

    {

        "name": "TestTemplate",

        "projectName": "CustomTemplate",

        "projectId": "12380ce9-54fa-42ba-bcec-8d672868d311",

        "templateId": "d5777a20-1459-42b6-a6d8-70726383ebc4",

        "versionsInfo": [

            {

                "id": "d5777a20-1459-42b6-a6d8-70726383ebc4",

                "description": "change host name",

                "versionTime": 0

            },

            {

                "id": "dc9b1f62-ec6b-4a24-9dab-89cb6a2fe979",

                "description": "change host name",

                "author": "admin",

                "version": "1",

                "versionComment": "commit",

                "versionTime": 1538073546822

            }

        ],

        "composite": false

    }

]

 

 

Request 3 : Template ID details

 

https://10.126.78.99:443/api/v1/template-programmer/template/dc9b1f62-ec6b-4a24-9dab-89cb6a2fe979

 

{

    "name": "TestTemplate",

    "description": "change host name",

    "tags": [],

    "author": "admin",

    "deviceTypes": [

        {

            "productFamily": "Switches and Hubs"

        }

    ],

    "softwareType": "IOS",

    "softwareVersion": "15.2(4)E5",

    "templateContent": "hostname $hostname",

    "rollbackTemplateContent": "",

    "templateParams": [

        {

            "parameterName": "hostname",

            "dataType": null,

            "defaultValue": null,

            "description": null,

            "required": true,

            "notParam": false,

            "displayName": null,

            "instructionText": null,

            "group": null,

            "order": 1,

            "selection": null,

            "range": [],

            "key": null,

            "provider": null,

            "binding": "",

            "id": "c4533d94-c424-4093-b92e-49a5c3c20575"

        }

    ],

    "rollbackTemplateParams": [],

    "composite": false,

    "containingTemplates": [],

    "id": "dc9b1f62-ec6b-4a24-9dab-89cb6a2fe979",

    "createTime": 1538073362414,

    "lastUpdateTime": 1538073479833,

    "parentTemplateId": "d5777a20-1459-42b6-a6d8-70726383ebc4"

}

 

 

Request 4 :

 

https://10.126.78.99:443/api/v1/template-programmer/template/deploy

 

deploy with below body

 

 

{

  "targetInfo": [

    {

      "hostName": "IOS:prk:banglore27091818",

      "id": "dc9b1f62-ec6b-4a24-9dab-89cb6a2fe979",

      "params": {"hostname":"newHostname"},

      "type": "MANAGED_DEVICE_HOSTNAME"

    }

  ],

  "templateId": "d5777a20-1459-42b6-a6d8-70726383ebc4"

}

 

 

I am getting below error :

 

 

{

    "response": {

        "errorCode": "UNEXPECTED_ERROR",

        "message": "Cannot provision unversioned template. Provide a versioned template identifier.",

        "detail": "An error occurred while invoking a REST API",

        "href": ""

    },

    "version": "1.0"

}

 

 

0 Replies 0
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: