Merge "Add more bachend keywords"
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
from framework.exceptions.keyword_exception import KeywordException
|
||||
from keywords.cloud_platform.system.storage.objects.system_storage_backend_object import (
|
||||
SystemStorageBackendObject,
|
||||
)
|
||||
from keywords.cloud_platform.system.storage.objects.system_storage_backend_object import SystemStorageBackendObject
|
||||
from keywords.cloud_platform.system.system_table_parser import SystemTableParser
|
||||
|
||||
|
||||
@@ -93,3 +91,18 @@ class SystemStorageBackendOutput:
|
||||
if len(backends) == 0:
|
||||
raise KeywordException(f"No application with name {backend} was found.")
|
||||
return backends[0]
|
||||
|
||||
def is_backend_configured(self, backend: str) -> bool:
|
||||
"""
|
||||
Verifies if Given backend is configured.
|
||||
|
||||
Args:
|
||||
backend (str): backend ceph or ceph-rook.
|
||||
|
||||
Returns:
|
||||
bool: True if backend configured; False otherwise.
|
||||
"""
|
||||
backends = list(filter(lambda item: item.get_backend() == backend, self.system_storage_backends))
|
||||
if len(backends) == 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
from keywords.cloud_platform.command_wrappers import source_openrc
|
||||
from keywords.cloud_platform.system.storage.objects.system_storage_backend_output import SystemStorageBackendOutput
|
||||
@@ -8,11 +9,12 @@ class SystemStorageBackendKeywords(BaseKeyword):
|
||||
This class contains all the keywords related to the 'system storage-backend-*' commands.
|
||||
"""
|
||||
|
||||
def __init__(self, ssh_connection):
|
||||
def __init__(self, ssh_connection: SSHConnection):
|
||||
"""
|
||||
Constructor
|
||||
|
||||
Args:
|
||||
ssh_connection:
|
||||
ssh_connection (SSHConnection) : ssh_connection
|
||||
"""
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
@@ -20,11 +22,30 @@ class SystemStorageBackendKeywords(BaseKeyword):
|
||||
"""
|
||||
Gets the system backend list
|
||||
|
||||
Returns:
|
||||
Returns: list[str]
|
||||
|
||||
"""
|
||||
output = self.ssh_connection.send(source_openrc('system storage-backend-list --nowrap'))
|
||||
output = self.ssh_connection.send(source_openrc("system storage-backend-list --nowrap"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
system_storage_backend_output = SystemStorageBackendOutput(output)
|
||||
|
||||
return system_storage_backend_output
|
||||
|
||||
def system_storage_backend_add(self, backend: str, confirmed: bool = True, deployment_model: str = None):
|
||||
"""
|
||||
Adds the storage backend
|
||||
|
||||
Args:
|
||||
backend (str): the backend ceph or ceph-rook
|
||||
confirmed (bool): True or False
|
||||
deployment_model (str): deployment_model
|
||||
|
||||
"""
|
||||
extra_args = ""
|
||||
if confirmed:
|
||||
extra_args += " --confirmed"
|
||||
if deployment_model:
|
||||
extra_args += f" --deployment {deployment_model}"
|
||||
|
||||
self.ssh_connection.send(source_openrc(f"system storage-backend-add {backend} {extra_args}"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
Reference in New Issue
Block a user