tokio.cli.archive_esnet_snmp module

Retrieves ESnet SNMP counters and store them in TOKIO Timeseries format

class tokio.cli.archive_esnet_snmp.Archiver(query_start, query_end, interfaces, timestep, timeout=30.0, *args, **kwargs)[source]

Bases: dict

A dictionary containing TimeSeries objects

Contains the TimeSeries objects being populated from a remote data source. Implemented as a class so that a single object can store all of the TimeSeries objects that are generated by multiple method calls.

__init__(query_start, query_end, interfaces, timestep, timeout=30.0, *args, **kwargs)[source]

Initializes the archiver and stores its settings

  • query_start (datetime.datetime) – Lower bound of time to be archived, inclusive
  • query_end (datetime.datetime) – Upper bound of time to be archived, inclusive
  • interfaces (list of tuples) – List of endpoints and interfaces to archive. Each tuple is of the form (endpoint, interface).
  • timestep (int) – Number of seconds between successive data points. The ESnet service may not honor this request.
  • timeout (float) – Seconds before HTTP connection times out

Extract and encode data from ESnet’s SNMP service

Queries the ESnet SNMP REST service, interprets resulting data, and populates a dictionary of TimeSeries objects with those values.

Parameters:esnetsnmp (tokio.connectors.esnet_snmp.EsnetSnmp) – Connector instance

Convert datasets to deltas where necessary and tack on metadata

Perform a few finishing actions to all datasets contained in self after they have been populated. Such actions are configured entirely in self.config and require no external input.


Populate empty datasets within self

Creates and attachs TimeSeries objects to self based on a given column list

Parameters:dataset_names (list of str) – keys corresponding to self.config defining which datasets are being initialized

Set metadata constants (version, units, etc) on datasets and groups

Parameters:dataset_names (list of str) – keys corresponding to self.config for the datasets whose metadata should be set
tokio.cli.archive_esnet_snmp.archive_esnet_snmp(init_start, init_end, interfaces, timestep, output_file, query_start, query_end, input_file=None, **kwargs)[source]

Retrieves remote data and stores it in TOKIO time series format

Given a start and end time, retrieves all of the relevant contents of a remote data source and encodes them in the TOKIO time series HDF5 data format.

  • init_start (datetime.datetime) – The first timestamp to be included in the HDF5 file
  • init_end (datetime.datetime) – The timestamp following the last timestamp to be included in the HDF5 file.
  • interfaces (list of tuples) – List of (endpoint, interface) elements to query.
  • timestep (int) – Number of seconds between successive entries in the HDF5 file to be created.
  • output_file (str) – Path to the file to be created.
  • query_start (datetime.datetime) – Time after which remote data should be retrieved, inclusive.
  • query_end (datetime.datetime) – Time before which remote data should be retrieved, inclusive.
  • input_file (str or None) – Path to a cached input. If specified, the remote REST API will not be contacted and the contents of this file will be instead loaded.
  • kwargs (dict) – Extra arguments to be passed to Archiver.__init__()
tokio.cli.archive_esnet_snmp.endpoint_name(endpoint, interface)[source]

Create a single key from an endpoint, interface pair

  • endpoint (str) – The name of an endpoint
  • interface (str) – The interface on the given endpoint

A single key combining endpoint and interface

Return type:


tokio.cli.archive_esnet_snmp.init_hdf5_file(datasets, init_start, init_end, hdf5_file)[source]

Initialize the datasets at full dimensions in the HDF5 file if necessary


Entry point for the CLI interface