Templates

Get a Template

Resource Name

/config/templates/{template-name}

Description

Get Configuration template

https Method

GET

URL

https://<dcnm-ip>/fm/fmrest/config/templates/{template-name}

Parameter

Parameter Type Description
templateName S ConfigTemplate name

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
ConfigTemplateDO O ConfigTemplate object

Get All Template

Resource Name

/config/templates

Description

Get All Configuration template

https Method

GET

URL

https://<dcnm-ip>/fm/fmrest/config/templates

Parameter

Parameter Type Description
filterStr S Used for filtering the template format is :
sortBy S Filed to be sorted + for ASC and - for DESC
items (request header) S Range of records to fetch (i.e. 10-20)

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
ConfigTemplateDO[] A Array of ConfigTemplate object
items (response header) S Total number of records available

Create a Config Template

Resource Name

/config/templates

Description

Create a Config template

https Method

POST

URL

https://<dcnm-ip>/fm/fmrest/config/templates

Parameter

Parameter Type Description
templateFileContent S ConfigTemplate file content in plain text

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
InstanceNameIdDO O InstanceNameId of created template

Modify a Config Template

Resource Name

/config/templates/{template-name}

Description

Modify a config template

https Method

PUT

URL

https://<dcnm-ip>/fm/fmrest/config/templates/{template-name}

Example

Request Body:

{
"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

Parameter Type Description
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

Attribute Name Type Description

Delete a Config Template

Resource Name

/config/templates/{template-name}

Description

Delete a Config template

https Method

DELETE

URL

https://<dcnm-ip>/fm/fmrest/config/templates/{template-name}

Parameter

Parameter Type Description
templateName S ConfigTemplate name

Return Value

Format: JSON

Type: Object

Attribute Name Type Description

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

https Method

POST

URL

https://<dcnm-ip>/fm/fmrest/config/{templateName}/populate/{deviceIP}

Parameter

Parameter Type Description
parametervalue A JSON Array of parameter values i.e [1, 'a']

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
String S Populated CLI commands

Validate a Config Template

Resource Name

/config/templates/validate

Description

To Validate a Config template before creation

https Method

POST

URL

https://dcnm-ip/fm/fmrest/config/templates/validate

Parameter

Parameter Type Description
templateFileContent S ConfigTemplate file content in plain text

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
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.

https Method

GET

URL

https://<dcnm-ip>/fm/fmrest/config/templates/{template-name}/switches

Parameter

Parameter Type Description
templateName S Template name

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
ConfigDeliveryTaskDeviceDO [] A Array of device objects

Create a Config Template Job

Resource Name

/config/templates/jobs

Description

Creates a Config template delivery job

https Method

POST

URL

https://<dcnm-ip>/fm/fmrest/config/templates/jobs

Parameter

Parameter Type Description
TemplateConfigDeliveryTaskDO O ConfigDeliveryTask Object

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
InstanceNameIdDO O Task ID value

Get Config Template Jobs

Resource Name

/config/templates/jobs

Description

Fetches the Config template delivery jobs

https Method

GET

URL

https://<dcnm-ip>/fm/fmrest/config/templates/jobs

Parameter

Parameter Type Description
status S Could be any of "not started/in progress/completed"

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
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

https Method

GET

URL

https://<dcnm-ip>/fm/fmrest/config/templates/jobs/{jobID}

Parameter

Parameter Type Description

Return Value

Format: JSON

Type: Object

Attribute Name Type Description
ConfigDeliveryTaskDO [] A Array of ConfigDeliveryTask

Delete Config Template Job

Resource Name

/config/templates/jobs/{job-id}

Description

Deletes the Config template delivery jobs

https Method

DELETE

URL

https://<dcnm-ip>/fm/fmrest/config/templates/jobs/{job-id}

Parameter

Parameter Type Description
jobID S ID of the ConfigDeliveryTask

Return Value

Format: JSON

Type: Object

Attribute Name Type Description