faucet.conf module

Base configuration implementation.

class faucet.conf.Conf(_id, dp_id, conf=None)[source]

Bases: object

Base class for FAUCET configuration.

check_config()[source]

Check config at instantiation time for errors, typically via assert.

conf_diff(other)[source]

Return text diff between two Confs.

conf_hash(subconf=True, ignore_keys=None)[source]

Return hash of keys configurably filtering attributes.

defaults: dict = {}
defaults_types: dict = {}
dyn_finalized = False
dyn_hash = None
finalize()[source]

Configuration parsing marked complete.

ignore_subconf(other, ignore_keys=None)[source]

Return True if this config same as other, ignoring sub config.

merge_dyn(other_conf)[source]

Merge dynamic state from other conf object.

mutable_attrs: frozenset = frozenset({})
set_defaults()[source]

Set default values and run any basic sanity checks.

to_conf()[source]

Return configuration as a dict.

update(conf)[source]

Parse supplied YAML config and sanity check.

exception faucet.conf.InvalidConfigError[source]

Bases: Exception

This error is thrown when the config file is not valid.

faucet.conf.test_config_condition(cond, msg)[source]

Evaluate condition and raise InvalidConfigError if condition True.

Parameters:
  • cond (bool) – Condition on which to raise an error if it is true

  • msg (str) – Message for the error if the condition is true