Sol module

exception Sol.SolDuplicateOapNotificationException

Bases: exceptions.Exception

Sol.bin_to_http(sol_binl)

Convert a list of binary SOL objects (compound or not) into a JSON string to be sent as HTTP payload to the server.

Parameters:sol_binl (list) – a list of binary SOL Objects
Returns:A JSON string to be sent to the server over HTTP.
Return type:string
Sol.bin_to_json(sol_bin, mac=None)

Convert a binary SOL object into a JSON SOL Object.

Parameters:
  • sol_bin (list) – binary SOL object
  • mac (list) – A list of byte containing the MAC address of the that created the object
Returns:

JSON SOL Objects

Rtpe:

list

Sol.dumpToFile(sol_jsonl, file_name)
Sol.dust_to_json(dust_notif, mac_manager=None, timestamp=None)

Convert a single Dust serial API notification into a list of JSON SOL Object.

Parameters:
  • dust_notif (dict) – The Dust serial API notification as a json object created by the JsonServer application
  • mac_manager (list) – A list of byte containing the MAC address of the manager
  • timestamp (int) – the Unix epoch of the message creation in seconds (UTC)
Returns:

A list of SOL Object in JSON format

Return type:

list

Sol.http_to_bin(sol_http)

Convert the JSON string contained in an HTTP request into a list of binary SOL objects (compound or not).

Parameters:sol_http (string) – JSON string contained in an HTTP request
Returns:list of binary SOL objects (compound or not)
Return type:list
Sol.influxdb_to_json(sol_influxdb)

Converts an Influxdb query reply into a list of dicts.

Parameters:sol_influxdb (dict) – the result of a database query (sush as SELECT * FROM)
Returns:a list of JSON SOL objects
Return type:list
Sol.json_to_bin(sol_json)

Convert a JSON SOL Object into a single binary SOL Object.

Parameters:sol_json (dict) – a JSON SOL Object
Returns:A single binary SOL Object
Return type:list
Sol.json_to_influxdb(sol_json, tags)

Convert a JSON SOL object into a InfluxDB point

Parameters:
  • sol_json (dict) – JSON SOL object
  • tags (dict) – A dictionary of tags
Returns:

InfluxDB point

Rtpe:

list

Sol.loadFromFile(file_name, start_timestamp=None, end_timestamp=None)
Sol.version()
_images/SOL_functions.png