NASA-AMMOS / AIT-Core

MIT License
45 stars 27 forks source link

`ccsds_packet_handler` Test #237

Closed Futabay closed 4 years ago

Futabay commented 4 years ago
  1. Precondition:

    1. AIT is installed with virtual environment
    2. Virtual environment is started by typing workon ait on your working terminals
  2. Set config.yaml as follows:

            - stream:
                name: telem_stream
                input: 
                    - 3076
                handlers:
                    - name: ait.core.server.handlers.CCSDSPacketHandler
                      packet_types:   {'01011100111' : 'CCSDS_HEADER'}
  3. Start ait-server

    (ait) $ ait-server
    2020-02-09T19:28:31.325 | WARNING  | Config parameter command.history.filename specifies nonexistent path </some/path/to>/cmdhist.pcap
    2020-02-09T19:28:31.327 | WARNING  | Config parameter dsn.cfdp.mib.path specifies nonexistent path </some/path/to>/AIT-Core/config/mib
    2020-02-09T19:28:31.328 | WARNING  | Config parameter dsn.cfdp.datasink.outgoing.path specifies nonexistent path </some/path/to>/AIT-Core/ait/dsn/cfdp/datasink/outgoing
    2020-02-09T19:28:31.329 | WARNING  | Config parameter dsn.cfdp.datasink.incoming.path specifies nonexistent path </some/path/to>/AIT-Core/ait/dsn/cfdp/datasink/incoming
    2020-02-09T19:28:31.330 | WARNING  | Config parameter dsn.cfdp.datasink.tempfiles.path specifies nonexistent path </some/path/to>/AIT-Core/ait/dsn/cfdp/datasink/tempfiles
    2020-02-09T19:28:31.331 | WARNING  | Config parameter dsn.cfdp.datasink.pdusink.path specifies nonexistent path </some/path/to>/AIT-Core/ait/dsn/cfdp/datasink/pdusink
    2020-02-09T19:28:31.332 | WARNING  | Config parameter data.1553.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/downlink/1553
    2020-02-09T19:28:31.333 | WARNING  | Config parameter data.bad.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/downlink/bad
    2020-02-09T19:28:31.335 | WARNING  | Config parameter data.lehx.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/downlink/lehx
    2020-02-09T19:28:31.336 | WARNING  | Config parameter data.planning.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/planning
    2020-02-09T19:28:31.339 | WARNING  | Config parameter data.sdos.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/sdos
    2020-02-09T19:28:31.340 | WARNING  | Config parameter data.uplink.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/uplink
    2020-02-09T19:28:31.341 | WARNING  | Config parameter data.ats.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-041/ats
    2020-02-09T19:28:31.429 | WARNING  | No handlers specified for stream log_stream
    2020-02-09T19:28:31.431 | INFO     | Added inbound stream <PortInputStream address=:2514>
    2020-02-09T19:28:31.505 | INFO     | Created handler CCSDSPacketHandler for stream telem_stream
    2020-02-09T19:28:31.508 | INFO     | Added inbound stream <PortInputStream address=:3076>
    2020-02-09T19:28:31.510 | WARNING  | No handlers specified for stream command_stream
    2020-02-09T19:28:31.511 | INFO     | Added outbound stream <PortOutputStream name=command_stream>
    2020-02-09T19:28:31.546 | WARNING  | [GUI Playback Configuration]Unable to locate DataArchive plugin configuration for historical data queries. Historical telemetry playback will be disabled in monitoring UI and server endpoints.
    2020-02-09T19:28:31.549 | INFO     | Running AIT GUI v1.4.0
    2020-02-09T19:28:31.553 | INFO     | Added plugin <Plugin name=AITGUIPlugin>
    2020-02-09T19:28:31.554 | INFO     | Starting <Broker at 0x104d65ef0: _run> greenlet...
    2020-02-09T19:28:31.556 | INFO     | Starting <Plugin name=AITGUIPlugin> greenlet...
    2020-02-09T19:28:31.557 | INFO     | Starting <PortOutputStream name=command_stream> greenlet...
    2020-02-09T19:28:31.558 | INFO     | Starting <PortInputStream address=:2514> greenlet...
    2020-02-09T19:28:31.559 | INFO     | Starting <PortInputStream address=:3076> greenlet...
    2020-02-09T19:28:31.578 | INFO     | Subscribing <Plugin name=AITGUIPlugin> to topic log_stream
    2020-02-09T19:28:31.580 | INFO     | Subscribing <Plugin name=AITGUIPlugin> to topic telem_stream
    2020-02-09T19:28:31.589 | INFO     | Subscribing <PortOutputStream name=command_stream> to topic AITGUIPlugin
    2020-02-09T19:28:31.591 | INFO     | Starting broker...
  4. Run ccsds formatted packet in the different terminal. $/AIT-Core/ait/core/bin/ait_ccsds_send_example.py

    
    import socket
    import struct
    import time
    from ait.core import log, tlm

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) hs_packet = struct.Struct('>BBBBBBBBBBBBBBBB') data = bytearray(b'\x02\xE7\x40\x00\x00\x0B\x00\x00\x00\x01\x01\x71\x0C\x41\x00\x01’)

'''

CCSDS Packet

version: 000 type: 0 secondary header flag: 0 apid: 01011100111 #743# sequence flag: 01 sequence count: 00000000 000000 packet length: 00000000 00001011 time_coars 00000000 00000000 00000000 00000001 time_fine 0000 0001 time_id 01 checkword_indicator 1 zoe 1 packet_type 0001

0 element_id 0001 data_packet 1 version_id 0001 format_id 000001 00000000 frame_id 00000001 ''' buf = hs_packet.pack(*data) host = 'localhost' port = 3076 while True: s.sendto(buf, (host, port)) log.info('Sent telemetry (%d bytes) to %s:%d' % (hs_packet.size, host, port)) time.sleep(1) ``` ``` (ait) $ ./ait_ccsds_send_example.py 2020-02-23T18:55:15.397 | WARNING | Config parameter command.history.filename specifies nonexistent path /cmdhist.pcap 2020-02-23T18:55:15.399 | WARNING | Config parameter dsn.cfdp.mib.path specifies nonexistent path /AIT-Core/config/mib 2020-02-23T18:55:15.401 | WARNING | Config parameter dsn.cfdp.datasink.outgoing.path specifies nonexistent path /AIT-Core/ait/dsn/cfdp/datasink/outgoing 2020-02-23T18:55:15.403 | WARNING | Config parameter dsn.cfdp.datasink.incoming.path specifies nonexistent path /AIT-Core/ait/dsn/cfdp/datasink/incoming 2020-02-23T18:55:15.404 | WARNING | Config parameter dsn.cfdp.datasink.tempfiles.path specifies nonexistent path /AIT-Core/ait/dsn/cfdp/datasink/tempfiles 2020-02-23T18:55:15.406 | WARNING | Config parameter dsn.cfdp.datasink.pdusink.path specifies nonexistent path /AIT-Core/ait/dsn/cfdp/datasink/pdusink 2020-02-23T18:55:15.408 | WARNING | Config parameter data.1553.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/downlink/1553 2020-02-23T18:55:15.409 | WARNING | Config parameter data.bad.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/downlink/bad 2020-02-23T18:55:15.411 | WARNING | Config parameter data.lehx.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/downlink/lehx 2020-02-23T18:55:15.413 | WARNING | Config parameter data.planning.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/planning 2020-02-23T18:55:15.414 | WARNING | Config parameter data.sdos.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/sdos 2020-02-23T18:55:15.416 | WARNING | Config parameter data.uplink.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/uplink 2020-02-23T18:55:15.418 | WARNING | Config parameter data.ats.path specifies nonexistent path /gds/dev/data/LMC-062858/2020/2020-055/ats 2020-02-23T18:55:15.680 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:16.686 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:17.695 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:18.703 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:19.712 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:20.721 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:21.729 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:22.739 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:23.748 | INFO | Sent telemetry (16 bytes) to localhost:3076 2020-02-23T18:55:24.757 | INFO | Sent telemetry (16 bytes) to localhost:3076   ``` 4. Type `Ctrl`+C to stop `ait_ccsds_send_example.py` and `ait-server`
MJJoyce commented 4 years ago

I'm good with calling this test adequate if we update the unit tests per comments on #239