Skip to content

fix: pass runtime_json to program_switch() in main() - #729

Open
xovishnukosuri wants to merge 1 commit into
p4lang:masterfrom
xovishnukosuri:fix/simple-controller-missing-runtime-json-arg
Open

xovishnukosuri wants to merge 1 commit into
p4lang:masterfrom
xovishnukosuri:fix/simple-controller-missing-runtime-json-arg

Conversation

@xovishnukosuri

Copy link
Copy Markdown

What

program_switch() requires runtime_json as a positional parameter (added in #452). The main() function, which is the entry point when running simple_controller.py directly from the command line, was never updated to pass this argument.

Running simple_controller.py with any valid arguments produces:

TypeError: program_switch() missing 1 required positional argument: 'runtime_json'

Fix

Pass args.runtime_conf_file as runtime_json. This is consistent with how run_exercise.py calls program_switch(), where it passes the runtime JSON file path for use in error messages from validateTableEntry().

Test plan

  • Run simple_controller.py directly with -a, -d, -p, -c arguments against a running BMv2 switch and confirm no TypeError is raised.
  • Confirm error message from validateTableEntry() still includes the file path when a table entry is missing a required priority field.

When runtime_json was added as a required parameter to program_switch()
in commit 071b89a, the main() function was not updated to pass it.
Running simple_controller.py directly from the command line would fail
with TypeError: program_switch() missing 1 required positional argument.

Pass args.runtime_conf_file as runtime_json, consistent with how
run_exercise.py calls program_switch() with the runtime JSON file path.

Signed-off-by: Vishnu Kosuri <xovishnukosuri@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant