Commit Graph

148 Commits

Author SHA1 Message Date
Andreas Jaeger b5418e5912 Retire repo
This repo was created by accident, use deb-python-os-net-config
instead.

Needed-By: I1ac1a06931c8b6dd7c2e73620a0302c29e605f03
Change-Id: I81894aea69b9d09b0977039623c26781093a397a
2017-04-17 19:27:38 +02:00
Jenkins 9e1a613204 Merge "Enable os-net-config to support and configure NFVSwitch" 2016-08-11 12:31:22 +00:00
Dan Sneddon f96f808028 Fix Linux bond/slave ifup ordering
The latest version of os-net-config is not reliably enabling bonding
when there are no existing bonds on the system. This is due to an
order-of-operations problem where it tries to bring up the bond
before the slave interfaces. This can result in an error because
the bonding module is not present.

This change activates the bond only after the interfaces have been
activated. This should ensure that the bonding module is loaded.

Change-Id: I62e4b10a88168948ed59170285223fb4f8d8de88
Fixes-bug: 1611471
2016-08-09 11:52:06 -07:00
Sarath Kumar 15974244f6 Enable os-net-config to support and configure NFVSwitch
These changes are to generate /etc/sysconf/network-scripts/ifcfg-* and
/etc/sysconfig/nfvswitch configuration files for nfvswitch and its interfaces.
NFVSwitch is a virtual switch implementation based on DPDK for datacenter
workloads with very high throughput needs.

Change-Id: If02edb9c4c54c014f67290fe0c34e2fc73cb95bd
2016-08-02 11:45:46 -07:00
Dan Sneddon 311df0c382 Add adapter teaming support using teamd for ifcfg-systems
This change adds support for Linux adapter teams using teamd to
manage the bonds instead of the kernel bonding module. Adapter
teams using teamd can act like bonds, but also support additional
features and possibly more robust fault tolerance.

This implementation is fairly straightforward, in order to maintain
backward compatibility with templates made for Linux bonds. The only
difference in the syntax between the two is type: team instead of
type: linux_bond, and the bonding_options format is different.

The configuration files for teams should contain the team options
as a JSON string. The options that can be used are documented in
the teamd.conf(5) man page.

If an interface is marked as primary, the priority will be changed
from default 0 to 100, making this interface the preferred one. In
addition, the MAC address of the Team and all member interfaces will
be set to that of the primary interface. At this time, there is no
way to set the priority of link members individually, only the
interface marked primary will have a non-default priority.

This change has been tested on bare metal and worked for a team
with two bonded interfaces using LACP. The team was part of an
OVS bridge, and there was a VLAN interface on the team. Everything
worked as expected. Unit tests are included and passing.

Change-Id: If1d516ce8f9ada76375c3a52c5557d3f7348981a
Implements: blueprint os-net-config-teaming
2016-07-25 21:33:39 +00:00
Jenkins f17add2e8e Merge "Add support for Infiniband interfaces" 2016-07-25 14:41:18 +00:00
Jenkins a08e230b00 Merge "Make os-net-config idempotent with Linux bonds and MAC mapping" 2016-07-19 17:36:54 +00:00
Dan Sneddon 78e1b65d93 Add support for Infiniband interfaces
This patch adds support for Infiniband interfaces. The only difference
between Inifiniband and regular interfaces at this time is that an
interface with type "ib_interface" will have "TYPE=Infiniband" added
to the ifcfg file.

However, the Infiniband interface is implemented as a full new class,
so in the future we can add script functions or additional config
options to the Infiniband interface config if needed.

Unit tests for both the object and the ifcfg implementation are
included. This patch does not include an implementation for systems
that use /etc/network/interfaces (Debian-based systems).

Note that this change has not yet been tested on bare metal with
Infiniband hardware.

Fixes bug: https://bugzilla.redhat.com/show_bug.cgi?id=1326616

Change-Id: Iaeaca9cd71e2cea6147951d49aecc7458be4ca0b
2016-07-05 10:27:45 -07:00
Jenkins 6bb8412ef3 Merge "Add support for OVS patch ports" 2016-07-05 09:15:23 +00:00
Dan Sneddon 6036a16671 Make os-net-config idempotent with Linux bonds and MAC mapping
This small change fixes a serious bug in os-net-config which made
mapping NICs by MAC address not idempotent if Linux bonds were used.

The first time os-net-config runs, it sees the MAC address of each
interface, then it sets up the bond. On subsequent runs, any
non-primary interfaces have taken the MAC address of the primary
interface in the bond. At this time, they all show the same MAC
address. This causes the mapping to fail, and it appears that
the system has fewer matching interfaces than it had before.

The impact of this bug is that bonding doesn't work for
anyone doing mapping by MAC address. This is known to be affecting
installations with a particular 3rd-party Neutron plugin vendor.

