diff options
author | James Slagle <jslagle@redhat.com> | 2016-04-11 12:19:51 -0400 |
---|---|---|
committer | James Slagle <jslagle@redhat.com> | 2016-04-13 12:32:22 -0400 |
commit | d325a1a2f8d7c815cbaa016858db053412201b9d (patch) | |
tree | 35033588fa76d32c260076229a4f5f22907406ad /os_net_config/impl_ifcfg.py | |
parent | 1134091ff1a6a0fc9f8dc6fe4d70bf0274728fdd (diff) |
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
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r-- | os_net_config/impl_ifcfg.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 6459bcc..f6b4617 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -177,6 +177,14 @@ class IfcfgNetConfig(os_net_config.NetConfig): self.member_names[base_opt.name] = members if base_opt.bonding_options: data += "BONDING_OPTS=\"%s\"\n" % base_opt.bonding_options + elif isinstance(base_opt, objects.OvsTunnel): + ovs_extra.extend(base_opt.ovs_extra) + data += "DEVICETYPE=ovs\n" + data += "TYPE=OVSTunnel\n" + data += "OVS_BRIDGE=%s\n" % base_opt.bridge_name + data += "OVS_TUNNEL_TYPE=%s\n" % base_opt.tunnel_type + data += "OVS_TUNNEL_OPTIONS=\"%s\"\n" % \ + ' '.join(base_opt.ovs_options) else: if base_opt.use_dhcp: data += "BOOTPROTO=dhcp\n" @@ -356,6 +364,16 @@ class IfcfgNetConfig(os_net_config.NetConfig): if bond.routes: self._add_routes(bond.name, bond.routes) + def add_ovs_tunnel(self, tunnel): + """Add a OvsTunnel object to the net config object. + + :param tunnel: The OvsTunnel object to add. + """ + logger.info('adding ovs tunnel: %s' % tunnel.name) + data = self._add_common(tunnel) + logger.debug('ovs tunnel data: %s' % data) + self.interface_data[tunnel.name] = data + def generate_ivs_config(self, ivs_uplinks, ivs_interfaces): """Generate configuration content for ivs.""" |