summaryrefslogtreecommitdiffstats
path: root/baro_tests
diff options
context:
space:
mode:
Diffstat (limited to 'baro_tests')
-rw-r--r--baro_tests/collectd.py6
-rw-r--r--baro_tests/config_server.py38
-rw-r--r--baro_tests/dma.py (renamed from baro_tests/local_agent.py)72
-rw-r--r--baro_tests/tests.py2
4 files changed, 59 insertions, 59 deletions
diff --git a/baro_tests/collectd.py b/baro_tests/collectd.py
index 86871b47..c1a05afb 100644
--- a/baro_tests/collectd.py
+++ b/baro_tests/collectd.py
@@ -25,7 +25,7 @@ import time
import logging
import config_server
import tests
-import local_agent
+import dma
from distutils import version
from opnfv.deployment import factory
@@ -878,8 +878,8 @@ def main(bt_logger=None):
else:
pass
- _print_label('Testing LocalAgent on compute nodes')
- res_agent = local_agent.local_agent_main(logger, conf, computes)
+ _print_label('Testing DMA on compute nodes')
+ res_agent = dma.dma_main(logger, conf, computes)
return 0 if res_overall == 0 and res_agent == 0 else 1
diff --git a/baro_tests/config_server.py b/baro_tests/config_server.py
index d64a9146..e6d72335 100644
--- a/baro_tests/config_server.py
+++ b/baro_tests/config_server.py
@@ -324,64 +324,64 @@ class ConfigServer(object):
compute_name))
return False
- def is_localagent_server_running(self, compute):
- """Check whether LocalAgent server is running on compute"""
+ def is_dma_server_running(self, compute):
+ """Check whether DMA server is running on compute"""
compute_name = compute.get_name()
nodes = get_apex_nodes()
for node in nodes:
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd('sudo systemctl status docker'
'&& sudo docker ps'
- '| grep opnfv/barometer-localagent')
+ '| grep opnfv/barometer-dma')
if stdout and '/server' in stdout:
self.__logger.info(
- 'LocalAgent Server is running in node {}'.format(
+ 'DMA Server is running in node {}'.format(
compute_name))
return True
self.__logger.info(
- 'LocalAgent Server is *not* running in node {}'.format(
+ 'DMA Server is *not* running in node {}'.format(
compute_name))
return False
- def is_localagent_infofetch_running(self, compute):
- """Check whether LocalAgent infofetch is running on compute"""
+ def is_dma_infofetch_running(self, compute):
+ """Check whether DMA infofetch is running on compute"""
compute_name = compute.get_name()
nodes = get_apex_nodes()
for node in nodes:
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd('sudo systemctl status docker'
'&& sudo docker ps'
- '| grep opnfv/barometer-localagent')
+ '| grep opnfv/barometer-dma')
if stdout and '/infofetch' in stdout:
self.__logger.info(
- 'LocalAgent InfoFetch is running in node {}'.format(
+ 'DMA InfoFetch is running in node {}'.format(
compute_name))
return True
self.__logger.info(
- 'LocalAgent InfoFetch is *not* running in node {}'.format(
+ 'DMA InfoFetch is *not* running in node {}'.format(
compute_name))
return False
- def get_localagent_config(self, compute):
- """Get config values of LocalAgent"""
+ def get_dma_config(self, compute):
+ """Get config values of DMA"""
compute_name = compute.get_name()
nodes = get_apex_nodes()
for node in nodes:
if compute_name == node.get_dict()['name']:
# We use following after functest accept python-toml
# stdout = node.run_cmd(
- # 'cat /etc/barometer-localagent/config.toml')
+ # 'cat /etc/barometer-dma/config.toml')
# try:
# agent_conf = toml.loads(stdout)
# except (TypeError, TomlDecodeError) as e:
# self.__logger.error(
- # 'LocalAgent config error: {}'.format(e))
+ # 'DMA config error: {}'.format(e))
# agent_conf = None
# finally:
# return agent_conf
readcmd = (
'egrep "listen_port|amqp_"'
- ' /etc/barometer-localagent/config.toml'
+ ' /etc/barometer-dma/config.toml'
'| sed -e "s/#.*$//" | sed -e "s/=/:/"'
)
stdout = node.run_cmd(readcmd)
@@ -757,8 +757,8 @@ class ConfigServer(object):
else:
return False
- def check_localagent_dummy_included(self, compute, name):
- """Check if dummy collectd config by LocalAgent
+ def check_dma_dummy_included(self, compute, name):
+ """Check if dummy collectd config by DMA
is included in collectd.conf file.
Keyword arguments:
@@ -859,13 +859,13 @@ class ConfigServer(object):
self.__logger.debug('VM and other OpenStack resources deleted')
- def test_localagent_infofetch_get_data(self, compute, test_name):
+ def test_dma_infofetch_get_data(self, compute, test_name):
compute_name = compute.get_name()
nodes = get_apex_nodes()
for node in nodes:
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd(
- 'redis-cli keys "barometer-localagent/vm/*/vminfo"'
+ 'redis-cli keys "barometer-dma/vm/*/vminfo"'
' | while read k; do redis-cli get $k; done'
' | grep {}'.format(test_name))
self.__logger.debug('InfoFetch data: {}'.format(stdout))
diff --git a/baro_tests/local_agent.py b/baro_tests/dma.py
index 1a50d963..4a44480b 100644
--- a/baro_tests/local_agent.py
+++ b/baro_tests/dma.py
@@ -15,7 +15,7 @@
# under the License.
# Patch on October 10 2017
-"""Executing test of LocalAgent"""
+"""Executing test of DMA"""
import os
import pika
@@ -29,8 +29,8 @@ logger = None
TEMP_DIR = '/root'
-class LocalAgentClient(object):
- """Client to request LocalAgent"""
+class DMAClient(object):
+ """Client to request DMA"""
def __init__(self, host, port, user, passwd):
"""
Keyword arguments:
@@ -45,7 +45,7 @@ class LocalAgentClient(object):
self._passwd = passwd
def set(self, file):
- logger.error('Do nothing to LocalAgent')
+ logger.error('Do nothing to DMA')
def __str__(self):
return ('host: {0}, port: {1}, user: {2}, pass: {3}'
@@ -53,13 +53,13 @@ class LocalAgentClient(object):
self._user, (self._passwd and '<Filterd>')))
-class RestLocalAgentClient(LocalAgentClient):
- """Client to request LocalAgent using REST"""
+class RestDMAClient(DMAClient):
+ """Client to request DMA using REST"""
def __init__(self, host, port, user, passwd):
super(self.__class__, self).__init__(host, port, user, passwd)
def set(self, file):
- logger.debug('Send to localagent using REST -- {}'.format(str(self)))
+ logger.debug('Send to DMA using REST -- {}'.format(str(self)))
if not os.path.isfile(file):
print '{} is not found'.format(file)
@@ -73,13 +73,13 @@ class RestLocalAgentClient(LocalAgentClient):
return True
-class PubLocalAgentClient(LocalAgentClient):
- """Client to request LocalAgent using AMQP Publish"""
+class PubDMAClient(DMAClient):
+ """Client to request DMA using AMQP Publish"""
def __init__(self, host, port, user, passwd):
super(self.__class__, self).__init__(host, port, user, passwd)
def set(self, file):
- logger.debug('Send to localagent using AMQP Publish -- {}'
+ logger.debug('Send to DMA using AMQP Publish -- {}'
.format(str(self)))
if not os.path.isfile(file):
@@ -104,28 +104,28 @@ class PubLocalAgentClient(LocalAgentClient):
return True
-def _process_localagent_result(compute_node, testfunc,
+def _process_dma_result(compute_node, testfunc,
result, results_list, node):
- """Print LocalAgent test result and append it to results list.
+ """Print DMA test result and append it to results list.
Keyword arguments:
- testfunc -- localagent function name
+ testfunc -- DMA function name
result -- boolean test result
results_list -- results list
"""
if result:
logger.info(
- 'Test case for {0} with LocalAgent PASSED on {1}.'.format(
+ 'Test case for {0} with DMA PASSED on {1}.'.format(
node, testfunc))
else:
logger.error(
- 'Test case for {0} with LocalAgent FAILED on {1}.'.format(
+ 'Test case for {0} with DMA FAILED on {1}.'.format(
node, testfunc))
- results_list.append((compute_node, "LocalAgent", testfunc, result))
+ results_list.append((compute_node, "DMA", testfunc, result))
-def _print_result_of_localagent(compute_ids, results):
- """Print results of LocalAgent.
+def _print_result_of_dma(compute_ids, results):
+ """Print results of DMA.
Keyword arguments:
compute_ids -- list of compute node IDs
@@ -141,7 +141,7 @@ def _print_result_of_localagent(compute_ids, results):
logger.info('+' + ('-' * ((9 * len(compute_node_names))+16)) + '+')
logger.info(
'|' + ' ' * ((9*len(compute_node_names))/2)
- + ' LOCALAGENT TEST'
+ + ' DMA TEST '
+ ' ' * (
9*len(compute_node_names) - (9*len(compute_node_names))/2)
+ '|')
@@ -151,7 +151,7 @@ def _print_result_of_localagent(compute_ids, results):
logger.info(
'+' + ('-' * 16) + '+' + (('-' * 8) + '+') * len(compute_node_names))
- testname = "LocalAgent"
+ testname = "DMA"
print_line = ''
for id in compute_ids:
all_result = \
@@ -182,8 +182,8 @@ def _print_result_of_localagent(compute_ids, results):
logger.info('=' * 70)
-def local_agent_main(bt_logger, conf, computes):
- """Check LocalAgent of each compute node.
+def dma_main(bt_logger, conf, computes):
+ """Check DMA of each compute node.
Keyword arguments:
bt_logger -- logger instance
@@ -198,42 +198,42 @@ def local_agent_main(bt_logger, conf, computes):
node_id = compute_node.get_id()
compute_ids.append(node_id)
- agent_server_running = conf.is_localagent_server_running(compute_node)
+ agent_server_running = conf.is_dma_server_running(compute_node)
agent_infofetch_running = (
- conf.is_localagent_infofetch_running(compute_node) and
+ conf.is_dma_infofetch_running(compute_node) and
conf.is_redis_running(compute_node))
if agent_server_running:
test_name = 'barotest'
tmpfile = TEMP_DIR + '/' + test_name + '.conf'
- agent_config = conf.get_localagent_config(compute_node)
+ agent_config = conf.get_dma_config(compute_node)
listen_ip = compute_node.get_ip()
listen_port = agent_config.get('server').get('listen_port')
amqp_host = agent_config.get('server').get('amqp_host')
amqp_port = agent_config.get('server').get('amqp_port')
amqp_user = agent_config.get('server').get('amqp_user')
amqp_passwd = agent_config.get('server').get('amqp_password')
- rest_client = RestLocalAgentClient(
+ rest_client = RestDMAClient(
listen_ip, listen_port, '', '')
- pub_client = PubLocalAgentClient(
+ pub_client = PubDMAClient(
amqp_host, amqp_port, amqp_user,
amqp_passwd)
all_res = True
for client in [rest_client, pub_client]:
- tests.test_localagent_server_set_collectd(
+ tests.test_dma_server_set_collectd(
compute_node, tmpfile, logger, client)
sleep_time = 1
logger.info(
'Sleeping for {} seconds'.format(sleep_time)
- + ' before localagent server test...')
+ + ' before DMA server test...')
time.sleep(sleep_time)
- res = conf.check_localagent_dummy_included(
+ res = conf.check_dma_dummy_included(
compute_node, test_name)
all_res = all_res and res
- _process_localagent_result(
+ _process_dma_result(
compute_node.get_id(), 'Server',
all_res, agent_results, compute_node.get_name())
@@ -243,22 +243,22 @@ def local_agent_main(bt_logger, conf, computes):
sleep_time = 5
logger.info(
'Sleeping for {} seconds'.format(sleep_time)
- + ' before localagent infofetch test...')
+ + ' before DMA infofetch test...')
time.sleep(sleep_time)
- res = conf.test_localagent_infofetch_get_data(
+ res = conf.test_dma_infofetch_get_data(
compute_node, test_name)
conf.delete_testvm(resources)
- _process_localagent_result(
+ _process_dma_result(
compute_node.get_id(), 'InfoFetch',
res, agent_results, compute_node.get_name())
- _print_result_of_localagent(compute_ids, agent_results)
+ _print_result_of_dma(compute_ids, agent_results)
for res in agent_results:
if not res[3]:
logger.error('Some tests have failed or have not been executed')
- logger.error('LocalAgent test is Fail')
+ logger.error('DMA test is Fail')
return 1
else:
pass
diff --git a/baro_tests/tests.py b/baro_tests/tests.py
index d315fcf1..47edd778 100644
--- a/baro_tests/tests.py
+++ b/baro_tests/tests.py
@@ -274,7 +274,7 @@ def test_csv_handles_plugin_data(
return True
-def test_localagent_server_set_collectd(compute, file, logger, client):
+def test_dma_server_set_collectd(compute, file, logger, client):
with open(file, mode='w') as f:
f.write('# dummy conf\n')
res = client.set(file)