Templates
The following are the Template REST APIs:
Status
The following table details the API Response code, status and, the HTTPS methods.
|
|
|
200 |
OK |
GET |
202 |
Accepted |
POST PUT DELETE |
400 |
Bad Request |
GET POST PUT DELETE |
401 |
Unauthorized |
GET POST PUT DELETE |
403 |
Forbidden |
GET POST PUT DELETE |
404 |
Not Found |
GET POST PUT DELETE |
405 |
Method Not Allowed |
GET POST PUT DELETE |
500 |
Internal Server Error |
GET POST PUT DELETE |
Resource Name
/config/templates/{template-name}
Description
Get Configuration template
URL
https://dcnm-ip/fm/fmrest/config/templates/{template-name}
Parameter
|
|
|
templateName |
S |
ConfigTemplate name |
Return Value
Format: JSON
Type: Object
|
|
|
ConfigTemplateDO |
O |
ConfigTemplate object |
Resource Name
/config/templates
Description
Get All Configuration template
URL
https://dcnm-ip/fm/fmrest/config/templates
Parameter
|
|
|
filterStr |
S |
Used for filtering the template format is <templateField1>:<filter value1> |
sortBy |
S |
Filed to be sorted +<filed name> for ASC and -<filed name> for DESC |
items (request header) |
S |
Range of records to fetch (i.e. 10-20) |
Return Value
Format: JSON
Type: Object
|
|
|
ConfigTemplateDO[] |
A |
Array of ConfigTemplate object |
items (response header) |
S |
Total number of records available |
Resource Name
/config/templates
Description
Create a Config template
URL
https://dcnm-ip/fm/fmrest/config/templates
Parameter
|
|
|
templateFileContent |
S |
ConfigTemplate file content in plain text |
Return Value
Format: JSON
Type: Object
|
|
|
InstanceNameIdDO |
O |
InstanceNameId of created template |
Resource Name
/config/templates/{template-name}
Description
Modify a config template
URL
https://dcnm-ip/fm/fmrest/config/templates/{template-name}
Example
Request Body:
"id":"Example_Simple_v7",
"content":"##template properties \nname =Example_Simple_v7;\ndescription = Simple POAP Template example to assign a Management IP address;\nuserDefined= true;\nsupportedPlatforms = N3K,N5K,N5500,N5600,N6K,N9K;\ntemplateType = POAP;\ntemplateSubType=NA;\npublished = false;\ntimestamp = 2017-05-26 23:27:05 ;\n##\n##template variables\n\n# Copyright (c) 2017 by Cisco Systems, Inc.\n# All rights reserved.\n\n@(IsSwitchName=true, UseDNSReverseLookup=true, IsMandatory=true, Description=\"The host name of the switch [example: switch{1-3}]\", DisplayName=\"Switch Name\")\nstring SWITCH_NAME;\n\n@(IsMandatory=true, Description=\"Administrative User which will be used to manage this device\", DisplayName=\"Administrative Username\")\nstring ADMIN_USERNAME{\n defaultValue=admin;\n};\n\n@(IsMandatory=true, Description=\"Plain text password of at least 8 characters\", DisplayName=\"Administrative Password\")\nstring ADMIN_PASSWORD;\n\n@(IsManagementIP=true, IsMandatory=true, IsMultiplicity=true, Description=\"Mgmt0 address for this device [example: 10.10.10.10-20]\", DisplayName=\"Management IP\")\nipV4Address MGMT_IP;\n\n@(IsMandatory=true, Description=\"Management Network Prefix\", DisplayName=\"Management Prefix\")\ninteger MGMT_PREFIX{\n defaultValue=%POAP.MGMT_PREFIX;\n};\n\n@(IsMandatory=true, Description=\"Default Gateway IP address\", DisplayName=\"Default Gateway\")\nipV4Address DEFAULT_GATEWAY{\n defaultValue=%POAP.DEFAULT_GATEWAY;\n};\n\n@(IsMandatory=true, DisplayName=\"Console timeout\", Description=\"Enter timeout in minutes, 0 to disable\")\ninteger CONSOLE_TIMEOUT{\n defaultValue=0;\n};\n\n@(IsMandatory=true, DisplayName=\"Console Speed\")\ninteger CONSOLE_SPEED{\n defaultValue=9600;\n};\n##\n\n##template content\n\nhostname $$SWITCH_NAME$$\n\nno password strength-check\nusername $$ADMIN_USERNAME$$ password $$ADMIN_PASSWORD$$ role network-admin\n\nsnmp-server user $$ADMIN_USERNAME$$ network-admin auth md5 $$ADMIN_PASSWORD$$ priv $$ADMIN_PASSWORD$$ \n\nvrf context management\n ip route 0.0.0.0/0 $$DEFAULT_GATEWAY$$\n\ninterface mgmt0\n vrf member management\n no cdp enable\n no lldp transmit \n no lldp receive \n ip address $$MGMT_IP$$/$$MGMT_PREFIX$$\n no shutdown\n\nline console\nif( $$CONSOLE_TIMEOUT$$ != \"30\"){\n exec-timeout $$CONSOLE_TIMEOUT$$\n}\nif( $$CONSOLE_SPEED$$ != \"9600\"){ \n speed $$CONSOLE_SPEED$$\n}\n##\n"
Note The id attribute must match with the template-name in the URL.
Response Body:
"status":"Template modification successful"
Parameter
|
|
|
templateFileContent |
O |
ConfigTemplate file content in plain text The parameter is a JSON object data type with mandatory properties of id and content, where id is the template name and content is the modified template content. |
Return Value
Format: JSON
Type: Object
Resource Name
/config/templates/{template-name}
Description
Delete a Config template
URL
https://dcnm-ip/fm/fmrest/config/templates/{template-name}
Parameter
|
|
|
templateName |
S |
ConfigTemplate name |
Return Value
Format: JSON
Type: Object
Get Populated template CLI content
Resource Name
/config/templates/{templateName}/populate/{ deviceIP}
Description
To get the CLI delivery content for the given parameter value for a template
URL
https://dcnm-ip/fm/fmrest/config/{templateName}/populate/{deviceIP}
Parameter
|
|
|
parametervalue |
A |
JSON Array of parameter values i.e [1, 'a'] |
Return Value
Format: JSON
Type: Object
|
|
|
String |
S |
Populated CLI commands |
Validate a Config Template
Resource Name
/config/templates/validate
Description
To Validate a Config template before creation
URL
https://dcnm-ip/fm/fmrest/config/templates/validate
Parameter
|
|
|
templateFileContent |
S |
ConfigTemplate file content in plain text |
Return Value
Format: JSON
Type: Object
|
|
|
ReportItem[] |
S |
Validation result |
Get Config Template Valid Switches
Resource Name
/config/templates/{template-name}/switches
Description
Returns all valid switches available for the template based on "supported platform" attribute there in Template.
URL
https://dcnm-ip/fm/fmrest/config/templates/{template-name}/switches
Parameter
|
|
|
templateName |
S |
Template name |
Return Value
Format: JSON
Type: Object
|
|
|
ConfigDeliveryTaskDeviceDO [] |
A |
Array of device objects |
Create a Config Template Job
Resource Name
/config/templates/jobs
Description
Creates a Config template delivery job
URL
https://dcnm-ip/fm/fmrest/config/templates/jobs
Parameter
|
|
|
TemplateConfigDeliveryTaskDO |
O |
ConfigDeliveryTask Object |
Return Value
Format: JSON
Type: Object
|
|
|
InstanceNameIdDO |
O |
Task ID value |
Resource Name
/config/templates/jobs
Description
Fetches the Config template delivery jobs
URL
https://dcnm-ip/fm/fmrest/config/templates/jobs
Parameter
|
|
|
status |
S |
Could be any of "not started/in progress/completed" |
Return Value
Format: JSON
Type: Object
|
|
|
ConfigDeliveryTaskDO [] |
A |
Array of ConfigDeliveryTask |
Get Config Template Job detail
Resource Name
/config/templates/jobs/{jobID}
Description
Fetches the Config template delivery job with execution details
URL
https://dcnm-ip/fm/fmrest/config/templates/jobs/{jobID}
Return Value
Format: JSON
Type: Object
|
|
|
ConfigDeliveryTaskDO [] |
A |
Array of ConfigDeliveryTask |
Delete Config Template Job
Resource Name
/config/templates/jobs/{job-id}
Description
Deletes the Config template delivery jobs
URL
https://dcnm-ip/fm/fmrest/config/templates/jobs/{job-id}
Parameter
|
|
|
jobID |
S |
ID of the ConfigDeliveryTask |
Return Value
Format: JSON
Type: Object