From c36f96b80c00a23164a194c6c74d7281c9835e12 Mon Sep 17 00:00:00 2001 From: spisarski Date: Tue, 21 Nov 2017 12:09:29 -0700 Subject: Removal of deprecated SNAPS-OO classes. JIRA: SNAPS-202 Change-Id: I115b4927b287a5525f4c1b95128d91f5229c7856 Signed-off-by: spisarski --- functest/core/vnf.py | 10 +- functest/opnfv_tests/openstack/rally/rally.py | 22 +++-- functest/opnfv_tests/openstack/tempest/tempest.py | 22 +++-- functest/opnfv_tests/openstack/vping/vping_base.py | 17 ++-- functest/opnfv_tests/openstack/vping/vping_ssh.py | 50 +++++----- .../opnfv_tests/openstack/vping/vping_userdata.py | 12 +-- functest/opnfv_tests/vnf/ims/cloudify_ims.py | 83 ++++++++-------- functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py | 105 +++++++++++---------- .../opnfv_tests/vnf/ims/orchestra_clearwaterims.py | 73 +++++++------- functest/opnfv_tests/vnf/ims/orchestra_openims.py | 66 +++++++------ .../opnfv_tests/vnf/router/cloudify_vrouter.py | 85 +++++++++-------- functest/tests/unit/openstack/vping/test_vping.py | 40 ++++---- 12 files changed, 298 insertions(+), 287 deletions(-) (limited to 'functest') diff --git a/functest/core/vnf.py b/functest/core/vnf.py index 507e2765..73aaf446 100644 --- a/functest/core/vnf.py +++ b/functest/core/vnf.py @@ -14,8 +14,10 @@ import time import functest.core.testcase as base from functest.utils.constants import CONST -from snaps.openstack.create_user import UserSettings, OpenStackUser -from snaps.openstack.create_project import ProjectSettings, OpenStackProject +from snaps.config.user import UserConfig +from snaps.config.project import ProjectConfig +from snaps.openstack.create_user import OpenStackUser +from snaps.openstack.create_project import OpenStackProject from snaps.openstack.tests import openstack_tests __author__ = ("Morgan Richomme , " @@ -108,7 +110,7 @@ class VnfOnBoarding(base.TestCase): project_creator = OpenStackProject( snaps_creds, - ProjectSettings( + ProjectConfig( name=self.tenant_name, description=tenant_description )) @@ -118,7 +120,7 @@ class VnfOnBoarding(base.TestCase): user_creator = OpenStackUser( snaps_creds, - UserSettings( + UserConfig( name=self.tenant_name, password=self.tenant_name, roles={'admin': self.tenant_name})) diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index a4970fc2..0117e69c 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -29,10 +29,12 @@ from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils.constants import CONST -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_image import ImageSettings -from snaps.openstack.create_network import NetworkSettings, SubnetSettings -from snaps.openstack.create_router import RouterSettings +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.network import NetworkConfig, SubnetConfig +from snaps.config.router import RouterConfig + +from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils @@ -478,7 +480,7 @@ class RallyBase(testcase.TestCase): LOGGER.debug("Creating image '%s'...", self.image_name) image_creator = deploy_utils.create_image( - self.os_creds, ImageSettings( + self.os_creds, ImageConfig( name=self.image_name, image_file=self.GLANCE_IMAGE_PATH, img_format=self.GLANCE_IMAGE_FORMAT, @@ -491,10 +493,10 @@ class RallyBase(testcase.TestCase): LOGGER.debug("Creating network '%s'...", network_name) network_creator = deploy_utils.create_network( - self.os_creds, NetworkSettings( + self.os_creds, NetworkConfig( name=network_name, shared=True, - subnet_settings=[SubnetSettings( + subnet_settings=[SubnetConfig( name=subnet_name, cidr=self.RALLY_PRIVATE_SUBNET_CIDR) ])) @@ -505,7 +507,7 @@ class RallyBase(testcase.TestCase): LOGGER.debug("Creating router '%s'...", router_name) router_creator = deploy_utils.create_router( - self.os_creds, RouterSettings( + self.os_creds, RouterConfig( name=router_name, external_gateway=self.ext_net_name, internal_subnets=[subnet_name])) @@ -515,7 +517,7 @@ class RallyBase(testcase.TestCase): LOGGER.debug("Creating flavor '%s'...", self.flavor_name) flavor_creator = OpenStackFlavor( - self.os_creds, FlavorSettings( + self.os_creds, FlavorConfig( name=self.flavor_name, ram=512, disk=1, vcpus=1, metadata=self.FLAVOR_EXTRA_SPECS)) if flavor_creator is None or flavor_creator.create() is None: @@ -524,7 +526,7 @@ class RallyBase(testcase.TestCase): LOGGER.debug("Creating flavor '%s'...", self.flavor_alt_name) flavor_alt_creator = OpenStackFlavor( - self.os_creds, FlavorSettings( + self.os_creds, FlavorConfig( name=self.flavor_alt_name, ram=1024, disk=1, vcpus=1, metadata=self.FLAVOR_EXTRA_SPECS)) if flavor_alt_creator is None or flavor_alt_creator.create() is None: diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index f4b77936..bede02fb 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -26,11 +26,13 @@ from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils +from snaps.config.flavor import FlavorConfig +from snaps.config.network import NetworkConfig, SubnetConfig +from snaps.config.project import ProjectConfig +from snaps.config.user import UserConfig + from snaps.openstack import create_flavor -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_project import ProjectSettings -from snaps.openstack.create_network import NetworkSettings, SubnetSettings -from snaps.openstack.create_user import UserSettings +from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils @@ -335,7 +337,7 @@ class TempestResourcesManager(object): project_name = CONST.__getattribute__( 'tempest_identity_tenant_name') + self.guid project_creator = deploy_utils.create_project( - self.os_creds, ProjectSettings( + self.os_creds, ProjectConfig( name=project_name, description=CONST.__getattribute__( 'tempest_identity_tenant_description'))) @@ -347,7 +349,7 @@ class TempestResourcesManager(object): logger.debug("Creating user for Tempest suite") user_creator = deploy_utils.create_user( - self.os_creds, UserSettings( + self.os_creds, UserConfig( name=CONST.__getattribute__( 'tempest_identity_user_name') + self.guid, password=CONST.__getattribute__( @@ -364,11 +366,11 @@ class TempestResourcesManager(object): logger.debug("Creating private network for Tempest suite") network_creator = deploy_utils.create_network( - self.os_creds, NetworkSettings( + self.os_creds, NetworkConfig( name=CONST.__getattribute__( 'tempest_private_net_name') + self.guid, project_name=project_name, - subnet_settings=[SubnetSettings( + subnet_settings=[SubnetConfig( name=CONST.__getattribute__( 'tempest_private_subnet_name') + self.guid, cidr=CONST.__getattribute__('tempest_private_subnet_cidr')) @@ -421,7 +423,7 @@ class TempestResourcesManager(object): if 'ovs' in scenario or 'fdio' in scenario: flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE flavor_creator = OpenStackFlavor( - self.os_creds, FlavorSettings( + self.os_creds, FlavorConfig( name=CONST.__getattribute__( 'openstack_flavor_name') + self.guid, ram=CONST.__getattribute__('openstack_flavor_ram'), @@ -441,7 +443,7 @@ class TempestResourcesManager(object): if 'ovs' in scenario or 'fdio' in scenario: flavor_metadata_alt = create_flavor.MEM_PAGE_SIZE_LARGE flavor_creator_alt = OpenStackFlavor( - self.os_creds, FlavorSettings( + self.os_creds, FlavorConfig( name=CONST.__getattribute__( 'openstack_flavor_name_alt') + self.guid, ram=CONST.__getattribute__('openstack_flavor_ram'), diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index e719145b..de431fe1 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -16,10 +16,11 @@ from functest.core import testcase from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils.constants import CONST +from snaps.config.flavor import FlavorConfig +from snaps.config.network import NetworkConfig, SubnetConfig +from snaps.config.router import RouterConfig from snaps.openstack import create_flavor -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_network import NetworkSettings, SubnetSettings -from snaps.openstack.create_router import RouterSettings +from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils @@ -130,12 +131,12 @@ class VPingBase(testcase.TestCase): "Creating network with name: '%s'" % private_net_name) self.network_creator = deploy_utils.create_network( self.os_creds, - NetworkSettings( + NetworkConfig( name=private_net_name, network_type=vping_network_type, physical_network=vping_physical_network, segmentation_id=vping_segmentation_id, - subnet_settings=[SubnetSettings( + subnet_settings=[SubnetConfig( name=private_subnet_name, cidr=private_subnet_cidr)])) self.creators.append(self.network_creator) @@ -146,7 +147,7 @@ class VPingBase(testcase.TestCase): ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) self.router_creator = deploy_utils.create_router( self.os_creds, - RouterSettings( + RouterConfig( name=self.router_name, external_gateway=ext_net_name, internal_subnets=[private_subnet_name])) @@ -160,8 +161,8 @@ class VPingBase(testcase.TestCase): flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE flavor_creator = OpenStackFlavor( self.os_creds, - FlavorSettings(name=self.flavor_name, ram=512, disk=1, vcpus=1, - metadata=flavor_metadata)) + FlavorConfig(name=self.flavor_name, ram=512, disk=1, vcpus=1, + metadata=flavor_metadata)) flavor_creator.create() self.creators.append(flavor_creator) diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 1a04ad02..0d92a7e1 100644 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -22,13 +22,13 @@ from functest.core.testcase import TestCase from functest.energy import energy from functest.opnfv_tests.openstack.vping import vping_base from functest.utils.constants import CONST -from snaps.openstack.create_instance import FloatingIpSettings, \ - VmInstanceSettings -from snaps.openstack.create_keypairs import KeypairSettings -from snaps.openstack.create_network import PortSettings -from snaps.openstack.create_security_group import Direction, Protocol, \ - SecurityGroupSettings, SecurityGroupRuleSettings +from snaps.config.keypair import KeypairConfig +from snaps.config.network import PortConfig +from snaps.config.security_group import ( + Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig) +from snaps.config.vm_inst import FloatingIpConfig, VmInstanceConfig + from snaps.openstack.utils import deploy_utils @@ -68,16 +68,16 @@ class VPingSSH(vping_base.VPingBase): self.logger.info(log) kp_creator = deploy_utils.create_keypair( self.os_creds, - KeypairSettings(name=self.kp_name, - private_filepath=self.kp_priv_file, - public_filepath=self.kp_pub_file)) + KeypairConfig( + name=self.kp_name, private_filepath=self.kp_priv_file, + public_filepath=self.kp_pub_file)) self.creators.append(kp_creator) # Creating Instance 1 - port1_settings = PortSettings( + port1_settings = PortConfig( name=self.vm1_name + '-vPingPort', network_name=self.network_creator.network_settings.name) - instance1_settings = VmInstanceSettings( + instance1_settings = VmInstanceConfig( name=self.vm1_name, flavor=self.flavor_name, vm_boot_timeout=self.vm_boot_timeout, vm_delete_timeout=self.vm_delete_timeout, @@ -98,17 +98,17 @@ class VPingSSH(vping_base.VPingBase): sg_creator = self.__create_security_group() self.creators.append(sg_creator) - port2_settings = PortSettings( + port2_settings = PortConfig( name=self.vm2_name + '-vPingPort', network_name=self.network_creator.network_settings.name) - instance2_settings = VmInstanceSettings( + instance2_settings = VmInstanceConfig( name=self.vm2_name, flavor=self.flavor_name, vm_boot_timeout=self.vm_boot_timeout, vm_delete_timeout=self.vm_delete_timeout, ssh_connect_timeout=self.vm_ssh_connect_timeout, port_settings=[port2_settings], security_group_names=[sg_creator.sec_grp_settings.name], - floating_ip_settings=[FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name=self.vm2_name + '-FIPName', port_name=port2_settings.name, router_name=self.router_creator.router_settings.name)]) @@ -218,24 +218,22 @@ class VPingSSH(vping_base.VPingBase): """ sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name=self.sg_name, - direction=Direction.ingress, - protocol=Protocol.icmp)) + SecurityGroupRuleConfig( + sec_grp_name=self.sg_name, direction=Direction.ingress, + protocol=Protocol.icmp)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name=self.sg_name, - direction=Direction.ingress, - protocol=Protocol.tcp, port_range_min=22, - port_range_max=22)) + SecurityGroupRuleConfig( + sec_grp_name=self.sg_name, direction=Direction.ingress, + protocol=Protocol.tcp, port_range_min=22, port_range_max=22)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name=self.sg_name, - direction=Direction.egress, - protocol=Protocol.tcp, port_range_min=22, - port_range_max=22)) + SecurityGroupRuleConfig( + sec_grp_name=self.sg_name, direction=Direction.egress, + protocol=Protocol.tcp, port_range_min=22, port_range_max=22)) log = "Security group with name: '%s'" % self.sg_name self.logger.info(log) return deploy_utils.create_security_group(self.os_creds, - SecurityGroupSettings( + SecurityGroupConfig( name=self.sg_name, description=self.sg_desc, rule_settings=sg_rules)) diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py index deaacfcc..4cc8f42f 100644 --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -9,9 +9,9 @@ import time +from snaps.config.network import PortConfig +from snaps.config.vm_inst import VmInstanceConfig from snaps.openstack.utils import deploy_utils -from snaps.openstack.create_instance import VmInstanceSettings -from snaps.openstack.create_network import PortSettings from functest.core.testcase import TestCase from functest.opnfv_tests.openstack.vping import vping_base @@ -37,10 +37,10 @@ class VPingUserdata(vping_base.VPingBase): super(VPingUserdata, self).run() # Creating Instance 1 - port1_settings = PortSettings( + port1_settings = PortConfig( name=self.vm1_name + '-vPingPort', network_name=self.network_creator.network_settings.name) - instance1_settings = VmInstanceSettings( + instance1_settings = VmInstanceConfig( name=self.vm1_name, flavor=self.flavor_name, vm_boot_timeout=self.vm_boot_timeout, @@ -58,10 +58,10 @@ class VPingUserdata(vping_base.VPingBase): self.vm1_creator.get_port_ip(port1_settings.name)) if userdata: # Creating Instance 2 - port2_settings = PortSettings( + port2_settings = PortConfig( name=self.vm2_name + '-vPingPort', network_name=self.network_creator.network_settings.name) - instance2_settings = VmInstanceSettings( + instance2_settings = VmInstanceConfig( name=self.vm2_name, flavor=self.flavor_name, vm_boot_timeout=self.vm_boot_timeout, diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index f9548eb2..d97a0bcd 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -24,20 +24,22 @@ import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base from functest.utils.constants import CONST import functest.utils.openstack_utils as os_utils -from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, - OpenStackNetwork) -from snaps.openstack.create_security_group import (SecurityGroupSettings, - SecurityGroupRuleSettings, - Direction, Protocol, - OpenStackSecurityGroup) -from snaps.openstack.create_router import RouterSettings, OpenStackRouter -from snaps.openstack.create_instance import (VmInstanceSettings, - FloatingIpSettings, - OpenStackVmInstance) -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_image import ImageSettings, OpenStackImage -from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair -from snaps.openstack.create_network import PortSettings +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.keypair import KeypairConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +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_image import OpenStackImage +from snaps.openstack.create_instance import OpenStackVmInstance +from snaps.openstack.create_keypairs import OpenStackKeypair +from snaps.openstack.create_network import OpenStackNetwork +from snaps.openstack.create_router import OpenStackRouter +from snaps.openstack.create_security_group import OpenStackSecurityGroup __author__ = "Valentin Boucher " @@ -120,10 +122,9 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): if image_file and image_name: image_creator = OpenStackImage( self.snaps_creds, - ImageSettings(name=image_name, - image_user='cloud', - img_format='qcow2', - image_file=image_file)) + ImageConfig( + name=image_name, image_user='cloud', + img_format='qcow2', image_file=image_file)) image_creator.create() # self.created_object.append(image_creator) @@ -138,24 +139,24 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): start_time = time.time() self.__logger.info("Creating keypair ...") kp_file = os.path.join(self.data_dir, "cloudify_ims.pem") - keypair_settings = KeypairSettings(name='cloudify_ims_kp', - private_filepath=kp_file) + keypair_settings = KeypairConfig(name='cloudify_ims_kp', + private_filepath=kp_file) keypair_creator = OpenStackKeypair(self.snaps_creds, keypair_settings) keypair_creator.create() self.created_object.append(keypair_creator) self.__logger.info("Creating full network ...") - subnet_settings = SubnetSettings(name='cloudify_ims_subnet', - cidr='10.67.79.0/24') - network_settings = NetworkSettings(name='cloudify_ims_network', - subnet_settings=[subnet_settings]) + subnet_settings = SubnetConfig(name='cloudify_ims_subnet', + cidr='10.67.79.0/24') + network_settings = NetworkConfig(name='cloudify_ims_network', + subnet_settings=[subnet_settings]) network_creator = OpenStackNetwork(self.snaps_creds, network_settings) network_creator.create() self.created_object.append(network_creator) ext_net_name = snaps_utils.get_ext_net_name(self.snaps_creds) router_creator = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name='cloudify_ims_router', external_gateway=ext_net_name, internal_subnets=[subnet_settings.name])) @@ -166,19 +167,19 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.info("Creating security group for cloudify manager vm") sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="sg-cloudify-manager", - direction=Direction.ingress, - protocol=Protocol.tcp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig( + sec_grp_name="sg-cloudify-manager", + direction=Direction.ingress, protocol=Protocol.tcp, + port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="sg-cloudify-manager", - direction=Direction.ingress, - protocol=Protocol.udp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig( + sec_grp_name="sg-cloudify-manager", + direction=Direction.ingress, protocol=Protocol.udp, + port_range_min=1, port_range_max=65535)) securit_group_creator = OpenStackSecurityGroup( self.snaps_creds, - SecurityGroupSettings( + SecurityGroupConfig( name="sg-cloudify-manager", rule_settings=sg_rules)) @@ -188,7 +189,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): # orchestrator VM flavor self.__logger.info("Get or create flavor for cloudify manager vm ...") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.orchestrator['requirements']['flavor']['name'], ram=self.orchestrator['requirements']['flavor']['ram_min'], disk=50, @@ -196,20 +197,20 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): flavor_creator = OpenStackFlavor(self.snaps_creds, flavor_settings) flavor_creator.create() self.created_object.append(flavor_creator) - image_settings = ImageSettings( + image_settings = ImageConfig( name=self.orchestrator['requirements']['os_image'], image_user='centos', exists=True) - port_settings = PortSettings(name='cloudify_manager_port', - network_name=network_settings.name) + port_settings = PortConfig(name='cloudify_manager_port', + network_name=network_settings.name) - manager_settings = VmInstanceSettings( + manager_settings = VmInstanceConfig( name='cloudify_manager', flavor=flavor_settings.name, port_settings=[port_settings], security_group_names=[securit_group_creator.sec_grp_settings.name], - floating_ip_settings=[FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name='cloudify_manager_fip', port_name=port_settings.name, router_name=router_creator.router_settings.name)]) @@ -301,7 +302,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): descriptor.get('file_name')) self.__logger.info("Get or create flavor for all clearwater vm") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.vnf['requirements']['flavor']['name'], ram=self.vnf['requirements']['flavor']['ram_min'], disk=25, diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py index 90068525..a1612a52 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py @@ -25,18 +25,19 @@ from functest.opnfv_tests.openstack.snaps import snaps_utils import functest.opnfv_tests.vnf.ims.cloudify_ims as cloudify_ims from functest.utils.constants import CONST -from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, - OpenStackNetwork, PortSettings) -from snaps.openstack.create_security_group import (SecurityGroupSettings, - SecurityGroupRuleSettings, - Direction, Protocol, - OpenStackSecurityGroup) -from snaps.openstack.create_router import RouterSettings, OpenStackRouter -from snaps.openstack.create_instance import (VmInstanceSettings, - FloatingIpSettings, - OpenStackVmInstance) -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_image import ImageSettings +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +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 @@ -115,17 +116,17 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): ellis_ip = outputs['ellis_ip'] self.__logger.info("Creating full IXIA network ...") - subnet_settings = SubnetSettings(name='ixia_management_subnet', - cidr='10.10.10.0/24') - network_settings = NetworkSettings(name='ixia_management_network', - subnet_settings=[subnet_settings]) + subnet_settings = SubnetConfig(name='ixia_management_subnet', + cidr='10.10.10.0/24') + network_settings = NetworkConfig(name='ixia_management_network', + subnet_settings=[subnet_settings]) network_creator = OpenStackNetwork(self.snaps_creds, network_settings) network_creator.create() self.created_object.append(network_creator) ext_net_name = snaps_utils.get_ext_net_name(self.snaps_creds) router_creator = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name='ixia_management_router', external_gateway=ext_net_name, internal_subnets=[subnet_settings.name])) @@ -136,21 +137,21 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): self.__logger.info("Creating security groups for IXIA VMs") sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="ixia_management", - direction=Direction.ingress, - protocol=Protocol.tcp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig(sec_grp_name="ixia_management", + direction=Direction.ingress, + protocol=Protocol.tcp, port_range_min=1, + port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="ixia_management", - direction=Direction.ingress, - protocol=Protocol.udp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig(sec_grp_name="ixia_management", + direction=Direction.ingress, + protocol=Protocol.udp, port_range_min=1, + port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="ixia_management", - direction=Direction.ingress, - protocol=Protocol.icmp)) + SecurityGroupRuleConfig(sec_grp_name="ixia_management", + direction=Direction.ingress, + protocol=Protocol.icmp)) - ixia_managment_sg_settings = SecurityGroupSettings( + ixia_managment_sg_settings = SecurityGroupConfig( name="ixia_management", rule_settings=sg_rules) securit_group_creator = OpenStackSecurityGroup( @@ -162,12 +163,12 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="ixia_ssh_http", - direction=Direction.ingress, - protocol=Protocol.tcp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig(sec_grp_name="ixia_ssh_http", + direction=Direction.ingress, + protocol=Protocol.tcp, port_range_min=1, + port_range_max=65535)) - ixia_ssh_http_sg_settings = SecurityGroupSettings( + ixia_ssh_http_sg_settings = SecurityGroupConfig( name="ixia_ssh_http", rule_settings=sg_rules) securit_group_creator = OpenStackSecurityGroup( @@ -177,7 +178,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): securit_group_creator.create() self.created_object.append(securit_group_creator) - chassis_flavor_settings = FlavorSettings( + chassis_flavor_settings = FlavorConfig( name="ixia_vChassis", ram=4096, disk=40, @@ -187,7 +188,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): flavor_creator.create() self.created_object.append(flavor_creator) - card_flavor_settings = FlavorSettings( + card_flavor_settings = FlavorConfig( name="ixia_vCard", ram=4096, disk=4, @@ -197,7 +198,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): flavor_creator.create() self.created_object.append(flavor_creator) - load_flavor_settings = FlavorSettings( + load_flavor_settings = FlavorConfig( name="ixia_vLoad", ram=8192, disk=100, @@ -207,52 +208,52 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): flavor_creator.create() self.created_object.append(flavor_creator) - chassis_image_settings = ImageSettings( + chassis_image_settings = ImageConfig( name=self.test['requirements']['chassis']['image'], image_user='admin', exists=True) - card_image_settings = ImageSettings( + card_image_settings = ImageConfig( name=self.test['requirements']['card']['image'], image_user='admin', exists=True) - load_image_settings = ImageSettings( + load_image_settings = ImageConfig( name=self.test['requirements']['load']['image'], image_user='admin', exists=True) - chassis_port_settings = PortSettings( + chassis_port_settings = PortConfig( name='ixia_chassis_port', network_name=network_settings.name) - card1_port1_settings = PortSettings( + card1_port1_settings = PortConfig( name='ixia_card1_port1', network_name=network_settings.name) - card2_port1_settings = PortSettings( + card2_port1_settings = PortConfig( name='ixia_card2_port1', network_name=network_settings.name) - card1_port2_settings = PortSettings( + card1_port2_settings = PortConfig( name='ixia_card1_port2', network_name="cloudify_ims_network") - card2_port2_settings = PortSettings( + card2_port2_settings = PortConfig( name='ixia_card2_port2', network_name="cloudify_ims_network") - load_port_settings = PortSettings( + load_port_settings = PortConfig( name='ixia_load_port', network_name=network_settings.name) - chassis_settings = VmInstanceSettings( + chassis_settings = VmInstanceConfig( name='ixia_vChassis', flavor=chassis_flavor_settings.name, port_settings=[chassis_port_settings], security_group_names=[ixia_ssh_http_sg_settings.name, ixia_managment_sg_settings.name], - floating_ip_settings=[FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name='ixia_vChassis_fip', port_name=chassis_port_settings.name, router_name=router_creator.router_settings.name)]) @@ -266,7 +267,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): fip_chassis = vm_creator.get_floating_ip().ip self.created_object.append(vm_creator) - card1_settings = VmInstanceSettings( + card1_settings = VmInstanceConfig( name='ixia_vCard1', flavor=card_flavor_settings.name, port_settings=[card1_port1_settings, card1_port2_settings], @@ -284,7 +285,7 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): vcard_ips_p2.append(vm_creator.get_port_ip('ixia_card1_port2')) self.created_object.append(vm_creator) - card2_settings = VmInstanceSettings( + card2_settings = VmInstanceConfig( name='ixia_vCard2', flavor=card_flavor_settings.name, port_settings=[card2_port1_settings, card2_port2_settings], @@ -300,13 +301,13 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): vcard_ips_p2.append(vm_creator.get_port_ip('ixia_card2_port2')) self.created_object.append(vm_creator) - load_settings = VmInstanceSettings( + load_settings = VmInstanceConfig( name='ixia_vLoad', flavor=load_flavor_settings.name, port_settings=[load_port_settings], security_group_names=[ixia_ssh_http_sg_settings.name, ixia_managment_sg_settings.name], - floating_ip_settings=[FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name='ixia_vLoad_fip', port_name=load_port_settings.name, router_name=router_creator.router_settings.name)]) diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 2cfc2a5d..c6e96e1d 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -17,23 +17,21 @@ import time import pkg_resources import yaml -from snaps.openstack.create_image import OpenStackImage, ImageSettings -from snaps.openstack.create_flavor import OpenStackFlavor, FlavorSettings -from snaps.openstack.create_security_group import ( - OpenStackSecurityGroup, - SecurityGroupSettings, - SecurityGroupRuleSettings, - Direction, - Protocol) -from snaps.openstack.create_network import ( - OpenStackNetwork, - NetworkSettings, - SubnetSettings, - PortSettings) -from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.create_instance import ( - VmInstanceSettings, - OpenStackVmInstance) +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +from snaps.config.router import RouterConfig +from snaps.config.security_group import ( + Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig) +from snaps.config.vm_inst import VmInstanceConfig + +from snaps.openstack.create_flavor import OpenStackFlavor +from snaps.openstack.create_image import OpenStackImage +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 functest.opnfv_tests.openstack.snaps import snaps_utils import functest.core.vnf as vnf @@ -164,6 +162,7 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): 'vnf_{}_config'.format(self.case_name)) except BaseException: raise Exception("Orchestra VNF config file not found") + config_file = self.case_dir + self.config self.mano = dict( @@ -230,11 +229,11 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): if image_file and image_name: image = OpenStackImage( self.snaps_creds, - ImageSettings(name=image_name, - image_user='cloud', - img_format='qcow2', - image_file=image_file, - public=True)) + ImageConfig(name=image_name, + image_user='cloud', + img_format='qcow2', + image_file=image_file, + public=True)) image.create() # self.created_resources.append(image); @@ -244,46 +243,46 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): "Creating security group for Open Baton if not yet existing...") sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.ingress, protocol=Protocol.tcp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.egress, protocol=Protocol.tcp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.ingress, protocol=Protocol.udp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.egress, protocol=Protocol.udp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.ingress, protocol=Protocol.icmp)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.egress, protocol=Protocol.icmp)) security_group = OpenStackSecurityGroup( self.snaps_creds, - SecurityGroupSettings( + SecurityGroupConfig( name="orchestra-sec-group-allowall", rule_settings=sg_rules)) @@ -298,7 +297,7 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): self.logger.info( "Create Flavor for Open Baton NFVO if not yet existing") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.mano['requirements']['flavor']['name'], ram=self.mano['requirements']['flavor']['ram_min'], disk=self.mano['requirements']['flavor']['disk'], @@ -314,11 +313,11 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): """Create network/subnet/router if they doen't exist yet""" self.logger.info( "Creating network/subnet/router if they doen't exist yet...") - subnet_settings = SubnetSettings( + subnet_settings = SubnetConfig( name='%s_subnet' % self.case_name, cidr="192.168.100.0/24") - network_settings = NetworkSettings( + network_settings = NetworkConfig( name='%s_net' % self.case_name, subnet_settings=[subnet_settings]) @@ -333,7 +332,7 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): self.created_resources.append(orchestra_network) orchestra_router = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name='%s_router' % self.case_name, external_gateway=self.mano['details']['external_net_name'], @@ -437,16 +436,16 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): self.mano['details']['network']['id']) self.logger.debug("userdata: %s\n", userdata) # setting up image - image_settings = ImageSettings( + image_settings = ImageConfig( name=self.mano['requirements']['image'], image_user='ubuntu', exists=True) # setting up port - port_settings = PortSettings( + port_settings = PortConfig( name='%s_port' % self.case_name, network_name=self.mano['details']['network']['name']) # build configuration of vm - orchestra_settings = VmInstanceSettings( + orchestra_settings = VmInstanceConfig( name=self.case_name, flavor=self.mano['details']['flavor']['name'], port_settings=[port_settings], @@ -519,7 +518,7 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): self.logger.info( "Create %s Flavor if not existing", self.vnf['name']) - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.vnf['requirements']['flavor']['name'], ram=self.vnf['requirements']['flavor']['ram_min'], disk=self.vnf['requirements']['flavor']['disk'], diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index 6192cc54..f4c140e5 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -17,23 +17,21 @@ import time import pkg_resources import yaml +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +from snaps.config.router import RouterConfig +from snaps.config.security_group import ( + Direction, Protocol, SecurityGroupConfig, SecurityGroupRuleConfig) +from snaps.config.vm_inst import VmInstanceConfig + +from snaps.openstack.create_image import OpenStackImage +from snaps.openstack.create_flavor import OpenStackFlavor +from snaps.openstack.create_security_group import OpenStackSecurityGroup +from snaps.openstack.create_network import OpenStackNetwork +from snaps.openstack.create_router import OpenStackRouter +from snaps.openstack.create_instance import OpenStackVmInstance -from snaps.openstack.create_image import OpenStackImage, ImageSettings -from snaps.openstack.create_flavor import OpenStackFlavor, FlavorSettings -from snaps.openstack.create_security_group import ( - OpenStackSecurityGroup, - SecurityGroupSettings, - SecurityGroupRuleSettings, - Direction, - Protocol) -from snaps.openstack.create_network import ( - OpenStackNetwork, - NetworkSettings, - SubnetSettings, - PortSettings) -from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.create_instance import ( - VmInstanceSettings, OpenStackVmInstance) from functest.opnfv_tests.openstack.snaps import snaps_utils import functest.core.vnf as vnf @@ -225,11 +223,11 @@ class OpenImsVnf(vnf.VnfOnBoarding): if image_file and image_name: image = OpenStackImage( self.snaps_creds, - ImageSettings(name=image_name, - image_user='cloud', - img_format='qcow2', - image_file=image_file, - public=True)) + ImageConfig(name=image_name, + image_user='cloud', + img_format='qcow2', + image_file=image_file, + public=True)) image.create() # self.created_resources.append(image); @@ -239,28 +237,28 @@ class OpenImsVnf(vnf.VnfOnBoarding): "Creating security group for Open Baton if not yet existing...") sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.ingress, protocol=Protocol.tcp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.egress, protocol=Protocol.tcp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.ingress, protocol=Protocol.udp, port_range_min=1, port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings( + SecurityGroupRuleConfig( sec_grp_name="orchestra-sec-group-allowall", direction=Direction.egress, protocol=Protocol.udp, @@ -268,7 +266,7 @@ class OpenImsVnf(vnf.VnfOnBoarding): port_range_max=65535)) security_group = OpenStackSecurityGroup( self.snaps_creds, - SecurityGroupSettings( + SecurityGroupConfig( name="orchestra-sec-group-allowall", rule_settings=sg_rules)) @@ -283,7 +281,7 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.logger.info( "Create Flavor for Open Baton NFVO if not yet existing") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.mano['requirements']['flavor']['name'], ram=self.mano['requirements']['flavor']['ram_min'], disk=self.mano['requirements']['flavor']['disk'], @@ -299,11 +297,11 @@ class OpenImsVnf(vnf.VnfOnBoarding): """Create network/subnet/router if they doen't exist yet""" self.logger.info( "Creating network/subnet/router if they doen't exist yet...") - subnet_settings = SubnetSettings( + subnet_settings = SubnetConfig( name='%s_subnet' % self.case_name, cidr="192.168.100.0/24") - network_settings = NetworkSettings( + network_settings = NetworkConfig( name='%s_net' % self.case_name, subnet_settings=[subnet_settings]) @@ -318,7 +316,7 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.created_resources.append(orchestra_network) orchestra_router = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name='%s_router' % self.case_name, external_gateway=self.mano['details']['external_net_name'], @@ -421,16 +419,16 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.mano['details']['network']['id']) self.logger.debug("userdata: %s\n", userdata) # setting up image - image_settings = ImageSettings( + image_settings = ImageConfig( name=self.mano['requirements']['image'], image_user='ubuntu', exists=True) # setting up port - port_settings = PortSettings( + port_settings = PortConfig( name='%s_port' % self.case_name, network_name=self.mano['details']['network']['name']) # build configuration of vm - orchestra_settings = VmInstanceSettings( + orchestra_settings = VmInstanceConfig( name=self.case_name, flavor=self.mano['details']['flavor']['name'], port_settings=[port_settings], @@ -502,7 +500,7 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.logger.info( "Create %s Flavor if not existing", self.vnf['name']) - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.vnf['requirements']['flavor']['name'], ram=self.vnf['requirements']['flavor']['ram_min'], disk=self.vnf['requirements']['flavor']['disk'], diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index ea09b211..fc16977e 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -25,20 +25,23 @@ import functest.utils.openstack_utils as os_utils from git import Repo -from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, - OpenStackNetwork) -from snaps.openstack.create_security_group import (SecurityGroupSettings, - SecurityGroupRuleSettings, - Direction, Protocol, - OpenStackSecurityGroup) -from snaps.openstack.create_router import RouterSettings, OpenStackRouter -from snaps.openstack.create_instance import (VmInstanceSettings, - FloatingIpSettings, - OpenStackVmInstance) -from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor -from snaps.openstack.create_image import ImageSettings, OpenStackImage -from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair -from snaps.openstack.create_network import PortSettings +from snaps.config.flavor import FlavorConfig +from snaps.config.image import ImageConfig +from snaps.config.keypair import KeypairConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +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_image import OpenStackImage +from snaps.openstack.create_instance import OpenStackVmInstance +from snaps.openstack.create_keypairs import OpenStackKeypair +from snaps.openstack.create_network import OpenStackNetwork +from snaps.openstack.create_security_group import OpenStackSecurityGroup +from snaps.openstack.create_router import OpenStackRouter + import snaps.openstack.utils.glance_utils as glance_utils from functest.opnfv_tests.vnf.router.utilvnf import Utilvnf @@ -121,10 +124,10 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): if image_file and image_name: image_creator = OpenStackImage( self.snaps_creds, - ImageSettings(name=image_name, - image_user='cloud', - img_format='qcow2', - image_file=image_file)) + ImageConfig(name=image_name, + image_user='cloud', + img_format='qcow2', + image_file=image_file)) image_creator.create() self.created_object.append(image_creator) @@ -138,24 +141,24 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): start_time = time.time() self.__logger.info("Creating keypair ...") kp_file = os.path.join(self.data_dir, "cloudify_vrouter.pem") - keypair_settings = KeypairSettings(name='cloudify_vrouter_kp', - private_filepath=kp_file) + keypair_settings = KeypairConfig(name='cloudify_vrouter_kp', + private_filepath=kp_file) keypair_creator = OpenStackKeypair(self.snaps_creds, keypair_settings) keypair_creator.create() self.created_object.append(keypair_creator) self.__logger.info("Creating full network ...") - subnet_settings = SubnetSettings(name='cloudify_vrouter_subnet', - cidr='10.67.79.0/24') - network_settings = NetworkSettings(name='cloudify_vrouter_network', - subnet_settings=[subnet_settings]) + subnet_settings = SubnetConfig(name='cloudify_vrouter_subnet', + cidr='10.67.79.0/24') + network_settings = NetworkConfig(name='cloudify_vrouter_network', + subnet_settings=[subnet_settings]) network_creator = OpenStackNetwork(self.snaps_creds, network_settings) network_creator.create() self.created_object.append(network_creator) ext_net_name = snaps_utils.get_ext_net_name(self.snaps_creds) router_creator = OpenStackRouter( self.snaps_creds, - RouterSettings( + RouterConfig( name='cloudify_vrouter_router', external_gateway=ext_net_name, internal_subnets=[subnet_settings.name])) @@ -166,19 +169,19 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): self.__logger.info("Creating security group for cloudify manager vm") sg_rules = list() sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="sg-cloudify-manager", - direction=Direction.ingress, - protocol=Protocol.tcp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig(sec_grp_name="sg-cloudify-manager", + direction=Direction.ingress, + protocol=Protocol.tcp, port_range_min=1, + port_range_max=65535)) sg_rules.append( - SecurityGroupRuleSettings(sec_grp_name="sg-cloudify-manager", - direction=Direction.ingress, - protocol=Protocol.udp, port_range_min=1, - port_range_max=65535)) + SecurityGroupRuleConfig(sec_grp_name="sg-cloudify-manager", + direction=Direction.ingress, + protocol=Protocol.udp, port_range_min=1, + port_range_max=65535)) security_group_creator = OpenStackSecurityGroup( self.snaps_creds, - SecurityGroupSettings( + SecurityGroupConfig( name="sg-cloudify-manager", rule_settings=sg_rules)) @@ -188,7 +191,7 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): # orchestrator VM flavor self.__logger.info("Get or create flavor for cloudify manager vm ...") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.orchestrator['requirements']['flavor']['name'], ram=self.orchestrator['requirements']['flavor']['ram_min'], disk=50, @@ -196,21 +199,21 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): flavor_creator = OpenStackFlavor(self.snaps_creds, flavor_settings) flavor_creator.create() self.created_object.append(flavor_creator) - image_settings = ImageSettings( + image_settings = ImageConfig( name=self.orchestrator['requirements']['os_image'], image_user='centos', exists=True) - port_settings = PortSettings(name='cloudify_manager_port', - network_name=network_settings.name) + port_settings = PortConfig(name='cloudify_manager_port', + network_name=network_settings.name) - manager_settings = VmInstanceSettings( + manager_settings = VmInstanceConfig( name='cloudify_manager', flavor=flavor_settings.name, port_settings=[port_settings], security_group_names=[ security_group_creator.sec_grp_settings.name], - floating_ip_settings=[FloatingIpSettings( + floating_ip_settings=[FloatingIpConfig( name='cloudify_manager_fip', port_name=port_settings.name, router_name=router_creator.router_settings.name)]) @@ -309,7 +312,7 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): descriptor.get('name')) self.__logger.info("Get or create flavor for vrouter") - flavor_settings = FlavorSettings( + flavor_settings = FlavorConfig( name=self.vnf['requirements']['flavor']['name'], ram=self.vnf['requirements']['flavor']['ram_min'], disk=25, diff --git a/functest/tests/unit/openstack/vping/test_vping.py b/functest/tests/unit/openstack/vping/test_vping.py index a28c61ae..dbfb679f 100644 --- a/functest/tests/unit/openstack/vping/test_vping.py +++ b/functest/tests/unit/openstack/vping/test_vping.py @@ -10,15 +10,19 @@ import unittest import mock +from snaps.config.keypair import KeypairConfig +from snaps.config.network import NetworkConfig, PortConfig, SubnetConfig +from snaps.config.router import RouterConfig +from snaps.config.security_group import SecurityGroupConfig +from snaps.config.vm_inst import VmInstanceConfig + from snaps.openstack.create_image import OpenStackImage -from snaps.openstack.create_instance import OpenStackVmInstance, \ - VmInstanceSettings -from snaps.openstack.create_keypairs import OpenStackKeypair, KeypairSettings -from snaps.openstack.create_network import OpenStackNetwork, NetworkSettings, \ - SubnetSettings, PortSettings -from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.create_security_group import OpenStackSecurityGroup, \ - SecurityGroupSettings +from snaps.openstack.create_instance import OpenStackVmInstance +from snaps.openstack.create_keypairs import OpenStackKeypair +from snaps.openstack.create_network import OpenStackNetwork +from snaps.openstack.create_router import OpenStackRouter +from snaps.openstack.create_security_group import OpenStackSecurityGroup + from snaps.openstack.os_credentials import OSCreds from functest.core.testcase import TestCase @@ -54,14 +58,14 @@ class VPingUserdataTesting(unittest.TestCase): return_value=OpenStackImage(self.os_creds, None)), \ mock.patch('snaps.openstack.utils.deploy_utils.create_network', return_value=OpenStackNetwork( - self.os_creds, NetworkSettings(name='foo'))), \ + self.os_creds, NetworkConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( self.os_creds, - VmInstanceSettings( + VmInstanceConfig( name='foo', flavor='bar', - port_settings=[PortSettings( + port_settings=[PortConfig( name='foo', network_name='bar')]), None)), \ mock.patch('snaps.openstack.create_instance.' @@ -120,32 +124,32 @@ class VPingSSHTesting(unittest.TestCase): mock.patch('snaps.openstack.utils.deploy_utils.create_network', return_value=OpenStackNetwork( self.os_creds, - NetworkSettings( + NetworkConfig( name='foo', subnet_settings=[ - SubnetSettings( + SubnetConfig( name='bar', cidr='10.0.0.1/24')]))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( self.os_creds, - VmInstanceSettings( + VmInstanceConfig( name='foo', flavor='bar', - port_settings=[PortSettings( + port_settings=[PortConfig( name='foo', network_name='bar')]), None)), \ mock.patch('snaps.openstack.utils.deploy_utils.create_keypair', return_value=OpenStackKeypair( - self.os_creds, KeypairSettings(name='foo'))), \ + self.os_creds, KeypairConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.create_router', return_value=OpenStackRouter( - self.os_creds, RouterSettings(name='foo'))), \ + self.os_creds, RouterConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_security_group', return_value=OpenStackSecurityGroup( self.os_creds, - SecurityGroupSettings(name='foo'))), \ + SecurityGroupConfig(name='foo'))), \ mock.patch('snaps.openstack.create_instance.' 'OpenStackVmInstance.' 'get_vm_inst', return_value=os_vm_inst), \ -- cgit 1.2.3-korg