Constructor(pid = None)
Returns an object of class OtNetwork.
The object can be initialized by passing a Portable Inventory Data set as an argument, representing an individual network, as obtained by using the OtNetworks class.
loadREST(networkId, host, auth, prot = 'https', cert = None)
Initialize an OtNetwork object with data loaded from OTbase OTbase Inventory via the REST API.
Arguments
networkId = network identifier
The network identifier of the network for which metadata shall be loaded. Note that this is not the network name, but the identifier that is auto-assigned by OTbase, always starts with the prefix "NW.", and cannot be changed by the user.
host = host name of a computer system where OTbase Asset Center is running
Note that only the host name or IP address of the server needs to be specified, not a URL or path.
auth = (userid, password)
Authentification data for connecting to OTbase Inventory.
prot = 'http' | 'https'
The protocol that shall be used for connecting to OTbase Inventory. By default, https is used.
cert = client certificate
Filename(s) of client certificate(s) that are required to open a connection via HTTPS to a secure OTbase Inventory, such as in OTbase Cloud. The client certificate is passed as a file name (path name). Note that the client certificate must be in the .pem format. If the certificate file contains both public and private key, one file name is sufficient. If you have split public and private key in separate files, pass the two file names as a tuple; public key first, private key second. -- You can generate a .pem file from a .p12 file using openssl, like "openssl pkcs12 -in mycert.p12 -out mycert.pem -nodes".
Example
n = OtNetwork()
n.loadREST('NW.99', '192.168.0.5', (user, password))
Id
The network identifier of the network. (Read-only)
name
The name of the network. (Read/write)
group
The network group of the network. (Read/write)
Note that you can only assign a network group that already exists in OTbase Asset Center.
groupColor
The color code of the network group. (Read-only)
address
The address of the network. (Read-only)
type
The type of the network. (Read-only)
locationId
The location identifier of the network. (Read-only)
location
The location name of the network. (Read-only)
description
Description of the network. (Read/write)
toAssetCenter(host, auth, prot = 'https', cert = None)
Exports network metadata of the given network to OTbase Inventory using the REST API. You need to have an online connection to OTbase Inventory and an active user account.
Arguments
host = IP address or hostname
Identifies the endpoint where OTbase Inventory is hosted, either as an IP address or symbolic hostname.
prot = 'http' | 'https'
The protocol to be used. Default is https.
auth = (user ID, password)
Access credentials, expressed as a tuple
cert = client certificate
Filename(s) of client certificate(s) that are required to open a connection via HTTPS to a secure OTbase Inventory, such as in OTbase Cloud. The client certificate is passed as a file name (path name). Note that the client certificate must be in the .pem format. If the certificate file contains both public and private key, one file name is sufficient. If you have split public and private key in separate files, pass the two file names as a tuple; public key first, private key second. -- You can generate a .pem file from a .p12 file using openssl, like "openssl pkcs12 -in mycert.p12 -out mycert.pem -nodes".
Example
n.toAssetCenter('192.168.178.5', (user, password), prot = 'http')
Return value
The status code of the HTTP request (200 = OK).
Comments
0 comments
Please sign in to leave a comment.