Revision c068e75d
b/snf-cyclades-app/synnefo/api/management/commands/subnet-create.py | ||
---|---|---|
96 | 96 |
if not cidr: |
97 | 97 |
raise CommandError("cidr is mandatory") |
98 | 98 |
|
99 |
user_id = common.get_network(id=network_id).userid |
|
100 |
name = options.get["name", None] |
|
101 |
allocation_pools = options.get["allocation_pools", None] |
|
102 |
ipversion = options.get["ipversion", 4] |
|
103 |
gateway = options.get["gateway", ""] |
|
104 |
dhcp = options.get["dhcp", True] |
|
105 |
dns = options.get["dns", None] |
|
106 |
host_routes = options.get["host_routes", None] |
|
99 |
user_id = common.get_network(network_id).userid |
|
100 |
name = options["name"] |
|
101 |
allocation_pools = options["allocation_pools"] |
|
102 |
ipversion = int(options["ipversion"]) |
|
103 |
if not ipversion: |
|
104 |
ipversion = 4 |
|
105 |
gateway = options["gateway"] |
|
106 |
if not gateway: |
|
107 |
gateway = "" |
|
108 |
dhcp = options["dhcp"] |
|
109 |
if not dhcp: |
|
110 |
dhcp = True |
|
111 |
dns = options["dns"] |
|
112 |
host_routes = options["host_routes"] |
|
107 | 113 |
|
108 |
subnets.create(name=name, |
|
109 |
network_id=network_id, |
|
110 |
cidr=cidr, |
|
111 |
allocation_pools=allocation_pools, |
|
112 |
gateway=gateway, |
|
113 |
ipversion=ipversion, |
|
114 |
dhcp=dhcp, |
|
115 |
dns_nameservers=dns, |
|
116 |
host_routes=host_routes, |
|
117 |
user_id=user_id) |
|
114 |
subnets.create_subnet(name=name, |
|
115 |
network_id=network_id, |
|
116 |
cidr=cidr, |
|
117 |
allocation_pools=allocation_pools, |
|
118 |
gateway=gateway, |
|
119 |
ipversion=ipversion, |
|
120 |
dhcp=dhcp, |
|
121 |
slac=dhcp, |
|
122 |
dns_nameservers=dns, |
|
123 |
host_routes=host_routes, |
|
124 |
user_id=user_id) |
Also available in: Unified diff