From: schillinge Date: Thu, 21 Mar 2019 10:33:52 +0000 (+0100) Subject: Added performance testing for the limit of a machine X-Git-Tag: v6.0.0~9 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fvim-emu.git;a=commitdiff_plain;h=aaa0840875a1e84af924e261f2259a1fc2a19c09 Added performance testing for the limit of a machine Change-Id: Ie8abc4b0514e0e153f497125bbe156341ae8e9a5 Signed-off-by: schillinge --- diff --git a/examples/performance_measurements/limit_testing.py b/examples/performance_measurements/limit_testing.py new file mode 100644 index 0000000..2cb2a6d --- /dev/null +++ b/examples/performance_measurements/limit_testing.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python2 +# Copyright (c) 2019 Erik Schilling +# ALL RIGHTS RESERVED. +# +# 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 time + +import psutil + +from emuvim.api.osm.pre_configured_osm import PreConfiguredOSM + +import csv + + +with open('limit_testing_%d.csv' % time.time(), 'w') as csvfile: + fieldnames = ['i', 'used_ram', 'cpu_usage'] + writer = csv.DictWriter(csvfile, fieldnames=fieldnames) + writer.writeheader() + + start = time.time() + with PreConfiguredOSM() as osm: + start_done = time.time() + osm.onboard_vnfd('../vnfs/multiple_vdu_vnfd') + nsd_id = osm.onboard_nsd('../services/multiple_vdu_nsd') + + i = 0 + while True: + time.sleep(3) + + measurement = { + 'i': i, + 'used_ram': psutil.virtual_memory().used, + 'cpu_usage': psutil.cpu_percent(interval=1) + } + writer.writerow(measurement) + csvfile.flush() + + i += 1 + + osm.ns_create('multiple-vdu-test-%d' % i, nsd_id) + _, num_failed = osm.ns_wait_until_all_in_status('running', 'failed') + if num_failed != 0: + print('NS failed') + break + + for ns in osm.ns_list(): + osm.ns_delete(ns['id']) + + osm.ns_wait_until_all_in_status('terminated') diff --git a/examples/services/multiple_vdu_nsd/multiple_vdu_nsd.yaml b/examples/services/multiple_vdu_nsd/multiple_vdu_nsd.yaml new file mode 100644 index 0000000..3c8412a --- /dev/null +++ b/examples/services/multiple_vdu_nsd/multiple_vdu_nsd.yaml @@ -0,0 +1,32 @@ +# Copyright (c) 2019 Erik Schilling +# ALL RIGHTS RESERVED. +# +# 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: multiple-vdu + name: multiple-vdu + short-name: multiple-vdu + constituent-vnfd: + - vnfd-id-ref: multiple-vdu-vnf + member-vnf-index: '1' + vld: + - id: mgmt + type: ELAN + mgmt-network: 'true' + vim-network-name: default + vnfd-connection-point-ref: + - vnfd-id-ref: multiple-vdu-vnf + member-vnf-index-ref: '1' + vnfd-connection-point-ref: eth0 diff --git a/examples/vnfs/multiple_vdu_vnfd/multiple_vdu_vnfd.yaml b/examples/vnfs/multiple_vdu_vnfd/multiple_vdu_vnfd.yaml new file mode 100644 index 0000000..335329d --- /dev/null +++ b/examples/vnfs/multiple_vdu_vnfd/multiple_vdu_vnfd.yaml @@ -0,0 +1,45 @@ +--- +# Copyright (c) 2018 by Paderborn University and Manuel Peuster +# (manuel@peuster.de) +# ALL RIGHTS RESERVED. +# +# 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. +# +# Neither the name of the Paderborn University +# nor the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. + +vnfd:vnfd-catalog: + vnfd: + - id: multiple-vdu-vnf + short-name: multiple-vdu-vnf + name: multiple-vdu-vnf + vdu: + - id: multiple-vdu-vnf-vdu + count: 10 + vm-flavor: + vcpu-count: 1 + memory-mb: 256 + storage-gb: 6 + image: "ubuntu:trusty" + interface: + - name: eth0 + type: EXTERNAL + position: 0 + external-connection-point-ref: eth0 + mgmt-interface: + vdu-id: multiple-vdu-vnf-vdu + connection-point: + - name: eth0 + type: VPORT diff --git a/setup.py b/setup.py index 5bab406..7442fda 100755 --- a/setup.py +++ b/setup.py @@ -60,7 +60,8 @@ setup(name='emuvim', 'flake8', # fixes: https://github.com/pytest-dev/pytest/issues/4770 'more-itertools<=5.0.0', - 'jinja2' + 'jinja2', + 'psutil' ], zip_safe=False, entry_points={