use keystone v3 API
[doctor.git] / doctor_tests / inspector / vitrage.py
1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 from doctor_tests.identity_auth import get_identity_auth
10 from doctor_tests.identity_auth import get_session
11 from doctor_tests.os_clients import keystone_client
12 from doctor_tests.os_clients import vitrage_client
13
14 from doctor_tests.inspector.base import BaseInspector
15
16
17 class VitrageInspector(BaseInspector):
18
19     def __init__(self, conf, log):
20         super(VitrageInspector, self).__init__(conf, log)
21         self.auth = get_identity_auth()
22         self.keystone = keystone_client(self.conf.keystone_version,
23                                         get_session(auth=self.auth))
24         self.vitrage = vitrage_client(self.conf.vitrage_version,
25                                       get_session(auth=self.auth))
26         self.inspector_url = self.get_inspector_url()
27
28     def get_inspector_url(self):
29         vitrage_endpoint = \
30             self.keystone.session.get_endpoint(
31                 service_type='rca',
32                 interface='publicURL')
33         return '%s/v1/event' % vitrage_endpoint
34
35     def start(self):
36         self.log.info('vitrage inspector start......')
37
38     def stop(self):
39         self.log.info('vitrage inspector stop......')