LinMin Bare Metal Provisioning 6.2 User's Guide

API: Legacy API (for LBMP 5.5 and earlier)

Hide Navigation Pane

API: Legacy API (for LBMP 5.5 and earlier)

Previous topic Next topic No expanding text in this topic  

API: Legacy API (for LBMP 5.5 and earlier)

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function Mail us feedback on this topic!  

Do not use the Legacy API for any new project.

 

Additions to existing Applications using the Legacy API should be implemented using the new 6.0 API.

 

Starting with LBMP 6.0, a new API was introduced with security, more provisioning functions and a new imaging capability. It is far superior to the Legacy API.

This page covers the Legacy API that will be supported through July 1, 2011 and then discontinued.  We encourage customers to start transitioning from the Legacy API to the new API during this window of time, and to write any new applications using the new API only.

The LinMin Server Application Programming Interface enables external applications (hosting control panels, asset management, load balancing, capacity planning, systems management, cloud computing resource management, system monitoring, SaaS deployment, hosting customer signup/billing, etc.) to interface directly with the LinMin Server data structures, eliminating the need for an IT user to use the graphical user interface for MAC-Specific Provisioning.

The API allows pre-existing Provisioning Role Templates to be assigned (add/update/delete/read) to unique systems based on MAC address, and dynamic, real-time business needs. In this fashion, external applications can prepare systems to be provisioned from a pool of spare or under-utilized systems to maximize system capacity and minimize power consumption.  The next time a given system boots to the network, it will be provisioned as specified by the external application, without human intervention.

The API can be used by either incorporating a GUI page into an existing application, or by issuing HTTP commands from an external program to the LinMin Server.

LBMP PROFILES Database Table API Specifications

 

Module name: lbmp-DBAPI-profiles.php

 

This PHP based API will get “linminbmp” database "profiles" table records by key and provide basic functions equivalent to the GUI actions --

 

1.MAC-Specific Provisioning Roles --> Add MAC-Specific Role --> MAC-Specific Provisioning Role {fill in form fields} --> OK
2.MAC-Specific Provisioning Roles --> Edit {selected} --> MAC-Specific Provisioning Role {change form fields} --> OK
3.MAC-Specific Provisioning Roles --> Delete {selected} --> OK

 

 

The actions supported are:

read
add
delete
update (no support for record locking with update will be provided so there is no assurance against stepping on interim GUI changes (there is a very low probability of this happening).

 

The key accesses supported are:

by user supplied nick name
by MAC address
key access will be:
If mac_address is not present or is null user_supplied_id must be present.
If both are present the user_supplied_id is used as the access key (an error is thrown if the passed in MAC is not equal to the DB MAC of the  user_supplied_id record)

 

The "profiles" database fields supported are:

 For field details refer to the documentation fore the GUI field names.

user_supplied_id
okey field
oGUI: Nick Name)
mac_address
okey field
oformat ff:ff:ff:ff:ff:ff
oGUI: MAC Address
node_name
oGUI: Host Name
node_domain
oGUI: Domain Name Server
node_password
oGUI: Root Password
node_ip_address
oformat ###.###.###.###
oGUI: IP Address
node_subnet_mask
oformat ###.###.###.###
oGUI: Net Mask
node_nameserver
oformat ###.###.###.###
oGUI: Domain Name Server
node_default_gateway
oformat ###.###.###.###
oGUI: Gateway
node_time_zone
ovalues GMT{+1 to +12 or -1 to -12}
oGUI: Time Zone
control_file_template
ovalid existing template
oGUI: Provisioning Role Template
enable_provisioning_flag
ovalues: 'ignore', 'always', or 'nextbootonly'
oGUI: Enable Provisioning upon Network Boot?
values  Ignore (boot from local disk), Always Provision, or Provision on next boot only, then set to Ignore
Table fields not shown will be set to system defaults the same as with the GUI actions

The protocol supported will be standard HTTP get/post --

Input interfaces supported:
oURL with parameter string
url/lbmp-DBAPI-profiles.php?name1=value1&name2=value2...
values must be url encoded
oHTML form, POST or GET
oCGI HTTP
oPHP CLI with a single quoted parameter string equivalent to a URL GET string of name value pairs
Output interface will be HTTP URL with GET format name value parameter string.
oValues will be encoded

 

Fields passed as input are --

Required for all actions:
oaction={read, add, update, delete}
oan access key
user_supplied_id
or
mac_address={valid mac in correct format}
Additionally for "update" actions
oAny remaining supported fields with new values
Other "update" action fields supported – changes to key fields
onew_mac_address
format ff:ff:ff:ff:ff:ff
GUI: MAC Address
onew_user_supplied_id
GUI: Unique System Nickname
Additionally for "add" actions
oAll remaining supported fields are required with values
Optionally this field may be passed:
oreturnURL={urlencoded URL}
The default is to return to the referring URL if returnURL is not present or is null

 

