diff options
author | Dan Prince <dprince@redhat.com> | 2014-07-01 16:54:25 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2014-07-01 16:54:25 -0400 |
commit | 50290b0e45429c207a5640979f3b0eee7aabfe20 (patch) | |
tree | b099344a07ec7bec47832a055c25d820313b49ae /os_net_config/__init__.py | |
parent | a58503a27b67571b8a534b43fc7e614b5557b64e (diff) |
Add os-net-config CLI
Adds a new CLI which parses the JSON and calls the configured
provider to apply the configuration.
Diffstat (limited to 'os_net_config/__init__.py')
-rw-r--r-- | os_net_config/__init__.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/os_net_config/__init__.py b/os_net_config/__init__.py index e2232e4..484863a 100644 --- a/os_net_config/__init__.py +++ b/os_net_config/__init__.py @@ -15,6 +15,8 @@ import pbr.version +from os_net_config import objects + __version__ = pbr.version.VersionInfo( 'os_net_config').version_string() @@ -26,16 +28,30 @@ class NotImplemented(Exception): class NetConfig(object): """Configure network interfaces using the ifcfg format.""" + def addObject(self, obj): + if isinstance(obj, objects.Interface): + self.addInterface(obj) + elif isinstance(obj, objects.Vlan): + self.addVlan(obj) + elif isinstance(obj, objects.OvsBridge): + self.addBridge(obj) + for member in obj.members: + self.addObject(member) + elif isinstance(obj, objects.OvsBond): + self.addBond(obj) + for member in obj.members: + self.addObject(member) + def addInterface(self, interface): raise NotImplemented("addInterface is not implemented.") - def addVlan(self, bridge): + def addVlan(self, vlan): raise NotImplemented("addVlan is not implemented.") def addBridge(self, bridge): raise NotImplemented("addBridge is not implemented.") - def addBond(self, bridge): + def addBond(self, bond): raise NotImplemented("addBond is not implemented.") def apply(self): |