Integration between Monasca and Ceilometer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

monasca_test_setup.py 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. #
  14. import ceilometer
  15. import os
  16. import shutil
  17. ceilo_dir = os.path.dirname(ceilometer.__file__)
  18. ceilosca_files = {
  19. 'ceilosca/ceilometer/' + file: '%s/%s' % (ceilo_dir, file)
  20. for file in
  21. [
  22. 'monasca_client.py',
  23. 'monasca_opts.py',
  24. 'publisher/monasca_data_filter.py',
  25. 'publisher/monasca.py'
  26. ]
  27. }
  28. # Copy the files to ceilometer venv dir. without this step
  29. # python cannot load our files for unit testing
  30. for src, dest in ceilosca_files.items():
  31. shutil.copyfile(src, dest)
  32. ceilo_parent_dir = os.path.dirname(os.path.abspath(
  33. os.path.dirname(ceilometer.__file__)))
  34. ceilosca_conf_files = {
  35. file: '%s/%s' % (ceilo_parent_dir, file)
  36. for file in
  37. [
  38. 'etc/ceilometer/monasca_field_definitions.yaml',
  39. 'etc/ceilometer/pipeline.yaml',
  40. 'etc/ceilometer/ceilometer.conf',
  41. 'etc/ceilometer/policy.json'
  42. ]
  43. }
  44. dest_conf_dir = ceilo_parent_dir + '/etc/ceilometer'
  45. if not os.path.exists(dest_conf_dir):
  46. os.makedirs(dest_conf_dir)
  47. for src, dest in ceilosca_conf_files.items():
  48. shutil.copyfile(src, dest)