Support Qinling actions in Mistral

An example can be found in the task description.

Remove the cap on networkx library according to:
13644d63c6 (diff-d7d5c6fa7118ea10d88f3afeaef4da77)

Depends-On: https://review.openstack.org/#/c/567971/
Change-Id: I168a32b8c73b4b30224ce8f27bcde9cfa2b8d2ad
Story: 2002014
Task: 19654
This commit is contained in:
Lingxian Kong 2018-05-12 16:03:28 +12:00
parent 8ee525ea68
commit 4fe4198ac8
9 changed files with 75 additions and 4 deletions

View File

@ -130,6 +130,7 @@ python-troveclient==2.2.0
python-vitrageclient==2.0.0
python-zaqarclient==1.0.0
python-zunclient==1.0.0
python-qinlingclient==1.0.0
pytz==2013.6
PyYAML==3.12
reno==2.5.0

View File

@ -21,7 +21,7 @@ SUPPORTED_MODULES = [
'Nova', 'Glance', 'Keystone', 'Heat', 'Neutron', 'Cinder',
'Trove', 'Ironic', 'Baremetal Introspection', 'Swift', 'SwiftService',
'Zaqar', 'Barbican', 'Mistral', 'Designate', 'Magnum', 'Murano', 'Tacker',
'Aodh', 'Gnocchi', 'Glare', 'Vitrage', 'Senlin', 'Zun'
'Aodh', 'Gnocchi', 'Glare', 'Vitrage', 'Senlin', 'Zun', 'Qinling'
]

View File

@ -65,6 +65,7 @@ mistralclient = _try_import('mistralclient.api.v2.client')
muranoclient = _try_import('muranoclient.v1.client')
neutronclient = _try_import('neutronclient.v2_0.client')
novaclient = _try_import('novaclient.client')
qinlingclient = _try_import('qinlingclient.v1.client')
senlinclient = _try_import('senlinclient.v1.client')
swift_client = _try_import('swiftclient.client')
swiftservice = _try_import('swiftclient.service')
@ -974,3 +975,26 @@ class ZunAction(base.OpenStackAction):
endpoint_override="http://127.0.0.1:9517/",
session=session
)
class QinlingAction(base.OpenStackAction):
_service_type = 'function-engine'
@classmethod
def _get_client_class(cls):
return qinlingclient.Client
def _create_client(self, context):
qinling_endpoint = self.get_service_endpoint()
session_and_auth = self.get_session_and_auth(context)
return self._get_client_class()(endpoint_override=qinling_endpoint.url,
session=session_and_auth['session'])
@classmethod
def _get_fake_client(cls):
session = keystone_utils.get_admin_session()
return cls._get_client_class()(
endpoint_override="http://127.0.0.1:7070/",
session=session
)

View File

@ -1305,5 +1305,32 @@
"services_disable": "services.disable",
"services_enable": "services.enable",
"services_list": "services.list"
},
"qinling": {
"_comment": "Qinling v1 actions",
"runtimes_create": "runtimes.create",
"runtimes_list": "runtimes.list",
"runtimes_get": "runtimes.get",
"runtimes_delete": "runtimes.delete",
"functions_create": "functions.create",
"functions_list": "functions.list",
"functions_get": "functions.get",
"functions_update": "functions.update",
"functions_delete": "functions.delete",
"function_executions_create": "function_executions.create",
"function_executions_list": "function_executions.list",
"function_executions_get": "function_executions.get",
"function_executions_delete": "function_executions.delete",
"function_executions_get_log": "function_executions.get_log",
"jobs_create": "jobs.create",
"jobs_list": "jobs.list",
"jobs_get": "jobs.get",
"jobs_update": "jobs.update",
"jobs_delete": "jobs.delete",
"webhooks_create": "webhooks.create",
"webhooks_list": "webhooks.list",
"webhooks_get": "webhooks.get",
"webhooks_update": "webhooks.update",
"webhooks_delete": "webhooks.delete"
}
}

View File

@ -56,7 +56,8 @@ MODULE_MAPPING = {
'gnocchi': ['gnocchi.metric_list', actions.GnocchiAction],
'glare': ['glare.artifacts_list', actions.GlareAction],
'vitrage': ['vitrage.alarm_get', actions.VitrageAction],
'zun': ['zun.containers_list', actions.ZunAction]
'zun': ['zun.containers_list', actions.ZunAction],
'qinling': ['qinling.runtimes_list', actions.QinlingAction]
}
EXTRA_MODULES = ['neutron', 'swift', 'zaqar', 'tacker', 'senlin']

View File

@ -374,3 +374,16 @@ class OpenStackActionTest(base.BaseTestCase):
mocked().containers.get.assert_called_once_with(
container_id="1234-abcd"
)
@mock.patch.object(actions.QinlingAction, '_get_client')
def test_qinling_action(self, mocked):
mock_ctx = mock.Mock()
method_name = "runtimes.get"
action_class = actions.QinlingAction
action_class.client_method_name = method_name
params = {'id': '1234-abcd'}
action = action_class(**params)
action.run(mock_ctx)
self.assertTrue(mocked().runtimes.get.called)
mocked().runtimes.get.assert_called_once_with(id="1234-abcd")

View File

@ -0,0 +1,4 @@
---
features:
- |
Add Mistral actions for Openstack Qinling, the function management service.

View File

@ -13,7 +13,7 @@ Jinja2>=2.10 # BSD License (3 clause)
jsonschema<3.0.0,>=2.6.0 # MIT
keystonemiddleware>=4.17.0 # Apache-2.0
mistral-lib>=0.4.0 # Apache-2.0
networkx<2.0,>=1.10 # BSD
networkx>=1.10 # BSD
oslo.concurrency>=3.26.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.context>=2.20.0 # Apache-2.0
@ -51,6 +51,7 @@ python-ironic-inspector-client>=1.5.0 # Apache-2.0
python-vitrageclient>=2.0.0 # Apache-2.0
python-zaqarclient>=1.0.0 # Apache-2.0
python-zunclient>=1.0.0 # Apache-2.0
python-qinlingclient>=1.0.0 # Apache-2.0
PyJWT>=1.0.1 # MIT
PyYAML>=3.12 # MIT
requests>=2.14.2 # Apache-2.0

View File

@ -10,7 +10,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
keystonemiddleware>=4.17.0 # Apache-2.0
mistral-lib>=0.4.0 # Apache-2.0
mock>=2.0.0 # BSD
networkx<2.0,>=1.10 # BSD
networkx>=1.10 # BSD
nose>=1.3.7 # LGPL
oslotest>=3.2.0 # Apache-2.0
oslo.db>=4.27.0 # Apache-2.0