ait.dsn.plugins.vcid_routing module
Implements a plugin which routes AOS frames by VCID
- class ait.dsn.plugins.vcid_routing.AOSFrameRouter(inputs=None, outputs=None, zmq_args=None, routing_table=None, default_topic=None)
Bases:
Plugin
Routes AOS frames by VCID according to a routing table defined by a yaml file. Arguments to the range operator are inclusive. (i.e. range[40,50] adds VCIDs 40-50 inclusive to the topic, not 40-49) The exclude operator must come after the range operator.
example in config.yaml:
- plugin:
name: ait.dsn.plugins.vcid_routing.AOSFrameRouter inputs:
__telempkts__
default_topic: default_AOS_topic routing_table:
path: aos_routing_table.yaml
example routing table .yaml file:
- output_topics:
- file_frame_handler:
1
- realtime_housekeeping_telemetry:
2
4
- science_data:
5
- file_sink:
- range:
1
5
- exclude:
3
- idle_handler:
63
- add_range_to_table(routing_table, range_array, topic_name)
Adds a range of VCIDs to the routing table. The range_array argument is an array of form [beginning, end]. This function is inclusive of all values. I.e. if range_array is [5, 9], VCIDs 5-9 inclusive will be added (not 5-8).
- add_topic_to_table(routing_table, vcid, topic_name)
Returns an updated table with the topic_name added to the entry for the specified vcid
- get_frame_vcid(frame)
Returns the VCID (as integer) for a given frame (bytearray) Assumes that the VCID is bits 10:15
- load_table_yaml(routing_table_path)
Reads a .yaml file and returns a dictionary of format {vcid1: [streams], vcid2: [streams]}
- Parameters
routing_table_path (string) – path to yaml file containing routing table
- Returns
routing table
- Return type
- process(input_data)
publishes incoming AOS frames to the routes specified in the routing table
- remove_from_table(routing_table, vcid_array, topic_name)
Removes a topic name from all the VCIDs in the vcid_array argument.