yaml_tools.oscal

The main init, run, and self-test functions for oscal extract.

Functions

csv_append_id_data(in_ids, prog_opts, uargs)

Append/update column data using ID sets and write a new csv file using

csv_row_match(in_ids, ctl)

Extracted ctl munging from csv_append_id_data loop for testing.

load_input_data(filepath, prog_opts[, use_ssg, debug])

Find and gather the inputs, ie, content file(s) and user control IDs,

munge_file(filepath, prog_opts, uargs)

Munge a CSV file by appending columns.

process_data(filepath, prog_opts, uargs)

Process inputs, print some output.

ssg_ctrl_from_nist(in_id, prog_opts, uargs)

Create a new control in SSG format using the given ID. Give it some

id_set_match(in_ids, id_q, uargs)

Quick set match analysis of ID sets.

self_test(ucfg)

Basic sanity check using import_module.

main([argv])

Collect and process command options/arguments and then process data.

Module Contents

yaml_tools.oscal.csv_append_id_data(in_ids, prog_opts, uargs)[source]

Append/update column data using ID sets and write a new csv file using the given filename with .modified appended to the filename stem.

Parameters:
  • in_ids (List)

  • prog_opts (Dict)

  • uargs (munch.Munch)

Return type:

None

yaml_tools.oscal.csv_row_match(in_ids, ctl)[source]

Extracted ctl munging from csv_append_id_data loop for testing.

Parameters:
  • in_ids (List)

  • ctl (List)

Return type:

List

yaml_tools.oscal.load_input_data(filepath, prog_opts, use_ssg=False, debug=False)[source]

Find and gather the inputs, ie, content file(s) and user control IDs, into a tuple of lists (id_list, file_tuple_list). Load up the queues and return a tuple of both queues and the list of normalized user IDs from filepath.

Parameters:
  • filepath (pathlib.Path)

  • prog_opts (Dict)

  • use_ssg (bool)

  • debug (bool)

Return type:

Tuple[List, Deque, Deque]

yaml_tools.oscal.munge_file(filepath, prog_opts, uargs)[source]

Munge a CSV file by appending columns.

Parameters:
  • filepath (pathlib.Path)

  • prog_opts (Dict)

  • uargs (munch.Munch)

yaml_tools.oscal.process_data(filepath, prog_opts, uargs)[source]

Process inputs, print some output.

Parameters:
  • filepath (pathlib.Path)

  • prog_opts (Dict)

  • uargs (munch.Munch)

yaml_tools.oscal.ssg_ctrl_from_nist(in_id, prog_opts, uargs)[source]

Create a new control in SSG format using the given ID. Give it some levels if it exists in the relevant NIST profiles.

Parameters:
  • in_id (str)

  • prog_opts (Dict)

  • uargs (munch.Munch)

yaml_tools.oscal.id_set_match(in_ids, id_q, uargs)[source]

Quick set match analysis of ID sets.

Parameters:
  • in_ids (List)

  • id_q (Deque)

  • uargs (munch.Munch)

Return type:

Tuple[List, List]

yaml_tools.oscal.self_test(ucfg)[source]

Basic sanity check using import_module.

Parameters:

ucfg (munch.Munch)

yaml_tools.oscal.main(argv=None)[source]

Collect and process command options/arguments and then process data.