aboutsummaryrefslogtreecommitdiffstats
path: root/docs/index.rst
blob: 37e0c43fa5bfb710a939e2bd154e34bbbc5b943a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Intel Corporation, AT&T and others.

.. OPNFV VSPERF Documentation master file.

======
VSPERF
======
VSPERF is an OPNFV testing project.

VSPERF will develop a generic and architecture agnostic vSwitch testing
framework and associated tests, that will serve as a basis for validating the
suitability of different vSwitch implementations in a Telco NFV deployment
environment. The output of this project will be utilized by the OPNFV
Performance and Test group and its associated projects, as part of OPNFV
Platform and VNF level testing and validation.

* Project Wiki: https://wiki.opnfv.org/characterize_vswitch_performance_for_telco_nfv_use_cases
* Project Repository: https://gerrit.opnfv.org/gerrit/#/q/vswitchperf
* Continuous Integration https://build.opnfv.org/ci/view/vswitchperf/

.. toctree::
   :maxdepth: 3
   :numbered: 5

   ./configguide/index.rst
   ./userguide/index.rst
   ./design/index.rst
   ./requirements/index.rst
   ./release/index.rst
   ./results/index.rst

Indices
=======
* :ref:`search`
*/ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/env python

##
## Copyright (c) 2010-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 sutstatsconsfile import *
from tsstatsconsfile import *
from csvwriter import *

class TestResult:
    class Times:
        def __init__(self):
            self.serie = []
        def addTime(self, val):
            self.serie.append(val)
        def getTime(self, i):
            return self.serie[i]

    def __init__(self, testSystemCount):
        self.rates = None;
        self.tsStatsDump = [];
        self.tsTimes = [];
        for i in range(testSystemCount):
            self.tsStatsDump.append("");
            self.tsTimes.append(TestResult.Times());

        self.sutStatsDump = None;
        self.sutTime = TestResult.Times();

    def getTSCount(self):
        return len(self.tsTimes)

    def setTSStatsDump(self, filePaths):
        self.tsStatsDump = filePaths;

    def setSUTStatsDump(self, filePath):
        self.sutStatsDump = filePath;

    def getTSStatsDump(self):
        return self.tsStatsDump;

    def getSUTStatsDump(self):
        return self.sutStatsDump;

    def addTimeTS(self, times):
        for i in range(len(times)):
            self.tsTimes[i].addTime(times[i])

    def addTimeSUT(self, time):
        self.sutTime.addTime(time);


class ResultProcessor:
    def __init__(self, testResult):
        self._testResults = testResult;

    def process(self):
        self._readStatsConsLogs();
        self._mergeTsStats();
        self._calcSetupRate();

    def percentHandled(self):
        converged_tsc = self._testResults.sutTime.getTime(1) - self._testResults.sutTime.getTime(0)
        end_tsc = self._testResults.sutTime.getTime(2) - self._testResults.sutTime.getTime(0)

        converged = converged_tsc/Decimal(self._sutHz)
        end = end_tsc/Decimal(self._sutHz);

        rx_converged = -1
        tx_converged = -1
        rx_end = -1
        tx_end = -1

        for entry in self._sutStats:
            timeStamp = entry[3]
            if (rx_converged == -1):
                if (timeStamp > converged):
                    rx_converged = entry[0]
                    tx_converged = entry[1] - entry[2]
                else:
                    continue;
            else:
                if (timeStamp > end):
                    rx_end = entry[0]
                    tx_end = entry[1] - entry[2]
                    break;
        return (tx_end - tx_converged)/Decimal(rx_end - rx_converged)

    def toFile(self, fileName):
        outFile = CsvWriter();

        outFile.open(fileName)

        for entry in self._sutStats:
            timeStamp = round(entry[3], 3);
            rx = entry[0]
            tx = entry[1]
            drop = entry[2]

            outFile.write([timeStamp, rx, tx, drop, "", ""])

        for entry in self._tsStats:
            timeStamp = round(entry[-1], 3);
            connections = entry[0]
            setupRate = entry[3]
            outFile.write([timeStamp,"","","", connections, setupRate]);
        outFile.close();

    def _readStatsConsLogs(self):
        print "Reading SUT stats"
        self._sutStats = self._readSutStats();
        print "Reading TS stats"
        self._tsAllStats = self._readAllTSStats();

    def _mergeTsStats(self):
        # The first test system is the reference system. The totals
        # will be accumulated by repeatedly taking the closest
        # available data from other systems
        ret = []
        for entry in self._tsAllStats[0]:
            ret.append(entry)

        interSampleTime = ret[1][-1] - ret[0][-1];

        mergedSampleCount = 0;
        if (len(self._tsAllStats) == 1):
            mergedSampleCount = len(ret)

        for i in range(0, len(self._tsAllStats) - 1):
            prev = 0;
            for entry in ret:
                timeStamp = entry[-1]
                found = False;

                for idx in range(prev, len(self._tsAllStats[i])):
                    diff = abs(self._tsAllStats[i][idx][-1] - timeStamp)
                    if (diff < interSampleTime):
                        found = True;
                        prev = idx;
                        break;

                if (found):
                    entry[0] += self._tsAllStats[i][prev][0]
                    entry[1] += self._tsAllStats[i][prev][1]
                    mergedSampleCount += 1;
                else:
                    break;

        self._tsStats = ret[0: mergedSampleCount];

    def _calcSetupRate(self):
        for i in range(0, len(self._tsStats)):
            prevCreated = 0
            prevTime = 0
            if (i > 0):
                prevCreated = self._tsStats[i - 1][1];
                prevTime = self._tsStats[i - 1][-1];
            curCreated = self._tsStats[i][1];
            curTime = self._tsStats[i][-1];

            setupRate = (curCreated - prevCreated)/(curTime - prevTime)

            self._tsStats[i].append(setupRate);


    def _readSutStats(self):
        ret = []
        fileName = self._testResults.getSUTStatsDump();
        beg = self._testResults.sutTime.getTime(0);
        f = SutStatsConsFile(fileName, beg);
        entry = f.readNext();
        self._sutHz = f.getHz();
        while (entry is not None):
            ret.append(entry);
            entry = f.readNext();
        f.close();
        return ret;

    def _readAllTSStats(self):
        stats = []
        for i in range(self._testResults.getTSCount()):
            fileName = self._testResults.getTSStatsDump()[i]
            beg = self._testResults.tsTimes[i].getTime(0)
            tsStat = self._readTSStats(fileName, beg)
            stats.append(tsStat);
        return stats;

    def _readTSStats(self, fileName, beg):
        ret = []
        f = TSStatsConsFile(fileName, beg)

        entry = f.readNext()
        while (entry is not None):
            ret.append(entry);
            entry = f.readNext();
        f.close()
        return ret;