Commit f6f81cd3 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Set a default network type when creating nets

Default type is MAX_FILTERED

Support #3514
parent 7515b22e
......@@ -596,7 +596,11 @@ class network_create(_init_cyclades):
cidr=ValueArgument('explicitly set cidr', '--with-cidr'),
gateway=ValueArgument('explicitly set gateway', '--with-gateway'),
dhcp=FlagArgument('Use dhcp (default: off)', '--with-dhcp'),
type=ValueArgument('explicitly set type', '--with-type')
type=ValueArgument(
'Valid network types are '
'CUSTOM, IP_LESS_ROUTED, MAC_FILTERED (default), PHYSICAL_VLAN',
'--with-type',
default='MAC_FILTERED')
)
@errors.generic.all
......
......@@ -152,7 +152,8 @@ class CycladesClient(CycladesRestClient):
:param geteway: (str)
:param type: (str)
:param type: (str) if None, will use MAC_FILTERED as default
Valid values: CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
:param dhcp: (bool)
......@@ -163,8 +164,7 @@ class CycladesClient(CycladesRestClient):
net['cidr'] = cidr
if gateway:
net['gateway'] = gateway
if type:
net['type'] = type
net['type'] = type or 'MAC_FILTERED'
net['dhcp'] = True if dhcp else False
req = dict(network=net)
r = self.networks_post(json_data=req, success=202)
......
......@@ -311,7 +311,7 @@ class CycladesClient(TestCase):
dhcp=True)
test_args = dict(full_args)
test_args.update(dict(empty=None, full=None))
net_exp = dict(dhcp=False, name=net_name)
net_exp = dict(dhcp=False, name=net_name, type='MAC_FILTERED')
for arg, val in test_args.items():
kwargs = {} if arg == 'empty' else full_args if (
arg == 'full') else {arg: val}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment