diff options
author | Dan Sneddon <dsneddon@redhat.com> | 2016-04-13 01:17:16 -0700 |
---|---|---|
committer | Dan Sneddon <dsneddon@redhat.com> | 2016-07-05 10:27:45 -0700 |
commit | 78e1b65d93a1c16d58fd72cb65f8e2adf1762854 (patch) | |
tree | 150a8e2a68c41b0bd76dc17829181e4b4842b1de /os_net_config/objects.py | |
parent | 6bb8412ef3d3f163d91f2884081b743f07a78f18 (diff) |
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
Diffstat (limited to 'os_net_config/objects.py')
-rw-r--r-- | os_net_config/objects.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/os_net_config/objects.py b/os_net_config/objects.py index 9815832..289a0da 100644 --- a/os_net_config/objects.py +++ b/os_net_config/objects.py @@ -52,6 +52,8 @@ def object_from_json(json): return OvsTunnel.from_json(json) elif obj_type == "ovs_patch_port": return OvsPatchPort.from_json(json) + elif obj_type == "ib_interface": + return IbInterface.from_json(json) def _get_required_field(json, name, object_name): @@ -689,3 +691,25 @@ class OvsPatchPort(_BaseOpts): opts = _BaseOpts.base_opts_from_json(json) return OvsPatchPort(name, *opts, bridge_name=bridge_name, peer=peer, ovs_options=ovs_options, ovs_extra=ovs_extra) + + +class IbInterface(_BaseOpts): + """Base class for InfiniBand network interfaces.""" + + def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=None, + routes=None, mtu=None, primary=False, nic_mapping=None, + persist_mapping=False, defroute=True, dhclient_args=None, + dns_servers=None): + addresses = addresses or [] + routes = routes or [] + dns_servers = dns_servers or [] + super(IbInterface, self).__init__(name, use_dhcp, use_dhcpv6, + addresses, routes, mtu, primary, + nic_mapping, persist_mapping, + defroute, dhclient_args, dns_servers) + + @staticmethod + def from_json(json): + name = _get_required_field(json, 'name', 'IbInterface') + opts = _BaseOpts.base_opts_from_json(json) + return IbInterface(name, *opts) |