aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py60
-rw-r--r--functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py21
2 files changed, 35 insertions, 46 deletions
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py
index a1612a52..6d742804 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py
@@ -19,10 +19,12 @@ import paramiko
import dns.resolver
from jinja2 import Environment, FileSystemLoader
-
from functest.energy import energy
from functest.opnfv_tests.openstack.snaps import snaps_utils
-import functest.opnfv_tests.vnf.ims.cloudify_ims as cloudify_ims
+from functest.opnfv_tests.vnf.ims import cloudify_ims
+from functest.opnfv_tests.vnf.ims.ixia.utils import IxChassisUtils
+from functest.opnfv_tests.vnf.ims.ixia.utils import IxLoadUtils
+from functest.opnfv_tests.vnf.ims.ixia.utils import IxRestUtils
from functest.utils.constants import CONST
from snaps.config.flavor import FlavorConfig
@@ -32,16 +34,12 @@ from snaps.config.router import RouterConfig
from snaps.config.security_group import (
Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig)
from snaps.config.vm_inst import FloatingIpConfig, VmInstanceConfig
-
from snaps.openstack.create_flavor import OpenStackFlavor
from snaps.openstack.create_instance import OpenStackVmInstance
from snaps.openstack.create_network import OpenStackNetwork
from snaps.openstack.create_router import OpenStackRouter
from snaps.openstack.create_security_group import OpenStackSecurityGroup
-from ixia.utils.IxChassisUtils import ChassisRestAPI
-import ixia.utils.IxLoadUtils as IxLoadUtils
-import ixia.utils.IxRestUtils as IxRestUtils
__author__ = "Valentin Boucher <valentin.boucher@orange.com>"
@@ -152,8 +150,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
protocol=Protocol.icmp))
ixia_managment_sg_settings = SecurityGroupConfig(
- name="ixia_management",
- rule_settings=sg_rules)
+ name="ixia_management", rule_settings=sg_rules)
securit_group_creator = OpenStackSecurityGroup(
self.snaps_creds,
ixia_managment_sg_settings)
@@ -169,8 +166,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
port_range_max=65535))
ixia_ssh_http_sg_settings = SecurityGroupConfig(
- name="ixia_ssh_http",
- rule_settings=sg_rules)
+ name="ixia_ssh_http", rule_settings=sg_rules)
securit_group_creator = OpenStackSecurityGroup(
self.snaps_creds,
ixia_ssh_http_sg_settings)
@@ -224,28 +220,22 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
exists=True)
chassis_port_settings = PortConfig(
- name='ixia_chassis_port',
- network_name=network_settings.name)
+ name='ixia_chassis_port', network_name=network_settings.name)
card1_port1_settings = PortConfig(
- name='ixia_card1_port1',
- network_name=network_settings.name)
+ name='ixia_card1_port1', network_name=network_settings.name)
card2_port1_settings = PortConfig(
- name='ixia_card2_port1',
- network_name=network_settings.name)
+ name='ixia_card2_port1', network_name=network_settings.name)
card1_port2_settings = PortConfig(
- name='ixia_card1_port2',
- network_name="cloudify_ims_network")
+ name='ixia_card1_port2', network_name="cloudify_ims_network")
card2_port2_settings = PortConfig(
- name='ixia_card2_port2',
- network_name="cloudify_ims_network")
+ name='ixia_card2_port2', network_name="cloudify_ims_network")
load_port_settings = PortConfig(
- name='ixia_load_port',
- network_name=network_settings.name)
+ name='ixia_load_port', network_name=network_settings.name)
chassis_settings = VmInstanceConfig(
name='ixia_vChassis',
@@ -329,19 +319,19 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
"password": "admin",
"rememberMe": "false"})
api_key = json.loads((
- ChassisRestAPI.postWithPayload(login_url, payload)))["apiKey"]
+ IxChassisUtils.ChassisRestAPI.postWithPayload(
+ login_url, payload)))["apiKey"]
self.__logger.info("Adding 2 card back inside the ixia chassis...")
for ip in vcard_ips:
payload = {"ipAddress": str(ip)}
- response = json.loads(ChassisRestAPI.postOperation(cards_url,
- api_key,
- payload))
+ response = json.loads(IxChassisUtils.ChassisRestAPI.postOperation(
+ cards_url, api_key, payload))
count = 0
while (int(
- ChassisRestAPI.getWithHeaders(response['url'],
- api_key)['progress']) != 100):
+ IxChassisUtils.ChassisRestAPI.getWithHeaders(
+ response['url'], api_key)['progress']) != 100):
self.__logger.debug("Operation did not finish yet. \
Waiting for 1 more second..")
time.sleep(1)
@@ -406,10 +396,8 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
j2_env = Environment(loader=FileSystemLoader(files_dir),
trim_blocks=True)
self.test['inputs'].update(dict(
- ipchassis=fip_chassis,
- ipcard1=vcard_ips_p2[0],
- ipcard2=vcard_ips_p2[1],
- iplistims=iplistims
+ ipchassis=fip_chassis, ipcard1=vcard_ips_p2[0],
+ ipcard2=vcard_ips_p2[1], iplistims=iplistims
))
target_file.write(
@@ -444,8 +432,8 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
self.__logger.info("Starting the test...")
IxLoadUtils.runTest(connection, sessionUrl)
- self.__logger.info("Polling values for stats %s..." % (
- kStatsToDisplayDict))
+ self.__logger.info(
+ "Polling values for stats %s..." % (kStatsToDisplayDict))
result = IxLoadUtils.pollStats(connection, sessionUrl,
kStatsToDisplayDict)
self.__logger.info("Test finished.")
@@ -458,8 +446,8 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms):
result=result,
duration=duration)
if testRunError:
- self.__logger.info("The test exited with following error: %s" % (
- testRunError))
+ self.__logger.info(
+ "The test exited with following error: %s" % (testRunError))
self.details['test_vnf'].update(status='FAIL', duration=duration)
return False
else:
diff --git a/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py b/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
index d8003e46..50dfbc66 100644
--- a/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
+++ b/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
@@ -11,7 +11,9 @@ import requests
import sys
import time
import logging
-from IxRestUtils import formatDictToJSONPayload
+
+from functest.opnfv_tests.vnf.ims.ixia.utils import IxRestUtils
+
kActionStateFinished = 'finished'
kActionStatusSuccessful = 'Successful'
@@ -80,7 +82,7 @@ def performGenericOperation(connection, url, payloadDict):
it will wait for it to finish.
"""
- data = formatDictToJSONPayload(payloadDict)
+ data = IxRestUtils.formatDictToJSONPayload(payloadDict)
reply = connection.httpPost(url=url, data=data)
waitForActionToFinish(connection, reply, url)
@@ -93,7 +95,7 @@ def performGenericPost(connection, listUrl, payloadDict):
This will perform a generic POST method on a given url
"""
- data = formatDictToJSONPayload(payloadDict)
+ data = IxRestUtils.formatDictToJSONPayload(payloadDict)
reply = connection.httpPost(url=listUrl, data=data)
try:
@@ -111,7 +113,7 @@ def performGenericDelete(connection, listUrl, payloadDict):
This will perform a generic DELETE method on a given url
"""
- data = formatDictToJSONPayload(payloadDict)
+ data = IxRestUtils.formatDictToJSONPayload(payloadDict)
reply = connection.httpDelete(url=listUrl, data=data)
return reply
@@ -122,7 +124,7 @@ def performGenericPatch(connection, url, payloadDict):
This will perform a generic PATCH method on a given url
"""
- data = formatDictToJSONPayload(payloadDict)
+ data = IxRestUtils.formatDictToJSONPayload(payloadDict)
reply = connection.httpPatch(url=url, data=data)
return reply
@@ -307,12 +309,11 @@ def pollStats(connection, sessionUrl, watchedStatsDict, pollingInterval=4):
for timestamp in newTimestamps:
timeStampStr = str(timestamp)
- collectedTimestamps.setdefault(statSource, []).append(
- timeStampStr)
+ collectedTimestamps.setdefault(
+ statSource, []).append(timeStampStr)
- timestampDict = statsDict.setdefault(statSource,
- {}).setdefault(
- timestamp, {})
+ timestampDict = statsDict.setdefault(
+ statSource, {}).setdefault(timestamp, {})
# save the values for the current timestamp,
# and later print them