Return parameters are:

action={same as input}
actionResults={OK or FAILED}
actionResultsMsg={text, success message or error message}
mac_address={from DB or same as input on failure}
user_supplied_id={from DB or same as input on failure}
For action "read" with actionResults "OK" --
oall other supported fields are returned with values from the DB
For actions other than "read" with all actionResults values --
oall input fields are returned with values passed in

 

Example actionResults and actionResultsMsg:

actionResults=OK with actionResultsMsg=Successful:update
actionResults=OK with actionResultsMsg=Successful:delete
actionResults=OK with actionResultsMsg=Successful:add
actionResults=FAILED with actionResultsMsg=add: record already exists for user_supplied_id: centos51-1
actionResults=OK with actionResultsMsg=Successful:delete
actionResults=FAILED with actionResultsMsg=delete: delete failed, no record found for: WHERE user_supplied_id = 'centos51-1'

 

Logging actions:

A log file of the result status of each API call is maintained at the default location
/usr/local/linmin/lbmp-DBAPI-profiles.log
This location may be changed in the file
/usr/local/linmin/lbmp-DBAPI-profiles_log_location.cfg
if this cfg file does not exist creating it with a valid path/name will establish the log
To turn off logging enter '/dev/null/' in
/usr/local/linmin/lbmp-DBAPI-profiles_log_location.cfg

 

Example log entries:

2008-07-27_23:24:55_PDT MAC:ff:00:00:00:00:01 Nickname:centos51-1 Status:OK Successful:update 2008-07-27_23:31:22_PDT Nickname:centos51-1 Status:OK Successful:delete 2008-07-27_23:31:41_PDT MAC:ff:00:00:00:00:01 Nickname:centos51-1 Status:OK Successful:add

2008-07-27_23:31:43_PDT MAC:ff:00:00:00:00:01 Nickname:centos51-1 Status:FAILED add: record already exists for user_supplied_id: centos51-1

2008-07-27_23:32:52_PDT Nickname:centos51-1 Status:OK Successful:delete

2008-07-27_23:32:55_PDT Nickname:centos51-1 Status:FAILED delete: delete failed, no record found for: WHERE user_supplied_id = 'centos51-1'

 

Interactive use learning via example GUI (lbmp-DBAPI_sample_URL_string_generator.php) form:

(this page is no longer shipped with LBMP but it remains on your LinMin Server after you upgrade to 6.0 and beyond)

 

The LinMin Server provides a PHP example API interface form module. This is to be used to explore and learn about the API actions and requirements. If familiar with the LinMin Server GUI for MAC-Specific Provisioning Role this form will intuitive. It mostly mirrors the fields and actions of MAC-Specific Provisioning Role GUI as described in the users guide.

API_Legacy_empty

 

Module name: lbmp-DBAPI_sample_URL_string_generator.php
Invoke via browser
http://{yourLBMPserverIP}/tftpboot/www/lbmp-DBAPI_sample_URL_string_generator.php
Read the notes at the bottom of the form for an understanding of the differences from actual MAC-Specific Provisioning Role GUI.
The differences to note are in these form rows:
Results of previous action
shows the results of the previous action
New System Nickname
allows for changing this key field
New MAC Address
allows for changing this key field
Provisioning Role Template
a drop-down selection in the LinMin Server GUI, this must be known and keyed in this form
Action
provides for the basic actions, Read, Update, Add, and Delete
Debug
No
call to API with direct return the submit form displaying returned values
Show
call to API showing detail information about the construction of the URL return string
provides a clickable link to continue to the submit form displaying returned values
GET
call to the API showing the input and output HTTP GET format parameter strings
provides a clickable link to continue to the submit form displaying returned values
GET example
Invoked with HTTP GET string:

returnURL=http%3A%2F%2F192.168.1.56%2Ftftpboot%2Fwww%2Flbmp-DBAPI_sample_URL_string_generator.php &user_supplied_id=&mac_address=&new_user_supplied_id=&new_mac_address=&control_file_template=&node_name=&node_domain=&node_ip_address=&node_subnet_mask=&node_nameserver=&node_default_gateway=&node_password=&node_time_zone=&action=read

 

Returns with HTTP GET string:

returnURL=http%3A%2F%2F192.168.1.56%2Ftftpboot%2Fwww%2Flbmp-DBAPI_sample_URL_string_generator.php&user_supplied_id=&mac_address=&new_user_supplied_id=&new_mac_address=&control_file_template=&node_name=&node_domain=&node_ip_address=&node_subnet_mask=&node_nameserver=&node_default_gateway=&node_password=&node_time_zone=&action=read&actionResults=FAILED&actionResultsMsg=update%253A%2Bno%2Bkey%2Bprovided%252C%2Buser_supplied_id%2Bor%2Bmac_address%2Brequired

 

 

Examples of a completed API code generation page:

API_Legacy_filled

 

 

API_Legacy_return_code

And the corresponding output: