Ejemplo n.º 1
0
from qautils.configuration.configuration_utils import set_up_project
from fiwarefacts_client.client import FactsClient
from fiwarecloto_client.client import ClotoClient
from commons.rabbit_utils import RabbitMQConsumer, RabbitMQPublisher
import qautils.configuration.configuration_utils as configuration_utils
from fiwarefacts_client.window_size_model_utils import get_window_size_rabbitmq_message
from qautils.configuration.configuration_properties import PROPERTIES_CONFIG_SERVICE_PROTOCOL, \
    PROPERTIES_CONFIG_SERVICE_RESOURCE, PROPERTIES_CONFIG_SERVICE_PORT, PROPERTIES_CONFIG_SERVICE_HOST, \
    PROPERTIES_CONFIG_SERVICE_OS_USERNAME, PROPERTIES_CONFIG_SERVICE_OS_PASSWORD, \
    PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID, PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL, PROPERTIES_CONFIG_SERVICE_USER, \
    PROPERTIES_CONFIG_SERVICE_PASSWORD
from commons.constants import *  # All custom constants are used in this file.
import time


__logger__ = get_logger(__name__)


def before_all(context):

    __logger__.info("START ...")
    __logger__.info("Setting UP acceptance test project ")

    set_up_project()  # Load setting using 'qautils.configuration.configuration_utils'

    # Save tenantId
    context.tenant_id = \
        configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID]

    # Create REST Clients
    context.facts_client = FactsClient(
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

from commons.constants import IMAGES_DIR
from hamcrest import assert_that, is_not, is_, equal_to
from qautils.dataset.dataset_utils import DatasetUtils
from qautils.logger.logger_utils import get_logger
from commons.utils import get_real_value_of_image_property
import os

__author__ = "@jframos"
__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("qautils")


def create_new_image(context, region_name, image_name, image_filename=None):
    """
    HELPER: Create new image using given params and step context.
    :param region_name (string): Name of the node where image will be created
    :param context (Behave Context): Behave context
    :param image_name (string): Name of the image
    :param image_file (string): Filename to be used as image.
    :return: None
    """

    __logger__.info("Creating new image '%s' in region '%s'. Image filename: '%s'",
                    image_name, region_name, image_filename)
Ejemplo n.º 3
0
from keystoneclient import session
from keystoneclient.exceptions import ClientException as KeystoneClientException
from keystoneclient.exceptions import ConnectionRefused as KeystoneConnectionRefused
import qautils.configuration.configuration_utils as configuration_manager
from constants import PROPERTIES_CONFIG_AIAKOS
from qautils.configuration.configuration_properties import PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID, \
    PROPERTIES_CONFIG_SERVICE_OS_PASSWORD, PROPERTIES_CONFIG_SERVICE_OS_TENANT_NAME, \
    PROPERTIES_CONFIG_SERVICE_OS_USERNAME, \
    PROPERTIES_CONFIG_SERVICE_OS_DOMAIN_NAME, PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL
from qautils.logger.logger_utils import get_logger

__author__ = "Telefonica I+D"
__copyright__ = "Copyright 2015"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("authentication")

class Authentication(object):

    region_name = None
    auth_api = 'v2.0'
    auth_url = None
    auth_sess = None
    auth_token = None
    auth_cred = {}

    @classmethod
    def init_auth(cls):
        """
        Init the variables related to authorization, needed to execute tests
        :return: The auth token retrieved
Ejemplo n.º 4
0
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

from behave import step, given
from hamcrest import assert_that, is_not, is_, equal_to, has_key
from commons.behave_step_helpers import create_new_image, image_is_present_in_nodes, image_is_not_present_in_node
from commons.constants import WAIT_SECONDS, MAX_WAIT_TASK_FINISHED
import time
from qautils.logger.logger_utils import get_logger

__author__ = "@jframos"
__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("steps.sync_region")


@given(u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)"')
@given(u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)" and these properties')
def a_new_image_created_in_glance_of_master(context, image_name):
    """Create New image in the Glance of Master Node"""

    create_new_image(context, context.master_region_name, image_name)


@given(u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)" '
       u'and file "(?P<file>\w*)"')
@given(u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)", '
       u'file "(?P<file>\w*)" and these properties')
def other_new_image_created_in_glance_of_master(context, image_name, file):
Ejemplo n.º 5
0
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

import behave
from commons.constants import *
from qautils.logger.logger_utils import get_logger
from commons.utils import load_project_properties
from commons.glance_operations import GlanceOperations
from glancesync_api_client.api_client import GlanceSyncApiClient
from glancesync_cmd_client.remote_client import GlanceSyncRemoteCmdClient

__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("qautils")

# Use regular expressions for step param definition (Behave).
behave.use_step_matcher("re")


def before_all(context):
    """
    HOOK: To be executed before all:
        - Load project properties.
        - Init Glance client.
        - Init GlanceSync API Client.
    """

    __logger__.info("SetUp execution")
Ejemplo n.º 6
0
import behave
from qautils.logger.logger_utils import get_logger
import qautils.configuration.configuration_utils as configuration_manager
from commons.constants import PROPERTIES_CONFIG_AIAKOS, PROPERTIES_CONFIG_AIAKOS_KEYFILES_PATH
from qautils.configuration.configuration_properties import PROPERTIES_CONFIG_SERVICE_PROTOCOL, \
    PROPERTIES_CONFIG_SERVICE_HOST, PROPERTIES_CONFIG_SERVICE_PORT, PROPERTIES_CONFIG_SERVICE_RESOURCE, \
    PROPERTIES_CONFIG_SERVICE_HOST_USER, PROPERTIES_CONFIG_SERVICE_HOST_PKEY
from aiakos_client.client import AiakosApiClient
from qautils.remote.fabric_utils import FabricUtils


__author__ = "Telefonica I+D"
__copyright__ = "Copyright 2015"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("behave_environment")

# Use regular expressions for step param definition (Behave).
behave.use_step_matcher("re")


def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
        - Init Aiakos API Client
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
Ejemplo n.º 7
0
from keystoneclient import session
from keystoneclient.exceptions import ClientException as KeystoneClientException
from keystoneclient.exceptions import ConnectionRefused as KeystoneConnectionRefused
import qautils.configuration.configuration_utils as configuration_manager
from constants import PROPERTIES_CONFIG_AIAKOS
from qautils.configuration.configuration_properties import PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID, \
    PROPERTIES_CONFIG_SERVICE_OS_PASSWORD, PROPERTIES_CONFIG_SERVICE_OS_TENANT_NAME, \
    PROPERTIES_CONFIG_SERVICE_OS_USERNAME, \
    PROPERTIES_CONFIG_SERVICE_OS_DOMAIN_NAME, PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL
from qautils.logger.logger_utils import get_logger

__author__ = "Telefonica I+D"
__copyright__ = "Copyright 2015"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("authentication")


class Authentication(object):

    region_name = None
    auth_api = 'v2.0'
    auth_url = None
    auth_sess = None
    auth_token = None
    auth_cred = {}

    @classmethod
    def init_auth(cls):
        """
        Init the variables related to authorization, needed to execute tests
Ejemplo n.º 8
0
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]


