Command Line Utilities

AIT provides a number of command line utilities for performing common operations and component initialization. Below is a breakdown of these utilities with a brief explanation of how they work and why you might use them.


Component Initialization Utilities

The following commands are used to start up AIT services or components.

ait-bsc

Usage: ait-bsc

Start the ait BSC for capturing network traffic into PCAP files
and the manager server for RESTful manipulation of active loggers.

Sequence Utilities

Utilities for the manipulation of command sequences.

ait-seq-encode

usage:  ait-seq-encode mission_seq_SSS_desc_NNN.txt
where:
        SSS  = subsystem
        desc = sequence descriptor
        NNN  = sequence ID (integer)

Encodes the given relative time command sequence to binary.

Examples:

  $ ait-seq-encode seq/oco3_seq_gps_reset_001.txt

ait-seq-decode


usage: ait-seq-decode oco3_seq_SSS_NNN_desc.bin

Decodes the given relative time command sequence to text.

Examples:

  $ ait-seq-decode seq/oco3_seq_gps_001_reset.bin

ait-seq-print

usage: ait-seq-print oco3_seq_SSS_NNN_desc.bin

Prints the given binary relative time command sequence to standard
output as text.

Examples:

  $ ait-seq-print seq/oco3_seq_gps_001_reset.bin

Telemetry Utilities

ait-tlm-send

Usage: ait-tlm-send [options] <pcap-filename>

Sends the telemetry contained in the given pcap file via UDP.

  --port=number    Port to which to send data  (default: 3076)
  --verbose        Report every packet sent    (default:False)

Examples:

  $ ait-tlm-send test/data/pcap/oco3fsw-iss1553-2015-04-22.pcap


Command Utilities

ait-cmd-send

ait-cmd-send

BSC Utilities

ait-bsc-create-handler

Usage:
    ait-bsc-create-handler [options] <name> <loc> <port> <conn_type>

--service-host=<host>     The host for the BSC REST service connection
                          [default: localhost]
--service-port=<port>     The port for the BSC REST service connection
                          [default: 8080]
--rotate-log=<rl>         Flag saying whether the log should be rotated
                          automatically [default: True]
--rotate-log-index=<rli>  If log rotation is enabled, this determines the
                          frequency of a rotation. One of 'year', 'month',
                          'day', 'hour', 'minutes', 'second' [default: day]
--rotate-log-delta=<rld>  If log rotation is enabled, this determines the
                          delta between log creation and current time
                          rotate-index value needed to trigger a log
                          rotation [default: 1]
--file-name-pattern=<fnp> The file pattern for the log file name. This can
                          include handler metadata values as well as strftime
                          format characters [default: %Y-%m-%d-%H-%M-%S-{name}.pcap]

ait-bsc-stop-handler

Usage:
    ait-bsc-stop-handler [options] <name>

--service-host=<host> The host for the BSC REST service connection
                      [default: localhost]
--service-port=<port> The port for the BSC REST service connection
                      [default: 8080]

Command Table Utilities

ait-table-decode

usage: ait-table-decode --fswtabdict config/table.yaml --tabletype targets --binfile /Users/ays/targets.bin

Decodes the given FSW binary table to text.

Examples:

  $ ait-table-decode --fswtabdict config/table.yaml --tabletype targets --binfile /Users/ays/targets.bin

ait-table-encode

usage: ait-table-encode --fswtabdict config/table.yaml --tabletype targets --tabfile /Users/ays/Documents/workspace/ait-workspace/output/targets_table.txt

Encodes the given FSW text table to binary.

Examples:

  $ ait-table-encode --fswtabdict config/table.yaml --tabletype targets --tabfile /Users/ays/Documents/workspace/ait-workspace/output/targets_table.txt

Miscellaneous Utilities

ait-create-dirs

Usage:
    ait-create-dirs [options]

Arguments:

    -d DATETIME, --datetime=<YYYY-MM-DDTHH:mm:ssZ>  Create directory structure using this
                                                    ISO 8601 datetime for strftime replacement
                                                    in directory path. Default: TODAY

Description:

    AIT Create Directory Structure

    Based on the data paths specified in the AIT_CONFIG, this software creates
    daily directories for the GDS based on the paths and any applicable variable
    substitution.

    Define the Paths
    ================

    Paths should be specified within the 'data' portion of the AIT_CONFIG. It
    should follow the following hierarchy within the YAML file:

        data:
            data-type:
                path:

    For example:

        data:
            type_a:
                path: /path/to/data/type_a
            type_b:
                path: /path/to/data/type_b

    Be sure to use 'path' to specify the data path so the software knows to
    translate these paths as needed. You can use absolute or relative paths:

        data:
            type_a:
                path: to/data/type_a
            type_b:
                path: ~/to/data/type_b


    Variable Substitution
    =====================

    Variable substituion is also possible using any of the default-, platform-,
    or host- level attributes within the AIT_CONFIG. To include a variable
    in a path use the following syntax, `${variable}`

    For example,

        default:
            mission: 'oco3'
            phase: 'int'

            data:
                type_a:
                    path: /${mission}/${phase}/data/type_a
                type_b:
                    path: /${mission}/${phase}/data/type_b

    Will create the directories:

        /oco3/int/data/type_a
        /oco3/int/data/type_b


    Special Variables and strftime directives
    =========================================

    There are also several special variables available:
    * hostname = current machine hostname
    * platform = platform of the current machine (darwin, win32, etc.)

    You can also use strftime format characters
    (https://docs.python.org/2/library/time.html#time.strftime).

    For example,

        default:
            mission: 'oco3'
            phase: 'int'

            data:
                type_a:
                    path: /${mission}/${phase}/%Y/%Y-%j/type_a
                type_b:
                    path: /${mission}/${phase}/%Y/%Y-%j/type_b

    Will produce paths like (depending on the date):

        /oco3/int/2016/2016-299/type_a
        /oco3/int/2016/2016-299/type_b


ait-orbits

ait-yaml-validate

usage: ait-yaml-validate

Validate YAML files with applicable schema and/or advanced
content validation for CMD and TLM dictionaries.

YAML validation is done through a combination of JSON Schema
(http://json-schema.org/) and Python-coded content validation.
The JSON Schema is used to validate general format of the YAML,
i.e dictionaries contain the expected keys, values are the
expected type, etc.

Why JSON Schema? All of the available YAML validators did not
meet the robustness expected for this tool. Since JSON and YAML
are stored similarly in memory, the JSON Schema became an option.
The only difference between YAML and JSON is the use of multiple
documents in the same YAML file. The val.py module handles this
implication. See TBD wiki page for more details on developing
JSON schema for an applicable YAML file.

Examples:

  $ ait-yaml-validate --cmd
  $ ait-yaml-validate --tlm
  $ ait-yaml-validate --evr
  $ ait-yaml-validate --cmd --yaml /path/to/cmd.yaml
  $ ait-yaml-validate --tlm --yaml /path/to/tlm.yaml
  $ ait-yaml-validate --yaml /path/to/yaml --schema /path/to/schema