aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/objects.py
diff options
context:
space:
mode:
authorSarath Kumar <sarath.kutty@bigswitch.com>2016-09-23 15:56:30 -0700
committerSarath Kumar <sarath.kutty@bigswitch.com>2016-09-27 11:12:37 -0700
commit08590fc1a733a7f35958516f90258f1123791f06 (patch)
treead51f97bc312623e5a35faf797468cad2fac4786 /os_net_config/objects.py
parent35823f261506f9256c1a227dd4a2770a0508c62d (diff)
Add options attribute to NFVSwitch
Adding options to NFVSwitch type bridge will give flexibility and avoid specific attributes like 'cpus' in the yaml file (which will now be moved into the options) Change-Id: I4d715b641c54de969b9195b1a4b16195b2d7e595
Diffstat (limited to 'os_net_config/objects.py')
-rw-r--r--os_net_config/objects.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/os_net_config/objects.py b/os_net_config/objects.py
index 8fab1ab..3c67ada 100644
--- a/os_net_config/objects.py
+++ b/os_net_config/objects.py
@@ -628,7 +628,7 @@ class NfvswitchBridge(_BaseOpts):
def __init__(self, name='nfvswitch', use_dhcp=False, use_dhcpv6=False,
addresses=None, routes=None, mtu=1500, members=None,
nic_mapping=None, persist_mapping=False, defroute=True,
- dhclient_args=None, dns_servers=None, cpus=""):
+ dhclient_args=None, dns_servers=None, options=""):
addresses = addresses or []
routes = routes or []
members = members or []
@@ -638,7 +638,7 @@ class NfvswitchBridge(_BaseOpts):
nic_mapping, persist_mapping,
defroute, dhclient_args,
dns_servers)
- self.cpus = cpus
+ self.options = options
self.members = members
for member in self.members:
if isinstance(member, OvsBond) or isinstance(member, LinuxBond):
@@ -667,16 +667,9 @@ class NfvswitchBridge(_BaseOpts):
msg = 'Members must be a list.'
raise InvalidConfigException(msg)
- cpus = ''
- cpus_json = json.get('cpus')
- if cpus_json:
- if isinstance(cpus_json, basestring):
- cpus = cpus_json
- else:
- msg = '"cpus" must be a string of numbers separated by commas.'
- raise InvalidConfigException(msg)
- else:
- msg = 'Config "cpus" is mandatory.'
+ options = json.get('options')
+ if not options:
+ msg = 'Config "options" is mandatory.'
raise InvalidConfigException(msg)
return NfvswitchBridge(name, use_dhcp=use_dhcp, use_dhcpv6=use_dhcpv6,
@@ -684,7 +677,7 @@ class NfvswitchBridge(_BaseOpts):
members=members, nic_mapping=nic_mapping,
persist_mapping=persist_mapping,
defroute=defroute, dhclient_args=dhclient_args,
- dns_servers=dns_servers, cpus=cpus)
+ dns_servers=dns_servers, options=options)
class LinuxTeam(_BaseOpts):