Class PXE_API

Description

NOC-PS API

The API can be called remotely by third-party software using XML-RPC over HTTPS

To connect to the NOC-PS server with IP-address 1.2.3.4, using the PHP API:

  1.  require_once('include/nocps_api.php');
  2.  $api new nocps_api('1.2.3.4''username''password');

-OR- you can change the default login information in nocps_api.php and use:

  1.  require_once('include/nocps_api.php');
  2.  $api new nocps_api();

On generic errors an Exception (XML-RPC fault) may be raised, and should be catched in your software.
Some methods return a structured response. This is an associative array that has a boolean named "success" set to true on success. If one of more parameters is incorrect, it will return a field named "errors" specifying which parameters are incorrect.

e.g:

  1.  $result $api->addSubnetarray(
  2.         "subnet"     => '100.0.0.0',
  3.         "netmask"    => '255.255.255.0',
  4.         "gateway"    => '101.0.0.1',
  5.         "description"=> ''
  6.         ));
  7.  print_r($result);

Will return:

  1.  Array
  2.  (
  3.    [success=>
  4.    [errors=> Array
  5.        (
  6.            [gateway=> Gateway IP-address is outside subnetmust be
  7.            between 100.0.0.1 and 100.0.0.254
  8.        )
  9.  )

To use the API from other programming languages:

XML-RPC endpoint: https://1.2.3.4/xmlrpc.php
XML-RPC class/namespace name: PXE_API
Authenticate using standard basic HTTP username/password authentication

Part of project codename NOC-PS
Copyright (C) Maxnet 2009
All rights reserved


	
			
Method Summary
struct addDeviceConnection (struct $p)
struct addHost (struct $p)
struct addReservation (struct $p)
struct addSubnet (struct $p)
struct addSubnet6 (struct $p)
struct addVM (struct $p)
string|boolean arpPing (string $ip)
void cancelProvisioning (string $mac)
void copyCD (string $filename)
void deleteDevice (string $id)
void deleteDeviceConnection (string $server, int $devid, string $portid)
void deleteHost (string|array $mac)
void deleteISO (string $filename)
void deleteNic (string $host, string $index)
void deletePool (string|array $id)
void deleteProfile (int $id)
void deleteProfileAddon (string $tag, string $name)
void deleteSubnet (string|array $subnet)
void deleteSubnet6 (string|array $subnet)
void deleteUser (string $username)
void deleteVM (string|array $mac)
void emptyCacheOfProfile (int $profile)
base64 exportData ()
string fetchUpdateInfo ()
base64 generateBandwidthGraph (struct $p)
struct getAvailableBandwidthData (string $host)
void getAvailableData (struct $p)
struct getBandwidthData (struct $p)
struct getBandwidthDataOfAllHosts (int $start, int $end)
struct getConnectionsByHost (string $mac)
string getConsoleURL (string $mac, string $ipmi_password, string|bool $restrict_ip)
void getDataOfAllHosts (struct $p)
struct getDatastores (int $devid)
struct getDefaults ()
struct getDevices (int $start, int $limit)
struct getDeviceTypes ()
struct getDisabledProfileNames (int $start, int $limit)
string getFirstAvailableIP (string $subnet)
struct getHost (string $mac)
struct getHosts (string $subnet, int $start, int $limit)
struct getISOs (int $start, int $limit)
string getLicenseInfo ()
struct getLocale ()
struct getNetworks (int $devid)
struct getPools ()
struct getProfile (int $id)
struct getProfileAddon (string $tag, string $name)
struct getProfileAddonNames (int $start, int $limit)
int getProfileByName (string $name, [string $arch = 'amd64'])
struct getProfileNames (int $start, int $limit)
struct getProvisioningStatus (int $start, int $limit)
struct getProvisioningStatusByServer (string $server)
string getServerByIP (string $ip)
returns getSubnets (int $start, int $limit)
returns getSubnets6 (int $start, int $limit)
struct getUnknownHosts (int $start, int $limit)
struct getUnusedDevicePorts (int $devid)
struct getUsernames (int $start, int $limit)
string getVersion ()
void installUpdate ()
boolean IPinUse (string $ip)
boolean IPinUseByDevice (string $ip)
boolean IPinUseByOtherServer (string $ip, string $server)
string IPMIcommand (string $ip, string $user, string $password, string $cmd)
string IPMIcommandEx (string $ip, string $type, string $user, string $password, string $cmd)
struct listHostNics (string $host)
int longPoll (int $num, int $timeout)
boolean ping (string $ip)
void pingGateway ()
string|boolean popFromPool (int $pool, int $moveToPool)
string powercontrol (string $mac, string $action, string $ipmipassword, string $method)
struct provisionHost (struct $p)
void renameISO (string $oldname, string $newname)
struct searchHosts (struct $p)
struct setDefaults ( $p, struct $d)
struct setLocale (struct $d)
void setProfileEnabled (int $profileid, bool $enabled)
void splitSubnet (struct $p)
void splitSubnet6 (struct $p)
struct startVKVM (struct $p)
struct submitDevice (struct $p)
struct submitIPMI (struct $d)
struct submitNic (struct $p)
struct submitPool (struct $p)
struct submitProfile (struct $p)
struct submitProfileAddon (struct $p)
struct submitUser (struct $p)
struct updateHost (struct $p)
struct updateSubnet (struct $p)
struct updateSubnet6 (struct $p)
Methods
addDeviceConnection

Adds a connection between server and device

struct addDeviceConnection (struct $p)
  • struct $p: Associative array with the following fields:
    • host: MAC-address
    • devid: Device ID
    • portid: Port ID
    • description: Optional port description
    For iSCSI:
    • conn_user: username
    • conn_password: password
    • data1: initiator name
    • data2: reserved
    • data3: reserved
addHost

Adds a host to the system

  • return: Structured response
struct addHost (struct $p)
  • struct $p: Associative array with the following fields:
    • mac: MAC-address
    • subnet: Network address of subnet (must already exist in database)
    • ip: IP-address
    • numips: number of IPs (e.g. 1). All IPs must be sequential from "ip"
    • add_ips: OPTIONAL: space seperated string with additional IP-addresses that are not sequential.
    • ipmi_ip: IP-address of IPMI card
    • ipmi_user: IPMI username
    • ipmi_password: IPMI password
    • ipmi_type: IPMI type. v1, v2, v2nokvm or AMT
    • hostname: hostname
    • arch: optional architecture
    • description: description
    • pool: id of pool
addReservation

Adds an IP-reservation to the system

  • return: Structured response
struct addReservation (struct $p)
  • struct $p: Associative array with the following fields:
    • subnet: Network address of subnet (must already exist in database)
    • ip: IP-address
    • numips: number of IPs (e.g. 1). All IPs must be sequential from "ip"
    • add_ips: OPTIONAL: space seperated string with additional IP-addresses that are not sequential.
    • hostname: hostname
    • description: description
addSubnet

Adds a subnet to the system

  • return: returns structured result
struct addSubnet (struct $p)
  • struct $p: associative array with the following elements:
    • subnet: network address of subnet (e.g. 10.0.0.0)
    • netmask: netmask (e.g. 255.255.255.0)
    • gateway: IP-address of gateway
    • vlan: Optional VLAN ID. Currently only used for matching IPv4 to IPv6 subnets
    • description: Description
addSubnet6

Adds an IPv6 subnet to the system

  • return: returns structured result
struct addSubnet6 (struct $p)
  • struct $p: associative array with the following elements:
    • subnet: network address of subnet (e.g. 1:2:3:4::)
    • cidr: cidr (e.g. 64)
    • gateway: IPv6-address of gateway
    • vlan: Optional VLAN ID. Currently only used for matching IPv4 to IPv6 subnets
    • description: Description
addVM

Adds a VPS to the system

  • return: Structured response
struct addVM (struct $p)
  • struct $p: Associative array with the following fields:
    • subnet: Network address of subnet (must already exist in database)
    • ip: IP-address
    • numips: number of IPs (e.g. 1). All IPs must be sequential from "ip"
    • add_ips: OPTIONAL: space seperated string with additional IP-addresses that are not sequential.
    • hostname: hostname
    • description: description
    • module: hypervisor device module ID
    • memory: amount of memory in MB
    • disk: amount of disk in MB
    • diskstore: OPTIONAL name of disk store
    • network: OPTIONAL name of network to hook up to
arpPing

Checks if an IP-address is already in use using ARP-ping

Only works for hosts that are in the same VLAN as the NOC-PS server.

  • return: Returns MAC-address if already in use, or boolean false if not
string|boolean arpPing (string $ip)
  • string $ip: IP-address
cancelProvisioning

Cancels the provisioning of a server

void cancelProvisioning (string $mac)
  • string $mac: MAC-address
copyCD

Physical/virtual CD -> ISO

void copyCD (string $filename)
  • string $filename: ISO filename to create
deleteDevice

Deletes a device

void deleteDevice (string $id)
  • string $id
deleteDeviceConnection

Deletes a connection between server and device

void deleteDeviceConnection (string $server, int $devid, string $portid)
  • string $server: MAC-address
  • int $devid: Device ID
  • string $portid: Port ID
deleteHost
void deleteHost (string|array $mac)
  • string|array $mac: MAC-address
deleteISO

Delete ISO file

void deleteISO (string $filename)
  • string $filename: Filename
deleteNic

Deletes a nic

void deleteNic (string $host, string $index)
  • string $host: Host
  • string $index:

    Index

    Note we currently do not support deleting adapter #0

deletePool
void deletePool (string|array $id)
  • string|array $id: ID of pool
deleteProfile

Delete profile Also deletes cached files if it is the only profile using that cache folder

Throws exception if hosts being provisioned are still depending on it

void deleteProfile (int $id)
  • int $id: Numeric ID of profile
deleteProfileAddon

Delete profile add-on

void deleteProfileAddon (string $tag, string $name)
  • string $tag: Tag
  • string $name: Name
deleteSubnet

Deletes a subnet

Throws an exception if the subnet cannot be deleted, for example: when there are still hosts associated with it.

void deleteSubnet (string|array $subnet)
  • string|array $subnet: Network address of subnet
deleteSubnet6

Deletes an IPv6 subnet

Throws an exception if the subnet cannot be deleted, for example: when there are still hosts associated with it. Note: IPv6 subnet must be written exactly the same as in NOC-PS database (e.g. compact 0001:0000 to 1::)

void deleteSubnet6 (string|array $subnet)
  • string|array $subnet: Network address of subnet
deleteUser

Delete a webinterace user

Throws an exception if it is the last admin left

void deleteUser (string $username)
  • string $username: Username
deleteVM

Delete VM including storage

void deleteVM (string|array $mac)
  • string|array $mac: MAC-address
emptyCacheOfProfile

Removes downloaded files of profile

void emptyCacheOfProfile (int $profile)
  • int $profile: Numeric profile ID
exportData

Exports host and subnet information

Format is .zip file containing 2 .csv files

  • return: exported zip file
base64 exportData ()
fetchUpdateInfo

Check if there is a new NOC-PS update, and return information

  • return: Returns textual string or empty if there is no update
string fetchUpdateInfo ()
generateBandwidthGraph

Generates a bandwidth graph

  • return: Binary data of graph
base64 generateBandwidthGraph (struct $p)
  • struct $p: Associative array with following parameters:
    • host: MAC-address of server
    • device: Device number (only if host is not specified)
    • port: number of port
    • start: Start of graph period requested
    • end: End of graph period requested
getAvailableBandwidthData

Retrieves information about the available bandwidth data of a host

  • return:

    Associate array with the following information:

    • ports: number of switch ports associated with the host
    • start: timestamp of start of data collection
    • last: timestamp of last data colelction

struct getAvailableBandwidthData (string $host)
  • string $host: MAC-address of server
getAvailableData
void getAvailableData (struct $p)
  • struct $p: associated struct, parameters:
    • host MAC-address of server
    • type net or power
getAvailableSpace

Retrieves available disk space

  • return: Space in MB
int getAvailableSpace ()
getBandwidthData

Retrieves numerical bandwidth information

  • return: Bandwidth information
struct getBandwidthData (struct $p)
  • struct $p: Associative array with following parameters:
    • host: MAC-address of server
    • port: number of port
    • start: Start of period requested
    • end: End of period requested
getBandwidthDataOfAllHosts

Retrieves bandwidth data from all hosts

  • return: Array with bw data
struct getBandwidthDataOfAllHosts (int $start, int $end)
  • int $start: Start of period requested
  • int $end: End of period requested
getConnectionsByHost

Retrieves a list of device connections by host

  • return: Returns an array of records, having the following fields:
    • devid: device id number
    • portid: identifier of port
    • portdescr: description of port
    • devname: device name
    • devtype: device type
struct getConnectionsByHost (string $mac)
  • string $mac: MAC-address of host
getConsoleURL

Get console URL

  • return: URL of console
string getConsoleURL (string $mac, string $ipmi_password, string|bool $restrict_ip)
  • string $mac: MAC-address of server
  • string $ipmi_password: IPMI password (if applicable). Leave blank to use stored password.
  • string|bool $restrict_ip: Optional: IP-address of client to restrict access to
getDataOfAllHosts

Retrieves statistics from all hosts

void getDataOfAllHosts (struct $p)
  • struct $p: p Associate array with the following fields:
    • start: start time
    • end: end time
    • type: type of data. "net" for data traffic stats, "power" for power statistics
getDatastores

Get a list of datastores available at a certain hypervisor

struct getDatastores (int $devid)
  • int $devid: Hypervisor device ID
getDefaults

Get default settings

  • return: Returns defaults
struct getDefaults ()
getDevices

Retrieve a list of devices

  • return: Returns an array of records. Records have the following fields:
    • id
    • ip
    • name
    • type
    • statusmsg
struct getDevices (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getDeviceTypes

Retrieves the list of device types supported

e.g.: apcpdu, switch, iscsi, webresetter, xenserver, vmware

  • return: Structured response
struct getDeviceTypes ()
getDisabledProfileNames

Get a list of inactive profiles

  • return: Returns array of records, each record has the fields:
struct getDisabledProfileNames (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getFirstAvailableIP

Get the first available IP-address that is not already in use in a subnet

  • return: Returns IP-address or empty string when there are no IP-addresses left
string getFirstAvailableIP (string $subnet)
  • string $subnet: Network address of subnet
getHost

Retrieve all host information from a specific host

struct getHost (string $mac)
  • string $mac: MAC-address
getHosts

Retrieve all host information for a specific subnet

struct getHosts (string $subnet, int $start, int $limit)
  • string $subnet: network address of subnet
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getISOs

Get list of ISO files on server

  • return: Returns array of records. Each record has the fields:
    • filename: Name of ISO file
    • size: Size in MB
struct getISOs (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getLicenseInfo

Retrieves license information

  • return: Returns string with textual information about the license
string getLicenseInfo ()
getLocale

Get locale settings

  • return:

    Struct with the following fields:

    • language: default installation language
    • timezone: default timezone

struct getLocale ()
getNetworks

Get a list of networks available at a certain hypervisor

struct getNetworks (int $devid)
  • int $devid: Hypervisor device ID
getPools

Retrieves a list of pools

  • return: Returns an array of records, having the following fields:
    • id: pool id number
    • name: friendly name
    • description: description of port
struct getPools ()
getProfile

Get all information from profile

  • return: Returns record with all information
struct getProfile (int $id)
  • int $id
getProfileAddon

Get all information from profile add-on

  • return: Returns record with all information
struct getProfileAddon (string $tag, string $name)
  • string $tag: tag
  • string $name: name
getProfileAddonNames

Get a list of add-ons

  • return: Returns array of records, each record has the fields:
    • tag: tag the add-on applies to
    • name: code name
    • type: type of add-on
    • descr: friendly name
struct getProfileAddonNames (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getProfileByName

Get profile number by name

  • return: Returns unique ID number, or false/0 if not found
int getProfileByName (string $name, [string $arch = 'amd64'])
  • string $name: Friendly name of profile
  • string $arch: Architecture ("amd64" for 64-bit, "x86" for 32-bit)
getProfileNames

Get a list of profiles

  • return: Returns array of records, each record has the fields:
    • id: numeric unique ID
    • name: friendly name of profile
    • arch: architecture. usually "amd64" for 64-bit, or "x86" for 32-bit.
    • tags: tags associated with the profile
struct getProfileNames (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getProvisioningStatus

Retrieve the provisioning status

  • return: Returns an array of records. Each record has the following fields:
    • host: MAC-address of server being provisioned
    • hostname: Hostname of server being provisioned
    • profile: Numeric ID number of profile
    • profilename: Friendly name of profile
    • statusmsg: Textual description of status (e.g. "Waiting for reboot")
    • statusprogress: Currently not used. Reserved for percentage.
struct getProvisioningStatus (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getProvisioningStatusByServer

Retrieve the provisioning status of a single server

  • return: @see getProvisioningStatus for fields
struct getProvisioningStatusByServer (string $server)
  • string $server: MAC-address of server
getServerByIP

Get server (MAC-address) by IP-address

  • return: Returns MAC address, or false/0 if not found
string getServerByIP (string $ip)
  • string $ip: IP-address
getSubnets

Retrieve all subnet information

  • return: array of records. Each record is an associative array with the following fields:
    • subnet
    • netmask
    • gw
    • descr
returns getSubnets (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getSubnets6

Retrieve all subnet information

  • return: array of records. Each record is an associative array with the following fields:
    • subnet
    • netmask
    • gw
    • descr
returns getSubnets6 (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getUnknownHosts

Retrieve a list of hosts that requested a DHCP lease recently.

The list is sorted on newest first.

  • return: Returns array of records, each record has the fields:
    • mac: MAC-address
    • hostname: hostname (usually "-unknown-")
    • last_boot: textual representation of time since boot (e.g. "2 minutes ago")
struct getUnknownHosts (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getUnusedDevicePorts

Get ports from device, that are not assigned to other servers yet

struct getUnusedDevicePorts (int $devid)
  • int $devid: Device ID
getUsernames

Retrieve a list of webinterface usernames

  • return: Returns an array of records. Records have the following fields:
    • username: username
    • accesslevel: admin or space seperated list of hosts it is allowed to administer
struct getUsernames (int $start, int $limit)
  • int $start: offset of first record (first = 0)
  • int $limit: maximum number of results
getVersion

Retrieve version information

  • return: Returns version
string getVersion ()
installUpdate

Update NOC-PS to newest version

void installUpdate ()
IPinUse

Check if an IP-address is already in use by another server (according to the database)

  • return: returns true if in use
boolean IPinUse (string $ip)
  • string $ip: IP-address to check
IPinUseByDevice

Check if an IP-address is in use by device

  • return: returns true if in use
boolean IPinUseByDevice (string $ip)
  • string $ip: IP-address to check
IPinUseByOtherServer

Check if an IP-address is already in use BY ANOTHER SERVER then the one specified

  • return: returns true if in use
boolean IPinUseByOtherServer (string $ip, string $server)
  • string $ip
  • string $server: MAC-address of server
IPMIcommand

Send an IPMI command to server (depreciated, use IPMIcommandEx or submitIPMI instead)

string IPMIcommand (string $ip, string $user, string $password, string $cmd)
  • string $ip: IP-address of IPMI card
  • string $user: IPMI username
  • string $password: IPMI password
  • string $cmd: Raw IPMI command
IPMIcommandEx

Send an IPMI command to server

To be able to use IPMI password stored in database: use submitIPMI() instead

string IPMIcommandEx (string $ip, string $type, string $user, string $password, string $cmd)
  • string $ip: IP-address of IPMI card
  • string $type: IPMI version/type. "v1", "v2", "v2nokvm" or "AMT"
  • string $user: IPMI username
  • string $password: IPMI password
  • string $cmd: Raw IPMI command
licenseDaysLeft

Returns the days left before the license expires If less than 15, the license server is contacted to see if user bought a new one

  • return: Days left
int licenseDaysLeft ()
listHostNics

Retrieves information about the hosts secondary network interfaces

  • return: Structured response
struct listHostNics (string $host)
  • string $host: Host
longPoll

Wait for event

This can be used to wait for updates on the provisioning status

int longPoll (int $num, int $timeout)
  • int $num: last event received
  • int $timeout: timeout in seconds
ping

Performs an ICMP echo request

boolean ping (string $ip)
  • string $ip: IP-address
pingGateway
void pingGateway ()
popFromPool

Grab a single server from the specificied pool and move it to a new pool Atomic operation (database table locked during operation)

  • return: Returns the MAC-address of the server moved, or false if no server is available
string|boolean popFromPool (int $pool, int $moveToPool)
  • int $pool: Old pool ID
  • int $moveToPool: New pool ID
powercontrol

Controls the power of a server

  • return: result
string powercontrol (string $mac, string $action, string $ipmipassword, string $method)
  • string $mac: MAC-address of server
  • string $action: on/off/status/reset/cycle/ctrlaltdel/supportedactions
  • string $ipmipassword: IPMI password (only required when password is not stored in db)
  • string $method: apcpdu, webresetter, ipmi or auto
provisionHost

Provisions a server

The server must already be in the system. If it is not, add it with AddHost

struct provisionHost (struct $p)
  • struct $p:

    Associative array with the following fields:

    • mac: MAC-address
    • hostname: New hostname of server
    • rootpassword, rootpassword2: Root password (twice)
    • adminuser: Username of optional user
    • userpassword, userpassword2: Password of optional user (twice)
    • rebootmethod: ipmi, apcpdu, webresetter, auto, or empty for manual
    • ipmipassword: IPMI password to set boot method and reboot (optional)
    • profile: Profile ID number
    Optional, overriding profile defaults:

    • disklayout: Disk layout in profile specific format
    • packages: List of packages
    • pre_installation: Pre-installation script (not supported by every profile)
    • post_installation: Post-installation script (usually executed at the end of the installation, before reboot)
    • firstboot: First boot script (executed after installation, after reboot)
    • timezone: Server's timezone
    • language: Language pack to install
    -OR-

    • disk_addon: Reference to disk layout tag/name (e.g. "kickstart:raid1")
    • packages_addon: Reference to package list tag/name (e.g. "ubuntu:lamp")
    • extra_addon1 ... extra_addon10: Extra settings. Usually post-installation scripts. Maximum of 10 items.
    Optional for integration with 3rd party software:

    • callback: URL to be called when provisioning is finished. The MAC addresses of the host will be appended to the URL as GET parameter.
    Caveats:

    • Do not override both the profile defaults and use add-ons at the same time.
    • You should NOT set parameters to empty, if you do not want to use them. e.g. setting "packages" to "", will result in 0 packages being installed If that is not your intention, and you would like to install the default packages listed in the profile, you should leave out the parameter completely, instead of setting it to empty.

renameISO

Rename ISO file

void renameISO (string $oldname, string $newname)
  • string $oldname: Current filename
  • string $newname: New filename
searchHosts

Search hosts

struct searchHosts (struct $p)
  • struct $p: containing:
    • subnet OR device OR pool OR rack OR query
setDefaults

Set default settings

struct setDefaults ( $p, struct $d)
  • struct $d
  • $p
setLocale

Update locale settings

struct setLocale (struct $d)
  • struct $d
setProfileEnabled

Active/Deactivate profile

void setProfileEnabled (int $profileid, bool $enabled)
  • int $profileid
  • bool $enabled
splitSubnet

Splits a subnet into smaller ones

The subnet must be empty, it may not have any hosts associated with it.

void splitSubnet (struct $p)
  • struct $p: associative array with the following elements: *
    • subnet: Network address of subnet
    • cidr: CIDR of new subnet (e.g. "30" to split into \30 subnets)
    • gateway: "first" to indicate the gateway is the first usable IP of subnet, "last" for last IP, or "none"
splitSubnet6

Splits an IPv6 subnet into smaller ones

The subnet must be empty, it may not have any hosts associated with it. Implementation limitation: currently can only split subnet CIDRs dividable by 8 into 256 subnets

void splitSubnet6 (struct $p)
  • struct $p: associative array with the following elements: *
    • subnet: Network address of subnet
    • cidr: CIDR of new subnet (e.g. "30" to split into \30 subnets)
    • gateway: "first" to indicate the gateway is the first usable IP of subnet, "last" for last IP, or "none"
startVKVM

Start KVM/QEMU environment

  • return: Returns structured response
struct startVKVM (struct $p)
  • struct $p: Associative array with the following fields:
    • rootpassword: VNC password (8 characters max)
    • iso: optional filename of ISO file
    • storage: optional storage mode (ide, scsi, virtio)
    • network: optional networking mode (none, user)
submitDevice

Add or update a device like an Ethernet or power switch

struct submitDevice (struct $p)
  • struct $p: Associative array of the following fields:
    • id (only required when updating)
    • ip
    • name
    • type
    • username (optional)
    • password (or SNMP community name)
submitIPMI

Send an IPMI command to server (array version)

  • return: Returns structured response
struct submitIPMI (struct $d)
  • struct $d: associative array with fields:
    • ip
    • username
    • password (if not in database)
    • ipmi_type (v1, v2 or AMT)
    • cmd
submitNic

Add or update NIC

  • return: Structured response
struct submitNic (struct $p)
  • struct $p: Associative array with the following fields:
    • host
    • index
    • mac
    • model
    • subnet
    • ip
    • add_ips
    • ext_if
    • antispoof
submitPool

Add or update a pool

struct submitPool (struct $p)
  • struct $p: Associate array with the following fields:
    • id: pool id number (only if updating a pool)
    • name: name of pool
    • description: description
submitProfile

Add or update profile

  • return: Returns structured response
struct submitProfile (struct $p)
  • struct $p: Associative array
submitProfileAddon

Add or update add-on

  • return: Returns structured response
struct submitProfileAddon (struct $p)
  • struct $p: Associative array
submitUser

Add or update webinterface user

struct submitUser (struct $p)
  • struct $p: Associative array of the following fields:
    • username: Username
    • password, password2: Password (twice)
    • restrict_ip: IP restriction
    • current_username: current username (only when updating an existing user)
updateHost

Updates host information You must update all fields at once. MAC address and subnet cannot be changed.

  • return: Structured response
struct updateHost (struct $p)
  • struct $p: Associative array with the following fields:
    • mac: MAC-address
    • ip: IP-address
    • add_ips: OPTIONAL: space seperated string with additional IP-addresses that are not sequential
    • subnet: OPTIONAL: network IP-address of new subnet
    • ipmi_ip: IP-address of IPMI card
    • ipmi_user: IPMI username
    • ipmi_password: IPMI password
    • ipmi_noverify: if set, do not verify IPMI password. Default is to connect to the IPMI unit and verify password upon calling updateHost()
    • ipmi_type: v1, v2, v2nokvm or AMT
    • hostname: hostname
    • dhcp: boolean, true if we act as permanent DHCP server for this host
    • pool: pool id number
    • subnet6: IPv6 subnet
    • add_ips6: Space seperated string with IPv6 address(es). All must be within the subnet specified by subnet6
updateSubnet

Updates a subnet NOTE: subnet and netmask values CANNOT be changed, only gateway and description

  • return: returns structured result
struct updateSubnet (struct $p)
  • struct $p: associative array with the following elements:
    • subnet: network address of subnet (e.g. 10.0.0.0)
    • gateway: IP-address of gateway
    • description: Description
    • vlan: Optional VLAN ID
updateSubnet6

Updates an IPv6 subnet NOTE: subnet and cidr values CANNOT be changed, only gateway, vlan and description

  • return: returns structured result
struct updateSubnet6 (struct $p)
  • struct $p: associative array with the following elements:
    • subnet: network address of IPv6 subnet
    • gateway: IP-address of gateway
    • description: Description
    • vlan: Optional VLAN ID

Documentation generated on Thu, 06 Feb 2014 12:24:17 +0100 by phpDocumentor 1.4.3