[Manila] Add scenario for creation and deletion of security services
List of changes: - Added support of 'create' and 'delete' operations for security services. - Added benchmark for creating and deleting security services. Change-Id: I26ba499f24d0cc0036fbc3c7b2e7f7239ffad583
This commit is contained in:
parent
044d6f34b1
commit
b779c01ab2
@ -85,3 +85,28 @@
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
ManilaShares.create_security_service_and_delete:
|
||||
{% for s in ("ldap", "kerberos", "active_directory") %}
|
||||
-
|
||||
args:
|
||||
security_service_type: {{s}}
|
||||
dns_ip: "fake_dns_ip"
|
||||
server: "fake-server"
|
||||
domain: "fake_domain"
|
||||
user: "fake_user"
|
||||
password: "fake_password"
|
||||
name: "fake_name"
|
||||
description: "fake_description"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
{% endfor %}
|
||||
|
@ -134,3 +134,35 @@ class ManilaShares(utils.ManilaScenario):
|
||||
"host", "status", "share_network" and "project_id".
|
||||
"""
|
||||
self._list_share_servers(search_opts=search_opts)
|
||||
|
||||
@validation.required_services(consts.Service.MANILA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["manila"]})
|
||||
def create_security_service_and_delete(self, security_service_type,
|
||||
dns_ip=None, server=None,
|
||||
domain=None, user=None,
|
||||
password=None, name=None,
|
||||
description=None):
|
||||
"""Creates security service and then deletes.
|
||||
|
||||
:param security_service_type: security service type, permitted values
|
||||
are 'ldap', 'kerberos' or 'active_directory'.
|
||||
:param dns_ip: dns ip address used inside tenant's network
|
||||
:param server: security service server ip address or hostname
|
||||
:param domain: security service domain
|
||||
:param user: security identifier used by tenant
|
||||
:param password: password used by user
|
||||
:param name: security service name
|
||||
:param description: security service description
|
||||
"""
|
||||
security_service = self._create_security_service(
|
||||
security_service_type=security_service_type,
|
||||
dns_ip=dns_ip,
|
||||
server=server,
|
||||
domain=domain,
|
||||
user=user,
|
||||
password=password,
|
||||
name=name,
|
||||
description=description,
|
||||
)
|
||||
self._delete_security_service(security_service)
|
||||
|
@ -172,3 +172,48 @@ class ManilaScenario(base.Scenario):
|
||||
share_servers = self.admin_clients("manila").share_servers.list(
|
||||
search_opts=search_opts)
|
||||
return share_servers
|
||||
|
||||
@base.atomic_action_timer("manila.create_security_service")
|
||||
def _create_security_service(self, security_service_type, dns_ip=None,
|
||||
server=None, domain=None, user=None,
|
||||
password=None, name=None, description=None):
|
||||
"""Create security service.
|
||||
|
||||
'Security service' is data container in Manila that stores info
|
||||
about auth services 'Active Directory', 'Kerberos' and catalog
|
||||
service 'LDAP' that should be used for shares.
|
||||
|
||||
:param security_service_type: security service type, permitted values
|
||||
are 'ldap', 'kerberos' or 'active_directory'.
|
||||
:param dns_ip: dns ip address used inside tenant's network
|
||||
:param server: security service server ip address or hostname
|
||||
:param domain: security service domain
|
||||
:param user: security identifier used by tenant
|
||||
:param password: password used by user
|
||||
:param name: security service name
|
||||
:param description: security service description
|
||||
:returns: instance of :class:`SecurityService`
|
||||
"""
|
||||
security_service = self.clients("manila").security_services.create(
|
||||
type=security_service_type,
|
||||
dns_ip=dns_ip,
|
||||
server=server,
|
||||
domain=domain,
|
||||
user=user,
|
||||
password=password,
|
||||
name=name,
|
||||
description=description)
|
||||
return security_service
|
||||
|
||||
@base.atomic_action_timer("manila.delete_security_service")
|
||||
def _delete_security_service(self, security_service):
|
||||
"""Delete security service.
|
||||
|
||||
:param security_service: instance of :class:`SecurityService`.
|
||||
"""
|
||||
security_service.delete()
|
||||
utils.wait_for_delete(
|
||||
security_service,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
"ManilaShares.create_security_service_and_delete": [
|
||||
{
|
||||
"args": {
|
||||
"security_service_type": "active_directory",
|
||||
"dns_ip": "fake_dns_ip",
|
||||
"server": "fake-server",
|
||||
"domain": "fake_domain",
|
||||
"user": "fake_user",
|
||||
"password": "fake_password",
|
||||
"name": "fake_name",
|
||||
"description": "fake_description"
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 1,
|
||||
"users_per_tenant": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
ManilaShares.create_security_service_and_delete:
|
||||
-
|
||||
args:
|
||||
security_service_type: "active_directory"
|
||||
dns_ip: "fake_dns_ip"
|
||||
server: "fake-server"
|
||||
domain: "fake_domain"
|
||||
user: "fake_user"
|
||||
password: "fake_password"
|
||||
name: "fake_name"
|
||||
description: "fake_description"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 1
|
||||
users_per_tenant: 1
|
@ -148,3 +148,37 @@ class ManilaSharesTestCase(test.TestCase):
|
||||
|
||||
scenario._list_share_servers.assert_called_once_with(
|
||||
search_opts=search_opts)
|
||||
|
||||
@ddt.data(
|
||||
{"security_service_type": "fake_type"},
|
||||
{"name": "foo_name",
|
||||
"security_service_type": "fake_type",
|
||||
"dns_ip": "fake_dns_ip",
|
||||
"server": "fake_server",
|
||||
"domain": "fake_domain",
|
||||
"user": "fake_user",
|
||||
"password": "fake_password",
|
||||
"description": "fake_description"},
|
||||
)
|
||||
def test_create_security_service_and_delete(self, params):
|
||||
fake_ss = mock.MagicMock()
|
||||
scenario = shares.ManilaShares()
|
||||
scenario._create_security_service = mock.MagicMock(
|
||||
return_value=fake_ss)
|
||||
scenario._delete_security_service = mock.MagicMock()
|
||||
expected_params = {
|
||||
"security_service_type": params.get("security_service_type"),
|
||||
"dns_ip": params.get("dns_ip"),
|
||||
"server": params.get("server"),
|
||||
"domain": params.get("domain"),
|
||||
"user": params.get("user"),
|
||||
"password": params.get("password"),
|
||||
"name": params.get("name"),
|
||||
"description": params.get("description"),
|
||||
}
|
||||
|
||||
scenario.create_security_service_and_delete(**params)
|
||||
|
||||
scenario._create_security_service.assert_called_once_with(
|
||||
**expected_params)
|
||||
scenario._delete_security_service.assert_called_once_with(fake_ss)
|
||||
|
@ -148,3 +148,40 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.admin_clients(
|
||||
"manila").share_servers.list.assert_called_once_with(
|
||||
search_opts=params.get("search_opts", None))
|
||||
|
||||
@ddt.data("ldap", "kerberos", "active_directory")
|
||||
def test__create_security_service(self, ss_type):
|
||||
fake_ss = mock.Mock()
|
||||
self.clients("manila").security_services.create.return_value = fake_ss
|
||||
data = {
|
||||
"security_service_type": ss_type,
|
||||
"dns_ip": "fake_dns_ip",
|
||||
"server": "fake_server",
|
||||
"domain": "fake_domain",
|
||||
"user": "fake_user",
|
||||
"password": "fake_password",
|
||||
"name": "fake_name",
|
||||
"description": "fake_description",
|
||||
}
|
||||
expected = dict(data)
|
||||
expected["type"] = expected.pop("security_service_type")
|
||||
|
||||
result = self.scenario._create_security_service(**data)
|
||||
|
||||
self.assertEqual(fake_ss, result)
|
||||
self.clients(
|
||||
"manila").security_services.create.assert_called_once_with(
|
||||
**expected)
|
||||
|
||||
@mock.patch(BM_UTILS + "get_from_manager")
|
||||
@mock.patch(BM_UTILS + "wait_for_delete")
|
||||
def test__delete_security_service(self, mock_wait_for_delete,
|
||||
mock_get_from_manager):
|
||||
fake_ss = mock.MagicMock()
|
||||
|
||||
self.scenario._delete_security_service(fake_ss)
|
||||
|
||||
fake_ss.delete.assert_called_once_with()
|
||||
mock_get_from_manager.assert_called_once_with()
|
||||
mock_wait_for_delete.assert_called_once_with(
|
||||
fake_ss, update_resource=mock.ANY, timeout=180, check_interval=2)
|
||||
|
Loading…
Reference in New Issue
Block a user