volttroncentral.platforms module¶
-
class
volttroncentral.platforms.
PlatformHandler
(vc, vip_identity)[source]¶ Bases:
object
This class is a wrapper around the communication between VC and a corresponding VCP on either this instance or another instance.
-
property
address
¶
-
call
(platform_method, *args, **kwargs)[source]¶ Calls a method on a vcp platform.
- Parameters
platform_method –
args –
kwargs –
- Returns
-
property
config_store_name
¶ Each platform has a specific entry for its data. In order to get that entry the config store needs a config name. This property returns the config store name for this platform.
- Returns
config store name
- Return type
-
property
display_name
¶
-
property
health
¶ Returns a Status object as a dictionary. This will be populated by the heartbeat from the external instance that this object is monitoring, unless it has been over 10 seconds since the instance has been reached. In that case the health will be BAD.
- Returns
-
property
platforms
¶ Returns a link to the object that created this handler.
- Returns
-
property
vip_identity
¶
-
property
-
class
volttroncentral.platforms.
Platforms
(vc)[source]¶ Bases:
object
A class to manage the connections and interactions with external instances.
-
add_platform
(vip_identity)[source]¶ Add a platform based upon the vip_identity to the “known list” of platforms.
- Parameters
vip_identity –
- Returns
-
disconnect_platform
(vip_identity)[source]¶ Remove a platform based upon vip_identity from the “known list” of platforms.
- Parameters
vip_identity –
- Returns
-
get_performance_list
(session_user, params)[source]¶ Retrieve a list of all of the platforms stats available.
This function returns a list of platform status such as the following:
[ { "topic": "datalogger/platforms/f6e675fb36989f97c3b0f25227aaf02e/status/cpu", "last_published_utc": "2017-01-12T18:58:47.894296+00:00", "points": [ "times_percent/guest_nice", "times_percent/system", "percent", "times_percent/irq", "times_percent/steal", "times_percent/user", "times_percent/nice", "times_percent/iowait", "times_percent/idle", "times_percent/guest", "times_percent/softirq" ] }, ... ]
- Parameters
session_user –
params –
- Returns
dictionary containing lookup topic and last publish time.
-
get_platform
(platform_uuid, default=None)[source]¶ Get a specific PlatformHandler associated with the passed address_hash. If the hash is not available then the default parameter is returned.
- Parameters
address_hash – string associated with a specific platform
default – a default to be returned if not in the collection.
- Returns
a PlatformHandler or default
-
get_platform_hashes
()[source]¶ Returns a list of all the address hashes that are currently registered with VC.
- Returns
list of str
-
get_platform_list
(session_user, params)[source]¶ Retrieve the platform list and respond in a manner that can be sent back to the web service.
The response will be formatted as follows:
- [
- {
- “health”: {
“status”: “GOOD”, “last_updated”: “2017-02-24T19:18:52.723445+00:00”, “context”: “Platform here!”
}, “name”: “tcp://127.0.0.1:22916”, “uuid”: “vcp-f6e675fb36989f97c3b0f25227aaf02e”
}
]
- Parameters
session_user –
params –
- Returns
A list of dictionaries each representing a platform.
-
get_platform_vip_identities
()[source]¶ Get the “known list” of connected vcp platforms. This returns a set of keys that are available.
- Returns
-
is_registered
(platform_uuid)[source]¶ Returns true if the platform is currently known.
- Return type
Boolean
- Returns
Whether the platform is known or not.
-
register_platform
(address, address_type, serverkey=None, display_name=None)[source]¶ DEPRECATED VOLTTRON 7.0 Allows an volttron central platform (vcp) to register with vc. Note that if the address has already been used then the same PlatformHandler object reference will be returned to the caller.
- Parameters
address – An address or resolvable domain name with port.
address_type – A string consisting of ipc or tcp.
- Param
serverkey: str: The router publickey for the vcp attempting to register.
- Param
display_name: str: The name to be shown in volttron central.
- Returns
platform_hash and platform object as a tuple.
-
property
vc
¶
-