Revision 2da652e2 kamaki/clients/network/__init__.py
b/kamaki/clients/network/__init__.py | ||
---|---|---|
186 | 186 |
return r.json |
187 | 187 |
|
188 | 188 |
def update_subnet( |
189 |
self, network_id, cidr,
|
|
190 |
name=None, allocation_pools=None, gateway_ip=None, subnet_id=None,
|
|
191 |
ipv6=None, enable_dhcp=None):
|
|
189 |
self, subnet_id,
|
|
190 |
name=None, allocation_pools=None, gateway_ip=None, ipv6=None,
|
|
191 |
enable_dhcp=None): |
|
192 | 192 |
""" |
193 |
:param network_id: (str) used as filter |
|
194 |
:param cidr: (str) used as filter |
|
193 |
:param subnet_id: (str) |
|
195 | 194 |
|
196 | 195 |
:param name: (str) The subnet name |
197 | 196 |
:param allocation_pools: (list of dicts) start/end addresses of |
198 | 197 |
allocation pools: [{'start': ..., 'end': ...}, ...] |
199 | 198 |
:param gateway_ip: (str) |
200 |
:param subnet_id: (str) |
|
201 | 199 |
:param ipv6: (bool) ip_version == 6 if true, 4 if false, used as filter |
202 | 200 |
:param enable_dhcp: (bool) |
203 | 201 |
""" |
204 |
subnet = dict(network_id=network_id, cidr=cidr)
|
|
202 |
subnet = dict() |
|
205 | 203 |
if name not in (None, ): |
206 | 204 |
subnet['name'] = name |
207 | 205 |
if allocation_pools not in (None, ): |
208 | 206 |
subnet['allocation_pools'] = allocation_pools |
209 | 207 |
if gateway_ip not in (None, ): |
210 | 208 |
subnet['gateway_ip'] = gateway_ip |
211 |
if subnet_id not in (None, ): |
|
212 |
subnet['id'] = subnet_id |
|
213 | 209 |
if ipv6 not in (None, ): |
214 | 210 |
subnet['ip_version'] = 6 if ipv6 else 4 |
215 | 211 |
if enable_dhcp not in (None, ): |
216 | 212 |
subnet['enable_dhcp'] = enable_dhcp |
217 |
r = self.subnets_put(json_data=dict(subnet=subnet), success=201) |
|
213 |
r = self.subnets_put( |
|
214 |
subnet_id, json=dict(subnet=subnet), success=200) |
|
218 | 215 |
return r.json['subnet'] |
219 | 216 |
|
220 | 217 |
def delete_subnet(self, subnet_id): |
Also available in: Unified diff