aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-04-25 10:39:47 +0200
committerTibor Frank <tifrank@cisco.com>2018-04-25 10:39:47 +0200
commit59e06f5e3143bf093bdb6b53c0186b050668e3d4 (patch)
tree3d29fedf782c10f86ffb6062329294c39ea44d0c /resources/libraries/python/TrafficGenerator.py
parentd1d8f2b387d3fd625ac98bc5bc37ff344b98ead8 (diff)
Report: add data
- https://jenkins.fd.io/job/csit-vpp-perf-1804-all/17/ - https://jenkins.fd.io/job/csit-vpp-perf-1804-all/18/ Change-Id: I3cfebb535c1c1806530ec16e86a5088a94ce3141 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
0 files changed, 0 insertions, 0 deletions
.sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .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 */ }
/*
 * Copyright (c) 2016 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.
 */

#include <vppinfra/types.h>
#include <vnet/bier/bier_types.h>
#include <vnet/bier/bier_hdr_inlines.h>

/*
 * enum to string conversions
 */
const static char* const bier_hdr_len_id_names[] = BIER_HDR_LEN_IDS;
const static char* const bier_hdr_proto_names[] = BIER_HDR_PROTO_ID_NAMES;

const static u16 bier_hdr_len_num_buckets[] = {
    [BIER_HDR_LEN_INVALID] = 0,
    [BIER_HDR_LEN_64] = 8,
    [BIER_HDR_LEN_128] = 16,
    [BIER_HDR_LEN_256] = 32,
    [BIER_HDR_LEN_512] = 64,
    [BIER_HDR_LEN_1024] = 128,
    [BIER_HDR_LEN_2048] = 256,
    [BIER_HDR_LEN_4096] = 512,
};

const static u16 bier_hdr_len_num_bits[] = {
    [BIER_HDR_LEN_INVALID] = 0,
    [BIER_HDR_LEN_64] = 64,
    [BIER_HDR_LEN_128] = 128,
    [BIER_HDR_LEN_256] = 256,
    [BIER_HDR_LEN_512] = 512,
    [BIER_HDR_LEN_1024] = 1024,
    [BIER_HDR_LEN_2048] = 2048,
    [BIER_HDR_LEN_4096] = 4096,
};

const static u16 bier_hdr_len_prefix_len[] = {
    [BIER_HDR_LEN_INVALID] = 0,
    [BIER_HDR_LEN_64] = 7,
    [BIER_HDR_LEN_128] = 8,
    [BIER_HDR_LEN_256] = 9,
    [BIER_HDR_LEN_512] = 10,
    [BIER_HDR_LEN_1024] = 11,
    [BIER_HDR_LEN_2048] = 12,
    [BIER_HDR_LEN_4096] = 13,
};

u32
bier_hdr_len_id_to_num_buckets (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_num_buckets[id]);
}

u32
bier_hdr_len_id_to_num_bytes (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_id_to_num_buckets(id));
}

u32
bier_hdr_len_id_to_max_bucket (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_id_to_num_buckets(id) - 1);
}

u32
bier_hdr_len_id_to_num_bits (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_num_bits[id]);
}

u32
bier_hdr_len_id_to_max_bit (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_id_to_num_bits(id));
}

u32
bier_hdr_len_id_to_prefix_len (bier_hdr_len_id_t id)
{
    return (bier_hdr_len_prefix_len[id]);
}

u8 *
format_bier_hdr_len_id (u8 *s, va_list *ap)
{
    bier_hdr_len_id_t hli = va_arg(*ap, int); // int promotion of bier_hdr_len_id_t

    return (format(s, "%s", bier_hdr_len_id_names[hli]));
}

u8 *
format_bier_hdr_proto (u8 *s, va_list *ap)
{
    bier_hdr_proto_id_t pi = va_arg(*ap, int);

    return (format(s, "%s", bier_hdr_proto_names[pi]));
}

int
bier_table_id_cmp (const bier_table_id_t *btid1,
                   const bier_table_id_t *btid2)
{
    int res;

    res = (btid1->bti_set - btid2->bti_set);

    if (0 == res)
    {
        res  = (btid1->bti_sub_domain - btid2->bti_sub_domain);
    }
    if (0 == res)
    {
        res = (btid1->bti_ecmp - btid2->bti_ecmp);
    }
    if (0 == res)
    {
        res = (btid1->bti_hdr_len - btid2->bti_hdr_len);
    }
    if (0 == res)
    {
        res = (btid1->bti_type - btid2->bti_type);
    }
    return (res);
}

dpo_proto_t
bier_hdr_proto_to_dpo (bier_hdr_proto_id_t bproto)
{
    switch (bproto)
    {
    case BIER_HDR_PROTO_INVALID:
    case BIER_HDR_PROTO_CTRL:
    case BIER_HDR_PROTO_OAM:
        ASSERT(0);
        break;
    case BIER_HDR_PROTO_MPLS_DOWN_STREAM:
    case BIER_HDR_PROTO_MPLS_UP_STREAM:
        return (DPO_PROTO_MPLS);
    case BIER_HDR_PROTO_ETHERNET:
    case BIER_HDR_PROTO_VXLAN:
        return (DPO_PROTO_ETHERNET);
    case BIER_HDR_PROTO_IPV4:
        return (DPO_PROTO_IP4);
    case BIER_HDR_PROTO_IPV6:
        return (DPO_PROTO_IP4);
    }

    return (DPO_PROTO_NUM);
}

bier_bift_id_t
bier_bift_id_encode (bier_table_set_id_t set,
                     bier_table_sub_domain_id_t sd,
                     bier_hdr_len_id_t bsl)
{
    bier_bift_id_t id;

    id = bsl;
    id = id << 8;
    id |= sd;
    id = id << 8;
    id |= set;

    return (id);
}

void
bier_bift_id_decode (bier_bift_id_t id,
                     bier_table_set_id_t *set,
                     bier_table_sub_domain_id_t *sd,
                     bier_hdr_len_id_t *bsl)
{
    *set = id & 0xff;
    id = id >> 8;
    *sd = id & 0xff;
    id = id >> 8;
    *bsl = id;
}

u8 *
format_bier_table_id (u8 *s, va_list *ap)
{
    bier_table_id_t *btid = va_arg(*ap, bier_table_id_t *);

    return (format(s, "sub-domain:%d set:%d ecmp:%d bsl:%U",
                   btid->bti_sub_domain,
                   btid->bti_set,
                   btid->bti_ecmp,
                   format_bier_hdr_len_id, btid->bti_hdr_len));
}

u8 *
format_bier_hdr (u8 *s, va_list *ap)
{
    bier_hdr_t *bh = va_arg(*ap, bier_hdr_t *);
    bier_hdr_t copy = *bh;

    bier_hdr_ntoh(&copy);

    return (format(s, "nibble:%d version:%d hdr-len:%U entropy:%d proto:%U src:%d",
                   bier_hdr_get_1st_nibble(&copy),
                   bier_hdr_get_version(&copy),
                   format_bier_hdr_len_id, bier_hdr_get_len_id(&copy),
                   bier_hdr_get_entropy(&copy),
                   format_bier_hdr_proto, bier_hdr_get_proto_id(&copy),
                   bier_hdr_get_src_id(&copy)));
}

 u8*
 format_bier_bift_id(u8 *s, va_list *ap)
 {
     bier_bift_id_t id = va_arg(*ap, bier_bift_id_t);
     bier_table_sub_domain_id_t sd;
     bier_table_set_id_t set;
     bier_hdr_len_id_t bsl;

     bier_bift_id_decode(id, &set, &sd, &bsl);

     return (format(s, "0x%x -> set:%d sd:%d hdr-len:%U",
                    id, set, sd, format_bier_hdr_len_id, bsl));
 }