NASA-AMMOS / NASA-AMMOS/AIT-Core

Consider allowing numeric-form for enum command arguments

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
56
Forks
35
Avg merge
1d 20h
Merged PRs (30d)
3

Description

When sending commands via ait_cmd_send.py, for any enum based arguments, only the string name component is allowed. Consider allowing the numeric version to also be accepted.

Example of a command with integer and enum argument

- !Command
  name:      SEQ_ENABLE_DISABLE
  opcode:    0x0003
  subsystem: CMD
  title: Enable/Disable Sequence
  desc:      |
    This command enables or disabled the specified sequence.  If a
    sequence to be disabled is currently executing, it will be
    interrupted.

  arguments:
    - !Argument
      name:  sequence_id
      desc:  Sequence ID
      units: none
      type:  MSB_U16
      bytes: [0,1]

    - !Argument
      name:  enable
      desc:  Enable
      units: none
      type:  U8
      bytes: 2
      enum:
        0: DISABLED
        1: ENABLED

Using name version of enum:

>> $AIT_ROOT/ait/core/bin/ait_cmd_send.py SEQ_ENABLE_DISABLE 1 ENABLED
2019-06-26T17:16:16.575 | PROGRAM  | /Users/nttoole/dev/ait/git_repos/ait_052919/AIT-Core/ait/core/bin/ait_cmd_send.py SEQ_ENABLE_DISABLE 1 ENABLED
2019-06-26T17:16:16.577 | COMMAND  | Sending to 127.0.0.1:3075: SEQ_ENABLE_DISABLE 1 ENABLED
2019-06-26T17:16:16.579 | PROGRAM  | done.

Using numeric version of enum:

>> $AIT_ROOT/ait/core/bin/ait_cmd_send.py SEQ_ENABLE_DISABLE 1 1
2019-06-26T17:16:23.512 | PROGRAM  | /Users/nttoole/dev/ait/git_repos/ait_052919/AIT-Core/ait/core/bin/ait_cmd_send.py SEQ_ENABLE_DISABLE 1 1
2019-06-26T17:16:23.514 | ERROR    | enable value '1' not in allowed enumerated values.
2019-06-26T17:16:23.515 | PROGRAM  | done.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ait/core/bin/ait_cmd_send.py and trace how enum-based command arguments are validated. Use the SEQ_ENABLE_DISABLE example to check that the numeric value 1 is accepted alongside ENABLED, while the existing command behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.