ironic.common.trait_based_networking.config_file module

class ironic.common.trait_based_networking.config_file.ConfigFile(filename)[source]

Bases: object

Provides functionality to read TBN configuration files

Basic flow for use goes like:

cf = ConfigFile(“some_tbn_config.yaml”) # File is read(). valid, reasons = cf.validate() if not valid:

# Do something with reasons, like raise an exception and log. return reasons

cf.parse() # If the file is valid, this should parse the config traits = cf.traits() # Get the parsed traits as a list.

parse()[source]

Render contents of configuration file as TBN objects

The result of this method can later be retrieved by calling traits()

read()[source]

Read the YAML YBN configuration file

traits()[source]

Return the parsed traits from the configuration file.

validate()[source]

Check that contents conform to TBN expectations.

Returns:

(valid, reasons): valid is a boolean representing if the

contents passed validation or not, and reasons is a list of strings describing why the contents failed validation if they are not valid.