aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-02-24Add a persist_mapping option to the mapping fileSteven Hardy7-20/+81
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
2015-02-24Add mapping option to influence nicN mapping orderSteven Hardy6-33/+184
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
2015-01-15test_cli add stderr/stdout sanity assertionsSteven Hardy1-8/+41
Currently no check for error output on stderr is made, and no sanity checked performed on the stdout string - both yaml and json versions could be empty and the test would still pass. So add sanity assertions for each case so the test is a bit more robust. Change-Id: Iced683ff3365e0766d345a2ce840b69b501fbb54
2015-01-14Derive sample location from test file, not pwdSteven Hardy1-1/+3
Currently test_cli fails if you don't run it from the repository top directory, so instead derive a relative path from the test, which e.g allows you to do nosetests -svx test_cli.py which can be more convenient when debugging. Change-Id: I120065ca17104be7c2f4bf00d3e4e281a3179703
2015-01-14Fix test_cli exit code assertionSteven Hardy1-14/+12
Currently we ignore the actual return code from the main() function, due to the try/catch, which isn't appropriate where we're directly calling the function. Instead assert the return value directly, which will catch failures where main returns a non-zero status. Change-Id: Ic92ca243230f732201f30cc63be5101f70c206bb
2015-01-14Add sample and cli test for simple interface configSteven Hardy3-0/+30
Adds a simple example showing how an individual interface can be configured, e.g outside of a bond etc. Change-Id: I05dcb4fabe718686e306bdc719b32f0fb40c1b5e
2014-12-17Merge "Fix verbose/debug loglevels"Jenkins1-2/+2
2014-12-16Merge "If setting a default route, use default netmask"Jenkins1-2/+5
2014-12-12Correct the ENI provider name log statementDan Prince1-1/+1
Change-Id: I88118836605fade6bc7978b2d65ed51cef0cdc80
2014-12-06Fix verbose/debug loglevelsSteven Hardy1-2/+2
These options seem to be reversed, in most other tools verbose means INFO and debug means DEBUG. Change-Id: I31005e4e10372018685a93dc2f80619f16c513d9
2014-12-05Workflow documentation is now in infra-manualJeremy Stanley1-4/+3
Replace URLs for workflow documentation to appropriate parts of the OpenStack Project Infrastructure Manual. Change-Id: Id21fe13d6c085966549006aa1f5b74c610b8a167
2014-11-24If setting a default route, use default netmaskJames Polley1-2/+5
Without this change, when configuring a default route, it's neccessary to explicitly provide an ip_netmask of 0.0.0.0/0 - otherwise line 177 errors because there's no route.ip_netmask. With this change, it's still possible to provide an ip_netmask for a default route (even though that makes no sense), but if none is provided The Right Thing is done. Change-Id: Idac59e571a72cc8d5693f811ec0121273b891d0f
2014-09-18Add a .gitreview file for os-net-configDan Prince1-0/+4
Change-Id: I3eedbacc359bf6209392b2e69a5a65a055d81390
2014-09-18Update child_members to use a SetDan Prince2-6/+8
Updates the impl_ifcfg.child_members method so that it uses a set instead of an array (this avoids dups). Also fixes an issue with this method which would cause tests to fail intermittently due to ordering differences. Adding each member object regardless solves this (not sure why I had commented out the children.append before) Also fixes an issue in test_cli which causes tests to fail on Debian which doesn't yet support the add_bond method on its ENI provider. This fix was to explicitly set --provider=ifcfg on the failing tests. We should be able to remove these once ENI supports bonding properly. Closes-bug: #1370615 Change-Id: Id9cfa2b2eaab27c93113956f5956facfa2a2aeee
2014-09-04Correct the setup.cfg OS.Dan Prince1-1/+1
2014-09-04Move versioning into version.pyDan Prince3-8/+21
2014-09-04Updated description in README.rstDan Prince1-3/+3
2014-09-04Minor updates to setup.cfg.Dan Prince1-9/+9
2014-08-26README.rst updates per yaml config changesDan Prince1-67/+55
2014-08-25ifcfg: restart child interfaces on updatesDan Prince2-19/+84
If a top level bridge or bond is modified we also want to restart the child interfaces.
2014-08-22Fix a few pep8 issues...Dan Prince2-4/+2
2014-08-22Add ovs_extra to some of the sample configs.Dan Prince2-0/+5
2014-08-22Don't log errors if files don't exists.Dan Prince1-1/+5
Update the utils.get_file_data method so that it doesn't log errors if a file doesn't exist.
2014-08-22Add support for ovs_extra.Dan Prince5-9/+75
Adds support for ovs_extra to the OVS Bridge and OVS bond objects.
2014-08-21A vlan on an OVS bridge doesn't require a deviceDan Prince5-15/+25
Updates the object model so that a VLAN on top of a bridge (an OVS int port) doesn't require a physical device to be set in the object model.
2014-08-21Correct the noop format for the eni providerDan Prince1-1/+1
Corrects the eni provider so that it returns the correct format in noop mode.
2014-08-20Add support for parsing YAMLDan Prince7-4/+117
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.
2014-08-20Add nic1, nic2 naming abstractionDan Prince5-6/+206
Implements a new active NIC abstraction and naming convention that allows nic1, nic2, etc. to be translated to actual (active) network device names like em1, em2 (or eth0, eth1). This includes some logic to map ordered active nics to the nic1, nic2 naming scheme. Embedded nics are always listed first (in sort order) followed by any other active Nics on the system. With the new code: {"type": "interface", "name": "nic1" } is automatically translated (internally) to: {"type": "interface", "name": "em1" } This works for all top level "interface" devices, vlans, bonds, and bridges alike. For vlans the 'device' name is translated instead of the device name per vlan object conventions.
2014-08-15ifcfg: Exclude ifcfg-lo from cleanupDan Prince2-6/+20
This interface should always exist... we don't want to clean it up.
2014-08-14Correct add_object call.Dan Prince1-1/+1
Missed this in 9e515950c7eb4a73e02a4f4883c223dd24ba93ff
2014-08-14Docstring updates to NetConfig objects.Dan Prince3-0/+49
2014-08-14Add --cleanup, and impl for ifcfgDan Prince5-12/+61
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).
2014-08-14Use underscores for provider function names.Dan Prince5-79/+79
2014-08-12Set the MAC to the primary interfaceDan Prince7-13/+121
Adds support for a new 'primary' interface option exposed via the object model and JSON parsers which can be used to force the MAC address on a bridge. Only one interface on a given bridge (or bond) may be set as the primary interface. Also, update the ifcfg and eni providers so that they use OVS_EXTRA (or ovs_extra) to pin the mac accordingly.
2014-08-11Add configuration samples.Dan Prince3-0/+54
2014-08-11Use --noop instead of --mock.Dan Prince4-22/+40
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).
2014-08-11Adds mock ability to the ENI and Ifcfg providersmarios3-8/+28
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
2014-07-10Uncomment the provider.apply callDan Prince1-1/+1
This fixes issues where running os-net-config did nothing.
2014-07-09Add README example docs, etc.Dan Prince1-5/+105
2014-07-09Don't write 'None' to ifcfg route files.Dan Prince2-4/+8
Corrects an issue where 'None' got written into the ifcfg format route files instead of ''.
2014-07-09Add logging to utils.Dan Prince1-1/+11
2014-07-09Add -d and -v options for logging level controlDan Prince1-14/+32
Adds -d (--debug) and -v (--verbose) options to control the log levels.
2014-07-08Add logging to the eni provider.Dan Prince2-5/+28
2014-07-08Add logging to the ifcfg provider.Dan Prince1-0/+22
2014-07-07Add copyrights to files.Dan Prince12-15/+22
2014-07-03ENI: bring up bridges first on DebianDan Prince2-5/+9
We should bring up the interfaces on boot in the same order with which we bring them up in this tool.
2014-07-02ENI: enable 'auto' on bridges by defaultDan Prince2-1/+3
2014-07-02Update impl_eni to set the MTU.Dan Prince1-0/+2
2014-07-02ifcfg: don't call set Interface for vlans...Dan Prince2-5/+0
Drop the 'set Interface $DEVICE external-ids:iface-id=...' config from ifcfg ovs vlans.
2014-07-02Add vlan support for the ENI implementation.Dan Prince2-7/+60