aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/mrr-weekly.txt
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/function/mrr-weekly.txt')
-rw-r--r--resources/libraries/bash/function/mrr-weekly.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/libraries/bash/function/mrr-weekly.txt b/resources/libraries/bash/function/mrr-weekly.txt
index b89987dc23..b09c8228a2 100644
--- a/resources/libraries/bash/function/mrr-weekly.txt
+++ b/resources/libraries/bash/function/mrr-weekly.txt
@@ -24,4 +24,4 @@
1numaAND4cAND64bANDbaseANDdpdkANDethANDhw_envANDl2xcfwdANDmrrANDnic_intel-xxv710NOT100_flowsNOT100k_flowsNOT10k_flowsNOT10r1cNOT114bNOT1518bNOT1cNOT1r10cNOT1r1cNOT1r2cNOT1r4cNOT1r6cNOT1r8cNOT1vmNOT1vnfNOT1vswitchNOT2cNOT2r1cNOT2r2cNOT2r4cNOT2r6cNOT2r8cNOT2vmNOT2vnfNOT4r1cNOT4r2cNOT4r4cNOT4vnfNOT6r1cNOT6r2cNOT78bNOT8r1cNOT8r2cNOT9000bNOTaclNOTacl1NOTacl10NOTacl50NOTacl_permitNOTacl_permit_reflectNOTacl_statefulNOTacl_statelessNOTaes_gcmNOTcbc_sha1NOTcfs_optNOTchainNOTcopwhlistNOTdockerNOTdot1adNOTdot1qNOTdrv_avfNOTencapNOTfeatureNOTfib_100kNOTfib_10kNOTfib_1mNOTfib_200kNOTfib_20kNOTfib_2mNOThorizontalNOTiaclNOTiacldstNOTimixNOTip4baseNOTip4fwdNOTip4ovrlayNOTip4unrlayNOTip6baseNOTip6fwdNOTip6ovrlayNOTip6unrlayNOTipsecNOTipsechwNOTipsecintNOTipsecswNOTipsectranNOTipsectunNOTk8sNOTl2bd_1NOTl2bd_10NOTl2bd_100NOTl2bd_1kNOTl2bdbaseNOTl2bdmaclrnNOTl2bdscaleNOTl2ovrlayNOTl2patchNOTl2xcbaseNOTlbondNOTlbond_1lNOTlbond_2lNOTlbond_dpdkNOTlbond_lb_l34NOTlbond_mode_lacpNOTlbond_mode_xorNOTlbond_vppNOTlispNOTlispgpeNOTlxcNOTmacipNOTmemifNOTnat44NOTndrpdrNOTnf_densityNOTnf_l3fwdip4NOTnf_vppip4NOTnic_cisco-vic-1227NOTnic_cisco-vic-1385NOTnic_intel-x520-da2NOTnic_intel-x553NOTnic_intel-x710NOTnic_intel-xl710NOToaclNOTparallelNOTpipelineNOTpolice_markNOTscaleNOTsfc_controllerNOTsingle_memifNOTsrc_user_1NOTsrc_user_10NOTsrc_user_100NOTsrc_user_1000NOTsrc_user_2000NOTsrc_user_4000NOTsrv6NOTsrv6_1sidNOTsrv6_2sid_decapNOTsrv6_2sid_nodecapNOTsrv6_proxyNOTsrv6_proxy_dynNOTsrv6_proxy_masqNOTsrv6_proxy_statNOTtnl_1000NOTvhostNOTvhost_1024NOTvlan_1NOTvlan_10NOTvlan_100NOTvlan_1kNOTvpp_agentNOTvtsNOTvxlanNOTvxlan_1NOTvxlan_10NOTvxlan_100NOTvxlan_1k
# nfv_density
-mrrAND${default_nic}ANDnf_densityANDimix
+mrrAND${default_nic}ANDnf_densityANDimixANDdrv_vfio_pci
>168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
# Copyright (c) 2018 Cisco and/or its affiliates.
# 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.

"""Report generation.
"""

import logging
import datetime

from shutil import make_archive

from pal_utils import get_files, execute_command, archive_input_data


# .css file for the html format of the report
THEME_OVERRIDES = u"""/* override table width restrictions */
@media screen and (min-width: 767px) {
    .wy-table-responsive table td, .wy-table-responsive table th {
        white-space: normal !important;
    }

    .wy-table-responsive {
        font-size: small;
        margin-bottom: 24px;
        max-width: 100%;
        overflow: visible !important;
    }
}
.rst-content blockquote {
    margin-left: 0px;
    line-height: 18px;
    margin-bottom: 0px;
}
.wy-menu-vertical a {
    display: inline-block;
    line-height: 18px;
    padding: 0 2em;
    display: block;
    position: relative;
    font-size: 90%;
    color: #d9d9d9
}
.wy-menu-vertical li.current a {
    color: gray;
    border-right: solid 1px #c9c9c9;
    padding: 0 3em;
}
.wy-menu-vertical li.toctree-l2.current > a {
    background: #c9c9c9;
    padding: 0 3em;
}
.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a {
    display: block;
    background: #c9c9c9;
    padding: 0 4em;
}
.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a {
    display: block;
    background: #bdbdbd;
    padding: 0 5em;
}
.wy-menu-vertical li.on a, .wy-menu-vertical li.current > a {
    color: #404040;
    padding: 0 2em;
    font-weight: bold;
    position: relative;
    background: #fcfcfc;
    border: none;
        border-top-width: medium;
        border-bottom-width: medium;
        border-top-style: none;
        border-bottom-style: none;
        border-top-color: currentcolor;
        border-bottom-color: currentcolor;
    padding-left: 2em -4px;
}
"""