This change simply looks for the permanent hardware address under
the bonding_slave directory, if it exists.

Change-Id: I5b0087370f74ecc319d2285b0f9f5f3dd951dbc2
2016-06-30 15:56:52 -07:00
James Slagle 789bd1ea08 Add support for OVS patch ports
OVS patch ports are used to connect two OVS bridges so traffic can flow
between them. This is generally useful for various cases.

Specifically it could be used to connect the bridges created by TripleO
networking configurations (br-ex, etc) to the bridge created by the
multinode networking setup in infra's nodepool (br_pub). This allows the
nodes in a multinode deployment to have connectivity across private
subnets where such traffic is typically firewalled off in public clouds.

Change-Id: I11404106cb3f53734f6fc9a35c22f905a0770245
2016-06-14 17:50:56 -04:00
Jenkins f742dcbda0 Merge "Add some debugging output to ordered_active_nics" 2016-06-14 12:36:55 +00:00
Jenkins 4d88e7f349 Merge "Add support for OVS tunnels" 2016-06-10 15:43:39 +00:00
James Slagle 5a6f63a1ad Add some debugging output to ordered_active_nics
Occassionally I've found myself debugging os-net-config's behavior
related to detecting active nics. This adds a little debugging output to
help see what's going on in the ordered_active_nics function.

Change-Id: If7ea010071d2253b29aaaabb242690ea5fbfb165
2016-05-23 13:34:57 +00:00
Jenkins 60475755e3 Merge "Add warning for no active nics" 2016-04-22 10:52:29 +00:00
James Slagle d325a1a2f8 Add support for OVS tunnels
Adds support for configuring OVS Tunnels via os-net-config. Tunnels are
configured as members of ovs_bridge's where the type is set to
ovs_tunnel. The object also supports setting OVS extra and options so
that additional tunnel data can be defined, such as remote_ip.

Change-Id: I31ac1cbe8a13247a1529c0f99a0aea5807888844
2016-04-13 12:32:22 -04:00
Ben Nemec 34f7198267 Add warning for no active nics
When there are no active nics, strange errors can happen later
in the process of applying the configuration, and it's often not
obvious what caused them.  Logging a warning should make it
easier to track down such problems.

Note that this should never happen legitimately in a TripleO
environment since we always need to have at least one active nic
to even get configuration to the system.  However, it is a valid
case for someone who might be applying a configuration with local
access to a system, so it should be handled sanely.  It's also
helpful in case of future bugs in the active nic checking.

Change-Id: Iaf6d4b1b215b70d61e0857e093a834702829e1b9
Related-Bug: 1569403
2016-04-12 16:55:50 +00:00
Ben Nemec 2af4ee4b87 Normalize operstate value for interfaces
The previous check for an interface operstate only looked for the
literal "UP" in caps, but in my environments I'm seeing operstate
returned as "up" in lower-case, which causes the _is_active_nic
check to fail incorrectly.  Example:

[root@overcloud-controller-0 heat-admin]# cat /sys/class/net/eth0/operstate
up

In this environment os-net-config is failing with the exception
in the linked bug.

Change-Id: I85c2d074ce43673c691523ca146ff7cdfdf1c7ca
Closes-Bug: 1569403
2016-04-12 15:34:15 +00:00
Jenkins 1134091ff1 Merge "Fix typos" 2016-04-12 13:09:24 +00:00
James Slagle 2add867244 Fix typos
Fixes a couple of small types in a docstring and exception message.

Change-Id: Id6977ca50418f9fbdca2d1a26174637968b305a6
2016-04-12 11:33:52 +00:00
Jenkins 2ab73df9e0 Merge "Use interface operstate to determine nic status" 2016-04-11 16:51:38 +00:00
Jenkins 02d87760ee Merge "Bump hacking in test-requirements.txt" 2016-04-11 04:38:38 +00:00
Giulio Fidente 2188cf1651 Use PEERDNS when no dns_servers or use_dhcp is provided
PEERDNS=no ensures resolv.conf is not modified by ifup/ifdown when
restarting an interface.

Closes-bug: #1567004

Change-Id: Idec15d4c1630638ce8362f9d95ae3c09bcae86a3
2016-04-07 16:44:31 +00:00
Dan Prince 876107d89f Bump hacking in test-requirements.txt
Bumps the version of hacking to match that in global-requirements.txt.

Change-Id: I7bb98dc773ce821b025d534f537f1a1704a50f9e
Closes-bug: #1566463
2016-04-06 12:41:49 -04:00
Dan Prince 5f7a330f8c Add MASTER=bond SLAVE=yes to linux bond interfaces
When configuring a linux bond with interfaces we have a bug
(due to a missing unit test) where the interfaces weren't
being configured with MASTER=<bond_name> SLAVE=yes. This
patch adds a unit test to check for the required configuration
and cleans up the logic in impl_ifcfg.py to handle it correctly
by simply checking for the linux_bond_name property which
is already set for us via objects.py.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1323717

