aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.py
AgeCommit message (Collapse)AuthorFilesLines
2015-10-05Add support for Linux Bonding to os-net-config ifcfgDan Sneddon1-0/+47
This change adds support for Linux Bonding to the impl_ifcfg in os-net-config. This change adds support for configuring Linux Bonds using the Bonding module rather than Open vSwitch. Most of the options for Linux Bonds are the same as OVS, with the exception of bonding_options instead of ovs_options. Change-Id: If8c6de1554234277843de9fac58536dd5b0a941b
2015-10-01Merge "ifcfg: Add support for dns_servers"Jenkins1-0/+6
2015-09-23ifcfg: Add support for dns_serversDan Prince1-0/+6
Adds in the ability to optionally configure DNS server settings via the ifcfg file formats. The dns_servers JSON is an array which currently supports either 1 or 2 DNS servers (per limitations of the ifcfg format). Change-Id: I9edecfdd4e1d0f39883b72be554cd92c5685881d
2015-08-17Support multiple addresses assignment with ifcfgTomoki Sekiyama1-5/+10
Currently only the first IPv4/v6 address is assigned to a NIC even if multiple addresses are specified in config file. With this change, ifcfg implementation can configure multiple IPv4/v6 addresses for a NIC. Also this enables os-net-config to configure IPv6 netmasks. Change-Id: I31b39abae36e0620dbbcb1001fa51f5ca2bd9ea2
2015-08-17os-net-config: ensure ifup is called just onceDan Prince1-1/+1
This patch fixes an issue in the ifcfg provider implementation that caused interfaces to be started twice. This can cause failures if the interface uses DHCP and dhclient was already running. The child_members function was incorrectly adding the interface name to the child members set on key error. This patch removes that logic and simply ignores key errors. Change-Id: Ibe0e32bc09979bc68b92a722b2bfa383e77502a9 Closes-bug: #1485634
2015-08-02Allow to specify the root directory of the filesystemFrederic Lepied1-7/+7
Change-Id: Ice1b8d17804cf7a0aafd308945a5e960fe927bbc
2015-07-01Add support for dhclient_argsDan Prince1-0/+2
This patch adds an optional flag that can be used to pass in args for dhclient when using DHCP. This use case for this is to be able to control which DHCP options dhclient listens for and we can thus disable specific options (like routing) for some network configurations. Change-Id: Ic21de0615ea0ef304843c55cc5abe43cb1771169
2015-06-09Set primary interface on OVS bondsDan Sneddon1-1/+9
This change sets one of the member interfaces of a bond as the primary interface, which results in that interface being the active slave. This change adds a step to the apply method in impl_ifcfg which runs 'ovs-appctl bond/set-active-slave <bond> <iface>' after bringing up the bond interfaces. This step ensures that the bonds work correctly without LACP switch support. If a member interface on the bond is set as primary, that interface will be used. Co-Authored-By: Dan Prince <dprince@redhat.com> Change-Id: I795bb3b8ef977f9276bfec062b197c473393942e
2015-06-04Merge "Don't set OVSDHCPINTERFACES if bridge is static"Jenkins1-1/+2
2015-06-03Don't set OVSDHCPINTERFACES if bridge is staticDan Prince1-1/+2
Updates the ifcfg provider so that we don't set the OVSDHCPINTERFACES config setting if the interface is private. This doesn't seem to cause any functional issues but it is not required and can be confusing. Change-Id: I9d51905df87969ae1b221680e8f0b5befc7b6bfe
2015-06-03ifcfg: don't set VLAN=yes if is an ovs_portDan Prince1-3/+5
When using the ifcfg provider vlans on bridges (or bonds) fail to startup correctly. This is because VLANs on an OVS bridge are configured as internal ports and these should not have the VLAN=yes or PHYSDEV ifcfg settings specified. Change-Id: Ieb743eda8f0a25cdaca43bdea767af26bf504f15 Closes-bug: #1453904
2015-05-14Add NM_CONTROLLED=no to each interface configurationDan Sneddon1-0/+1
In order to allow os-net-config to coexist with NetworkManager, this patch adds NM_CONTROLLED=no to the top of each interface configuration. This ensures that NetworkManager will not mess with interfaces that are configured by os-net-config. Change-Id: I9d226e032eb1cb411b6ea617936f4425c7fd2c74
2015-05-11Add flag for DEFROUTE=no in ifcfg files to ignore DHCP gatewayDan Sneddon1-0/+2
When multiple interfaces are configured with DHCP, and more than one interface receives a gateway from the DHCP server(s), the resulting default gateway on the system is unpredictable. This change adds the "defroute" boolean to the configuration syntax for os-net-config. Any interface type may be marked so that the gateway received from the DHCP server will not be eligible as a default gateway for the system. This only works for ifcfg files, /etc/network/interfaces lacks an equivalent option. Change-Id: Id775f3506b2ec60c9a2833efd49fb8319151c00d Closes-Bug: 1449288
2015-03-19Mark ENI files as autogeneratedDan Prince1-1/+2
End users may not realize these files are autogenerated and may be surprised if they make changes to the /etc/sysconfig/network-scripts files which are then overwritten on reboot. Change-Id: I526c228463bd10de2cf3724aa4159b63a9aeff80
2015-03-05Enable renaming of interfaces without rebootSteven Hardy1-0/+9
When using persist_mapping to rename nics, you can either use --no-activate then reboot, or with this patch, allow activation and we'll take the device links down and rename on the fly avoiding the need for a reboot. Change-Id: Ife9486c9f5447e9c7a55f90ba075e22b6344ad67
2015-03-05Add a --no-activate option to disable device up/down actionsSteven Hardy1-9/+15
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
2015-02-24Refactor ifup/ifdown into base-classSteven Hardy1-11/+7
Refactor some common code so the base-class handles the ifup/down Change-Id: Id1fee1d2d5c9315717611b7bf18f058c49fe3622
2015-02-24Refactor noop to enable logging of disabled operationsSteven Hardy1-24/+13
Currently we only output the config file contents in noop mode, but it's very useful to see what would be done in terms of taking interfaces up and down, and especially what will be removed when --cleanup mode is specified So this refactors the operations skipped by noop into the base-class so we can conveniently log what they would do when --noop is selected. Change-Id: Ia9cfa9a05b2df02c165a2ff992765ab63e55ae6b
2015-02-24Remove deprecated references to oslo-incubatorSteven Hardy1-1/+1
Purge references to modules which have been deprecated by various oslo libraries. Requires changes to use oslo.utils and oslo.concurrency, which are added to the requirements, syncing with the latest in global requirements so we can also move to the un-namespaced oslo package names. Change-Id: Idacb71b7871330e3b3fabf4a926a5b8987614c4d
2015-02-24Move noop flag to provider base-classSteven Hardy1-4/+5
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
2015-02-24Add a persist_mapping option to the mapping fileSteven Hardy1-0/+2
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
2014-09-18Update child_members to use a SetDan Prince1-4/+4
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-08-25ifcfg: restart child interfaces on updatesDan Prince1-14/+29
If a top level bridge or bond is modified we also want to restart the child interfaces.
2014-08-22Add support for ovs_extra.Dan Prince1-2/+9
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 Prince1-1/+2
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-15ifcfg: Exclude ifcfg-lo from cleanupDan Prince1-5/+7
This interface should always exist... we don't want to clean it up.
2014-08-14Docstring updates to NetConfig objects.Dan Prince1-0/+16
2014-08-14Add --cleanup, and impl for ifcfgDan Prince1-9/+36
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 Prince1-14/+14
2014-08-12Set the MAC to the primary interfaceDan Prince1-0/+4
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-11Use --noop instead of --mock.Dan Prince1-10/+13
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 providersmarios1-4/+11
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-09Don't write 'None' to ifcfg route files.Dan Prince1-2/+2
Corrects an issue where 'None' got written into the ifcfg format route files instead of ''.
2014-07-08Add logging to the eni provider.Dan Prince1-2/+7
2014-07-08Add logging to the ifcfg provider.Dan Prince1-0/+22
2014-07-07Add copyrights to files.Dan Prince1-0/+2
2014-07-02ifcfg: don't call set Interface for vlans...Dan Prince1-3/+0
Drop the 'set Interface $DEVICE external-ids:iface-id=...' config from ifcfg ovs vlans.
2014-07-01Remove some extra print statements.Dan Prince1-2/+0
2014-06-26Add OvsBond object and impl for ifcfg format.Dan Prince1-13/+33
Supports the configuration of OVS bond interfaces. Also adds the ability to configure extra OVS_OPTIONS for both bonds and bridges (useful for some modes of operation)
2014-06-25Vlan object and support for ifcfg.Dan Prince1-27/+40
Add ifcfg configuration support for Vlans and Vlan OVS ports.
2014-06-11Add OvsBridge configuration supportDan Prince1-9/+57
Adds new object for OvsBridge. Also update the ifcfg network config class to support adding bridges. As part of the change both the bridge and interface classes extend a _BaseOpts base class.
2014-06-10Implement apply for ifcfg implementationDan Prince1-21/+35
Adds an apply function to the ifcfg implementation which: 1) Shuts down existing interfaces w/ ifdown 2) writes new interfaces config files (routes too) 3) Starts up new interfaces w/ ifup
2014-06-09Initial ifcfg implementation for interfaces/routesDan Prince1-0/+93
Ifcfg formatted persistence for interfaces and routes.