Skip to content
Snippets Groups Projects
Commit a6be089f authored by Juraj Paluba's avatar Juraj Paluba
Browse files

Merge branch 'implement-node-details' into 'master'

cloud_client: implement node details

See merge request !12
parents 2051efb4 a45778dd
No related branches found
No related tags found
1 merge request!12cloud_client: implement node details
Pipeline #537334 passed
from .cloud_client_base import KypoCloudClientBase from .cloud_client_base import KypoCloudClientBase
from .cloud_client_elements import Image, Limits, QuotaSet, Quota, HardwareUsage from .cloud_client_elements import Image, Limits, QuotaSet, Quota, HardwareUsage, NodeDetails
from .exceptions import KypoException, StackException, StackCreationFailed, \ from .exceptions import KypoException, StackException, StackCreationFailed, \
InvalidTopologyDefinition, StackNotFound InvalidTopologyDefinition, StackNotFound
from .topology_elements import MAN, SecurityGroups, Link, NodeToNodeLinkPair from .topology_elements import MAN, SecurityGroups, Link, NodeToNodeLinkPair
......
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import List from typing import List
from kypo.cloud_commons.cloud_client_elements import Image, QuotaSet, HardwareUsage, Limits from kypo.cloud_commons.cloud_client_elements import Image, NodeDetails, QuotaSet, HardwareUsage, Limits
from kypo.cloud_commons.topology_instance import TopologyInstance from kypo.cloud_commons.topology_instance import TopologyInstance
...@@ -86,6 +86,17 @@ class KypoCloudClientBase(ABC): ...@@ -86,6 +86,17 @@ class KypoCloudClientBase(ABC):
""" """
pass pass
@abstractmethod
def get_node_details(self, terraform_attrs: dict) -> NodeDetails:
"""
Get node details from the Terraform resource attributes.
Note, Terraform attributes are backend specific.
:param terraform_attrs: Terraform resource attributes of the node
:return: Node details
"""
pass
@abstractmethod @abstractmethod
def get_console_url(self, node_id: str, console_type: str) -> str: def get_console_url(self, node_id: str, console_type: str) -> str:
""" """
......
...@@ -164,3 +164,14 @@ class HardwareUsage: ...@@ -164,3 +164,14 @@ class HardwareUsage:
return self.vcpu == other.vcpu and self.ram == other.ram and\ return self.vcpu == other.vcpu and self.ram == other.ram and\
self.instances == other.instances and self.network == other.network and\ self.instances == other.instances and self.network == other.network and\
self.subnet == other.subnet and self.port == other.port self.subnet == other.subnet and self.port == other.port
class NodeDetails:
"""
Defines node (Terraform resource) detail
"""
def __init__(self, image_id: str, status: str, flavor: str) -> None:
self.image_id = image_id
self.status = status
self.flavor = flavor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment