summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_1024K-requests_65000_concurrency.yaml24
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_1b-requests_65000_concurrency.yaml2
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_256K-requests_65000_concurrency.yaml24
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_4K-requests_65000_concurrency.yaml24
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_512K-requests_65000_concurrency.yaml24
-rw-r--r--samples/vnf_samples/traffic_profiles/http_tests/HTTP_64K-requests_65000_concurrency.yaml24
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py8
-rw-r--r--tests/unit/benchmark/contexts/test_model.py172
-rw-r--r--yardstick/benchmark/contexts/heat.py1
-rw-r--r--yardstick/benchmark/contexts/model.py32
10 files changed, 329 insertions, 6 deletions
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1024K-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1024K-requests_65000_concurrency.yaml
new file mode 100644
index 000000000..bfc75982f
--- /dev/null
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1024K-requests_65000_concurrency.yaml
@@ -0,0 +1,24 @@
+schema: "nsb:traffic_profile:0.1"
+
+name: TrafficProfileGenericHTTP
+description: Traffic profile to run HTTP test
+traffic_profile:
+ traffic_type: TrafficProfileGenericHTTP
+
+#http client specific values
+uplink_0:
+ http_no_requests: "1000" # number of http iterations
+ http_concurency: "65000" # number of threads to be run
+ http_locator: "/1024K.bin" # http locator to be read
+ http_peer_address: "152.40.40.20" # address range of the servers
+ http_peer_port: "9004" # port range of the server
+ http_client_address: "152.16.100.20" # address range of the servers
+ private_subnet_mask: "255.255.255.0"
+ attacker_tests: "False" # True : If attacker Test, False : Otherwise
+
+#http server side
+downlink_0:
+ http_locator_image_size: "1024KB" # image size requested by http client
+ http_bind_address: "152.40.40.20" # where address is bound
+ http_bind_port: "9004" # when port is bound
+ public_subnet_mask: "255.255.255.0"
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1b-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1b-requests_65000_concurrency.yaml
index 3d97c8c59..112836ac9 100644
--- a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1b-requests_65000_concurrency.yaml
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_1b-requests_65000_concurrency.yaml
@@ -1,4 +1,4 @@
-schema: "isb:traffic_profile:0.1"
+schema: "nsb:traffic_profile:0.1"
name: TrafficProfileGenericHTTP
description: Traffic profile to run HTTP test
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_256K-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_256K-requests_65000_concurrency.yaml
new file mode 100644
index 000000000..100257533
--- /dev/null
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_256K-requests_65000_concurrency.yaml
@@ -0,0 +1,24 @@
+schema: "nsb:traffic_profile:0.1"
+
+name: TrafficProfileGenericHTTP
+description: Traffic profile to run HTTP test
+traffic_profile:
+ traffic_type: TrafficProfileGenericHTTP
+
+#http client specific values
+uplink_0:
+ http_no_requests: "1000" # number of http iterations
+ http_concurency: "65000" # number of threads to be run
+ http_locator: "/256K.bin" # http locator to be read
+ http_peer_address: "152.40.40.20" # address range of the servers
+ http_peer_port: "9004" # port range of the server
+ http_client_address: "152.16.100.20" # address range of the servers
+ private_subnet_mask: "255.255.255.0"
+ attacker_tests: "False" # True : If attacker Test, False : Otherwise
+
+#http server side
+downlink_0:
+ http_locator_image_size: "256KB" # image size requested by http client
+ http_bind_address: "152.40.40.20" # where address is bound
+ http_bind_port: "9004" # when port is bound
+ public_subnet_mask: "255.255.255.0"
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_4K-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_4K-requests_65000_concurrency.yaml
new file mode 100644
index 000000000..a62aeb210
--- /dev/null
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_4K-requests_65000_concurrency.yaml
@@ -0,0 +1,24 @@
+schema: "nsb:traffic_profile:0.1"
+
+name: TrafficProfileGenericHTTP
+description: Traffic profile to run HTTP test
+traffic_profile:
+ traffic_type: TrafficProfileGenericHTTP
+
+#http client specific values
+uplink_0:
+ http_no_requests: "1000" # number of http iterations
+ http_concurency: "65000" # number of threads to be run
+ http_locator: "/4K.bin" # http locator to be read
+ http_peer_address: "152.40.40.20" # address range of the servers
+ http_peer_port: "9004" # port range of the server
+ http_client_address: "152.16.100.20" # address range of the servers
+ private_subnet_mask: "255.255.255.0"
+ attacker_tests: "False" # True : If attacker Test, False : Otherwise
+
+#http server side
+downlink_0:
+ http_locator_image_size: "4KB" # image size requested by http client
+ http_bind_address: "152.40.40.20" # where address is bound
+ http_bind_port: "9004" # when port is bound
+ public_subnet_mask: "255.255.255.0"
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_512K-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_512K-requests_65000_concurrency.yaml
new file mode 100644
index 000000000..9fd76354f
--- /dev/null
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_512K-requests_65000_concurrency.yaml
@@ -0,0 +1,24 @@
+schema: "nsb:traffic_profile:0.1"
+
+name: TrafficProfileGenericHTTP
+description: Traffic profile to run HTTP test
+traffic_profile:
+ traffic_type: TrafficProfileGenericHTTP
+
+#http client specific values
+uplink_0:
+ http_no_requests: "1000" # number of http iterations
+ http_concurency: "65000" # number of threads to be run
+ http_locator: "/512K.bin" # http locator to be read
+ http_peer_address: "152.40.40.20" # address range of the servers
+ http_peer_port: "9004" # port range of the server
+ http_client_address: "152.16.100.20" # address range of the servers
+ private_subnet_mask: "255.255.255.0"
+ attacker_tests: "False" # True : If attacker Test, False : Otherwise
+
+#http server side
+downlink_0:
+ http_locator_image_size: "512KB" # image size requested by http client
+ http_bind_address: "152.40.40.20" # where address is bound
+ http_bind_port: "9004" # when port is bound
+ public_subnet_mask: "255.255.255.0"
diff --git a/samples/vnf_samples/traffic_profiles/http_tests/HTTP_64K-requests_65000_concurrency.yaml b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_64K-requests_65000_concurrency.yaml
new file mode 100644
index 000000000..4585b31e9
--- /dev/null
+++ b/samples/vnf_samples/traffic_profiles/http_tests/HTTP_64K-requests_65000_concurrency.yaml
@@ -0,0 +1,24 @@
+schema: "nsb:traffic_profile:0.1"
+
+name: TrafficProfileGenericHTTP
+description: Traffic profile to run HTTP test
+traffic_profile:
+ traffic_type: TrafficProfileGenericHTTP
+
+#http client specific values
+uplink_0:
+ http_no_requests: "1000" # number of http iterations
+ http_concurency: "65000" # number of threads to be run
+ http_locator: "/64K.bin" # http locator to be read
+ http_peer_address: "152.40.40.20" # address range of the servers
+ http_peer_port: "9004" # port range of the server
+ http_client_address: "152.16.100.20" # address range of the servers
+ private_subnet_mask: "255.255.255.0"
+ attacker_tests: "False" # True : If attacker Test, False : Otherwise
+
+#http server side
+downlink_0:
+ http_locator_image_size: "64KB" # image size requested by http client
+ http_bind_address: "152.40.40.20" # where address is bound
+ http_bind_port: "9004" # when port is bound
+ public_subnet_mask: "255.255.255.0"
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index 223d64060..f2e725df2 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -119,8 +119,12 @@ class HeatContextTestCase(unittest.TestCase):
"2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b")
mock_template.add_security_group.assert_called_with("foo-secgroup")
# mock_template.add_network.assert_called_with("bar-fool-network", 'physnet1', None)
- mock_template.add_router.assert_called_with("bar-fool-network-router", netattrs["external_network"], "bar-fool-network-subnet")
- mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0", "bar-fool-network-router", "bar-fool-network-subnet")
+ mock_template.add_router.assert_called_with("bar-fool-network-router",
+ netattrs["external_network"],
+ "bar-fool-network-subnet")
+ mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0",
+ "bar-fool-network-router",
+ "bar-fool-network-subnet")
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_attrs_get(self, mock_template):
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index 48ee01cf0..53b035b82 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -282,6 +282,178 @@ class ServerTestCase(unittest.TestCase):
scheduler_hints='hints',
availability_zone='zone')
+ def test_override_ip(self):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': [
+ {'xe0': {'local_ip': '10.44.0.20', 'netmask': '255.255.255.0'}},
+ ],
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.interfaces = {
+ "xe0": {
+ "local_ip": "1.2.3.4",
+ "netmask": "255.255.255.0",
+ },
+ "xe1": {
+ "local_ip": "1.2.3.5",
+ "netmask": "255.255.255.0"
+ }
+ }
+ test_server.network_ports = network_ports
+
+ test_server.override_ip("uplink_0", {"port": "xe0"})
+ self.assertEqual(test_server.interfaces["xe0"], network_ports["uplink_0"][0]["xe0"])
+
+ def test_override_ip_multiple(self):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': [
+ {'xe0': {'local_ip': '10.44.0.20', 'netmask': '255.255.255.0'}},
+ {'xe0': {'local_ip': '10.44.0.21', 'netmask': '255.255.255.0'}},
+ ],
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.interfaces = {
+ "xe0": {
+ "local_ip": "1.2.3.4",
+ "netmask": "255.255.255.0",
+ },
+ "xe1": {
+ "local_ip": "1.2.3.5",
+ "netmask": "255.255.255.0"
+ }
+ }
+ test_server.network_ports = network_ports
+ test_server.override_ip("uplink_0", {"port": "xe0"})
+ self.assertEqual(test_server.interfaces["xe0"], network_ports["uplink_0"][0]["xe0"])
+
+ def test_override_ip_mixed(self):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': [
+ 'xe0',
+ {'xe0': {'local_ip': '10.44.0.21', 'netmask': '255.255.255.0'}},
+ ],
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.interfaces = {
+ "xe0": {
+ "local_ip": "1.2.3.4",
+ "netmask": "255.255.255.0",
+ },
+ "xe1": {
+ "local_ip": "1.2.3.5",
+ "netmask": "255.255.255.0"
+ }
+ }
+ test_server.network_ports = network_ports
+ test_server.override_ip("uplink_0", {"port": "xe0"})
+ self.assertEqual(test_server.interfaces["xe0"], network_ports["uplink_0"][1]["xe0"])
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test__add_instance_with_ip_override_invalid_syntax(self, mock_template):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': 'xe0',
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.network_ports = network_ports
+ context = type("Context", (object,), {})
+ # can't use Mock because Mock.name is reserved
+ context.name = "context"
+ networks = [model.Network(n, context, {}) for n in network_ports]
+
+ with self.assertRaises(SyntaxError):
+ test_server._add_instance(mock_template, 'some-server',
+ networks, 'hints')
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test__add_instance_with_ip_override(self, mock_template):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': [
+ {'xe0': {'local_ip': '10.44.0.20', 'netmask': '255.255.255.0'}},
+ ],
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.network_ports = network_ports
+ context = type("Context", (object,), {})
+ # can't use Mock because Mock.name is reserved
+ context.name = "context"
+ networks = [model.Network(n, context, {}) for n in network_ports]
+
+ test_server._add_instance(mock_template, 'some-server',
+ networks, 'hints')
+ self.assertEqual(test_server.ports, {
+ 'downlink_0': [{'port': 'xe1', 'stack_name': 'some-server-xe1-port'}],
+ 'mgmt': [{'port': 'mgmt', 'stack_name': 'some-server-mgmt-port'}],
+ 'uplink_0': [{'port': 'xe0', 'stack_name': 'some-server-xe0-port'}]
+ })
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test__add_instance_with_multiple_ip_override(self, mock_template):
+ network_ports = {
+ 'mgmt': ['mgmt'],
+ 'uplink_0': [
+ {'xe0': {'local_ip': '10.44.0.20', 'netmask': '255.255.255.0'}},
+ {'xe0': {'local_ip': '10.44.0.21', 'netmask': '255.255.255.0'}},
+ ],
+ 'downlink_0': [
+ {'xe1': {'local_ip': '10.44.0.30', 'netmask': '255.255.255.0'}},
+ ],
+ }
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+ test_server.network_ports = network_ports
+ context = type("Context", (object,), {})
+ # can't use Mock because Mock.name is reserved
+ context.name = "context"
+ networks = [model.Network(n, context, {}) for n in network_ports]
+
+ test_server._add_instance(mock_template, 'some-server',
+ networks, 'hints')
+ self.assertEqual(test_server.ports, {
+ 'downlink_0': [{'port': 'xe1', 'stack_name': 'some-server-xe1-port'}],
+ 'mgmt': [{'port': 'mgmt', 'stack_name': 'some-server-mgmt-port'}],
+ 'uplink_0': [{'port': 'xe0', 'stack_name': 'some-server-xe0-port'},
+ # this is not an error, we can produce this, it is left to Heat
+ # to detect duplicate ports and error
+ {'port': 'xe0', 'stack_name': 'some-server-xe0-port'}]
+ })
+
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test__add_instance_with_user_data(self, mock_template):
user_data = "USER_DATA"
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index ff3e5f801..4ba543b9e 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -348,6 +348,7 @@ class HeatContext(Context):
port['port'],
port['stack_name'],
self.stack.outputs)
+ server.override_ip(network_name, port)
def make_interface_dict(self, network_name, port, stack_name, outputs):
private_ip = outputs[stack_name]
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index d3c03e100..ae56066ee 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -14,6 +14,8 @@ from __future__ import absolute_import
import six
import logging
+
+from collections import Mapping
from six.moves import range
@@ -241,6 +243,26 @@ class Server(Object): # pragma: no cover
Server.list.append(self)
+ def override_ip(self, network_name, port):
+ def find_port_overrides():
+ for p in ports:
+ # p can be string or dict
+ # we can't just use p[port['port'] in case p is a string
+ # and port['port'] is an int?
+ if isinstance(p, Mapping):
+ g = p.get(port['port'])
+ # filter out empty dicts
+ if g:
+ yield g
+
+ ports = self.network_ports.get(network_name, [])
+ intf = self.interfaces[port['port']]
+ for override in find_port_overrides():
+ intf['local_ip'] = override.get('local_ip', intf['local_ip'])
+ intf['netmask'] = override.get('netmask', intf['netmask'])
+ # only use the first value
+ break
+
@property
def image(self):
"""returns a server's image name"""
@@ -270,9 +292,13 @@ class Server(Object): # pragma: no cover
continue
else:
if isinstance(ports, six.string_types):
- if ports.startswith('-'):
- LOG.warning("possible YAML error, port name starts with - '%s", ports)
- ports = [ports]
+ # because strings are iterable we have to check specifically
+ raise SyntaxError("network_port must be a list '{}'".format(ports))
+ # convert port subdicts into their just port name
+ # port subdicts are used to override Heat IP address,
+ # but we just need the port name
+ # we allow duplicates here and let Heat raise the error
+ ports = [next(iter(p)) if isinstance(p, dict) else p for p in ports]
# otherwise add a port for every network with port name as network name
else:
ports = [network.name]