aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
blob: 57b9758114eb635710f4b9c30e5c1436419fb026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#############################################################################
# Copyright (c) 2015 Ericsson AB and others.
#
# 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 logging
import os

from yardstick.benchmark.scenarios import base
import experimental_framework.api as api

LOG = logging.getLogger(__name__)


class VtcInstantiationValidationNoisy(base.Scenario):
    """Execute Instantiation Validation TC on the vTC
    """
    __scenario_type__ = "vtc_instantiation_validation_noisy"

    def __init__(self, scenario_cfg, context_cfg):
        self.scenario_cfg = scenario_cfg
        self.context_cfg = context_cfg
        self.options = None
        self.setup_done = False

    def setup(self):
        '''scenario setup'''

        self.options = self.scenario_cfg['options']
        self.setup_done = True

    def run(self, result):
        """execute test"""

        if not self.setup_done:
            self.setup()

        heat_template = 'vTC.yaml'
        iterations = 1

        openstack_credentials = {
            'ip_controller': '0.0.0.0',
            'heat_url': '***',
            'auth_uri': os.environ.get('OS_AUTH_URL'),
            'user': os.environ.get('OS_USERNAME'),
            'password': os.environ.get('OS_PASSWORD'),
            'project': os.environ.get('OS_TENANT_NAME')
        }
        heat_template_parameters = {
            'default_net': self.options['default_net_name'],
            'default_subnet': self.options['default_subnet_name'],
            'source_net': self.options['vlan_net_1_name'],
            'source_subnet': self.options['vlan_subnet_1_name'],
            'destination_net': self.options['vlan_net_2_name'],
            'destination_subnet': self.options['vlan_subnet_2_name']
        }
        deployment_configuration = {
            'vnic_type': [self.options['vnic_type']],
            'vtc_flavor': [self.options['vtc_flavor']]
        }

        test_case = dict()
        test_case['name'] = 'instantiation_validation_noisy_neighbors_' \
                            'benchmark.' \
                            'InstantiationValidationNoisyNeighborsBenchmark'
        test_case['params'] = dict()
        test_case['params']['throughput'] = '1'
        test_case['params']['vlan_sender'] = str(self.options['vlan_sender'])
        test_case['params']['vlan_receiver'] = \
            str(self.options['vlan_receiver'])
        test_case['params']['num_of_neighbours'] = \
            str(self.options['num_of_neighbours'])
        test_case['params']['amount_of_ram'] = \
            str(self.options['amount_of_ram'])
        test_case['params']['number_of_cores'] = \
            str(self.options['number_of_cores'])

        res = dict()
        try:
            res = api.FrameworkApi.execute_framework(
                [test_case],
                iterations,
                heat_template,
                heat_template_parameters,
                deployment_configuration,
                openstack_credentials)
        except Exception as e:
            LOG.info('Exception: {}'.format(e.message))
        LOG.info('Got output: {}'.format(res))
        result.update(res)