cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
868
Views
2
Helpful
7
Replies

updating tunnel variable in device template throwing 405 error

nitinkdas
Level 1
Level 1

Legends,

I am trying to update the tunnel variable (vpnx_tunnel_dest_ip_peer01) using rest api PUT call with below end point, playload and PUT call -
/dataservice/template/device/{template_id} 

template_data = {
"templateId": "templateID",
"name": "templateName",
"description": "Testing the PUT method to update variable.",
"variables": {
"vpnx_tunnel_dest_ip_peer01": "11.0.1.101"
}
}

response = requests.put(url, headers=header,data=json.dumps(payload), verify= False)

i am getting below error :

requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://{vmangeURL}:{port}/ dataservice/template/device/config/attached/{templateID}

Please help in getting correct endpoint to fix this. Need to automate the edit device template using API.

Thanks

 

 

 

1 Accepted Solution

Accepted Solutions

Try this one, looks like they have moved all docs to developer now https://developer.cisco.com/docs/sdwan/device-template/

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

7 Replies 7

Would check that endpoint is correct, as the error suggest this is not correct?

The process is described on: https://sdwan-docs.cisco.com/Product_Documentation/Command_Reference/vManage_REST_APIs/Device_Configuration_APIs/Device_Templates#Attach_Device_Templates

1. Generate Device Input Variables: https://vmanage-ip-address/dataservice/template/device/config/input
2. Preview Device Configuration with variables filled: https://vmanage-ip-address/dataservice/template/device/config/config
3. Attach Device Template: https://vmanage-ip-address/dataservice/template/device/config/attachcli or https://vmanage-ip-address/dataservice/template/device/config/attachfeature
4. Monitor attach action: https://vmanage-ip-address/dataservice/device/action/status/{attachID}

You can always capture the process and body in Chrome developer tools by doing this via the UI, this will document the process and show you the API call, body etc..

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Try this one, looks like they have moved all docs to developer now https://developer.cisco.com/docs/sdwan/device-template/

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

@bigevilbeard Thanks for help, but now i am getting different , in attach template post method , below is my payload

"deviceTemplateList":[
{
"templateId":"{deviceID}",
"device":[
{
"csv-status":"complete",
"csv-deviceId":"{deviceID}",
"csv-deviceIP":"1.2.3.4",
"csv-host-name":"hostname02",
"//system/host-name":"hostname02",
"//system/system-ip":"1.2.3.4",
"//system/site-id":"1000",
"csv-templateId":"{templateID}",
"selected":"true",
"/2/vpnx_ipsec_intf01_num/interface/tunnel-destination":"1.2.3.4",
"//virtual-applications/virtual-application/te/te-mgmt-ip": "1.2.3.4/30",
"//virtual-applications/virtual-application/te/te-vpg-ip":"1.2.3.4",
"//virtual-applications/virtual-application/te/name-server":"1.2.3.4",
"//virtual-applications/virtual-application/te/hostname":"hostname",
"/0/vpn-instance/ip/route/0.0.0.0/0/next-hop/vpn0_default_next_hop01/address":"1.2.3.4",
"deviceModel":"model"
}
],

 

Failed to update configuration - com.viptela.vmanage.server.deviceconfig.template.TemplateException: com.viptela.vmanage.server.deviceconfig.template.TemplateException: java.lang.NullPointerException"

I think this error means the API is expecting a value that is either missing or incorrectly formatted in your request. I am guessing here as it has been sometime, but are you missing the two fields?

 "isEdited": false,
"isMasterEdited": false
{
    "deviceTemplateList":[
    {
        "templateId":"72babaf2-68b6-4176-92d5-fa8de58e19d8",
        "device":[
        {
            "csv-status":"complete",
            "csv-deviceId":"0C8419",
            "csv-deviceIP":"4.4.4.60",
            "csv-host-name":"BR1-CEDGE1",
            "//system/host-name":"BR1-CEDGE1",
            "//system/system-ip":"4.4.4.60",
            "//system/site-id":"200",
            "csv-templateId":"72babaf2-68b6-4176-92d5-fa8de58e19d8",
            "selected":"true"
        }
        ],
        "isEdited":false,
        "isMasterEdited":false
    }
    ]
}

This repo was written by the former TME for SD-WAN https://github.com/suchandanreddy/sdwan-apis/blob/master/configuration-apis.md#attach-device-template and has lots of examples, which i compared your payload too.

Might be the issue.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hey Appologies , i forgot to paste these 2 parameters, i have those 2 parameters in my payload. then also i am getting nullpointer exception .

nitinkdas
Level 1
Level 1

After Post call i do get sample response as : {"id":"push_file_template_configuration-70acb6c7-a589-4a10-be93-27620c46dae5"}.
Now when i run GET call with Push ID : https://vmanage-ip:port/dataservice/device/action/status/push-template-id
There i am getting below error -
Failed to update configuration - com.viptela.vmanage.server.deviceconfig.template.TemplateException: com.viptela.vmanage.server.deviceconfig.template.TemplateException: java.lang.NullPointerException"