Revision 447365fe kamaki/clients/network/__init__.py
b/kamaki/clients/network/__init__.py | ||
---|---|---|
290 | 290 |
def delete_port(self, port_id): |
291 | 291 |
r = self.ports_delete(port_id, success=204) |
292 | 292 |
return r.headers |
293 |
|
|
294 |
def update_port( |
|
295 |
self, port_id, network_id, |
|
296 |
name=None, status=None, admin_state_up=None, mac_address=None, |
|
297 |
fixed_ips=None, security_groups=None): |
|
298 |
""" |
|
299 |
:param network_id: (str) |
|
300 |
|
|
301 |
:param name: (str) |
|
302 |
:param status: (str) |
|
303 |
:param admin_state_up: (bool) Router administrative status (UP / DOWN) |
|
304 |
:param mac_address: (str) |
|
305 |
:param fixed_ips: (str) |
|
306 |
:param security_groups: (list) |
|
307 |
""" |
|
308 |
port = dict(network_id=network_id) |
|
309 |
if name: |
|
310 |
port['name'] = name |
|
311 |
if status: |
|
312 |
port['status'] = status |
|
313 |
if admin_state_up not in (None, ): |
|
314 |
port['admin_state_up'] = bool(admin_state_up) |
|
315 |
if mac_address: |
|
316 |
port['mac_address'] = mac_address |
|
317 |
if fixed_ips: |
|
318 |
port['fixed_ips'] = fixed_ips |
|
319 |
if security_groups: |
|
320 |
port['security_groups'] = security_groups |
|
321 |
r = self.ports_put(port_id, json_data=dict(port=port), success=201) |
|
322 |
return r.json['port'] |
Also available in: Unified diff