silo.low_code.framework.base_classes module

silo.low_code.framework.base_classes.AppProperties

Stores the Application properties of a component device

Variables
  • did (object) – The DID of the device/component device

  • sub_dict (dict) – Substitution dictionary

class silo.low_code.framework.base_classes.ArgParser(subs, rc, sub_prefix='<', sub_suffix='>')

Bases: SequencePhase

The ArgParser converts the snippet argument into the appropriate execution to execute.

class silo.low_code.framework.base_classes.CommandSub(subs, result_container=None, prefix='', suffix='')

Bases: object

substitute(command, json=False)
silo.low_code.framework.base_classes.NeededRequestResults

Stores the needed requests and the saved results

Variables
  • needed_req (list) – ResultContainer list for needed requests, these are requests were not made before.

  • saved_res (list) – ResultContainer list, cache requests, known requests.

class silo.low_code.framework.base_classes.RequestMaker(credential, cache_read=True, result_cache=None)

Bases: SequencePhase

Network Requests

agent_supported = False
static generate_agent_config(da_job, result_containers)

Generate an agent configuration for the Requestor / DA Job

This function generates all required configurations and returns them as a list of messages. This allows agent alignment to occur with the proper configuration to collect the required collections. If this function is not implemented, execution on the agent will not occur.

Parameters
  • da_job (dict) – Dynamic Application job pertaining to a specific app / device id.

  • result_containers (list) – List of result containers for the current collections

Returns

List of messages that can be used to generate the config

Return type

list

classmethod get_hash_information(result_container)

Generates the hash information for a specific RC

Parameters

result_container (ResultContainer) – RC to use for generating the Requestor hash. This ensures that duplicate requests are not made which will reduce the load on the local system and reduce toe bandwidth to SL1 and storage on both devices.

Returns

Tuple containing the Display ID and backend ID

Return type

tuple

classmethod get_req_id_disp(result_container)

Setup and calling for generating the request ID

Parameters

result_container (ResultContainer) – Current RC

Returns

Request ID Display name

Return type

str

classmethod get_request_id(result_container)

Given a request for a network response, return the request’s unique ID. By default, this is just the details of the network connection. You may need to make it unique based on e.g. headers, credentials, etc.

The goal is to have a unique hashable identifier based on whatever properties make this request unique.

Parameters

result_container (ResultContainer) – ResultContainer of this network request

Returns

A unique, hashable identifier for this request

Return type

hashable

static manipulate_agent_data(result)

Modify the results to be consistent between the agent and CU

Parameters

result (object) – Results from the agent

abstract validate_request(request)

Accepts a single request to ensure that it is valid for the network requester

Validates that the provided request meets the criteria to be executed by this RequestMaker. If the request is not valid, an exception stating why will be raised. There is no return for this function.

Parameters

request (ResultContainer) – Request that needs to be verified.

class silo.low_code.framework.base_classes.SequencePhase

Bases: object

abstract call(response, *args, **kwargs)
abstract static get_desc()
abstract static get_name()
classmethod get_request_id(result_container)

Default function for generating the request id for caching

Parameters
  • cls (Class) – Reference to the class

  • result_container (ResultContainer) – result_container that will be used when generating the request_id hash that is used for caching

Returns

Hash for the action

Return type

str

silo.low_code.framework.base_classes.TotalRequests

Stores two values, a list of desired requests and a dictionary of lists with identical requests

Variables
  • redup_requests (dict) – Dictionary of lists of requests objects with the same network request.

  • dedup_requests (list) – List of requests we need.

silo.low_code.framework.base_classes.generate_hash_key(tiered_name)

Generate the DB key from the tiered name

Parameters

tiered_name (str) – Human-readable key

Returns

Database cache key

Return type

str

silo.low_code.framework.base_classes.get_cache_dict(collection_time=0)
silo.low_code.framework.base_classes.get_prefix_key(collection_time=0)
silo.low_code.framework.base_classes.metric_substitution(device_metric, custom=None)

Provides default substitution values related to the collection

The following default substitutions are available:

silo:app_id - The application ID of the DA silo:app_type - The type ID of the DA silo:gmtime - The GM time of the DA silo:freq - The poll frequency of the DA silo:comp_name - The name of this component device silo:comp_dn - The DN of this component device silo:comp_uid - The Unique ID of this component device silo:did - The DID of this device/component device silo:root_did - The root DID of this component device silo:parent_did - The parent DID of this component device

Parameters
  • device_metric (ResultContainer) – Container to substitute

  • custom (dict) – Custom substitution to add. Default values take precedence

Returns

App properties

Return type

AppProperties()