cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4622
Views
15
Helpful
4
Replies

vManage API log

rahendatri
Level 1
Level 1

Hello,

 

Does anybody know where to find vManage API log ? I try to do some API calls to create a template using API, but unfortunately I got an "internal server error" with an internal code like

{
  "error": {
    "message": "Server error",
    "details": "Unknown error",
    "code": "REST0001"
  }
}

Could anyone please help how to get more verbose information ?

 

 

2 Accepted Solutions

Accepted Solutions

Danny De Ridder
Cisco Employee
Cisco Employee

Hello,

 

you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.

 

Use command show log and one of the above path names and you will see the logs printed on screen.

 

Or go into vsh and look at the files using your favourite linux commands.

 

REST001 seems to be some uncaught exception. Maybe the above logs show more detail.

 

Regards,

 

Danny.

View solution in original post

Hello,

 

the closest example I could get for the json body is in jinja format used in Python.

One needs other calls to get all the feature template IDs so it it not that straightforward.

 

There are some good API examples on devnet.

 

https://developer.cisco.com/learning/modules/cisco_sd-wan_with_ansible

 

Regards,

 

Danny.

 

 

 

{
  "templateName": "{{item.keys()[0]}}",
  "templateDescription": "{{ item.values()[0].Template_Description }}",
  "deviceType": "{{ Type }}",
  "configType": "template",
  "factoryDefault": false,
  "policyId": "",
  "featureTemplateUidRange": [],
  "connectionPreferenceRequired": true,
  "connectionPreference": true,
  "generalTemplates": [
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_AAA]}}",
      "templateType": "aaa"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_BFD]}}",
      "templateType": "bfd-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_OMP]}}",
      "templateType": "omp-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_Security]}}",
      "templateType": "security-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_System]}}",
      "templateType": "system-vedge",
      "subTemplates": [
        {
          "templateId": "{{feature_template_db[item.values()[0].Feature_Logging]}}",
          "templateType": "logging"
        }
      ]
    },

{% for vpn in  item.values()[0].Feature_VPN  %}

    {
      "templateId": "{{feature_template_db[vpn]}}",
      "templateType": "vpn-vedge",
      "subTemplates": [

{% for subtemplate in  item.values()[0].Feature_VPN[vpn] %}

        {
          "templateId": "{{feature_template_db[subtemplate]}}",
          "templateType": "vpn-vedge-interface"
        },
{% endfor %}

      ]
    },

{% endfor %}

    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_Banner]}}",
      "templateType": "banner"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_SNMP]}}",
      "templateType": "snmp"
    }
  ]
}

 

View solution in original post

4 Replies 4

Danny De Ridder
Cisco Employee
Cisco Employee

Hello,

 

you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.

 

Use command show log and one of the above path names and you will see the logs printed on screen.

 

Or go into vsh and look at the files using your favourite linux commands.

 

REST001 seems to be some uncaught exception. Maybe the above logs show more detail.

 

Regards,

 

Danny.


@Danny De Ridder wrote:

Hello,

 

you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.

 

Use command show log and one of the above path names and you will see the logs printed on screen.

 

Or go into vsh and look at the files using your favourite linux commands.

 

REST001 seems to be some uncaught exception. Maybe the above logs show more detail.

 

Regards,

 

Danny.



Thank you for the information Danny. I did get some logs of the API, especially on /var/log/nms/vmanage-server.log where there is a java error stack displayed. However the error is java.lang.NullPointerException, which doesn't tell what did I do wrong. You can find the screenshot attached.

I tried to create a device template by posting on this API endpoint (/template/device/feature) with the following data :

{
"templateName":"testAPI_DeviceTemplate",
"configType":"template",
"deviceType" : "vedge-cloud",
"templateDescription" : "testAPI_DeviceTemplate",
"requiredTemplate" : [
"Factory_Default_vSmart_vManage_Security_Template"
]
}

 

I couldn't find any way to know what is the correct json object to put to the request body. Would there be some hints please?

Fyi. I tried to surf the documentation but nothing explained on how to create a device template via API.

Thank you for any help.

 

Regards,

 

Rahenda

 

 

Hello,

 

the closest example I could get for the json body is in jinja format used in Python.

One needs other calls to get all the feature template IDs so it it not that straightforward.

 

There are some good API examples on devnet.

 

https://developer.cisco.com/learning/modules/cisco_sd-wan_with_ansible

 

Regards,

 

Danny.

 

 

 

{
  "templateName": "{{item.keys()[0]}}",
  "templateDescription": "{{ item.values()[0].Template_Description }}",
  "deviceType": "{{ Type }}",
  "configType": "template",
  "factoryDefault": false,
  "policyId": "",
  "featureTemplateUidRange": [],
  "connectionPreferenceRequired": true,
  "connectionPreference": true,
  "generalTemplates": [
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_AAA]}}",
      "templateType": "aaa"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_BFD]}}",
      "templateType": "bfd-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_OMP]}}",
      "templateType": "omp-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_Security]}}",
      "templateType": "security-vedge"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_System]}}",
      "templateType": "system-vedge",
      "subTemplates": [
        {
          "templateId": "{{feature_template_db[item.values()[0].Feature_Logging]}}",
          "templateType": "logging"
        }
      ]
    },

{% for vpn in  item.values()[0].Feature_VPN  %}

    {
      "templateId": "{{feature_template_db[vpn]}}",
      "templateType": "vpn-vedge",
      "subTemplates": [

{% for subtemplate in  item.values()[0].Feature_VPN[vpn] %}

        {
          "templateId": "{{feature_template_db[subtemplate]}}",
          "templateType": "vpn-vedge-interface"
        },
{% endfor %}

      ]
    },

{% endfor %}

    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_Banner]}}",
      "templateType": "banner"
    },
    {
      "templateId": "{{feature_template_db[item.values()[0].Feature_SNMP]}}",
      "templateType": "snmp"
    }
  ]
}

 

Thank you very much for your helps ! :)
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: