aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ci/cover.awk25
-rw-r--r--tests/ci/cover.sh92
-rw-r--r--tests/ci/pip_license.py80
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml28
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml30
-rw-r--r--tests/unit/apiserver/__init__.py8
-rw-r--r--tests/unit/apiserver/resources/test_env_action.py4
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py296
-rw-r--r--tests/unit/benchmark/contexts/test_kubernetes.py34
-rw-r--r--tests/unit/benchmark/contexts/test_node.py181
-rw-r--r--tests/unit/benchmark/contexts/test_standalone.py9
-rw-r--r--tests/unit/benchmark/core/test_task.py10
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_flavor.py37
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_image.py41
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_server.py42
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_create_volume.py40
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_flavor.py35
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_image.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_server.py35
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_get_flavor.py33
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_pktgen.py2
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py152
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vsperf.py2
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_bonnie.py74
-rw-r--r--tests/unit/common/test_utils.py879
-rw-r--r--tests/unit/network_services/helpers/__init__.py0
-rw-r--r--tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml50
-rw-r--r--tests/unit/network_services/helpers/test_cpu.py119
-rw-r--r--tests/unit/network_services/helpers/test_samplevnf_helper.py1082
-rw-r--r--tests/unit/network_services/libs/__init__.py0
-rw-r--r--tests/unit/network_services/libs/ixia_libs/__init__.py0
-rw-r--r--tests/unit/network_services/libs/ixia_libs/test_IxNet.py882
-rw-r--r--tests/unit/network_services/nfvi/test_resource.py220
-rw-r--r--tests/unit/network_services/test_utils.py2
-rw-r--r--tests/unit/network_services/test_yang_model.py135
-rw-r--r--tests/unit/network_services/traffic_profile/test_http_ixload.py250
-rw-r--r--tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py648
-rw-r--r--tests/unit/network_services/traffic_profile/test_rfc2544.py200
-rw-r--r--tests/unit/network_services/traffic_profile/test_traffic_profile.py10
-rw-r--r--tests/unit/network_services/vnf_generic/test_vnfdgen.py17
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/acl_1rule.yaml47
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py456
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_base.py312
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py481
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py2239
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py374
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py445
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py405
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py560
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py308
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py467
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py447
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py1002
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/vpe_config/action_bulk_512.txt512
-rwxr-xr-xtests/unit/network_services/vnf_generic/vnf/vpe_config/full_tm_profile_10G.cfg105
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/vpe_config/fw_bulk_inst0_256.txt256
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_config101
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_script384
-rw-r--r--tests/unit/test_ssh.py107
59 files changed, 12067 insertions, 2761 deletions
diff --git a/tests/ci/cover.awk b/tests/ci/cover.awk
new file mode 100644
index 000000000..e4bb816dc
--- /dev/null
+++ b/tests/ci/cover.awk
@@ -0,0 +1,25 @@
+BEGIN{
+ template = "%6s %-75s\n"
+ printf template, "Delta", "Module Path"
+}
+
+/^-/{
+ s = substr($1, 2)
+ x[s] = $3;
+};
+
+/^+/{
+ s = substr($1, 2)
+ d = $3
+ if (s in x)
+ d = d - x[s]
+ y[s" "d] = d
+}
+
+END{
+ asorti(y, z1, "@val_num_asc")
+ for (i=1; i <= length(z1); i++){
+ split(z1[i], z2, " ")
+ printf template, z2[2], z2[1]
+ }
+}
diff --git a/tests/ci/cover.sh b/tests/ci/cover.sh
index 822ed2ff2..780a85a22 100644
--- a/tests/ci/cover.sh
+++ b/tests/ci/cover.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
##############################################################################
# Copyright 2015: Mirantis Inc.
# All Rights Reserved.
@@ -17,65 +18,104 @@
# rally/tests/ci/cover.sh
##############################################################################
+if [[ -n $COVER_DIR_NAME ]]; then
+ :
+elif [[ -n $_ ]]; then
+ COVER_DIR_NAME=$( dirname $_ )
+else
+ COVER_DIR_NAME=$( dirname $0 )
+fi
+
show_diff () {
- head -1 $1
- diff -U 0 $1 $2 | sed 1,2d
+ diff -U 0 $1 $2 | awk -f $COVER_DIR_NAME/cover.awk
}
-
run_coverage_test() {
ALLOWED_EXTRA_MISSING=10
-
+ # enable debugging
+ set -x
# Stash uncommitted changes, checkout master and save coverage report
uncommited=$(git status --porcelain | grep -v "^??")
- [[ -n $uncommited ]] && git stash > /dev/null
+ [[ -n ${uncommited} ]] && git stash > /dev/null
git checkout HEAD^
baseline_report=$(mktemp -t yardstick_coverageXXXXXXX)
+ ls -l .testrepository
+
# workaround 'db type could not be determined' bug
# https://bugs.launchpad.net/testrepository/+bug/1229445
rm -rf .testrepository
- find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --slowest --testr-args="$*"
- coverage report > $baseline_report
- baseline_missing=$(awk 'END { print $3 }' $baseline_report)
+ find . -type f -name "*.pyc" -delete
+
+ #python setup.py testr --coverage --testr-args=""
+ python setup.py testr --coverage --slowest --testr-args="$*"
+ testr failing
+ coverage report > ${baseline_report}
+
+ # debug awk
+ tail -1 ${baseline_report}
+ baseline_missing=$(awk 'END { if (int($3) > 0) print $3 }' ${baseline_report})
+
+ if [[ -z $baseline_missing ]]; then
+ echo "Failed to determine baseline missing"
+ exit 1
+ fi
# Checkout back and unstash uncommitted changes (if any)
git checkout -
- [[ -n $uncommited ]] && git stash pop > /dev/null
+ [[ -n ${uncommited} ]] && git stash pop > /dev/null
# Generate and save coverage report
current_report=$(mktemp -t yardstick_coverageXXXXXXX)
+ ls -l .testrepository
+
# workaround 'db type could not be determined' bug
# https://bugs.launchpad.net/testrepository/+bug/1229445
rm -rf .testrepository
- find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --slowest --testr-args="$*"
- coverage report > $current_report
- current_missing=$(awk 'END { print $3 }' $current_report)
+ find . -type f -name "*.pyc" -delete
+
+ #python setup.py testr --coverage --testr-args=""
+ python setup.py testr --coverage --slowest --testr-args="$*"
+ testr failing
+ coverage report > ${current_report}
+
+ rm -rf cover-$PY_VER
+ coverage html -d cover-$PY_VER
+
+ # debug awk
+ tail -1 ${current_report}
+ current_missing=$(awk 'END { if (int($3) > 0) print $3 }' ${current_report})
+
+ if [[ -z $current_missing ]]; then
+ echo "Failed to determine current missing"
+ exit 1
+ fi
# Show coverage details
- allowed_missing=$((baseline_missing+ALLOWED_EXTRA_MISSING))
+ new_missing=$((current_missing - baseline_missing))
- echo "Allowed to introduce missing lines : ${ALLOWED_EXTRA_MISSING}"
+ echo "Missing lines allowed to introduce : ${ALLOWED_EXTRA_MISSING}"
+ echo "Missing lines introduced : ${new_missing}"
echo "Missing lines in master : ${baseline_missing}"
echo "Missing lines in proposed change : ${current_missing}"
- if [ $allowed_missing -gt $current_missing ];
+ if [[ ${new_missing} -gt ${ALLOWED_EXTRA_MISSING} ]];
then
- if [ $baseline_missing -lt $current_missing ];
- then
- show_diff $baseline_report $current_report
- echo "I believe you can cover all your code with 100% coverage!"
- else
- echo "Thank you! You are awesome! Keep writing unit tests! :)"
- fi
- else
- show_diff $baseline_report $current_report
+ show_diff ${baseline_report} ${current_report}
echo "Please write more unit tests, we should keep our test coverage :( "
- rm $baseline_report $current_report
+ rm ${baseline_report} ${current_report}
exit 1
+
+ elif [[ ${new_missing} -gt 0 ]];
+ then
+ show_diff ${baseline_report} ${current_report}
+ echo "I believe you can cover all your code with 100% coverage!"
+
+ else
+ echo "Thank you! You are awesome! Keep writing unit tests! :)"
fi
- rm $baseline_report $current_report
+ rm ${baseline_report} ${current_report}
}
diff --git a/tests/ci/pip_license.py b/tests/ci/pip_license.py
new file mode 100644
index 000000000..e512db7ee
--- /dev/null
+++ b/tests/ci/pip_license.py
@@ -0,0 +1,80 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# 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.
+
+import pkg_resources
+import pip.req
+import sys
+
+
+def get_pkg_license(pkg):
+ """
+ Given a package reference (as from requirements.txt),
+ return license listed in package metadata.
+ NOTE: This function does no error checking and is for
+ demonstration purposes only.
+
+ can-pip-or-setuptools-distribute-etc-list-the-license-used-by-each-install
+ https://stackoverflow.com/a/19086260
+ https://stackoverflow.com/users/308066/dkamins
+ """
+ try:
+ pkgs = pkg_resources.working_set.resolve(pkg, replace_conflicting=True)
+ # pkgs = pkg_resources.require(pkg)
+ except pkg_resources.DistributionNotFound as e:
+ sys.stderr.write("%s\n" % e)
+ return None
+ pkg = pkgs[0]
+ try:
+ info = pkg.get_metadata_lines('METADATA')
+ except IOError:
+ try:
+ info = pkg.get_metadata_lines('PKG-INFO')
+ except IOError:
+ info = []
+ licenses = []
+ for line in info:
+ if "License:" in line:
+ lic = line.split(': ', 1)[1]
+ if "UNKNOWN" not in lic:
+ # try this type first
+ licenses.append(lic)
+ # break
+ elif "License ::" in line:
+ licenses.append(" ".join(line.split(':: ')[1:3]))
+ return "; ".join(licenses)
+
+# quick and dirty hack
+
+
+def main():
+
+ reqs = list(pip.req.parse_requirements("../../requirements.txt", session='hack'))
+ lines = []
+ for req in reqs:
+ pkg = pkg_resources.parse_requirements([req.name])
+ lic = get_pkg_license(pkg)
+ markers = req.markers
+ if markers:
+ mark = "; " + str(req.markers)
+ else:
+ mark = ""
+ line = "{0}{1}\t\t# {2}\n".format(req.req, mark, lic)
+ sys.stdout.write(line)
+ lines.append(line)
+ with open("requirements.txt", "w") as rrr:
+ rrr.writelines(lines)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
index a8312876f..a37f83b83 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
@@ -17,7 +17,9 @@ description: >
"etc/yardstick/nodes/pod.yaml.ipmi.sample").
{% set file = file or '/etc/yardstick/pod.yaml' %}
-{% set jumphost = jumphost or 'node0' %}
+{% set jump_host = jump_host or 'node0' %}
+{% set attack_host = attack_host or 'node1' %}
+{% set monitor_time = monitor_time or 180 %}
scenarios:
-
@@ -25,30 +27,38 @@ scenarios:
options:
attackers:
- fault_type: "bare-metal-down"
- host: node1
- jump_host: {{jumphost}}
+ host: {{attack_host}}
+ jump_host: {{jump_host}}
monitors:
- monitor_type: "openstack-cmd"
command_name: "openstack image list"
- monitor_time: 10
+ monitor_time: {{monitor_time}}
monitor_number: 3
+ sla:
+ max_outage_time: 5
- monitor_type: "openstack-cmd"
command_name: "openstack router list"
- monitor_time: 10
+ monitor_time: {{monitor_time}}
monitor_number: 3
+ sla:
+ max_outage_time: 5
- monitor_type: "openstack-cmd"
command_name: "openstack stack list"
- monitor_time: 10
+ monitor_time: {{monitor_time}}
monitor_number: 3
+ sla:
+ max_outage_time: 5
- monitor_type: "openstack-cmd"
command_name: "openstack volume list"
- monitor_time: 10
+ monitor_time: {{monitor_time}}
monitor_number: 3
+ sla:
+ max_outage_time: 5
nodes:
- node1: node1.LF
- node0: node0.LF
+ {{attack_host}}: {{attack_host}}.LF
+ {{jump_host}}: {{jump_host}}.LF
runner:
type: Iteration
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
index c229277f4..417327cb6 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
@@ -13,11 +13,15 @@ description: >
Test case for TC054 :OpenStack VIP Master Node abnormally shutdown High Availability;
This test case is written by new scenario-based HA testing framework.
+{% set attack_host = attack_host or 'node1' %}
+{% set check_host = check_host or 'node2' %}
+{% set jump_host = jump_host or 'node0' %}
{% set file = file or '/etc/yardstick/pod.yaml' %}
{% set vip_management = vip_management or '192.168.0.2' %}
{% set vip_public = vip_public or '172.16.0.3' %}
{% set vip_router_management = vip_router_management or '192.168.0.1' %}
{% set vip_router_public = vip_router_public or '172.16.0.2' %}
+{% set monitor_time = monitor_time or 180 %}
scenarios:
-
@@ -26,15 +30,16 @@ scenarios:
attackers:
-
fault_type: "bare-metal-down"
- host: node1
+ host: {{attack_host}}
key: "bare-metal-down"
+ jump_host: {{jump_host}}
monitors:
-
monitor_type: "openstack-cmd"
key: "list-images"
command_name: "openstack image list"
- monitor_time: 10
+ monitor_time: {{monitor_time}}
monitor_number: 3
sla:
max_outage_time: 5
@@ -43,8 +48,8 @@ scenarios:
monitor_type: "general-monitor"
monitor_key: "ip-status"
key: "vip-mgmt-status"
- host: node2
- monitor_time: 10
+ host: {{check_host}}
+ monitor_time: {{monitor_time}}
monitor_number: 3
sla:
max_outage_time: 5
@@ -55,8 +60,8 @@ scenarios:
monitor_type: "general-monitor"
monitor_key: "ip-status"
key: "vip-routerp-status"
- host: node2
- monitor_time: 10
+ host: {{check_host}}
+ monitor_time: {{monitor_time}}
monitor_number: 3
sla:
max_outage_time: 5
@@ -67,8 +72,8 @@ scenarios:
monitor_type: "general-monitor"
monitor_key: "ip-status"
key: "vip-router-status"
- host: node2
- monitor_time: 10
+ host: {{check_host}}
+ monitor_time: {{monitor_time}}
monitor_number: 3
sla:
max_outage_time: 5
@@ -79,8 +84,8 @@ scenarios:
monitor_type: "general-monitor"
monitor_key: "ip-status"
key: "vip-pub"
- host: node2
- monitor_time: 10
+ host: {{check_host}}
+ monitor_time: {{monitor_time}}
monitor_number: 3
sla:
max_outage_time: 5
@@ -119,8 +124,9 @@ scenarios:
index: 6
nodes:
- node1: node1.LF
- node2: node2.LF
+ {{jump_host}}: {{jump_host}}.LF
+ {{attack_host}}: {{attack_host}}.LF
+ {{check_host}}: {{check_host}}.LF
runner:
type: Duration
duration: 1
diff --git a/tests/unit/apiserver/__init__.py b/tests/unit/apiserver/__init__.py
index 021415296..1c9d5a672 100644
--- a/tests/unit/apiserver/__init__.py
+++ b/tests/unit/apiserver/__init__.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import os
+import socket
import unittest
import tempfile
@@ -14,7 +15,12 @@ class APITestCase(unittest.TestCase):
def setUp(self):
self.db_fd, self.db_path = tempfile.mkstemp()
consts.SQLITE = 'sqlite:///{}'.format(self.db_path)
- from api import server
+
+ try:
+ from api import server
+ except socket.gaierror:
+ self.app = None
+ return
server.app.config['TESTING'] = True
self.app = server.app.test_client()
diff --git a/tests/unit/apiserver/resources/test_env_action.py b/tests/unit/apiserver/resources/test_env_action.py
index 31afa4862..5417ad953 100644
--- a/tests/unit/apiserver/resources/test_env_action.py
+++ b/tests/unit/apiserver/resources/test_env_action.py
@@ -17,6 +17,10 @@ from tests.unit.apiserver import APITestCase
class EnvTestCase(APITestCase):
def test_create_grafana(self):
+ if self.app is None:
+ unittest.skip('host config error')
+ return
+
url = 'yardstick/env/action'
data = {'action': 'create_grafana'}
resp = self._post(url, data)
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index ae57402c0..658a8e580 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -22,21 +22,24 @@ from collections import OrderedDict
import mock
+from itertools import count
from yardstick.benchmark.contexts import heat
from yardstick.benchmark.contexts import model
-
LOG = logging.getLogger(__name__)
class HeatContextTestCase(unittest.TestCase):
+ def __init__(self, *args, **kwargs):
+ super(HeatContextTestCase, self).__init__(*args, **kwargs)
+ self.name_iter = ('vnf{:03}'.format(x) for x in count(0, step=3))
+
def setUp(self):
self.test_context = heat.HeatContext()
self.mock_context = mock.Mock(spec=heat.HeatContext())
- def test_construct(self):
-
+ def test___init__(self):
self.assertIsNone(self.test_context.name)
self.assertIsNone(self.test_context.stack)
self.assertEqual(self.test_context.networks, OrderedDict())
@@ -121,18 +124,63 @@ class HeatContextTestCase(unittest.TestCase):
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):
+ image, flavor, user = expected_tuple = 'foo1', 'foo2', 'foo3'
+ self.assertNotEqual(self.test_context.image, image)
+ self.assertNotEqual(self.test_context.flavor, flavor)
+ self.assertNotEqual(self.test_context.user, user)
+ self.test_context._image = image
+ self.test_context._flavor = flavor
+ self.test_context._user = user
+ attr_tuple = self.test_context.image, self.test_context.flavor, self.test_context.user
+ self.assertEqual(attr_tuple, expected_tuple)
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test_attrs_set_negative(self, mock_template):
+ with self.assertRaises(AttributeError):
+ self.test_context.image = 'foo'
+
+ with self.assertRaises(AttributeError):
+ self.test_context.flavor = 'foo'
+
+ with self.assertRaises(AttributeError):
+ self.test_context.user = 'foo'
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
@mock.patch('yardstick.benchmark.contexts.heat.get_neutron_client')
- def test_deploy(self, mock_neutron, mock_template):
+ def test_attrs_get(self, mock_neutron, mock_template):
+ image, flavor, user = expected_tuple = 'foo1', 'foo2', 'foo3'
+ self.assertNotEqual(self.test_context.image, image)
+ self.assertNotEqual(self.test_context.flavor, flavor)
+ self.assertNotEqual(self.test_context.user, user)
+ self.test_context._image = image
+ self.test_context._flavor = flavor
+ self.test_context._user = user
+ attr_tuple = self.test_context.image, self.test_context.flavor, self.test_context.user
+ self.assertEqual(attr_tuple, expected_tuple)
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test_attrs_set_negative(self, mock_template):
+ with self.assertRaises(AttributeError):
+ self.test_context.image = 'foo'
+
+ with self.assertRaises(AttributeError):
+ self.test_context.flavor = 'foo'
+
+ with self.assertRaises(AttributeError):
+ self.test_context.user = 'foo'
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test_deploy(self, mock_template):
self.test_context.name = 'foo'
self.test_context.template_file = '/bar/baz/some-heat-file'
self.test_context.heat_parameters = {'image': 'cirros'}
- self.test_context.heat_timeout = 5
+ self.test_context.get_neutron_info = mock.MagicMock()
self.test_context.deploy()
- mock_template.assert_called_with(self.test_context.name,
- self.test_context.template_file,
- self.test_context.heat_parameters)
+ mock_template.assert_called_with('foo',
+ '/bar/baz/some-heat-file',
+ {'image': 'cirros'})
self.assertIsNotNone(self.test_context.stack)
def test_add_server_port(self):
@@ -190,27 +238,233 @@ class HeatContextTestCase(unittest.TestCase):
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_undeploy(self, mock_template):
-
self.test_context.stack = mock_template
self.test_context.undeploy()
-
self.assertTrue(mock_template.delete.called)
- def test__get_server(self):
-
- self.mock_context.name = 'bar'
- self.mock_context.stack.outputs = {'public_ip': '127.0.0.1',
- 'private_ip': '10.0.0.1'}
- self.mock_context.key_uuid = uuid.uuid4()
-
- attr_name = {'name': 'foo.bar',
- 'public_ip_attr': 'public_ip',
- 'private_ip_attr': 'private_ip'}
- result = heat.HeatContext._get_server(self.mock_context, attr_name)
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ @mock.patch('yardstick.benchmark.contexts.heat.os')
+ def test_undeploy_key_filename(self, mock_template, mock_os):
+ self.test_context.stack = mock_template
+ mock_os.path.exists.return_value = True
+ self.assertIsNone(self.test_context.undeploy())
+
+ def test__get_server_found_dict(self):
+ """
+ Use HeatContext._get_server to get a server that matches
+ based on a dictionary input.
+ """
+ foo2_server = mock.Mock()
+ foo2_server.key_filename = 'key_file'
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.key_filename = 'key_filename'
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = '127.0.0.3'
+ baz3_server.context.user = 'zab'
+
+ self.test_context.name = 'bar'
+ self.test_context._user = 'bot'
+ self.test_context.stack = mock.Mock()
+ self.test_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.test_context.key_uuid = uuid.uuid4()
+ self.test_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ }
+ attr_name = {
+ 'name': 'foo.bar',
+ 'private_ip_attr': 'private_ip',
+ 'public_ip_attr': 'public_ip',
+ }
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result['user'], 'bot')
+ self.assertIsNotNone(result['key_filename'])
self.assertEqual(result['ip'], '127.0.0.1')
self.assertEqual(result['private_ip'], '10.0.0.1')
+ def test__get_server_found_dict_no_attrs(self):
+ """
+ Use HeatContext._get_server to get a server that matches
+ based on a dictionary input.
+ """
+ foo2_server = mock.Mock()
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = '127.0.0.3'
+ baz3_server.context.user = 'zab'
+
+ self.test_context.name = 'bar'
+ self.test_context._user = 'bot'
+ self.test_context.stack = mock.Mock()
+ self.test_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.test_context.key_uuid = uuid.uuid4()
+ self.test_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ }
+
+ attr_name = {
+ 'name': 'foo.bar',
+ }
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result['user'], 'bot')
+ self.assertIsNotNone(result['key_filename'])
+ # no private ip attr mapping in the map results in None value in the result
+ self.assertIsNone(result['private_ip'])
+ # no public ip attr mapping in the map results in no value in the result
+ self.assertNotIn('ip', result)
+
+ def test__get_server_found_not_dict(self):
+ """
+ Use HeatContext._get_server to get a server that matches
+ based on a non-dictionary input
+ """
+ foo2_server = mock.Mock()
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = None
+ baz3_server.context.user = 'zab'
+
+ self.test_context.name = 'bar1'
+ self.test_context.stack = mock.Mock()
+ self.test_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.test_context.key_uuid = uuid.uuid4()
+ self.test_context.generate_routing_table = mock.MagicMock(return_value=[])
+
+ self.test_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ }
+
+ attr_name = 'baz3'
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result['user'], 'zab')
+ self.assertIsNotNone(result['key_filename'])
+ self.assertEqual(result['private_ip'], '10.0.0.3')
+ # no public_ip on the server results in no value in the result
+ self.assertNotIn('public_ip', result)
+
+ def test__get_server_none_found_not_dict(self):
+ """
+ Use HeatContext._get_server to not get a server due to
+ None value associated with the match to a non-dictionary
+ input
+ """
+ foo2_server = mock.Mock()
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = None
+ baz3_server.context.user = 'zab'
+
+ self.test_context.name = 'bar1'
+ self.test_context.stack = mock.Mock()
+ self.test_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.test_context.key_uuid = uuid.uuid4()
+ self.test_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ 'wow4': None,
+ }
+
+ attr_name = 'wow4'
+ result = self.test_context._get_server(attr_name)
+ self.assertIsNone(result)
+
+ def test__get_server_not_found_dict(self):
+ """
+ Use HeatContext._get_server to not get a server for lack
+ of a match to a dictionary input
+ """
+ foo2_server = mock.Mock()
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = None
+ baz3_server.context.user = 'zab'
+
+ self.test_context.name = 'bar1'
+ self.test_context.stack = mock.Mock()
+ self.test_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.test_context.key_uuid = uuid.uuid4()
+ self.test_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ }
+
+ attr_name = {
+ 'name': 'foo.wow4',
+ 'private_ip_attr': 'private_ip',
+ 'public_ip_attr': 'public_ip',
+ }
+ result = self.test_context._get_server(attr_name)
+ self.assertIsNone(result)
+
+ def test__get_server_not_found_not_dict(self):
+ """
+ Use HeatContext._get_server to not get a server for lack
+ of a match to a non-dictionary input
+ """
+ foo2_server = mock.Mock()
+ foo2_server.private_ip = '10.0.0.2'
+ foo2_server.public_ip = '127.0.0.2'
+ foo2_server.context.user = 'oof'
+
+ baz3_server = mock.Mock()
+ baz3_server.private_ip = '10.0.0.3'
+ baz3_server.public_ip = None
+ baz3_server.context.user = 'zab'
+
+ self.mock_context.name = 'bar1'
+ self.test_context.stack = mock.Mock()
+ self.mock_context.stack.outputs = {
+ 'private_ip': '10.0.0.1',
+ 'public_ip': '127.0.0.1',
+ }
+ self.mock_context.key_uuid = uuid.uuid4()
+ self.mock_context._server_map = {
+ 'baz3': baz3_server,
+ 'foo2': foo2_server,
+ }
+
+ attr_name = 'foo.wow4'
+ result = self.test_context._get_server(attr_name)
+ self.assertIsNone(result)
+
def test__get_network(self):
network1 = mock.MagicMock()
network1.name = 'net_1'
diff --git a/tests/unit/benchmark/contexts/test_kubernetes.py b/tests/unit/benchmark/contexts/test_kubernetes.py
index f47c07a67..b0ee792db 100644
--- a/tests/unit/benchmark/contexts/test_kubernetes.py
+++ b/tests/unit/benchmark/contexts/test_kubernetes.py
@@ -15,6 +15,7 @@ from __future__ import absolute_import
import unittest
import mock
+from yardstick.benchmark.contexts.base import Context
from yardstick.benchmark.contexts.kubernetes import KubernetesContext
@@ -40,7 +41,11 @@ service ssh restart;while true ; do sleep 10000; done']
prefix = 'yardstick.benchmark.contexts.kubernetes'
-class UndeployTestCase(unittest.TestCase):
+class KubernetesTestCase(unittest.TestCase):
+
+ def tearDown(self):
+ # clear kubernetes contexts from global list so we don't break other tests
+ Context.list = []
@mock.patch('{}.KubernetesContext._delete_ssh_key'.format(prefix))
@mock.patch('{}.KubernetesContext._delete_rcs'.format(prefix))
@@ -57,9 +62,6 @@ class UndeployTestCase(unittest.TestCase):
self.assertTrue(mock_delete_rcs.called)
self.assertTrue(mock_delete_pods.called)
-
-class DeployTestCase(unittest.TestCase):
-
@mock.patch('{}.KubernetesContext._wait_until_running'.format(prefix))
@mock.patch('{}.KubernetesTemplate.get_rc_pods'.format(prefix))
@mock.patch('{}.KubernetesContext._create_rcs'.format(prefix))
@@ -72,15 +74,13 @@ class DeployTestCase(unittest.TestCase):
k8s_context = KubernetesContext()
k8s_context.init(context_cfg)
- k8s_context.deploy()
+ with mock.patch("yardstick.benchmark.contexts.kubernetes.time"):
+ k8s_context.deploy()
self.assertTrue(mock_set_ssh_key.called)
self.assertTrue(mock_create_rcs.called)
self.assertTrue(mock_get_rc_pods.called)
self.assertTrue(mock_wait_until_running.called)
-
-class SSHKeyTestCase(unittest.TestCase):
-
@mock.patch('{}.k8s_utils.delete_config_map'.format(prefix))
@mock.patch('{}.k8s_utils.create_config_map'.format(prefix))
def test_ssh_key(self, mock_create, mock_delete):
@@ -92,9 +92,6 @@ class SSHKeyTestCase(unittest.TestCase):
self.assertTrue(mock_create.called)
self.assertTrue(mock_delete.called)
-
-class WaitUntilRunningTestCase(unittest.TestCase):
-
@mock.patch('{}.k8s_utils.read_pod_status'.format(prefix))
def test_wait_until_running(self, mock_read_pod_status):
@@ -104,9 +101,6 @@ class WaitUntilRunningTestCase(unittest.TestCase):
mock_read_pod_status.return_value = 'Running'
k8s_context._wait_until_running()
-
-class GetServerTestCase(unittest.TestCase):
-
@mock.patch('{}.k8s_utils.get_pod_list'.format(prefix))
def test_get_server(self, mock_get_pod_list):
k8s_context = KubernetesContext()
@@ -116,9 +110,6 @@ class GetServerTestCase(unittest.TestCase):
server = k8s_context._get_server('server')
self.assertIsNone(server)
-
-class CreateRcsTestCase(unittest.TestCase):
-
@mock.patch('{}.KubernetesContext._create_rc'.format(prefix))
def test_create_rcs(self, mock_create_rc):
k8s_context = KubernetesContext()
@@ -126,9 +117,6 @@ class CreateRcsTestCase(unittest.TestCase):
k8s_context._create_rcs()
self.assertTrue(mock_create_rc.called)
-
-class CreateRcTestCase(unittest.TestCase):
-
@mock.patch('{}.k8s_utils.create_replication_controller'.format(prefix))
def test_create_rc(self, mock_create_replication_controller):
k8s_context = KubernetesContext()
@@ -136,9 +124,6 @@ class CreateRcTestCase(unittest.TestCase):
k8s_context._create_rc({})
self.assertTrue(mock_create_replication_controller.called)
-
-class DeleteRcsTestCases(unittest.TestCase):
-
@mock.patch('{}.KubernetesContext._delete_rc'.format(prefix))
def test_delete_rcs(self, mock_delete_rc):
k8s_context = KubernetesContext()
@@ -146,9 +131,6 @@ class DeleteRcsTestCases(unittest.TestCase):
k8s_context._delete_rcs()
self.assertTrue(mock_delete_rc.called)
-
-class DeleteRcTestCase(unittest.TestCase):
-
@mock.patch('{}.k8s_utils.delete_replication_controller'.format(prefix))
def test_delete_rc(self, mock_delete_replication_controller):
k8s_context = KubernetesContext()
diff --git a/tests/unit/benchmark/contexts/test_node.py b/tests/unit/benchmark/contexts/test_node.py
index d5ce8c5cb..9b5761c8d 100644
--- a/tests/unit/benchmark/contexts/test_node.py
+++ b/tests/unit/benchmark/contexts/test_node.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+# Copyright (c) 2015-2017 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -14,36 +14,128 @@
from __future__ import absolute_import
import os
import unittest
+import errno
import mock
+from yardstick.common import constants as consts
from yardstick.benchmark.contexts import node
class NodeContextTestCase(unittest.TestCase):
+ PREFIX = 'yardstick.benchmark.contexts.node'
+
NODES_SAMPLE = "nodes_sample.yaml"
NODES_DUPLICATE_SAMPLE = "nodes_duplicate_sample.yaml"
def setUp(self):
self.test_context = node.NodeContext()
+ self.os_path_join = os.path.join
- def test_construct(self):
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = self.os_path_join(curr_path, filename)
+ return file_path
+ def test___init__(self):
self.assertIsNone(self.test_context.name)
self.assertIsNone(self.test_context.file_path)
self.assertEqual(self.test_context.nodes, [])
self.assertEqual(self.test_context.controllers, [])
self.assertEqual(self.test_context.computes, [])
self.assertEqual(self.test_context.baremetals, [])
+ self.assertEqual(self.test_context.env, {})
+ self.assertEqual(self.test_context.attrs, {})
+
+ @mock.patch('{}.os.path.join'.format(PREFIX))
+ def test_init_negative(self, mock_path_join):
+ special_path = '/foo/bar/error_file'
+ error_path = self._get_file_abspath("error_file")
- def test_unsuccessful_init(self):
+ def path_join(*args):
+ if args == (consts.YARDSTICK_ROOT_PATH, error_path):
+ return special_path
+ return self.os_path_join(*args)
+
+ # we can't count mock_path_join calls because
+ # it can catch join calls for .pyc files.
+ mock_path_join.side_effect = path_join
+ self.test_context.read_config_file = read_mock = mock.Mock()
+ read_calls = 0
+
+ with self.assertRaises(KeyError):
+ self.test_context.init({})
+
+ self.assertEqual(read_mock.call_count, read_calls)
attrs = {
'name': 'foo',
- 'file': self._get_file_abspath("error_file")
+ 'file': error_path,
}
+ read_mock.side_effect = IOError(errno.EBUSY, 'busy')
+ with self.assertRaises(IOError) as raised:
+ self.test_context.init(attrs)
+
+ read_calls += 1
+ self.assertEqual(read_mock.called, read_calls)
+ self.assertIn(attrs['file'], self.test_context.file_path)
+ self.assertEqual(raised.exception.errno, errno.EBUSY)
+ self.assertEqual(str(raised.exception), str(read_mock.side_effect))
+
+ read_mock.side_effect = IOError(errno.ENOENT, 'not found')
+ with self.assertRaises(IOError) as raised:
+ self.test_context.init(attrs)
+
+ read_calls += 2
+ self.assertEqual(read_mock.call_count, read_calls)
+ self.assertEqual(self.test_context.file_path, special_path)
+ self.assertEqual(raised.exception.errno, errno.ENOENT)
+ self.assertEqual(str(raised.exception), str(read_mock.side_effect))
+
+ def test_read_config_file(self):
+
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
+
+ self.test_context.init(attrs)
+
+ self.assertIsNotNone(self.test_context.read_config_file())
+
+ def test__dispatch_script(self):
+
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
+
+ self.test_context.init(attrs)
+
+ self.test_context.env = {'bash': [{'script': 'dummy'}]}
+ self.test_context._execute_script = mock.Mock()
+ self.assertEqual(self.test_context._dispatch_script('bash'), None)
+
+ def test__dispatch_ansible(self):
+
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
+
+ self.test_context.init(attrs)
- self.assertRaises(IOError, self.test_context.init, attrs)
+ self.test_context.env = {'ansible': [{'script': 'dummy'}]}
+ self.test_context._do_ansible_job = mock.Mock()
+ self.assertEqual(self.test_context._dispatch_ansible('ansible'), None)
+ self.test_context.env = {}
+ self.assertEqual(self.test_context._dispatch_ansible('ansible'), None)
+
+ @mock.patch("{}.subprocess".format(PREFIX))
+ def test__do_ansible_job(self, mock_subprocess):
+ mock_subprocess.Popen = mock.MagicMock()
+ mock_subprocess.communicate = mock.Mock()
+ self.assertEqual(None, self.test_context._do_ansible_job('dummy'))
def test_successful_init(self):
@@ -90,6 +182,20 @@ class NodeContextTestCase(unittest.TestCase):
self.assertEqual(result, None)
+ def test__get_server_mismatch(self):
+
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
+
+ self.test_context.init(attrs)
+
+ attr_name = 'bar.foo1'
+ result = self.test_context._get_server(attr_name)
+
+ self.assertEqual(result, None)
+
def test__get_server_duplicate(self):
attrs = {
@@ -100,8 +206,8 @@ class NodeContextTestCase(unittest.TestCase):
self.test_context.init(attrs)
attr_name = 'node1.foo'
-
- self.assertRaises(ValueError, self.test_context._get_server, attr_name)
+ with self.assertRaises(ValueError):
+ self.test_context._get_server(attr_name)
def test__get_server_found(self):
@@ -120,14 +226,7 @@ class NodeContextTestCase(unittest.TestCase):
self.assertEqual(result['user'], 'root')
self.assertEqual(result['key_filename'], '/root/.yardstick_key')
- def _get_file_abspath(self, filename):
- curr_path = os.path.dirname(os.path.abspath(__file__))
- file_path = os.path.join(curr_path, filename)
- return file_path
-
- prefix = 'yardstick.benchmark.contexts.node'
-
- @mock.patch('{}.NodeContext._dispatch_script'.format(prefix))
+ @mock.patch('{}.NodeContext._dispatch_script'.format(PREFIX))
def test_deploy(self, dispatch_script_mock):
obj = node.NodeContext()
obj.env = {
@@ -136,7 +235,16 @@ class NodeContextTestCase(unittest.TestCase):
obj.deploy()
self.assertTrue(dispatch_script_mock.called)
- @mock.patch('{}.NodeContext._dispatch_script'.format(prefix))
+ @mock.patch('{}.NodeContext._dispatch_ansible'.format(PREFIX))
+ def test_deploy_anisible(self, dispatch_ansible_mock):
+ obj = node.NodeContext()
+ obj.env = {
+ 'type': 'ansible'
+ }
+ obj.deploy()
+ self.assertTrue(dispatch_ansible_mock.called)
+
+ @mock.patch('{}.NodeContext._dispatch_script'.format(PREFIX))
def test_undeploy(self, dispatch_script_mock):
obj = node.NodeContext()
obj.env = {
@@ -145,8 +253,17 @@ class NodeContextTestCase(unittest.TestCase):
obj.undeploy()
self.assertTrue(dispatch_script_mock.called)
- @mock.patch('{}.ssh.SSH._put_file_shell'.format(prefix))
- @mock.patch('{}.ssh.SSH.execute'.format(prefix))
+ @mock.patch('{}.NodeContext._dispatch_ansible'.format(PREFIX))
+ def test_undeploy_anisble(self, dispatch_ansible_mock):
+ obj = node.NodeContext()
+ obj.env = {
+ 'type': 'ansible'
+ }
+ obj.undeploy()
+ self.assertTrue(dispatch_ansible_mock.called)
+
+ @mock.patch('{}.ssh.SSH._put_file_shell'.format(PREFIX))
+ @mock.patch('{}.ssh.SSH.execute'.format(PREFIX))
def test_execute_remote_script(self, execute_mock, put_file_mock):
obj = node.NodeContext()
obj.env = {'prefix': 'yardstick.benchmark.scenarios.compute'}
@@ -165,14 +282,14 @@ class NodeContextTestCase(unittest.TestCase):
self.assertTrue(put_file_mock.called)
self.assertTrue(execute_mock.called)
- @mock.patch('{}.NodeContext._execute_local_script'.format(prefix))
+ @mock.patch('{}.NodeContext._execute_local_script'.format(PREFIX))
def test_execute_script_local(self, local_execute_mock):
node_name = 'local'
info = {}
node.NodeContext()._execute_script(node_name, info)
self.assertTrue(local_execute_mock.called)
- @mock.patch('{}.NodeContext._execute_remote_script'.format(prefix))
+ @mock.patch('{}.NodeContext._execute_remote_script'.format(PREFIX))
def test_execute_script_remote(self, remote_execute_mock):
node_name = 'node5'
info = {}
@@ -195,7 +312,7 @@ class NodeContextTestCase(unittest.TestCase):
node_info = obj._get_node_info(node_name_args)
self.assertEqual(node_info.get('check'), node_name_args)
- @mock.patch('{}.ssh.SSH.wait'.format(prefix))
+ @mock.patch('{}.ssh.SSH.wait'.format(PREFIX))
def test_get_client(self, wait_mock):
node_name_args = 'node5'
obj = node.NodeContext()
@@ -208,6 +325,28 @@ class NodeContextTestCase(unittest.TestCase):
obj._get_client(node_name_args)
self.assertTrue(wait_mock.called)
+ def test_get_server(self):
+ self.test_context.name = 'vnf1'
+ self.test_context.nodes = [{'name': 'my', 'value': 100}]
+
+ with self.assertRaises(ValueError):
+ self.test_context.get_server('my.vnf2')
+
+ expected = {'name': 'my.vnf1', 'value': 100, 'interfaces': {}}
+ result = self.test_context.get_server('my.vnf1')
+ self.assertDictEqual(result, expected)
+
+ def test_get_context_from_server(self):
+ self.test_context.name = 'vnf1'
+ self.test_context.nodes = [{'name': 'my', 'value': 100}]
+ self.test_context.attrs = {'attr1': 200}
+
+ with self.assertRaises(ValueError):
+ self.test_context.get_context_from_server('my.vnf2')
+
+ result = self.test_context.get_context_from_server('my.vnf1')
+ self.assertIs(result, self.test_context)
+
def test__get_network(self):
network1 = {
'name': 'net_1',
diff --git a/tests/unit/benchmark/contexts/test_standalone.py b/tests/unit/benchmark/contexts/test_standalone.py
index 1fc740393..d13e28470 100644
--- a/tests/unit/benchmark/contexts/test_standalone.py
+++ b/tests/unit/benchmark/contexts/test_standalone.py
@@ -194,8 +194,6 @@ class StandaloneContextTestCase(unittest.TestCase):
result = self.test_context._get_server(attr_name)
self.assertEqual(result, None)
-
-
def test__get_server_duplicate_sriov(self, mock_sriov_time, mock_standlalone_time,
mock_ovsdpdk_time):
attrs = {
@@ -244,6 +242,7 @@ class StandaloneContextTestCase(unittest.TestCase):
ValueError,
self.test_context._get_server,
attr_name)
+
def test__get_server_found_sriov(self, mock_sriov_time, mock_standlalone_time,
mock_ovsdpdk_time):
attrs = {
@@ -453,11 +452,6 @@ class StandaloneContextTestCase(unittest.TestCase):
self.test_context.nfvi_obj.setup_ovs_bridge = mock.Mock()
self.test_context.nfvi_obj.add_oflows = mock.Mock()
- # self.test_context.nfvi_obj.setup_ovs(PORTS)
- # self.test_context.nfvi_obj.start_ovs_serverswitch()
- # self.test_context.nfvi_obj.setup_ovs_bridge()
- # self.test_context.nfvi_obj.add_oflows()
-
result = self.test_context.nfvi_obj.setup_ovs_context(
PORTS,
NIC_DETAILS,
@@ -681,6 +675,7 @@ class StandaloneContextTestCase(unittest.TestCase):
expected = network1
result = self.test_context._get_network(attr_name)
self.assertDictEqual(result, expected)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index 7f617537e..25688bf48 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -118,7 +118,8 @@ class TaskTestCase(unittest.TestCase):
},
])
- expected_get_network_calls = 4 # once for each vld_id in the nodes dict
+ # once for each vld_id in the nodes dict
+ expected_get_network_calls = 4
expected = {
'a': {'name': 'a', 'network_type': 'private'},
'b': {'name': 'b', 'vld_id': 'y', 'subnet_cidr': '10.20.0.0/16'},
@@ -289,6 +290,13 @@ class TaskTestCase(unittest.TestCase):
task.change_server_name(scenario, suffix)
self.assertTrue(scenario['target']['name'], 'demo-8')
+ @mock.patch('yardstick.benchmark.core.task.logging')
+ def test_set_log(self, mock_logging):
+ task_obj = task.Task()
+ task_obj.task_id = 'task_id'
+ task_obj._set_log()
+ self.assertTrue(mock_logging.root.addHandler.called)
+
def _get_file_abspath(self, filename):
curr_path = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(curr_path, filename)
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_flavor.py b/tests/unit/benchmark/scenarios/lib/test_create_flavor.py
new file mode 100644
index 000000000..036ae952d
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_create_flavor.py
@@ -0,0 +1,37 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.create_flavor import CreateFlavor
+
+
+class CreateFlavorTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.create_flavor')
+ def test_create_flavor(self, mock_create_flavor):
+ options = {
+ 'flavor_name': 'yardstick_test_flavor',
+ 'vcpus': '2',
+ 'ram': '1024',
+ 'disk': '100',
+ 'is_public': 'True'
+ }
+ args = {"options": options}
+ obj = CreateFlavor(args, {})
+ obj.run({})
+ self.assertTrue(mock_create_flavor.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_image.py b/tests/unit/benchmark/scenarios/lib/test_create_image.py
new file mode 100644
index 000000000..c213ceba0
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_create_image.py
@@ -0,0 +1,41 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.create_image import CreateImage
+
+
+class CreateImageTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.create_image')
+ @mock.patch('yardstick.common.openstack_utils.get_glance_client')
+ def test_create_image(self, mock_get_glance_client, mock_create_image):
+ options = {
+ 'image_name': 'yardstick_test_image_01',
+ 'disk_format': 'qcow2',
+ 'container_format': 'bare',
+ 'min_disk': '1',
+ 'min_ram': '512',
+ 'protected': 'False',
+ 'tags': '["yardstick automatic test image"]',
+ 'file_path': '/home/opnfv/images/cirros-0.3.5-x86_64-disk.img'
+ }
+ args = {"options": options}
+ obj = CreateImage(args, {})
+ obj.run({})
+ self.assertTrue(mock_create_image.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_server.py b/tests/unit/benchmark/scenarios/lib/test_create_server.py
new file mode 100644
index 000000000..7c4193132
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_create_server.py
@@ -0,0 +1,42 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.create_server import CreateServer
+
+
+class CreateServerTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.create_instance_and_wait_for_active')
+ @mock.patch('yardstick.common.openstack_utils.get_nova_client')
+ @mock.patch('yardstick.common.openstack_utils.get_glance_client')
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ def test_create_server(self, mock_get_nova_client, mock_get_neutron_client,
+ mock_get_glance_client, mock_create_instance_and_wait_for_active):
+ scenario_cfg = {
+ 'options' : {
+ 'openstack_paras': 'example'
+ },
+ 'output': 'server'
+ }
+ obj = CreateServer(scenario_cfg, {})
+ obj.run({})
+ self.assertTrue(mock_get_nova_client.called)
+ self.assertTrue(mock_get_glance_client.called)
+ self.assertTrue(mock_get_neutron_client.called)
+ self.assertTrue(mock_create_instance_and_wait_for_active.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_create_volume.py b/tests/unit/benchmark/scenarios/lib/test_create_volume.py
new file mode 100644
index 000000000..fc633139e
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_create_volume.py
@@ -0,0 +1,40 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.create_volume import CreateVolume
+
+
+class CreateVolumeTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.create_volume')
+ @mock.patch('yardstick.common.openstack_utils.get_image_id')
+ @mock.patch('yardstick.common.openstack_utils.get_cinder_client')
+ @mock.patch('yardstick.common.openstack_utils.get_glance_client')
+ def test_create_volume(self, mock_get_glance_client, mock_get_cinder_client, mock_image_id, mock_create_volume):
+ options = {
+ 'volume_name': 'yardstick_test_volume_01',
+ 'size': '256',
+ 'image': 'cirros-0.3.5'
+ }
+ args = {"options": options}
+ obj = CreateVolume(args, {})
+ obj.run({})
+ self.assertTrue(mock_create_volume.called)
+ self.assertTrue(mock_image_id.called)
+ self.assertTrue(mock_get_glance_client.called)
+ self.assertTrue(mock_get_cinder_client.called)
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py b/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py
new file mode 100644
index 000000000..4a91b8939
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_flavor.py
@@ -0,0 +1,35 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.delete_flavor import DeleteFlavor
+
+
+class DeleteFlavorTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.delete_flavor')
+ @mock.patch('yardstick.common.openstack_utils.get_nova_client')
+ def test_delete_flavor(self, mock_get_nova_client, mock_delete_flavor):
+ options = {
+ 'flavor_name': 'yardstick_test_flavor'
+ }
+ args = {"options": options}
+ obj = DeleteFlavor(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_nova_client.called)
+ self.assertTrue(mock_delete_flavor.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_image.py b/tests/unit/benchmark/scenarios/lib/test_delete_image.py
new file mode 100644
index 000000000..2bbf14d16
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_image.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.delete_image import DeleteImage
+
+
+class DeleteImageTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.delete_image')
+ @mock.patch('yardstick.common.openstack_utils.get_image_id')
+ @mock.patch('yardstick.common.openstack_utils.get_glance_client')
+ def test_delete_image(self, mock_get_glance_client, mock_image_id, mock_delete_image):
+ options = {
+ 'image_name': 'yardstick_test_image_01'
+ }
+ args = {"options": options}
+ obj = DeleteImage(args, {})
+ obj.run({})
+ self.assertTrue(mock_delete_image.called)
+ self.assertTrue(mock_image_id.called)
+ self.assertTrue(mock_get_glance_client.called)
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_server.py b/tests/unit/benchmark/scenarios/lib/test_delete_server.py
new file mode 100644
index 000000000..622ead5ac
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_server.py
@@ -0,0 +1,35 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.delete_server import DeleteServer
+
+
+class DeleteServerTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.delete_instance')
+ @mock.patch('yardstick.common.openstack_utils.get_nova_client')
+ def test_delete_server(self, mock_get_nova_client, mock_delete_instance):
+ options = {
+ 'server_id': '1234-4567-0000'
+ }
+ args = {"options": options}
+ obj = DeleteServer(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_nova_client.called)
+ self.assertTrue(mock_delete_instance.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_get_flavor.py b/tests/unit/benchmark/scenarios/lib/test_get_flavor.py
new file mode 100644
index 000000000..bf12e0a32
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_get_flavor.py
@@ -0,0 +1,33 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 unittest
+import mock
+
+from yardstick.benchmark.scenarios.lib.get_flavor import GetFlavor
+
+
+class GetFlavorTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_flavor_by_name')
+ def test_get_flavor(self, mock_get_flavor_by_name):
+ options = {
+ 'flavor_name': 'yardstick_test_flavor'
+ }
+ args = {"options": options}
+ obj = GetFlavor(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_flavor_by_name.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen.py b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
index 2914c8e02..32ba255b2 100644
--- a/tests/unit/benchmark/scenarios/networking/test_pktgen.py
+++ b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
@@ -68,7 +68,7 @@ class PktgenTestCase(unittest.TestCase):
mock_ssh.SSH.from_node().execute.assert_called_with(
"sudo iptables -F; "
"sudo iptables -A INPUT -p udp --dport 1000:%s -j DROP"
- % 1010)
+ % 1010, timeout=60)
def test_pktgen_unsuccessful_iptables_setup(self, mock_ssh):
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index c9cd7fed5..84b42c832 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -209,8 +209,9 @@ TRAFFIC_PROFILE = {
class TestNetworkServiceTestCase(unittest.TestCase):
+
def setUp(self):
- self.trexgen__1 = {
+ self.tg__1 = {
'name': 'trafficgen_1.yardstick',
'ip': '10.10.10.11',
'role': 'TrafficGen',
@@ -236,7 +237,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
},
}
- self.trexvnf__1 = {
+ self.vnf__1 = {
'name': 'vnf.yardstick',
'ip': '10.10.10.12',
'host': '10.223.197.164',
@@ -293,8 +294,8 @@ class TestNetworkServiceTestCase(unittest.TestCase):
self.context_cfg = {
'nodes': {
- 'trexgen__1': self.trexgen__1,
- 'trexvnf__1': self.trexvnf__1,
+ 'tg__1': self.tg__1,
+ 'vnf__1': self.vnf__1,
},
'networks': {
'private': {
@@ -321,7 +322,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
],
'type': 'ELAN',
'id': 'private',
- 'name': 'trexgen__1 to trexvnf__1 link 1'
+ 'name': 'tg__1 to vnf__1 link 1'
}
self.vld1 = {
@@ -339,7 +340,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
],
'type': 'ELAN',
'id': 'public',
- 'name': 'trexvnf__1 to trexgen__1 link 2'
+ 'name': 'vnf__1 to tg__1 link 2'
}
self.topology = {
@@ -351,12 +352,12 @@ class TestNetworkServiceTestCase(unittest.TestCase):
{
'member-vnf-index': '1',
'VNF model': 'tg_trex_tpl.yaml',
- 'vnfd-id-ref': 'trexgen__1',
+ 'vnfd-id-ref': 'tg__1',
},
{
'member-vnf-index': '2',
'VNF model': 'tg_trex_tpl.yaml',
- 'vnfd-id-ref': 'trexvnf__1',
+ 'vnfd-id-ref': 'vnf__1',
},
],
'vld': [self.vld0, self.vld1],
@@ -418,12 +419,12 @@ class TestNetworkServiceTestCase(unittest.TestCase):
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
result = {'flow': {'dstip4_range': '152.40.0.20',
'srcip4_range': '152.16.0.20', 'count': 1}}
- self.assertEqual(result, self.s._get_traffic_flow(self.scenario_cfg))
+ self.assertEqual(result, self.s._get_traffic_flow())
def test___get_traffic_flow_error(self):
self.scenario_cfg["traffic_options"]["flow"] = \
"ipv4_1flow_Packets_vpe.yaml1"
- self.assertEqual({}, self.s._get_traffic_flow(self.scenario_cfg))
+ self.assertEqual({}, self.s._get_traffic_flow())
def test_get_vnf_imp(self):
vnfd = COMPLETE_TREX_VNFD['vnfd:vnfd-catalog']['vnfd'][0]['class-name']
@@ -439,9 +440,9 @@ class TestNetworkServiceTestCase(unittest.TestCase):
self.assertIn('found in', exc_str)
def test_load_vnf_models_invalid(self):
- self.context_cfg["nodes"]['trexgen__1']['VNF model'] = \
+ self.context_cfg["nodes"]['tg__1']['VNF model'] = \
self._get_file_abspath("tg_trex_tpl.yaml")
- self.context_cfg["nodes"]['trexvnf__1']['VNF model'] = \
+ self.context_cfg["nodes"]['vnf__1']['VNF model'] = \
self._get_file_abspath("tg_trex_tpl.yaml")
vnf = mock.Mock(autospec=GenericVNF)
@@ -456,15 +457,14 @@ class TestNetworkServiceTestCase(unittest.TestCase):
ssh_mock.execute = \
mock.Mock(return_value=(0, SYS_CLASS_NET + IP_ADDR_SHOW, ""))
ssh.from_node.return_value = ssh_mock
- self.s.map_topology_to_infrastructure(self.context_cfg,
- self.topology)
+ self.s.map_topology_to_infrastructure()
nodes = self.context_cfg["nodes"]
- self.assertEqual("tg_trex_tpl.yaml", nodes['trexgen__1']['VNF model'])
- self.assertEqual("tg_trex_tpl.yaml", nodes['trexvnf__1']['VNF model'])
+ self.assertEqual("../../vnf_descriptors/tg_rfc2544_tpl.yaml", nodes['tg__1']['VNF model'])
+ self.assertEqual("../../vnf_descriptors/vpe_vnf.yaml", nodes['vnf__1']['VNF model'])
def test_map_topology_to_infrastructure_insufficient_nodes(self):
- del self.context_cfg['nodes']['trexvnf__1']
+ del self.context_cfg['nodes']['vnf__1']
with mock.patch("yardstick.ssh.SSH") as ssh:
ssh_mock = mock.Mock(autospec=ssh.SSH)
ssh_mock.execute = \
@@ -472,11 +472,11 @@ class TestNetworkServiceTestCase(unittest.TestCase):
ssh.from_node.return_value = ssh_mock
with self.assertRaises(IncorrectSetup):
- self.s.map_topology_to_infrastructure(self.context_cfg, self.topology)
+ self.s.map_topology_to_infrastructure()
def test_map_topology_to_infrastructure_config_invalid(self):
cfg = dict(self.context_cfg)
- del cfg['nodes']['trexvnf__1']['interfaces']['xe0']['local_mac']
+ del cfg['nodes']['vnf__1']['interfaces']['xe0']['local_mac']
with mock.patch("yardstick.ssh.SSH") as ssh:
ssh_mock = mock.Mock(autospec=ssh.SSH)
ssh_mock.execute = \
@@ -484,7 +484,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
ssh.from_node.return_value = ssh_mock
with self.assertRaises(IncorrectConfig):
- self.s.map_topology_to_infrastructure(self.context_cfg, self.topology)
+ self.s.map_topology_to_infrastructure()
def test__resolve_topology_invalid_config(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
@@ -494,31 +494,41 @@ class TestNetworkServiceTestCase(unittest.TestCase):
ssh.from_node.return_value = ssh_mock
# purge an important key from the data structure
- for interface in self.trexgen__1['interfaces'].values():
+ for interface in self.tg__1['interfaces'].values():
del interface['local_mac']
- with self.assertRaises(IncorrectConfig) as raised:
- self.s._resolve_topology(self.context_cfg, self.topology)
+ with mock.patch(
+ "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log:
+ with self.assertRaises(IncorrectConfig) as raised:
+ self.s._resolve_topology()
self.assertIn('not found', str(raised.exception))
+ # restore local_mac
+ for index, interface in enumerate(self.tg__1['interfaces'].values()):
+ interface['local_mac'] = '00:00:00:00:00:{:2x}'.format(index)
+
# make a connection point ref with 3 points
- self.vld0['vnfd-connection-point-ref'].append(
- self.vld0['vnfd-connection-point-ref'][0])
+ self.s.topology["vld"][0]['vnfd-connection-point-ref'].append(
+ self.s.topology["vld"][0]['vnfd-connection-point-ref'][0])
- with self.assertRaises(IncorrectConfig) as raised:
- self.s._resolve_topology(self.context_cfg, self.topology)
+ with mock.patch(
+ "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log:
+ with self.assertRaises(IncorrectConfig) as raised:
+ self.s._resolve_topology()
- self.assertIn('wrong number of endpoints', str(raised.exception))
+ self.assertIn('wrong endpoint count', str(raised.exception))
# make a connection point ref with 1 point
- self.vld0['vnfd-connection-point-ref'] = \
- self.vld0['vnfd-connection-point-ref'][:1]
+ self.s.topology["vld"][0]['vnfd-connection-point-ref'] = \
+ self.s.topology["vld"][0]['vnfd-connection-point-ref'][:1]
- with self.assertRaises(IncorrectConfig) as raised:
- self.s._resolve_topology(self.context_cfg, self.topology)
+ with mock.patch(
+ "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log:
+ with self.assertRaises(IncorrectConfig) as raised:
+ self.s._resolve_topology()
- self.assertIn('wrong number of endpoints', str(raised.exception))
+ self.assertIn('wrong endpoint count', str(raised.exception))
def test_run(self):
tgen = mock.Mock(autospec=GenericTrafficGen)
@@ -567,19 +577,16 @@ class TestNetworkServiceTestCase(unittest.TestCase):
def test__get_traffic_profile(self):
self.scenario_cfg["traffic_profile"] = \
self._get_file_abspath("ipv4_throughput_vpe.yaml")
- self.assertIsNotNone(self.s._get_traffic_profile(self.scenario_cfg,
- self.context_cfg))
+ self.assertIsNotNone(self.s._get_traffic_profile())
def test__get_traffic_profile_exception(self):
- cfg = dict(self.scenario_cfg)
- cfg["traffic_profile"] = ""
- with self.assertRaises(IOError):
- self.s._get_traffic_profile(cfg, self.context_cfg)
+ with mock.patch.dict(self.scenario_cfg, {'traffic_profile': ''}):
+ with self.assertRaises(IOError):
+ self.s._get_traffic_profile()
def test___get_traffic_imix_exception(self):
- cfg = dict(self.scenario_cfg)
- cfg["traffic_options"]["imix"] = ""
- self.assertEqual({}, self.s._get_traffic_imix(cfg))
+ with mock.patch.dict(self.scenario_cfg["traffic_options"], {'imix': ''}):
+ self.assertEqual({}, self.s._get_traffic_imix())
def test__fill_traffic_profile(self):
with mock.patch.dict("sys.modules", STL_MOCKS):
@@ -589,8 +596,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
self.scenario_cfg["traffic_options"]["imix"] = \
self._get_file_abspath("imix_voice.yaml")
- self.assertIsNotNone(self.s._fill_traffic_profile(self.scenario_cfg,
- self.context_cfg))
+ self.assertIsNotNone(self.s._fill_traffic_profile())
def test_teardown(self):
vnf = mock.Mock(autospec=GenericVNF)
@@ -604,31 +610,32 @@ class TestNetworkServiceTestCase(unittest.TestCase):
self.assertIsNone(self.s.teardown())
SAMPLE_NETDEVS = {
- 'enp11s0': {
- 'address': '0a:de:ad:be:ef:f5',
- 'device': '0x1533',
- 'driver': 'igb',
- 'ifindex': '2',
- 'interface_name': 'enp11s0',
- 'operstate': 'down',
- 'pci_bus_id': '0000:0b:00.0',
- 'subsystem_device': '0x1533',
- 'subsystem_vendor': '0x15d9',
- 'vendor': '0x8086'
- },
- 'lan': {
- 'address': '0a:de:ad:be:ef:f4',
- 'device': '0x153a',
- 'driver': 'e1000e',
- 'ifindex': '3',
- 'interface_name': 'lan',
- 'operstate': 'up',
- 'pci_bus_id': '0000:00:19.0',
- 'subsystem_device': '0x153a',
- 'subsystem_vendor': '0x15d9',
- 'vendor': '0x8086'
- }
+ 'enp11s0': {
+ 'address': '0a:de:ad:be:ef:f5',
+ 'device': '0x1533',
+ 'driver': 'igb',
+ 'ifindex': '2',
+ 'interface_name': 'enp11s0',
+ 'operstate': 'down',
+ 'pci_bus_id': '0000:0b:00.0',
+ 'subsystem_device': '0x1533',
+ 'subsystem_vendor': '0x15d9',
+ 'vendor': '0x8086'
+ },
+ 'lan': {
+ 'address': '0a:de:ad:be:ef:f4',
+ 'device': '0x153a',
+ 'driver': 'e1000e',
+ 'ifindex': '3',
+ 'interface_name': 'lan',
+ 'operstate': 'up',
+ 'pci_bus_id': '0000:00:19.0',
+ 'subsystem_device': '0x153a',
+ 'subsystem_vendor': '0x15d9',
+ 'vendor': '0x8086'
}
+ }
+
SAMPLE_VM_NETDEVS = {
'eth1': {
'address': 'fa:de:ad:be:ef:5b',
@@ -681,19 +688,18 @@ class TestNetworkServiceTestCase(unittest.TestCase):
def test_sort_dpdk_port_num(self):
netdevs = self.SAMPLE_NETDEVS.copy()
NetworkServiceTestCase._sort_dpdk_port_num(netdevs)
- assert netdevs['lan']['dpdk_port_num'] == 1
- assert netdevs['enp11s0']['dpdk_port_num'] == 2
+ assert netdevs['lan']['dpdk_port_num'] == 0
+ assert netdevs['enp11s0']['dpdk_port_num'] == 1
def test_probe_missing_values(self):
netdevs = self.SAMPLE_NETDEVS.copy()
- NetworkServiceTestCase._sort_dpdk_port_num(netdevs)
network = {'local_mac': '0a:de:ad:be:ef:f5'}
NetworkServiceTestCase._probe_missing_values(netdevs, network, set())
- assert network['dpdk_port_num'] == 2
+ assert network['vpci'] == '0000:0b:00.0'
network = {'local_mac': '0a:de:ad:be:ef:f4'}
NetworkServiceTestCase._probe_missing_values(netdevs, network, set())
- assert network['dpdk_port_num'] == 1
+ assert network['vpci'] == '0000:00:19.0'
def test_open_relative_path(self):
mock_open = mock.mock_open()
diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf.py b/tests/unit/benchmark/scenarios/networking/test_vsperf.py
index 348aa4a63..cbbfc2b34 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vsperf.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vsperf.py
@@ -28,8 +28,6 @@ from yardstick.benchmark.scenarios.networking import vsperf
@mock.patch('yardstick.benchmark.scenarios.networking.vsperf.subprocess')
@mock.patch('yardstick.benchmark.scenarios.networking.vsperf.ssh')
-@mock.patch("yardstick.benchmark.scenarios.networking.vsperf.open",
- mock.mock_open())
class VsperfTestCase(unittest.TestCase):
def setUp(self):
diff --git a/tests/unit/benchmark/scenarios/storage/test_bonnie.py b/tests/unit/benchmark/scenarios/storage/test_bonnie.py
new file mode 100644
index 000000000..b3524e9a7
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/storage/test_bonnie.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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
+##############################################################################
+
+# Unittest for yardstick.benchmark.scenarios.storage.bonnie.Bonnie
+
+from __future__ import absolute_import
+
+import unittest
+
+import mock
+
+from yardstick.common import utils
+from yardstick.benchmark.scenarios.storage import bonnie
+
+
+class BonnieTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.ctx = {
+ 'host': {
+ 'ip': '172.16.0.137',
+ 'user': 'root',
+ 'key_filename': "mykey.key"
+ }
+ }
+
+ self.result = {}
+
+ @mock.patch('yardstick.benchmark.scenarios.storage.bonnie.ssh')
+ def test_bonnie_successful_setup(self, mock_ssh):
+
+ options = {
+ "file_size": "1024",
+ "ram_size": "512",
+ "test_dir": "/tmp",
+ "concurrency": "1",
+ "test_user": "root"
+ }
+ args = {"options": options}
+ b = bonnie.Bonnie(args, self.ctx)
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
+
+ b.setup()
+ self.assertIsNotNone(b.client)
+ self.assertTrue(b.setup_done, True)
+
+ @mock.patch('yardstick.benchmark.scenarios.storage.bonnie.ssh')
+ def test_bonnie_unsuccessful_script_error(self, mock_ssh):
+ options = {
+ "file_size": "1024",
+ "ram_size": "512",
+ "test_dir": "/tmp",
+ "concurrency": "1",
+ "test_user": "root"
+ }
+ args = {"options": options}
+ b = bonnie.Bonnie(args, self.ctx)
+
+ mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
+ self.assertRaises(RuntimeError, b.run, self.result)
+
+def main():
+ unittest.main()
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py
index e21e5fa3a..f25e6cc07 100644
--- a/tests/unit/common/test_utils.py
+++ b/tests/unit/common/test_utils.py
@@ -10,11 +10,18 @@
# Unittest for yardstick.common.utils
from __future__ import absolute_import
+
+import ipaddress
import os
-import mock
import unittest
+from copy import deepcopy
+from itertools import product, chain
+
+import mock
+from six.moves import configparser
from yardstick.common import utils
+from yardstick.common import constants
class IterSubclassesTestCase(unittest.TestCase):
@@ -93,7 +100,7 @@ class GetParaFromYaml(unittest.TestCase):
get_env.return_value = self._get_file_abspath(file_path)
args = 'releng.file'
default = 'hello'
- self.assertTrue(utils.get_param(args, default), default)
+ self.assertTrue(constants.get_param(args, default), default)
@mock.patch('yardstick.common.utils.os.environ.get')
def test_get_param_para_exists(self, get_env):
@@ -101,7 +108,7 @@ class GetParaFromYaml(unittest.TestCase):
get_env.return_value = self._get_file_abspath(file_path)
args = 'releng.dir'
para = '/home/opnfv/repos/releng'
- self.assertEqual(para, utils.get_param(args))
+ self.assertEqual(para, constants.get_param(args))
def _get_file_abspath(self, filename):
curr_path = os.path.dirname(os.path.abspath(__file__))
@@ -142,6 +149,13 @@ class CommonUtilTestCase(unittest.TestCase):
self.assertEqual(result, line)
+class TestMacAddressToHex(unittest.TestCase):
+
+ def test_mac_address_to_hex_list(self):
+ self.assertEqual(utils.mac_address_to_hex_list("ea:3e:e1:9a:99:e8"),
+ ['0xea', '0x3e', '0xe1', '0x9a', '0x99', '0xe8'])
+
+
class TranslateToStrTestCase(unittest.TestCase):
def test_translate_to_str_unicode(self):
@@ -162,6 +176,596 @@ class TranslateToStrTestCase(unittest.TestCase):
}
self.assertEqual(result, output_str)
+ def test_translate_to_str_non_string(self):
+ input_value = object()
+ result = utils.translate_to_str(input_value)
+ self.assertIs(input_value, result)
+
+
+class TestParseCpuInfo(unittest.TestCase):
+
+ def test_single_socket_no_hyperthread(self):
+ cpuinfo = """\
+processor : 2
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel Core Processor (Haswell, no TSX)
+stepping : 1
+microcode : 0x1
+cpu MHz : 2294.684
+cache size : 4096 KB
+physical id : 0
+siblings : 5
+core id : 2
+cpu cores : 5
+apicid : 2
+initial apicid : 2
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat
+bugs :
+bogomips : 4589.36
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 3
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel Core Processor (Haswell, no TSX)
+stepping : 1
+microcode : 0x1
+cpu MHz : 2294.684
+cache size : 4096 KB
+physical id : 0
+siblings : 5
+core id : 3
+cpu cores : 5
+apicid : 3
+initial apicid : 3
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat
+bugs :
+bogomips : 4589.36
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 4
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel Core Processor (Haswell, no TSX)
+stepping : 1
+microcode : 0x1
+cpu MHz : 2294.684
+cache size : 4096 KB
+physical id : 0
+siblings : 5
+core id : 4
+cpu cores : 5
+apicid : 4
+initial apicid : 4
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat
+bugs :
+bogomips : 4589.36
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+"""
+ socket_map = utils.parse_cpuinfo(cpuinfo)
+ assert sorted(socket_map.keys()) == [0]
+ assert sorted(socket_map[0].keys()) == [2, 3, 4]
+
+ def test_single_socket_hyperthread(self):
+ cpuinfo = """\
+processor : 5
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel(R) Xeon(R) CPU E3-1275 v3 @ 3.50GHz
+stepping : 3
+microcode : 0x1d
+cpu MHz : 3501.708
+cache size : 8192 KB
+physical id : 0
+siblings : 8
+core id : 1
+cpu cores : 4
+apicid : 3
+initial apicid : 3
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
+bugs :
+bogomips : 6987.36
+clflush size : 64
+cache_alignment : 64
+address sizes : 39 bits physical, 48 bits virtual
+power management:
+
+processor : 6
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel(R) Xeon(R) CPU E3-1275 v3 @ 3.50GHz
+stepping : 3
+microcode : 0x1d
+cpu MHz : 3531.829
+cache size : 8192 KB
+physical id : 0
+siblings : 8
+core id : 2
+cpu cores : 4
+apicid : 5
+initial apicid : 5
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
+bugs :
+bogomips : 6987.36
+clflush size : 64
+cache_alignment : 64
+address sizes : 39 bits physical, 48 bits virtual
+power management:
+
+processor : 7
+vendor_id : GenuineIntel
+cpu family : 6
+model : 60
+model name : Intel(R) Xeon(R) CPU E3-1275 v3 @ 3.50GHz
+stepping : 3
+microcode : 0x1d
+cpu MHz : 3500.213
+cache size : 8192 KB
+physical id : 0
+siblings : 8
+core id : 3
+cpu cores : 4
+apicid : 7
+initial apicid : 7
+fpu : yes
+fpu_exception : yes
+cpuid level : 13
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
+bugs :
+bogomips : 6987.24
+clflush size : 64
+cache_alignment : 64
+address sizes : 39 bits physical, 48 bits virtual
+power management:
+
+"""
+ socket_map = utils.parse_cpuinfo(cpuinfo)
+ assert sorted(socket_map.keys()) == [0]
+ assert sorted(socket_map[0].keys()) == [1, 2, 3]
+ assert sorted(socket_map[0][1]) == [5]
+ assert sorted(socket_map[0][2]) == [6]
+ assert sorted(socket_map[0][3]) == [7]
+
+ def test_dual_socket_hyperthread(self):
+ cpuinfo = """\
+processor : 1
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.976
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 1
+cpu cores : 22
+apicid : 2
+initial apicid : 2
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4401.07
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 2
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1226.892
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 2
+cpu cores : 22
+apicid : 4
+initial apicid : 4
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4400.84
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 43
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 28
+cpu cores : 22
+apicid : 120
+initial apicid : 120
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4411.31
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 44
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 0
+cpu cores : 22
+apicid : 1
+initial apicid : 1
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4410.61
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 85
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.573
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 26
+cpu cores : 22
+apicid : 117
+initial apicid : 117
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4409.07
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 86
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 27
+cpu cores : 22
+apicid : 119
+initial apicid : 119
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4406.62
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 87
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.708
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 28
+cpu cores : 22
+apicid : 121
+initial apicid : 121
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4413.48
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+"""
+ socket_map = utils.parse_cpuinfo(cpuinfo)
+ assert sorted(socket_map.keys()) == [0, 1]
+ assert sorted(socket_map[0].keys()) == [0, 1, 2]
+ assert sorted(socket_map[1].keys()) == [26, 27, 28]
+ assert sorted(socket_map[0][0]) == [44]
+ assert sorted(socket_map[0][1]) == [1]
+ assert sorted(socket_map[0][2]) == [2]
+ assert sorted(socket_map[1][26]) == [85]
+ assert sorted(socket_map[1][27]) == [86]
+ assert sorted(socket_map[1][28]) == [43, 87]
+
+ def test_dual_socket_no_hyperthread(self):
+ cpuinfo = """\
+processor : 1
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.976
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 1
+cpu cores : 22
+apicid : 2
+initial apicid : 2
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4401.07
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 2
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1226.892
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 2
+cpu cores : 22
+apicid : 4
+initial apicid : 4
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4400.84
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 43
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 28
+cpu cores : 22
+apicid : 120
+initial apicid : 120
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4411.31
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 44
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 0
+siblings : 44
+core id : 0
+cpu cores : 22
+apicid : 1
+initial apicid : 1
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4410.61
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 85
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.573
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 26
+cpu cores : 22
+apicid : 117
+initial apicid : 117
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4409.07
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 86
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.305
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 27
+cpu cores : 22
+apicid : 119
+initial apicid : 119
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4406.62
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+processor : 87
+vendor_id : GenuineIntel
+cpu family : 6
+model : 79
+model name : Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
+stepping : 1
+microcode : 0xb00001f
+cpu MHz : 1200.708
+cache size : 56320 KB
+physical id : 1
+siblings : 44
+core id : 28
+cpu cores : 22
+apicid : 121
+initial apicid : 121
+fpu : yes
+fpu_exception : yes
+cpuid level : 20
+wp : yes
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
+bugs :
+bogomips : 4413.48
+clflush size : 64
+cache_alignment : 64
+address sizes : 46 bits physical, 48 bits virtual
+power management:
+
+"""
+ socket_map = utils.parse_cpuinfo(cpuinfo)
+ processors = socket_map.processors()
+ assert processors == [1, 2, 43, 44, 85, 86, 87]
+ cores = socket_map.cores()
+ assert cores == [0, 1, 2, 26, 27, 28]
+ sockets = socket_map.sockets()
+ assert sockets == [0, 1]
+
class ChangeObjToDictTestCase(unittest.TestCase):
@@ -195,6 +799,275 @@ class RemoveFileTestCase(unittest.TestCase):
self.assertTrue(isinstance(e, OSError))
+class TestUtils(unittest.TestCase):
+
+ @mock.patch('yardstick.common.utils.jsonify')
+ def test_result_handler(self, mock_jsonify):
+ mock_jsonify.return_value = 432
+
+ self.assertEqual(utils.result_handler('x', 234), 432)
+ mock_jsonify.assert_called_once_with({'status': 'x', 'result': 234})
+
+ @mock.patch('random.randint')
+ @mock.patch('socket.socket')
+ def test_get_free_port(self, mock_socket, mock_randint):
+ mock_randint.return_value = 7777
+ s = mock_socket('x', 'y')
+ s.connect_ex.side_effect = iter([0, 1])
+ result = utils.get_free_port('10.20.30.40')
+ self.assertEqual(result, 7777)
+ self.assertEqual(s.connect_ex.call_count, 2)
+
+ @mock.patch('subprocess.check_output')
+ def test_execute_command(self, mock_check_output):
+ expected = ['hello world', '1234']
+ mock_check_output.return_value = os.linesep.join(expected)
+ result = utils.execute_command('my_command arg1 arg2')
+ self.assertEqual(result, expected)
+
+ @mock.patch('subprocess.Popen')
+ def test_source_env(self, mock_popen):
+ base_env = deepcopy(os.environ)
+ mock_process = mock_popen()
+ output_list = [
+ 'garbage line before',
+ 'NEW_ENV_VALUE=234',
+ 'garbage line after',
+ ]
+ mock_process.communicate.return_value = os.linesep.join(output_list), '', 0
+ expected = {'NEW_ENV_VALUE': '234'}
+ result = utils.source_env('my_file')
+ self.assertDictEqual(result, expected)
+ os.environ.clear()
+ os.environ.update(base_env)
+
+ @mock.patch('yardstick.common.utils.configparser.ConfigParser')
+ def test_parse_ini_file(self, mock_config_parser_type):
+ defaults = {
+ 'default1': 'value1',
+ 'default2': 'value2',
+ }
+ s1 = {
+ 'key1': 'value11',
+ 'key2': 'value22',
+ }
+ s2 = {
+ 'key1': 'value123',
+ 'key2': 'value234',
+ }
+
+ mock_config_parser = mock_config_parser_type()
+ mock_config_parser.read.return_value = True
+ mock_config_parser.sections.return_value = ['s1', 's2']
+ mock_config_parser.items.side_effect = iter([
+ defaults.items(),
+ s1.items(),
+ s2.items(),
+ ])
+
+ expected = {
+ 'DEFAULT': defaults,
+ 's1': s1,
+ 's2': s2,
+ }
+ result = utils.parse_ini_file('my_path')
+ self.assertDictEqual(result, expected)
+
+ @mock.patch('yardstick.common.utils.configparser.ConfigParser')
+ def test_parse_ini_file_missing_section_header(self, mock_config_parser_type):
+ mock_config_parser = mock_config_parser_type()
+ mock_config_parser.read.side_effect = \
+ configparser.MissingSectionHeaderError(mock.Mock(), 321, mock.Mock())
+
+ with self.assertRaises(configparser.MissingSectionHeaderError):
+ utils.parse_ini_file('my_path')
+
+ @mock.patch('yardstick.common.utils.configparser.ConfigParser')
+ def test_parse_ini_file_no_file(self, mock_config_parser_type):
+ mock_config_parser = mock_config_parser_type()
+ mock_config_parser.read.return_value = False
+ with self.assertRaises(RuntimeError):
+ utils.parse_ini_file('my_path')
+
+ @mock.patch('yardstick.common.utils.configparser.ConfigParser')
+ def test_parse_ini_file_no_default_section_header(self, mock_config_parser_type):
+ s1 = {
+ 'key1': 'value11',
+ 'key2': 'value22',
+ }
+ s2 = {
+ 'key1': 'value123',
+ 'key2': 'value234',
+ }
+
+ mock_config_parser = mock_config_parser_type()
+ mock_config_parser.read.return_value = True
+ mock_config_parser.sections.return_value = ['s1', 's2']
+ mock_config_parser.items.side_effect = iter([
+ configparser.NoSectionError(mock.Mock()),
+ s1.items(),
+ s2.items(),
+ ])
+
+ expected = {
+ 'DEFAULT': {},
+ 's1': s1,
+ 's2': s2,
+ }
+ result = utils.parse_ini_file('my_path')
+ self.assertDictEqual(result, expected)
+
+ def test_join_non_strings(self):
+ self.assertEqual(utils.join_non_strings(':'), '')
+ self.assertEqual(utils.join_non_strings(':', 'a'), 'a')
+ self.assertEqual(utils.join_non_strings(':', 'a', 2, 'c'), 'a:2:c')
+ self.assertEqual(utils.join_non_strings(':', ['a', 2, 'c']), 'a:2:c')
+ self.assertEqual(utils.join_non_strings(':', 'abc'), 'abc')
+
+ def test_validate_non_string_sequence(self):
+ self.assertEqual(utils.validate_non_string_sequence([1, 2, 3]), [1, 2, 3])
+ self.assertIsNone(utils.validate_non_string_sequence('123'))
+ self.assertIsNone(utils.validate_non_string_sequence(1))
+
+ self.assertEqual(utils.validate_non_string_sequence(1, 2), 2)
+ self.assertEqual(utils.validate_non_string_sequence(1, default=2), 2)
+
+ with self.assertRaises(RuntimeError):
+ utils.validate_non_string_sequence(1, raise_exc=RuntimeError)
+
+ def test_error_class(self):
+ with self.assertRaises(RuntimeError):
+ utils.ErrorClass()
+
+ error_instance = utils.ErrorClass(test='')
+ with self.assertRaises(AttributeError):
+ error_instance.get_name()
+
+
+class TestUtilsIpAddrMethods(unittest.TestCase):
+
+ GOOD_IP_V4_ADDRESS_STR_LIST = [
+ u'0.0.0.0',
+ u'10.20.30.40',
+ u'127.0.0.1',
+ u'10.20.30.40',
+ u'172.29.50.75',
+ u'192.168.230.9',
+ u'255.255.255.255',
+ ]
+
+ GOOD_IP_V4_MASK_STR_LIST = [
+ u'/1',
+ u'/8',
+ u'/13',
+ u'/19',
+ u'/24',
+ u'/32',
+ ]
+
+ GOOD_IP_V6_ADDRESS_STR_LIST = [
+ u'::1',
+ u'fe80::250:56ff:fe89:91ff',
+ u'123:4567:89ab:cdef:123:4567:89ab:cdef',
+ ]
+
+ GOOD_IP_V6_MASK_STR_LIST = [
+ u'/1',
+ u'/16',
+ u'/29',
+ u'/64',
+ u'/99',
+ u'/128',
+ ]
+
+ INVALID_IP_ADDRESS_STR_LIST = [
+ 1,
+ u'w.x.y.z',
+ u'10.20.30.40/33',
+ u'123:4567:89ab:cdef:123:4567:89ab:cdef/129',
+ ]
+
+ def test_safe_ip_address(self):
+ addr_list = self.GOOD_IP_V4_ADDRESS_STR_LIST
+ for addr in addr_list:
+ # test with no mask
+ expected = ipaddress.ip_address(addr)
+ self.assertEqual(utils.safe_ip_address(addr), expected, addr)
+
+ def test_safe_ip_address_v6_ip(self):
+ addr_list = self.GOOD_IP_V6_ADDRESS_STR_LIST
+ for addr in addr_list:
+ # test with no mask
+ expected = ipaddress.ip_address(addr)
+ self.assertEqual(utils.safe_ip_address(addr), expected, addr)
+
+ @mock.patch("yardstick.common.utils.logging")
+ def test_safe_ip_address_negative(self, mock_logging):
+ for value in self.INVALID_IP_ADDRESS_STR_LIST:
+ self.assertIsNone(utils.safe_ip_address(value), value)
+
+ addr_list = self.GOOD_IP_V4_ADDRESS_STR_LIST
+ mask_list = self.GOOD_IP_V4_MASK_STR_LIST
+ for addr_mask_pair in product(addr_list, mask_list):
+ value = ''.join(addr_mask_pair)
+ self.assertIsNone(utils.safe_ip_address(value), value)
+
+ addr_list = self.GOOD_IP_V6_ADDRESS_STR_LIST
+ mask_list = self.GOOD_IP_V6_MASK_STR_LIST
+ for addr_mask_pair in product(addr_list, mask_list):
+ value = ''.join(addr_mask_pair)
+ self.assertIsNone(utils.safe_ip_address(value), value)
+
+ def test_get_ip_version(self):
+ addr_list = self.GOOD_IP_V4_ADDRESS_STR_LIST
+ for addr in addr_list:
+ # test with no mask
+ self.assertEqual(utils.get_ip_version(addr), 4, addr)
+
+ def test_get_ip_version_v6_ip(self):
+ addr_list = self.GOOD_IP_V6_ADDRESS_STR_LIST
+ for addr in addr_list:
+ # test with no mask
+ self.assertEqual(utils.get_ip_version(addr), 6, addr)
+
+ @mock.patch("yardstick.common.utils.logging")
+ def test_get_ip_version_negative(self, mock_logging):
+ for value in self.INVALID_IP_ADDRESS_STR_LIST:
+ self.assertIsNone(utils.get_ip_version(value), value)
+
+ addr_list = self.GOOD_IP_V4_ADDRESS_STR_LIST
+ mask_list = self.GOOD_IP_V4_MASK_STR_LIST
+ for addr_mask_pair in product(addr_list, mask_list):
+ value = ''.join(addr_mask_pair)
+ self.assertIsNone(utils.get_ip_version(value), value)
+
+ addr_list = self.GOOD_IP_V6_ADDRESS_STR_LIST
+ mask_list = self.GOOD_IP_V6_MASK_STR_LIST
+ for addr_mask_pair in product(addr_list, mask_list):
+ value = ''.join(addr_mask_pair)
+ self.assertIsNone(utils.get_ip_version(value), value)
+
+ def test_ip_to_hex(self):
+ self.assertEqual(utils.ip_to_hex('0.0.0.0'), '00000000')
+ self.assertEqual(utils.ip_to_hex('10.20.30.40'), '0a141e28')
+ self.assertEqual(utils.ip_to_hex('127.0.0.1'), '7f000001')
+ self.assertEqual(utils.ip_to_hex('172.31.90.100'), 'ac1f5a64')
+ self.assertEqual(utils.ip_to_hex('192.168.254.253'), 'c0a8fefd')
+ self.assertEqual(utils.ip_to_hex('255.255.255.255'), 'ffffffff')
+
+ def test_ip_to_hex_v6_ip(self):
+ for value in self.GOOD_IP_V6_ADDRESS_STR_LIST:
+ self.assertEqual(utils.ip_to_hex(value), value)
+
+ @mock.patch("yardstick.common.utils.logging")
+ def test_ip_to_hex_negative(self, mock_logging):
+ addr_list = self.GOOD_IP_V4_ADDRESS_STR_LIST
+ mask_list = self.GOOD_IP_V4_MASK_STR_LIST
+ value_iter = (''.join(pair) for pair in product(addr_list, mask_list))
+ for value in chain(value_iter, self.INVALID_IP_ADDRESS_STR_LIST):
+ self.assertEqual(utils.ip_to_hex(value), value)
+
+
def main():
unittest.main()
diff --git a/tests/unit/network_services/helpers/__init__.py b/tests/unit/network_services/helpers/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/network_services/helpers/__init__.py
diff --git a/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml b/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml
new file mode 100644
index 000000000..606d557e9
--- /dev/null
+++ b/tests/unit/network_services/helpers/acl_vnf_topology_ixia.yaml
@@ -0,0 +1,50 @@
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+
+nsd:nsd-catalog:
+ nsd:
+ - id: VACL
+ name: VACL
+ short-name: VACL
+ description: scenario with VACL,L3fwd and VNF
+ constituent-vnfd:
+ - member-vnf-index: '1'
+ vnfd-id-ref: tg__1
+ VNF model: ../../vnf_descriptors/ixia_rfc2544_tpl.yaml
+ - member-vnf-index: '2'
+ vnfd-id-ref: vnf__1
+ VNF model: ../../vnf_descriptors/acl_vnf.yaml
+
+ vld:
+ - id: private_1
+ name: tg__1 to vnf__1 link 1
+ type: ELAN
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: xe0
+ vnfd-id-ref: tg__1 #TREX
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: xe0
+ vnfd-id-ref: vnf__1 #VNF
+
+ - id: public_1
+ name: vnf__1 to tg__1 link 2
+ type: ELAN
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: xe1
+ vnfd-id-ref: vnf__1 #L3fwd
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: xe1
+ vnfd-id-ref: tg__1 #VACL VNF
diff --git a/tests/unit/network_services/helpers/test_cpu.py b/tests/unit/network_services/helpers/test_cpu.py
new file mode 100644
index 000000000..7ea6bd0fc
--- /dev/null
+++ b/tests/unit/network_services/helpers/test_cpu.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+from __future__ import division
+import unittest
+import mock
+import subprocess
+
+from yardstick.network_services.helpers.cpu import \
+ CpuSysCores
+
+
+class TestCpuSysCores(unittest.TestCase):
+
+ def test___init__(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ self.assertIsNotNone(cpu_topo.connection)
+
+ def test__get_core_details(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ subprocess.check_output = mock.Mock(return_value=0)
+ lines = ["cpu:1", "topo:2", ""]
+ self.assertEqual([{'topo': '2', 'cpu': '1'}],
+ cpu_topo._get_core_details(lines))
+
+ def test_get_core_socket(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "cpu:1\ntest:2\n \n", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ subprocess.check_output = mock.Mock(return_value=0)
+ cpu_topo._get_core_details = \
+ mock.Mock(side_effect=[[{'Core(s) per socket': '2', 'Thread(s) per core': '1'}],
+ [{'physical id': '2', 'processor': '1'}]])
+ self.assertEqual({'thread_per_core': '1', '2': ['1'],
+ 'cores_per_socket': '2'},
+ cpu_topo.get_core_socket())
+
+ def test_validate_cpu_cfg(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "cpu:1\ntest:2\n \n", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ subprocess.check_output = mock.Mock(return_value=0)
+ cpu_topo._get_core_details = \
+ mock.Mock(side_effect=[[{'Core(s) per socket': '2', 'Thread(s) per core': '1'}],
+ [{'physical id': '2', 'processor': '1'}]])
+ cpu_topo.core_map = \
+ {'thread_per_core': '1', '2':['1'], 'cores_per_socket': '2'}
+ self.assertEqual(-1, cpu_topo.validate_cpu_cfg())
+
+ def test_validate_cpu_cfg_2t(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "cpu:1\ntest:2\n \n", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ subprocess.check_output = mock.Mock(return_value=0)
+ cpu_topo._get_core_details = \
+ mock.Mock(side_effect=[[{'Core(s) per socket': '2', 'Thread(s) per core': '1'}],
+ [{'physical id': '2', 'processor': '1'}]])
+ cpu_topo.core_map = \
+ {'thread_per_core': 1, '2':['1'], 'cores_per_socket': '2'}
+ vnf_cfg = {'lb_config': 'SW', 'lb_count': 1, 'worker_config':
+ '1C/2T', 'worker_threads': 1}
+ self.assertEqual(-1, cpu_topo.validate_cpu_cfg(vnf_cfg))
+
+ def test_validate_cpu_cfg_fail(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(1, "cpu:1\ntest:2\n \n", ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(1, "", ""))
+ cpu_topo = CpuSysCores(ssh_mock)
+ subprocess.check_output = mock.Mock(return_value=0)
+ cpu_topo._get_core_details = \
+ mock.Mock(side_effect=[[{'Core(s) per socket': '2', 'Thread(s) per core': '1'}],
+ [{'physical id': '2', 'processor': '1'}]])
+ cpu_topo.core_map = \
+ {'thread_per_core': 1, '2':[1], 'cores_per_socket': 2}
+ vnf_cfg = {'lb_config': 'SW', 'lb_count': 1, 'worker_config':
+ '1C/1T', 'worker_threads': 1}
+ self.assertEqual(-1, cpu_topo.validate_cpu_cfg(vnf_cfg))
diff --git a/tests/unit/network_services/helpers/test_samplevnf_helper.py b/tests/unit/network_services/helpers/test_samplevnf_helper.py
new file mode 100644
index 000000000..b89668577
--- /dev/null
+++ b/tests/unit/network_services/helpers/test_samplevnf_helper.py
@@ -0,0 +1,1082 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+from __future__ import division
+
+import os
+import unittest
+
+import mock
+
+from yardstick.network_services.helpers.samplevnf_helper import MultiPortConfig
+
+
+class TestMultiPortConfig(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [
+ {'virtual-interface':
+ {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'ifname': 'xe0',
+ 'local_iface_name': 'eth0',
+ 'local_mac': '00:00:00:00:00:02',
+ 'vld_id': 'private_1',
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'ifname': 'xe1',
+ 'local_iface_name': 'eth1',
+ 'local_mac': '00:00:00:00:00:01',
+ 'vld_id': 'public_1',
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}
+ ]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'AclApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test___init__(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ self.assertEqual(0, opnfv_vnf.swq)
+ mock_os.path = mock.MagicMock()
+ mock_os.path.isfile = mock.Mock(return_value=False)
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ self.assertEqual(0, opnfv_vnf.swq)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_update_timer(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ self.assertEqual(None, opnfv_vnf.update_timer())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_script(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ self.assertIsNotNone(opnfv_vnf.generate_script(self.VNFD))
+ opnfv_vnf.lb_config = 'HW'
+ self.assertIsNotNone(opnfv_vnf.generate_script(self.VNFD))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_script_data(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.vnf_type = 'ACL'
+ opnfv_vnf.generate_link_config = mock.Mock()
+ opnfv_vnf.generate_arp_config = mock.Mock()
+ opnfv_vnf.generate_arp_config6 = mock.Mock()
+ opnfv_vnf.generate_action_config = mock.Mock()
+ opnfv_vnf.generate_rule_config = mock.Mock()
+ self.assertIsNotNone(opnfv_vnf.generate_script_data())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_rule_config(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'ACL'
+ opnfv_vnf.get_ports_gateway = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.get_ports_gateway6 = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway6 = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ self.assertIsNotNone(opnfv_vnf.generate_rule_config())
+ opnfv_vnf.rules = 'new'
+ self.assertIsNotNone(opnfv_vnf.generate_rule_config())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_action_config(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.get_ports_gateway = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.get_ports_gateway6 = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway6 = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ self.assertIsNotNone(opnfv_vnf.generate_action_config())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_arp_config6(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.get_ports_gateway = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.get_ports_gateway6 = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway6 = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ self.assertIsNotNone(opnfv_vnf.generate_arp_config6())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_arp_config(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.get_ports_gateway = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.get_ports_gateway6 = mock.Mock(return_value=u'1.1.1.1')
+ opnfv_vnf.get_netmask_gateway6 = mock.Mock(return_value=u'255.255.255.0')
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ self.assertIsNotNone(opnfv_vnf.generate_arp_config())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_get_ports_gateway(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.assertIsNotNone(opnfv_vnf.get_ports_gateway('xe0'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_get_ports_gateway6(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.assertIsNotNone(opnfv_vnf.get_ports_gateway6('xe0'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_get_netmask_gateway(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.assertIsNotNone(opnfv_vnf.get_netmask_gateway('xe0'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_get_netmask_gateway6(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.interfaces = mock.MagicMock()
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.assertIsNotNone(opnfv_vnf.get_netmask_gateway6('xe0'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_link_config(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.get_port_pairs = mock.Mock()
+ opnfv_vnf.vnf_type = 'VFW'
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ self.assertIsNotNone(opnfv_vnf.generate_link_config())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ def test_generate_config(self, mock_open, mock_os, ConfigParser):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.get_config_tpl_data = mock.MagicMock()
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.update_write_parser = mock.MagicMock()
+ opnfv_vnf.generate_script_data = \
+ mock.Mock(return_value={'link_config': 0, 'arp_config': '',
+ 'arp_config6': '', 'actions': '',
+ 'rules': ''})
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.get_ports_gateway6 = mock.Mock()
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.generate_lb_to_port_pair_mapping = mock.Mock()
+ opnfv_vnf.generate_config_data = mock.Mock()
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.is_openstack = True
+ self.assertIsNone(opnfv_vnf.generate_config())
+ opnfv_vnf.is_openstack = False
+ self.assertIsNone(opnfv_vnf.generate_config())
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_get_config_tpl_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=True)
+ opnfv_vnf.read_parser.get = mock.Mock(return_value='filename')
+
+ self.assertIsNotNone(opnfv_vnf.get_config_tpl_data('filename'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_get_txrx_tpl_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=True)
+ opnfv_vnf.read_parser.get = mock.Mock(return_value='filename')
+
+ self.assertIsNotNone(opnfv_vnf.get_txrx_tpl_data('filename'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_init_write_parser_template(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=True)
+ opnfv_vnf.read_parser.get = mock.Mock(return_value='filename')
+
+ self.assertIsNone(opnfv_vnf.init_write_parser_template('filename'))
+ opnfv_vnf.write_parser.add_section = mock.MagicMock()
+ opnfv_vnf.read_parser.item = mock.Mock(return_value=[1, 2, 3])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=False)
+ opnfv_vnf.write_parser.set = mock.Mock()
+ self.assertIsNone(opnfv_vnf.init_write_parser_template('filename'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_init_write_parser_template_2(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ self.assertIsNone(opnfv_vnf.init_write_parser_template('filename'))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_update_write_parser(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ self.assertIsNone(opnfv_vnf.update_write_parser({'filename': 1}))
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_get_worker_threads(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ result = opnfv_vnf.get_worker_threads(1)
+ self.assertEqual(1, result)
+ opnfv_vnf.worker_config = '2t'
+ result = opnfv_vnf.get_worker_threads(2)
+ self.assertEqual(2, result)
+ opnfv_vnf.worker_config = '2t'
+ result = opnfv_vnf.get_worker_threads(3)
+ self.assertEqual(2, result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_next_core_id(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ result = opnfv_vnf.generate_next_core_id()
+ self.assertEqual(None, result)
+ opnfv_vnf.worker_config = '2t'
+ opnfv_vnf.start_core = 'a'
+ self.assertRaises(ValueError, opnfv_vnf.generate_next_core_id)
+ opnfv_vnf.worker_config = '2t'
+ opnfv_vnf.start_core = 1
+ result = opnfv_vnf.generate_next_core_id()
+ self.assertEqual(None, result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_lb_to_port_pair_mapping(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ result = opnfv_vnf.generate_lb_to_port_pair_mapping()
+ self.assertEqual(None, result)
+ result = opnfv_vnf.set_priv_to_pub_mapping()
+ self.assertEqual('(0, 1)', result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_set_priv_que_handler(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ result = opnfv_vnf.set_priv_que_handler()
+ self.assertEqual(None, result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_arpicmp_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ result = opnfv_vnf.generate_arpicmp_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'ovs'
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ result = opnfv_vnf.generate_arpicmp_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'openstack'
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ result = opnfv_vnf.generate_arpicmp_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.lb_config = 'HW'
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ result = opnfv_vnf.generate_arpicmp_data()
+ self.assertIsNotNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_final_txrx_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.ports_len = 2
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.pktq_out_os = [1, 2]
+ result = opnfv_vnf.generate_final_txrx_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'openstack'
+ opnfv_vnf.pktq_out_os = [1, 2]
+ opnfv_vnf.lb_index = 1
+ result = opnfv_vnf.generate_final_txrx_data()
+ self.assertIsNotNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_initial_txrx_data(self, mock_open, mock_os,
+ ConfigParser, OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 2
+ result = opnfv_vnf.generate_initial_txrx_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'openstack'
+ opnfv_vnf.pktq_out_os = [1, 2]
+ result = opnfv_vnf.generate_initial_txrx_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'ovs'
+ opnfv_vnf.init_ovs = False
+ opnfv_vnf.ovs_pktq_out = ''
+ opnfv_vnf.pktq_out_os = [1, 2]
+ opnfv_vnf.lb_index = 1
+ result = opnfv_vnf.generate_initial_txrx_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.nfv_type = 'ovs'
+ opnfv_vnf.init_ovs = True
+ opnfv_vnf.pktq_out_os = [1, 2]
+ opnfv_vnf.ovs_pktq_out = ''
+ opnfv_vnf.lb_index = 1
+ result = opnfv_vnf.generate_initial_txrx_data()
+ self.assertIsNotNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_lb_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 2
+ opnfv_vnf.prv_que_handler = 0
+ result = opnfv_vnf.generate_lb_data()
+ self.assertIsNotNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_vnf_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 1
+ opnfv_vnf.pktq_out = ['1', '2']
+ opnfv_vnf.vnf_tpl = {'public_ip_port_range': '98164810',
+ 'vnf_set': '(2,4,5)'}
+ opnfv_vnf.prv_que_handler = 0
+ result = opnfv_vnf.generate_vnf_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.lb_config = 'HW'
+ opnfv_vnf.mul = 0.1
+ result = opnfv_vnf.generate_vnf_data()
+ self.assertIsNotNone(result)
+ opnfv_vnf.lb_config = 'HW'
+ opnfv_vnf.mul = 0.1
+ opnfv_vnf.vnf_type = 'ACL'
+ result = opnfv_vnf.generate_vnf_data()
+ self.assertIsNotNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_generate_config_data(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 1
+ opnfv_vnf.pktq_out = ['1', '2']
+ opnfv_vnf.prv_que_handler = 0
+ opnfv_vnf.init_write_parser_template = mock.Mock()
+ opnfv_vnf.arpicmp_tpl = mock.MagicMock()
+ opnfv_vnf.txrx_tpl = mock.MagicMock()
+ opnfv_vnf.loadb_tpl = mock.MagicMock()
+ opnfv_vnf.vnf_tpl = {'public_ip_port_range': '98164810 (1,65535)',
+ 'vnf_set': "(2,4,5)"}
+ opnfv_vnf.generate_vnf_data = mock.Mock(return_value={})
+ opnfv_vnf.update_write_parser = mock.Mock()
+ result = opnfv_vnf.generate_config_data()
+ self.assertIsNone(result)
+ opnfv_vnf.generate_final_txrx_data = mock.Mock()
+ opnfv_vnf.update_write_parser = mock.Mock()
+ result = opnfv_vnf.generate_config_data()
+ self.assertIsNone(result)
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 1
+ opnfv_vnf.pktq_out = ['1', '2']
+ opnfv_vnf.prv_que_handler = 0
+ opnfv_vnf.init_write_parser_template = mock.Mock()
+ opnfv_vnf.arpicmp_tpl = mock.MagicMock()
+ opnfv_vnf.txrx_tpl = mock.MagicMock()
+ opnfv_vnf.loadb_tpl = mock.MagicMock()
+ opnfv_vnf.vnf_type = 'CGNAPT'
+ opnfv_vnf.update_timer = mock.Mock()
+ opnfv_vnf.port_pair_list = [[[0], [1], [2]]]
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.generate_arpicmp_data = mock.Mock()
+ result = opnfv_vnf.generate_config_data()
+ self.assertIsNone(result)
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_get_port_pairs(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 1
+ opnfv_vnf.pktq_out = ['1', '2']
+ opnfv_vnf.prv_que_handler = 0
+ opnfv_vnf.init_write_parser_template = mock.Mock()
+ opnfv_vnf.arpicmp_tpl = mock.MagicMock()
+ opnfv_vnf.txrx_tpl = mock.MagicMock()
+ opnfv_vnf.loadb_tpl = mock.MagicMock()
+ opnfv_vnf.vnf_tpl = {'public_ip_port_range': '98164810 (1,65535)',
+ 'vnf_set': '(2,4,5)'}
+ opnfv_vnf.generate_vnf_data = mock.Mock(return_value={})
+ opnfv_vnf.update_write_parser = mock.Mock()
+
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ opnfv_vnf.topology_file = \
+ os.path.join(curr_path, 'acl_vnf_topology_ixia.yaml')
+ opnfv_vnf.lb_count = 10
+ result = opnfv_vnf.get_port_pairs(opnfv_vnf.interfaces)
+ self.assertEqual(result[0], [('xe0', 'xe1')])
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.open')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.os')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.ConfigParser')
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.OrderedDict')
+ def test_init_eal(self, mock_open, mock_os, ConfigParser,
+ OrderedDict):
+ topology_file = mock.Mock()
+ config_tpl = mock.Mock()
+ tmp_file = mock.Mock()
+ opnfv_vnf = MultiPortConfig(topology_file, config_tpl, tmp_file)
+ opnfv_vnf.socket = 0
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.port_pair_list = [[[0], [1]]]
+ opnfv_vnf.port_pairs = [[[0], [1]]]
+ opnfv_vnf.txrx_pipeline = ''
+ opnfv_vnf.rules = ''
+ opnfv_vnf.write_parser = mock.MagicMock()
+ opnfv_vnf.read_parser = mock.MagicMock()
+ opnfv_vnf.read_parser.sections = mock.Mock(return_value=['MASTER'])
+ opnfv_vnf.read_parser.has_option = mock.Mock(return_value=[])
+ opnfv_vnf.write_parser.set = mock.Mock()
+ opnfv_vnf.write_parser.add_section = mock.Mock()
+ opnfv_vnf.read_parser.items = mock.MagicMock()
+ opnfv_vnf.pipeline_counter = 0
+ opnfv_vnf.worker_config = '1t'
+ opnfv_vnf.start_core = 0
+ opnfv_vnf.lb_count = 1
+ opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface']
+ opnfv_vnf.lb_to_port_pair_mapping = [0, 1]
+ opnfv_vnf.lb_index = 1
+ opnfv_vnf.ports_len = 1
+ opnfv_vnf.pktq_out = ['1', '2']
+ opnfv_vnf.prv_que_handler = 0
+ opnfv_vnf.init_write_parser_template = mock.Mock()
+ opnfv_vnf.arpicmp_tpl = mock.MagicMock()
+ opnfv_vnf.txrx_tpl = mock.MagicMock()
+ opnfv_vnf.loadb_tpl = mock.MagicMock()
+ opnfv_vnf.vnf_tpl = {'public_ip_port_range': '98164810 (1,65535)'}
+ opnfv_vnf.generate_vnf_data = mock.Mock(return_value={})
+ opnfv_vnf.update_write_parser = mock.Mock()
+ opnfv_vnf.tmp_file = "/tmp/config"
+ result = opnfv_vnf.init_eal()
+ self.assertIsNone(result)
diff --git a/tests/unit/network_services/libs/__init__.py b/tests/unit/network_services/libs/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/network_services/libs/__init__.py
diff --git a/tests/unit/network_services/libs/ixia_libs/__init__.py b/tests/unit/network_services/libs/ixia_libs/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/network_services/libs/ixia_libs/__init__.py
diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
new file mode 100644
index 000000000..9114b5163
--- /dev/null
+++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
@@ -0,0 +1,882 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+# Unittest for yardstick.network_services.libs.ixia_libs.IxNet
+
+from __future__ import absolute_import
+import unittest
+import mock
+
+from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IxNextgen
+from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_4
+from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_6
+
+
+class TestIxNextgen(unittest.TestCase):
+
+ def test___init__(self):
+ ixnet_gen = IxNextgen()
+ self.assertIsNone(ixnet_gen._bidir)
+
+ @mock.patch("yardstick.network_services.libs.ixia_libs.IxNet.IxNet.IxNetwork")
+ @mock.patch("yardstick.network_services.libs.ixia_libs.IxNet.IxNet.sys")
+ def test_connect(self, mock_sys, mock_ix_network):
+ mock_ix_network.IxNet.return_value = mock_ixnet = mock.Mock()
+
+ ixnet_gen = IxNextgen()
+ ixnet_gen.get_config = mock.MagicMock()
+ ixnet_gen.get_ixnet = mock.MagicMock()
+
+ result = ixnet_gen._connect({"py_lib_path": "/tmp"})
+ self.assertIsNotNone(result)
+ self.assertEqual(mock_ix_network.IxNet.call_count, 1)
+ self.assertEqual(mock_ixnet.connect.call_count, 1)
+
+ def test_clear_ixia_config(self):
+ ixnet = mock.MagicMock()
+ ixnet.execute = mock.Mock()
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.clear_ixia_config()
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.execute.call_count, 1)
+
+ def test_load_ixia_profile(self):
+ ixnet = mock.MagicMock()
+ ixnet.execute = mock.Mock()
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.load_ixia_profile({})
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.execute.call_count, 1)
+
+ def test_load_ixia_config(self):
+ ixnet = mock.MagicMock()
+ ixnet.execute = mock.Mock()
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_load_config({})
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.execute.call_count, 2)
+
+ @mock.patch('yardstick.network_services.libs.ixia_libs.IxNet.IxNet.log')
+ def test_ix_assign_ports(self, mock_logger):
+ ixnet = mock.MagicMock()
+ ixnet.getList.return_value = [0, 1]
+ ixnet.getAttribute.side_effect = ['up', 'down']
+
+ config = {
+ 'chassis': '1.1.1.1',
+ 'card1': '1',
+ 'card2': '2',
+ 'port1': '2',
+ 'port2': '2',
+ }
+
+ ixnet_gen = IxNextgen(ixnet)
+ ixnet_gen._cfg = config
+
+ result = ixnet_gen.ix_assign_ports()
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.execute.call_count, 1)
+ self.assertEqual(ixnet.commit.call_count, 1)
+ self.assertEqual(ixnet.getAttribute.call_count, 2)
+ self.assertEqual(mock_logger.error.call_count, 1)
+
+ def test_ix_update_frame(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": {
+ "64B": "100",
+ "1KB": "0",
+ },
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": False,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.remapIds.return_value = ["0"]
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+ ixnet.getList.side_effect = [
+ [1],
+ [1],
+ [1],
+ [
+ "ethernet.header.destinationAddress",
+ "ethernet.header.sourceAddress",
+ ],
+ ]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_update_frame(static_traffic_params)
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.setMultiAttribute.call_count, 7)
+ self.assertEqual(ixnet.commit.call_count, 2)
+
+ def test_ix_update_udp(self):
+ ixnet = mock.MagicMock()
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_update_udp({})
+ self.assertIsNone(result)
+
+ def test_ix_update_tcp(self):
+ ixnet = mock.MagicMock()
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_update_tcp({})
+ self.assertIsNone(result)
+
+ def test_ix_start_traffic(self):
+ ixnet = mock.MagicMock()
+ ixnet.getList.return_value = [0]
+ ixnet.getAttribute.return_value = 'down'
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_start_traffic()
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.getList.call_count, 1)
+ self.assertEqual(ixnet.execute.call_count, 3)
+
+ def test_ix_stop_traffic(self):
+ ixnet = mock.MagicMock()
+ ixnet.getList.return_value = [0]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_stop_traffic()
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.getList.call_count, 1)
+ self.assertEqual(ixnet.execute.call_count, 1)
+
+ def test_ix_get_statistics(self):
+ ixnet = mock.MagicMock()
+ ixnet.execute.return_value = ""
+ ixnet.getList.side_effect = [
+ [
+ '::ixNet::OBJ-/statistics/view:"Traffic Item Statistics"',
+ '::ixNet::OBJ-/statistics/view:"Port Statistics"',
+ ],
+ [
+ '::ixNet::OBJ-/statistics/view:"Flow Statistics"',
+ ],
+ ]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_get_statistics()
+ self.assertIsNotNone(result)
+ self.assertEqual(ixnet.getList.call_count, 2)
+ self.assertEqual(ixnet.execute.call_count, 20)
+
+ def test_find_view_obj_no_where(self):
+ views = ['here', 'there', 'everywhere']
+ result = IxNextgen.find_view_obj('no_where', views)
+ self.assertEqual(result, '')
+
+ def test_add_ip_header_v4(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "count": 1024,
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.remapIds.return_value = ["0"]
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+ ixnet.getList.side_effect = [[1], [0], [0], ["srcIp", "dstIp"]]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.add_ip_header(static_traffic_params, IP_VERSION_4)
+ self.assertIsNone(result)
+ self.assertGreater(ixnet.setMultiAttribute.call_count, 0)
+ self.assertEqual(ixnet.commit.call_count, 1)
+
+ def test_add_ip_header_v4_nothing_to_do(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "count": 1024,
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.remapIds.return_value=["0"]
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+ ixnet.getList.side_effect = [[1], [0, 1], [0], ["srcIp", "dstIp"]]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.add_ip_header(static_traffic_params, IP_VERSION_4)
+ self.assertIsNone(result)
+ self.assertGreater(ixnet.setMultiAttribute.call_count, 0)
+ self.assertEqual(ixnet.commit.call_count, 1)
+
+ def test_add_ip_header_v6(self):
+ static_traffic_profile = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.getList.side_effect = [[1], [1], [1], ["srcIp", "dstIp"]]
+ ixnet.remapIds.return_value = ["0"]
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.add_ip_header(static_traffic_profile, IP_VERSION_6)
+ self.assertIsNone(result)
+ self.assertGreater(ixnet.setMultiAttribute.call_count, 0)
+ self.assertEqual(ixnet.commit.call_count, 1)
+
+ def test_add_ip_header_v6_nothing_to_do(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "count": 1024,
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": {"64B": "100"},
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.getList.side_effect = [[1], [0, 1], [1], ["srcIP", "dstIP"]]
+ ixnet.remapIds.return_value = ["0"]
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.add_ip_header(static_traffic_params, IP_VERSION_6)
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.setMultiAttribute.call_count, 0)
+
+ def test_set_random_ip_multi_attributes_bad_ip_version(self):
+ bad_ip_version = object()
+ ixnet_gen = IxNextgen(mock.Mock())
+ mock1 = mock.Mock()
+ mock2 = mock.Mock()
+ mock3 = mock.Mock()
+ with self.assertRaises(ValueError):
+ ixnet_gen.set_random_ip_multi_attributes(mock1, bad_ip_version, mock2, mock3)
+
+ def test_get_config(self):
+ tg_cfg = {
+ "vdu": [
+ {
+ "external-interface": [
+ {
+ "virtual-interface": {
+ "vpci": "0000:07:00.1",
+ },
+ },
+ {
+ "virtual-interface": {
+ "vpci": "0001:08:01.2",
+ },
+ },
+ ],
+ },
+ ],
+ "mgmt-interface": {
+ "ip": "test1",
+ "tg-config": {
+ "dut_result_dir": "test2",
+ "version": "test3",
+ "ixchassis": "test4",
+ "tcl_port": "test5",
+ "py_lib_path": "test6",
+ },
+ }
+ }
+
+ expected = {
+ 'py_lib_path': 'test6',
+ 'machine': 'test1',
+ 'port': 'test5',
+ 'chassis': 'test4',
+ 'card1': '0000',
+ 'port1': '07',
+ 'card2': '0001',
+ 'port2': '08',
+ 'output_dir': 'test2',
+ 'version': 'test3',
+ 'bidir': True,
+ }
+
+ result = IxNextgen.get_config(tg_cfg)
+ self.assertDictEqual(result, expected)
+
+ def test_ix_update_ether(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+ ixnet.getList.side_effect = [
+ [1],
+ [1],
+ [1],
+ [
+ "ethernet.header.destinationAddress",
+ "ethernet.header.sourceAddress",
+ ],
+ ]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_update_ether(static_traffic_params)
+ self.assertIsNone(result)
+ self.assertGreater(ixnet.setMultiAttribute.call_count, 0)
+
+ def test_ix_update_ether_nothing_to_do(self):
+ static_traffic_params = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+
+ ixnet = mock.MagicMock()
+ ixnet.setMultiAttribute.return_value = [1]
+ ixnet.commit.return_value = [1]
+ ixnet.getList.side_effect=[
+ [1],
+ [1],
+ [1],
+ [
+ "ethernet.header.destinationAddress",
+ "ethernet.header.sourceAddress",
+ ],
+ ]
+
+ ixnet_gen = IxNextgen(ixnet)
+
+ result = ixnet_gen.ix_update_ether(static_traffic_params)
+ self.assertIsNone(result)
+ self.assertEqual(ixnet.setMultiAttribute.call_count, 0)
diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py
index e2640ac74..cb26fd085 100644
--- a/tests/unit/network_services/nfvi/test_resource.py
+++ b/tests/unit/network_services/nfvi/test_resource.py
@@ -92,9 +92,11 @@ class TestResourceProfile(unittest.TestCase):
mock.Mock(return_value=(0, {}, ""))
ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
self.resource_profile = \
- ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0],
- [1, 2, 3])
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
def test___init__(self):
self.assertEqual(True, self.resource_profile.enable)
@@ -107,13 +109,13 @@ class TestResourceProfile(unittest.TestCase):
reskey = ["", "cpufreq", "cpufreq-0"]
value = "metric:10"
val = self.resource_profile.get_cpu_data(reskey, value)
- self.assertEqual(val, ['0', 'cpufreq', '10', 'metric'])
+ self.assertIsNotNone(val)
def test_get_cpu_data_error(self):
reskey = ["", "", ""]
value = "metric:10"
val = self.resource_profile.get_cpu_data(reskey, value)
- self.assertEqual(val, ['error', 'Invalid', ''])
+ self.assertEqual(val, ('error', 'Invalid', '', ''))
def test__start_collectd(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
@@ -121,32 +123,228 @@ class TestResourceProfile(unittest.TestCase):
ssh_mock.execute = \
mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
resource_profile = \
- ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0],
- [1, 2, 3])
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._prepare_collectd_conf = mock.Mock()
self.assertIsNone(
resource_profile._start_collectd(ssh_mock, "/opt/nsb_bin"))
- def test_initiate_systemagent(self):
+ def test__prepare_collectd_conf_BM(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
ssh_mock = mock.Mock(autospec=ssh.SSH)
ssh_mock.execute = \
mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
resource_profile = \
- ResourceProfile(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0],
- [1, 2, 3])
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._provide_config_file = mock.Mock()
+ self.assertIsNone(
+ resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
+
+ def test__prepare_collectd_conf_managed_ovs_dpdk(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._provide_config_file = mock.Mock()
+ self.assertIsNone(
+ resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
+
+ def test__prepare_collectd_conf_ovs_dpdk(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._provide_config_file = mock.Mock()
+ self.assertIsNone(
+ resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
+
+ def test__prepare_collectd_conf_managed_sriov(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._provide_config_file = mock.Mock()
+ self.assertIsNone(
+ resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
+
+ def test__prepare_collectd_conf_sriov(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._provide_config_file = mock.Mock()
+ self.assertIsNone(
+ resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
+
+ @mock.patch("yardstick.network_services.nfvi.resource.open")
+ @mock.patch("yardstick.network_services.nfvi.resource.tempfile")
+ @mock.patch("yardstick.network_services.nfvi.resource.os")
+ def test__provide_config_file(self, mock_open, mock_tempfile, mock_os):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._prepare_collectd_conf = mock.Mock()
+ resource_profile.connection = ssh_mock
+ resource_profile.connection.put = \
+ mock.Mock(return_value=(0, "", ""))
+ mock_tempfile.mkstemp = mock.Mock(return_value=["test", ""])
+ self.assertIsNone(
+ resource_profile._provide_config_file("/opt/nsb_bin",
+ "collectd.cfg", {}))
+
+ @mock.patch("yardstick.network_services.nfvi.resource.open")
+ def test_initiate_systemagent(self, mock_open):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ mgmt = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['mgmt-interface']
+ interfaces = \
+ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface']
+ resource_profile = \
+ ResourceProfile(mgmt, interfaces, [1, 2, 3])
+ resource_profile._start_collectd = mock.Mock()
self.assertIsNone(
resource_profile.initiate_systemagent("/opt/nsb_bin"))
+ def test__parse_hugepages(self):
+ reskey = ["cpu", "cpuFreq"]
+ value = "timestamp:12345"
+ res = self.resource_profile.parse_hugepages(reskey, value)
+ self.assertEqual({'cpu/cpuFreq': '12345'}, res)
+
+ def test__parse_dpdkstat(self):
+ reskey = ["dpdk0", "0"]
+ value = "tx:12345"
+ res = self.resource_profile.parse_dpdkstat(reskey, value)
+ self.assertEqual({'dpdk0/0': '12345'}, res)
+
+ def test__parse_virt(self):
+ reskey = ["vm0", "cpu"]
+ value = "load:45"
+ res = self.resource_profile.parse_virt(reskey, value)
+ self.assertEqual({'vm0/cpu': '45'}, res)
+
+ def test__parse_ovs_stats(self):
+ reskey = ["ovs", "stats"]
+ value = "tx:45"
+ res = self.resource_profile.parse_ovs_stats(reskey, value)
+ self.assertEqual({'ovs/stats': '45'}, res)
+
def test_parse_collectd_result(self):
res = self.resource_profile.parse_collectd_result({}, [0, 1, 2])
- self.assertDictEqual(res, {'timestamp': '', 'cpu': {}, 'memory': {}})
+ expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {},
+ 'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'virt': {}}
+ self.assertDictEqual(res, expected_result)
+
+ def test_parse_collectd_result_cpu(self):
+ metric = {"nsb_stats/cpu/0/ipc": "101"}
+ self.resource_profile.get_cpu_data = mock.Mock(return_value=[1,
+ "ipc",
+ "1234",
+ ""])
+ res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
+ expected_result = {'cpu': {1: {'ipc': '1234'}}, 'dpdkstat': {}, 'hugepages': {},
+ 'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'virt': {}}
+ self.assertDictEqual(res, expected_result)
+
+ def test_parse_collectd_result_memory(self):
+ metric = {"nsb_stats/memory/bw": "101"}
+ res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
+ expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {},
+ 'memory': {'bw': '101'}, 'ovs_stats': {}, 'timestamp': '',
+ 'virt': {}}
+ self.assertDictEqual(res, expected_result)
+
+ def test_parse_collectd_result_hugepage(self):
+ metric = {"nsb_stats/hugepages/free": "101"}
+ self.resource_profile.parse_hugepages = \
+ mock.Mock(return_value={"free": "101"})
+ res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
+ expected_result = {'cpu': {}, 'dpdkstat': {}, 'hugepages': {'free':
+ '101'},
+ 'memory': {}, 'ovs_stats': {}, 'timestamp': '',
+ 'virt': {}}
+ self.assertDictEqual(res, expected_result)
+
+ def test_parse_collectd_result_dpdk_virt_ovs(self):
+ metric = {"nsb_stats/dpdkstat/tx": "101",
+ "nsb_stats/ovs_stats/tx": "101",
+ "nsb_stats/virt/virt/memory": "101"}
+ self.resource_profile.parse_dpdkstat = \
+ mock.Mock(return_value={"tx": "101"})
+ self.resource_profile.parse_virt = \
+ mock.Mock(return_value={"memory": "101"})
+ self.resource_profile.parse_ovs_stats = \
+ mock.Mock(return_value={"tx": "101"})
+ res = self.resource_profile.parse_collectd_result(metric, [0, 1, 2])
+ expected_result = {'cpu': {}, 'dpdkstat': {'tx': '101'}, 'hugepages': {},
+ 'memory': {}, 'ovs_stats': {'tx': '101'}, 'timestamp': '',
+ 'virt': {'memory': '101'}}
+ self.assertDictEqual(res, expected_result)
+
+ def test_amqp_process_for_nfvi_kpi(self):
+ self.resource_profile.amqp_client = \
+ mock.MagicMock(side_effect=[None, mock.MagicMock()])
+ self.resource_profile.run_collectd_amqp = \
+ mock.Mock(return_value=0)
+ res = self.resource_profile.amqp_process_for_nfvi_kpi()
+ self.assertEqual(None, res)
+
+ def test_amqp_collect_nfvi_kpi(self):
+ self.resource_profile.amqp_client = \
+ mock.MagicMock(side_effect=[None, mock.MagicMock()])
+ self.resource_profile.run_collectd_amqp = \
+ mock.Mock(return_value=0)
+ self.resource_profile.parse_collectd_result = mock.Mock()
+ res = self.resource_profile.amqp_collect_nfvi_kpi()
+ self.assertIsNotNone(res)
def test_run_collectd_amqp(self):
_queue = multiprocessing.Queue()
resource.AmqpConsumer = mock.Mock(autospec=collectd)
- self.assertIsNone(self.resource_profile.run_collectd_amqp(_queue))
+ self.assertIsNone(self.resource_profile.run_collectd_amqp())
def test_start(self):
self.assertIsNone(self.resource_profile.start())
diff --git a/tests/unit/network_services/test_utils.py b/tests/unit/network_services/test_utils.py
index 8d9e74adf..993adbeae 100644
--- a/tests/unit/network_services/test_utils.py
+++ b/tests/unit/network_services/test_utils.py
@@ -27,7 +27,7 @@ from yardstick.network_services import utils
class UtilsTestCase(unittest.TestCase):
"""Test all VNF helper methods."""
- DPDK_PATH = os.path.join(utils.NSB_ROOT, "dpdk_nic_bind.py")
+ DPDK_PATH = os.path.join(utils.NSB_ROOT, "dpdk-devbind.py")
def setUp(self):
super(UtilsTestCase, self).setUp()
diff --git a/tests/unit/network_services/test_yang_model.py b/tests/unit/network_services/test_yang_model.py
new file mode 100644
index 000000000..28367f316
--- /dev/null
+++ b/tests/unit/network_services/test_yang_model.py
@@ -0,0 +1,135 @@
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+# Unittest for yardstick.network_services.utils
+
+from __future__ import absolute_import
+
+import unittest
+import mock
+
+import yaml
+
+from yardstick.network_services.yang_model import YangModel
+
+
+class YangModelTestCase(unittest.TestCase):
+ """Test all Yang Model methods."""
+
+ ENTRIES = {
+ 'access-list1': {
+ 'acl': {
+ 'access-list-entries': [{
+ 'ace': {
+ 'ace-oper-data': {
+ 'match-counter': 0},
+ 'actions': 'drop,count',
+ 'matches': {
+ 'destination-ipv4-network':
+ '152.16.40.20/24',
+ 'destination-port-range': {
+ 'lower-port': 0,
+ 'upper-port': 65535},
+ 'source-ipv4-network': '0.0.0.0/0',
+ 'source-port-range': {
+ 'lower-port': 0,
+ 'upper-port': 65535}},
+ 'rule-name': 'rule1588'}},
+ {
+ 'ace': {
+ 'ace-oper-data': {
+ 'match-counter': 0},
+ 'actions': 'drop,count',
+ 'matches': {
+ 'destination-ipv4-network':
+ '0.0.0.0/0',
+ 'destination-port-range': {
+ 'lower-port': 0,
+ 'upper-port': 65535},
+ 'source-ipv4-network':
+ '152.16.100.20/24',
+ 'source-port-range': {
+ 'lower-port': 0,
+ 'upper-port': 65535}},
+ 'rule-name': 'rule1589'}}],
+ 'acl-name': 'sample-ipv4-acl',
+ 'acl-type': 'ipv4-acl'}
+ }
+ }
+
+ def test__init__(self):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ self.assertEqual(y.config_file, cfg)
+
+ def test_config_file_setter(self):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ self.assertEqual(y.config_file, cfg)
+ cfg2 = "yang2.yaml"
+ y.config_file = cfg2
+ self.assertEqual(y.config_file, cfg2)
+
+ def test__get_entries(self):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ y._options = self.ENTRIES
+ y._get_entries()
+ self.assertIn("p acl add", y._rules)
+
+ def test__get_entries_no_options(self):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ y._get_entries()
+ self.assertEqual(y._rules, '')
+
+ @mock.patch('yaml.safe_load')
+ @mock.patch('yardstick.network_services.yang_model.open')
+ def test__read_config(self, mock_open, mock_safe_load):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ mock_safe_load.return_value = expected = {'key1': 'value1', 'key2': 'value2'}
+ y._read_config()
+ self.assertDictEqual(y._options, expected)
+
+ @mock.patch('yardstick.network_services.yang_model.open')
+ def test__read_config_open_error(self, mock_open):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ mock_open.side_effect = IOError('my error')
+
+ self.assertEqual(y._options, {})
+ with self.assertRaises(IOError) as raised:
+ y._read_config()
+
+ self.assertIn('my error', str(raised.exception))
+ self.assertEqual(y._options, {})
+
+ def test_get_rules(self):
+ cfg = "yang.yaml"
+ y = YangModel(cfg)
+ y._read_config = read_mock = mock.Mock()
+ y._get_entries = get_mock = mock.Mock()
+
+ y._rules = None
+ self.assertIsNone(y.get_rules())
+ self.assertEqual(read_mock.call_count, 1)
+ self.assertEqual(get_mock.call_count, 1)
+
+ # True value should prevent calling read and get
+ y._rules = 999
+ self.assertEqual(y.get_rules(), 999)
+ self.assertEqual(read_mock.call_count, 1)
+ self.assertEqual(get_mock.call_count, 1)
diff --git a/tests/unit/network_services/traffic_profile/test_http_ixload.py b/tests/unit/network_services/traffic_profile/test_http_ixload.py
new file mode 100644
index 000000000..2e1b6f4ff
--- /dev/null
+++ b/tests/unit/network_services/traffic_profile/test_http_ixload.py
@@ -0,0 +1,250 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# 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.
+
+
+from __future__ import absolute_import
+import unittest
+import mock
+import runpy
+
+from oslo_serialization import jsonutils
+
+from yardstick.network_services.traffic_profile import http_ixload
+
+
+class TestIxLoadTrafficGen(unittest.TestCase):
+
+ def test_parse_run_test(self):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+ j = jsonutils.dump_as_bytes(test_input)
+ ixload = http_ixload.IXLOADHttpTest(j)
+ self.assertDictEqual(ixload.test_input, test_input)
+ self.assertIsNone(ixload.parse_run_test())
+ self.assertEqual(ixload.ports_to_reassign, [
+ ["IXIA_CHASSIS", "CARD", 1],
+ ["IXIA_CHASSIS", "CARD", 2],
+ ["IXIA_CHASSIS", "CARD", 3],
+ ])
+
+ def test_format_ports_for_reassignment(self):
+ ports = [
+ ["IXIA_CHASSIS", "CARD", 1],
+ ["IXIA_CHASSIS", "CARD", 2],
+ ["IXIA_CHASSIS", "CARD", 3],
+ ]
+ formatted = http_ixload.IXLOADHttpTest.format_ports_for_reassignment(ports)
+ self.assertEqual(formatted, [
+ "IXIA_CHASSIS;CARD;1",
+ "IXIA_CHASSIS;CARD;2",
+ "IXIA_CHASSIS;CARD;3",
+ ])
+
+ def test_reassign_ports(self):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+ j = jsonutils.dump_as_bytes(test_input)
+ ixload = http_ixload.IXLOADHttpTest(j)
+ repository = mock.Mock()
+ test = mock.MagicMock()
+ test.setPorts = mock.Mock()
+ ports_to_reassign = [(1, 2, 3), (1, 2, 4)]
+ ixload.format_ports_for_reassignment = mock.Mock(return_value=["1;2;3"])
+ self.assertIsNone(ixload.reassign_ports(test, repository, ports_to_reassign))
+
+ def test_reassign_ports_error(self):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+ j = jsonutils.dump_as_bytes(test_input)
+ ixload = http_ixload.IXLOADHttpTest(j)
+ repository = mock.Mock()
+ test = "test"
+ ports_to_reassign = [(1, 2, 3), (1, 2, 4)]
+ ixload.format_ports_for_reassignment = mock.Mock(return_value=["1;2;3"])
+ ixload.ix_load = mock.MagicMock()
+ ixload.ix_load.delete = mock.Mock()
+ ixload.ix_load.disconnect = mock.Mock()
+ with self.assertRaises(Exception):
+ ixload.reassign_ports(test, repository, ports_to_reassign)
+
+ def test_stat_collector(self):
+ args = [0, 1]
+ self.assertIsNone(
+ http_ixload.IXLOADHttpTest.stat_collector(*args))
+
+ def test_IxL_StatCollectorCommand(self):
+ args = [[0, 1, 2, 3], [0, 1, 2, 3]]
+ self.assertIsNone(
+ http_ixload.IXLOADHttpTest.IxL_StatCollectorCommand(*args))
+
+ def test_set_results_dir(self):
+ test_stat_collector = mock.MagicMock()
+ test_stat_collector.setResultDir = mock.Mock()
+ results_on_windows = "c:/Results"
+ self.assertIsNone(
+ http_ixload.IXLOADHttpTest.set_results_dir(test_stat_collector,
+ results_on_windows))
+
+ def test_set_results_dir_error(self):
+ test_stat_collector = ""
+ results_on_windows = "c:/Results"
+ with self.assertRaises(Exception):
+ http_ixload.IXLOADHttpTest.set_results_dir(test_stat_collector, results_on_windows)
+
+ def test_load_config_file(self):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+ j = jsonutils.dump_as_bytes(test_input)
+ ixload = http_ixload.IXLOADHttpTest(j)
+ ixload.ix_load = mock.MagicMock()
+ ixload.ix_load.new = mock.Mock(return_value="")
+ self.assertIsNotNone(ixload.load_config_file("ixload.cfg"))
+
+ def test_load_config_file_error(self):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+ j = jsonutils.dump_as_bytes(test_input)
+ ixload = http_ixload.IXLOADHttpTest(j)
+ ixload.ix_load = "test"
+ with self.assertRaises(Exception):
+ ixload.load_config_file("ixload.cfg")
+
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
+ def test_start_http_test_connect_error(self, mock_collector_type, mock_ixload_type):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+
+ j = jsonutils.dump_as_bytes(test_input)
+
+ mock_ixload = mock_ixload_type()
+ mock_ixload.connect.side_effect = RuntimeError
+
+ ixload = http_ixload.IXLOADHttpTest(j)
+ ixload.results_on_windows = 'windows_result_dir'
+ ixload.result_dir = 'my_result_dir'
+
+ with self.assertRaises(RuntimeError):
+ ixload.start_http_test()
+
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
+ def test_start_http_test(self, mock_collector_type, mock_ixload_type):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+
+ j = jsonutils.dump_as_bytes(test_input)
+
+ ixload = http_ixload.IXLOADHttpTest(j)
+ ixload.results_on_windows = 'windows_result_dir'
+ ixload.result_dir = 'my_result_dir'
+ ixload.load_config_file = mock.MagicMock()
+
+ self.assertIsNone(ixload.start_http_test())
+
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.IxLoad')
+ @mock.patch('yardstick.network_services.traffic_profile.http_ixload.StatCollectorUtils')
+ def test_start_http_test_reassign_error(self, mock_collector_type, mock_ixload_type):
+ ports = [1, 2, 3]
+ test_input = {
+ "remote_server": "REMOTE_SERVER",
+ "ixload_cfg": "IXLOAD_CFG",
+ "result_dir": "RESULT_DIR",
+ "ixia_chassis": "IXIA_CHASSIS",
+ "IXIA": {
+ "card": "CARD",
+ "ports": ports,
+ },
+ }
+
+ j = jsonutils.dump_as_bytes(test_input)
+
+ ixload = http_ixload.IXLOADHttpTest(j)
+ ixload.load_config_file = mock.MagicMock()
+
+ reassign_ports = mock.Mock(side_effect=RuntimeError)
+ ixload.reassign_ports = reassign_ports
+ ixload.results_on_windows = 'windows_result_dir'
+ ixload.result_dir = 'my_result_dir'
+
+ ixload.start_http_test()
+ self.assertEqual(reassign_ports.call_count, 1)
+
+ @mock.patch("yardstick.network_services.traffic_profile.http_ixload.IXLOADHttpTest")
+ def test_main(self, IXLOADHttpTest):
+ args = ["1", "2", "3"]
+ http_ixload.main(args)
diff --git a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
new file mode 100644
index 000000000..6dba64af9
--- /dev/null
+++ b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
@@ -0,0 +1,648 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+from __future__ import division
+import unittest
+import mock
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.traffic_profile.traffic_profile \
+ import TrexProfile
+ from yardstick.network_services.traffic_profile.ixia_rfc2544 import \
+ IXIARFC2544Profile
+ from yardstick.network_services.traffic_profile import ixia_rfc2544
+
+
+class TestIXIARFC2544Profile(unittest.TestCase):
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64}}
+
+ PROFILE = {'description': 'Traffic profile to run RFC2544 latency',
+ 'name': 'rfc2544',
+ 'traffic_profile': {'traffic_type': 'IXIARFC2544Profile',
+ 'frame_rate': 100},
+ 'public': {'ipv4':
+ {'outer_l2': {'framesize':
+ {'64B': '100', '1518B': '0',
+ '128B': '0', '1400B': '0',
+ '256B': '0', '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255',
+ 'proto': 'udp',
+ 'srcip4': '90.90.1.1-90.105.255.255',
+ 'dscp': 0, 'ttl': 32},
+ 'outer_l4': {'srcport': '2001',
+ 'dsrport': '1234'}}},
+ 'private': {'ipv4':
+ {'outer_l2': {'framesize':
+ {'64B': '100', '1518B': '0',
+ '128B': '0', '1400B': '0',
+ '256B': '0', '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255',
+ 'proto': 'udp',
+ 'srcip4': '1.1.1.1-1.15.255.255',
+ 'dscp': 0, 'ttl': 32},
+ 'outer_l4': {'dstport': '2001',
+ 'srcport': '1234'}}},
+ 'schema': 'isb:traffic_profile:0.1'}
+
+ def test_get_ixia_traffic_profile_error(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ STATIC_TRAFFIC = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+ ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
+
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.rate = 100
+ mac = {"src_mac_0": "00:00:00:00:00:01",
+ "src_mac_1": "00:00:00:00:00:02",
+ "src_mac_2": "00:00:00:00:00:02",
+ "dst_mac_0": "00:00:00:00:00:03",
+ "dst_mac_1": "00:00:00:00:00:04",
+ "dst_mac_2": "00:00:00:00:00:04"}
+ self.assertRaises(IOError, r_f_c2544_profile._get_ixia_traffic_profile,
+ self.PROFILE, mac, xfile="tmp",
+ static_traffic=STATIC_TRAFFIC)
+
+
+ @mock.patch("yardstick.network_services.traffic_profile.ixia_rfc2544.open")
+ def test_get_ixia_traffic_profile(self, mock_open):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ STATIC_TRAFFIC = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+ ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
+
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.rate = 100
+ mac = {"src_mac_0": "00:00:00:00:00:01",
+ "src_mac_1": "00:00:00:00:00:02",
+ "src_mac_2": "00:00:00:00:00:02",
+ "dst_mac_0": "00:00:00:00:00:03",
+ "dst_mac_1": "00:00:00:00:00:04",
+ "dst_mac_2": "00:00:00:00:00:04"}
+ result = r_f_c2544_profile._get_ixia_traffic_profile(
+ self.PROFILE, mac, xfile="tmp", static_traffic=STATIC_TRAFFIC)
+ self.assertIsNotNone(result)
+
+ @mock.patch("yardstick.network_services.traffic_profile.ixia_rfc2544.open")
+ def test_get_ixia_traffic_profile_v6(self, mock_open):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ STATIC_TRAFFIC = {
+ "private": {
+ "id": 1,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:03",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "dscp": 0,
+ "dstip4": "152.16.40.20",
+ "proto": "udp",
+ "srcip4": "152.16.100.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "2001",
+ "srcport": "1234"
+ },
+ "traffic_type": "continuous"
+ },
+ "public": {
+ "id": 2,
+ "bidir": "False",
+ "duration": 60,
+ "iload": "100",
+ "outer_l2": {
+ "dstmac": "00:00:00:00:00:04",
+ "framesPerSecond": True,
+ "framesize": 64,
+ "srcmac": "00:00:00:00:00:01"
+ },
+ "outer_l3": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v4": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l3v6": {
+ "count": 1024,
+ "dscp": 0,
+ "dstip4": "152.16.100.20",
+ "proto": "udp",
+ "srcip4": "152.16.40.20",
+ "ttl": 32
+ },
+ "outer_l4": {
+ "dstport": "1234",
+ "srcport": "2001"
+ },
+ "traffic_type": "continuous"
+ }
+ }
+ ixia_rfc2544.STATIC_TRAFFIC = STATIC_TRAFFIC
+
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.rate = 100
+ mac = {"src_mac_0": "00:00:00:00:00:01",
+ "src_mac_1": "00:00:00:00:00:02",
+ "src_mac_2": "00:00:00:00:00:02",
+ "dst_mac_0": "00:00:00:00:00:03",
+ "dst_mac_1": "00:00:00:00:00:04",
+ "dst_mac_2": "00:00:00:00:00:04"}
+ profile_data = {'description': 'Traffic profile to run RFC2544',
+ 'name': 'rfc2544',
+ 'traffic_profile':
+ {'traffic_type': 'IXIARFC2544Profile',
+ 'frame_rate': 100},
+ 'public':
+ {'ipv4':
+ {'outer_l2': {'framesize':
+ {'64B': '100', '1518B': '0',
+ '128B': '0', '1400B': '0',
+ '256B': '0', '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v6': {'dstip6': '1.1.1.1-1.15.255.255',
+ 'proto': 'udp',
+ 'srcip6': '90.90.1.1-90.105.255.255',
+ 'dscp': 0, 'ttl': 32},
+ 'outer_l4': {'srcport': '2001',
+ 'dsrport': '1234'}}},
+ 'private': {'ipv4':
+ {'outer_l2': {'framesize':
+ {'64B': '100', '1518B': '0',
+ '128B': '0', '1400B': '0',
+ '256B': '0', '373b': '0',
+ '570B': '0'}},
+ 'outer_l3v6':
+ {'dstip6': '9.9.1.1-90.105.255.255',
+ 'proto': 'udp',
+ 'srcip6': '1.1.1.1-1.15.255.255',
+ 'dscp': 0, 'ttl': 32},
+ 'outer_l4': {'dstport': '2001',
+ 'srcport': '1234'}}},
+ 'schema': 'isb:traffic_profile:0.1'}
+ result = r_f_c2544_profile._get_ixia_traffic_profile(
+ profile_data, mac, static_traffic=STATIC_TRAFFIC)
+ self.assertIsNotNone(result)
+
+ def test__ixia_traffic_generate(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ traffic = {"public": {'iload': 10},
+ "private": {'iload': 10}}
+ ixia_obj = mock.MagicMock()
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.rate = 100
+ result = r_f_c2544_profile._ixia_traffic_generate(traffic_generator,
+ traffic, ixia_obj)
+ self.assertIsNone(result)
+
+ def test_execute(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.first_run = True
+ r_f_c2544_profile.params = {"public": {'iload': 10},
+ "private": {'iload': 10}}
+
+ r_f_c2544_profile.get_streams = mock.Mock()
+ r_f_c2544_profile.full_profile = {}
+ r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
+ r_f_c2544_profile.get_multiplier = mock.Mock()
+ r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
+ ixia_obj = mock.MagicMock()
+ self.assertEqual(None, r_f_c2544_profile.execute(traffic_generator,
+ ixia_obj))
+
+ def test_get_drop_percentage(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.params = self.PROFILE
+ ixia_obj = mock.MagicMock()
+ r_f_c2544_profile.execute = mock.Mock()
+ r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
+ r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
+ r_f_c2544_profile.get_multiplier = mock.Mock()
+ r_f_c2544_profile.tmp_throughput = 0
+ r_f_c2544_profile.tmp_drop = 0
+ r_f_c2544_profile.full_profile = {}
+ samples = {}
+ for ifname in range(1):
+ name = "xe{}".format(ifname)
+ samples[name] = {"rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "RxThroughput": 10,
+ "TxThroughput": 10,
+ "in_packets": 1000,
+ "out_packets": 1000}
+ tol_min = 100.0
+ tolerance = 0.0
+ self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
+ traffic_generator, samples,
+ tol_min, tolerance, ixia_obj))
+
+ def test_get_drop_percentage_update(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.params = self.PROFILE
+ ixia_obj = mock.MagicMock()
+ r_f_c2544_profile.execute = mock.Mock()
+ r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
+ r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
+ r_f_c2544_profile.get_multiplier = mock.Mock()
+ r_f_c2544_profile.tmp_throughput = 0
+ r_f_c2544_profile.tmp_drop = 0
+ r_f_c2544_profile.full_profile = {}
+ samples = {}
+ for ifname in range(1):
+ name = "xe{}".format(ifname)
+ samples[name] = {"rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "RxThroughput": 10,
+ "TxThroughput": 10,
+ "in_packets": 1000,
+ "out_packets": 1002}
+ tol_min = 0.0
+ tolerance = 1.0
+ self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
+ traffic_generator, samples,
+ tol_min, tolerance, ixia_obj))
+
+ def test_get_drop_percentage_div_zero(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.params = self.PROFILE
+ ixia_obj = mock.MagicMock()
+ r_f_c2544_profile.execute = mock.Mock()
+ r_f_c2544_profile._get_ixia_traffic_profile = mock.Mock()
+ r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
+ r_f_c2544_profile.get_multiplier = mock.Mock()
+ r_f_c2544_profile.tmp_throughput = 0
+ r_f_c2544_profile.tmp_drop = 0
+ r_f_c2544_profile.full_profile = {}
+ samples = {}
+ for ifname in range(1):
+ name = "xe{}".format(ifname)
+ samples[name] = {"rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "RxThroughput": 10,
+ "TxThroughput": 10,
+ "in_packets": 1000,
+ "out_packets": 0}
+ tol_min = 0.0
+ tolerance = 0.0
+ r_f_c2544_profile.tmp_throughput = 0
+ self.assertIsNotNone(r_f_c2544_profile.get_drop_percentage(
+ traffic_generator, samples,
+ tol_min, tolerance, ixia_obj))
+
+ def test_get_multiplier(self):
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.max_rate = 100
+ r_f_c2544_profile.min_rate = 100
+ self.assertEqual("1.0", r_f_c2544_profile.get_multiplier())
+
+ def test_start_ixia_latency(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.max_rate = 100
+ r_f_c2544_profile.min_rate = 100
+ ixia_obj = mock.MagicMock()
+ r_f_c2544_profile._get_ixia_traffic_profile = \
+ mock.Mock(return_value={})
+ r_f_c2544_profile.full_profile = {}
+ r_f_c2544_profile._ixia_traffic_generate = mock.Mock()
+ self.assertEqual(
+ None,
+ r_f_c2544_profile.start_ixia_latency(traffic_generator,
+ ixia_obj))
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/traffic_profile/test_rfc2544.py b/tests/unit/network_services/traffic_profile/test_rfc2544.py
index 1e9409b2a..dcaf43dc5 100644
--- a/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -106,7 +106,7 @@ class TestRFC2544Profile(unittest.TestCase):
'name': 'rfc2544',
'traffic_profile': {'traffic_type': 'RFC2544Profile',
'frame_rate': 100},
- 'public': {'ipv4':
+ 'public_1': {'ipv4':
{'outer_l2': {'framesize':
{'64B': '100', '1518B': '0',
'128B': '0', '1400B': '0',
@@ -118,7 +118,7 @@ class TestRFC2544Profile(unittest.TestCase):
'dscp': 0, 'ttl': 32},
'outer_l4': {'srcport': '2001',
'dsrport': '1234'}}},
- 'private': {'ipv4':
+ 'private_1': {'ipv4':
{'outer_l2': {'framesize':
{'64B': '100', '1518B': '0',
'128B': '0', '1400B': '0',
@@ -139,6 +139,8 @@ class TestRFC2544Profile(unittest.TestCase):
def test_execute(self):
traffic_generator = mock.Mock(autospec=TrexProfile)
traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
traffic_generator.client = \
mock.Mock(return_value=True)
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
@@ -149,66 +151,101 @@ class TestRFC2544Profile(unittest.TestCase):
def test_get_drop_percentage(self):
traffic_generator = mock.Mock(autospec=TrexProfile)
traffic_generator.my_ports = [0, 1]
- traffic_generator.client = \
- mock.Mock(return_value=True)
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = mock.Mock(return_value=True)
+
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
r_f_c2544_profile.params = self.PROFILE
- self.assertEqual(None, r_f_c2544_profile.execute(traffic_generator))
+ r_f_c2544_profile.register_generator(traffic_generator)
+ self.assertIsNone(r_f_c2544_profile.execute(traffic_generator))
+
samples = {}
for ifname in range(1):
name = "xe{}".format(ifname)
- samples[name] = {"rx_throughput_fps": 20,
- "tx_throughput_fps": 20,
- "rx_throughput_mbps": 10,
- "tx_throughput_mbps": 10,
- "in_packets": 1000,
- "out_packets": 1000}
- tol_min = 100.0
- tolerance = 0.0
- expected = {'DropPercentage': 0.0, 'RxThroughput': 100/3.0,
- 'TxThroughput': 100/3.0, 'CurrentDropPercentage': 0.0,
- 'Throughput': 100/3.0,
- 'xe0': {'tx_throughput_fps': 20, 'in_packets': 1000,
- 'out_packets': 1000, 'rx_throughput_mbps': 10,
- 'tx_throughput_mbps': 10, 'rx_throughput_fps': 20}}
- self.assertDictEqual(expected,
- r_f_c2544_profile.get_drop_percentage(
- traffic_generator, samples,
- tol_min, tolerance))
+ samples[name] = {
+ "rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "in_packets": 1000,
+ "out_packets": 1000,
+ }
+
+ expected = {
+ 'DropPercentage': 0.0,
+ 'RxThroughput': 100 / 3.0,
+ 'TxThroughput': 100 / 3.0,
+ 'CurrentDropPercentage': 0.0,
+ 'Throughput': 66.66666666666667,
+ 'xe0': {
+ 'tx_throughput_fps': 20,
+ 'in_packets': 1000,
+ 'out_packets': 1000,
+ 'rx_throughput_mbps': 10,
+ 'tx_throughput_mbps': 10,
+ 'rx_throughput_fps': 20,
+ },
+ }
+ traffic_generator.generate_samples = mock.MagicMock(return_value=samples)
+ traffic_generator.RUN_DURATION = 30
+ traffic_generator.rfc2544_helper.tolerance_low = 0.0001
+ traffic_generator.rfc2544_helper.tolerance_high = 0.0001
+ result = r_f_c2544_profile.get_drop_percentage(traffic_generator)
+ self.assertDictEqual(result, expected)
def test_get_drop_percentage_update(self):
- traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator = mock.Mock(autospec=RFC2544Profile)
traffic_generator.my_ports = [0, 1]
- traffic_generator.client = \
- mock.Mock(return_value=True)
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = mock.Mock(return_value=True)
+
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
r_f_c2544_profile.params = self.PROFILE
- self.assertEqual(None, r_f_c2544_profile.execute(traffic_generator))
+ r_f_c2544_profile.register_generator(traffic_generator)
+ self.assertIsNone(r_f_c2544_profile.execute())
+
samples = {}
for ifname in range(1):
name = "xe{}".format(ifname)
- samples[name] = {"rx_throughput_fps": 20,
- "tx_throughput_fps": 20,
- "rx_throughput_mbps": 10,
- "tx_throughput_mbps": 10,
- "in_packets": 1000,
- "out_packets": 1002}
+ samples[name] = {
+ "rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "in_packets": 1000,
+ "out_packets": 1002,
+ }
tol_min = 0.0
tolerance = 1.0
- expected = {'DropPercentage': 0.2, 'RxThroughput': 100/3.0,
- 'TxThroughput': 33.4, 'CurrentDropPercentage': 0.2,
- 'Throughput': 100/3.0,
- 'xe0': {'tx_throughput_fps': 20, 'in_packets': 1000,
- 'out_packets': 1002, 'rx_throughput_mbps': 10,
- 'tx_throughput_mbps': 10, 'rx_throughput_fps': 20}}
- self.assertDictEqual(expected,
- r_f_c2544_profile.get_drop_percentage(
- traffic_generator, samples,
- tol_min, tolerance))
+ expected = {
+ 'DropPercentage': 0.1996,
+ 'RxThroughput': 33.333333333333336,
+ 'TxThroughput': 33.4,
+ 'CurrentDropPercentage': 0.1996,
+ 'Throughput': 66.66666666666667,
+ 'xe0': {
+ 'tx_throughput_fps': 20,
+ 'in_packets': 1000,
+ 'out_packets': 1002,
+ 'rx_throughput_mbps': 10,
+ 'tx_throughput_mbps': 10,
+ 'rx_throughput_fps': 20,
+ },
+ }
+ traffic_generator.generate_samples = mock.MagicMock(return_value=samples)
+ traffic_generator.RUN_DURATION = 30
+ traffic_generator.rfc2544_helper.tolerance_low = 0.0001
+ traffic_generator.rfc2544_helper.tolerance_high = 0.0001
+ result = r_f_c2544_profile.get_drop_percentage(traffic_generator)
+ self.assertDictEqual(expected, result)
def test_get_drop_percentage_div_zero(self):
traffic_generator = mock.Mock(autospec=TrexProfile)
traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [0]
+ traffic_generator.pub_ports = [1]
traffic_generator.client = \
mock.Mock(return_value=True)
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
@@ -225,17 +262,23 @@ class TestRFC2544Profile(unittest.TestCase):
"out_packets": 0}
tol_min = 0.0
tolerance = 0.0
- r_f_c2544_profile.tmp_throughput = 0
- expected = {'DropPercentage': 100.0, 'RxThroughput': 100/3.0,
- 'TxThroughput': 0.0, 'CurrentDropPercentage': 100.0,
- 'Throughput': 100/3.0,
- 'xe0': {'tx_throughput_fps': 20, 'in_packets': 1000,
- 'out_packets': 0, 'rx_throughput_mbps': 10,
- 'tx_throughput_mbps': 10, 'rx_throughput_fps': 20}}
+ r_f_c2544_profile.throughput_max = 0
+ expected = {
+ 'DropPercentage': 100.0, 'RxThroughput': 100 / 3.0,
+ 'TxThroughput': 0.0, 'CurrentDropPercentage': 100.0,
+ 'Throughput': 66.66666666666667,
+ 'xe0': {
+ 'tx_throughput_fps': 20, 'in_packets': 1000,
+ 'out_packets': 0, 'rx_throughput_mbps': 10,
+ 'tx_throughput_mbps': 10, 'rx_throughput_fps': 20
+ }
+ }
+ traffic_generator.generate_samples = mock.MagicMock(return_value=samples)
+ traffic_generator.RUN_DURATION = 30
+ traffic_generator.rfc2544_helper.tolerance_low = 0.0001
+ traffic_generator.rfc2544_helper.tolerance_high = 0.0001
self.assertDictEqual(expected,
- r_f_c2544_profile.get_drop_percentage(
- traffic_generator, samples,
- tol_min, tolerance))
+ r_f_c2544_profile.get_drop_percentage(traffic_generator))
def test_get_multiplier(self):
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
@@ -243,5 +286,56 @@ class TestRFC2544Profile(unittest.TestCase):
r_f_c2544_profile.min_rate = 100
self.assertEqual("1.0", r_f_c2544_profile.get_multiplier())
+ def test_calculate_pps(self):
+ r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.rate = 100
+ r_f_c2544_profile.pps = 100
+ samples = {'Throughput': 4549093.33}
+ self.assertEqual((2274546.67, 1.0),
+ r_f_c2544_profile.calculate_pps(samples))
+
+ def test_create_single_stream(self):
+ r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile._create_single_packet = mock.MagicMock()
+ r_f_c2544_profile.pg_id = 1
+ self.assertIsNotNone(
+ r_f_c2544_profile.create_single_stream(64, 2274546.67))
+
+ def test_create_single_stream_no_pg_id(self):
+ r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile._create_single_packet = mock.MagicMock()
+ r_f_c2544_profile.pg_id = 0
+ self.assertIsNotNone(
+ r_f_c2544_profile.create_single_stream(64, 2274546.67))
+
+ def test_execute_latency(self):
+ traffic_generator = mock.Mock(autospec=TrexProfile)
+ traffic_generator.my_ports = [0, 1]
+ traffic_generator.priv_ports = [-1]
+ traffic_generator.pub_ports = [1]
+ traffic_generator.client = \
+ mock.Mock(return_value=True)
+ r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
+ r_f_c2544_profile.params = self.PROFILE
+ r_f_c2544_profile.first_run = True
+ samples = {}
+ for ifname in range(1):
+ name = "xe{}".format(ifname)
+ samples[name] = {"rx_throughput_fps": 20,
+ "tx_throughput_fps": 20,
+ "rx_throughput_mbps": 10,
+ "tx_throughput_mbps": 10,
+ "in_packets": 1000,
+ "out_packets": 0}
+
+ samples['Throughput'] = 4549093.33
+ r_f_c2544_profile.calculate_pps = mock.Mock(return_value=[2274546.67,
+ 1.0])
+
+ self.assertEqual(None,
+ r_f_c2544_profile.execute_latency(traffic_generator,
+ samples))
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/unit/network_services/traffic_profile/test_traffic_profile.py b/tests/unit/network_services/traffic_profile/test_traffic_profile.py
index ec07e83a6..fd769e6e0 100644
--- a/tests/unit/network_services/traffic_profile/test_traffic_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_traffic_profile.py
@@ -307,15 +307,15 @@ class TestTrexProfile(unittest.TestCase):
trex_profile = \
TrexProfile(TrafficProfile)
trex_profile.params = self.PROFILE
- trex_profile.profile_data = self.PROFILE["private"]
- self.assertIsNotNone(trex_profile.get_streams())
+ profile_data = self.PROFILE["private"]
+ self.assertIsNotNone(trex_profile.get_streams(profile_data))
trex_profile.pg_id = 1
- self.assertIsNotNone(trex_profile.get_streams())
+ self.assertIsNotNone(trex_profile.get_streams(profile_data))
trex_profile.params = self.PROFILE_v6
trex_profile.profile_data = self.PROFILE_v6["private"]
- self.assertIsNotNone(trex_profile.get_streams())
+ self.assertIsNotNone(trex_profile.get_streams(profile_data))
trex_profile.pg_id = 1
- self.assertIsNotNone(trex_profile.get_streams())
+ self.assertIsNotNone(trex_profile.get_streams(profile_data))
def test_generate_packets(self):
trex_profile = \
diff --git a/tests/unit/network_services/vnf_generic/test_vnfdgen.py b/tests/unit/network_services/vnf_generic/test_vnfdgen.py
index 6d5fb0c7a..be51e4a43 100644
--- a/tests/unit/network_services/vnf_generic/test_vnfdgen.py
+++ b/tests/unit/network_services/vnf_generic/test_vnfdgen.py
@@ -185,26 +185,21 @@ class TestVnfdGen(unittest.TestCase):
generated_tp = vnfdgen.generate_vnfd(TRAFFIC_PROFILE_TPL, {"imix": {}})
self.assertDictEqual(TRAFFIC_PROFILE, generated_tp)
- def test_dict_flatten_empty_dict(self):
- self.assertEqual(vnfdgen.dict_key_flatten({}), {})
+ def test_deepgetitem(self):
+ d = {'a': 1, 'b': 2}
+ self.assertEqual(vnfdgen.deepgetitem(d, "a"), 1)
def test_dict_flatten_int(self):
d = {'a': 1, 'b': 2}
- self.assertEqual(vnfdgen.dict_key_flatten(d), d)
-
- def test_dict_flatten_str(self):
- d = {'a': "1", 'b': '2'}
- self.assertEqual(vnfdgen.dict_key_flatten(d), d)
+ self.assertEqual(vnfdgen.deepgetitem(d, "a"), 1)
def test_dict_flatten_list(self):
d = {'a': 1, 'b': list(range(2))}
- self.assertEqual(vnfdgen.dict_key_flatten(d),
- {'a': 1, 'b0': 0, 'b1': 1})
+ self.assertEqual(vnfdgen.deepgetitem(d, "b.0"), 0)
def test_dict_flatten_dict(self):
d = {'a': 1, 'b': {x: x for x in list(range(2))}}
- self.assertEqual(vnfdgen.dict_key_flatten(d),
- {'a': 1, 'b.0': 0, 'b.1': 1})
+ self.assertEqual(vnfdgen.deepgetitem(d, "b.0"), 0)
def test_generate_tp_single_var(self):
""" Function to verify traffic profile generation with imix """
diff --git a/tests/unit/network_services/vnf_generic/vnf/acl_1rule.yaml b/tests/unit/network_services/vnf_generic/vnf/acl_1rule.yaml
new file mode 100644
index 000000000..b184a29e2
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/acl_1rule.yaml
@@ -0,0 +1,47 @@
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+
+access-list1:
+ acl:
+ access-list-entries:
+ - ace:
+ ace-oper-data:
+ match-counter: 0
+ actions: drop,count
+ matches:
+ destination-ipv4-network: 152.16.40.20/24
+ destination-port-range:
+ lower-port: 0
+ upper-port: 65535
+ source-ipv4-network: 0.0.0.0/0
+ source-port-range:
+ lower-port: 0
+ upper-port: 65535
+ rule-name: rule1588
+ - ace:
+ ace-oper-data:
+ match-counter: 0
+ actions: drop,count
+ matches:
+ destination-ipv4-network: 0.0.0.0/0
+ destination-port-range:
+ lower-port: 0
+ upper-port: 65535
+ source-ipv4-network: 152.16.100.20/24
+ source-port-range:
+ lower-port: 0
+ upper-port: 65535
+ rule-name: rule1589
+ acl-name: sample-ipv4-acl
+ acl-type: ipv4-acl
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
new file mode 100644
index 000000000..c079a2ad0
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
@@ -0,0 +1,456 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+import unittest
+import mock
+import os
+
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.acl_vnf import AclApproxVnf
+ from yardstick.network_services.vnf_generic.vnf import acl_vnf
+ from yardstick.network_services.nfvi.resource import ResourceProfile
+
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+
+name = 'vnf__1'
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Process")
+class TestAclApproxVnf(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'AclApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ scenario_cfg = {'options': {'packetsize': 64, 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ },
+ 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
+ 'task_path': '/tmp',
+ 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
+ 'runner': {'object': 'NetworkServiceTestCase',
+ 'interval': 35,
+ 'output_filename': '/tmp/yardstick.out',
+ 'runner_id': 74476, 'duration': 400,
+ 'type': 'Duration'},
+ 'traffic_profile': 'ipv4_throughput_acl.yaml',
+ 'traffic_options': {'flow': 'ipv4_Packets_acl.yaml',
+ 'imix': 'imix_voice.yaml'},
+ 'type': 'ISB',
+ 'nodes': {'tg__2': 'trafficgen_2.yardstick',
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick'},
+ 'topology': 'vpe-tg-topology-baremetal.yaml'}
+
+ context_cfg = {'nodes': {'tg__2':
+ {'member-vnf-index': '3',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_2.yardstick',
+ 'vnfd-id-ref': 'tg__2',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens513f0',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.20',
+ 'dst_mac': '00:00:00:00:00:01',
+ 'local_mac': '00:00:00:00:00:03',
+ 'dst_ip': '152.16.40.19',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens513f1',
+ 'netmask': '255.255.255.0',
+ 'network': '202.16.100.0',
+ 'local_ip': '202.16.100.20',
+ 'local_mac': '00:1e:67:d0:60:5d',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'l3fwd_vnf.yaml',
+ 'user': 'root'},
+ 'tg__1':
+ {'member-vnf-index': '1',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_1.yardstick',
+ 'vnfd-id-ref': 'tg__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens785f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.20',
+ 'dst_mac': '00:00:00:00:00:02',
+ 'local_mac': '00:00:00:00:00:04',
+ 'dst_ip': '152.16.100.19',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens785f1',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.21',
+ 'local_mac': '00:00:00:00:00:01',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'tg_rfc2544_tpl.yaml',
+ 'user': 'root'},
+ 'vnf__1':
+ {'name': 'vnf.yardstick',
+ 'vnfd-id-ref': 'vnf__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens786f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.19',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'local_mac': '00:00:00:00:00:02',
+ 'dst_ip': '152.16.100.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens786f1',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.19',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'local_mac': '00:00:00:00:00:01',
+ 'dst_ip': '152.16.40.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'routing_table':
+ [{'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'network': '152.16.100.20',
+ 'if': 'xe0'},
+ {'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'network': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'member-vnf-index': '2',
+ 'host': '1.2.1.1',
+ 'role': 'vnf',
+ 'user': 'root',
+ 'nd_route_tbl':
+ [{'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'password': 'r00t',
+ 'VNF model': 'acl_vnf.yaml'}}}
+
+ def test___init__(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ self.assertIsNone(acl_approx_vnf._vnf_process)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_collect_kpi(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf.q_in = mock.MagicMock()
+ acl_approx_vnf.q_out = mock.MagicMock()
+ acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ acl_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
+ acl_approx_vnf.vnf_execute = mock.Mock(return_value="")
+ result = {'packets_dropped': 0, 'packets_fwd': 0,
+ 'packets_in': 0}
+ self.assertEqual(result, acl_approx_vnf.collect_kpi())
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_vnf_execute_command(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf.q_in = mock.MagicMock()
+ acl_approx_vnf.q_out = mock.MagicMock()
+ acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ cmd = "quit"
+ self.assertEqual("", acl_approx_vnf.vnf_execute(cmd))
+
+ def test_get_stats(self, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf.q_in = mock.MagicMock()
+ acl_approx_vnf.q_out = mock.MagicMock()
+ acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ mock_result = \
+ "ACL TOTAL: pkts_processed: 100, pkts_drop: 0, spkts_received: 100"
+ acl_approx_vnf.vnf_execute = mock.Mock(return_value=mock_result)
+ self.assertEqual(mock_result, acl_approx_vnf.get_stats())
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.acl_vnf.hex")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.acl_vnf.eval")
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.acl_vnf.open')
+ def test_run_acl(self, mock_open, eval, hex, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf._build_config = mock.MagicMock()
+ acl_approx_vnf.queue_wrapper = mock.MagicMock()
+ acl_approx_vnf.ssh_helper = mock.MagicMock()
+ acl_approx_vnf.ssh_helper.run = mock.MagicMock()
+ acl_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
+ acl_approx_vnf.vnf_cfg = {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1}
+ acl_approx_vnf.all_options = {'traffic_type': '4',
+ 'topology': 'nsb_test_case.yaml'}
+ acl_approx_vnf._run()
+ acl_approx_vnf.ssh_helper.run.assert_called_once()
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.acl_vnf.YangModel")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.acl_vnf.find_relative_file")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
+ def test_instantiate(self, mock_context, mock_yang, mock_find, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf.ssh_helper = ssh
+ acl_approx_vnf.deploy_helper = mock.MagicMock()
+ acl_approx_vnf.resource_helper = mock.MagicMock()
+ acl_approx_vnf._build_config = mock.MagicMock()
+ self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
+ 'rules': ""}}
+ acl_approx_vnf.q_out.put("pipeline>")
+ acl_approx_vnf.WAIT_TIME = 0
+ self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
+ self.assertIsNone(acl_approx_vnf.instantiate(self.scenario_cfg,
+ self.context_cfg))
+
+ def test_instantiate_panic(self, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = mock.Mock(return_value=(1, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
+ 'rules': ""}}
+ acl_approx_vnf._run_acl = mock.Mock(return_value=0)
+ acl_approx_vnf.WAIT_TIME = 0
+ acl_approx_vnf.resource_helper = mock.MagicMock()
+ acl_approx_vnf._build_config = mock.MagicMock()
+ acl_approx_vnf._vnf_process = mock.MagicMock()
+ acl_approx_vnf._vnf_process.start = mock.Mock()
+ acl_approx_vnf._vnf_process.is_alive = mock.Mock(return_value=True)
+ self.assertRaises(ValueError, acl_approx_vnf.instantiate,
+ self.scenario_cfg, self.context_cfg)
+ acl_approx_vnf.q_out.put("PANIC")
+ acl_approx_vnf.WAIT_TIME = 0
+ self.assertRaises(ValueError, acl_approx_vnf.instantiate,
+ self.scenario_cfg, self.context_cfg)
+
+ def test_scale(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ flavor = ""
+ self.assertRaises(NotImplementedError, acl_approx_vnf.scale, flavor)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_terminate(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ acl_approx_vnf = AclApproxVnf(name, vnfd)
+ acl_approx_vnf._vnf_process = mock.MagicMock()
+ acl_approx_vnf._vnf_process.terminate = mock.Mock()
+ acl_approx_vnf.used_drivers = {"01:01.0": "i40e",
+ "01:01.1": "i40e"}
+ acl_approx_vnf.vnf_execute = mock.MagicMock()
+ acl_approx_vnf.ssh_helper = ssh_mock
+ acl_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py"
+ acl_approx_vnf._resource_collect_stop = mock.Mock()
+ self.assertEqual(None, acl_approx_vnf.terminate())
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_base.py b/tests/unit/network_services/vnf_generic/vnf/test_base.py
index 9f2912d1b..e4f4450ce 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_base.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_base.py
@@ -19,6 +19,7 @@
from __future__ import absolute_import
import unittest
+import os
import mock
from multiprocessing import Queue
@@ -34,6 +35,34 @@ IP_PIPELINE_ND_CFG_FILE_TPL = """
nd_route_tbl = ({port1_dst_ip_hex6},"""
"""{port1_dst_netmask_hex6},1,{port1_dst_ip_hex6})"""
+_LOCAL_OBJECT = object()
+
+
+class FileAbsPath(object):
+ def __init__(self, module_file):
+ super(FileAbsPath, self).__init__()
+ self.module_path = os.path.dirname(os.path.abspath(module_file))
+
+ def get_path(self, filename):
+ file_path = os.path.join(self.module_path, filename)
+ return file_path
+
+
+def mock_ssh(ssh, spec=None, exec_result=_LOCAL_OBJECT, run_result=_LOCAL_OBJECT):
+ if spec is None:
+ spec = ssh.SSH
+
+ if exec_result is _LOCAL_OBJECT:
+ exec_result = 0, "", ""
+
+ if run_result is _LOCAL_OBJECT:
+ run_result = 0, "", ""
+
+ ssh_mock = mock.Mock(autospec=spec)
+ ssh_mock.execute = mock.Mock(return_value=exec_result)
+ ssh_mock.run = mock.Mock(return_value=run_result)
+ ssh.from_node.return_value = ssh_mock
+
class TestQueueFileWrapper(unittest.TestCase):
def setUp(self):
@@ -52,6 +81,7 @@ class TestQueueFileWrapper(unittest.TestCase):
queue_file_wrapper.bufsize = 5
queue_file_wrapper.write("pipeline>")
queue_file_wrapper.close()
+ self.assertIsNone(queue_file_wrapper.clear())
self.assertIsNotNone(queue_file_wrapper.q_out.empty())
def test_close(self):
@@ -73,198 +103,168 @@ class TestQueueFileWrapper(unittest.TestCase):
class TestGenericVNF(unittest.TestCase):
- VNFD = {'vnfd:vnfd-catalog':
- {'vnfd':
- [{'short-name': 'VpeVnf',
- 'vdu':
- [{'routing_table':
- [{'network': '152.16.100.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.100.20',
- 'if': 'xe0'},
- {'network': '152.16.40.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.40.20',
- 'if': 'xe1'}],
- 'description': 'VPE approximation using DPDK',
- 'name': 'vpevnf-baremetal',
- 'nd_route_tbl':
- [{'network': '0064:ff9b:0:0:0:0:9810:6414',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
- 'if': 'xe0'},
- {'network': '0064:ff9b:0:0:0:0:9810:2814',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
- 'if': 'xe1'}],
- 'id': 'vpevnf-baremetal',
- 'external-interface':
- [{'virtual-interface':
- {'dst_mac': '00:00:00:00:00:03',
- 'vpci': '0000:05:00.0',
- 'local_ip': '152.16.100.19',
- 'type': 'PCI-PASSTHROUGH',
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '0',
- 'bandwidth': '10 Gbps',
- 'dst_ip': '152.16.100.20',
- 'local_mac': '00:00:00:00:00:01'},
- 'vnfd-connection-point-ref': 'xe0',
- 'name': 'xe0'},
- {'virtual-interface':
- {'dst_mac': '00:00:00:00:00:04',
- 'vpci': '0000:05:00.1',
- 'local_ip': '152.16.40.19',
- 'type': 'PCI-PASSTHROUGH',
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '1',
- 'bandwidth': '10 Gbps',
- 'dst_ip': '152.16.40.20',
- 'local_mac': '00:00:00:00:00:02'},
- 'vnfd-connection-point-ref': 'xe1',
- 'name': 'xe1'}]}],
- 'description': 'Vpe approximation using DPDK',
- 'mgmt-interface':
- {'vdu-id': 'vpevnf-baremetal',
- 'host': '1.1.1.1',
- 'password': 'r00t',
- 'user': 'root',
- 'ip': '1.1.1.1'},
- 'benchmark':
- {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
- 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
- {'type': 'VPORT', 'name': 'xe1'}],
- 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ]
+ }
+ }
def test___init__(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- assert generic_vn_f.kpi
+ generic_vnf = GenericVNF('vnf1', self.VNFD_0)
+ assert generic_vnf.kpi
def test_collect_kpi(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertRaises(NotImplementedError, generic_vn_f.collect_kpi)
-
- def test_get_ip_version(self):
- ip_addr = "152.16.1.1"
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertEqual(4, generic_vn_f.get_ip_version(ip_addr))
-
- @mock.patch('yardstick.network_services.vnf_generic.vnf.base.LOG')
- def test_get_ip_version_error(self, mock_LOG):
- ip_addr = "152.16.1.1.1"
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertRaises(ValueError, generic_vn_f.get_ip_version(ip_addr))
-
- def test_ip_to_hex(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- hex_ip = generic_vn_f._ip_to_hex("192.168.10.1")
- self.assertEqual("C0A80A01", hex_ip)
-
- def test_append_routes(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- arp_route = generic_vn_f._append_routes(IP_PIPELINE_CFG_FILE_TPL)
- expected = '\narp_route_tbl = (98106414,FFFFFF00,0,98106414)' \
- ' (98102814,FFFFFF00,1,98102814)\n,'
- self.assertEqual(expected, arp_route)
-
- def test_append_nd_routes(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- nd_route = generic_vn_f._append_nd_routes(IP_PIPELINE_ND_CFG_FILE_TPL)
- expected = '\nnd_route_tbl = (0064:ff9b:0:0:0:0:9810:6414,112,0,' \
- '0064:ff9b:0:0:0:0:9810:6414) '\
- '(0064:ff9b:0:0:0:0:9810:2814,112,'\
- '1,0064:ff9b:0:0:0:0:9810:2814)\n,'
- self.assertEqual(expected, nd_route)
-
- def test_get_port0localip6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port0_v6 = generic_vn_f._get_port0localip6()
- expected = '0064:ff9b:0:0:0:0:9810:6414'
- self.assertEqual(expected, port0_v6)
-
- def test_get_port1localip6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port1_v6 = generic_vn_f._get_port1localip6()
- expected = '0064:ff9b:0:0:0:0:9810:2814'
- self.assertEqual(expected, port1_v6)
-
- def test_get_port0prefixip6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port0_v6 = generic_vn_f._get_port0prefixlen6()
- self.assertEqual('112', port0_v6)
-
- def test_get_port1prefixip6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port1_v6 = generic_vn_f._get_port1prefixlen6()
- self.assertEqual('112', port1_v6)
-
- def test_get_port0gateway6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port0_v6 = generic_vn_f._get_port0gateway6()
- self.assertEqual('0064:ff9b:0:0:0:0:9810:6414', port0_v6)
-
- def test_get_port1gateway6(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port1_v6 = generic_vn_f._get_port1gateway6()
- self.assertEqual('0064:ff9b:0:0:0:0:9810:2814', port1_v6)
-
- def test_get_dpdk_port_num(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- port_num = generic_vn_f._get_dpdk_port_num('xe0')
- self.assertEqual('0', port_num)
+ generic_vnf = GenericVNF('vnf1', self.VNFD_0)
+ self.assertRaises(NotImplementedError, generic_vnf.collect_kpi)
def test__get_kpi_definition(self):
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_vn_f = GenericVNF(vnfd)
- kpi = \
- generic_vn_f._get_kpi_definition(vnfd)
+ generic_vnf = GenericVNF('vnf1', vnfd)
+ kpi = generic_vnf._get_kpi_definition()
self.assertEqual(kpi, ['packets_in', 'packets_fwd', 'packets_dropped'])
def test_instantiate(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertRaises(NotImplementedError,
- generic_vn_f.instantiate, {}, {})
+ generic_vnf = GenericVNF('vnf1', self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
+ with self.assertRaises(NotImplementedError):
+ generic_vnf.instantiate({}, {})
def test_scale(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertRaises(NotImplementedError, generic_vn_f.scale)
+ generic_vnf = GenericVNF('vnf1', self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
+ with self.assertRaises(NotImplementedError):
+ generic_vnf.scale()
def test_terminate(self):
- generic_vn_f = GenericVNF(self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
- self.assertRaises(NotImplementedError, generic_vn_f.terminate)
+ generic_vnf = GenericVNF('vnf1', self.VNFD['vnfd:vnfd-catalog']['vnfd'][0])
+ with self.assertRaises(NotImplementedError):
+ generic_vnf.terminate()
class TestGenericTrafficGen(unittest.TestCase):
def test___init__(self):
vnfd = TestGenericVNF.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_traffic_gen = \
- GenericTrafficGen(vnfd)
- assert generic_traffic_gen.name == "tgen__1"
+ generic_traffic_gen = GenericTrafficGen('vnf1', vnfd)
+ assert generic_traffic_gen.name == "vnf1"
def test_listen_traffic(self):
vnfd = TestGenericVNF.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_traffic_gen = \
- GenericTrafficGen(vnfd)
+ generic_traffic_gen = GenericTrafficGen('vnf1', vnfd)
traffic_profile = {}
self.assertIsNone(generic_traffic_gen.listen_traffic(traffic_profile))
def test_run_traffic(self):
vnfd = TestGenericVNF.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_traffic_gen = \
- GenericTrafficGen(vnfd)
+ generic_traffic_gen = GenericTrafficGen('vnf1', vnfd)
traffic_profile = {}
self.assertRaises(NotImplementedError,
generic_traffic_gen.run_traffic, traffic_profile)
def test_terminate(self):
vnfd = TestGenericVNF.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_traffic_gen = \
- GenericTrafficGen(vnfd)
+ generic_traffic_gen = GenericTrafficGen('vnf1', vnfd)
self.assertRaises(NotImplementedError, generic_traffic_gen.terminate)
def test_verify_traffic(self):
vnfd = TestGenericVNF.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- generic_traffic_gen = \
- GenericTrafficGen(vnfd)
+ generic_traffic_gen = GenericTrafficGen('vnf1', vnfd)
traffic_profile = {}
self.assertIsNone(generic_traffic_gen.verify_traffic(traffic_profile))
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
new file mode 100644
index 000000000..bf226d2c8
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
@@ -0,0 +1,481 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+
+import os
+import unittest
+
+import mock
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.cgnapt_vnf import CgnaptApproxVnf, \
+ CgnaptApproxSetupEnvHelper
+ from yardstick.network_services.vnf_generic.vnf import cgnapt_vnf
+ from yardstick.network_services.nfvi.resource import ResourceProfile
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+
+name = 'vnf__1'
+
+
+class TestCgnaptApproxSetupEnvHelper(unittest.TestCase):
+
+ def test__generate_ip_from_pool(self):
+
+ ip = CgnaptApproxSetupEnvHelper._generate_ip_from_pool("1.2.3.4")
+ self.assertEqual(next(ip), '1.2.3.4')
+ self.assertEqual(next(ip), '1.2.4.4')
+ self.assertEqual(next(ip), '1.2.5.4')
+
+ def test__update_cgnat_script_file(self):
+
+ sample = """\
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+link 0 down
+link 0 config {port0_local_ip} {port0_prefixlen}
+link 0 up
+link 1 down
+link 1 config {port1_local_ip} {port1_prefixlen}
+link 1 up
+"""
+ header = "This is a header"
+
+ out = CgnaptApproxSetupEnvHelper._update_cgnat_script_file(header, sample.splitlines(), "")
+ self.assertNotIn("This is a header", out)
+
+ def test__get_cgnapt_confgi(self):
+
+ c = CgnaptApproxSetupEnvHelper(mock.MagicMock(), mock.MagicMock(), mock.MagicMock())
+ c._get_ports_gateway = mock.Mock(return_value=3)
+ ret = c._get_cgnapt_config([{"name": 'a'}, {}, {"name": "b"}, {}, {"name": "c"}])
+ self.assertEqual(ret, [3, 3, 3])
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Process")
+class TestCgnaptApproxVnf(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'CgnaptApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ scenario_cfg = {'options': {'packetsize': 64, 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ },
+ 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
+ 'task_path': '/tmp',
+ 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
+ 'runner': {'object': 'NetworkServiceTestCase',
+ 'interval': 35,
+ 'output_filename': '/tmp/yardstick.out',
+ 'runner_id': 74476, 'duration': 400,
+ 'type': 'Duration'},
+ 'traffic_profile': 'ipv4_throughput_acl.yaml',
+ 'traffic_options': {'flow': 'ipv4_Packets_acl.yaml',
+ 'imix': 'imix_voice.yaml'},
+ 'type': 'ISB',
+ 'nodes': {'tg__2': 'trafficgen_2.yardstick',
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick'},
+ 'topology': 'vpe-tg-topology-baremetal.yaml'}
+
+ context_cfg = {'nodes': {'tg__2':
+ {'member-vnf-index': '3',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_2.yardstick',
+ 'vnfd-id-ref': 'tg__2',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens513f0',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.20',
+ 'dst_mac': '00:00:00:00:00:01',
+ 'local_mac': '00:00:00:00:00:03',
+ 'dst_ip': '152.16.40.19',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens513f1',
+ 'netmask': '255.255.255.0',
+ 'network': '202.16.100.0',
+ 'local_ip': '202.16.100.20',
+ 'local_mac': '00:1e:67:d0:60:5d',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'l3fwd_vnf.yaml',
+ 'user': 'root'},
+ 'tg__1':
+ {'member-vnf-index': '1',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_1.yardstick',
+ 'vnfd-id-ref': 'tg__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens785f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.20',
+ 'dst_mac': '00:00:00:00:00:02',
+ 'local_mac': '00:00:00:00:00:04',
+ 'dst_ip': '152.16.100.19',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens785f1',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.21',
+ 'local_mac': '00:00:00:00:00:01',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'tg_rfc2544_tpl.yaml',
+ 'user': 'root'},
+ 'vnf__1':
+ {'name': 'vnf.yardstick',
+ 'vnfd-id-ref': 'vnf__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens786f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.19',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'local_mac': '00:00:00:00:00:02',
+ 'dst_ip': '152.16.100.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens786f1',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.19',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'local_mac': '00:00:00:00:00:01',
+ 'dst_ip': '152.16.40.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'routing_table':
+ [{'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'network': '152.16.100.20',
+ 'if': 'xe0'},
+ {'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'network': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'member-vnf-index': '2',
+ 'host': '1.2.1.1',
+ 'role': 'vnf',
+ 'user': 'root',
+ 'nd_route_tbl':
+ [{'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'password': 'r00t',
+ 'VNF model': 'cgnapt_vnf.yaml'}}}
+
+ def test___init__(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ self.assertIsNone(cgnapt_approx_vnf._vnf_process)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_collect_kpi(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf.q_in = mock.MagicMock()
+ cgnapt_approx_vnf.q_out = mock.MagicMock()
+ cgnapt_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ cgnapt_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
+ result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0}
+ self.assertEqual(result, cgnapt_approx_vnf.collect_kpi())
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_vnf_execute_command(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf.q_in = mock.MagicMock()
+ cgnapt_approx_vnf.q_out = mock.MagicMock()
+ cgnapt_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ cmd = "quit"
+ self.assertEqual("", cgnapt_approx_vnf.vnf_execute(cmd))
+
+ def test_get_stats(self, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf.q_in = mock.MagicMock()
+ cgnapt_approx_vnf.q_out = mock.MagicMock()
+ cgnapt_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ mock_result = \
+ "CG-NAPT(.*\n)*Received 100, Missed 0, Dropped 0,Translated 100,ingress"
+ cgnapt_approx_vnf.vnf_execute = mock.Mock(return_value=mock_result)
+ self.assertListEqual(list(mock_result), list(cgnapt_approx_vnf.get_stats()))
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.hex")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.eval")
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.open')
+ def test_run_vcgnapt(self, hex, eval, mock_open, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf._build_config = mock.MagicMock()
+ cgnapt_approx_vnf.queue_wrapper = mock.MagicMock()
+ cgnapt_approx_vnf.ssh_helper = mock.MagicMock()
+ cgnapt_approx_vnf.ssh_helper.run = mock.MagicMock()
+ cgnapt_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
+ cgnapt_approx_vnf._run()
+ cgnapt_approx_vnf.ssh_helper.run.assert_called_once()
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
+ def test_instantiate(self, mock_context, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf.ssh_helper = ssh
+ cgnapt_approx_vnf.deploy_helper = mock.MagicMock()
+ cgnapt_approx_vnf.resource_helper = mock.MagicMock()
+ cgnapt_approx_vnf._build_config = mock.MagicMock()
+ self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
+ 'rules': ""}}
+ cgnapt_approx_vnf.q_out.put("pipeline>")
+ cgnapt_vnf.WAIT_TIME = 3
+ self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
+ self.assertIsNone(cgnapt_approx_vnf.instantiate(self.scenario_cfg,
+ self.context_cfg))
+
+ def test_scale(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ flavor = ""
+ self.assertRaises(NotImplementedError, cgnapt_approx_vnf.scale, flavor)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_terminate(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf._vnf_process = mock.MagicMock()
+ cgnapt_approx_vnf._vnf_process.terminate = mock.Mock()
+ cgnapt_approx_vnf.used_drivers = {"01:01.0": "i40e",
+ "01:01.1": "i40e"}
+ cgnapt_approx_vnf.vnf_execute = mock.MagicMock()
+ cgnapt_approx_vnf.ssh_helper = ssh_mock
+ cgnapt_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py"
+ cgnapt_approx_vnf._resource_collect_stop = mock.Mock()
+ self.assertEqual(None, cgnapt_approx_vnf.terminate())
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.cgnapt_vnf.time")
+ def test__vnf_up_post(self, mock_time, mock_cgnapt_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
+ cgnapt_approx_vnf._vnf_process = mock.MagicMock()
+ cgnapt_approx_vnf._vnf_process.terminate = mock.Mock()
+ cgnapt_approx_vnf.vnf_execute = mock.MagicMock()
+ cgnapt_approx_vnf.ssh_helper = ssh_mock
+ cgnapt_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
+ cgnapt_approx_vnf._resource_collect_stop = mock.Mock()
+ cgnapt_approx_vnf._vnf_up_post()
+ cgnapt_approx_vnf.vnf_execute.assert_called_once()
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
new file mode 100644
index 000000000..af0d2ddde
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -0,0 +1,2239 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Intel Corporation
+#
+# 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.
+#
+
+# Unittest for yardstick.network_services.vnf_generic.vnf.sample_vnf
+
+from __future__ import absolute_import
+import unittest
+import mock
+from copy import deepcopy
+
+from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+from yardstick.benchmark.contexts.base import Context
+from yardstick.network_services.nfvi.resource import ResourceProfile
+from yardstick.network_services.traffic_profile.base import TrafficProfile
+from yardstick.network_services.vnf_generic.vnf.base import VnfdHelper
+from yardstick.ssh import SSHError
+
+
+class MockError(BaseException):
+ pass
+
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import VnfSshHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFDeployHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import ScenarioHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import ResourceHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import Rfc2544ResourceHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import SetupEnvHelper
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNF
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import DpdkVnfSetupEnvHelper
+
+
+class TestVnfSshHelper(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ]
+ }
+ }
+
+ def assertAll(self, iterable, message=None):
+ self.assertTrue(all(iterable), message)
+
+ def test_get_class(self):
+ self.assertIs(VnfSshHelper.get_class(), VnfSshHelper)
+
+ @mock.patch('yardstick.ssh.paramiko')
+ def test_copy(self, _):
+ ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+ ssh_helper._run = mock.Mock()
+
+ ssh_helper.execute('ls')
+ self.assertTrue(ssh_helper.is_connected)
+ result = ssh_helper.copy()
+ self.assertIsInstance(result, VnfSshHelper)
+ self.assertFalse(result.is_connected)
+ self.assertEqual(result.bin_path, ssh_helper.bin_path)
+ self.assertEqual(result.host, ssh_helper.host)
+ self.assertEqual(result.port, ssh_helper.port)
+ self.assertEqual(result.user, ssh_helper.user)
+ self.assertEqual(result.password, ssh_helper.password)
+ self.assertEqual(result.key_filename, ssh_helper.key_filename)
+
+ @mock.patch('yardstick.ssh.paramiko')
+ def test_upload_config_file(self, mock_paramiko):
+ ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+
+ self.assertFalse(ssh_helper.is_connected)
+ cfg_file = ssh_helper.upload_config_file('my/prefix', 'my content')
+ self.assertTrue(ssh_helper.is_connected)
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertTrue(cfg_file.startswith('/tmp'))
+
+ cfg_file = ssh_helper.upload_config_file('/my/prefix', 'my content')
+ self.assertTrue(ssh_helper.is_connected)
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertEqual(cfg_file, '/my/prefix')
+
+ def test_join_bin_path(self):
+ ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+
+ expected_start = 'my'
+ expected_middle_list = ['bin']
+ expected_end = 'path'
+ result = ssh_helper.join_bin_path()
+ self.assertTrue(result.startswith(expected_start))
+ self.assertAll(middle in result for middle in expected_middle_list)
+ self.assertTrue(result.endswith(expected_end))
+
+ expected_middle_list.append(expected_end)
+ expected_end = 'some_file.sh'
+ result = ssh_helper.join_bin_path('some_file.sh')
+ self.assertTrue(result.startswith(expected_start))
+ self.assertAll(middle in result for middle in expected_middle_list)
+ self.assertTrue(result.endswith(expected_end))
+
+ expected_middle_list.append('some_dir')
+ expected_end = 'some_file.sh'
+ result = ssh_helper.join_bin_path('some_dir', 'some_file.sh')
+ self.assertTrue(result.startswith(expected_start))
+ self.assertAll(middle in result for middle in expected_middle_list)
+ self.assertTrue(result.endswith(expected_end))
+
+ @mock.patch('yardstick.ssh.paramiko')
+ @mock.patch('yardstick.ssh.provision_tool')
+ def test_provision_tool(self, mock_provision_tool, mock_paramiko):
+ ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+
+ self.assertFalse(ssh_helper.is_connected)
+ ssh_helper.provision_tool()
+ self.assertTrue(ssh_helper.is_connected)
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertEqual(mock_provision_tool.call_count, 1)
+
+ ssh_helper.provision_tool(tool_file='my_tool.sh')
+ self.assertTrue(ssh_helper.is_connected)
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertEqual(mock_provision_tool.call_count, 2)
+
+ ssh_helper.provision_tool('tool_path', 'my_tool.sh')
+ self.assertTrue(ssh_helper.is_connected)
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertEqual(mock_provision_tool.call_count, 3)
+
+
+class TestSetupEnvHelper(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ def test_build_config(self):
+ setup_env_helper = SetupEnvHelper(mock.Mock(), mock.Mock(), mock.Mock())
+
+ with self.assertRaises(NotImplementedError):
+ setup_env_helper.build_config()
+
+ def test__get_ports_gateway(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ setup_env_helper = SetupEnvHelper(vnfd_helper, mock.Mock(), mock.Mock())
+ result = setup_env_helper._get_ports_gateway("xe0")
+ self.assertEqual(result, "152.16.100.20")
+
+ result = setup_env_helper._get_ports_gateway("xe123")
+ self.assertIsNone(result)
+
+ def test_setup_vnf_environment(self):
+ setup_env_helper = SetupEnvHelper(mock.Mock(), mock.Mock(), mock.Mock())
+ self.assertIsNone(setup_env_helper.setup_vnf_environment())
+
+ def test_tear_down(self):
+ setup_env_helper = SetupEnvHelper(mock.Mock(), mock.Mock(), mock.Mock())
+
+ with self.assertRaises(NotImplementedError):
+ setup_env_helper.tear_down()
+
+
+class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'driver': 'i40e',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'driver': 'ixgbe',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ]
+ }
+ }
+
+ def test__update_packet_type(self):
+ ip_pipeline_cfg = 'pkt_type = ipv4'
+ pkt_type = {'pkt_type': '1'}
+
+ expected = "pkt_type = 1"
+ result = DpdkVnfSetupEnvHelper._update_packet_type(ip_pipeline_cfg, pkt_type)
+ self.assertEqual(result, expected)
+
+ def test__update_packet_type_no_op(self):
+ ip_pipeline_cfg = 'pkt_type = ipv6'
+ pkt_type = {'pkt_type': '1'}
+
+ expected = "pkt_type = ipv6"
+ result = DpdkVnfSetupEnvHelper._update_packet_type(ip_pipeline_cfg, pkt_type)
+ self.assertEqual(result, expected)
+
+ def test__update_packet_type_multi_op(self):
+ ip_pipeline_cfg = 'pkt_type = ipv4\npkt_type = 1\npkt_type = ipv4'
+ pkt_type = {'pkt_type': '1'}
+
+ expected = 'pkt_type = 1\npkt_type = 1\npkt_type = 1'
+ result = DpdkVnfSetupEnvHelper._update_packet_type(ip_pipeline_cfg, pkt_type)
+ self.assertEqual(result, expected)
+
+ def test__update_traffic_type(self):
+ ip_pipeline_cfg = 'pkt_type = ipv4'
+
+ traffic_options = {"vnf_type": DpdkVnfSetupEnvHelper.APP_NAME, 'traffic_type': 4}
+ expected = "pkt_type = ipv4"
+ result = DpdkVnfSetupEnvHelper._update_traffic_type(ip_pipeline_cfg, traffic_options)
+ self.assertEqual(result, expected)
+
+ def test__update_traffic_type_ipv6(self):
+ ip_pipeline_cfg = 'pkt_type = ipv4'
+
+ traffic_options = {"vnf_type": DpdkVnfSetupEnvHelper.APP_NAME, 'traffic_type': 6}
+ expected = "pkt_type = ipv6"
+ result = DpdkVnfSetupEnvHelper._update_traffic_type(ip_pipeline_cfg, traffic_options)
+ self.assertEqual(result, expected)
+
+ def test__update_traffic_type_not_app_name(self):
+ ip_pipeline_cfg = 'traffic_type = 4'
+
+ vnf_type = ''.join(["Not", DpdkVnfSetupEnvHelper.APP_NAME])
+ traffic_options = {"vnf_type": vnf_type, 'traffic_type': 8}
+ expected = "traffic_type = 8"
+ result = DpdkVnfSetupEnvHelper._update_traffic_type(ip_pipeline_cfg, traffic_options)
+ self.assertEqual(result, expected)
+
+ def test__setup_hugepages(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 0, '', ''
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ result = dpdk_setup_helper._setup_hugepages()
+ expect_start_list = ['awk', 'awk', 'echo']
+ expect_in_list = ['meminfo', 'nr_hugepages', '16']
+ call_args_iter = (args[0][0] for args in ssh_helper.execute.call_args_list)
+ self.assertIsNone(result)
+ self.assertEqual(ssh_helper.execute.call_count, 3)
+ for expect_start, expect_in, arg0 in zip(expect_start_list, expect_in_list, call_args_iter):
+ self.assertTrue(arg0.startswith(expect_start))
+ self.assertIn(expect_in, arg0)
+
+ def test__setup_hugepages_2_mb(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 0, '2048kB ', ''
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ result = dpdk_setup_helper._setup_hugepages()
+ expect_start_list = ['awk', 'awk', 'echo']
+ expect_in_list = ['meminfo', 'nr_hugepages', '16384']
+ call_args_iter = (args[0][0] for args in ssh_helper.execute.call_args_list)
+ self.assertIsNone(result)
+ self.assertEqual(ssh_helper.execute.call_count, 3)
+ for expect_start, expect_in, arg0 in zip(expect_start_list, expect_in_list, call_args_iter):
+ self.assertTrue(arg0.startswith(expect_start))
+ self.assertIn(expect_in, arg0)
+
+ def test__get_dpdk_port_num(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ expected = '0'
+ result = dpdk_setup_helper._get_dpdk_port_num('xe0')
+ self.assertEqual(result, expected)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.open')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.find_relative_file')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig')
+ def test_build_config(self, mock_multi_port_config_class, mock_find, _):
+ mock_multi_port_config = mock_multi_port_config_class()
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ scenario_helper.vnf_cfg = {}
+ scenario_helper.all_options = {}
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.all_ports = []
+
+ dpdk_setup_helper.PIPELINE_COMMAND = expected = 'pipeline command'
+ result = dpdk_setup_helper.build_config()
+ self.assertEqual(result, expected)
+ self.assertGreaterEqual(ssh_helper.upload_config_file.call_count, 2)
+ self.assertGreaterEqual(mock_find.call_count, 1)
+ self.assertGreaterEqual(mock_multi_port_config.generate_config.call_count, 1)
+ self.assertGreaterEqual(mock_multi_port_config.generate_script.call_count, 1)
+
+ def test__build_pipeline_kwargs(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.provision_tool.return_value = 'tool_path'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.CFG_CONFIG = 'config'
+ dpdk_setup_helper.CFG_SCRIPT = 'script'
+ dpdk_setup_helper.all_ports = [3, 4, 5]
+ dpdk_setup_helper.pipeline_kwargs = {}
+
+ expected = {
+ 'cfg_file': 'config',
+ 'script': 'script',
+ 'ports_len_hex': '0xf',
+ 'tool_path': 'tool_path',
+ }
+ dpdk_setup_helper._build_pipeline_kwargs()
+ self.assertDictEqual(dpdk_setup_helper.pipeline_kwargs, expected)
+
+ def test__get_app_cpu(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.provision_tool.return_value = 'tool_path'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ dpdk_setup_helper.CORES = expected = [5, 4, 3]
+ result = dpdk_setup_helper._get_app_cpu()
+ self.assertEqual(result, expected)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
+ def test__get_app_cpu_no_cores_sw(self, mock_cpu_sys_cores_class):
+ mock_cpu_sys_cores = mock_cpu_sys_cores_class()
+ mock_cpu_sys_cores.get_core_socket.return_value = {
+ 'socket': [2, 4, 8, 10, 12],
+ }
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.provision_tool.return_value = 'tool_path'
+ scenario_helper = mock.Mock()
+ scenario_helper.vnf_cfg = {
+ 'worker_threads': '2',
+ }
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.CORES = []
+ dpdk_setup_helper.SW_DEFAULT_CORE = 1
+ dpdk_setup_helper.HW_DEFAULT_CORE = 2
+ dpdk_setup_helper.socket = 'socket'
+
+ expected = [2, 4, 8]
+ result = dpdk_setup_helper._get_app_cpu()
+ self.assertEqual(result, expected)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
+ def test__get_app_cpu_no_cores_hw(self, mock_cpu_sys_cores_class):
+ mock_cpu_sys_cores = mock_cpu_sys_cores_class()
+ mock_cpu_sys_cores.get_core_socket.return_value = {
+ 'socket': [2, 4, 8, 10, 12],
+ }
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ scenario_helper.vnf_cfg = {
+ 'worker_threads': '2',
+ 'lb_config': 'HW',
+ }
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.CORES = []
+ dpdk_setup_helper.SW_DEFAULT_CORE = 1
+ dpdk_setup_helper.HW_DEFAULT_CORE = 2
+ dpdk_setup_helper.socket = 'socket'
+
+ expected = [2, 4, 8, 10]
+ result = dpdk_setup_helper._get_app_cpu()
+ self.assertEqual(result, expected)
+
+ def test__get_cpu_sibling_list(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[])
+
+ expected = ['5', '3', '4', '10']
+ result = dpdk_setup_helper._get_cpu_sibling_list([1, 3, 7])
+ self.assertEqual(result, expected)
+
+ def test__get_cpu_sibling_list_no_core_arg(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[1, 7])
+
+ expected = ['5', '3', '4']
+ result = dpdk_setup_helper._get_cpu_sibling_list()
+ self.assertEqual(result, expected)
+
+ def test__get_cpu_sibling_list_ssh_failure(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = iter([(0, '5', ''), SSHError, (0, '10', '')])
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[])
+
+ expected = []
+ result = dpdk_setup_helper._get_cpu_sibling_list([1, 3, 7])
+ self.assertEqual(result, expected)
+
+ def test__validate_cpu_cfg(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[1, 3, 7])
+
+ expected = ['5', '3', '4', '10']
+ result = dpdk_setup_helper._validate_cpu_cfg()
+ self.assertEqual(result, expected)
+
+ def test__find_used_drivers(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ stdout = '''
+00:01.2 foo drv=name1
+00:01.4 drv foo=name2
+00:02.2 drv=name3
+00:02.3 drv=name4
+'''
+ ssh_helper.execute.return_value = 0, stdout, ''
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.used_drivers = None
+ dpdk_setup_helper._dpdk_nic_bind = ''
+ dpdk_setup_helper.bound_pci = [
+ 'pci 00:01.2',
+ 'pci 00:02.3',
+ ]
+
+ expected = {
+ '00:01.2': (0, 'name1'),
+ '00:02.3': (2, 'name4'),
+ }
+ dpdk_setup_helper._find_used_drivers()
+ self.assertEqual(dpdk_setup_helper.used_drivers, expected)
+
+ def test_dpdk_nic_bind(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.provision_tool.return_value = nic_bind = object()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ self.assertIsNone(dpdk_setup_helper._dpdk_nic_bind)
+ self.assertIs(dpdk_setup_helper.dpdk_nic_bind, nic_bind)
+ self.assertIs(dpdk_setup_helper.dpdk_nic_bind, nic_bind)
+ self.assertEqual(ssh_helper.provision_tool.call_count, 1)
+
+ # ensure provision tool is not called a second time
+ self.assertIs(dpdk_setup_helper.dpdk_nic_bind, nic_bind)
+ self.assertEqual(ssh_helper.provision_tool.call_count, 1)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('yardstick.ssh.SSH')
+ def test_setup_vnf_environment(self, _, mock_time):
+ cores = ['3', '4']
+
+ vnfd_helper = VnfdHelper(deepcopy(self.VNFD_0))
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 1, 'bad output', 'error output'
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.provision_tool.return_value = 'provision string'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._setup_hugepages = mock.Mock()
+ dpdk_setup_helper._validate_cpu_cfg = mock.Mock(return_value=cores)
+ dpdk_setup_helper._find_used_drivers = mock.Mock()
+ dpdk_setup_helper.used_drivers = {
+ '0000:05:00.0': (1, ''),
+ '0000:05:01.0': (3, ''),
+ }
+
+ result = dpdk_setup_helper.setup_vnf_environment()
+ self.assertIsInstance(result, ResourceProfile)
+ self.assertEqual(result.cores, cores)
+ self.assertEqual(vnfd_helper.interfaces[0]['dpdk_port_num'], 1)
+ self.assertNotIn('dpdk_port_num', vnfd_helper.interfaces[1])
+
+ def test__setup_dpdk_early_success(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 0, 'output', ''
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.provision_tool.return_value = 'provision string'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._setup_hugepages = mock.Mock()
+
+ self.assertIsNone(dpdk_setup_helper._setup_dpdk())
+ self.assertEqual(dpdk_setup_helper.ssh_helper.execute.call_count, 2)
+
+ @mock.patch('yardstick.ssh.SSH')
+ def test__setup_dpdk_short(self, _):
+ def execute_side(cmd, *args, **kwargs):
+ if 'joined_path' in cmd:
+ return 0, 'output', ''
+ return 1, 'bad output', 'error output'
+
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = execute_side
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.provision_tool.return_value = 'provision string'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._setup_hugepages = mock.Mock()
+
+ self.assertIsNone(dpdk_setup_helper._setup_dpdk())
+ self.assertEqual(dpdk_setup_helper.ssh_helper.execute.call_count, 3)
+
+ @mock.patch('yardstick.ssh.SSH')
+ def test__setup_resources(self, _):
+ vnfd_helper = VnfdHelper(deepcopy(self.VNFD_0))
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._validate_cpu_cfg = mock.Mock()
+
+ result = dpdk_setup_helper._setup_resources()
+ self.assertIsInstance(result, ResourceProfile)
+ self.assertEqual(dpdk_setup_helper.socket, 0)
+
+ @mock.patch('yardstick.ssh.SSH')
+ def test__setup_resources_socket_1(self, _):
+ vnfd_helper = VnfdHelper(deepcopy(self.VNFD_0))
+ vnfd_helper.interfaces[0]['virtual-interface']['vpci'] = '0000:55:00.0'
+ vnfd_helper.interfaces[1]['virtual-interface']['vpci'] = '0000:35:00.0'
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._validate_cpu_cfg = mock.Mock()
+
+ result = dpdk_setup_helper._setup_resources()
+ self.assertIsInstance(result, ResourceProfile)
+ self.assertEqual(dpdk_setup_helper.socket, 1)
+
+ def test__bind_dpdk_unforced(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ dpdk_setup_helper._bind_dpdk('x', 'y', force=False)
+ self.assertNotIn('--force', ssh_helper.execute.call_args_list[0][0][0])
+
+ def test__detect_and_bind_dpdk_short(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 0, 'output', ''
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+
+ self.assertIsNone(dpdk_setup_helper._detect_and_bind_dpdk('a', 'b'))
+ self.assertEqual(ssh_helper.execute.call_count, 1)
+
+ def test__detect_and_bind_dpdk_fail_to_bind(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.return_value = 1, 'bad output', 'error output'
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._bind_dpdk = mock.Mock()
+
+ self.assertIsNone(dpdk_setup_helper._detect_and_bind_dpdk('a', 'b'))
+ self.assertEqual(ssh_helper.execute.call_count, 2)
+
+ def test__detect_and_bind_dpdk(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ ssh_helper.execute.side_effect = iter([
+ (1, 'bad output', 'error output'),
+ (0, 'output', ''),
+ ])
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._bind_dpdk = mock.Mock()
+
+ self.assertEqual(dpdk_setup_helper._detect_and_bind_dpdk('a', 'b'), 'output')
+ self.assertEqual(ssh_helper.execute.call_count, 2)
+
+ def test__bind_kernel_devices(self):
+ bind_iter = iter([
+ None,
+ 'output',
+ ])
+
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._detect_and_bind_dpdk = mock.Mock(side_effect=bind_iter)
+
+ self.assertIsNone(dpdk_setup_helper._bind_kernel_devices())
+
+ def test_tear_down(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper._dpdk_nic_bind = 'a'
+ dpdk_setup_helper.used_drivers = {
+ '0000:05:00.0': (1, 'd1'),
+ '0000:05:01.0': (3, 'd3'),
+ }
+
+ self.assertIsNone(dpdk_setup_helper.tear_down())
+
+
+class TestResourceHelper(unittest.TestCase):
+
+ def test_setup(self):
+ resource = object()
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ dpdk_setup_helper.setup_vnf_environment = mock.Mock(return_value=resource)
+ resource_helper = ResourceHelper(dpdk_setup_helper)
+
+ self.assertIsNone(resource_helper.setup())
+ self.assertIs(resource_helper.resource, resource)
+
+ def test_generate_cfg(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ resource_helper = ResourceHelper(dpdk_setup_helper)
+
+ self.assertIsNone(resource_helper.generate_cfg())
+
+ def test_stop_collect(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ resource_helper = ResourceHelper(dpdk_setup_helper)
+ resource_helper.resource = mock.Mock()
+
+ self.assertIsNone(resource_helper.stop_collect())
+
+ def test_stop_collect_none(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ resource_helper = ResourceHelper(dpdk_setup_helper)
+ resource_helper.resource = None
+
+ self.assertIsNone(resource_helper.stop_collect())
+
+class TestClientResourceHelper(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'driver': 'i40e',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'driver': 'ixgbe',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:13',
+ 'vpci': '0000:05:00.2',
+ 'driver': 'ixgbe',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.30',
+ 'local_mac': '00:00:00:00:00:11'
+ },
+ 'vnfd-connection-point-ref': 'xe2',
+ 'name': 'xe2'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ],
+ },
+ }
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.LOG')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.STLStateError',
+ new_callable=lambda: MockError)
+ def test_get_stats_not_connected(self, mock_state_error, mock_logger):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.MagicMock()
+ client_resource_helper.client.get_stats.side_effect = mock_state_error
+
+ self.assertEqual(client_resource_helper.get_stats(), {})
+ self.assertEqual(client_resource_helper.client.get_stats.call_count, 1)
+
+ def test_generate_samples(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.MagicMock()
+ client_resource_helper._vpci_ascending = [
+ '0000:05:00.0',
+ '0000:05:00.1',
+ '0000:05:00.2',
+ ]
+ client_resource_helper.client.get_stats.return_value = {
+ 0: {
+ 'rx_pps': 5.5,
+ 'tx_pps': 4.9,
+ 'rx_bps': 234.78,
+ 'tx_bps': 243.11,
+ 'ipackets': 34251,
+ 'opackets': 52342,
+ },
+ 1: {
+ 'tx_pps': 5.9,
+ 'rx_bps': 434.78,
+ 'opackets': 48791,
+ },
+ }
+
+ expected = {
+ 'xe0': {
+ "rx_throughput_fps": 5.5,
+ "tx_throughput_fps": 4.9,
+ "rx_throughput_mbps": 234.78,
+ "tx_throughput_mbps": 243.11,
+ "in_packets": 34251,
+ "out_packets": 52342,
+ },
+ 'xe1': {
+ "rx_throughput_fps": 0.0,
+ "tx_throughput_fps": 5.9,
+ "rx_throughput_mbps": 434.78,
+ "tx_throughput_mbps": 0.0,
+ "in_packets": 0,
+ "out_packets": 48791,
+ },
+ 'xe2': {
+ "rx_throughput_fps": 0.0,
+ "tx_throughput_fps": 0.0,
+ "rx_throughput_mbps": 0.0,
+ "tx_throughput_mbps": 0.0,
+ "in_packets": 0,
+ "out_packets": 0,
+ },
+ }
+ result = client_resource_helper.generate_samples()
+ self.assertDictEqual(result, expected)
+
+ def test_generate_samples_with_key(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.MagicMock()
+ client_resource_helper._vpci_ascending = [
+ '0000:05:00.0',
+ '0000:05:00.1',
+ ]
+ client_resource_helper.client.get_stats.return_value = {
+ 'key_name': 'key_value',
+ 0: {
+ 'rx_pps': 5.5,
+ 'tx_pps': 4.9,
+ 'rx_bps': 234.78,
+ 'tx_bps': 243.11,
+ 'ipackets': 34251,
+ 'opackets': 52342,
+ },
+ 1: {
+ 'tx_pps': 5.9,
+ 'rx_bps': 434.78,
+ 'opackets': 48791,
+ },
+ }
+
+ expected = {
+ 'xe0': {
+ 'key_name': 'key_value',
+ "rx_throughput_fps": 5.5,
+ "tx_throughput_fps": 4.9,
+ "rx_throughput_mbps": 234.78,
+ "tx_throughput_mbps": 243.11,
+ "in_packets": 34251,
+ "out_packets": 52342,
+ },
+ 'xe1': {
+ 'key_name': 'key_value',
+ "rx_throughput_fps": 0.0,
+ "tx_throughput_fps": 5.9,
+ "rx_throughput_mbps": 434.78,
+ "tx_throughput_mbps": 0.0,
+ "in_packets": 0,
+ "out_packets": 48791,
+ },
+ }
+ result = client_resource_helper.generate_samples('key_name')
+ self.assertDictEqual(result, expected)
+
+ def test_generate_samples_with_key_and_default(self):
+ vnfd_helper = VnfdHelper(self.VNFD_0)
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.MagicMock()
+ client_resource_helper._vpci_ascending = [
+ '0000:05:00.0',
+ '0000:05:00.1',
+ ]
+ client_resource_helper.client.get_stats.return_value = {
+ 0: {
+ 'rx_pps': 5.5,
+ 'tx_pps': 4.9,
+ 'rx_bps': 234.78,
+ 'tx_bps': 243.11,
+ 'ipackets': 34251,
+ 'opackets': 52342,
+ },
+ 1: {
+ 'tx_pps': 5.9,
+ 'rx_bps': 434.78,
+ 'opackets': 48791,
+ },
+ }
+
+ expected = {
+ 'xe0': {
+ 'key_name': 'default',
+ "rx_throughput_fps": 5.5,
+ "tx_throughput_fps": 4.9,
+ "rx_throughput_mbps": 234.78,
+ "tx_throughput_mbps": 243.11,
+ "in_packets": 34251,
+ "out_packets": 52342,
+ },
+ 'xe1': {
+ 'key_name': 'default',
+ "rx_throughput_fps": 0.0,
+ "tx_throughput_fps": 5.9,
+ "rx_throughput_mbps": 434.78,
+ "tx_throughput_mbps": 0.0,
+ "in_packets": 0,
+ "out_packets": 48791,
+ },
+ }
+ result = client_resource_helper.generate_samples('key_name', 'default')
+ self.assertDictEqual(result, expected)
+
+ def test_clear_stats(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.Mock()
+
+ self.assertIsNone(client_resource_helper.clear_stats())
+ self.assertEqual(client_resource_helper.client.clear_stats.call_count, 1)
+
+ def test_clear_stats_of_ports(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.Mock()
+
+ self.assertIsNone(client_resource_helper.clear_stats([3, 4]))
+ self.assertEqual(client_resource_helper.client.clear_stats.call_count, 1)
+
+ def test_start(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.Mock()
+
+ self.assertIsNone(client_resource_helper.start())
+ self.assertEqual(client_resource_helper.client.start.call_count, 1)
+
+ def test_start_ports(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper.client = mock.Mock()
+
+ self.assertIsNone(client_resource_helper.start([3, 4]))
+ self.assertEqual(client_resource_helper.client.start.call_count, 1)
+
+ def test_collect_kpi_with_queue(self):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client_resource_helper._result = {'existing': 43, 'replaceable': 12}
+ client_resource_helper._queue = mock.Mock()
+ client_resource_helper._queue.empty.return_value = False
+ client_resource_helper._queue.get.return_value = {'incoming': 34, 'replaceable': 99}
+
+ expected = {
+ 'existing': 43,
+ 'incoming': 34,
+ 'replaceable': 99,
+ }
+ result = client_resource_helper.collect_kpi()
+ self.assertDictEqual(result, expected)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.LOG')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.STLError',
+ new_callable=lambda: MockError)
+ def test__connect_with_failures(self, mock_error, mock_logger, mock_time):
+ vnfd_helper = VnfdHelper({})
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
+ client_resource_helper = ClientResourceHelper(dpdk_setup_helper)
+ client = mock.MagicMock()
+ client.connect.side_effect = mock_error
+
+ self.assertIs(client_resource_helper._connect(client), client)
+
+
+class TestRfc2544ResourceHelper(unittest.TestCase):
+
+ RFC2544_CFG_1 = {
+ 'latency': True,
+ 'correlated_traffic': True,
+ 'allowed_drop_rate': '0.1 - 0.15',
+ }
+
+ RFC2544_CFG_2 = {
+ 'allowed_drop_rate': ' 0.25 - 0.05 ',
+ }
+
+ RFC2544_CFG_3 = {
+ 'allowed_drop_rate': '0.2',
+ }
+
+ RFC2544_CFG_4 = {
+ 'latency': True,
+ }
+
+ SCENARIO_CFG_1 = {
+ 'options': {
+ 'rfc2544': RFC2544_CFG_1,
+ }
+ }
+
+ SCENARIO_CFG_2 = {
+ 'options': {
+ 'rfc2544': RFC2544_CFG_2,
+ }
+ }
+
+ SCENARIO_CFG_3 = {
+ 'options': {
+ 'rfc2544': RFC2544_CFG_3,
+ }
+ }
+
+ SCENARIO_CFG_4 = {
+ 'options': {
+ 'rfc2544': RFC2544_CFG_4,
+ }
+ }
+
+ def test_property_rfc2544(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_1
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertIsNone(rfc2544_resource_helper._rfc2544)
+ self.assertDictEqual(rfc2544_resource_helper.rfc2544, self.RFC2544_CFG_1)
+ self.assertDictEqual(rfc2544_resource_helper._rfc2544, self.RFC2544_CFG_1)
+ scenario_helper.scenario_cfg = {} # ensure that resource_helper caches
+ self.assertDictEqual(rfc2544_resource_helper.rfc2544, self.RFC2544_CFG_1)
+
+ def test_property_tolerance_high(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_1
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertIsNone(rfc2544_resource_helper._tolerance_high)
+ self.assertEqual(rfc2544_resource_helper.tolerance_high, 0.15)
+ self.assertEqual(rfc2544_resource_helper._tolerance_high, 0.15)
+ scenario_helper.scenario_cfg = {} # ensure that resource_helper caches
+ self.assertEqual(rfc2544_resource_helper.tolerance_high, 0.15)
+
+ def test_property_tolerance_low(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_1
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertIsNone(rfc2544_resource_helper._tolerance_low)
+ self.assertEqual(rfc2544_resource_helper.tolerance_low, 0.1)
+ self.assertEqual(rfc2544_resource_helper._tolerance_low, 0.1)
+ scenario_helper.scenario_cfg = {} # ensure that resource_helper caches
+ self.assertEqual(rfc2544_resource_helper.tolerance_low, 0.1)
+
+ def test_property_tolerance_high_range_swap(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_2
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_high, 0.25)
+
+ def test_property_tolerance_low_range_swap(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_2
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_low, 0.05)
+
+ def test_property_tolerance_high_not_range(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_3
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_high, 0.2)
+
+ def test_property_tolerance_low_not_range(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_3
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_low, 0.2)
+
+ def test_property_tolerance_high_default(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_4
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_high, 0.0001)
+
+ def test_property_tolerance_low_default(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_4
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertEqual(rfc2544_resource_helper.tolerance_low, 0.0001)
+
+ def test_property_latency(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_1
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertIsNone(rfc2544_resource_helper._latency)
+ self.assertTrue(rfc2544_resource_helper.latency)
+ self.assertTrue(rfc2544_resource_helper._latency)
+ scenario_helper.scenario_cfg = {} # ensure that resource_helper caches
+ self.assertTrue(rfc2544_resource_helper.latency)
+
+ def test_property_latency_default(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_2
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertFalse(rfc2544_resource_helper.latency)
+
+ def test_property_correlated_traffic(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_1
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertIsNone(rfc2544_resource_helper._correlated_traffic)
+ self.assertTrue(rfc2544_resource_helper.correlated_traffic)
+ self.assertTrue(rfc2544_resource_helper._correlated_traffic)
+ scenario_helper.scenario_cfg = {} # ensure that resource_helper caches
+ self.assertTrue(rfc2544_resource_helper.correlated_traffic)
+
+ def test_property_correlated_traffic_default(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = self.SCENARIO_CFG_2
+ rfc2544_resource_helper = Rfc2544ResourceHelper(scenario_helper)
+
+ self.assertFalse(rfc2544_resource_helper.correlated_traffic)
+
+
+class TestSampleVNFDeployHelper(unittest.TestCase):
+
+ @mock.patch('subprocess.check_output')
+ def test_deploy_vnfs_disabled(self, mock_check_output):
+ vnfd_helper = mock.Mock()
+ ssh_helper = mock.Mock()
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.execute.return_value = 1, 'bad output', 'error output'
+ ssh_helper.put.return_value = None
+ sample_vnf_deploy_helper = SampleVNFDeployHelper(vnfd_helper, ssh_helper)
+
+ self.assertIsNone(sample_vnf_deploy_helper.deploy_vnfs('name1'))
+ self.assertEqual(ssh_helper.execute.call_count, 0)
+ self.assertEqual(ssh_helper.put.call_count, 0)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('subprocess.check_output')
+ def test_deploy_vnfs(self, mock_check_output, mock_time):
+ vnfd_helper = mock.Mock()
+ ssh_helper = mock.Mock()
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.execute.return_value = 1, 'bad output', 'error output'
+ ssh_helper.put.return_value = None
+ sample_vnf_deploy_helper = SampleVNFDeployHelper(vnfd_helper, ssh_helper)
+ sample_vnf_deploy_helper.DISABLE_DEPLOY = False
+
+ self.assertIsNone(sample_vnf_deploy_helper.deploy_vnfs('name1'))
+ self.assertEqual(ssh_helper.execute.call_count, 5)
+ self.assertEqual(ssh_helper.put.call_count, 1)
+
+ @mock.patch('subprocess.check_output')
+ def test_deploy_vnfs_early_success(self, mock_check_output):
+ vnfd_helper = mock.Mock()
+ ssh_helper = mock.Mock()
+ ssh_helper.join_bin_path.return_value = 'joined_path'
+ ssh_helper.execute.return_value = 0, 'output', ''
+ ssh_helper.put.return_value = None
+ sample_vnf_deploy_helper = SampleVNFDeployHelper(vnfd_helper, ssh_helper)
+ sample_vnf_deploy_helper.DISABLE_DEPLOY = False
+
+ self.assertIsNone(sample_vnf_deploy_helper.deploy_vnfs('name1'))
+ self.assertEqual(ssh_helper.execute.call_count, 1)
+ self.assertEqual(ssh_helper.put.call_count, 0)
+
+
+class TestScenarioHelper(unittest.TestCase):
+
+ def test_property_task_path(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'task_path': 'my_path',
+ }
+
+ self.assertEqual(scenario_helper.task_path, 'my_path')
+
+ def test_property_nodes(self):
+ nodes = ['node1', 'node2']
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'nodes': nodes,
+ }
+
+ self.assertEqual(scenario_helper.nodes, nodes)
+
+ def test_property_all_options(self):
+ data = {
+ 'name1': {
+ 'key3': 'value3',
+ },
+ 'name2': {}
+ }
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'options': data,
+ }
+
+ self.assertDictEqual(scenario_helper.all_options, data)
+
+ def test_property_options(self):
+ data = {
+ 'key1': 'value1',
+ 'key2': 'value2',
+ }
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'options': {
+ 'name1': data,
+ },
+ }
+
+ self.assertDictEqual(scenario_helper.options, data)
+
+ def test_property_vnf_cfg(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'options': {
+ 'name1': {
+ 'vnf_config': 'my_config',
+ },
+ },
+ }
+
+ self.assertEqual(scenario_helper.vnf_cfg, 'my_config')
+
+ def test_property_vnf_cfg_default(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'options': {
+ 'name1': {},
+ },
+ }
+
+ self.assertDictEqual(scenario_helper.vnf_cfg, ScenarioHelper.DEFAULT_VNF_CFG)
+
+ def test_property_topology(self):
+ scenario_helper = ScenarioHelper('name1')
+ scenario_helper.scenario_cfg = {
+ 'topology': 'my_topology',
+ }
+
+ self.assertEqual(scenario_helper.topology, 'my_topology')
+
+
+class TestSampleVnf(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ]
+ }
+ }
+
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64,
+ },
+ }
+
+ def test___init__(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+
+ self.assertEqual(sample_vnf.name, 'vnf1')
+ self.assertDictEqual(sample_vnf.vnfd_helper, self.VNFD_0)
+
+ # test the default setup helper is SetupEnvHelper, not subclass
+ self.assertEqual(type(sample_vnf.setup_helper), SetupEnvHelper)
+
+ # test the default resource helper is ResourceHelper, not subclass
+ self.assertEqual(type(sample_vnf.resource_helper), ResourceHelper)
+
+ def test___init___alt_types(self):
+ class MySetupEnvHelper(SetupEnvHelper):
+ pass
+
+
+ class MyResourceHelper(ResourceHelper):
+ pass
+
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0, MySetupEnvHelper, MyResourceHelper)
+
+ self.assertEqual(sample_vnf.name, 'vnf1')
+ self.assertDictEqual(sample_vnf.vnfd_helper, self.VNFD_0)
+
+ # test the default setup helper is MySetupEnvHelper, not subclass
+ self.assertEqual(type(sample_vnf.setup_helper), MySetupEnvHelper)
+
+ # test the default resource helper is MyResourceHelper, not subclass
+ self.assertEqual(type(sample_vnf.resource_helper), MyResourceHelper)
+
+ def test__get_port0localip6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '0064:ff9b:0:0:0:0:9810:6414'
+ result = sample_vnf._get_port0localip6()
+ self.assertEqual(result, expected)
+
+ def test__get_port1localip6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '0064:ff9b:0:0:0:0:9810:2814'
+ result = sample_vnf._get_port1localip6()
+ self.assertEqual(result, expected)
+
+ def test__get_port0prefixip6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '112'
+ result = sample_vnf._get_port0prefixlen6()
+ self.assertEqual(result, expected)
+
+ def test__get_port1prefixip6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '112'
+ result = sample_vnf._get_port1prefixlen6()
+ self.assertEqual(result, expected)
+
+ def test__get_port0gateway6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '0064:ff9b:0:0:0:0:9810:6414'
+ result = sample_vnf._get_port0gateway6()
+ self.assertEqual(result, expected)
+
+ def test__get_port1gateway6(self):
+ sample_vnf = SampleVNF('vnf1', self.VNFD_0)
+ expected = '0064:ff9b:0:0:0:0:9810:2814'
+ result = sample_vnf._get_port1gateway6()
+ self.assertEqual(result, expected)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.Process')
+ def test__start_vnf(self, mock_process_type):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf._run = mock.Mock()
+
+ self.assertIsNone(sample_vnf.queue_wrapper)
+ self.assertIsNone(sample_vnf._vnf_process)
+ self.assertIsNone(sample_vnf._start_vnf())
+ self.assertIsNotNone(sample_vnf.queue_wrapper)
+ self.assertIsNotNone(sample_vnf._vnf_process)
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_instantiate(self, ssh):
+ mock_ssh(ssh)
+
+ nodes = {
+ 'vnf1': 'name1',
+ 'vnf2': 'name2',
+ }
+
+ context1 = mock.Mock()
+ context1._get_server.return_value = None
+ context2 = mock.Mock()
+ context2._get_server.return_value = context2
+
+ try:
+ Context.list.clear()
+ except AttributeError:
+ # clear() but works in Py2.7
+ Context.list[:] = []
+
+ Context.list.extend([
+ context1,
+ context2,
+ ])
+
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf._start_server = mock.Mock(return_value=0)
+ sample_vnf._vnf_process = mock.MagicMock()
+ sample_vnf._vnf_process._is_alive.return_value = 1
+ sample_vnf.ssh_helper = mock.MagicMock()
+ sample_vnf.deploy_helper = mock.MagicMock()
+ sample_vnf.resource_helper.ssh_helper = mock.MagicMock()
+ scenario_cfg = {
+ 'nodes': nodes,
+ }
+
+ self.assertIsNone(sample_vnf.instantiate(scenario_cfg, {}))
+ self.assertEqual(sample_vnf.nfvi_context, context2)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ @mock.patch("yardstick.ssh.SSH")
+ def test_wait_for_instantiate_empty_queue(self, ssh, mock_time):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+
+ queue_size_list = [
+ 0,
+ 1,
+ 0,
+ 1,
+ ]
+
+ queue_get_list = [
+ 'some output',
+ 'pipeline> ',
+ ]
+
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf._start_server = mock.Mock(return_value=0)
+ sample_vnf._vnf_process = mock.MagicMock()
+ sample_vnf._vnf_process.exitcode = 0
+ sample_vnf._vnf_process._is_alive.return_value = 1
+ sample_vnf.queue_wrapper = mock.Mock()
+ sample_vnf.q_out = mock.Mock()
+ sample_vnf.q_out.qsize.side_effect = iter(queue_size_list)
+ sample_vnf.q_out.get.side_effect = iter(queue_get_list)
+ sample_vnf.ssh_helper = mock.MagicMock()
+ sample_vnf.resource_helper.ssh_helper = mock.MagicMock()
+ sample_vnf.resource_helper.start_collect = mock.MagicMock()
+
+ self.assertEqual(sample_vnf.wait_for_instantiate(), 0)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_vnf_execute_with_queue_data(self, mock_time):
+ queue_size_list = [
+ 1,
+ 1,
+ 0,
+ ]
+
+ queue_get_list = [
+ 'hello ',
+ 'world'
+ ]
+
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf.q_out = mock.Mock()
+ sample_vnf.q_out.qsize.side_effect = iter(queue_size_list)
+ sample_vnf.q_out.get.side_effect = iter(queue_get_list)
+
+ self.assertEqual(sample_vnf.vnf_execute('my command'), 'hello world')
+
+ def test_terminate_without_vnf_process(self):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf.vnf_execute = mock.Mock()
+ sample_vnf.ssh_helper = mock.Mock()
+ sample_vnf._tear_down = mock.Mock()
+ sample_vnf.resource_helper = mock.Mock()
+
+ self.assertIsNone(sample_vnf.terminate())
+
+ def test_get_stats(self):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf.APP_WORD = 'sample1'
+ sample_vnf.vnf_execute = mock.Mock(return_value='the stats')
+
+ self.assertEqual(sample_vnf.get_stats(), 'the stats')
+
+ def test_collect_kpi(self):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf.COLLECT_KPI = '\s(\d+)\D*(\d+)\D*(\d+)'
+ sample_vnf.COLLECT_MAP = {
+ 'k1': 3,
+ 'k2': 1,
+ 'k3': 2,
+ }
+ sample_vnf.get_stats = mock.Mock(return_value='index0: 34 -- 91, 27')
+ sample_vnf.resource_helper = mock.Mock()
+ sample_vnf.resource_helper.collect_kpi.return_value = {}
+
+ expected = {
+ 'k1': 27,
+ 'k2': 34,
+ 'k3': 91,
+ 'collect_stats': {},
+ }
+ result = sample_vnf.collect_kpi()
+ self.assertDictEqual(result, expected)
+
+ def test_collect_kpi_default(self):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sample_vnf = SampleVNF('vnf1', vnfd)
+ sample_vnf.APP_NAME = 'sample1'
+ sample_vnf.COLLECT_KPI = '\s(\d+)\D*(\d+)\D*(\d+)'
+ sample_vnf.get_stats = mock.Mock(return_value='')
+
+ expected = {
+ 'packets_in': 0,
+ 'packets_fwd': 0,
+ 'packets_dropped': 0,
+ }
+ result = sample_vnf.collect_kpi()
+ self.assertDictEqual(result, expected)
+
+
+class TestSampleVNFTrafficGen(unittest.TestCase):
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.0',
+ 'driver': 'i40e',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.100.20',
+ 'local_mac': '00:00:00:00:00:01'
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.1',
+ 'driver': 'ixgbe',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:13',
+ 'vpci': '0000:05:00.2',
+ 'driver': 'ixgbe',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.30',
+ 'local_mac': '00:00:00:00:00:11'
+ },
+ 'vnfd-connection-point-ref': 'xe2',
+ 'name': 'xe2'
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ],
+ },
+ }
+
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64,
+ },
+ }
+
+ def test__check_status(self):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+
+ with self.assertRaises(NotImplementedError):
+ sample_vnf_tg._check_status()
+
+ def test_listen_traffic(self):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+
+ sample_vnf_tg.listen_traffic(mock.Mock())
+
+ def test_verify_traffic(self):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+
+ sample_vnf_tg.verify_traffic(mock.Mock())
+
+ def test_terminate(self):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+ sample_vnf_tg._traffic_process = mock.Mock()
+
+ sample_vnf_tg.terminate()
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.LOG')
+ def test_wait_for_instantiate(self, mock_logger, mock_time):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+ sample_vnf_tg._check_status = mock.Mock(side_effect=iter([1, 0]))
+ sample_vnf_tg._tg_process = mock.Mock()
+ sample_vnf_tg._tg_process.is_alive.return_value = True
+ sample_vnf_tg._tg_process.exitcode = 234
+
+ self.assertEqual(sample_vnf_tg.wait_for_instantiate(), 234)
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.LOG')
+ def test_wait_for_instantiate_not_alive(self, mock_logger, mock_time):
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+ sample_vnf_tg._check_status = mock.Mock(return_value=1)
+ sample_vnf_tg._tg_process = mock.Mock()
+ sample_vnf_tg._tg_process.is_alive.side_effect = iter([True, False])
+ sample_vnf_tg._tg_process.exitcode = 234
+
+ with self.assertRaises(RuntimeError):
+ sample_vnf_tg.wait_for_instantiate()
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.LOG')
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.Process')
+ def test_wait_for_instantiate_delayed(self, mock_process, mock_logger, mock_time):
+ class MockClientStarted(mock.Mock):
+
+ def __init__(self, *args, **kwargs):
+ super(MockClientStarted, self).__init__(*args, **kwargs)
+ self.iter = iter([0, 0, 1])
+
+ @property
+ def value(self):
+ return next(self.iter)
+
+ mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
+ mock_traffic_profile.get_traffic_definition.return_value = "64"
+ mock_traffic_profile.execute.return_value = "64"
+ mock_traffic_profile.params = self.TRAFFIC_PROFILE
+
+ sample_vnf_tg = SampleVNFTrafficGen('tg1', self.VNFD_0)
+ sample_vnf_tg._check_status = mock.Mock(side_effect=iter([1, 0]))
+ sample_vnf_tg._tg_process = mock.Mock()
+ sample_vnf_tg._tg_process.is_alive.return_value = True
+ sample_vnf_tg._tg_process.exitcode = 234
+ sample_vnf_tg.resource_helper = mock.Mock()
+ sample_vnf_tg.resource_helper.client_started = MockClientStarted()
+
+ self.assertTrue(sample_vnf_tg.run_traffic(mock_traffic_profile))
+ self.assertEqual(mock_time.sleep.call_count, 2)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
new file mode 100644
index 000000000..cda44127e
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
@@ -0,0 +1,374 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+import unittest
+import mock
+import subprocess
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.tg_ixload import IxLoadTrafficGen
+ from yardstick.network_services.vnf_generic.vnf.tg_ixload import IxLoadResourceHelper
+ from yardstick.network_services.traffic_profile.base import TrafficProfile
+
+
+NAME = "tg__1"
+
+
+class TestIxLoadTrafficGen(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64}}
+
+ def test___init__(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ self.assertIsNone(ixload_traffic_gen.data)
+
+ def test_collect_kpi(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ ixload_traffic_gen.data = {}
+ restult = ixload_traffic_gen.collect_kpi()
+ self.assertEqual({}, restult)
+
+ def test_listen_traffic(self):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ self.assertEqual(None, ixload_traffic_gen.listen_traffic({}))
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.makedirs")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.shutil")
+ def test_instantiate(self, call, shutil, mock_makedirs):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ scenario_cfg = {'tc': "nsb_test_case",
+ 'ixia_profile': "ixload.cfg"}
+ ixload_traffic_gen.RESULTS_MOUNT = "/tmp/result"
+ shutil.copy = mock.Mock()
+ scenario_cfg.update({'options': {'packetsize': 64, 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ }})
+ self.assertRaises(IOError,
+ ixload_traffic_gen.instantiate(scenario_cfg, {}))
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.shutil")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.open")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.min")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.max")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.len")
+ def test_run_traffic(self, call, shutil, main_open, min, max, len):
+ mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
+ mock_traffic_profile.get_traffic_definition.return_value = "64"
+ mock_traffic_profile.params = self.TRAFFIC_PROFILE
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vnfd["mgmt-interface"].update({"tg-config": {}})
+ vnfd["mgmt-interface"]["tg-config"].update({"ixchassis":
+ "1.1.1.1"})
+ vnfd["mgmt-interface"]["tg-config"].update({"py_bin_path":
+ "/root"})
+ sut = IxLoadTrafficGen(NAME, vnfd)
+ sut.connection = mock.Mock()
+ sut.connection.run = mock.Mock()
+ sut._traffic_runner = mock.Mock(return_value=0)
+ shutil.copy = mock.Mock()
+ result = sut.run_traffic(mock_traffic_profile)
+ self.assertIsNone(result)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.shutil")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.open")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.min")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.max")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.len")
+ def test_run_traffic_csv(self, call, shutil, main_open, min, max, len):
+ mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
+ mock_traffic_profile.get_traffic_definition.return_value = "64"
+ mock_traffic_profile.params = self.TRAFFIC_PROFILE
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vnfd["mgmt-interface"].update({"tg-config": {}})
+ vnfd["mgmt-interface"]["tg-config"].update({"ixchassis":
+ "1.1.1.1"})
+ vnfd["mgmt-interface"]["tg-config"].update({"py_bin_path":
+ "/root"})
+ sut = IxLoadTrafficGen(NAME, vnfd)
+ sut.connection = mock.Mock()
+ sut.connection.run = mock.Mock()
+ sut._traffic_runner = mock.Mock(return_value=0)
+ shutil.copy = mock.Mock()
+ subprocess.call(["touch", "/tmp/1.csv"])
+ sut.rel_bin_path = mock.Mock(return_value="/tmp/*.csv")
+ result = sut.run_traffic(mock_traffic_profile)
+ self.assertIsNone(result)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ def test_terminate(self, call):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ self.assertEqual(None, ixload_traffic_gen.terminate())
+
+ @mock.patch("yardstick.ssh.SSH")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ def test_parse_csv_read(self, mock_call, mock_ssh):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ kpi_data = {
+ 'HTTP Total Throughput (Kbps)': 1,
+ 'HTTP Simulated Users': 2,
+ 'HTTP Concurrent Connections': '3',
+ 'HTTP Connection Rate': 4.3,
+ 'HTTP Transaction Rate': True,
+ }
+ http_reader = [kpi_data]
+
+ mock_ssh_type = mock.Mock(autospec=mock_ssh.SSH)
+ mock_ssh_type.execute.return_value = 0, "", ""
+ mock_ssh.from_node.return_value = mock_ssh_type
+
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ result = ixload_traffic_gen.resource_helper.result
+
+ ixload_traffic_gen.resource_helper.parse_csv_read(http_reader)
+ for key_left, key_right in IxLoadResourceHelper.KPI_LIST.items():
+ self.assertEqual(result[key_left][-1], int(kpi_data[key_right]))
+
+ @mock.patch("yardstick.ssh.SSH")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ def test_parse_csv_read_value_error(self, mock_call, mock_ssh):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ http_reader = [{
+ 'HTTP Total Throughput (Kbps)': 1,
+ 'HTTP Simulated Users': 2,
+ 'HTTP Concurrent Connections': "not a number",
+ 'HTTP Connection Rate': 4,
+ 'HTTP Transaction Rate': 5,
+ }]
+
+ mock_ssh_type = mock.Mock(autospec=mock_ssh.SSH)
+ mock_ssh_type.execute.return_value = 0, "", ""
+ mock_ssh.from_node.return_value = mock_ssh_type
+
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+ init_value = ixload_traffic_gen.resource_helper.result
+
+ ixload_traffic_gen.resource_helper.parse_csv_read(http_reader)
+ self.assertDictEqual(ixload_traffic_gen.resource_helper.result, init_value)
+
+ @mock.patch("yardstick.ssh.SSH")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
+ def test_parse_csv_read_error(self, mock_call, mock_ssh):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ http_reader = [{
+ 'HTTP Total Throughput (Kbps)': 1,
+ 'HTTP Simulated Users': 2,
+ 'HTTP Concurrent Connections': 3,
+ 'HTTP Transaction Rate': 5,
+ }]
+
+ mock_ssh_type = mock.Mock(autospec=mock_ssh.SSH)
+ mock_ssh_type.execute.return_value = 0, "", ""
+ mock_ssh.from_node.return_value = mock_ssh_type
+
+ ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
+
+ with self.assertRaises(KeyError):
+ ixload_traffic_gen.resource_helper.parse_csv_read(http_reader)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
index 0c88ee80c..949bfb3d4 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
@@ -20,9 +20,78 @@ import unittest
import mock
from multiprocessing import Queue
-from yardstick.network_services.vnf_generic.vnf.tg_ping import \
- PingParser, PingTrafficGen
-from yardstick.network_services.traffic_profile.base import TrafficProfile
+from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+
+SSH_HELPER = "yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper"
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.tg_ping import PingParser, PingTrafficGen
+ from yardstick.network_services.traffic_profile.base import TrafficProfile
+ from yardstick.network_services.vnf_generic.vnf.sample_vnf import VnfSshHelper
class TestPingParser(unittest.TestCase):
@@ -58,72 +127,122 @@ class TestPingParser(unittest.TestCase):
class TestPingTrafficGen(unittest.TestCase):
- VNFD = {'vnfd:vnfd-catalog':
- {'vnfd':
- [{'short-name': 'VpeVnf',
- 'vdu':
- [{'routing_table':
- [{'network': '152.16.100.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.100.20',
- 'if': 'xe0'},
- {'network': '152.16.40.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.40.20',
- 'if': 'xe1'}],
- 'description': 'VPE approximation using DPDK',
- 'name': 'vpevnf-baremetal',
- 'nd_route_tbl':
- [{'network': '0064:ff9b:0:0:0:0:9810:6414',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
- 'if': 'xe0'},
- {'network': '0064:ff9b:0:0:0:0:9810:2814',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
- 'if': 'xe1'}],
- 'id': 'vpevnf-baremetal',
- 'external-interface':
- [{'virtual-interface':
- {'dst_mac': '00:00:00:00:00:04',
- 'vpci': '0000:05:00.0',
- 'local_ip': '152.16.100.19',
- 'type': 'PCI-PASSTHROUGH',
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '0',
- 'bandwidth': '10 Gbps',
- 'driver': "i40e",
- 'dst_ip': '152.16.100.20',
- 'local_iface_name': 'xe0',
- 'local_mac': '00:00:00:00:00:02'},
- 'vnfd-connection-point-ref': 'xe0',
- 'name': 'xe0'},
- {'virtual-interface':
- {'dst_mac': '00:00:00:00:00:03',
- 'vpci': '0000:05:00.1',
- 'local_ip': '152.16.40.19',
- 'type': 'PCI-PASSTHROUGH',
- 'driver': "i40e",
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '1',
- 'bandwidth': '10 Gbps',
- 'dst_ip': '152.16.40.20',
- 'local_iface_name': 'xe1',
- 'local_mac': '00:00:00:00:00:01'},
- 'vnfd-connection-point-ref': 'xe1',
- 'name': 'xe1'}]}],
- 'description': 'Vpe approximation using DPDK',
- 'mgmt-interface':
- {'vdu-id': 'vpevnf-baremetal',
- 'host': '1.1.1.1',
- 'password': 'r00t',
- 'user': 'root',
- 'ip': '1.1.1.1'},
- 'benchmark':
- {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
- 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
- {'type': 'VPORT', 'name': 'xe1'}],
- 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ VNFD_0_EXT_IF_0 = {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': u'152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': u'152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02',
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0',
+ }
+
+ VNFD_0_EXT_IF_1 = {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': u'152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': u'152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01',
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1',
+ }
+
+ VNFD_0_EXT_IF_LIST = [
+ VNFD_0_EXT_IF_0,
+ VNFD_0_EXT_IF_1,
+ ]
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': u'152.16.100.20',
+ 'netmask': u'255.255.255.0',
+ 'gateway': u'152.16.100.20',
+ 'if': 'xe0',
+ },
+ {
+ 'network': u'152.16.40.20',
+ 'netmask': u'255.255.255.0',
+ 'gateway': u'152.16.40.20',
+ 'if': 'xe1',
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0',
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1',
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': VNFD_0_EXT_IF_LIST,
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1',
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf',
+ 'name': 'VPEVnfSsh',
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ],
+ },
+ }
TRAFFIC_PROFILE = {
"schema": "isb:traffic_profile:0.1",
@@ -133,115 +252,87 @@ class TestPingTrafficGen(unittest.TestCase):
"traffic_type": "FixedTraffic",
"frame_rate": 100, # pps
"flow_number": 10,
- "frame_size": 64}}
+ "frame_size": 64,
+ },
+ }
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test___init__(self, ssh):
+ ssh.from_node.return_value.execute.return_value = 0, "success", ""
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ self.assertIsNotNone(ping_traffic_gen._queue)
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test__bind_device_kernel_with_failure(self, ssh):
+ mock_ssh(ssh)
+
+ execute_result_data = [
+ (1, 'bad stdout messages', 'error messages'),
+ (0, '', ''),
+ (0, 'if_name_1', ''),
+ (0, 'if_name_2', ''),
+ ]
+ ssh.from_node.return_value.execute.side_effect = iter(execute_result_data)
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ ext_ifs = ping_traffic_gen.vnfd_helper.interfaces
+ self.assertNotEqual(ext_ifs[0]['virtual-interface']['local_iface_name'], 'if_name_1')
+ self.assertNotEqual(ext_ifs[1]['virtual-interface']['local_iface_name'], 'if_name_2')
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_collect_kpi(self, ssh):
+ mock_ssh(ssh, exec_result=(0, "success", ""))
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ ping_traffic_gen._queue = Queue()
+ ping_traffic_gen._queue.put({})
+ ping_traffic_gen.collect_kpi()
+ self.assertEqual(ping_traffic_gen._result, {})
+
+ @mock.patch(SSH_HELPER)
+ def test_instantiate(self, ssh):
+ mock_ssh(ssh, spec=VnfSshHelper, exec_result=(0, "success", ""))
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ ping_traffic_gen.setup_helper.ssh_helper = mock.MagicMock(
+ **{"execute.return_value": (0, "", "")})
+ self.assertIsInstance(ping_traffic_gen.ssh_helper, mock.Mock)
+ self.assertEqual(ping_traffic_gen._result, {})
+ self.assertIsNone(ping_traffic_gen.instantiate({}, {}))
+ self.assertIsNotNone(ping_traffic_gen._result)
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_listen_traffic(self, ssh):
+ ssh.from_node.return_value.execute.return_value = 0, "success", ""
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ self.assertIsNone(ping_traffic_gen.listen_traffic({}))
+
+ @mock.patch(SSH_HELPER)
+ def test_run_traffic_process(self, ssh):
+ mock_ssh(ssh)
- def test___init__(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ping_traffic_gen = PingTrafficGen(vnfd)
- self.assertEqual(ping_traffic_gen._queue, None)
-
- def test_collect_kpi(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- ping_traffic_gen = PingTrafficGen(vnfd)
- ping_traffic_gen._queue = Queue()
- ping_traffic_gen._queue.put({})
- ping_traffic_gen.collect_kpi()
- self.assertEqual({}, ping_traffic_gen._result)
-
- def test_instantiate(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ping_traffic_gen = PingTrafficGen(vnfd)
- self.assertEqual(None, ping_traffic_gen.instantiate({}, {}))
-
- def test_listen_traffic(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ping_traffic_gen = PingTrafficGen(vnfd)
- self.assertEqual(None, ping_traffic_gen.listen_traffic({}))
-
- @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ping.time")
- def test_run_traffic(self, mock_time):
- mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
- mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = PingTrafficGen(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- self.sut._traffic_runner = mock.Mock(return_value=0)
- self.assertIn(self.sut.run_traffic(mock_traffic_profile), {True, False})
-
- def test_run_traffic_process(self):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = PingTrafficGen(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- q = Queue()
- self.sut._traffic_runner(mock_traffic_profile, q)
- self.sut.connection.run.assert_called_with(
- "ping -s 64 152.16.100.20",
- stdout=q, keep_stdin_open=True, pty=True)
-
- def test_scale(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- flavor = ""
- ping_traffic_gen = PingTrafficGen(vnfd)
- self.assertRaises(NotImplementedError, ping_traffic_gen.scale, flavor)
-
- def test_terminate(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ping_traffic_gen = PingTrafficGen(vnfd)
- self.assertEqual(None, ping_traffic_gen.terminate())
+
+ ssh.from_node.return_value.execute.return_value = 0, "success", ""
+ ssh.from_node.return_value.run.return_value = 0, "success", ""
+
+ sut = PingTrafficGen('vnf1', self.VNFD_0)
+ sut._traffic_runner(mock_traffic_profile)
+ sut.ssh_helper.run.assert_called_with(
+ "ping -s 64 152.16.100.20",
+ stdout=sut._parser, keep_stdin_open=True, pty=True)
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_scale_negative(self, ssh):
+ ssh.from_node.return_value.execute.return_value = 0, "success", ""
+ ssh.from_node.return_value.run.return_value = 0, "success", ""
+
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ ping_traffic_gen.scale()
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_terminate(self, ssh):
+ ssh.from_node.return_value.execute.return_value = 0, "success", ""
+ ssh.from_node.return_value.run.return_value = 0, "success", ""
+
+ ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
+ self.assertIsNone(ping_traffic_gen.terminate()) \ No newline at end of file
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
new file mode 100644
index 000000000..8f7f05772
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -0,0 +1,405 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+import os
+import unittest
+import mock
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia import IxiaTrafficGen
+ from yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia import IxiaRfc2544Helper
+ from yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia import IxiaResourceHelper
+ from yardstick.network_services.traffic_profile.base import TrafficProfile
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+
+NAME = "tg__1"
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.IxNextgen")
+class TestIxiaResourceHelper(unittest.TestCase):
+
+ def test___init___with_custom_rfc_helper(self, mock_ix_nextgen):
+ class MyRfcHelper(IxiaRfc2544Helper):
+ pass
+
+ ixia_resource_helper = IxiaResourceHelper(mock.Mock(), MyRfcHelper)
+ self.assertIsInstance(ixia_resource_helper.rfc_helper, MyRfcHelper)
+
+ def test_stop_collect_with_client(self, mock_ix_nextgen):
+ mock_client = mock.Mock()
+
+ ixia_resource_helper = IxiaResourceHelper(mock.Mock())
+
+ ixia_resource_helper.client = mock_client
+ ixia_resource_helper.stop_collect()
+ self.assertEqual(mock_client.ix_stop_traffic.call_count, 1)
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.IxNextgen")
+class TestIXIATrafficGen(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ TRAFFIC_PROFILE = {
+ "schema": "isb:traffic_profile:0.1",
+ "name": "fixed",
+ "description": "Fixed traffic profile to run UDP traffic",
+ "traffic_profile": {
+ "traffic_type": "FixedTraffic",
+ "frame_rate": 100, # pps
+ "flow_number": 10,
+ "frame_size": 64}}
+
+ TC_YAML = {'scenarios': [{'tc_options':
+ {'rfc2544': {'allowed_drop_rate': '0.8 - 1'}},
+ 'runner': {'duration': 400,
+ 'interval': 35, 'type': 'Duration'},
+ 'traffic_options':
+ {'flow': 'ipv4_1flow_Packets_vpe.yaml',
+ 'imix': 'imix_voice.yaml'},
+ 'vnf_options': {'vpe': {'cfg': 'vpe_config'}},
+ 'traffic_profile': 'ipv4_throughput_vpe.yaml',
+ 'type': 'NSPerf',
+ 'nodes': {'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick'},
+ 'topology': 'vpe_vnf_topology.yaml'}],
+ 'context': {'nfvi_type': 'baremetal', 'type': 'Node',
+ 'name': 'yardstick',
+ 'file': '/etc/yardstick/nodes/pod.yaml'},
+ 'schema': 'yardstick:task:0.1'}
+
+ def test___init__(self, mock_ixnextgen):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixnet_traffic_gen = IxiaTrafficGen(NAME, vnfd)
+
+ def test_listen_traffic(self, mock_ixnextgen):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixnet_traffic_gen = IxiaTrafficGen(NAME, vnfd)
+ self.assertEqual(None, ixnet_traffic_gen.listen_traffic({}))
+
+ def test_instantiate(self, mock_ixnextgen):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixnet_traffic_gen = IxiaTrafficGen(NAME, vnfd)
+ scenario_cfg = {'tc': "nsb_test_case", "topology": "",
+ 'ixia_profile': "ixload.cfg"}
+ scenario_cfg.update({'options': {'packetsize': 64,
+ 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ }})
+ ixnet_traffic_gen.topology = ""
+ ixnet_traffic_gen.get_ixobj = mock.MagicMock()
+ ixnet_traffic_gen._ixia_traffic_gen = mock.MagicMock()
+ ixnet_traffic_gen._ixia_traffic_gen._connect = mock.Mock()
+ self.assertRaises(
+ IOError,
+ ixnet_traffic_gen.instantiate(scenario_cfg, {}))
+
+ def test_collect_kpi(self, mock_ixnextgen):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ixnet_traffic_gen = IxiaTrafficGen(NAME, vnfd)
+ ixnet_traffic_gen.data = {}
+ restult = ixnet_traffic_gen.collect_kpi()
+ self.assertEqual({}, restult)
+
+ def test_terminate(self, mock_ixnextgen):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ ixnet_traffic_gen = IxiaTrafficGen(NAME, vnfd)
+ ixnet_traffic_gen._terminated = mock.MagicMock()
+ ixnet_traffic_gen._terminated.value = 0
+ ixnet_traffic_gen._ixia_traffic_gen = mock.MagicMock()
+ ixnet_traffic_gen._ixia_traffic_gen.ix_stop_traffic = mock.Mock()
+ ixnet_traffic_gen._traffic_process = mock.MagicMock()
+ ixnet_traffic_gen._traffic_process.terminate = mock.Mock()
+ self.assertEqual(None, ixnet_traffic_gen.terminate())
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+ def test_scale(self, mock_ix_nextgen):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = IxiaTrafficGen('vnf1', vnfd)
+ sut.scale()
+
+ def test__check_status(self, mock_ix_nextgen):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = IxiaTrafficGen('vnf1', vnfd)
+ sut._check_status()
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.time")
+ @mock.patch("yardstick.ssh.SSH")
+ def test_traffic_runner(self, mock_ixnextgen, mock_ssh, mock_time):
+ mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
+ mock_traffic_profile.get_traffic_definition.return_value = "64"
+ mock_traffic_profile.params = self.TRAFFIC_PROFILE
+
+ mock_ssh_instance = mock.Mock(autospec=mock_ssh.SSH)
+ mock_ssh_instance.execute.return_value = 0, "", ""
+ mock_ssh_instance.run.return_value = 0, "", ""
+
+ mock_ssh.from_node.return_value = mock_ssh_instance
+
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vnfd["mgmt-interface"].update({
+ 'tg-config': {
+ "ixchassis": "1.1.1.1",
+ "py_bin_path": "/root",
+ }
+ })
+
+ samples = {}
+ name = ''
+ for ifname in range(1):
+ name = "xe{}".format(ifname)
+ samples[name] = {
+ "Rx_Rate_Kbps": 20,
+ "Tx_Rate_Kbps": 20,
+ "Rx_Rate_Mbps": 10,
+ "Tx_Rate_Mbps": 10,
+ "RxThroughput": 10,
+ "TxThroughput": 10,
+ "Valid_Frames_Rx": 1000,
+ "Frames_Tx": 1000,
+ "in_packets": 1000,
+ "out_packets": 1000,
+ }
+
+ samples.update({"CurrentDropPercentage": 0.0})
+
+ last_res = [
+ 0,
+ {
+ "Rx_Rate_Kbps": [20, 20],
+ "Tx_Rate_Kbps": [20, 20],
+ "Rx_Rate_Mbps": [10, 10],
+ "Tx_Rate_Mbps": [10, 10],
+ "CurrentDropPercentage": [0, 0],
+ "RxThroughput": [10, 10],
+ "TxThroughput": [10, 10],
+ "Frames_Tx": [1000, 1000],
+ "in_packets": [1000, 1000],
+ "Valid_Frames_Rx": [1000, 1000],
+ "out_packets": [1000, 1000],
+ },
+ ]
+
+ mock_traffic_profile.execute.return_value = ['Completed', samples]
+ mock_traffic_profile.get_drop_percentage.return_value = ['Completed', samples]
+
+ sut = IxiaTrafficGen(name, vnfd)
+ sut.tg_port_pairs = [[[0], [1]]]
+ sut.vnf_port_pairs = [[[0], [1]]]
+ sut.tc_file_name = self._get_file_abspath(TEST_FILE_YAML)
+ sut.topology = ""
+
+ sut.ssh_helper = mock.Mock()
+ sut._traffic_process = mock.MagicMock()
+ sut.generate_port_pairs = mock.Mock()
+
+ sut._ixia_traffic_gen = mock.MagicMock()
+ sut._ixia_traffic_gen.ix_get_statistics.return_value = last_res
+
+ sut.resource_helper.client = mock.MagicMock()
+ sut.resource_helper.client_started = mock.MagicMock()
+ sut.resource_helper.client_started.value = 1
+
+ sut.scenario_helper.scenario_cfg = {
+ 'options': {
+ 'packetsize': 64,
+ 'traffic_type': 4,
+ 'rfc2544': {
+ 'allowed_drop_rate': '0.8 - 1'
+ },
+ 'vnf__1': {
+ 'rules': 'acl_1rule.yaml',
+ 'vnf_config': {
+ 'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1,
+ },
+ },
+ },
+ 'ixia_profile': {}
+ }
+
+ result = sut._traffic_runner(mock_traffic_profile)
+ self.assertIsNone(result)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
index bca0780dc..7dc303852 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
@@ -18,9 +18,8 @@
from __future__ import absolute_import
import unittest
import mock
-import os
-import multiprocessing
-from multiprocessing import Queue
+
+SSH_HELPER = "yardstick.ssh.SSH"
STL_MOCKS = {
'stl': mock.MagicMock(),
@@ -87,79 +86,146 @@ stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
stl_patch.start()
if stl_patch:
- from yardstick.network_services.vnf_generic.vnf.tg_rfc2544_trex import \
- TrexTrafficGenRFC
+ from yardstick.network_services.vnf_generic.vnf.tg_rfc2544_trex import TrexTrafficGenRFC, \
+ TrexRfcResourceHelper
from yardstick.network_services.vnf_generic.vnf import tg_rfc2544_trex
from yardstick.network_services.traffic_profile.base import TrafficProfile
+ from tests.unit.network_services.vnf_generic.vnf.test_base import FileAbsPath, mock_ssh
+
+MODULE_PATH = FileAbsPath(__file__)
+get_file_abspath = MODULE_PATH.get_path
+
+
+class TestTrexRfcResouceHelper(unittest.TestCase):
+
+ @mock.patch('yardstick.network_services.helpers.samplevnf_helper.MultiPortConfig')
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_trex.time")
+ @mock.patch(SSH_HELPER)
+ def test__run_traffic_once(self, ssh, *_):
+ mock_ssh(ssh)
+
+ mock_traffic_profile = mock.MagicMock(autospec=TrafficProfile,
+ **{'get_drop_percentage.return_value': {}})
+ sut = TrexRfcResourceHelper(mock.MagicMock(), mock.MagicMock())
+ sut.client = mock.MagicMock()
+ sut._run_traffic_once(mock_traffic_profile)
class TestTrexTrafficGenRFC(unittest.TestCase):
- VNFD = {'vnfd:vnfd-catalog':
- {'vnfd':
- [{'short-name': 'VpeVnf',
- 'vdu':
- [{'routing_table':
- [{'network': '152.16.100.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.100.20',
- 'if': 'xe0'},
- {'network': '152.16.40.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.40.20',
- 'if': 'xe1'}],
- 'description': 'VPE approximation using DPDK',
- 'name': 'vpevnf-baremetal',
- 'nd_route_tbl':
- [{'network': '0064:ff9b:0:0:0:0:9810:6414',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
- 'if': 'xe0'},
- {'network': '0064:ff9b:0:0:0:0:9810:2814',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
- 'if': 'xe1'}],
- 'id': 'vpevnf-baremetal',
- 'external-interface':
- [{'virtual-interface':
- {'dst_mac': '00:00:00:00:00:04',
- 'vpci': '0000:05:00.0',
- 'local_ip': '152.16.100.19',
- 'type': 'PCI-PASSTHROUGH',
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '0',
- 'bandwidth': '10 Gbps',
- 'driver': "i40e",
- 'dst_ip': '152.16.100.20',
- 'local_iface_name': 'xe0',
- 'local_mac': '00:00:00:00:00:01'},
- 'vnfd-connection-point-ref': 'xe0',
- 'name': 'xe0'},
- {'virtual-interface':
- {'dst_mac': '00:00:00:00:00:03',
- 'vpci': '0000:05:00.1',
- 'local_ip': '152.16.40.19',
- 'type': 'PCI-PASSTHROUGH',
- 'driver': "i40e",
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '1',
- 'bandwidth': '10 Gbps',
- 'dst_ip': '152.16.40.20',
- 'local_iface_name': 'xe1',
- 'local_mac': '00:00:00:00:00:02'},
- 'vnfd-connection-point-ref': 'xe1',
- 'name': 'xe1'}]}],
- 'description': 'Vpe approximation using DPDK',
- 'mgmt-interface':
- {'vdu-id': 'vpevnf-baremetal',
- 'host': '1.1.1.1',
- 'password': 'r00t',
- 'user': 'root',
- 'ip': '1.1.1.1'},
- 'benchmark':
- {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
- 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
- {'type': 'VPORT', 'name': 'xe1'}],
- 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0',
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1',
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0',
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1',
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'ifname': 'xe0',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'vld_id': 'private_1',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:01',
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0',
+ },
+ {
+ 'virtual-interface': {
+ 'ifname': 'xe1',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'vld_id': 'public_1',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:02'
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1',
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.1.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.1.1.1',
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf',
+ 'name': 'VPEVnfSsh',
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ],
+ },
+ }
TRAFFIC_PROFILE = {
"schema": "isb:traffic_profile:0.1",
@@ -169,240 +235,170 @@ class TestTrexTrafficGenRFC(unittest.TestCase):
"traffic_type": "FixedTraffic",
"frame_rate": 100, # pps
"flow_number": 10,
- "frame_size": 64}}
+ "frame_size": 64,
+ },
+ }
- TC_YAML = {'scenarios': [{'tc_options':
- {'rfc2544': {'allowed_drop_rate': '0.8 - 1'}},
- 'runner': {'duration': 400,
- 'interval': 35, 'type': 'Duration'},
- 'traffic_options':
- {'flow': 'ipv4_1flow_Packets_vpe.yaml',
- 'imix': 'imix_voice.yaml'},
- 'vnf_options': {'vpe': {'cfg': 'vpe_config'}},
- 'traffic_profile': 'ipv4_throughput_vpe.yaml',
- 'type': 'NSPerf',
- 'nodes': {'tg__1': 'trafficgen_1.yardstick',
- 'vnf__1': 'vnf.yardstick'},
- 'topology': 'vpe_vnf_topology.yaml'}],
- 'context': {'nfvi_type': 'baremetal', 'type': 'Node',
- 'name': 'yardstick',
- 'file': '/etc/yardstick/nodes/pod.yaml'},
- 'schema': 'yardstick:task:0.1'}
+ TC_YAML = {
+ 'scenarios': [
+ {
+ 'tc_options': {
+ 'rfc2544': {
+ 'allowed_drop_rate': '0.8 - 1',
+ },
+ },
+ 'runner': {
+ 'duration': 400,
+ 'interval': 35,
+ 'type': 'Duration',
+ },
+ 'traffic_options': {
+ 'flow': 'ipv4_1flow_Packets_vpe.yaml',
+ 'imix': 'imix_voice.yaml',
+ },
+ 'vnf_options': {
+ 'vpe': {
+ 'cfg': 'vpe_config',
+ },
+ },
+ 'traffic_profile': 'ipv4_throughput_vpe.yaml',
+ 'type': 'NSPerf',
+ 'nodes': {
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick',
+ },
+ 'topology': 'vpe_vnf_topology.yaml',
+ },
+ ],
+ 'context': {
+ 'nfvi_type': 'baremetal',
+ 'type': 'Node',
+ 'name': 'yardstick',
+ 'file': '/etc/yardstick/nodes/pod.yaml',
+ },
+ 'schema': 'yardstick:task:0.1',
+ }
- def test___init__(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertIsNotNone(trex_traffic_gen._terminated)
+ @mock.patch(SSH_HELPER)
+ def test___init__(self, ssh):
+ mock_ssh(ssh)
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ self.assertIsNotNone(trex_traffic_gen.resource_helper._terminated.value)
- def test_collect_kpi(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- restult = trex_traffic_gen.collect_kpi()
- self.assertEqual({}, restult)
+ @mock.patch(SSH_HELPER)
+ def test_collect_kpi(self, ssh):
+ mock_ssh(ssh)
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ self.assertIsNone(trex_traffic_gen.collect_kpi())
- def test_listen_traffic(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertEqual(None, trex_traffic_gen.listen_traffic({}))
+ @mock.patch(SSH_HELPER)
+ def test_listen_traffic(self, ssh):
+ mock_ssh(ssh)
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ self.assertIsNone(trex_traffic_gen.listen_traffic({}))
- def test_instantiate(self):
- mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
- mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- trex_traffic_gen._start_server = mock.Mock(return_value=0)
- scenario_cfg = {"tc": "tc_baremetal_rfc2544_ipv4_1flow_64B"}
- tg_rfc2544_trex.WAIT_TIME = 0
- self.assertIn(trex_traffic_gen.instantiate(scenario_cfg, {}), {0, None})
+ @mock.patch(SSH_HELPER)
+ def test_instantiate(self, ssh):
+ mock_ssh(ssh)
- def test_instantiate_error(self):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(1, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- scenario_cfg = {"tc": "tc_baremetal_rfc2544_ipv4_1flow_64B"}
- tg_rfc2544_trex.WAIT_TIME = 0
- self.assertRaises(RuntimeError,
- trex_traffic_gen.instantiate, scenario_cfg, {})
- def test__get_rfc_tolerance(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertEqual([0.8, 1.0],
- trex_traffic_gen._get_rfc_tolerance(self.TC_YAML))
- self.TC_YAML["scenarios"][0]["tc_options"]['rfc2544'][
- 'allowed_drop_rate'] = '0.8'
- self.assertEqual([0.8, 0.8],
- trex_traffic_gen._get_rfc_tolerance(self.TC_YAML))
-
- def test__start_server(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertEqual(None, trex_traffic_gen._start_server())
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen._start_server = mock.Mock(return_value=0)
+ trex_traffic_gen.resource_helper = mock.MagicMock()
+ scenario_cfg = {
+ "tc": "tc_baremetal_rfc2544_ipv4_1flow_64B",
+ "topology": 'nsb_test_case.yaml',
+ 'options': {
+ 'packetsize': 64,
+ 'traffic_type': 4,
+ 'rfc2544': {
+ 'allowed_drop_rate': '0.8 - 1',
+ },
+ 'vnf__1': {
+ 'rules': 'acl_1rule.yaml',
+ 'vnf_config': {
+ 'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1
+ },
+ },
+ },
+ }
+ tg_rfc2544_trex.WAIT_TIME = 3
+ scenario_cfg.update({"nodes": ["tg_1", "vnf_1"]})
+ self.assertIsNone(trex_traffic_gen.instantiate(scenario_cfg, {}))
- def _get_file_abspath(self, filename):
- curr_path = os.path.dirname(os.path.abspath(__file__))
- file_path = os.path.join(curr_path, filename)
- return file_path
+ @mock.patch(SSH_HELPER)
+ def test_instantiate_error(self, ssh):
+ mock_ssh(ssh, exec_result=(1, "", ""))
- @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_trex.time")
- def test__traffic_runner(self, mock_time):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.execute.return_value = "64"
- mock_traffic_profile.get_drop_percentage.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = TrexTrafficGenRFC(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- q = Queue()
- client_started = multiprocessing.Value('i', 1)
- self.sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
- self.sut._connect_client = mock.Mock(autospec=STLClient)
- self.sut._connect_client.get_stats = mock.Mock(return_value="0")
- self.sut.tc_file_name = \
- self._get_file_abspath(
- "tc_baremetal_rfc2544_ipv4_1flow_64B.yaml")
- tg_rfc2544_trex.DURATION = 1
- tg_rfc2544_trex.WAIT_TIME = 0
- self.sut._traffic_runner(mock_traffic_profile, q, client_started,
- self.sut._terminated)
- def test__split_mac_address_into_list(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- result = ['0x00', '0x00', '0x00', '0x00', '0x00', '0x01']
- self.assertEqual(result,
- trex_traffic_gen._split_mac_address_into_list(
- "00:00:00:00:00:01"))
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen.resource_helper = mock.MagicMock()
+ scenario_cfg = {
+ "tc": "tc_baremetal_rfc2544_ipv4_1flow_64B",
+ "nodes": [
+ "tg_1",
+ "vnf_1",
+ ],
+ "topology": 'nsb_test_case.yaml',
+ 'options': {
+ 'packetsize': 64,
+ 'traffic_type': 4,
+ 'rfc2544': {
+ 'allowed_drop_rate': '0.8 - 1',
+ },
+ 'vnf__1': {
+ 'rules': 'acl_1rule.yaml',
+ 'vnf_config': {
+ 'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1,
+ },
+ },
+ },
+ }
+ trex_traffic_gen.instantiate(scenario_cfg, {})
- def test__generate_trex_cfg(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- tg_rfc2544_trex.WAIT_TIME = 0
- self.assertEqual(None, trex_traffic_gen._generate_trex_cfg(vnfd))
+ @mock.patch(SSH_HELPER)
+ def test__start_server(self, ssh):
+ mock_ssh(ssh)
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen.resource_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen._start_server())
- def test_run_traffic(self):
- mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
- mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = TrexTrafficGenRFC(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- self.sut._traffic_runner = mock.Mock(return_value=0)
- client_started = multiprocessing.Value('i', 1)
- result = self.sut.run_traffic(mock_traffic_profile, client_started)
- self.sut._traffic_process.terminate()
- self.assertIsNotNone(result)
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_rfc2544_trex.time")
+ @mock.patch(SSH_HELPER)
+ def test__generate_trex_cfg(self, ssh, _):
+ mock_ssh(ssh)
+
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.resource_helper.generate_cfg())
def test_scale(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
+ with mock.patch(SSH_HELPER) as ssh:
ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
+ ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- flavor = ""
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertRaises(NotImplementedError,
- trex_traffic_gen.scale, flavor)
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen.scale('')
def test_terminate(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- self.assertEqual(None, trex_traffic_gen.terminate())
-
- def test__connect_client(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ with mock.patch(SSH_HELPER) as ssh:
ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
+ ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
- trex_traffic_gen = TrexTrafficGenRFC(vnfd)
- client = mock.Mock(autospec=STLClient)
- client.connect = mock.Mock(return_value=0)
- self.assertIsNotNone(trex_traffic_gen._connect_client(client))
+ trex_traffic_gen = TrexTrafficGenRFC('vnf1', self.VNFD_0)
+ trex_traffic_gen.resource_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.terminate())
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
index a1d4ca161..6fb5d080f 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
@@ -18,9 +18,11 @@
from __future__ import absolute_import
import unittest
import mock
-import multiprocessing
-from multiprocessing import Queue
+from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+
+
+NAME = 'vnf_1'
STL_MOCKS = {
'stl': mock.MagicMock(),
@@ -88,7 +90,7 @@ stl_patch.start()
if stl_patch:
from yardstick.network_services.vnf_generic.vnf.tg_trex import \
- TrexTrafficGen
+ TrexTrafficGen, TrexResourceHelper
from yardstick.network_services.traffic_profile.base import TrafficProfile
@@ -170,202 +172,144 @@ class TestTrexTrafficGen(unittest.TestCase):
"flow_number": 10,
"frame_size": 64}}
- def test___init__(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertIsNotNone(trex_traffic_gen._terminated)
+ @mock.patch("yardstick.ssh.SSH")
+ def test___init__(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ self.assertIsInstance(trex_traffic_gen.resource_helper, TrexResourceHelper)
- def test_collect_kpi(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- trex_traffic_gen._queue.put({})
- restult = trex_traffic_gen.collect_kpi()
- self.assertEqual({}, restult)
+ @mock.patch("yardstick.ssh.SSH")
+ def test_collect_kpi(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.resource_helper._queue.put({})
+ result = trex_traffic_gen.collect_kpi()
+ self.assertEqual({}, result)
- def test_listen_traffic(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertEqual(None, trex_traffic_gen.listen_traffic({}))
+ @mock.patch("yardstick.ssh.SSH")
+ def test_listen_traffic(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ self.assertIsNone(trex_traffic_gen.listen_traffic({}))
- @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_trex.time")
- def test_instantiate(self, mock_time):
- mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
- mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertIn(trex_traffic_gen.instantiate({}, {}), {0, None})
+ @mock.patch("yardstick.ssh.SSH")
+ def test_instantiate(self, ssh):
+ mock_ssh(ssh)
- @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_trex.time")
- def test_instantiate_error(self, mock_time):
- mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
- mock_traffic_profile.get_traffic_definition.return_value = "64"
- mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(1, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertRaises(RuntimeError,
- trex_traffic_gen.instantiate, {}, {})
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen._start_server = mock.Mock(return_value=0)
+ trex_traffic_gen._tg_process = mock.MagicMock()
+ trex_traffic_gen._tg_process.start = mock.Mock()
+ trex_traffic_gen._tg_process.exitcode = 0
+ trex_traffic_gen._tg_process._is_alive = mock.Mock(return_value=1)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.instantiate({}, {}))
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_instantiate_error(self, ssh):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen._start_server = mock.Mock(return_value=0)
+ trex_traffic_gen._tg_process = mock.MagicMock()
+ trex_traffic_gen._tg_process.start = mock.Mock()
+ trex_traffic_gen._tg_process._is_alive = mock.Mock(return_value=0)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.instantiate({}, {}))
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test__start_server(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen._start_server())
- def test__start_server(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertEqual(None, trex_traffic_gen._start_server())
+ @mock.patch("yardstick.ssh.SSH")
+ def test__traffic_runner(self, ssh):
+ mock_ssh(ssh)
- @mock.patch("yardstick.network_services.vnf_generic.vnf.tg_trex.time")
- def test__traffic_runner(self, mock_time):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.execute.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = TrexTrafficGen(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- q = Queue()
- client_started = multiprocessing.Value('i', 1)
- self.sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
- self.sut._connect_client = mock.Mock(autospec=STLClient)
- self.sut._connect_client.get_stats = mock.Mock(return_value="0")
- self.sut._traffic_runner(mock_traffic_profile, q, client_started,
- self.sut._terminated)
- def test__generate_trex_cfg(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertEqual(None, trex_traffic_gen._generate_trex_cfg(vnfd))
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.sut = TrexTrafficGen(NAME, vnfd)
+ self.sut.ssh_helper = mock.Mock()
+ self.sut.ssh_helper.run = mock.Mock()
+ self.sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
+ self.sut._connect_client = mock.Mock(autospec=STLClient)
+ self.sut._connect_client.get_stats = mock.Mock(return_value="0")
+ self.sut.resource_helper.RUN_DURATION = 0
+ self.sut.resource_helper.QUEUE_WAIT_TIME = 0
+ self.sut._traffic_runner(mock_traffic_profile)
- def test__split_mac_address_into_list(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- result = ['0x00', '0x00', '0x00', '0x00', '0x00', '0x01']
- self.assertEqual(
- result, trex_traffic_gen._split_mac_address_into_list(
- "00:00:00:00:00:01"))
+ @mock.patch("yardstick.ssh.SSH")
+ def test__generate_trex_cfg(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.resource_helper.generate_cfg())
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_run_traffic(self, ssh):
+ mock_ssh(ssh)
- def test_run_traffic(self):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- self.sut = TrexTrafficGen(vnfd)
- self.sut.connection = mock.Mock()
- self.sut.connection.run = mock.Mock()
- self.sut._traffic_runner = mock.Mock(return_value=0)
- self.sut.client_started.value = 1
- result = self.sut.run_traffic(mock_traffic_profile)
- self.sut._traffic_process.terminate()
- self.assertIsNotNone(result)
- def test_scale(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(1, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- flavor = ""
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertRaises(NotImplementedError,
- trex_traffic_gen.scale, flavor)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ self.sut = TrexTrafficGen(NAME, vnfd)
+ self.sut.ssh_helper = mock.Mock()
+ self.sut.ssh_helper.run = mock.Mock()
+ self.sut._traffic_runner = mock.Mock(return_value=0)
+ self.sut.resource_helper.client_started.value = 1
+ result = self.sut.run_traffic(mock_traffic_profile)
+ self.sut._traffic_process.terminate()
+ self.assertIsNotNone(result)
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_scale(self, ssh):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.scale('')
+
+ @mock.patch("yardstick.ssh.SSH")
+ def test_setup_vnf_environment(self, ssh):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ self.assertIsNone(trex_traffic_gen.setup_helper.setup_vnf_environment())
- def test_setup_vnf_environment(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(1, "", ""))
- ssh.from_node.return_value = ssh_mock
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertEqual(
- None, trex_traffic_gen.setup_vnf_environment(ssh_mock))
+ @mock.patch("yardstick.ssh.SSH")
+ def test_terminate(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ trex_traffic_gen.ssh_helper = mock.MagicMock()
+ trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
+ self.assertIsNone(trex_traffic_gen.terminate())
- def test_terminate(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- trex_traffic_gen = TrexTrafficGen(vnfd)
- self.assertEqual(None, trex_traffic_gen.terminate())
+ @mock.patch("yardstick.ssh.SSH")
+ def test__connect_client(self, ssh):
+ mock_ssh(ssh)
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
+ client = mock.Mock(autospec=STLClient)
+ client.connect = mock.Mock(return_value=0)
+ self.assertIsNotNone(trex_traffic_gen.resource_helper._connect(client))
- def test__connect_client(self):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- trex_traffic_gen = TrexTrafficGen(vnfd)
- client = mock.Mock(autospec=STLClient)
- client.connect = mock.Mock(return_value=0)
- self.assertIsNotNone(trex_traffic_gen._connect_client(client))
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
new file mode 100644
index 000000000..08bf06b74
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
@@ -0,0 +1,467 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+import unittest
+import mock
+import os
+
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.udp_replay import UdpReplayApproxVnf
+ from yardstick.network_services.vnf_generic.vnf import udp_replay
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+
+NAME = "tg__1"
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Process")
+class TestAclApproxVnf(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'UdpReplayApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ scenario_cfg = {'options': {'packetsize': 64, 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ },
+ 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
+ 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
+ 'runner': {'object': 'NetworkServiceTestCase',
+ 'interval': 35,
+ 'output_filename': '/tmp/yardstick.out',
+ 'runner_id': 74476, 'duration': 400,
+ 'type': 'Duration'},
+ 'traffic_profile': 'ipv4_throughput_acl.yaml',
+ 'traffic_options': {'flow': 'ipv4_Packets_acl.yaml',
+ 'imix': 'imix_voice.yaml'},
+ 'type': 'ISB',
+ 'nodes': {'tg__2': 'trafficgen_2.yardstick',
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick'},
+ 'topology': 'vpe-tg-topology-baremetal.yaml'}
+
+ context_cfg = {'nodes': {'trafficgen_2.yardstick':
+ {'member-vnf-index': '3',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_2.yardstick',
+ 'vnfd-id-ref': 'tg__2',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens513f0',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.20',
+ 'dst_mac': '00:00:00:00:00:01',
+ 'local_mac': '00:00:00:00:00:03',
+ 'dst_ip': '152.16.40.19',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens513f1',
+ 'netmask': '255.255.255.0',
+ 'network': '202.16.100.0',
+ 'local_ip': '202.16.100.20',
+ 'local_mac': '00:1e:67:d0:60:5d',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'l3fwd_vnf.yaml',
+ 'user': 'root'},
+ 'trafficgen_1.yardstick':
+ {'member-vnf-index': '1',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_1.yardstick',
+ 'vnfd-id-ref': 'tg__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens785f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.20',
+ 'dst_mac': '00:00:00:00:00:02',
+ 'local_mac': '00:00:00:00:00:04',
+ 'dst_ip': '152.16.100.19',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens785f1',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.21',
+ 'local_mac': '00:00:00:00:00:01',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'tg_rfc2544_tpl.yaml',
+ 'user': 'root'},
+ 'vnf__1':
+ {'name': 'vnf.yardstick',
+ 'vnfd-id-ref': 'vnf__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens786f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.19',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'local_mac': '00:00:00:00:00:02',
+ 'dst_ip': '152.16.100.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens786f1',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.19',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'local_mac': '00:00:00:00:00:01',
+ 'dst_ip': '152.16.40.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'routing_table':
+ [{'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'network': '152.16.100.20',
+ 'if': 'xe0'},
+ {'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'network': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'member-vnf-index': '2',
+ 'host': '1.2.1.1',
+ 'role': 'vnf',
+ 'user': 'root',
+ 'nd_route_tbl':
+ [{'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'password': 'r00t',
+ 'VNF model': 'udp_replay.yaml'}}}
+
+ def test___init__(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ self.assertIsNone(udp_approx_vnf._vnf_process)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_collect_kpi(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ result = "stats\r\r\n\r\nUDP_Replay stats:\r\n--------------\r\n" \
+ "Port\t\tRx Packet\t\tTx Packet\t\tRx Pkt Drop\t\tTx Pkt Drop \r\n"\
+ "0\t\t7374156\t\t7374136\t\t\t0\t\t\t0\r\n" \
+ "1\t\t7374316\t\t7374315\t\t\t0\t\t\t0\r\n\r\nReplay>\r\r\nReplay>"
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ udp_approx_vnf.q_in = mock.MagicMock()
+ udp_approx_vnf.q_out = mock.MagicMock()
+ udp_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ udp_approx_vnf.all_ports = [0, 1]
+ udp_approx_vnf.interfaces = vnfd["vdu"][0]['external-interface']
+ udp_approx_vnf.get_stats = mock.Mock(return_value=result)
+ result = {'collect_stats': {}, 'packets_dropped': 0,
+ 'packets_fwd': 14748451, 'packets_in': 14748472}
+ self.assertEqual(result, udp_approx_vnf.collect_kpi())
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_vnf_execute_command(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ cmd = "quit"
+ self.assertEqual("", udp_approx_vnf.vnf_execute(cmd))
+
+ def test_get_stats(self, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ udp_approx_vnf.q_in = mock.MagicMock()
+ udp_approx_vnf.q_out = mock.MagicMock()
+ udp_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ mock_result = \
+ "CG-NAPT(.*\n)*Received 100, Missed 0, Dropped 0,Translated 100,ingress"
+ udp_approx_vnf.vnf_execute = mock.Mock(return_value=mock_result)
+ self.assertEqual(mock_result,
+ udp_approx_vnf.get_stats())
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.udp_replay.open')
+ def test__build_pipeline_kwargs(self, mock_open, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ udp_approx_vnf._build_config = mock.MagicMock()
+ udp_approx_vnf.queue_wrapper = mock.MagicMock()
+ udp_approx_vnf.nfvi_type = "baremetal"
+ udp_approx_vnf.bound_pci = []
+ udp_approx_vnf.all_ports = [0, 1]
+ udp_approx_vnf.ssh_helper = mock.MagicMock(
+ **{"provision_tool.return_value": "tool_path"})
+ udp_approx_vnf.vnf_cfg = {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1}
+ udp_approx_vnf.options = {'traffic_type': '4',
+ 'topology': 'nsb_test_case.yaml'}
+
+ udp_approx_vnf._build_pipeline_kwargs()
+ self.assertEqual(udp_approx_vnf.pipeline_kwargs, {
+ 'config': '(0, 0, 1)(1, 0, 2)',
+ 'cpu_mask_hex': '0x6',
+ 'hw_csum': '',
+ 'ports_len_hex': '0x3',
+ 'tool_path': 'tool_path',
+ 'whitelist': ''
+ })
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.udp_replay.hex")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.udp_replay.eval")
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.udp_replay.open')
+ def test_run_udp_replay(self, mock_open, eval, hex, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ udp_approx_vnf._build_config = mock.MagicMock()
+ udp_approx_vnf.queue_wrapper = mock.MagicMock()
+ udp_approx_vnf.ssh_helper = mock.MagicMock()
+ udp_approx_vnf.ssh_helper.run = mock.MagicMock()
+ udp_approx_vnf.vnf_cfg = {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1}
+ udp_approx_vnf.options = {'traffic_type': '4',
+ 'topology': 'nsb_test_case.yaml'}
+
+ udp_approx_vnf._run()
+ udp_approx_vnf.ssh_helper.run.assert_called_once()
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
+ def test_instantiate(self, Context, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ self.scenario_cfg['vnf_options'] = {'cgnapt': {'cfg': "",
+ 'rules': ""}}
+ udp_approx_vnf._run_udp_replay = mock.Mock(return_value=0)
+ udp_approx_vnf._parse_rule_file = mock.Mock(return_value={})
+ udp_approx_vnf.deploy_udp_replay_vnf = mock.Mock(return_value=1)
+ udp_approx_vnf.q_out.put("Replay>")
+ udp_approx_vnf.get_my_ports = mock.Mock(return_value=[0, 1])
+ udp_replay.WAIT_TIME = 3
+ udp_approx_vnf.get_nfvi_type = mock.Mock(return_value="baremetal")
+
+ udp_approx_vnf._vnf_process = mock.MagicMock()
+ udp_approx_vnf._vnf_process.is_alive = \
+ mock.Mock(return_value=1)
+ self.assertIsNone(udp_approx_vnf.instantiate(self.scenario_cfg,
+ self.context_cfg))
+
+ def test_scale(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ flavor = ""
+ self.assertRaises(NotImplementedError, udp_approx_vnf.scale, flavor)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_terminate(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
+ udp_approx_vnf._vnf_process = mock.MagicMock()
+ udp_approx_vnf._vnf_process.terminate = mock.Mock()
+ udp_approx_vnf.used_drivers = {"01:01.0": "i40e",
+ "01:01.1": "i40e"}
+ udp_approx_vnf.execute_command = mock.Mock()
+ udp_approx_vnf.ssh_helper = ssh_mock
+ udp_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py"
+ self.assertEqual(None, udp_approx_vnf.terminate())
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
new file mode 100644
index 000000000..d817b164c
--- /dev/null
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
@@ -0,0 +1,447 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# 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.
+#
+
+from __future__ import absolute_import
+import unittest
+import mock
+import os
+
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.vfw_vnf import FWApproxVnf
+ from yardstick.network_services.nfvi.resource import ResourceProfile
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+
+name = 'vnf__1'
+
+
+@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Process")
+class TestFWApproxVnf(unittest.TestCase):
+ VNFD = {'vnfd:vnfd-catalog':
+ {'vnfd':
+ [{'short-name': 'VpeVnf',
+ 'vdu':
+ [{'routing_table':
+ [{'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0'},
+ {'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl':
+ [{'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface':
+ [{'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02'},
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0'},
+ {'virtual-interface':
+ {'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01'},
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1'}]}],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface':
+ {'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1'},
+ 'benchmark':
+ {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
+ 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
+ {'type': 'VPORT', 'name': 'xe1'}],
+ 'id': 'FWApproxVnf', 'name': 'VPEVnfSsh'}]}}
+
+ scenario_cfg = {'options': {'packetsize': 64, 'traffic_type': 4,
+ 'rfc2544': {'allowed_drop_rate': '0.8 - 1'},
+ 'vnf__1': {'rules': 'acl_1rule.yaml',
+ 'vnf_config': {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1}}
+ },
+ 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
+ 'task_path': '/tmp',
+ 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
+ 'runner': {'object': 'NetworkServiceTestCase',
+ 'interval': 35,
+ 'output_filename': '/tmp/yardstick.out',
+ 'runner_id': 74476, 'duration': 400,
+ 'type': 'Duration'},
+ 'traffic_profile': 'ipv4_throughput_vfw.yaml',
+ 'traffic_options': {'flow': 'ipv4_Packets_vfw.yaml',
+ 'imix': 'imix_voice.yaml'},
+ 'type': 'ISB',
+ 'nodes': {'tg__2': 'trafficgen_2.yardstick',
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick'},
+ 'topology': 'vpe-tg-topology-baremetal.yaml'}
+
+ context_cfg = {'nodes': {'tg__2':
+ {'member-vnf-index': '3',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_2.yardstick',
+ 'vnfd-id-ref': 'tg__2',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens513f0',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.20',
+ 'dst_mac': '00:00:00:00:00:01',
+ 'local_mac': '00:00:00:00:00:03',
+ 'dst_ip': '152.16.40.19',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens513f1',
+ 'netmask': '255.255.255.0',
+ 'network': '202.16.100.0',
+ 'local_ip': '202.16.100.20',
+ 'local_mac': '00:1e:67:d0:60:5d',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'l3fwd_vnf.yaml',
+ 'user': 'root'},
+ 'tg__1':
+ {'member-vnf-index': '1',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_1.yardstick',
+ 'vnfd-id-ref': 'tg__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens785f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.20',
+ 'dst_mac': '00:00:00:00:00:02',
+ 'local_mac': '00:00:00:00:00:04',
+ 'dst_ip': '152.16.100.19',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens785f1',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.21',
+ 'local_mac': '00:00:00:00:00:01',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'password': 'r00t',
+ 'VNF model': 'tg_rfc2544_tpl.yaml',
+ 'user': 'root'},
+ 'vnf__1':
+ {'name': 'vnf.yardstick',
+ 'vnfd-id-ref': 'vnf__1',
+ 'ip': '1.2.1.1',
+ 'interfaces':
+ {'xe0': {'local_iface_name': 'ens786f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.19',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'local_mac': '00:00:00:00:00:02',
+ 'dst_ip': '152.16.100.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0},
+ 'xe1': {'local_iface_name': 'ens786f1',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.19',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'local_mac': '00:00:00:00:00:01',
+ 'dst_ip': '152.16.40.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1}},
+ 'routing_table':
+ [{'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'network': '152.16.100.20',
+ 'if': 'xe0'},
+ {'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'network': '152.16.40.20',
+ 'if': 'xe1'}],
+ 'member-vnf-index': '2',
+ 'host': '1.2.1.1',
+ 'role': 'vnf',
+ 'user': 'root',
+ 'nd_route_tbl':
+ [{'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0'},
+ {'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1'}],
+ 'password': 'r00t',
+ 'VNF model': 'vfw_vnf.yaml'}}}
+
+ def test___init__(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ self.assertIsNone(vfw_approx_vnf._vnf_process)
+
+ STATS = """\
+p vfw stats
+
+VFW Stats
+{"VFW_counters" : {"id" : "PIPELINE4", " pkts_received": 6007180, " pkts_fw_forwarded": 6007180, " pkts_drop_fw": 0, " pkts_acl_forwarded": 6007180, "pkts_drop_without_rule" : 0, "average_pkts_in_batch" : 31, "average_internal_time_in_clocks" : 17427, "average_external_time_in_clocks" : 261120, "total_time_measures" : 189829, "ct_packets_forwarded" : 6007148, "ct_packets_dropped" : 0, "bytes_processed ": 360430800, "ct_sessions" : {"active" : 130050, "open_attempt" : 130050, "re-open_attempt" : 0, "established" : 0, "closed" : 0, "timeout" : 0}, "ct_drops" : {"out_of_window" : 0, "invalid_conn" : 0, "invalid_state_transition" : 0 "RST" : 0}}
+VFW TOTAL: pkts_received: 6007180, "pkts_fw_forwarded": 6007180, "pkts_drop_fw": 0, "fw_drops" : {"TTL_zero" : 0, "bad_size" : 0, "fragmented_packet" : 0, "unsupported_packet_types" : 0, "no_arp_entry" : 6007180}, "pkts_acl_forwarded": 6007180, "pkts_drop_without_rule": 0, "packets_last_sec" : 0, "average_packets_per_sec" : 0, "bytes_last_sec" : 0, "average_bytes_per_sec" : 0, "bytes_processed ": 360430800
+"CT TOTAL: ct_packets_forwarded" : 6007180, " ct_packets_dropped" : 0, "ct_sessions" : {"active" : 130050, "open_attempt" : 130050, "re-open_attempt" : 0, "established" : 0, "closed" : 0, "timeout" : 0}, "ct_drops" : {"out_of_window" : 0, "invalid_conn" : 0, "invalid_state_transition" : 0 "RST" : 0}
+Action ID: 00, packetCount: 2954633, byteCount: 177277980
+Action ID: 01, packetCount: 3052547, byteCount: 183152820
+pipeline>
+
+pipeline>
+""" # noqa
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_collect_kpi(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf.q_in = mock.MagicMock()
+ vfw_approx_vnf.q_out = mock.MagicMock()
+ vfw_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ vfw_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
+ vfw_approx_vnf.resource_helper = mock.MagicMock(
+ **{'collect_kpi.return_value': {"core": {}}})
+ vfw_approx_vnf.vnf_execute = mock.Mock(return_value=self.STATS)
+ result = {
+ 'packets_dropped': 0,
+ 'packets_fwd': 6007180,
+ 'packets_in': 6007180,
+ 'collect_stats': {'core': {}},
+ }
+ self.assertEqual(result, vfw_approx_vnf.collect_kpi())
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_vnf_execute_command(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf.q_in = mock.MagicMock()
+ vfw_approx_vnf.q_out = mock.MagicMock()
+ vfw_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ cmd = "quit"
+ self.assertEqual("", vfw_approx_vnf.vnf_execute(cmd))
+
+ def test_get_stats(self, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf.q_in = mock.MagicMock()
+ vfw_approx_vnf.q_out = mock.MagicMock()
+ vfw_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ vfw_approx_vnf.vnf_execute = mock.Mock(return_value=self.STATS)
+ self.assertEqual(self.STATS, vfw_approx_vnf.get_stats())
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.hex")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.eval")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.open")
+ def test_run_vfw(self, mock_open, eval, hex, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh_mock.run = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf._build_config = mock.MagicMock()
+ vfw_approx_vnf.queue_wrapper = mock.MagicMock()
+ vfw_approx_vnf.ssh_helper = mock.MagicMock()
+ vfw_approx_vnf.ssh_helper.run = mock.MagicMock()
+ vfw_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
+ vfw_approx_vnf.vnf_cfg = {'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1}
+ vfw_approx_vnf.all_options = {'traffic_type': '4',
+ 'topology': 'nsb_test_case.yaml'}
+ vfw_approx_vnf._run()
+ vfw_approx_vnf.ssh_helper.run.assert_called_once()
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.YangModel")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.find_relative_file")
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
+ def test_instantiate(self, Context, mock_yang, mock_find, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf.ssh_helper = ssh
+ vfw_approx_vnf.deploy_helper = mock.MagicMock()
+ vfw_approx_vnf.resource_helper = mock.MagicMock()
+ vfw_approx_vnf._build_config = mock.MagicMock()
+ self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
+ 'rules': ""}}
+ self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
+ self.assertIsNone(vfw_approx_vnf.instantiate(self.scenario_cfg,
+ self.context_cfg))
+
+ def test_scale(self, mock_process):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ flavor = ""
+ self.assertRaises(NotImplementedError, vfw_approx_vnf.scale, flavor)
+
+ @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time")
+ def test_terminate(self, mock_time, mock_process):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "", ""))
+ ssh.from_node.return_value = ssh_mock
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ vfw_approx_vnf = FWApproxVnf(name, vnfd)
+ vfw_approx_vnf._vnf_process = mock.MagicMock()
+ vfw_approx_vnf._vnf_process.terminate = mock.Mock()
+ vfw_approx_vnf.used_drivers = {"01:01.0": "i40e",
+ "01:01.1": "i40e"}
+ vfw_approx_vnf.vnf_execute = mock.Mock()
+ vfw_approx_vnf.ssh_helper = ssh_mock
+ vfw_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py"
+ vfw_approx_vnf._resource_collect_stop = mock.Mock()
+ self.assertEqual(None, vfw_approx_vnf.terminate())
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
index 54934c2fe..80b4a5108 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
@@ -20,334 +20,694 @@ from __future__ import absolute_import
import os
import unittest
+import six.moves.configparser as configparser
import mock
+from multiprocessing import Process, Queue
-from yardstick.network_services.nfvi.resource import ResourceProfile
-from yardstick.network_services.vnf_generic.vnf import vpe_vnf
-from yardstick.network_services.vnf_generic.vnf.base import \
- QueueFileWrapper
-from yardstick.network_services.vnf_generic.vnf.vpe_vnf import VpeApproxVnf
+from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper
+SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
-@mock.patch('yardstick.network_services.vnf_generic.vnf.vpe_vnf.time')
+STL_MOCKS = {
+ 'stl': mock.MagicMock(),
+ 'stl.trex_stl_lib': mock.MagicMock(),
+ 'stl.trex_stl_lib.base64': mock.MagicMock(),
+ 'stl.trex_stl_lib.binascii': mock.MagicMock(),
+ 'stl.trex_stl_lib.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.copy': mock.MagicMock(),
+ 'stl.trex_stl_lib.datetime': mock.MagicMock(),
+ 'stl.trex_stl_lib.functools': mock.MagicMock(),
+ 'stl.trex_stl_lib.imp': mock.MagicMock(),
+ 'stl.trex_stl_lib.inspect': mock.MagicMock(),
+ 'stl.trex_stl_lib.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.linecache': mock.MagicMock(),
+ 'stl.trex_stl_lib.math': mock.MagicMock(),
+ 'stl.trex_stl_lib.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.platform': mock.MagicMock(),
+ 'stl.trex_stl_lib.pprint': mock.MagicMock(),
+ 'stl.trex_stl_lib.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.socket': mock.MagicMock(),
+ 'stl.trex_stl_lib.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.struct': mock.MagicMock(),
+ 'stl.trex_stl_lib.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.threading': mock.MagicMock(),
+ 'stl.trex_stl_lib.time': mock.MagicMock(),
+ 'stl.trex_stl_lib.traceback': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'stl.trex_stl_lib.types': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.common': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.json': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.os': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.random': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.re': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.string': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'stl.trex_stl_lib.warnings': mock.MagicMock(),
+ 'stl.trex_stl_lib.yaml': mock.MagicMock(),
+ 'stl.trex_stl_lib.zlib': mock.MagicMock(),
+ 'stl.trex_stl_lib.zmq': mock.MagicMock(),
+}
+
+STLClient = mock.MagicMock()
+stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
+stl_patch.start()
+
+if stl_patch:
+ from yardstick.network_services.vnf_generic.vnf.vpe_vnf import ConfigCreate
+ from yardstick.network_services.nfvi.resource import ResourceProfile
+ from yardstick.network_services.vnf_generic.vnf import vpe_vnf
+ from yardstick.network_services.vnf_generic.vnf.vpe_vnf import VpeApproxVnf
+
+from tests.unit.network_services.vnf_generic.vnf.test_base import FileAbsPath
+from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
+
+
+TEST_FILE_YAML = 'nsb_test_case.yaml'
+
+NAME = 'vnf_1'
+
+PING_OUTPUT_1 = "Pkts in: 101\r\n\tPkts dropped by AH: 100\r\n\tPkts dropped by other: 100"
+
+MODULE_PATH = FileAbsPath(__file__)
+get_file_abspath = MODULE_PATH.get_path
+
+
+class TestConfigCreate(unittest.TestCase):
+
+ def test___init__(self):
+ config_create = ConfigCreate([0], [1], 2)
+ self.assertEqual(config_create.priv_ports, [0])
+ self.assertEqual(config_create.pub_ports, [1])
+ self.assertEqual(config_create.socket, 2)
+
+ def test_vpe_initialize(self):
+ config_create = ConfigCreate([0], [1], 2)
+ config = configparser.ConfigParser()
+ config_create.vpe_initialize(config)
+ self.assertEqual(config.get('EAL', 'log_level'), '0')
+ self.assertEqual(config.get('PIPELINE0', 'type'), 'MASTER')
+ self.assertEqual(config.get('PIPELINE0', 'core'), 's2C0')
+ self.assertEqual(config.get('MEMPOOL0', 'pool_size'), '256K')
+ self.assertEqual(config.get('MEMPOOL1', 'pool_size'), '2M')
+
+ def test_vpe_rxq(self):
+ config_create = ConfigCreate([0], [1, 2], 3)
+ config = configparser.ConfigParser()
+ config_create.vpe_rxq(config)
+ self.assertEqual(config.get('RXQ1.0', 'mempool'), 'MEMPOOL1')
+ self.assertEqual(config.get('RXQ2.0', 'mempool'), 'MEMPOOL1')
+
+ def test_get_sink_swq(self):
+ config_create = ConfigCreate([0], [1], 2)
+ config = configparser.ConfigParser()
+ config.add_section('PIPELINE0')
+ config.set('PIPELINE0', 'key1', 'value1')
+ config.set('PIPELINE0', 'key2', 'value2 SINK')
+ config.set('PIPELINE0', 'key3', 'TM value3')
+ config.set('PIPELINE0', 'key4', 'value4')
+ config.set('PIPELINE0', 'key5', 'the SINK value5')
+
+ self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key1', 5), 'SWQ-1')
+ self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key2', 5), 'SWQ-1 SINK0')
+ self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key3', 5), 'SWQ-1 TM5')
+ config_create.sw_q += 1
+ self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key4', 5), 'SWQ0')
+ self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key5', 5), 'SWQ0 SINK1')
+
+ def test_generate_vpe_script(self):
+ vpe_config_vnf = ConfigCreate([0], [0], 0)
+ intf = [
+ {
+ "virtual-interface": {
+ "dst_ip": "1.1.1.1",
+ "dst_mac": "00:00:00:00:00:00:02",
+ },
+ },
+ ]
+ result = vpe_config_vnf.generate_vpe_script(intf)
+ self.assertIsInstance(result, str)
+ self.assertNotEqual(result, '')
+
+ def test_create_vpe_config(self):
+ priv_ports = [
+ {
+ 'index': 0,
+ 'dpdk_port_num': 1,
+ 'peer_intf': {
+ 'dpdk_port_num': 2,
+ 'index': 3,
+ },
+ },
+ ]
+
+ pub_ports = [
+ {
+ 'index': 2,
+ 'dpdk_port_num': 3,
+ 'peer_intf': {
+ 'dpdk_port_num': 0,
+ 'index': 1,
+ },
+ },
+ ]
+
+ config_create = ConfigCreate(priv_ports, pub_ports, 23)
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config"
+ vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg)
+ config_create.create_vpe_config(vnf_cfg)
+ os.system("git checkout -- %s" % vnf_cfg)
+
+
+@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
class TestVpeApproxVnf(unittest.TestCase):
- VNFD = {'vnfd:vnfd-catalog':
- {'vnfd':
- [{'short-name': 'VpeVnf',
- 'vdu':
- [{'routing_table':
- [{'network': '152.16.100.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.100.20',
- 'if': 'xe0'},
- {'network': '152.16.40.20',
- 'netmask': '255.255.255.0',
- 'gateway': '152.16.40.20',
- 'if': 'xe1'}],
- 'description': 'VPE approximation using DPDK',
- 'name': 'vpevnf-baremetal',
- 'nd_route_tbl':
- [{'network': '0064:ff9b:0:0:0:0:9810:6414',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
- 'if': 'xe0'},
- {'network': '0064:ff9b:0:0:0:0:9810:2814',
- 'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
- 'if': 'xe1'}],
- 'id': 'vpevnf-baremetal',
- 'external-interface':
- [{'virtual-interface':
- {'dst_mac': '00:00:00:00:00:04',
- 'vpci': '0000:05:00.0',
- 'local_ip': '152.16.100.19',
- 'type': 'PCI-PASSTHROUGH',
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '0',
- 'bandwidth': '10 Gbps',
- 'driver': "i40e",
- 'dst_ip': '152.16.100.20',
- 'local_iface_name': 'xe0',
- 'local_mac': '00:00:00:00:00:02'},
- 'vnfd-connection-point-ref': 'xe0',
- 'name': 'xe0'},
- {'virtual-interface':
- {'dst_mac': '00:00:00:00:00:03',
- 'vpci': '0000:05:00.1',
- 'local_ip': '152.16.40.19',
- 'type': 'PCI-PASSTHROUGH',
- 'driver': "i40e",
- 'netmask': '255.255.255.0',
- 'dpdk_port_num': '1',
- 'bandwidth': '10 Gbps',
- 'dst_ip': '152.16.40.20',
- 'local_iface_name': 'xe1',
- 'local_mac': '00:00:00:00:00:01'},
- 'vnfd-connection-point-ref': 'xe1',
- 'name': 'xe1'}]}],
- 'description': 'Vpe approximation using DPDK',
- 'mgmt-interface':
- {'vdu-id': 'vpevnf-baremetal',
- 'host': '1.2.1.1',
- 'password': 'r00t',
- 'user': 'root',
- 'ip': '1.2.1.1'},
- 'benchmark':
- {'kpi': ['packets_in', 'packets_fwd', 'packets_dropped']},
- 'connection-point': [{'type': 'VPORT', 'name': 'xe0'},
- {'type': 'VPORT', 'name': 'xe1'}],
- 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'}]}}
-
- scenario_cfg = {'tc_options': {'rfc2544':
- {'allowed_drop_rate': '0.8 - 1'}},
- 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
- 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
- 'runner': {'object': 'NetworkServiceTestCase',
- 'interval': 35,
- 'output_filename': '/tmp/yardstick.out',
- 'runner_id': 74476, 'duration': 400,
- 'type': 'Duration'},
- 'traffic_profile': 'ipv4_throughput_vpe.yaml',
- 'traffic_options': {'flow': 'ipv4_Packets_vpe.yaml',
- 'imix': 'imix_voice.yaml'},
- 'type': 'ISB',
- 'nodes': {'tg__2': 'trafficgen_2.yardstick',
- 'tg__1': 'trafficgen_1.yardstick',
- 'vnf__1': 'vnf.yardstick'},
- 'topology': 'vpe-tg-topology-baremetal.yaml'}
-
- context_cfg = {'nodes': {'tg__2':
- {'member-vnf-index': '3',
- 'role': 'TrafficGen',
- 'name': 'trafficgen_2.yardstick',
- 'vnfd-id-ref': 'tg__2',
- 'ip': '1.2.1.1',
- 'interfaces':
- {'xe0': {'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
- 'netmask': '255.255.255.0',
- 'local_ip': '152.16.40.20',
- 'dst_mac': '00:00:00:00:00:01',
- 'local_mac': '00:00:00:00:00:03',
- 'dst_ip': '152.16.40.19',
- 'driver': 'ixgbe',
- 'vpci': '0000:02:00.0',
- 'dpdk_port_num': 0},
- 'xe1': {'local_iface_name': 'ens513f1',
- 'netmask': '255.255.255.0',
- 'network': '202.16.100.0',
- 'local_ip': '202.16.100.20',
- 'local_mac': '00:1e:67:d0:60:5d',
- 'driver': 'ixgbe',
- 'vpci': '0000:02:00.1',
- 'dpdk_port_num': 1}},
- 'password': 'r00t',
- 'VNF model': 'l3fwd_vnf.yaml',
- 'user': 'root'},
- 'tg__1':
- {'member-vnf-index': '1',
- 'role': 'TrafficGen',
- 'name': 'trafficgen_1.yardstick',
- 'vnfd-id-ref': 'tg__1',
- 'ip': '1.2.1.1',
- 'interfaces':
- {'xe0': {'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
- 'netmask': '255.255.255.0',
- 'local_ip': '152.16.100.20',
- 'dst_mac': '00:00:00:00:00:02',
- 'local_mac': '00:00:00:00:00:04',
- 'dst_ip': '152.16.100.19',
- 'driver': 'i40e',
- 'vpci': '0000:05:00.0',
- 'dpdk_port_num': 0},
- 'xe1': {'local_iface_name': 'ens785f1',
- 'netmask': '255.255.255.0',
- 'local_ip': '152.16.100.21',
- 'local_mac': '00:00:00:00:00:01',
- 'driver': 'i40e',
- 'vpci': '0000:05:00.1',
- 'dpdk_port_num': 1}},
- 'password': 'r00t',
- 'VNF model': 'tg_rfc2544_tpl.yaml',
- 'user': 'root'},
- 'vnf__1':
- {'name': 'vnf.yardstick',
- 'vnfd-id-ref': 'vnf__1',
- 'ip': '1.2.1.1',
- 'interfaces':
- {'xe0': {'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
- 'netmask': '255.255.255.0',
- 'local_ip': '152.16.100.19',
- 'dst_mac': '00:00:00:00:00:04',
- 'local_mac': '00:00:00:00:00:02',
- 'dst_ip': '152.16.100.20',
- 'driver': 'i40e',
- 'vpci': '0000:05:00.0',
- 'dpdk_port_num': 0},
- 'xe1': {'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
- 'netmask': '255.255.255.0',
- 'local_ip': '152.16.40.19',
- 'dst_mac': '00:00:00:00:00:03',
- 'local_mac': '00:00:00:00:00:01',
- 'dst_ip': '152.16.40.20',
- 'driver': 'i40e',
- 'vpci': '0000:05:00.1',
- 'dpdk_port_num': 1}},
- 'routing_table':
- [{'netmask': '255.255.255.0',
- 'gateway': '152.16.100.20',
- 'network': '152.16.100.20',
- 'if': 'xe0'},
- {'netmask': '255.255.255.0',
- 'gateway': '152.16.40.20',
- 'network': '152.16.40.20',
- 'if': 'xe1'}],
- 'member-vnf-index': '2',
- 'host': '1.2.1.1',
- 'role': 'vnf',
- 'user': 'root',
- 'nd_route_tbl':
- [{'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
- 'network': '0064:ff9b:0:0:0:0:9810:6414',
- 'if': 'xe0'},
- {'netmask': '112',
- 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
- 'network': '0064:ff9b:0:0:0:0:9810:2814',
- 'if': 'xe1'}],
- 'password': 'r00t',
- 'VNF model': 'vpe_vnf.yaml'}}}
-
- def test___init__(self, mock_time):
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
+
+ VNFD_0 = {
+ 'short-name': 'VpeVnf',
+ 'vdu': [
+ {
+ 'routing_table': [
+ {
+ 'network': '152.16.100.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'if': 'xe0',
+ },
+ {
+ 'network': '152.16.40.20',
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'if': 'xe1',
+ },
+ ],
+ 'description': 'VPE approximation using DPDK',
+ 'name': 'vpevnf-baremetal',
+ 'nd_route_tbl': [
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0',
+ },
+ {
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1',
+ },
+ ],
+ 'id': 'vpevnf-baremetal',
+ 'external-interface': [
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:04',
+ 'vpci': '0000:05:00.0',
+ 'local_ip': '152.16.100.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'vld_id': '',
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '0',
+ 'bandwidth': '10 Gbps',
+ 'driver': "i40e",
+ 'dst_ip': '152.16.100.20',
+ 'local_iface_name': 'xe0',
+ 'local_mac': '00:00:00:00:00:02',
+ },
+ 'vnfd-connection-point-ref': 'xe0',
+ 'name': 'xe0',
+ },
+ {
+ 'virtual-interface': {
+ 'dst_mac': '00:00:00:00:00:03',
+ 'vpci': '0000:05:00.1',
+ 'local_ip': '152.16.40.19',
+ 'type': 'PCI-PASSTHROUGH',
+ 'vld_id': '',
+ 'driver': "i40e",
+ 'netmask': '255.255.255.0',
+ 'dpdk_port_num': '1',
+ 'bandwidth': '10 Gbps',
+ 'dst_ip': '152.16.40.20',
+ 'local_iface_name': 'xe1',
+ 'local_mac': '00:00:00:00:00:01',
+ },
+ 'vnfd-connection-point-ref': 'xe1',
+ 'name': 'xe1',
+ },
+ ],
+ },
+ ],
+ 'description': 'Vpe approximation using DPDK',
+ 'mgmt-interface': {
+ 'vdu-id': 'vpevnf-baremetal',
+ 'host': '1.2.1.1',
+ 'password': 'r00t',
+ 'user': 'root',
+ 'ip': '1.2.1.1',
+ },
+ 'benchmark': {
+ 'kpi': [
+ 'packets_in',
+ 'packets_fwd',
+ 'packets_dropped',
+ ],
+ },
+ 'connection-point': [
+ {
+ 'type': 'VPORT',
+ 'name': 'xe0',
+ },
+ {
+ 'type': 'VPORT',
+ 'name': 'xe1',
+ },
+ ],
+ 'id': 'VpeApproxVnf',
+ 'name': 'VPEVnfSsh',
+ }
+
+ VNFD = {
+ 'vnfd:vnfd-catalog': {
+ 'vnfd': [
+ VNFD_0,
+ ],
+ },
+ }
+
+ SCENARIO_CFG = {
+ 'options': {
+ 'packetsize': 64,
+ 'traffic_type': 4 ,
+ 'rfc2544': {
+ 'allowed_drop_rate': '0.8 - 1',
+ },
+ 'vnf__1': {
+ 'cfg': 'acl_1rule.yaml',
+ 'vnf_config': {
+ 'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config':
+ '1C/1T',
+ 'worker_threads': 1,
+ },
+ }
+ },
+ 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
+ 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
+ 'runner': {
+ 'object': 'NetworkServiceTestCase',
+ 'interval': 35,
+ 'output_filename': '/tmp/yardstick.out',
+ 'runner_id': 74476,
+ 'duration': 400,
+ 'type': 'Duration',
+ },
+ 'traffic_profile': 'ipv4_throughput_vpe.yaml',
+ 'traffic_options': {
+ 'flow': 'ipv4_Packets_vpe.yaml',
+ 'imix': 'imix_voice.yaml',
+ },
+ 'type': 'ISB',
+ 'nodes': {
+ 'tg__2': 'trafficgen_2.yardstick',
+ 'tg__1': 'trafficgen_1.yardstick',
+ 'vnf__1': 'vnf.yardstick',
+ },
+ 'topology': 'vpe-tg-topology-baremetal.yaml',
+ }
+
+ CONTEXT_CFG = {
+ 'nodes': {
+ 'tg__2': {
+ 'member-vnf-index': '3',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_2.yardstick',
+ 'vnfd-id-ref': 'tg__2',
+ 'ip': '1.2.1.1',
+ 'interfaces': {
+ 'xe0': {
+ 'local_iface_name': 'ens513f0',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.20',
+ 'dst_mac': '00:00:00:00:00:01',
+ 'local_mac': '00:00:00:00:00:03',
+ 'dst_ip': '152.16.40.19',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.0',
+ 'dpdk_port_num': 0,
+ },
+ 'xe1': {
+ 'local_iface_name': 'ens513f1',
+ 'netmask': '255.255.255.0',
+ 'network': '202.16.100.0',
+ 'local_ip': '202.16.100.20',
+ 'local_mac': '00:1e:67:d0:60:5d',
+ 'driver': 'ixgbe',
+ 'vpci': '0000:02:00.1',
+ 'dpdk_port_num': 1,
+ },
+ },
+ 'password': 'r00t',
+ 'VNF model': 'l3fwd_vnf.yaml',
+ 'user': 'root',
+ },
+ 'tg__1': {
+ 'member-vnf-index': '1',
+ 'role': 'TrafficGen',
+ 'name': 'trafficgen_1.yardstick',
+ 'vnfd-id-ref': 'tg__1',
+ 'ip': '1.2.1.1',
+ 'interfaces': {
+ 'xe0': {
+ 'local_iface_name': 'ens785f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.20',
+ 'dst_mac': '00:00:00:00:00:02',
+ 'local_mac': '00:00:00:00:00:04',
+ 'dst_ip': '152.16.100.19',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0,
+ },
+ 'xe1': {
+ 'local_iface_name': 'ens785f1',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.21',
+ 'local_mac': '00:00:00:00:00:01',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1,
+ },
+ },
+ 'password': 'r00t',
+ 'VNF model': 'tg_rfc2544_tpl.yaml',
+ 'user': 'root',
+ },
+ 'vnf__1': {
+ 'name': 'vnf.yardstick',
+ 'vnfd-id-ref': 'vnf__1',
+ 'ip': '1.2.1.1',
+ 'interfaces': {
+ 'xe0': {
+ 'local_iface_name': 'ens786f0',
+ 'vld_id': 'private',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.100.19',
+ 'dst_mac': '00:00:00:00:00:04',
+ 'local_mac': '00:00:00:00:00:02',
+ 'dst_ip': '152.16.100.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.0',
+ 'dpdk_port_num': 0,
+ },
+ 'xe1': {
+ 'local_iface_name': 'ens786f1',
+ 'vld_id': 'public',
+ 'netmask': '255.255.255.0',
+ 'local_ip': '152.16.40.19',
+ 'dst_mac': '00:00:00:00:00:03',
+ 'local_mac': '00:00:00:00:00:01',
+ 'dst_ip': '152.16.40.20',
+ 'driver': 'i40e',
+ 'vpci': '0000:05:00.1',
+ 'dpdk_port_num': 1,
+ },
+ },
+ 'routing_table': [
+ {
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.100.20',
+ 'network': '152.16.100.20',
+ 'if': 'xe0',
+ },
+ {
+ 'netmask': '255.255.255.0',
+ 'gateway': '152.16.40.20',
+ 'network': '152.16.40.20',
+ 'if': 'xe1',
+ },
+ ],
+ 'member-vnf-index': '2',
+ 'host': '1.2.1.1',
+ 'role': 'vnf',
+ 'user': 'root',
+ 'nd_route_tbl': [
+ {
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
+ 'network': '0064:ff9b:0:0:0:0:9810:6414',
+ 'if': 'xe0',
+ },
+ {
+ 'netmask': '112',
+ 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
+ 'network': '0064:ff9b:0:0:0:0:9810:2814',
+ 'if': 'xe1',
+ },
+ ],
+ 'password': 'r00t',
+ 'VNF model': 'vpe_vnf.yaml',
+ },
+ },
+ }
+
+ def test___init__(self, _):
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
self.assertIsNone(vpe_approx_vnf._vnf_process)
- def test_collect_kpi(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- vpe_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
- vpe_approx_vnf.resource.check_if_sa_running = \
- mock.Mock(return_value=[0, 1])
- vpe_approx_vnf.resource.amqp_collect_nfvi_kpi = \
- mock.Mock(return_value={})
- result = {'pkt_in_down_stream': 0,
- 'pkt_in_up_stream': 0,
- 'collect_stats': {'core': {}},
- 'pkt_drop_down_stream': 0, 'pkt_drop_up_stream': 0}
- # mock execute_command because it sleeps for 3 seconds.
- with mock.patch.object(vpe_approx_vnf, "execute_command", return_value=""):
- self.assertEqual(result, vpe_approx_vnf.collect_kpi())
-
- def test_execute_command(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- cmd = "quit"
- self.assertEqual("", vpe_approx_vnf.execute_command(cmd))
-
- def test_get_stats_vpe(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- vpe_approx_vnf.execute_command = \
- mock.Mock(return_value="Pkts in: 101\r\n\tPkts dropped by AH: 100\r\n\tPkts dropped by other: 100")
- result = {'pkt_in_down_stream': 202, 'pkt_in_up_stream': 303,
- 'pkt_drop_down_stream': 400, 'pkt_drop_up_stream': 600}
- self.assertEqual(result, vpe_approx_vnf.get_stats_vpe())
-
- def test_run_vpe(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh_mock.run = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- curr_path = os.path.dirname(os.path.abspath(__file__))
- vpe_vnf = os.path.join(curr_path, "vpe_config")
- queue_wrapper = \
- QueueFileWrapper(vpe_approx_vnf.q_in,
- vpe_approx_vnf.q_out, "pipeline>")
- self.assertEqual(None,
- vpe_approx_vnf._run_vpe(queue_wrapper, vpe_vnf))
-
- def test_instantiate(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}}
- vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
- vpe_approx_vnf._resource_collect_start = mock.Mock(return_value=0)
- vpe_approx_vnf.q_out.put("pipeline>")
- vpe_vnf.WAIT_TIME = 0.1
- # if process it still running exitcode will be None
- self.assertIn(vpe_approx_vnf.instantiate(self.scenario_cfg, self.context_cfg),
- {0, None})
-
- def test_instantiate_panic(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(1, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}}
- vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
- vpe_vnf.WAIT_TIME = 0.1
- self.assertRaises(RuntimeError, vpe_approx_vnf.instantiate,
- self.scenario_cfg, self.context_cfg)
-
- def test_scale(self, mock_time):
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- flavor = ""
- self.assertRaises(NotImplementedError, vpe_approx_vnf.scale, flavor)
-
- def test_setup_vnf_environment(self, mock_time):
- with mock.patch("yardstick.ssh.SSH") as ssh:
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ssh_mock = mock.Mock(autospec=ssh.SSH)
- ssh_mock.execute = \
- mock.Mock(return_value=(0, "", ""))
- ssh.from_node.return_value = ssh_mock
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- self.assertEqual(None,
- vpe_approx_vnf.setup_vnf_environment(ssh_mock))
-
- def test_terminate(self, mock_time):
- vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- vpe_approx_vnf = VpeApproxVnf(vnfd)
- self.assertEqual(None, vpe_approx_vnf.terminate())
+ @mock.patch(SSH_HELPER)
+ def test_collect_kpi_sa_not_running(self, ssh, _):
+ mock_ssh(ssh)
+
+ resource = mock.Mock(autospec=ResourceProfile)
+ resource.check_if_sa_running.return_value = False, 'error'
+ resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf.q_in = mock.MagicMock()
+ vpe_approx_vnf.q_out = mock.MagicMock()
+ vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ vpe_approx_vnf.resource_helper.resource = resource
+
+ expected = {
+ 'pkt_in_down_stream': 0,
+ 'pkt_in_up_stream': 0,
+ 'pkt_drop_down_stream': 0,
+ 'pkt_drop_up_stream': 0,
+ 'collect_stats': {'core': {}},
+ }
+ self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
+
+ @mock.patch(SSH_HELPER)
+ def test_collect_kpi_sa_running(self, ssh, _):
+ mock_ssh(ssh)
+
+ resource = mock.Mock(autospec=ResourceProfile)
+ resource.check_if_sa_running.return_value = True, 'good'
+ resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf.q_in = mock.MagicMock()
+ vpe_approx_vnf.q_out = mock.MagicMock()
+ vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ vpe_approx_vnf.resource_helper.resource = resource
+
+ expected = {
+ 'pkt_in_down_stream': 0,
+ 'pkt_in_up_stream': 0,
+ 'pkt_drop_down_stream': 0,
+ 'pkt_drop_up_stream': 0,
+ 'collect_stats': {'core': {'foo': 234}},
+ }
+ self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
+
+ @mock.patch(SSH_HELPER)
+ def test_vnf_execute(self, ssh, _):
+ mock_ssh(ssh)
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf.q_in = mock.MagicMock()
+ vpe_approx_vnf.q_out = mock.MagicMock()
+ vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
+ self.assertEqual(vpe_approx_vnf.vnf_execute("quit", 0), '')
+
+ @mock.patch(SSH_HELPER)
+ def test_run_vpe(self, ssh, _):
+ mock_ssh(ssh)
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf.tc_file_name = get_file_abspath(TEST_FILE_YAML)
+ vpe_approx_vnf.generate_port_pairs = mock.Mock()
+ vpe_approx_vnf.tg_port_pairs = [[[0], [1]]]
+ vpe_approx_vnf.vnf_port_pairs = [[[0], [1]]]
+ vpe_approx_vnf.vnf_cfg = {
+ 'lb_config': 'SW',
+ 'lb_count': 1,
+ 'worker_config': '1C/1T',
+ 'worker_threads': 1,
+ }
+ vpe_approx_vnf.scenario_helper.scenario_cfg = {
+ 'options': {
+ NAME: {
+ 'traffic_type': '4',
+ 'topology': 'nsb_test_case.yaml',
+ }
+ }
+ }
+ vpe_approx_vnf.topology = "nsb_test_case.yaml"
+ vpe_approx_vnf.nfvi_type = "baremetal"
+ vpe_approx_vnf._provide_config_file = mock.Mock()
+
+ self.assertIsInstance(vpe_approx_vnf.ssh_helper, mock.Mock)
+ self.assertIsNone(vpe_approx_vnf._run())
+
+ @mock.patch(SSH_HELPER)
+ def test_wait_for_instantiate(self, ssh, _):
+ mock_ssh(ssh)
+
+ mock_process = mock.Mock(autospec=Process)
+ mock_process.is_alive.return_value = True
+ mock_process.exitcode = 432
+
+ mock_q_out = mock.Mock(autospec=Queue)
+ mock_q_out.get.side_effect = iter(["pipeline>"])
+ mock_q_out.qsize.side_effect = range(1, -1, -1)
+
+ mock_resource = mock.MagicMock()
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf._vnf_process = mock_process
+ vpe_approx_vnf.q_out = mock_q_out
+ vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
+ vpe_approx_vnf.resource_helper.resource = mock_resource
+
+ vpe_approx_vnf.q_out.put("pipeline>")
+ self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
+
+ @mock.patch(SSH_HELPER)
+ def test_wait_for_instantiate_fragmented(self, ssh, _):
+ mock_ssh(ssh)
+
+ mock_process = mock.Mock(autospec=Process)
+ mock_process.is_alive.return_value = True
+ mock_process.exitcode = 432
+
+ # test that fragmented pipeline prompt is recognized
+ mock_q_out = mock.Mock(autospec=Queue)
+ mock_q_out.get.side_effect = iter(["wow pipel", "ine>"])
+ mock_q_out.qsize.side_effect = range(2, -1, -1)
+
+ mock_resource = mock.MagicMock()
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf._vnf_process = mock_process
+ vpe_approx_vnf.q_out = mock_q_out
+ vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
+ vpe_approx_vnf.resource_helper.resource = mock_resource
+
+ self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
+
+ @mock.patch(SSH_HELPER)
+ def test_wait_for_instantiate_crash(self, ssh, _):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+
+ mock_process = mock.Mock(autospec=Process)
+ mock_process.is_alive.return_value = False
+ mock_process.exitcode = 432
+
+ mock_resource = mock.MagicMock()
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf._vnf_process = mock_process
+ vpe_approx_vnf.resource_helper.resource = mock_resource
+
+ with self.assertRaises(RuntimeError) as raised:
+ vpe_approx_vnf.wait_for_instantiate()
+
+ self.assertIn('VNF process died', str(raised.exception))
+
+ @mock.patch(SSH_HELPER)
+ def test_wait_for_instantiate_panic(self, ssh, _):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+
+ mock_process = mock.Mock(autospec=Process)
+ mock_process.is_alive.return_value = True
+ mock_process.exitcode = 432
+
+ mock_resource = mock.MagicMock()
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf._vnf_process = mock_process
+ vpe_approx_vnf.resource_helper.resource = mock_resource
+
+ vpe_approx_vnf.q_out.put("PANIC")
+ with self.assertRaises(RuntimeError) as raised:
+ vpe_approx_vnf.wait_for_instantiate()
+
+ self.assertIn('Error starting', str(raised.exception))
+
+ @mock.patch(SSH_HELPER)
+ def test_wait_for_instantiate_panic_fragmented(self, ssh, _):
+ mock_ssh(ssh, exec_result=(1, "", ""))
+
+ mock_process = mock.Mock(autospec=Process)
+ mock_process.is_alive.return_value = True
+ mock_process.exitcode = 432
+
+ # test that fragmented PANIC is recognized
+ mock_q_out = mock.Mock(autospec=Queue)
+ mock_q_out.get.side_effect = iter(["omg PA", "NIC this is bad"])
+ mock_q_out.qsize.side_effect = range(2, -1, -1)
+
+ mock_resource = mock.MagicMock()
+
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf._vnf_process = mock_process
+ vpe_approx_vnf.q_out = mock_q_out
+ vpe_approx_vnf.resource_helper.resource = mock_resource
+
+ with self.assertRaises(RuntimeError) as raised:
+ vpe_approx_vnf.wait_for_instantiate()
+
+ self.assertIn('Error starting', str(raised.exception))
+
+ def test_scale(self, _):
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ with self.assertRaises(NotImplementedError):
+ vpe_approx_vnf.scale('')
+
+ def test_terminate(self, _):
+ vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
+ vpe_approx_vnf.vnf_execute = mock.Mock()
+ vpe_approx_vnf._vnf_process = mock.MagicMock()
+ vpe_approx_vnf._vnf_process.terminate = mock.Mock()
+ vpe_approx_vnf._resource_collect_stop = mock.Mock()
+ vpe_approx_vnf.resource_helper = mock.MagicMock()
+ vpe_approx_vnf.ssh_helper = mock.MagicMock()
+
+ self.assertIsNone(vpe_approx_vnf.terminate())
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/unit/network_services/vnf_generic/vnf/vpe_config/action_bulk_512.txt b/tests/unit/network_services/vnf_generic/vnf/vpe_config/action_bulk_512.txt
deleted file mode 100644
index 21731cd45..000000000
--- a/tests/unit/network_services/vnf_generic/vnf/vpe_config/action_bulk_512.txt
+++ /dev/null
@@ -1,512 +0,0 @@
-flow 0 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 1 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 2 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 3 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 4 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 5 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 6 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 7 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 8 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 9 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 10 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 11 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 12 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 13 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 14 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 15 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 16 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 17 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 18 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 19 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 20 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 21 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 22 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 23 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 24 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 25 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 26 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 27 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 28 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 29 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 30 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 31 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 32 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 33 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 34 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 35 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 36 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 37 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 38 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 39 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 40 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 41 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 42 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 43 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 44 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 45 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 46 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 47 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 48 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 49 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 50 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 51 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 52 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 53 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 54 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 55 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 56 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 57 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 58 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 59 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 60 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 61 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 62 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 63 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 64 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 65 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 66 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 67 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 68 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 69 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 70 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 71 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 72 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 73 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 74 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 75 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 76 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 77 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 78 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 79 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 80 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 81 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 82 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 83 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 84 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 85 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 86 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 87 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 88 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 89 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 90 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 91 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 92 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 93 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 94 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 95 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 96 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 97 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 98 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 99 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 100 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 101 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 102 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 103 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 104 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 105 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 106 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 107 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 108 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 109 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 110 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 111 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 112 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 113 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 114 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 115 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 116 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 117 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 118 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 119 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 120 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 121 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 122 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 123 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 124 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 125 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 126 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 127 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 128 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 129 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 130 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 131 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 132 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 133 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 134 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 135 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 136 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 137 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 138 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 139 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 140 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 141 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 142 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 143 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 144 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 145 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 146 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 147 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 148 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 149 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 150 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 151 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 152 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 153 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 154 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 155 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 156 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 157 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 158 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 159 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 160 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 161 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 162 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 163 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 164 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 165 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 166 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 167 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 168 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 169 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 170 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 171 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 172 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 173 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 174 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 175 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 176 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 177 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 178 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 179 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 180 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 181 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 182 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 183 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 184 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 185 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 186 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 187 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 188 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 189 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 190 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 191 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 192 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 193 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 194 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 195 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 196 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 197 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 198 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 199 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 200 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 201 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 202 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 203 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 204 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 205 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 206 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 207 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 208 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 209 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 210 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 211 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 212 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 213 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 214 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 215 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 216 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 217 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 218 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 219 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 220 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 221 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 222 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 223 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 224 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 225 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 226 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 227 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 228 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 229 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 230 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 231 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 232 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 233 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 234 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 235 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 236 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 237 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 238 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 239 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 240 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 241 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 242 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 243 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 244 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 245 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 246 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 247 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 248 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 249 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 250 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 251 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 252 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 253 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 254 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 255 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 256 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 257 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 258 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 259 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 260 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 261 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 262 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 263 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 264 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 265 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 266 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 267 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 268 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 269 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 270 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 271 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 272 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 273 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 274 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 275 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 276 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 277 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 278 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 279 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 280 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 281 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 282 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 283 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 284 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 285 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 286 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 287 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 288 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 289 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 290 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 291 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 292 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 293 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 294 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 295 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 296 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 297 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 298 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 299 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 300 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 301 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 302 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 303 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 304 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 305 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 306 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 307 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 308 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 309 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 310 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 311 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 312 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 313 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 314 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 315 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 316 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 317 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 318 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 319 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 320 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 321 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 322 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 323 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 324 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 325 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 326 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 327 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 328 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 329 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 330 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 331 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 332 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 333 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 334 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 335 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 336 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 337 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 338 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 339 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 340 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 341 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 342 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 343 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 344 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 345 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 346 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 347 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 348 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 349 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 350 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 351 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 352 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 353 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 354 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 355 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 356 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 357 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 358 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 359 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 360 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 361 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 362 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 363 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 364 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 365 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 366 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 367 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 368 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 369 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 370 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 371 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 372 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 373 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 374 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 375 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 376 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 377 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 378 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 379 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 380 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 381 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 382 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 383 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 384 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 385 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 386 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 387 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 388 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 389 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 390 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 391 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 392 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 393 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 394 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 395 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 396 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 397 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 398 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 399 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 400 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 401 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 402 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 403 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 404 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 405 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 406 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 407 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 408 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 409 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 410 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 411 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 412 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 413 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 414 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 415 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 416 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 417 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 418 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 419 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 420 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 421 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 422 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 423 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 424 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 425 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 426 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 427 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 428 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 429 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 430 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 431 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 432 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 433 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 434 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 435 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 436 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 437 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 438 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 439 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 440 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 441 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 442 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 443 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 444 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 445 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 446 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 447 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 448 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 449 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 450 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 451 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 452 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 453 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 454 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 455 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 456 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 457 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 458 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 459 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 460 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 461 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 462 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 463 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 464 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 465 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 466 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 467 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 468 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 469 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 470 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 471 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 472 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 473 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 474 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 475 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 476 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 477 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 478 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 479 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 480 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 481 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 482 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 483 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 484 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 485 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 486 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 487 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 488 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 489 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 490 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 491 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 492 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 493 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 494 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 495 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 496 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 497 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 498 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 499 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 500 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 501 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 502 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 503 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 504 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 505 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 506 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 507 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 508 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 509 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 510 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
-flow 511 meter 0 trtcm 1250000000 1250000000 1000000 1000000 policer 0 g G y Y r R meter 1 trtcm 1250000000 1250000000 1000000 1000000 policer 1 g G y Y r R meter 2 trtcm 1250000000 1250000000 1000000 1000000 policer 2 g G y Y r R meter 3 trtcm 1250000000 1250000000 1000000 1000000 policer 3 g G y Y r R port 0
diff --git a/tests/unit/network_services/vnf_generic/vnf/vpe_config/full_tm_profile_10G.cfg b/tests/unit/network_services/vnf_generic/vnf/vpe_config/full_tm_profile_10G.cfg
deleted file mode 100755
index 502655fd0..000000000
--- a/tests/unit/network_services/vnf_generic/vnf/vpe_config/full_tm_profile_10G.cfg
+++ /dev/null
@@ -1,105 +0,0 @@
-; BSD LICENSE
-;
-; Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-; All rights reserved.
-;
-; Redistribution and use in source and binary forms, with or without
-; modification, are permitted provided that the following conditions
-; are met:
-;
-; * Redistributions of source code must retain the above copyright
-; notice, this list of conditions and the following disclaimer.
-; * Redistributions in binary form must reproduce the above copyright
-; notice, this list of conditions and the following disclaimer in
-; the documentation and/or other materials provided with the
-; distribution.
-; * Neither the name of Intel Corporation nor the names of its
-; contributors may be used to endorse or promote products derived
-; from this software without specific prior written permission.
-;
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-; This file enables the following hierarchical scheduler configuration for each
-; 10GbE output port:
-; * Single subport (subport 0):
-; - Subport rate set to 100% of port rate
-; - Each of the 4 traffic classes has rate set to 100% of port rate
-; * 4K pipes per subport 0 (pipes 0 .. 4095) with identical configuration:
-; - Pipe rate set to 1/4K of port rate
-; - Each of the 4 traffic classes has rate set to 100% of pipe rate
-; - Within each traffic class, the byte-level WRR weights for the 4 queues
-; are set to 1:1:1:1
-;
-; For more details, please refer to chapter "Quality of Service (QoS) Framework"
-; of Intel Data Plane Development Kit (Intel DPDK) Programmer's Guide.
-
-; Port configuration
-[port]
-frame overhead = 24 ; frame overhead = Preamble (7) + SFD (1) + FCS (4) + IFG (12)
-mtu = 1522; mtu = Q-in-Q MTU (FCS not included)
-number of subports per port = 1
-number of pipes per subport = 4096
-queue sizes = 64 64 64 64
-
-; Subport configuration
-[subport 0]
-tb rate = 1250000000 ; Bytes per second
-tb size = 1000000 ; Bytes
-
-tc 0 rate = 1250000000 ; Bytes per second
-tc 1 rate = 1250000000 ; Bytes per second
-tc 2 rate = 1250000000 ; Bytes per second
-tc 3 rate = 1250000000 ; Bytes per second
-tc period = 10 ; Milliseconds
-
-pipe 0-4095 = 0 ; These pipes are configured with pipe profile 0
-
-; Pipe configuration
-[pipe profile 0]
-tb rate = 1250000000 ; Bytes per second
-tb size = 1000000 ; Bytes
-
-tc 0 rate = 1250000000 ; Bytes per second
-tc 1 rate = 1250000000 ; Bytes per second
-tc 2 rate = 1250000000 ; Bytes per second
-tc 3 rate = 1250000000 ; Bytes per second
-tc period = 40 ; Milliseconds
-
-tc 3 oversubscription weight = 1
-
-tc 0 wrr weights = 1 1 1 1
-tc 1 wrr weights = 1 1 1 1
-tc 2 wrr weights = 1 1 1 1
-tc 3 wrr weights = 1 1 1 1
-
-; RED params per traffic class and color (Green / Yellow / Red)
-[red]
-tc 0 wred min = 48 40 32
-tc 0 wred max = 64 64 64
-tc 0 wred inv prob = 10 10 10
-tc 0 wred weight = 9 9 9
-
-tc 1 wred min = 48 40 32
-tc 1 wred max = 64 64 64
-tc 1 wred inv prob = 10 10 10
-tc 1 wred weight = 9 9 9
-
-tc 2 wred min = 48 40 32
-tc 2 wred max = 64 64 64
-tc 2 wred inv prob = 10 10 10
-tc 2 wred weight = 9 9 9
-
-tc 3 wred min = 48 40 32
-tc 3 wred max = 64 64 64
-tc 3 wred inv prob = 10 10 10
-tc 3 wred weight = 9 9 9
diff --git a/tests/unit/network_services/vnf_generic/vnf/vpe_config/fw_bulk_inst0_256.txt b/tests/unit/network_services/vnf_generic/vnf/vpe_config/fw_bulk_inst0_256.txt
deleted file mode 100644
index 307150789..000000000
--- a/tests/unit/network_services/vnf_generic/vnf/vpe_config/fw_bulk_inst0_256.txt
+++ /dev/null
@@ -1,256 +0,0 @@
-priority 1 ipv4 152.16.0.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.1.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.2.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.3.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.4.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.5.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.6.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.7.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.8.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.9.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.10.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.11.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.12.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.13.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.14.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.15.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.16.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.17.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.18.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.19.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.20.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.21.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.22.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.23.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.24.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.25.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.26.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.27.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.28.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.29.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.30.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.31.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.32.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.33.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.34.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.35.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.36.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.37.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.38.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.39.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.40.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.41.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.42.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.43.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.44.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.45.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.46.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.47.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.48.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.49.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.50.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.51.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.52.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.53.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.54.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.55.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.56.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.57.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.58.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.59.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.60.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.61.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.62.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.63.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.64.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.65.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.66.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.67.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.68.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.69.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.70.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.71.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.72.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.73.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.74.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.75.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.76.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.77.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.78.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.79.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.80.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.81.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.82.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.83.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.84.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.85.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.86.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.87.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.88.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.89.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.90.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.91.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.92.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.93.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.94.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.95.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.96.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.97.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.98.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.99.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.100.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.101.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.102.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.103.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.104.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.105.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.106.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.107.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.108.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.109.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.110.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.111.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.112.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.113.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.114.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.115.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.116.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.117.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.118.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.119.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.120.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.121.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.122.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.123.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.124.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.125.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.126.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.127.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.128.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.129.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.130.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.131.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.132.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.133.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.134.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.135.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.136.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.137.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.138.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.139.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.140.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.141.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.142.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.143.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.144.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.145.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.146.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.147.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.148.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.149.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.150.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.151.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.152.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.153.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.154.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.155.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.156.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.157.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.158.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.159.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.160.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.161.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.162.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.163.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.164.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.165.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.166.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.167.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.168.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.169.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.170.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.171.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.172.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.173.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.174.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.175.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.176.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.177.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.178.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.179.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.180.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.181.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.182.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.183.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.184.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.185.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.186.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.187.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.188.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.189.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.190.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.191.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.192.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.193.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.194.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.195.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.196.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.197.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.198.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.199.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.200.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.201.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.202.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.203.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.204.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.205.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.206.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.207.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.208.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.209.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.210.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.211.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.212.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.213.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.214.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.215.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.216.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.217.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.218.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.219.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.220.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.221.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.222.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.223.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.224.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.225.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.226.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.227.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.228.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.229.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.230.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.231.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.232.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.233.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.234.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.235.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.236.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.237.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.238.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.239.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.240.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.241.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.242.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.243.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.244.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.245.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.246.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.247.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.248.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.249.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.250.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.251.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.252.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.253.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.254.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
-priority 1 ipv4 152.16.255.0 24 0.0.0.0 0 0 65535 0 65535 6 0xFF port 0
diff --git a/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_config b/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_config
deleted file mode 100644
index 17ebc6a76..000000000
--- a/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_config
+++ /dev/null
@@ -1,101 +0,0 @@
-[EAL]
-log_level = 0
-
-[PIPELINE0]
-type = MASTER
-core = s{socket}c0
-
-[MEMPOOL0]
-pool_size = 256K
-
-[MEMPOOL1]
-pool_size = 2M
-
-[RXQ1.0]
-mempool = MEMPOOL1
-
-;;;;;;;;;;Begin of upstream 0;;;;;;;;;;;;;;;;;;
-[PIPELINE1]
-type = FIREWALL
-core = s{socket}c1
-pktq_in = RXQ0.0
-pktq_out = SWQ0 SINK0
-n_rules = 4096
-pkt_type = qinq_ipv4
-
-[PIPELINE2]
-type = FLOW_CLASSIFICATION
-core = s{socket}c1
-pktq_in = SWQ0
-pktq_out = SWQ1 SINK1
-n_flows = 65536
-key_size = 8; dma_size
-key_offset = 268; dma_dst_offset
-key_mask = 00000FFF00000FFF; qinq
-flowid_offset = 172; mbuf (128) + 64
-
-[PIPELINE3]
-type = FLOW_ACTIONS
-core = s{socket}c1h
-pktq_in = SWQ1
-pktq_out = SWQ2
-n_flows = 65536
-n_meters_per_flow = 1;dscp is not considered for per user metering
-flow_id_offset = 172; mbuf (128) + 64
-ip_hdr_offset = 278 ; should not needed, but who knows?
-color_offset = 176
-
-[PIPELINE4]
-type = FLOW_ACTIONS
-core = s{socket}c1h
-pktq_in = SWQ2
-pktq_out = SWQ3
-n_flows = 65536
-n_meters_per_flow = 4; Use dscp to classify into 1 out of 4 TC
-flow_id_offset = 172; mbuf (128) + 64
-ip_hdr_offset = 278 ; should not needed, but who knows?
-color_offset = 176
-
-[PIPELINE5]
-type = ROUTING
-core = s{socket}c1
-pktq_in = SWQ3
-pktq_out = TXQ1.0 SINK2
-encap = ethernet_mpls
-mpls_color_mark = yes
-ip_hdr_offset = 278 ; should not needed, but who knows?
-color_offset = 176
-
-;;;;;;;;;;Begin of downstream 0;;;;;;;;;;;;;;;;;;
-[PIPELINE6]
-type = ROUTING
-core = s{socket}c2
-pktq_in = RXQ1.0
-pktq_out = SWQ4 SINK3
-encap = ethernet_qinq
-qinq_sched = yes
-ip_hdr_offset = 270; mbuf (128) + headroom (128) + ethernet header (14) = 270
-
-
-[PIPELINE7]
-type = PASS-THROUGH
-core = s{socket}c2h
-pktq_in = SWQ4
-pktq_out = SWQ5
-
-[PIPELINE8]
-type = PASS-THROUGH
-core = s{socket}c2h
-pktq_in = SWQ5 TM0
-pktq_out = TM0 SWQ6
-
-[PIPELINE9]
-type = PASS-THROUGH
-core = s{socket}c2
-pktq_in = SWQ6
-pktq_out = TXQ0.0
-
-[TM0]
-burst_read = 24;dequeue should be slightly slower then enqueue to create buffer
-burst_write = 32
-cfg = /tmp/full_tm_profile_10G.cfg
diff --git a/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_script b/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_script
deleted file mode 100644
index 740eb6586..000000000
--- a/tests/unit/network_services/vnf_generic/vnf/vpe_config/vpe_script
+++ /dev/null
@@ -1,384 +0,0 @@
-#=================================================================
-#Pipeline 1 : 256 Firewall Rules for 1 port with 0.0.X.0/24 for destination IP
-#=================================================================
-p 1 firewall add bulk /tmp/fw_bulk_inst0_256.txt
-p 1 firewall add default 1
-
-#=================================================================
-#Pipeline 2 : 512 flow classfication Rules for 1 port using QinQ as input. Flow id = SVLAN * 512 + CVLAN
-#=================================================================
-p 2 flow add qinq 128 512 port 0 id 1
-p 2 flow add default 1
-
-#=================================================================
-#Pipeline 3 : 512 metering Rules for 1 port
-#=================================================================
-p 3 action flow bulk /tmp/action_bulk_512.txt
-p 3 flows 512 ports 1
-
-#=================================================================
-#Pipeline 4 : 512 metering Rules and 4 traffic classes for 1 port
-#=================================================================
-p 4 action flow bulk /tmp/action_bulk_512.txt
-p 4 flows 512 ports 1
-p 4 action dscp 0 class 0 color G
-p 4 action dscp 1 class 1 color Y
-p 4 action dscp 2 class 2 color R
-p 4 action dscp 3 class 3 color G
-p 4 action dscp 4 class 0 color Y
-p 4 action dscp 5 class 1 color R
-p 4 action dscp 6 class 2 color G
-p 4 action dscp 7 class 3 color Y
-p 4 action dscp 8 class 0 color R
-p 4 action dscp 9 class 1 color G
-p 4 action dscp 10 class 2 color Y
-p 4 action dscp 11 class 3 color R
-p 4 action dscp 12 class 0 color G
-p 4 action dscp 13 class 1 color Y
-p 4 action dscp 14 class 2 color R
-p 4 action dscp 15 class 3 color G
-p 4 action dscp 16 class 0 color Y
-p 4 action dscp 17 class 1 color R
-p 4 action dscp 18 class 2 color G
-p 4 action dscp 19 class 3 color Y
-p 4 action dscp 20 class 0 color R
-p 4 action dscp 21 class 1 color G
-p 4 action dscp 22 class 2 color Y
-p 4 action dscp 23 class 3 color R
-p 4 action dscp 24 class 0 color G
-p 4 action dscp 25 class 1 color Y
-p 4 action dscp 26 class 2 color R
-p 4 action dscp 27 class 3 color G
-p 4 action dscp 28 class 0 color Y
-p 4 action dscp 29 class 1 color R
-p 4 action dscp 30 class 2 color G
-p 4 action dscp 31 class 3 color Y
-p 4 action dscp 32 class 0 color R
-p 4 action dscp 33 class 1 color G
-p 4 action dscp 34 class 2 color Y
-p 4 action dscp 35 class 3 color R
-p 4 action dscp 36 class 0 color G
-p 4 action dscp 37 class 1 color Y
-p 4 action dscp 38 class 2 color R
-p 4 action dscp 39 class 3 color G
-p 4 action dscp 40 class 0 color Y
-p 4 action dscp 41 class 1 color R
-p 4 action dscp 42 class 2 color G
-p 4 action dscp 43 class 3 color Y
-p 4 action dscp 44 class 0 color R
-p 4 action dscp 45 class 1 color G
-p 4 action dscp 46 class 2 color Y
-p 4 action dscp 47 class 3 color R
-p 4 action dscp 48 class 0 color G
-p 4 action dscp 49 class 1 color Y
-p 4 action dscp 50 class 2 color R
-p 4 action dscp 51 class 3 color G
-p 4 action dscp 52 class 0 color Y
-p 4 action dscp 53 class 1 color R
-p 4 action dscp 54 class 2 color G
-p 4 action dscp 55 class 3 color Y
-p 4 action dscp 56 class 0 color R
-p 4 action dscp 57 class 1 color G
-p 4 action dscp 58 class 2 color Y
-p 4 action dscp 59 class 3 color R
-p 4 action dscp 60 class 0 color G
-p 4 action dscp 61 class 1 color Y
-p 4 action dscp 62 class 2 color R
-p 4 action dscp 63 class 3 color G
-#=================================================================
-#Pipeline 5 : 32 Upstream Routing Rules for 1 ports with dst_ip : 0.0.0.0 to 0.0.255.255
-#=================================================================
-p 5 route add 152.40.0.0 21 port 0 ether {port1_dst_mac} mpls 0:0
-p 5 route add 152.40.8.0 21 port 0 ether {port1_dst_mac} mpls 0:1
-p 5 route add 152.40.16.0 21 port 0 ether {port1_dst_mac} mpls 0:2
-p 5 route add 152.40.24.0 21 port 0 ether {port1_dst_mac} mpls 0:3
-p 5 route add 152.40.32.0 21 port 0 ether {port1_dst_mac} mpls 0:4
-p 5 route add 152.40.40.0 21 port 0 ether {port1_dst_mac} mpls 0:5
-p 5 route add 152.40.48.0 21 port 0 ether {port1_dst_mac} mpls 0:6
-p 5 route add 152.40.56.0 21 port 0 ether {port1_dst_mac} mpls 0:7
-p 5 route add 152.40.64.0 21 port 0 ether {port1_dst_mac} mpls 0:8
-p 5 route add 152.40.72.0 21 port 0 ether {port1_dst_mac} mpls 0:9
-p 5 route add 152.40.80.0 21 port 0 ether {port1_dst_mac} mpls 0:10
-p 5 route add 152.40.88.0 21 port 0 ether {port1_dst_mac} mpls 0:11
-p 5 route add 152.40.96.0 21 port 0 ether {port1_dst_mac} mpls 0:12
-p 5 route add 152.40.104.0 21 port 0 ether {port1_dst_mac} mpls 0:13
-p 5 route add 152.40.112.0 21 port 0 ether {port1_dst_mac} mpls 0:14
-p 5 route add 152.40.120.0 21 port 0 ether {port1_dst_mac} mpls 0:15
-p 5 route add 152.40.128.0 21 port 0 ether {port1_dst_mac} mpls 0:16
-p 5 route add 152.40.136.0 21 port 0 ether {port1_dst_mac} mpls 0:17
-p 5 route add 152.40.144.0 21 port 0 ether {port1_dst_mac} mpls 0:18
-p 5 route add 152.40.152.0 21 port 0 ether {port1_dst_mac} mpls 0:19
-p 5 route add 152.40.160.0 21 port 0 ether {port1_dst_mac} mpls 0:20
-p 5 route add 152.40.168.0 21 port 0 ether {port1_dst_mac} mpls 0:21
-p 5 route add 152.40.176.0 21 port 0 ether {port1_dst_mac} mpls 0:22
-p 5 route add 152.40.184.0 21 port 0 ether {port1_dst_mac} mpls 0:23
-p 5 route add 152.40.192.0 21 port 0 ether {port1_dst_mac} mpls 0:24
-p 5 route add 152.40.200.0 21 port 0 ether {port1_dst_mac} mpls 0:25
-p 5 route add 152.40.208.0 21 port 0 ether {port1_dst_mac} mpls 0:26
-p 5 route add 152.40.216.0 21 port 0 ether {port1_dst_mac} mpls 0:27
-p 5 route add 152.40.224.0 21 port 0 ether {port1_dst_mac} mpls 0:28
-p 5 route add 152.40.232.0 21 port 0 ether {port1_dst_mac} mpls 0:29
-p 5 route add 152.40.240.0 21 port 0 ether {port1_dst_mac} mpls 0:30
-p 5 route add 152.40.248.0 21 port 0 ether {port1_dst_mac} mpls 0:31
-p 5 route add default 1
-
-#=================================================================
-#Pipeline 6 : 256 Downstream Routing Rules for 1 ports with dst_ip : 0.0.0.0 to 0.0.255.255
-#=================================================================
-p 6 route add 152.16.0.0 24 port 0 ether {port0_dst_mac} qinq 0 0
-p 6 route add 152.16.1.0 24 port 0 ether {port0_dst_mac} qinq 0 1
-p 6 route add 152.16.2.0 24 port 0 ether {port0_dst_mac} qinq 0 2
-p 6 route add 152.16.3.0 24 port 0 ether {port0_dst_mac} qinq 0 3
-p 6 route add 152.16.4.0 24 port 0 ether {port0_dst_mac} qinq 0 4
-p 6 route add 152.16.5.0 24 port 0 ether {port0_dst_mac} qinq 0 5
-p 6 route add 152.16.6.0 24 port 0 ether {port0_dst_mac} qinq 0 6
-p 6 route add 152.16.7.0 24 port 0 ether {port0_dst_mac} qinq 0 7
-p 6 route add 152.16.8.0 24 port 0 ether {port0_dst_mac} qinq 0 8
-p 6 route add 152.16.9.0 24 port 0 ether {port0_dst_mac} qinq 0 9
-p 6 route add 152.16.10.0 24 port 0 ether {port0_dst_mac} qinq 0 10
-p 6 route add 152.16.11.0 24 port 0 ether {port0_dst_mac} qinq 0 11
-p 6 route add 152.16.12.0 24 port 0 ether {port0_dst_mac} qinq 0 12
-p 6 route add 152.16.13.0 24 port 0 ether {port0_dst_mac} qinq 0 13
-p 6 route add 152.16.14.0 24 port 0 ether {port0_dst_mac} qinq 0 14
-p 6 route add 152.16.15.0 24 port 0 ether {port0_dst_mac} qinq 0 15
-p 6 route add 152.16.16.0 24 port 0 ether {port0_dst_mac} qinq 0 16
-p 6 route add 152.16.17.0 24 port 0 ether {port0_dst_mac} qinq 0 17
-p 6 route add 152.16.18.0 24 port 0 ether {port0_dst_mac} qinq 0 18
-p 6 route add 152.16.19.0 24 port 0 ether {port0_dst_mac} qinq 0 19
-p 6 route add 152.16.20.0 24 port 0 ether {port0_dst_mac} qinq 0 20
-p 6 route add 152.16.21.0 24 port 0 ether {port0_dst_mac} qinq 0 21
-p 6 route add 152.16.22.0 24 port 0 ether {port0_dst_mac} qinq 0 22
-p 6 route add 152.16.23.0 24 port 0 ether {port0_dst_mac} qinq 0 23
-p 6 route add 152.16.24.0 24 port 0 ether {port0_dst_mac} qinq 0 24
-p 6 route add 152.16.25.0 24 port 0 ether {port0_dst_mac} qinq 0 25
-p 6 route add 152.16.26.0 24 port 0 ether {port0_dst_mac} qinq 0 26
-p 6 route add 152.16.27.0 24 port 0 ether {port0_dst_mac} qinq 0 27
-p 6 route add 152.16.28.0 24 port 0 ether {port0_dst_mac} qinq 0 28
-p 6 route add 152.16.29.0 24 port 0 ether {port0_dst_mac} qinq 0 29
-p 6 route add 152.16.30.0 24 port 0 ether {port0_dst_mac} qinq 0 30
-p 6 route add 152.16.31.0 24 port 0 ether {port0_dst_mac} qinq 0 31
-p 6 route add 152.16.32.0 24 port 0 ether {port0_dst_mac} qinq 0 32
-p 6 route add 152.16.33.0 24 port 0 ether {port0_dst_mac} qinq 0 33
-p 6 route add 152.16.34.0 24 port 0 ether {port0_dst_mac} qinq 0 34
-p 6 route add 152.16.35.0 24 port 0 ether {port0_dst_mac} qinq 0 35
-p 6 route add 152.16.36.0 24 port 0 ether {port0_dst_mac} qinq 0 36
-p 6 route add 152.16.37.0 24 port 0 ether {port0_dst_mac} qinq 0 37
-p 6 route add 152.16.38.0 24 port 0 ether {port0_dst_mac} qinq 0 38
-p 6 route add 152.16.39.0 24 port 0 ether {port0_dst_mac} qinq 0 39
-p 6 route add 152.16.40.0 24 port 0 ether {port0_dst_mac} qinq 0 40
-p 6 route add 152.16.41.0 24 port 0 ether {port0_dst_mac} qinq 0 41
-p 6 route add 152.16.42.0 24 port 0 ether {port0_dst_mac} qinq 0 42
-p 6 route add 152.16.43.0 24 port 0 ether {port0_dst_mac} qinq 0 43
-p 6 route add 152.16.44.0 24 port 0 ether {port0_dst_mac} qinq 0 44
-p 6 route add 152.16.45.0 24 port 0 ether {port0_dst_mac} qinq 0 45
-p 6 route add 152.16.46.0 24 port 0 ether {port0_dst_mac} qinq 0 46
-p 6 route add 152.16.47.0 24 port 0 ether {port0_dst_mac} qinq 0 47
-p 6 route add 152.16.48.0 24 port 0 ether {port0_dst_mac} qinq 0 48
-p 6 route add 152.16.49.0 24 port 0 ether {port0_dst_mac} qinq 0 49
-p 6 route add 152.16.50.0 24 port 0 ether {port0_dst_mac} qinq 0 50
-p 6 route add 152.16.51.0 24 port 0 ether {port0_dst_mac} qinq 0 51
-p 6 route add 152.16.52.0 24 port 0 ether {port0_dst_mac} qinq 0 52
-p 6 route add 152.16.53.0 24 port 0 ether {port0_dst_mac} qinq 0 53
-p 6 route add 152.16.54.0 24 port 0 ether {port0_dst_mac} qinq 0 54
-p 6 route add 152.16.55.0 24 port 0 ether {port0_dst_mac} qinq 0 55
-p 6 route add 152.16.56.0 24 port 0 ether {port0_dst_mac} qinq 0 56
-p 6 route add 152.16.57.0 24 port 0 ether {port0_dst_mac} qinq 0 57
-p 6 route add 152.16.58.0 24 port 0 ether {port0_dst_mac} qinq 0 58
-p 6 route add 152.16.59.0 24 port 0 ether {port0_dst_mac} qinq 0 59
-p 6 route add 152.16.60.0 24 port 0 ether {port0_dst_mac} qinq 0 60
-p 6 route add 152.16.61.0 24 port 0 ether {port0_dst_mac} qinq 0 61
-p 6 route add 152.16.62.0 24 port 0 ether {port0_dst_mac} qinq 0 62
-p 6 route add 152.16.63.0 24 port 0 ether {port0_dst_mac} qinq 0 63
-p 6 route add 152.16.64.0 24 port 0 ether {port0_dst_mac} qinq 0 64
-p 6 route add 152.16.65.0 24 port 0 ether {port0_dst_mac} qinq 0 65
-p 6 route add 152.16.66.0 24 port 0 ether {port0_dst_mac} qinq 0 66
-p 6 route add 152.16.67.0 24 port 0 ether {port0_dst_mac} qinq 0 67
-p 6 route add 152.16.68.0 24 port 0 ether {port0_dst_mac} qinq 0 68
-p 6 route add 152.16.69.0 24 port 0 ether {port0_dst_mac} qinq 0 69
-p 6 route add 152.16.70.0 24 port 0 ether {port0_dst_mac} qinq 0 70
-p 6 route add 152.16.71.0 24 port 0 ether {port0_dst_mac} qinq 0 71
-p 6 route add 152.16.72.0 24 port 0 ether {port0_dst_mac} qinq 0 72
-p 6 route add 152.16.73.0 24 port 0 ether {port0_dst_mac} qinq 0 73
-p 6 route add 152.16.74.0 24 port 0 ether {port0_dst_mac} qinq 0 74
-p 6 route add 152.16.75.0 24 port 0 ether {port0_dst_mac} qinq 0 75
-p 6 route add 152.16.76.0 24 port 0 ether {port0_dst_mac} qinq 0 76
-p 6 route add 152.16.77.0 24 port 0 ether {port0_dst_mac} qinq 0 77
-p 6 route add 152.16.78.0 24 port 0 ether {port0_dst_mac} qinq 0 78
-p 6 route add 152.16.79.0 24 port 0 ether {port0_dst_mac} qinq 0 79
-p 6 route add 152.16.80.0 24 port 0 ether {port0_dst_mac} qinq 0 80
-p 6 route add 152.16.81.0 24 port 0 ether {port0_dst_mac} qinq 0 81
-p 6 route add 152.16.82.0 24 port 0 ether {port0_dst_mac} qinq 0 82
-p 6 route add 152.16.83.0 24 port 0 ether {port0_dst_mac} qinq 0 83
-p 6 route add 152.16.84.0 24 port 0 ether {port0_dst_mac} qinq 0 84
-p 6 route add 152.16.85.0 24 port 0 ether {port0_dst_mac} qinq 0 85
-p 6 route add 152.16.86.0 24 port 0 ether {port0_dst_mac} qinq 0 86
-p 6 route add 152.16.87.0 24 port 0 ether {port0_dst_mac} qinq 0 87
-p 6 route add 152.16.88.0 24 port 0 ether {port0_dst_mac} qinq 0 88
-p 6 route add 152.16.89.0 24 port 0 ether {port0_dst_mac} qinq 0 89
-p 6 route add 152.16.90.0 24 port 0 ether {port0_dst_mac} qinq 0 90
-p 6 route add 152.16.91.0 24 port 0 ether {port0_dst_mac} qinq 0 91
-p 6 route add 152.16.92.0 24 port 0 ether {port0_dst_mac} qinq 0 92
-p 6 route add 152.16.93.0 24 port 0 ether {port0_dst_mac} qinq 0 93
-p 6 route add 152.16.94.0 24 port 0 ether {port0_dst_mac} qinq 0 94
-p 6 route add 152.16.95.0 24 port 0 ether {port0_dst_mac} qinq 0 95
-p 6 route add 152.16.96.0 24 port 0 ether {port0_dst_mac} qinq 0 96
-p 6 route add 152.16.97.0 24 port 0 ether {port0_dst_mac} qinq 0 97
-p 6 route add 152.16.98.0 24 port 0 ether {port0_dst_mac} qinq 0 98
-p 6 route add 152.16.99.0 24 port 0 ether {port0_dst_mac} qinq 0 99
-p 6 route add 152.16.100.0 24 port 0 ether {port0_dst_mac} qinq 0 100
-p 6 route add 152.16.101.0 24 port 0 ether {port0_dst_mac} qinq 0 101
-p 6 route add 152.16.102.0 24 port 0 ether {port0_dst_mac} qinq 0 102
-p 6 route add 152.16.103.0 24 port 0 ether {port0_dst_mac} qinq 0 103
-p 6 route add 152.16.104.0 24 port 0 ether {port0_dst_mac} qinq 0 104
-p 6 route add 152.16.105.0 24 port 0 ether {port0_dst_mac} qinq 0 105
-p 6 route add 152.16.106.0 24 port 0 ether {port0_dst_mac} qinq 0 106
-p 6 route add 152.16.107.0 24 port 0 ether {port0_dst_mac} qinq 0 107
-p 6 route add 152.16.108.0 24 port 0 ether {port0_dst_mac} qinq 0 108
-p 6 route add 152.16.109.0 24 port 0 ether {port0_dst_mac} qinq 0 109
-p 6 route add 152.16.110.0 24 port 0 ether {port0_dst_mac} qinq 0 110
-p 6 route add 152.16.111.0 24 port 0 ether {port0_dst_mac} qinq 0 111
-p 6 route add 152.16.112.0 24 port 0 ether {port0_dst_mac} qinq 0 112
-p 6 route add 152.16.113.0 24 port 0 ether {port0_dst_mac} qinq 0 113
-p 6 route add 152.16.114.0 24 port 0 ether {port0_dst_mac} qinq 0 114
-p 6 route add 152.16.115.0 24 port 0 ether {port0_dst_mac} qinq 0 115
-p 6 route add 152.16.116.0 24 port 0 ether {port0_dst_mac} qinq 0 116
-p 6 route add 152.16.117.0 24 port 0 ether {port0_dst_mac} qinq 0 117
-p 6 route add 152.16.118.0 24 port 0 ether {port0_dst_mac} qinq 0 118
-p 6 route add 152.16.119.0 24 port 0 ether {port0_dst_mac} qinq 0 119
-p 6 route add 152.16.120.0 24 port 0 ether {port0_dst_mac} qinq 0 120
-p 6 route add 152.16.121.0 24 port 0 ether {port0_dst_mac} qinq 0 121
-p 6 route add 152.16.122.0 24 port 0 ether {port0_dst_mac} qinq 0 122
-p 6 route add 152.16.123.0 24 port 0 ether {port0_dst_mac} qinq 0 123
-p 6 route add 152.16.124.0 24 port 0 ether {port0_dst_mac} qinq 0 124
-p 6 route add 152.16.125.0 24 port 0 ether {port0_dst_mac} qinq 0 125
-p 6 route add 152.16.126.0 24 port 0 ether {port0_dst_mac} qinq 0 126
-p 6 route add 152.16.127.0 24 port 0 ether {port0_dst_mac} qinq 0 127
-p 6 route add 152.16.128.0 24 port 0 ether {port0_dst_mac} qinq 0 128
-p 6 route add 152.16.129.0 24 port 0 ether {port0_dst_mac} qinq 0 129
-p 6 route add 152.16.130.0 24 port 0 ether {port0_dst_mac} qinq 0 130
-p 6 route add 152.16.131.0 24 port 0 ether {port0_dst_mac} qinq 0 131
-p 6 route add 152.16.132.0 24 port 0 ether {port0_dst_mac} qinq 0 132
-p 6 route add 152.16.133.0 24 port 0 ether {port0_dst_mac} qinq 0 133
-p 6 route add 152.16.134.0 24 port 0 ether {port0_dst_mac} qinq 0 134
-p 6 route add 152.16.135.0 24 port 0 ether {port0_dst_mac} qinq 0 135
-p 6 route add 152.16.136.0 24 port 0 ether {port0_dst_mac} qinq 0 136
-p 6 route add 152.16.137.0 24 port 0 ether {port0_dst_mac} qinq 0 137
-p 6 route add 152.16.138.0 24 port 0 ether {port0_dst_mac} qinq 0 138
-p 6 route add 152.16.139.0 24 port 0 ether {port0_dst_mac} qinq 0 139
-p 6 route add 152.16.140.0 24 port 0 ether {port0_dst_mac} qinq 0 140
-p 6 route add 152.16.141.0 24 port 0 ether {port0_dst_mac} qinq 0 141
-p 6 route add 152.16.142.0 24 port 0 ether {port0_dst_mac} qinq 0 142
-p 6 route add 152.16.143.0 24 port 0 ether {port0_dst_mac} qinq 0 143
-p 6 route add 152.16.144.0 24 port 0 ether {port0_dst_mac} qinq 0 144
-p 6 route add 152.16.145.0 24 port 0 ether {port0_dst_mac} qinq 0 145
-p 6 route add 152.16.146.0 24 port 0 ether {port0_dst_mac} qinq 0 146
-p 6 route add 152.16.147.0 24 port 0 ether {port0_dst_mac} qinq 0 147
-p 6 route add 152.16.148.0 24 port 0 ether {port0_dst_mac} qinq 0 148
-p 6 route add 152.16.149.0 24 port 0 ether {port0_dst_mac} qinq 0 149
-p 6 route add 152.16.150.0 24 port 0 ether {port0_dst_mac} qinq 0 150
-p 6 route add 152.16.151.0 24 port 0 ether {port0_dst_mac} qinq 0 151
-p 6 route add 152.16.152.0 24 port 0 ether {port0_dst_mac} qinq 0 152
-p 6 route add 152.16.153.0 24 port 0 ether {port0_dst_mac} qinq 0 153
-p 6 route add 152.16.154.0 24 port 0 ether {port0_dst_mac} qinq 0 154
-p 6 route add 152.16.155.0 24 port 0 ether {port0_dst_mac} qinq 0 155
-p 6 route add 152.16.156.0 24 port 0 ether {port0_dst_mac} qinq 0 156
-p 6 route add 152.16.157.0 24 port 0 ether {port0_dst_mac} qinq 0 157
-p 6 route add 152.16.158.0 24 port 0 ether {port0_dst_mac} qinq 0 158
-p 6 route add 152.16.159.0 24 port 0 ether {port0_dst_mac} qinq 0 159
-p 6 route add 152.16.160.0 24 port 0 ether {port0_dst_mac} qinq 0 160
-p 6 route add 152.16.161.0 24 port 0 ether {port0_dst_mac} qinq 0 161
-p 6 route add 152.16.162.0 24 port 0 ether {port0_dst_mac} qinq 0 162
-p 6 route add 152.16.163.0 24 port 0 ether {port0_dst_mac} qinq 0 163
-p 6 route add 152.16.164.0 24 port 0 ether {port0_dst_mac} qinq 0 164
-p 6 route add 152.16.165.0 24 port 0 ether {port0_dst_mac} qinq 0 165
-p 6 route add 152.16.166.0 24 port 0 ether {port0_dst_mac} qinq 0 166
-p 6 route add 152.16.167.0 24 port 0 ether {port0_dst_mac} qinq 0 167
-p 6 route add 152.16.168.0 24 port 0 ether {port0_dst_mac} qinq 0 168
-p 6 route add 152.16.169.0 24 port 0 ether {port0_dst_mac} qinq 0 169
-p 6 route add 152.16.170.0 24 port 0 ether {port0_dst_mac} qinq 0 170
-p 6 route add 152.16.171.0 24 port 0 ether {port0_dst_mac} qinq 0 171
-p 6 route add 152.16.172.0 24 port 0 ether {port0_dst_mac} qinq 0 172
-p 6 route add 152.16.173.0 24 port 0 ether {port0_dst_mac} qinq 0 173
-p 6 route add 152.16.174.0 24 port 0 ether {port0_dst_mac} qinq 0 174
-p 6 route add 152.16.175.0 24 port 0 ether {port0_dst_mac} qinq 0 175
-p 6 route add 152.16.176.0 24 port 0 ether {port0_dst_mac} qinq 0 176
-p 6 route add 152.16.177.0 24 port 0 ether {port0_dst_mac} qinq 0 177
-p 6 route add 152.16.178.0 24 port 0 ether {port0_dst_mac} qinq 0 178
-p 6 route add 152.16.179.0 24 port 0 ether {port0_dst_mac} qinq 0 179
-p 6 route add 152.16.180.0 24 port 0 ether {port0_dst_mac} qinq 0 180
-p 6 route add 152.16.181.0 24 port 0 ether {port0_dst_mac} qinq 0 181
-p 6 route add 152.16.182.0 24 port 0 ether {port0_dst_mac} qinq 0 182
-p 6 route add 152.16.183.0 24 port 0 ether {port0_dst_mac} qinq 0 183
-p 6 route add 152.16.184.0 24 port 0 ether {port0_dst_mac} qinq 0 184
-p 6 route add 152.16.185.0 24 port 0 ether {port0_dst_mac} qinq 0 185
-p 6 route add 152.16.186.0 24 port 0 ether {port0_dst_mac} qinq 0 186
-p 6 route add 152.16.187.0 24 port 0 ether {port0_dst_mac} qinq 0 187
-p 6 route add 152.16.188.0 24 port 0 ether {port0_dst_mac} qinq 0 188
-p 6 route add 152.16.189.0 24 port 0 ether {port0_dst_mac} qinq 0 189
-p 6 route add 152.16.190.0 24 port 0 ether {port0_dst_mac} qinq 0 190
-p 6 route add 152.16.191.0 24 port 0 ether {port0_dst_mac} qinq 0 191
-p 6 route add 152.16.192.0 24 port 0 ether {port0_dst_mac} qinq 0 192
-p 6 route add 152.16.193.0 24 port 0 ether {port0_dst_mac} qinq 0 193
-p 6 route add 152.16.194.0 24 port 0 ether {port0_dst_mac} qinq 0 194
-p 6 route add 152.16.195.0 24 port 0 ether {port0_dst_mac} qinq 0 195
-p 6 route add 152.16.196.0 24 port 0 ether {port0_dst_mac} qinq 0 196
-p 6 route add 152.16.197.0 24 port 0 ether {port0_dst_mac} qinq 0 197
-p 6 route add 152.16.198.0 24 port 0 ether {port0_dst_mac} qinq 0 198
-p 6 route add 152.16.199.0 24 port 0 ether {port0_dst_mac} qinq 0 199
-p 6 route add 152.16.200.0 24 port 0 ether {port0_dst_mac} qinq 0 200
-p 6 route add 152.16.201.0 24 port 0 ether {port0_dst_mac} qinq 0 201
-p 6 route add 152.16.202.0 24 port 0 ether {port0_dst_mac} qinq 0 202
-p 6 route add 152.16.203.0 24 port 0 ether {port0_dst_mac} qinq 0 203
-p 6 route add 152.16.204.0 24 port 0 ether {port0_dst_mac} qinq 0 204
-p 6 route add 152.16.205.0 24 port 0 ether {port0_dst_mac} qinq 0 205
-p 6 route add 152.16.206.0 24 port 0 ether {port0_dst_mac} qinq 0 206
-p 6 route add 152.16.207.0 24 port 0 ether {port0_dst_mac} qinq 0 207
-p 6 route add 152.16.208.0 24 port 0 ether {port0_dst_mac} qinq 0 208
-p 6 route add 152.16.209.0 24 port 0 ether {port0_dst_mac} qinq 0 209
-p 6 route add 152.16.210.0 24 port 0 ether {port0_dst_mac} qinq 0 210
-p 6 route add 152.16.211.0 24 port 0 ether {port0_dst_mac} qinq 0 211
-p 6 route add 152.16.212.0 24 port 0 ether {port0_dst_mac} qinq 0 212
-p 6 route add 152.16.213.0 24 port 0 ether {port0_dst_mac} qinq 0 213
-p 6 route add 152.16.214.0 24 port 0 ether {port0_dst_mac} qinq 0 214
-p 6 route add 152.16.215.0 24 port 0 ether {port0_dst_mac} qinq 0 215
-p 6 route add 152.16.216.0 24 port 0 ether {port0_dst_mac} qinq 0 216
-p 6 route add 152.16.217.0 24 port 0 ether {port0_dst_mac} qinq 0 217
-p 6 route add 152.16.218.0 24 port 0 ether {port0_dst_mac} qinq 0 218
-p 6 route add 152.16.219.0 24 port 0 ether {port0_dst_mac} qinq 0 219
-p 6 route add 152.16.220.0 24 port 0 ether {port0_dst_mac} qinq 0 220
-p 6 route add 152.16.221.0 24 port 0 ether {port0_dst_mac} qinq 0 221
-p 6 route add 152.16.222.0 24 port 0 ether {port0_dst_mac} qinq 0 222
-p 6 route add 152.16.223.0 24 port 0 ether {port0_dst_mac} qinq 0 223
-p 6 route add 152.16.224.0 24 port 0 ether {port0_dst_mac} qinq 0 224
-p 6 route add 152.16.225.0 24 port 0 ether {port0_dst_mac} qinq 0 225
-p 6 route add 152.16.226.0 24 port 0 ether {port0_dst_mac} qinq 0 226
-p 6 route add 152.16.227.0 24 port 0 ether {port0_dst_mac} qinq 0 227
-p 6 route add 152.16.228.0 24 port 0 ether {port0_dst_mac} qinq 0 228
-p 6 route add 152.16.229.0 24 port 0 ether {port0_dst_mac} qinq 0 229
-p 6 route add 152.16.230.0 24 port 0 ether {port0_dst_mac} qinq 0 230
-p 6 route add 152.16.231.0 24 port 0 ether {port0_dst_mac} qinq 0 231
-p 6 route add 152.16.232.0 24 port 0 ether {port0_dst_mac} qinq 0 232
-p 6 route add 152.16.233.0 24 port 0 ether {port0_dst_mac} qinq 0 233
-p 6 route add 152.16.234.0 24 port 0 ether {port0_dst_mac} qinq 0 234
-p 6 route add 152.16.235.0 24 port 0 ether {port0_dst_mac} qinq 0 235
-p 6 route add 152.16.236.0 24 port 0 ether {port0_dst_mac} qinq 0 236
-p 6 route add 152.16.237.0 24 port 0 ether {port0_dst_mac} qinq 0 237
-p 6 route add 152.16.238.0 24 port 0 ether {port0_dst_mac} qinq 0 238
-p 6 route add 152.16.239.0 24 port 0 ether {port0_dst_mac} qinq 0 239
-p 6 route add 152.16.240.0 24 port 0 ether {port0_dst_mac} qinq 0 240
-p 6 route add 152.16.241.0 24 port 0 ether {port0_dst_mac} qinq 0 241
-p 6 route add 152.16.242.0 24 port 0 ether {port0_dst_mac} qinq 0 242
-p 6 route add 152.16.243.0 24 port 0 ether {port0_dst_mac} qinq 0 243
-p 6 route add 152.16.244.0 24 port 0 ether {port0_dst_mac} qinq 0 244
-p 6 route add 152.16.245.0 24 port 0 ether {port0_dst_mac} qinq 0 245
-p 6 route add 152.16.246.0 24 port 0 ether {port0_dst_mac} qinq 0 246
-p 6 route add 152.16.247.0 24 port 0 ether {port0_dst_mac} qinq 0 247
-p 6 route add 152.16.248.0 24 port 0 ether {port0_dst_mac} qinq 0 248
-p 6 route add 152.16.249.0 24 port 0 ether {port0_dst_mac} qinq 0 249
-p 6 route add 152.16.250.0 24 port 0 ether {port0_dst_mac} qinq 0 250
-p 6 route add 152.16.251.0 24 port 0 ether {port0_dst_mac} qinq 0 251
-p 6 route add 152.16.252.0 24 port 0 ether {port0_dst_mac} qinq 0 252
-p 6 route add 152.16.253.0 24 port 0 ether {port0_dst_mac} qinq 0 253
-p 6 route add 152.16.254.0 24 port 0 ether {port0_dst_mac} qinq 0 254
-p 6 route add 152.16.255.0 24 port 0 ether {port0_dst_mac} qinq 0 255
-p 6 route add default 1
diff --git a/tests/unit/test_ssh.py b/tests/unit/test_ssh.py
index 236736baa..24a9d0c83 100644
--- a/tests/unit/test_ssh.py
+++ b/tests/unit/test_ssh.py
@@ -26,6 +26,9 @@ import mock
from oslo_utils import encodeutils
from yardstick import ssh
+from yardstick.ssh import SSHError
+from yardstick.ssh import SSH
+from yardstick.ssh import AutoConnectSSH
class FakeParamikoException(Exception):
@@ -90,7 +93,7 @@ class SSHTestCase(unittest.TestCase):
test_ssh = ssh.SSH.from_node(node)
self.assertEqual("root", test_ssh.user)
self.assertEqual("example.net", test_ssh.host)
- self.assertEqual(ssh.SSH_PORT, test_ssh.port)
+ self.assertEqual(ssh.SSH.SSH_PORT, test_ssh.port)
self.assertEqual("kf", test_ssh.key_filename)
self.assertEqual("secret", test_ssh.password)
@@ -175,6 +178,45 @@ class SSHTestCase(unittest.TestCase):
]
self.assertEqual(client_calls, client.mock_calls)
+ @mock.patch("yardstick.ssh.SSH._get_pkey")
+ @mock.patch("yardstick.ssh.paramiko")
+ def test__get_client_with_exception(self, mock_paramiko, mock_ssh__get_pkey):
+ class MyError(Exception):
+ pass
+
+ mock_ssh__get_pkey.return_value = "pkey"
+ fake_client = mock.Mock()
+ fake_client.connect.side_effect = MyError
+ fake_client.set_missing_host_key_policy.return_value = None
+ mock_paramiko.SSHClient.return_value = fake_client
+ mock_paramiko.AutoAddPolicy.return_value = "autoadd"
+
+ test_ssh = ssh.SSH("admin", "example.net", pkey="key")
+
+ with self.assertRaises(SSHError) as raised:
+ test_ssh._get_client()
+
+ self.assertEqual(mock_paramiko.SSHClient.call_count, 1)
+ self.assertEqual(mock_paramiko.AutoAddPolicy.call_count, 1)
+ self.assertEqual(fake_client.set_missing_host_key_policy.call_count, 1)
+ self.assertEqual(fake_client.connect.call_count, 1)
+ exc_str = str(raised.exception)
+ self.assertIn('raised during connect', exc_str)
+ self.assertIn('MyError', exc_str)
+
+ @mock.patch("yardstick.ssh.SSH._get_pkey")
+ @mock.patch("yardstick.ssh.paramiko")
+ def test_copy(self, mock_paramiko, mock_ssh__get_pkey):
+ mock_ssh__get_pkey.return_value = "pkey"
+ fake_client = mock.Mock()
+ fake_client.connect.side_effect = IOError
+ mock_paramiko.SSHClient.return_value = fake_client
+ mock_paramiko.AutoAddPolicy.return_value = "autoadd"
+
+ test_ssh = ssh.SSH("admin", "example.net", pkey="key")
+ result = test_ssh.copy()
+ self.assertIsNot(test_ssh, result)
+
def test_close(self):
with mock.patch.object(self.test_client, "_client") as m_client:
self.test_client.close()
@@ -449,6 +491,69 @@ class SSHRunTestCase(unittest.TestCase):
self.test_client._put_file_shell.assert_called_once_with("foo", "bar",
mode=42)
+ @mock.patch("yardstick.ssh.os.stat")
+ def test_put_file_obj_with_mode(self, mock_stat):
+ sftp = self.fake_client.open_sftp.return_value = mock.MagicMock()
+ sftp.__enter__.return_value = sftp
+
+ mock_stat.return_value = os.stat_result([0o753] + [0] * 9)
+
+ self.test_client.put_file_obj("localfile", "remotefile", 'my_mode')
+
+ sftp.__enter__.assert_called_once()
+ sftp.putfo.assert_called_once_with("localfile", "remotefile")
+ sftp.chmod.assert_called_once_with("remotefile", 'my_mode')
+ sftp.__exit__.assert_called_once_with(None, None, None)
+
+
+class TestAutoConnectSSH(unittest.TestCase):
+
+ def test__connect_with_wait(self):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1', wait=True)
+ auto_connect_ssh._get_client = mock.Mock()
+ auto_connect_ssh.wait = mock_wait = mock.Mock()
+
+ auto_connect_ssh._connect()
+ self.assertEqual(mock_wait.call_count, 1)
+
+ def test__make_dict(self):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1')
+
+ expected = {
+ 'user': 'user1',
+ 'host': 'host1',
+ 'port': SSH.SSH_PORT,
+ 'pkey': None,
+ 'key_filename': None,
+ 'password': None,
+ 'name': None,
+ 'wait': False,
+ }
+ result = auto_connect_ssh._make_dict()
+ self.assertDictEqual(result, expected)
+
+ def test_get_class(self):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1')
+
+ self.assertEqual(auto_connect_ssh.get_class(), AutoConnectSSH)
+
+ @mock.patch('yardstick.ssh.SCPClient')
+ def test_put(self, mock_scp_client_type):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1')
+ auto_connect_ssh._client = mock.Mock()
+
+ auto_connect_ssh.put('a', 'z')
+ with mock_scp_client_type() as mock_scp_client:
+ self.assertEqual(mock_scp_client.put.call_count, 1)
+
+ def test_put_file(self):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1')
+ auto_connect_ssh._client = mock.Mock()
+ auto_connect_ssh._put_file_sftp = mock_put_sftp = mock.Mock()
+
+ auto_connect_ssh.put_file('a', 'b')
+ self.assertEqual(mock_put_sftp.call_count, 1)
+
def main():
unittest.main()