Constructor()
Instantiates an OtNetworks object. The only way to initialize the object is to call the loadREST method.
Return value
An object of class OtNetworks.
loadREST(host, auth, prot = 'https', cert = None)
Initialize an OtNetworks object with asset data loaded from OT-BASE Asset Center via the REST API. Information loaded from OT-BASE Asset Center is usually processed by looping through the object's PID structure and initializing elements as objects of class OtNetwork (singular).
Arguments
host = host name of a computer system where OT-BASE 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 OT-BASE Asset Center.
prot = 'http' | 'https'
The protocol that shall be used for connecting to OT-BASE Asset Center. 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 OT-BASE Asset Center, such as in OT-BASE 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
nw = OtNetworks()
nw.loadREST('192.168.0.15', (userid, password))
PID
Returns the metadata for all networks in the Portable Inventory Data format. This data is usually processed in a loop by initializing OtNetwork objects.
Comments
0 comments
Please sign in to leave a comment.