Templates REST API
Description – API for using provisioning templates in UFM (getting, adding and refreshing templates)
Request URL – /ufmRest/templates
Main Operations
Get all templates
Get template
Add template
Remove template
Refresh templates list
Description – this interface is used to retrieve all templates
Request URL – GET /ufmRest/templates
Optional Request Parameters
"tags"
Comma seperated list of tags.
For example: .../templates?tags="switch,Mellanox"
"profile"
Profile of the template.
For example: .../templates?profile="ib"
"system_type"
Type of system.
For example: .../templates?system_type=Mellanox Switch
Request Data – N/A
Response
[{
"matchingValidationTemplate":null,"description":"Shows SNMP settings and status","filePath":"/opt/ufm/files/templates/pre-defined/Mellanox/Show-SNMP","validationTemplate":null,"portProvisioning":null,"systemProfile":"","parsingScript":null,"systemType":"Mellanox Switch","owner":"*system*","title":"Show-SNMP","tags":"switch,Mellanox"}, {"matchingValidationTemplate":null,"description":"Displays health report.","filePath":"/opt/ufm/files/templates/pre-defined/Mellanox/Show-Health-Report","validationTemplate":null,"portProvisioning":null,"systemProfile":"","parsingScript":null,"systemType":"Mellanox Switch","owner":"*system*","title":"Show-Health-Report","tags":"switch,Mellanox"}, . . .Status Codes
200 – successful operation
Description – this interface is used to retrieve the content of a specific template
Request URL – GET /ufmRest/<templates>/<template_name>
Request Data – N/A
Response
{
"matchingValidationTemplate":null,"description":"Shows SNMP settings and status","filePath":"/opt/ufm/files/templates/pre-defined/Mellanox/Show-SNMP","validationTemplate":null,"portProvisioning":null,"systemProfile":"","content": ["#!desc: Shows SNMP settings and status\n","#!system_profile:\n","#!system_type: mlnxos_switch\n","#!update_conf: false\n","#!owner: *system*\n","show snmp\n"],"parsingScript":null,"systemType":"Mellanox Switch","owner":"*system*","title":"Show-SNMP","tags":"switch,Mellanox"}Status Codes
200 – successful operation
400 – template <template_name> does not exist
Description – this interface is used to add/create a new user-defined template
Request URL – POST /ufmRest/<templates>
Request Data
{
"title":"tenplate_title","systemType":"Mellanox Switch","content":["the content of the template"],"description":"template_description"}Response – HTTP Response Location Header will contain URI with template name created for running the CLI command on the specified switches
Status Codes
201 – created
409 – template with a name 'template_title' already exists. Please select a different name.
400 – missing attribute(s) : attr_name
Description – this API is used to remove an existing template
Request URL – DELETE /ufmRest/<templates>/<template-id>
Request Data – N/A
Response – N/A
Status Codes
204 – no content
Description – this interface is used to refresh the templates list, after a new user-defined template was created
Request URL – POST /ufmRest/<templates>/refresh
Request Data – N/A
Response – N/A
Status Codes
200 – OK
General Templates
Available Templates  | Description  | Arguments  | |
Globals  | Locals  | ||
Disable-SNMP  | Disables SNMP on the switch  | ||
Disable-SNMP-V3  | Disables SNMP v3  | user_name - username to use  | |
Disable-Telnet  | Disables the telnet service on the switch  | ||
Enable-SNMP  | Enables SNMP and defines 'public' community string  | community_name - community name to enable  | |
Enable-SNMP-V3  | Creates an SNMP v3 user 'admin' with predefined authentication and privacy passwords  | 
  | |
Enable-Telnet  | Enables the telnet service on the switch  | ||
Install-License  | Installing Switch license  | license_key – license key to install  | |
Remove-SNMP-Host  | Removes a trap-receiver  | IP_address – IP address of SNMP host to remove  | |
Reset-Counters  | Clears all the counters  | ||
Set-CLI-Logout  | Sets default CLI log-out interval  | auto_logout_timeout – auto-logout timeout value (in minutes)  | |
Set-Email-Notifications  | Sets up an email server and a recipient for email notifications  | 
  | |
Set-Hostname  | Sets hostname of the switch  | switch_hostname – hostname to set  | |
Set-NTP-Server  | Sets up an NTP server, sets the time zone and synchronizes the date  | 
  | |
Set-SNMP-V2c-Traps  | Adds a trap-receiver for SNMP v2c traps with given community  | 
  | |
Set-SNMP-V3-Traps  | Adds a trap-receiver for SNMP v3 traps with username and predefined authentication and privacy passwords  | 
  | |
Show-Running-Config  | Shows the running configuration of the switch  | ||
Show-SNMP  | Shows SNMP settings and status  | ||
Show-SNMP-Host  | Shows list of trap-receivers  | ||
Show-SNMP-User  | Shows the list of SNMP users  | ||
Show-Power  | Displays power supplies and power usage  | ||
Show-Fan  | Displays fans status and speed  | ||
Show-Health-Report  | Displays health report  | ||
Show-Voltage  | Displays power supplies voltage level  | ||
Show-Protocols  | Displays all protocols enabled in the system  | ||
InfiniBand Templates
Available Templates  | Description  | 
Disable-SM  | Disables subnet manager  | 
Enable-SM  | Enables subnet manager  |