from behave import step, given, then
from hamcrest import assert_that, is_, equal_to, has_key, has_length, greater_than
from commons.constants import FEATURES_NOT_EMPTY_VALUE
from glancesync_api_client.api_client import HEADER_X_AUTH_TOKEN, API_GLANCESYNC_BASE_URI
from qautils.dataset.dataset_utils import DatasetUtils
from qautils.logger.logger_utils import get_logger


__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("steps.info")
_dataset_utils = DatasetUtils()


@given(u'the API running properly')
def api_running(context):
    """API is running"""
    # Nothing to do so far.
    pass


@given(u'the user is successfully authenticated')
def user_authenticate(context):
    """User is authenticate"""

    # This is the default behaviour for GlanceSync API Client.
Ejemplo n.º 9
0
# contact with [email protected]

import behave
from qautils.logger.logger_utils import get_logger
import qautils.configuration.configuration_utils as configuration_manager

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


__author__ = "Telefonica I+D"
__copyright__ = "Copyright 2015"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("behave_environment")

# Use regular expressions for step param definition (Behave).
behave.use_step_matcher("re")


def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
    # The loaded properties will be available in 'configuration_manager.config'
Ejemplo n.º 10
0
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

__author__ = "@jframos"

from qautils.http.rest_client_utils import RestClient, API_ROOT_URL_ARG_NAME
from qautils.http.body_model_utils import response_body_to_dict
from qautils.http.headers_utils import HEADER_ACCEPT
from qautils.logger.logger_utils import get_logger

__logger__ = get_logger(__name__)

CLOTO_BASE_URI = "{" + API_ROOT_URL_ARG_NAME + "}"
CLOTO_TENANT_URI = CLOTO_BASE_URI + '/{tenant_id}/'


class TenantIdResourceClient(RestClient):
    def __init__(self, protocol, host, port, resource, headers):
        """
        Class constructor. Inits default attributes.
        :param protocol: Connection protocol (HTTP | HTTPS)
        :param host: Host
        :param port: Port
        :param tenant_id: TenantID
        :param resource: Base URI resource
        :param headers: HTTP Headers
Ejemplo n.º 11
0
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

from behave import step, given
from hamcrest import assert_that, is_not, is_, equal_to, has_key
from commons.behave_step_helpers import create_new_image, image_is_present_in_nodes, image_is_not_present_in_node
from commons.constants import WAIT_SECONDS, MAX_WAIT_TASK_FINISHED
import time
from qautils.logger.logger_utils import get_logger

__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("steps.sync_region")


@given(
    u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)"'
)
@given(
    u'a new image created in the Glance of master node with name "(?P<image_name>[\w_\.]*)" and these properties'
)
def a_new_image_created_in_glance_of_master(context, image_name):
    """Create New image in the Glance of Master Node"""

    create_new_image(context, context.master_region_name, image_name)


@given(
Ejemplo n.º 12
0
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

from behave import step, given, then
from hamcrest import assert_that, is_, equal_to, has_key, has_length, greater_than
from commons.constants import FEATURES_NOT_EMPTY_VALUE
from glancesync_api_client.api_client import HEADER_X_AUTH_TOKEN, API_GLANCESYNC_BASE_URI
from qautils.dataset.dataset_utils import DatasetUtils
from qautils.logger.logger_utils import get_logger

__copyright__ = "Copyright 2015-2016"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("steps.info")
_dataset_utils = DatasetUtils()


@given(u'the API running properly')
def api_running(context):
    """API is running"""
    # Nothing to do so far.
    pass


@given(u'the user is successfully authenticated')
def user_authenticate(context):
    """User is authenticate"""

    # This is the default behaviour for GlanceSync API Client.