Bug Fix - Fixes the heat template for noisy neighbours and its deployment 97/11497/1
authoruser <user@TRAFCLASS-PACKET1.fuel.local>
Thu, 10 Mar 2016 15:10:27 +0000 (10:10 -0500)
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>
Tue, 22 Mar 2016 13:48:31 +0000 (13:48 +0000)
Change-Id: I4c45b204a06a728db276a2e4a5f905f3a34f2de5
Signed-off-by: user <user@TRAFCLASS-PACKET1.fuel.local>
(cherry picked from commit 6b3a3a061aed097fcbc7f0c4dceeabf0f7312122)

yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
yardstick/vTC/apexlake/experimental_framework/heat_manager.py
yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py
yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py

index 57b9758..8d9bf09 100644 (file)
@@ -78,6 +78,10 @@ class VtcInstantiationValidationNoisy(base.Scenario):
             str(self.options['amount_of_ram'])
         test_case['params']['number_of_cores'] = \
             str(self.options['number_of_cores'])
+        test_case['params']['network'] = \
+            str(self.options['default_net_name'])
+        test_case['params']['subnet'] = \
+            str(self.options['default_subnet_name'])
 
         res = dict()
         try:
index 703e06c..f032267 100644 (file)
@@ -77,6 +77,10 @@ class VtcThroughputNoisy(base.Scenario):
             str(self.options['amount_of_ram'])
         test_case['params']['number_of_cores'] = \
             str(self.options['number_of_cores'])
+        test_case['params']['network'] = \
+            str(self.options['default_net_name'])
+        test_case['params']['subnet'] = \
+            str(self.options['default_subnet_name'])
 
         res = dict()
         try:
index 4123563..ac7fad8 100644 (file)
@@ -34,7 +34,8 @@ class BenchmarkBaseClass(object):
                 params[param] = self.get_features()['default_values'][param]
 
         for param in self.get_features()['parameters']:
-            if params[param] not in \
+            if param in self.get_features()['allowed_values'] and \
+                    params[param] not in \
                     (self.get_features())['allowed_values'][param]:
                 raise ValueError('Value of parameter "' + param +
                                  '" is not allowed')
index 9610bc1..cbb4121 100644 (file)
@@ -20,6 +20,8 @@ from experimental_framework import common
 NUM_OF_NEIGHBORS = 'num_of_neighbours'
 AMOUNT_OF_RAM = 'amount_of_ram'
 NUMBER_OF_CORES = 'number_of_cores'
