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

Merge branch 'feature-ip-semantics' into develop

parents 6150578a 8f91ac18
......@@ -15,6 +15,7 @@ Changes:
[#4352]
- Make wait progress bars in cyclades CLI to count down to timeout instead of
progressing forward [#4352]
- Rename IP commands to new namespace and better names [#4422]
Features:
......
......@@ -246,6 +246,41 @@ Showcase: Create a server
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
ip (Compute/Cyclades)
---------------------
.. code-block:: text
info: Details for an IP
list: List reserved floating IPs
attach: Attach a floating IP to a server
pools: List pools of floating IPs
release: Release a floating IP
detach: Detach a floating IP from a server
reserve: Reserve a floating IP
Showcase: Reserve and attach IP to server
-----------------------------------------
.. code-block:: text
* Enter IP context *
[kamaki]: ip
* Reserve an IP and see servers *
[kamaki]: reserve
123.456.78.9
[kamaki]: /server list
42 My Windows Server
43 My Linux Server
* Attach IP to server
[kamaki]: attach 43 123.456.78.9
.. Note:: In kamaki shell, / is used to access top-level command groups while
working in command group contexts
network (Compute/Cyclades)
--------------------------
......
......@@ -52,6 +52,10 @@ network
Manage compute API networks.
ip
Manage compute API floating IP commands
image
Manage images on Plankton (and Compute).
......@@ -119,14 +123,6 @@ server commands
* firewall Set the server (VM) firewall profile for public networks
* set Set the firewall profile
* get Get the firewall profile
* ip Manage floating IPs for the servers
* attach Attach a floating ip to a server with server_id
* info A floating IPs' details
* detach Detach floating ip from server
* list List all floating ips
* create Create a new floating IP
* delete Delete a floating ip
* pools List all floating pools of floating ips
* info Detailed information on a Virtual Machine
* list List Virtual Machines accessible by user
* metadata Manage a server metadata
......@@ -188,6 +184,17 @@ network commands
* rename Set the name of a network
ip commands
***********
* info Details for an IP
* list List reserved floating IPs
* attach Attach a floating IP to a server
* pools List pools of floating IPs
* release Release a floating IP
* detach Detach a floating IP from a server
* reserve Reserve a floating IP
file commands
**************
......
......@@ -179,7 +179,6 @@ command group (server) and of a command in that group (list).
console: Get a VNC console to access an existing virtual server
addr: List the addresses of all network interfaces on a virtual server
firewall: Manage virtual server firewall profiles for public networks
ip: Manage floating IPs for the servers
create: Create a server (aka Virtual Machine)
list: List Virtual Machines accessible by user
reboot: Reboot a virtual server
......
......@@ -51,7 +51,8 @@ from kamaki.cli.commands import (
server_cmds = CommandTree('server', 'Cyclades/Compute API server commands')
flavor_cmds = CommandTree('flavor', 'Cyclades/Compute API flavor commands')
network_cmds = CommandTree('network', 'Cyclades/Compute API network commands')
_commands = [server_cmds, flavor_cmds, network_cmds]
ip_cmds = CommandTree('ip', 'Cyclades/Compute API floating ip commands')
_commands = [server_cmds, flavor_cmds, network_cmds, ip_cmds]
about_authentication = '\nUser Authentication:\
......@@ -1093,14 +1094,9 @@ class network_wait(_init_cyclades, _network_wait):
self._run(network_id=network_id, current_status=current_status)
@command(server_cmds)
class server_ip(_init_cyclades):
"""Manage floating IPs for the servers"""
@command(server_cmds)
class server_ip_pools(_init_cyclades, _optional_json):
"""List all floating pools of floating ips"""
@command(ip_cmds)
class ip_pools(_init_cyclades, _optional_json):
"""List pools of floating IPs"""
@errors.generic.all
@errors.cyclades.connection
......@@ -1113,9 +1109,9 @@ class server_ip_pools(_init_cyclades, _optional_json):
self._run()
@command(server_cmds)
class server_ip_list(_init_cyclades, _optional_json):
"""List all floating ips"""
@command(ip_cmds)
class ip_list(_init_cyclades, _optional_json):
"""List reserved floating IPs"""
@errors.generic.all
@errors.cyclades.connection
......@@ -1128,23 +1124,26 @@ class server_ip_list(_init_cyclades, _optional_json):
self._run()
@command(server_cmds)
class server_ip_info(_init_cyclades, _optional_json):
"""A floating IPs' details"""
@command(ip_cmds)
class ip_info(_init_cyclades, _optional_json):
"""Details for an IP"""
@errors.generic.all
@errors.cyclades.connection
def _run(self, ip):
self._print(self.client.get_floating_ip(ip), self.print_dict)
def main(self, ip):
def main(self, IP):
super(self.__class__, self)._run()
self._run(ip=ip)
self._run(ip=IP)
@command(server_cmds)
class server_ip_create(_init_cyclades, _optional_json):
"""Create a new floating IP"""
@command(ip_cmds)
class ip_reserve(_init_cyclades, _optional_json):
"""Reserve a floating IP
An IP is reserved from an IP pool. The default IP pool is chosen
automatically, but there is the option if specifying an explicit IP pool.
"""
arguments = dict(pool=ValueArgument('Source IP pool', ('--pool'), None))
......@@ -1153,28 +1152,30 @@ class server_ip_create(_init_cyclades, _optional_json):
def _run(self, ip=None):
self._print([self.client.alloc_floating_ip(self['pool'], ip)])
def main(self, requested_address=None):
def main(self, requested_IP=None):
super(self.__class__, self)._run()
self._run(ip=requested_address)
self._run(ip=requested_IP)
@command(server_cmds)
class server_ip_delete(_init_cyclades, _optional_output_cmd):
"""Delete a floating ip"""
@command(ip_cmds)
class ip_release(_init_cyclades, _optional_output_cmd):
"""Release a floating IP
The release IP is "returned" to the IP pool it came from.
"""
@errors.generic.all
@errors.cyclades.connection
def _run(self, ip):
self._optional_output(self.client.delete_floating_ip(ip))
def main(self, ip):
def main(self, IP):
super(self.__class__, self)._run()
self._run(ip=ip)
self._run(ip=IP)
@command(server_cmds)
class server_ip_attach(_init_cyclades, _optional_output_cmd):
"""Attach a floating ip to a server with server_id
@command(ip_cmds)
class ip_attach(_init_cyclades, _optional_output_cmd):
"""Attach a floating IP to a server
"""
@errors.generic.all
......@@ -1183,14 +1184,14 @@ class server_ip_attach(_init_cyclades, _optional_output_cmd):
def _run(self, server_id, ip):
self._optional_output(self.client.attach_floating_ip(server_id, ip))
def main(self, server_id, ip):
def main(self, server_id, IP):
super(self.__class__, self)._run()
self._run(server_id=server_id, ip=ip)
self._run(server_id=server_id, ip=IP)
@command(server_cmds)
class server_ip_detach(_init_cyclades, _optional_output_cmd):
"""Detach floating IP from server
@command(ip_cmds)
class ip_detach(_init_cyclades, _optional_output_cmd):
"""Detach a floating IP from a server
"""
@errors.generic.all
......@@ -1199,6 +1200,6 @@ class server_ip_detach(_init_cyclades, _optional_output_cmd):
def _run(self, server_id, ip):
self._optional_output(self.client.detach_floating_ip(server_id, ip))
def main(self, server_id, ip):
def main(self, server_id, IP):
super(self.__class__, self)._run()
self._run(server_id=server_id, ip=ip)
self._run(server_id=server_id, ip=IP)
......@@ -84,6 +84,7 @@ DEFAULTS = {
'server_cli': 'cyclades',
'flavor_cli': 'cyclades',
'network_cli': 'cyclades',
'ip_cli': 'cyclades',
'image_cli': 'image',
'config_cli': 'config',
'history_cli': 'history'
......
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