Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch adds a jsonschema for os-net-config's configuration data
and a library function to validate configuration data based on this
schema. Adding schema-based validation allows catching a larger class of
errors (typos, missing required parameters, etc.) for all devices
configurable through os-net-config.
The validation is run in the os-net-config CLI after loading the config
file. If the config file fails to validate, the current default is to
just log a warning and try to continue. By providing the new CLI option
'--exit-on-validation-errors', this can be changed to log an error and
exist instead.
This validation is meant to be reusable, for example for pre-deployment
validation of network environments (see change
Ic16ee0bc353c46f8fe512454176a07ee95347346). Packaging with os-net-config
makes it easier to keep object model and schema in sync.
Change-Id: Ie4a905863b2d46c88d9cd6c3afc50e7d0a877090
Signed-off-by: Frank A. Zdarsky <fzdarsky@redhat.com>
|
|
This patch improves Python 3 compatibility by replacing .iteritems()
with .items() for iterating over dicts and fixing two tests to use
portable string comparison.
Change-Id: I8e1acafe372f1696823561d6aa8aae5437d34025
Closes-Bug: #1654187
|
|
This patch adds a new --detailed-exit-codes option which can
be used to optionally enable the os-net-config CLI to return
exit code 2 if there have been modifications. Detailed
exit codes are useful if you need to trigger subsequent
external actions based whether os-net-config made changes or not.
Change-Id: I8f22fa15335d1276f4e444a6454a24ff486e1495
|
|
Change-Id: Ice1b8d17804cf7a0aafd308945a5e960fe927bbc
|
|
This patch updates the handling of the --debug and --verbose
options so that if both are specified then log level is set to
DEBUG.
Change-Id: I65d5665631f5575d1c8343bb7c1b197a61e0e176
Closes-bug: #1450586
|
|
Allows you to only install the config, but not take interfaces
down/up. Useful if you wish to defer activation of a new config
until a later time (e.g reboot).
Change-Id: I42f3195e1d3d5d3b9d1c9dbb1f7cf1364503cbd3
|
|
Moving this flag makes it easier to implement additional functions
which work differently depending on noop mode being set, vs passing
it into every function like apply()
Change-Id: I796792aece3e40322523e910a3b87f7ab9a451dd
|
|
This adds the option to permanently rewrite the configuration so the
aliases are used instead of the system name. This is useful where
you have a variety of hardware and you want to have consistent device
naming accross all platforms - this allows you to essentially rename
the interfaces permanently so they match the abstracted nicN names.
Note, this needs to be run with --cleanup or the old (now conflicting)
configs will still be in place, and it may require a reboot before
the changes are fully applied.
Change-Id: I5af146e764b72c4beaa41c549fabff0af8802152
|
|
Currently there's a fixed mapping between abstracted interface
names (nic1, nic2 etc) and the underlying biosdevname for the
device.
In many cases, this mapping based on system enumeration is
sufficient, but in some cases, particularly when you perform
detailed pre-deployment discovery of interfaces, you may wish
to alter the mapping independently of the config (e.g if the
config is in a heat template, and the discovery data is
provided at runtime).
So this adds a -m option to os-net-config, which enables a
mapping file to be provided, such that specific interfaces
may be mapped to their abstract names based on knowledge of
the devices or the networks they are connected to.
The mapping file has the following format, where em1 and em2 are
device names as detected by the OS (e.g biosdevname):
interface_mapping:
nic1: em2
nic2: em1
Or you can use the device MAC instead:
interface_mapping:
nic1: 12:34:56:78:9a:bc
nic2: 12:34:56:de:f0:12
Change-Id: I93e6d3ed733244834bb3c2126c91db705b4d9167
|
|
These options seem to be reversed, in most other tools verbose
means INFO and debug means DEBUG.
Change-Id: I31005e4e10372018685a93dc2f80619f16c513d9
|
|
|
|
Adds new YAML examples. Also adds some new CLI test
cases which compare --noop stdout (from the CLI) for
the json and yaml examples to verify they generate
the same things.
|
|
Missed this in 9e515950c7eb4a73e02a4f4883c223dd24ba93ff
|
|
Adds a new cleanup option which can be used to ifdown and
remove interfaces that exists but aren't specified in
the object model (or JSON).
|
|
Updates the apply() function for each NetConfig object
so that it now accepts noop instead. Also, the updated
files are not returned (always instead of conditionally
if mock was used).
|
|
Specifying mock=True for 'apply' will return a string
representing the changes required, or commands to be used
in order to implement the requested/specified configuration.
This is also exposed to the cli, with -m (--mock), e.g.
os-net-config --mock -c ./etc/example_os_net_config_1.json -p eni
|
|
This fixes issues where running os-net-config did nothing.
|
|
Adds -d (--debug) and -v (--verbose) options to control
the log levels.
|
|
|
|
Adds a new CLI which parses the JSON and calls the configured
provider to apply the configuration.
|