diff options
Diffstat (limited to 'yardstick/benchmark/scenarios/networking/networkcapacity.bash')
-rw-r--r-- | yardstick/benchmark/scenarios/networking/networkcapacity.bash | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.bash b/yardstick/benchmark/scenarios/networking/networkcapacity.bash new file mode 100644 index 000000000..a18f97e0b --- /dev/null +++ b/yardstick/benchmark/scenarios/networking/networkcapacity.bash @@ -0,0 +1,41 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2016 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 +############################################################################## + +# Measure compute capacity and scale of a host + +set -e +OUTPUT_FILE=/tmp/netperf-out.log + +# run capacity test +run_capacity() +{ + netstat -s > $OUTPUT_FILE +} + +# write the result to stdout in json format +output_json() +{ + CONNECTIONS=$(awk '/active/{print $1}' $OUTPUT_FILE) + FRAMES=$(awk '/total\ packets\ received/{print $1}' $OUTPUT_FILE) + echo -e "{ \ + \"Number of connections\":\"$CONNECTIONS\", \ + \"Number of frames received\": \"$FRAMES\" \ + }" +} + +main() +{ + run_capacity + + output_json +} + +main |