The ADNode class makes reading and writing the configuration of Asset Discovery nodes simple. It does not interface OT-BASE Asset Center but only Asset Discovery.
Constructor
Returns an object of class ADNode.
loadREST(host, auth, port = 443)
Load configuration data from an Asset Discovery node.
Arguments
host = host name of a computer system where OT-BASE Asset Discovery 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 Discovery.
port
The port number for the connection which can be set during the installation of Asset Discovery. Default is 443 (HTTPS).
Example
ad = ADNode()
ad.loadREST('192.168.0.10', (userid, password))
nodeName
The name of the Asset Discovery node (read-only).
version
Returns the version of the Asset Discovery server (read-only).
locationId
The location ID of the Asset Discovery node, which is used as a default for network and device location IDs (read-only).
export
The export configuration items as a dictionary (read-only).
addNodeCredentials(protocol, credentials)
Add global credentials for the node, for the specified protocol.
Arguments
protocol = One of the protocols supported by Asset Discovery (wmi, snmp, ssh etc.)
credentials = Credentials expressed as a dictionary
Example
ad.addNodeCredentials('wmi', [{"user": "User1", "password": "PW1"}, {"user": "User2","password": "PW2"}])
networks
Returns the network configuration of the Asset Discovery node as a dictionary (read-only).
getNetworkIdByName(name)
Returns the GUID of the network that is using the name that is passed as an argument, if existing (otherwise, None is returned). The ID can be used to change configuration settings for a network.
getNetworkIdByAddress(address)
Returns the GUID of the network that is using the IP address that is passed as an argument, if existing (otherwise, None is returned). The ID can be used to change configuration settings for a network.
Note that in the case where an Asset Discovery node is monitoring multiple networks using the same IP address, only the first entry will be returned.
getNetworkConfig(guid)
Returns the configuration settings for a specific network as a dictionary. You must pass the GUID for the network you are interested in. The GUID can be obained by a call to Networks, getNetworkIdByName, or getNetworkIdByAddress.
setNetworkConfig(guid, config)
Overwrites the configuration settings for a specific network.
Arguments
guid = GUID that references the network you want to re-configure
config = New configuration expressed as a dictionary
Refer to the REST API documentation for valid configuration items, or simply inspect the return value from getNetworkConfig.
ou must pass the GUID for the network you are interested in. The GUID can be obained by a call to Networks, getNetworkIdByName, or getNetworkIdByAddress.
setDeviceConfig(deviceRef, config, nwGuid = None)
Change configuration parameters credentials for an individual device.
Presently, the following configuration parameters can be changed for a device:
- locationId
- hwType
- hwVendor
- hwModel
- hwDescription
The most important use case for this function is setting the location ID for a device because you already have it available in an Excel table or similar so that this information can be processed automatically.
Arguments
deviceRef = IP address | hostname | MAC address
This identifies the device for which you want to change the configuration.
config = New configuration (dictionary)
nwGuid = Network GUID
If you specify a GUID, the device identified by deviceRef is only searched in that network. If you don't specify a GUID, the device is searched in all networks accessible by the Asset Discovery node.
Example
ad.setDeviceConfig('MyHostName', {'locationId': '+T800'})
Comments
0 comments
Please sign in to leave a comment.