Change-Id: Ic632c52265dcbbe6c0ace782e633a2030ad25e6f
Closes-bug: 1566428
2016-04-05 14:01:39 -04:00
Christopher Brown 8792d74c91 Use interface operstate to determine nic status
Fixes lp bug 1555669

Currently _is_active_nic performs multiple checks to see if a link is live.
However some hardware such as Ethernet over USB devices fulfil this criteria.
This causes tripleo deployments to fail if automatic interface naming is used.
We can therefore use operstate to determine if the link is actually up.
https://www.kernel.org/doc/Documentation/networking/operstates.txt
This patch implements this.

Implements: better link state detection
Closes-Bug: #1555669
Change-Id: I0bdd0c987f4f177935df4f7cdcc70f4d99c988a5
Signed-off-by: Christopher Brown <snecklifter@gmail.com>
2016-04-05 16:25:47 +00:00
Jenkins 4da6d609bb Merge "Fix order-of-operations bug in os-net-config restart_interfaces" 2016-03-25 17:35:48 +00:00
Dan Sneddon bfc72bd5ce Fix order-of-operations bug in os-net-config restart_interfaces
The current order of operations of bringing up interfaces starts
with the bridges, and restarts the members of the bridges. This
works well when an OVS bond is part of an OVS bridge, but does not
work well when Linux bonding is used with no bridges (such as in
the case of the Nuage plugin, which creates the bridges outside of
the ifcfg files).

This change will ensure that Linux bonds are brought up first, then
any bridges are brought up, interfaces are brought up next, and the
VLAN interfacs are brought up last. This corrects a race condition
where any VLAN which was brought up before the bond would not be
active, and the VLAN would have to be brought up by hand.

This change also fixes a logging issue where os-net-config would
report that no changes were necessary when changes were made. Now,
the logging messages indicating that "No changes were necessary"
show up when no changes are required, instead of when changes are
actually made.

Change-Id: I1efee3dfd8e8cef01b054bb57a3085cc7eb60372
2016-03-22 10:18:04 -07:00
Jenkins 5d8bb4c6a1 Merge "Use assertTrue/False instead of assertEqual(T/F)" 2016-03-22 16:44:00 +00:00
Jenkins ef02752ebf Merge "py26 is no longer supported by Infra's CI" 2016-03-17 21:47:23 +00:00
Jenkins 4471875a61 Merge "Fix hierarchy for Linux Bonds and Linux Bridges" 2016-03-17 18:32:17 +00:00
Dan Sneddon 3b4a27a3cc Add ability to set IPv6 routes in os-net-config templates
This change adds the ability to write IPv6 routes to the system
NIC configuration. In the ifcfg provider, IPv6 routes must be
written to network-scripts/route6-<interface> rather than
route-interface. This patch checks the next hop, and if it is an
IPv6 address (assumed because of the presence of ":"), then the
route will be written to route6-<interface>. This patch includes
tests to confirm proper operation.

Change-Id: I3563800c774a6082a896c7508f5a92e25418fe63
2016-03-11 10:24:42 -08:00
Dan Sneddon b0b09a65b6 Fix hierarchy for Linux Bonds and Linux Bridges
This change cleans up some of the Linux Bond and Linux Bridge logic
that processes member interfaces and VLANs.

One bug is fixed, where a VLAN might be assigned as a slave
interface on a bond.

Changes were made so that if VLANs are placed under a Linux Bond,
the PHYSDEV is set to the bond, so the device: does not need to
be specified in the config.

This change ensures that if a bridge has a bond and VLANs as members,
that the VLAN will be a member of the bridge and not the bond.

Change-Id: Id329737f0032e781b111741086ded83f378297a7
2016-03-11 10:22:36 -08:00
xinwu 63659fe4a6 Enable os_net_config to configure IVS
This change generates /etc/sysconf/network-scripts/ifcfg-* for ivs.
It also generates /etc/sysconf/ivs configuration file for ivs.
It supports only RedHat at this point.

