diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-09 07:02:45 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-09 13:15:10 +0100 |
commit | ab6ee580b80b6aacd39323c4668b14c81b54cbcf (patch) | |
tree | befcbae18bd6408f95a7acd4d7103e35b978f444 /functest/energy | |
parent | 746c1eb8b66ef38d3b21db2010cc820cb92c0293 (diff) |
Unlink Energy from functest utils and constants
It requires an update of releng jobs which have to export
ENERGY_RECORDER_API_URL = http://energy.opnfv.fr/resources
Change-Id: Iecd5d49b4d4c961c9dc51e43e54df1fcd4027266
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/energy')
-rw-r--r-- | functest/energy/energy.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/functest/energy/energy.py b/functest/energy/energy.py index 2835e05c..c6660406 100644 --- a/functest/energy/energy.py +++ b/functest/energy/energy.py @@ -12,14 +12,12 @@ import json import logging +import os from functools import wraps import requests from six.moves import urllib -from functest.utils.constants import CONST -import functest.utils.functest_utils as ft_utils - def finish_session(current_scenario): """Finish a recording session.""" @@ -94,23 +92,20 @@ class EnergyRecorder(object): # Singleton pattern for energy_recorder_api static member # Load only if not previouly done if EnergyRecorder.energy_recorder_api is None: - environment = CONST.__getattribute__('NODE_NAME') + environment = os.environ['NODE_NAME'] + assert environment # API URL - energy_recorder_uri = ft_utils.get_functest_config( - "energy_recorder.api_url") + energy_recorder_uri = os.environ["ENERGY_RECORDER_API_URL"] assert energy_recorder_uri - assert environment + + # Creds + creds_usr = os.environ.get("ENERGY_RECORDER_API_USER", "") + creds_pass = os.environ.get("ENERGY_RECORDER_API_PASSWORD", "") uri_comp = "/recorders/environment/" uri_comp += urllib.parse.quote_plus(environment) - # Creds - creds_usr = ft_utils.get_functest_config( - "energy_recorder.api_user") - creds_pass = ft_utils.get_functest_config( - "energy_recorder.api_password") - if creds_usr != "" and creds_pass != "": energy_recorder_api_auth = (creds_usr, creds_pass) else: |