ironic.common.inspection_rules.tester module¶
Test inspection rules against captured hardware inventory.
This module runs the inspection rules evaluation process to help test and
debug inspection rules before deploying them to a production environment.
It backs the ironic-manage inspection-rules check command.
- class ironic.common.inspection_rules.tester.FakeNode(data)[source]¶
Bases:
objectFake node built from ‘openstack baremetal node show’ output.
- class ironic.common.inspection_rules.tester.FakeTask(node)[source]¶
Bases:
objectMinimal fake task object for testing.
- class ironic.common.inspection_rules.tester.InspectionRulesEvaluator(node_file, inventory_file, rules_file)[source]¶
Bases:
objectEvaluator for testing inspection rules against hardware inventory.
- ironic.common.inspection_rules.tester.check_files(node_file, inventory_file, rules_file)[source]¶
Evaluate inspection rules against a single set of captured files.
- Parameters:
node_file – JSON or YAML file with node data, e.g. from
openstack baremetal node show <node> -f json.inventory_file – JSON or YAML file with hardware inventory and plugin data, e.g. from
openstack baremetal node inventory save.rules_file – YAML file with the inspection rules to evaluate.
- Returns:
an exit code, 0 on success.
- ironic.common.inspection_rules.tester.run_suite(data_dir, rules_file)[source]¶
Run the inspection rules tester against all test cases in a tree.
Each subdirectory of
data_diris one test case and must contain a node file (node.yamlornode.json) and an inventory file (inventory.yamlorinventory.json). The rules inrules_fileare evaluated against every test case.- Parameters:
data_dir – directory containing test case subdirectories.
rules_file – YAML file with the inspection rules to evaluate.
- Returns:
an exit code, 0 when all test cases pass.