+NETWORK_NAME = 'network'
+SUBNET_NAME = 'subnet'
 
 
 class InstantiationValidationNoisyNeighborsBenchmark(
@@ -40,6 +42,8 @@ class InstantiationValidationNoisyNeighborsBenchmark(
         features['parameters'].append(NUM_OF_NEIGHBORS)
         features['parameters'].append(AMOUNT_OF_RAM)
         features['parameters'].append(NUMBER_OF_CORES)
+        features['parameters'].append(NETWORK_NAME)
+        features['parameters'].append(SUBNET_NAME)
         features['allowed_values'][NUM_OF_NEIGHBORS] = \
             ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
         features['allowed_values'][NUMBER_OF_CORES] = \
@@ -50,6 +54,8 @@ class InstantiationValidationNoisyNeighborsBenchmark(
         features['default_values'][NUM_OF_NEIGHBORS] = '1'
         features['default_values'][NUMBER_OF_CORES] = '1'
         features['default_values'][AMOUNT_OF_RAM] = '256M'
+        features['default_values'][NETWORK_NAME] = ''
+        features['default_values'][SUBNET_NAME] = ''
         return features
 
     def init(self):
@@ -58,6 +64,8 @@ class InstantiationValidationNoisyNeighborsBenchmark(
                                'local out_file = "' +
                                self.results_file + '"')
         heat_param = dict()
+        heat_param['network'] = self.params[NETWORK_NAME]
+        heat_param['subnet'] = self.params[SUBNET_NAME]
         heat_param['cores'] = self.params['number_of_cores']
         heat_param['memory'] = self.params['amount_of_ram']
         for i in range(0, int(self.params['num_of_neighbours'])):
index 3182837..ee02bcc 100644 (file)
@@ -18,6 +18,10 @@ from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
 from experimental_framework import common
 
 
+NETWORK_NAME = 'network'
+SUBNET_NAME = 'subnet'
+
+
 class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
 
     def __init__(self, name, params):
@@ -35,6 +39,8 @@ class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
         features['parameters'].append('num_of_neighbours')
         features['parameters'].append('amount_of_ram')
         features['parameters'].append('number_of_cores')
+        features['parameters'].append(NETWORK_NAME)
+        features['parameters'].append(SUBNET_NAME)
         features['allowed_values']['num_of_neighbours'] = \
             ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
         features['allowed_values']['number_of_cores'] = \
@@ -42,6 +48,8 @@ class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
         features['allowed_values']['amount_of_ram'] = \
             ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
              '10G']
+        features['default_values'][NETWORK_NAME] = ''
+        features['default_values'][SUBNET_NAME] = ''
         features['default_values']['num_of_neighbours'] = '1'
         features['default_values']['number_of_cores'] = '1'
         features['default_values']['amount_of_ram'] = '256M'
@@ -58,6 +66,8 @@ class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
         heat_param = dict()
         heat_param['cores'] = self.params['number_of_cores']
         heat_param['memory'] = self.params['amount_of_ram']
+        heat_param['network'] = self.params[NETWORK_NAME]
+        heat_param['subnet'] = self.params[SUBNET_NAME]
         for i in range(0, int(self.params['num_of_neighbours'])):
             stack_name = self.stack_name + str(i)
             common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
index 186258f..596ee7a 100644 (file)
@@ -76,7 +76,6 @@ class DeploymentUnit:
         if not os.path.isfile(template_file):
             raise ValueError('The specified file does not exist ("' +
                              template_file + '")')
-        self.heat_manager.validate_heat_template(template_file)
         try:
             self.heat_manager.create_stack(template_file, stack_name,
                                            parameters)
index 28c069f..ab3df5c 100644 (file)
@@ -76,9 +76,10 @@ class HeatManager:
         :param stack_name: Name of the stack to be checked (type: str)
         :return: (type: str)
         """
-        for stack in self.heat.stacks.list():
-            if stack.stack_name == stack_name:
-                return stack.stack_status
+        if self.heat:
+            for stack in self.heat.stacks.list():
+                if stack.stack_name == stack_name:
+                    return stack.stack_status
         return 'NOT_FOUND'
 
     def validate_heat_template(self, heat_template_file):
index 85477fe..9820705 100644 (file)
@@ -9,24 +9,18 @@ parameters:
        type: string
    memory:
        type: string
+   network:
+       type: string
+   subnet:
+       type: string
 
 resources:
-   internal_net:
-      type: OS::Neutron::Net
-      properties:
-         name: traffic_network
-   internal_subnet:
-      type: OS::Neutron::Subnet
-      properties:
-         network_id: { get_resource: internal_net }
-         cidr: 10.100.0.0/24
-
    port:
       type: OS::Neutron::Port
       properties:
-         network: { get_resource: internal_net }
+         network: { get_param: network }
          fixed_ips:
-            - subnet: { get_resource: internal_subnet }
+            - subnet: { get_param: subnet }
 
    vm1:
       type: OS::Nova::Server
@@ -49,28 +43,22 @@ resources:
                   dhclient eth1
 
                   sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
-                  touch /etc/resolfconf/resolv.conf.d/tail
-                  echo 'nameserver 8.8.8.8' > /etc/resolvconf/resolv.conf.d/tail
+                  touch /etc/resolvconf/resolv.conf.d/tail
+                  echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
                   resolvconf -u
+                  echo 'nameserver 10.118.32.193' > /etc/resolv.conf
+
 
                   # Installation of stress
                   apt-get install -y stress
 
                   cd /home/clouduser
-                  # Setup merlin
-                  rm -rf merlin
-                  mkdir merlin
-                  cd merlin
-                  wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
-                  apt-get install -y zip
-                  unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
-                  ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
-                  ./updateConfiguration.py ./instrumentation.cfg tags role=cpu_stress
-                  nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
-                  cd ..
 
                   # workload setup
-                  nohup stress -c #CORES --vm-bytes #MEMORY
+                  echo 'stress -c $CORES --vm-bytes $MEMORY' > ./stress.sh
+                  chmod +x ./stress.sh
+                  nohup ./stress.sh &
+                  #nohup stress -c #CORES --vm-bytes #MEMORY
 
                params:
                   $NAME: { get_param: name }
index 4630357..f65600f 100644 (file)
@@ -67,6 +67,8 @@ class InstantiationValidationInitTest(unittest.TestCase):
         expected['parameters'].append('throughput')
         expected['parameters'].append('vlan_sender')
         expected['parameters'].append('vlan_receiver')
+        expected['parameters'].append('network')
+        expected['parameters'].append('subnet')
         expected['parameters'].append(mut.NUM_OF_NEIGHBORS)
         expected['parameters'].append(mut.AMOUNT_OF_RAM)
         expected['parameters'].append(mut.NUMBER_OF_CORES)
@@ -83,6 +85,8 @@ class InstantiationValidationInitTest(unittest.TestCase):
         expected['default_values']['throughput'] = '1'
         expected['default_values']['vlan_sender'] = '-1'
         expected['default_values']['vlan_receiver'] = '-1'
+        expected['default_values']['network'] = ''
+        expected['default_values']['subnet'] = ''
         expected['default_values'][mut.NUM_OF_NEIGHBORS] = '1'
         expected['default_values'][mut.NUMBER_OF_CORES] = '1'
         expected['default_values'][mut.AMOUNT_OF_RAM] = '256M'
@@ -106,6 +110,8 @@ class InstantiationValidationInitTest(unittest.TestCase):
         self.iv.results_file = 'res_file'
         self.iv.params = {'number_of_cores': 1,
                           'amount_of_ram': 1,
+                          'network': 1,
+                          'subnet': 1,
                           'num_of_neighbours': 1}
         self.iv.template_file = 'template.yaml'
         self.iv.init()
@@ -115,7 +121,10 @@ class InstantiationValidationInitTest(unittest.TestCase):
                                             'res_file' + '"')
         mock_deploy_heat.assert_called_once_with('template.yaml',
                                                  'neighbour0',
-                                                 {'cores': 1, 'memory': 1})
+                                                 {'cores': 1,
+                                                  'memory': 1,
+                                                  'network': 1,
+                                                  'subnet': 1})
         self.assertEqual(self.iv.neighbor_stack_names, ['neighbour0'])
 
     @mock.patch('experimental_framework.common.replace_in_file')
index 6544fea..fc5a7fd 100644 (file)
@@ -77,6 +77,8 @@ class TestMultiTenancyThroughputBenchmark(unittest.TestCase):
         heat_param = dict()
         heat_param['cores'] = num_of_cores
         heat_param['memory'] = amount_of_ram
+        heat_param['network'] = ''
+        heat_param['subnet'] = ''
         neighbor_stack_names = list()
 
         deployment_unit.\