Added senlin action pack

This patch adds senlin action pack into mistral

Change-Id: Ic822bfd3f43e6f6e834dd26bb87387d1eef93a89
Implements-Blueprint: senlin-action-pack
This commit is contained in:
Sharat Sharma 2016-11-09 18:46:20 +05:30
parent fe9677f86d
commit 84f3c1fb9d
5 changed files with 97 additions and 1 deletions

View File

@ -35,6 +35,7 @@ mistralclient = importutils.try_import('mistralclient.api.v2.client')
muranoclient = importutils.try_import('muranoclient.v1.client')
neutronclient = importutils.try_import('neutronclient.v2_0.client')
novaclient = importutils.try_import('novaclient.client')
senlinclient = importutils.try_import('senlinclient.v1.client')
swift_client = importutils.try_import('swiftclient.client')
tackerclient = importutils.try_import('tackerclient.v1_0.client')
troveclient = importutils.try_import('troveclient.v1.client')
@ -761,3 +762,30 @@ class TackerAction(base.OpenStackAction):
@classmethod
def _get_fake_client(cls):
return cls._get_client_class()()
class SenlinAction(base.OpenStackAction):
@classmethod
def _get_client_class(cls):
return senlinclient.Client
def _create_client(self):
ctx = context.ctx()
LOG.debug("Senlin action security context: %s" % ctx)
keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
senlin_endpoint = keystone_utils.get_endpoint_for_project('senlin')
return self._get_client_class()(
endpoint_url=senlin_endpoint.url,
token=ctx.auth_token,
tenant_id=ctx.project_id,
region_name=senlin_endpoint.region,
auth_url=keystone_endpoint.url
)
@classmethod
def _get_fake_client(cls):
return cls._get_client_class()("http://127.0.0.1:8778")

View File

@ -1266,5 +1266,57 @@
"delete_vim": "delete_vim",
"list_vims": "list_vims",
"show_vim": "show_vim"
},
"senlin":{
"_comment": "It uses senlinclient.v1_0.",
"profile_types": "profile_types",
"get_profile_type": "get_profile_type",
"profiles": "profiles",
"create_profile": "create_profile",
"get_profile": "get_profile",
"update_profile": "update_profile",
"delete_profile": "delete_profile",
"validate_profile": "validate_profile",
"policy_types": "policy_types",
"get_policy_type": "get_policy_type",
"policies": "policies",
"create_policy": "create_policy",
"get_policy": "get_policy",
"update_policy": "update_policy",
"delete_policy": "delete_policy",
"validate_policy": "validate_policy",
"clusters": "clusters",
"create_cluster": "create_cluster",
"get_cluster": "get_cluster",
"update_cluster": "update_cluster",
"delete_cluster": "delete_cluster",
"cluster_add_nodes": "cluster_add_nodes",
"cluster_del_nodes": "cluster_del_nodes",
"cluster_resize": "cluster_resize",
"cluster_scale_out": "cluster_scale_out",
"cluster_scale_in": "cluster_scale_in",
"cluster_policies": "cluster_policies",
"get_cluster_policy": "get_cluster_policy",
"cluster_attach_policy": "cluster_attach_policy",
"cluster_detach_policy": "cluster_detach_policy",
"cluster_update_policy": "cluster_update_policy",
"cluster_collect": "cluster_collect",
"check_cluster": "check_cluster",
"recover_cluster": "recover_cluster",
"nodes": "nodes",
"create_node": "create_node",
"get_node": "get_node",
"update_node": "update_node",
"delete_node": "delete_node",
"check_node": "check_node",
"recover_node": "recover_node",
"receivers": "receivers",
"create_receiver": "create_receiver",
"get_receiver": "get_receiver",
"delete_receiver": "delete_receiver",
"events": "events",
"get_event": "get_event",
"actions": "actions",
"get_action": "get_action"
}
}

View File

@ -35,7 +35,8 @@ MODULE_MAPPING = {
'designate': ['designate.domains_list', actions.DesignateAction],
'magnum': ['magnum.bays_list', actions.MagnumAction],
'murano': ['murano.deployments_list', actions.MuranoAction],
'tacker': ['tacker.list_vims', actions.TackerAction]
'tacker': ['tacker.list_vims', actions.TackerAction],
'senlin': ['senlin.get_profile', actions.SenlinAction]
}
EXTRA_MODULES = ['neutron', 'swift', 'zaqar', 'tacker']

View File

@ -359,3 +359,17 @@ class OpenStackActionTest(base.BaseTestCase):
mocked().show_vim.assert_called_once_with(
vim_id="1234-abcd"
)
@mock.patch.object(actions.SenlinAction, '_get_client')
def test_senlin_action(self, mocked):
action_class = actions.SenlinAction
action_class.client_method_name = "get_cluster"
action = action_class(cluster_id='1234-abcd')
action.run()
self.assertTrue(mocked().get_cluster.called)
mocked().get_cluster.assert_called_once_with(
cluster_id="1234-abcd"
)

View File

@ -38,6 +38,7 @@ python-magnumclient>=2.0.0 # Apache-2.0
python-muranoclient>=0.8.2 # Apache-2.0
python-neutronclient>=5.1.0 # Apache-2.0
python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0
python-senlinclient>=0.3.0 # Apache-2.0
python-swiftclient>=2.2.0 # Apache-2.0
python-tackerclient>=0.6.0 # Apache-2.0
python-troveclient>=2.2.0 # Apache-2.0