# Command to build the html format of the report
HTML_BUILDER = u'sphinx-build -v -c . -a ' \
               u'-b html -E ' \
               u'-t html ' \
               u'-D release={release} ' \
               u'-D version="Test Report {date}" ' \
               u'{working_dir} ' \
               u'{build_dir}/'

# Command to build the pdf format of the report
PDF_BUILDER = u'sphinx-build -v -c . -a ' \
              u'-b latex -E ' \
              u'-t latex ' \
              u'-D release={release} ' \
              u'-D version="Test Report {date}" ' \
              u'{working_dir} ' \
              u'{build_dir}'


def generate_report(release, spec, report_week):
    """Generate all formats and versions of the report.

    :param release: Release string of the product.
    :param spec: Specification read from the specification file.
    :param report_week: Calendar week when the report is published.
    :type release: str
    :type spec: Specification
    :type report_week: str
    """

    logging.info(u"Generating the report ...")

    report = {
        u"html": generate_html_report,
        u"pdf": generate_pdf_report
    }

    for report_format in spec.output[u"format"]:
        report[report_format](release, spec, report_week)

    archive_input_data(spec)

    logging.info(u"Done.")


def generate_html_report(release, spec, report_version):
    """Generate html format of the report.

    :param release: Release string of the product.
    :param spec: Specification read from the specification file.
    :param report_version: Version of the report.
    :type release: str
    :type spec: Specification
    :type report_version: str
    """

    _ = report_version

    logging.info(u"  Generating the html report, give me a few minutes, please "
                 u"...")

    working_dir = spec.environment[u"paths"][u"DIR[WORKING,SRC]"]

    execute_command(f"cd {working_dir} && mv -f index.html.template index.rst")

    cmd = HTML_BUILDER.format(
        release=release,
        date=datetime.datetime.utcnow().strftime(u'%Y-%m-%d %H:%M UTC'),
        working_dir=working_dir,
        build_dir=spec.environment[u"paths"][u"DIR[BUILD,HTML]"])
    execute_command(cmd)

    with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE]"], u"wt") as \
            css_file:
        css_file.write(THEME_OVERRIDES)

    with open(spec.environment[u"paths"][u"DIR[CSS_PATCH_FILE2]"], u"wt") as \
            css_file:
        css_file.write(THEME_OVERRIDES)

    logging.info(u"  Done.")


def generate_pdf_report(release, spec, report_week):
    """Generate html format of the report.

    :param release: Release string of the product.
    :param spec: Specification read from the specification file.
    :param report_week: Calendar week when the report is published.
    :type release: str
    :type spec: Specification
    :type report_week: str
    """

    logging.info(u"  Generating the pdf report, give me a few minutes, please "
                 u"...")

    working_dir = spec.environment[u"paths"][u"DIR[WORKING,SRC]"]

    execute_command(f"cd {working_dir} && mv -f index.pdf.template index.rst")

    _convert_all_svg_to_pdf(spec.environment[u"paths"][u"DIR[WORKING,SRC]"])

    # Convert PyPLOT graphs in HTML format to PDF.
    convert_plots = u"xvfb-run -a wkhtmltopdf {html} {pdf}"
    plots = get_files(spec.environment[u"paths"][u"DIR[STATIC,VPP]"], u"html")
    plots.extend(
        get_files(spec.environment[u"paths"][u"DIR[STATIC,DPDK]"], u"html")
    )
    for plot in plots:
        file_name = f"{plot.rsplit(u'.', 1)[0]}.pdf"
        logging.info(f"Converting {plot} to {file_name}")
        execute_command(convert_plots.format(html=plot, pdf=file_name))

    # Generate the LaTeX documentation
    build_dir = spec.environment[u"paths"][u"DIR[BUILD,LATEX]"]
    cmd = PDF_BUILDER.format(
        release=release,
        date=datetime.datetime.utcnow().strftime(u'%Y-%m-%d %H:%M UTC'),
        working_dir=working_dir,
        build_dir=build_dir)
    execute_command(cmd)

    # Build pdf documentation
    archive_dir = spec.environment[u"paths"][u"DIR[STATIC,ARCH]"]
    cmds = [
        f'cd {build_dir} && '
        f'pdflatex -shell-escape -interaction nonstopmode csit.tex || true',
        f'cd {build_dir} && '
        f'pdflatex -interaction nonstopmode csit.tex || true',
        f'cd {build_dir} && '
        f'cp csit.pdf ../{archive_dir}/csit_{release}.{report_week}.pdf &&'
        f'cp csit.pdf ../{archive_dir}/csit_{release}.pdf'
    ]

    for cmd in cmds:
        execute_command(cmd)

    logging.info(u"  Done.")


def archive_report(spec):
    """Archive the report.

    :param spec: Specification read from the specification file.
    :type spec: Specification
    """

    logging.info(u"  Archiving the report ...")

    make_archive(
        u"csit.report",
        u"gztar",
        base_dir=spec.environment[u"paths"][u"DIR[BUILD,HTML]"]
    )

    logging.info(u"  Done.")


def _convert_all_svg_to_pdf(path):
    """Convert all svg files on path "path" to pdf.

    :param path: Path to the root directory with svg files to convert.
    :type path: str
    """

    svg_files = get_files(path, u"svg", full_path=True)
    for svg_file in svg_files:
        pdf_file = f"{svg_file.rsplit(u'.', 1)[0]}.pdf"
        logging.info(f"Converting {svg_file} to {pdf_file}")
        execute_command(
            f"inkscape -D -z --file={svg_file} --export-pdf={pdf_file}"
        )