Indigo Virtual Switch (IVS, https://github.com/floodlight/ivs)
is a virtual switch for Linux. It is compatible with the KVM
hypervisor and leveraging the Open vSwitch kernel module for
packet forwarding. There are three major differences between
IVS and OVS:
1. Each node can have at most one ivs, name is not required.
2. Bond is not allowed to attach to an ivs. It is the SDN
controller's job to dynamically form bonds on ivs.
3. IP address can only be statically assigned.

Change-Id: I276d736794d123405de793c2a4eb2c1ee55a0fad
2016-03-07 18:59:02 -08:00
Jenkins c545e46f8f Merge "launchpad bug 1537330, fix _is_active_nic" 2016-03-02 21:08:49 +00:00
Ian Pilcher 047294481f Allow setting MTU to 1500
There are times when it is desirable to set the MTU of an
"interface" to 1500 -- when the external network and the storage
network are different VLANs on the same physical interface, for
example.

Change-Id: Ic5ea6ad05118fd57c26c898a460c19969de4109d
Closes-Bug: #1539821
2016-02-15 17:55:56 +00:00
xinwu cb4f56f72c launchpad bug 1537330, fix _is_active_nic
The detailed bug description is at
https://bugs.launchpad.net/os-net-config/+bug/1537330

Since kilo, os-net-config starts to support linux bond.
However, the addr_assign_type value of an active member
interface of a linux bond is 3, but not 0. The consequence
of this problem is that the linux bond member links are
never considered as active, this further messes up the
nicX to interface name mapping.

This change checks if device directory exists, instead
of checking the addr_assign_type value. This directory
exists only when the interface is an actual physical
interface.

Change-Id: I8e4c95a2efa809fd236b07cbce1b81a2e774f858
2016-02-12 18:51:44 -08:00
Swapnil Kulkarni (coolsvap) e87fac0224 Use assertTrue/False instead of assertEqual(T/F)
The usage of assertEqual(True/False, ***) should be changed
to a meaningful format of assertTrue/False(***).

Change-Id: Ic15b6ebff7f050c1d516d9d680f362609803da4c
Closes-Bug:#1512207
2016-01-07 12:14:56 +05:30
janonymous c9cc5cf20d py26 is no longer supported by Infra's CI
Python 2.6 support would be dropped by
Infra team from mitaka,CI would no longer be testing it,
so projects should drop it too.

Change-Id: Ic7dc4b74d231c47c28e789941cd30897880cb791
2015-12-26 14:21:47 +05:30
Gonéri Le Bouder f00d545041 ifcfg: add VLAN=yes when needed
Add the VLAN=yes parameter if the interface name is in the foo.123 format.
This is the behavior and Debian allow the same os-net-config configuration
file to be consistent with Red Hat systems.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1283812

Change-Id: Iab2a4861e2231b34899c379963abbef59cf73328
Closes-Bug: #1518449
2015-11-20 16:00:57 -05:00
Jenkins f0c42a7cda Merge "Added natural sort for interfaces in utils.ordered_active_nics()" 2015-11-04 09:44:09 +00:00
Jenkins 7f10579c4a Merge "Support multiple addresses assignment with eni" 2015-10-21 19:37:03 +00:00
bdemers 455cabdee3 Added natural sort for interfaces in utils.ordered_active_nics()
This way device eth10 is after eth9, and not directly after eth1

Change-Id: I81eba97cccf6c4f314f9037d16ee1f244dbade02
Closes-Bug: #1482818
2015-10-19 10:32:20 -04:00
Jenkins a7d9cc1129 Merge "Fix kwarg assignment in objects.py" 2015-10-16 11:23:49 +00:00
Jenkins f885df3946 Merge "Add Linux Bridge capability to os-net-config ifcfg" 2015-10-16 11:23:37 +00:00
Dan Sneddon 20c9887e8b Fix kwarg assignment in objects.py
This change modifies the kwargs in the object instantiation to
use immutable default assignments. This is for object safety,
since a mutable object will not point to a new memory address
on modification. In Python, lists and dicts should not be used
as default assignments for kwargs.

Change-Id: I73993df12ca317161ba32e02a98a5f40ef8904f3
2015-10-12 18:07:52 +00:00
Dan Sneddon d01acefc15 Add Linux Bridge capability to os-net-config ifcfg
This patch adds support for Linux Bridges to os-net-config. This is
done completely with ifcfg files, brctl is not used directly.
Hierarchy is preserved, so a Linux Bridge may have a Linux Bond
as a member, which in turn may have multiple interfaces as members.
This changeset has been updated to include a more specific example
for Linux bridge configuration (that doesn't combine bridging and
bonding).

This change depends on the change to add support for Linux Bonds.

Change-Id: I1ddacd514b02af30139a868071d82cde19b1f946
2015-10-12 11:03:25 -07:00
Jenkins cf68668803 Merge "Add support for Linux Bonding to os-net-config ifcfg" 2015-10-12 07:57:35 +00:00
Jenkins 95a8412bd9 Merge "Support multiple addresses assignment with ifcfg" 2015-10-08 15:49:19 +00:00
Dan Sneddon 62bc734ad5 Add support for Linux Bonding to os-net-config ifcfg
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-05 15:40:12 -07:00