Esempio n. 1
0
#
# http://www.apache.org/licenses/LICENSE-2.0
#

import re
import sys
import time

from multiprocessing import Process, Manager, Lock
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
from sdnvpn.lib import logutil

logger = logutil.getLogger('__name__')

std_out_lock = Lock()

COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
    'sdnvpn.test.functest.testcase_10')


def monitor(in_data, out_data, vm):
    # At the beginning of ping we might have some
    # failures, so we ignore the first 10 pings
    lines_offset = 20
    while in_data["stop_thread"] is False:
        try:
            time.sleep(1)
Esempio n. 2
0
#   - Set up a Quagga instance in the functest container
#   - Start a BGP router with OpenDaylight
#   - Add the functest Quagga as a neighbor
#   - Verify that the OpenDaylight and gateway Quagga peer

import os
import sys

from sdnvpn.lib import quagga
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib.results import Results
from sdnvpn.lib import logutil

logger = logutil.getLogger(__name__)

COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
    "sdnvpn.test.functest.testcase_3")


def main():
    results = Results(COMMON_CONFIG.line_length)
    results.add_to_summary(0, "=")
    results.add_to_summary(2, "STATUS", "SUBTEST")
    results.add_to_summary(0, "=")

    openstack_nodes = test_utils.get_nodes()

    # node.is_odl() doesn't work in Apex
Esempio n. 3
0
#
# Copyright (c) 2017 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0

import yaml
import pkg_resources

from functest.utils import config
import functest.utils.functest_utils as ft_utils
from sdnvpn.lib import logutil

logger = logutil.getLogger('sdnvpn_test_config')


class CommonConfig(object):
    """
    Common configuration parameters across testcases
    """
    class __CommonConfig:
        """
        Inner class used to make CommonConfig as singleton
        """
        def __init__(self):
            self.config_file = pkg_resources.resource_filename(
                'sdnvpn', 'test/functest/config.yaml')
            self.keyfile_path = pkg_resources.resource_filename(
                'sdnvpn', 'artifacts/id_rsa')
Esempio n. 4
0
#!/usr/bin/env python
#
# Copyright (c) 2017 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import time

import functest.utils.functest_utils as ft_utils
from sdnvpn.lib import logutil

logger = logutil.getLogger('sdnvpn-results')


class Results(object):

    def __init__(self, line_length):
        self.line_length = line_length
        self.test_result = "PASS"
        self.summary = ""
        self.details = []
        self.num_tests = 0
        self.num_tests_failed = 0

    def get_ping_status(self,
                        vm_source,
                        vm_target,
                        expected="PASS", timeout=30):
Esempio n. 5
0
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
import ConfigParser
import os
import re
import shutil

import functest.opnfv_tests.openstack.tempest.conf_utils as tempest_utils
from sdnvpn.lib import logutil

logger = logutil.getLogger('sdnvpn-tempest')


def main():
    verifier_id = tempest_utils.get_verifier_id()
    deployment_id = tempest_utils.get_verifier_deployment_id()
    src_tempest_dir = tempest_utils.get_verifier_deployment_dir(
        verifier_id, deployment_id)

    if not src_tempest_dir:
        logger.error("Rally deployment not found.")
        exit(-1)

    tempest_utils.configure_verifier(src_tempest_dir)

    src_tempest_conf = os.path.join(src_tempest_dir, 'tempest.conf')
Esempio n. 6
0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
"""Utilities for setting up quagga peering"""

import re
import time

import functest.utils.functest_utils as ft_utils
import sdnvpn.lib.config as config
from sdnvpn.lib.utils import run_odl_cmd, exec_cmd
from sdnvpn.lib import logutil

logger = logutil.getLogger('sdnvpn-quagga')

COMMON_CONFIG = config.CommonConfig()


def odl_add_neighbor(neighbor_ip, controller_ip, controller):
    # Explicitly pass controller_ip because controller.ip
    # Might not be accessible from the Quagga instance
    command = 'configure-bgp -op add-neighbor --as-num 200'
    command += ' --ip %s --use-source-ip %s' % (neighbor_ip, controller_ip)
    success = run_odl_cmd(controller, command)
    # The run_cmd api is really whimsical
    logger.info("Maybe stdout of %s: %s", command, success)
    return success

Esempio n. 7
0
# http://www.apache.org/licenses/LICENSE-2.0
#
import os
import time
import requests
import re
import subprocess
from concurrent.futures import ThreadPoolExecutor

from opnfv.deployment.factory import Factory as DeploymentFactory

from sdnvpn.lib import config as sdnvpn_config
import sdnvpn.lib.openstack_utils as os_utils
from sdnvpn.lib import logutil

logger = logutil.getLogger('sdnvpn_test_utils')

common_config = sdnvpn_config.CommonConfig()

ODL_USER = '******'
ODL_PASS = '******'

executor = ThreadPoolExecutor(5)


class ExtraRoute(object):
    """
    Class to represent extra route for a router
    """

    def __init__(self, destination, nexthop):