diff options
author | Dan Prince <dprince@redhat.com> | 2014-06-11 13:52:12 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2014-06-11 13:52:12 -0400 |
commit | 9110ad5fd4fa829a070d79da1f926758b15d5f10 (patch) | |
tree | 6ee2ed2e10d36a5e790ea26a0f999372322923fe /os_net_config/objects.py | |
parent | 86230e11d10a9a605f1eaaf9ab3619875224eb3d (diff) |
Add OvsBridge configuration support
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.
Diffstat (limited to 'os_net_config/objects.py')
-rw-r--r-- | os_net_config/objects.py | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/os_net_config/objects.py b/os_net_config/objects.py index 4b6e09e..c4f5600 100644 --- a/os_net_config/objects.py +++ b/os_net_config/objects.py @@ -40,8 +40,8 @@ class Address(object): self.routes = routes -class Interface(object): - """Base class for network interfaces.""" +class _BaseOpts(object): + """Base abstraction for logical port options.""" def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=[], routes=[], mtu=1500): @@ -51,7 +51,7 @@ class Interface(object): self.use_dhcpv6 = use_dhcpv6 self.addresses = addresses self.routes = routes - self.bridge = None + self.bridge_name = None self.type = None def v4_addresses(self): @@ -69,3 +69,26 @@ class Interface(object): v6_addresses.append(addr) return v6_addresses + + +class Interface(_BaseOpts): + """Base class for network interfaces.""" + + def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=[], + routes=[], mtu=1500): + super(Interface, self).__init__(name, use_dhcp, use_dhcpv6, addresses, + routes, mtu) + + +class OvsBridge(_BaseOpts): + """Base class for OVS bridges.""" + + def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=[], + routes=[], members=[], mtu=1500): + super(OvsBridge, self).__init__(name, use_dhcp, use_dhcpv6, addresses, + routes, mtu) + self.type = 'ovs_bridge' + self.members = members + for member in self.members: + member.bridge_name = name + member.type = 'ovs_port' |