from yardstick import ssh
from yardstick.network_services.nfvi.collectd import AmqpConsumer
-from yardstick.network_services.utils import provision_tool
+from yardstick.network_services.utils import get_nsb_option
LOG = logging.getLogger(__name__)
ZMQ_OVS_PORT = 5567
ZMQ_POLLING_TIME = 12000
LIST_PLUGINS_ENABLED = ["amqp", "cpu", "cpufreq", "intel_rdt", "memory",
- "hugepages", "dpdkstat", "virt", "ovs_stats"]
+ "hugepages", "dpdkstat", "virt", "ovs_stats", "intel_pmu"]
class ResourceProfile(object):
def parse_ovs_stats(cls, key, value):
return cls.parse_simple_resource(key, value)
+ @classmethod
+ def parse_intel_pmu_stats(cls, key, value):
+ return {''.join(key): value.split(":")[1]}
+
def parse_collectd_result(self, metrics, core_list):
""" convert collectd data into json"""
result = {
"dpdkstat": {},
"virt": {},
"ovs_stats": {},
+ "intel_pmu": {},
}
testcase = ""
elif "ovs_stats" in res_key0:
result["ovs_stats"].update(self.parse_ovs_stats(key_split, value))
+ elif "intel_pmu-all" in res_key0:
+ result["intel_pmu"].update(self.parse_intel_pmu_stats(res_key1, value))
+
result["timestamp"] = testcase
return result
"loadplugin": loadplugin,
"dpdk_interface": interfaces,
}
-
self._provide_config_file(bin_path, 'collectd.conf', kwargs)
def _start_collectd(self, connection, bin_path):
LOG.debug("Starting collectd to collect NFVi stats")
connection.execute('sudo pkill -9 collectd')
- collectd = os.path.join(bin_path, "collectd.sh")
- provision_tool(connection, collectd)
+ bin_path = get_nsb_option("bin_path")
+ collectd_path = os.path.join(bin_path, "collectd", "collectd")
+ exit_status = connection.execute("which %s > /dev/null 2>&1" % collectd_path)[0]
+ if exit_status != 0:
+ LOG.warning("%s is not present disabling", collectd_path)
+ # disable auto-provisioning because it requires Internet access
+ # collectd_installer = os.path.join(bin_path, "collectd.sh")
+ # provision_tool(connection, collectd)
+ # http_proxy = os.environ.get('http_proxy', '')
+ # https_proxy = os.environ.get('https_proxy', '')
+ # connection.execute("sudo %s '%s' '%s'" % (
+ # collectd_installer, http_proxy, https_proxy))
+ return
+ LOG.debug("Starting collectd to collect NFVi stats")
self._prepare_collectd_conf(bin_path)
# Reset amqp queue
connection.execute("sudo rabbitmqctl start_app")
connection.execute("sudo service rabbitmq-server restart")
- # Run collectd
+ LOG.debug("Creating amdin user for rabbitmq in order to collect data from collectd")
+ connection.execute("sudo rabbitmqctl delete_user guest")
+ connection.execute("sudo rabbitmqctl add_user admin admin")
+ connection.execute("sudo rabbitmqctl authenticate_user admin admin")
+ connection.execute("sudo rabbitmqctl set_permissions -p / admin \".*\" \".*\" \".*\"")
- http_proxy = os.environ.get('http_proxy', '')
- https_proxy = os.environ.get('https_proxy', '')
- connection.execute("sudo %s '%s' '%s'" %
- (collectd, http_proxy, https_proxy))
LOG.debug("Start collectd service.....")
- connection.execute(
- "sudo %s" % os.path.join(bin_path, "collectd", "collectd"))
+ connection.execute("sudo %s" % collectd_path)
LOG.debug("Done")
def initiate_systemagent(self, bin_path):