<commit_before># -*- coding: utf-8 -*-

# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# 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>

__author__ = 'jfernandez'


from commons.fiware_cloud_test_case import FiwareTestCase
from commons.constants import *
from novaclient.exceptions import Forbidden, OverLimit
from datetime import datetime
from commons.ssh_client import SSHClient, AuthenticationException
import socket


class FiwareRegionsBaseTests(FiwareTestCase):

    region_conf = None
    glance_conf = None

    @classmethod
    def setUpClass(cls):
        super(FiwareRegionsBaseTests, cls).setUpClass()
        cls.region_conf = cls.conf[PROPERTIES_CONFIG_REGION]
        cls.glance_conf = cls.conf[PROPERTIES_CONFIG_GLANCE]

    def setUp(self):
        super(FiwareRegionsBaseTests, self).setUp()
        self.test_world = {}
        self.init_world(self.test_world)

    def __create_keypair_test_helper__(self, keypair_name):
        """
        HELPER. Creates new Keypair
        :return: Private key value (String)
        """
        try:
            keypair_value = self.nova_operations.create_keypair(keypair_name)
            self.assertIsNotNone(keypair_value, "Problems creating keypair '%s" % keypair_name)
            self.test_world['keypair_names'].append(keypair_name)
        except Forbidden as e:
            self.logger.debug("Quota exceeded when creating a keypair")
            self.fail(e)

        return keypair_value

    def __allocate_ip_test_helper__(self):
        """
        HELPER. Allocates a IP from the Public Pool of the region<commit_msg>Fix error reading glance settings<commit_after># -*- coding: utf-8 -*-

# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# 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>

__author__ = 'jfernandez'


from commons.fiware_cloud_test_case import FiwareTestCase
from commons.constants import *
from novaclient.exceptions import Forbidden, OverLimit
from datetime import datetime
from commons.ssh_client import SSHClient, AuthenticationException
import socket


class FiwareRegionsBaseTests(FiwareTestCase):

    region_conf = None
    glance_conf = None

    @classmethod
    def setUpClass(cls):
        super(FiwareRegionsBaseTests, cls).setUpClass()
        cls.region_conf = cls.conf[PROPERTIES_CONFIG_REGION]
        cls.glance_conf = cls.conf[PROPERTIES_CONFIG_TEST][PROPERTIES_CONFIG_GLANCE]

    def setUp(self):
        super(FiwareRegionsBaseTests, self).setUp()
        self.test_world = {}
        self.init_world(self.test_world)

    def __create_keypair_test_helper__(self, keypair_name):
        """
        HELPER. Creates new Keypair
        :return: Private key value (String)
        """
        try:
            keypair_value = self.nova_operations.create_keypair(keypair_name)
            self.assertIsNotNone(keypair_value, "Problems creating keypair '%s" % keypair_name)
            self.test_world['keypair_names'].append(keypair_name)
        except Forbidden as e:
            self.logger.debug("Quota exceeded when creating a keypair")
            self.fail(e)

        return keypair_value

    def __allocate_ip_test_helper__(self):
        """
        HELPER. Allocates a IP from the Public Pool of the region
{'fraction_non_alphanumeric': 0.07603890362511052, 'fraction_numerical': 0.004862953138815208, 'mean_word_length': 3.4846382556987114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7057653', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1292, 'n_words': 411}