Console support for clouds (to connect to external devices or services).

pull/1354/head
grossmj 6 years ago
parent 40151cd1fe
commit 1f017a0d1d

@ -46,6 +46,10 @@ class Cloud(BaseNode):
super().__init__(name, node_id, project, manager)
self._nios = {}
self._remote_console_host = ""
self._remote_console_port = 23
self._remote_console_type = "none"
self._remote_console_http_path = "/"
# Populate the cloud with host interfaces if it is not configured
if not ports or len(ports) == 0:
@ -84,12 +88,96 @@ class Cloud(BaseNode):
return {"name": self.name,
"node_id": self.id,
"project_id": self.project.id,
"remote_console_host": self.remote_console_host,
"remote_console_port": self.remote_console_port,
"remote_console_type": self.remote_console_type,
"remote_console_http_path": self.remote_console_http_path,
"ports_mapping": self._ports_mapping,
"interfaces": host_interfaces,
"status": self.status,
"node_directory": self.working_path
}
@property
def remote_console_host(self):
"""
Returns the remote console host for this cloud.
:returns: remote console host
"""
return self._remote_console_host
@remote_console_host.setter
def remote_console_host(self, remote_console_host):
"""
Sets the remote console host for this cloud.
:param remote_console_host: remote console host
"""
self._remote_console_host = remote_console_host
@property
def remote_console_port(self):
"""
Returns the remote console port for this cloud.
:returns: remote console port
"""
return self._remote_console_port
@remote_console_port.setter
def remote_console_port(self, remote_console_port):
"""
Sets the remote console port for this cloud.
:param remote_console_port: remote console port
"""
self._remote_console_port = remote_console_port
@property
def remote_console_type(self):
"""
Returns the remote console type for this cloud.
:returns: remote console host
"""
return self._remote_console_type
@remote_console_type.setter
def remote_console_type(self, remote_console_type):
"""
Sets the remote console type for this cloud.
:param remote_console_type: remote console type
"""
self._remote_console_type = remote_console_type
@property
def remote_console_http_path(self):
"""
Returns the remote console HTTP path for this cloud.
:returns: remote console HTTP path
"""
return self._remote_console_http_path
@remote_console_http_path.setter
def remote_console_http_path(self, remote_console_http_path):
"""
Sets the remote console HTTP path for this cloud.
:param remote_console_http_path: remote console HTTP path
"""
self._remote_console_http_path = remote_console_http_path
@property
def ports_mapping(self):
"""

@ -57,6 +57,13 @@ class CloudHandler:
request.json.get("node_id"),
node_type="cloud",
ports=request.json.get("ports_mapping"))
# add the remote console settings
node.remote_console_host = request.json.get("remote_console_host", node.remote_console_host)
node.remote_console_port = request.json.get("remote_console_port", node.remote_console_port)
node.remote_console_type = request.json.get("remote_console_type", node.remote_console_type)
node.remote_console_http_path = request.json.get("remote_console_http_path", node.remote_console_http_path)
response.set_status(201)
response.json(node)

@ -62,6 +62,24 @@ CLOUD_CREATE_SCHEMA = {
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}
]
},
"remote_console_host": {
"description": "Remote console host or IP",
"type": ["string"]
},
"remote_console_port": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"remote_console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "spice", "http", "https", "none"]
},
"remote_console_http_path": {
"description": "Path of the remote web interface",
"type": "string",
},
"ports_mapping": {
"type": "array",
"items": [
@ -109,6 +127,24 @@ CLOUD_OBJECT_SCHEMA = {
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"remote_console_host": {
"description": "Remote console host or IP",
"type": ["string"]
},
"remote_console_port": {
"description": "Console TCP port",
"minimum": 1,
"maximum": 65535,
"type": ["integer", "null"]
},
"remote_console_type": {
"description": "Console type",
"enum": ["telnet", "vnc", "spice", "http", "https", "none"]
},
"remote_console_http_path": {
"description": "Path of the remote web interface",
"type": "string",
},
"ports_mapping": {
"type": "array",
"items": [

Loading…
Cancel
Save