API Classes and Functions

List of Classes available in rtapi module with functions and methods.

class rtapi.RTObject(dbobject)

Main class which create rtapi object. You could create multiple rtapi objects each for different database and interact between them.

This Class needs only one parameter and it’s database object.

AddDockerContainer(container_ip, container_name, docker_host)

Add new Docker container to racktables

AddObject(name, server_type_id, asset_no, label)

Add new object to racktables

AssignChassisSlot(chassis_name, slot_number, server_name)

Assign server objects to server chassis

CheckIfIp4IPExists(ip)

Check if ipv4 record exist in database

CleanIPAddresses(object_id, ip_addresses, device)

Clean unused ip from object. ip addresses is list of IP addresses configured on device (device) on host (object_id)

CleanIPv6Addresses(object_id, ip_addresses, device)

Clean unused ipv6 from object. ip_addresses mus be list of active IP addresses on device (device) on host (object_id)

CleanUnusedInterfaces(object_id, interface_list)

Remove unused old interfaces

CleanVirtuals(object_id, virtual_servers)

Clean dead virtuals from hypervisor. virtual_servers is list of active virtual servers on hypervisor (object_id)

CreateAttribute(attr_type, attr_name)

Create new attribute in Racktables. Require attr_type (string, dict, uint) and attr_name

FindIPFromComment(comment, network_name)

Find IP address based on comment

FindIPv6FromComment(comment, network_name)

Find IP address based on comment

GetAllServerChassisId()

Get list of all server chassis IDs

GetAttributeId(searchstring)

Search racktables database and get attribud id based on search string as argument

GetAttributeIdByName(attr_name)

Get the ID of an attribute by its EXACT name

GetAttributeValue(object_id, attr_id)

Search racktables database and get attribute values

GetDictionaryChapterId(value)

Search racktables dictionary chapter using exact value and return id of dictionary chapter

GetDictionaryId(searchstring, chapter_id=None)

Search racktables dictionary using searchstring and return id of dictionary element It is possible to specify chapter_id for more specific search

GetDictionaryIdByValue(dict_value, chapter_id=None)

Get the ID of a dictionary entry by its EXACT value Is it possible to specify chapter_id for more specific search.

GetDictionaryValueById(dict_key)

Get value from Dictionary by ID reference

GetDockerContainerHost(ip)

Get Docker container host

GetDockerContainerName(ip)

Get Docker container name

GetInterfaceId(object_id, interface)

Find id of specified interface

GetInterfaceList(object_id)

Get list of object interfaces ids and names Return array of touples id, name, type

GetInterfaceName(object_id, interface_id)

Find name of specified interface. Required object_id and interface_id argument

GetIpv4Allocations()

Get IPv4 Allocations for specific network

GetIpv4Networks()

Get All IPV4 Networks

GetIpv6Allocations()

Get IPv6 Allocations for specific network

GetIpv6Networks()

Get All IPV6 Networks

GetObjectAttributes(object_id)

Get list of Object attributes

GetObjectComment(object_id)

Get object comment

GetObjectId(name)

Translate Object name to object id

GetObjectIdByAsset(service_tag)

Get Object ID by Asset Tag

GetObjectLabel(object_id)

Get object label

GetObjectName(object_id)

Translate Object ID to Object Name

GetObjectNameByAsset(service_tag)

Translate Object AssetTag to Object Name

GetObjectTags(object_id)

Get object tags

GetObjectsByTag(tag_name)

Get Array of objects from Racktables database by Tag name

GetPortDeviceNameById(port_id)

Get Device name and Port Name by port ID, return dictionary device_name, port_name

InsertAttribute(object_id, object_tid, attr_id, string_value, uint_value, name=None)

Add or Update object attribute. Require 6 arguments: object_id, object_tid, attr_id, string_value, uint_value, name

InsertDictionaryChapter(value, sticky='no')

Insert new dictionary chapter

InsertDictionaryValue(dict_id, value)

Insert value into dictionary identified by dict_id

InsertIPv4Log(ip, message)

Attach log message to IPv4

InsertLog(object_id, message)

Attach log message to specific object

InterfaceAddIpv4IP(object_id, device, ip)

Add/Update IPv4 IP on interface

InterfaceAddIpv6IP(object_id, device, ip)

Add/Update IPv6 IP on interface

InterfaceGetIpv4IP(object_id, interface)

Get list of IPv4 IP from interface

InterfaceGetIpv6IP(object_id, interface)

Get list of IPv6 IP from interface

LinkNetworkInterface(object_id, interface, switch_name, interface_switch)

Link two devices togetger

LinkVirtualHypervisor(object_id, virtual_id)

Assign virtual server to correct hypervisor

ListDockerContainersOfHost(docker_host)

List all Docker containers of specified host

ListObjects(data='sum')

List all objects from database You can specify data sum or list to get summary or list of objects In list you get array of id,name,asset_no,objtype_id

ListObjectsByType(object_tid)

Get list of objects based on object type ID

MapAttribute(objtype_id, attr_id, chapter_id='NULL', sticky='no')

Map attribute to object type

ObjectExistName(name)

Check if object exist in database based on name

ObjectExistST(service_tag)

Check if object exist in database based on asset_no

ObjectExistSTName(name, asset_no)

Check if object exist in database based on name

ObjectGetIpv4IPList(object_id)

Get list of IPv4 IP from object

ObjectGetIpv6IPList(object_id)

Get list of IPv6 IP from object

RemoveDockerContainerFromHost(container_name, docker_host)

Remove Docker container from racktables

SetIP6Comment(comment, ip)

Set comment for IPv6 address

SetIPComment(comment, ip)

Set comment for IP address

SetIPName(name, ip)

Set name for IP address

UpdateDockerContainerHost(ip, host)

Update Docker container host

UpdateDockerContainerName(ip, name)

Update Docker container name

UpdateNetworkInterface(object_id, interface)

Add network interfece to object if not exist

UpdateObjectComment(object_id, comment)

Update comment on object

UpdateObjectLabel(object_id, label)

Update label on object

UpdateObjectName(object_id, name)

Update name on object

db_fetch_lastid()

SQL function which return ID of last inserted row.

db_insert(sql)

SQL insert/update function. Require sql query as parameter

db_query_all(sql)

SQL query function, return all rows. Require sql query as parameter

db_query_one(sql)

SQL query function, return one row. Require sql query as parameter