summaryrefslogtreecommitdiffstats
path: root/test/test_ip4.py
AgeCommit message (Expand)AuthorFilesLines
2017-10-31Refactor IP input checks for re-use at MPLS dispositionNeale Ranns1-0/+135
2017-10-14Source Lookup progammable via APINeale Ranns1-1/+109
2017-10-10punt and drop features:Neale Ranns1-1/+111
2017-09-11FIB table add/delete APINeale Ranns1-3/+8
2017-08-01Tests for recursive load-balancing with no choices.Neale Ranns1-5/+35
2017-06-06Packets recieved on VLAN-0 map to the main interfaceNeale Ranns1-0/+46
2017-05-25MPLS hash function improvementsNeale Ranns1-18/+43
2017-04-26IP Flow Hash Config fixesNeale Ranns1-0/+137
2017-03-29Sub-net broadcast addresses for IPv4Neale Ranns1-1/+124
2017-03-17Fix IP feature ordering.Neale Ranns1-1/+98
2017-03-09Tests to target holes in adjacency and DPO test coverageNeale Ranns1-1/+82
2017-01-11make test: improve documentation and PEP8 complianceKlement Sekera1-7/+10
2016-12-23make test: improve handling of packet capturesKlement Sekera1-11/+8
2016-12-09make test: FIB add/update/delete - ip4 routesMatej Klotton1-2/+266
2016-12-05make test: fix missing log/packet messagesKlement Sekera1-7/+5
2016-11-15Update test documentation.Matej Klotton1-18/+60
2016-11-09Disable non-working checks in load-balancer test and rename ip->ip4Klement Sekera1-0/+165
old } /* 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) 2019 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 <stdbool.h>
#include <vlib/vlib.h>
#include <vnet/crypto/crypto.h>

u8 *
format_vnet_crypto_alg (u8 * s, va_list * args)
{
  vnet_crypto_alg_t alg = va_arg (*args, vnet_crypto_alg_t);
  vnet_crypto_main_t *cm = &crypto_main;
  vnet_crypto_alg_data_t *d = vec_elt_at_index (cm->algs, alg);
  return format (s, "%s", d->name);
}

uword
unformat_vnet_crypto_alg (unformat_input_t * input, va_list * args)
{
  vnet_crypto_main_t *cm = &crypto_main;
  vnet_crypto_alg_t *alg = va_arg (*args, vnet_crypto_alg_t *);
  uword *p;
  u8 *name;

  if (!unformat (input, "%s", &name))
    return 0;

  p = hash_get_mem (cm->alg_index_by_name, name);
  vec_free (name);
  if (p == 0)
    return 0;

  *alg = p[0];

  return 1;
}

u8 *
format_vnet_crypto_op (u8 * s, va_list * args)
{
  vnet_crypto_main_t *cm = &crypto_main;
  vnet_crypto_op_id_t op = va_arg (*args, int);	// vnet_crypto_op_id_t);
  vnet_crypto_op_data_t *otd = cm->opt_data + op;

  return format (s, "%U-%U", format_vnet_crypto_op_type, otd->type,
		 format_vnet_crypto_alg, otd->alg);
}

u8 *
format_vnet_crypto_op_type (u8 * s, va_list * args)
{
  vnet_crypto_op_type_t opt = va_arg (*args, vnet_crypto_op_type_t);
  char *strings[] = {
#define _(n, s) [VNET_CRYPTO_OP_TYPE_##n] = s,
    foreach_crypto_op_type
#undef _
  };

  if (opt >= VNET_CRYPTO_OP_N_TYPES)
    return format (s, "unknown");

  return format (s, "%s", strings[opt]);
}

u8 *
format_vnet_crypto_op_status (u8 * s, va_list * args)
{
  vnet_crypto_op_status_t st = va_arg (*args, vnet_crypto_op_status_t);
  char *strings[] = {
#define _(n, s) [VNET_CRYPTO_OP_STATUS_##n] = s,
    foreach_crypto_op_status
#undef _
  };

  if (st >= VNET_CRYPTO_OP_N_STATUS)
    return format (s, "unknown");

  return format (s, "%s", strings[st]);
}

u8 *
format_vnet_crypto_engine (u8 * s, va_list * args)
{
  vnet_crypto_main_t *cm = &crypto_main;
  u32 crypto_engine_index = va_arg (*args, u32);
  vnet_crypto_engine_t *e;

  if (crypto_engine_index == ~0)
    return s;

  e = vec_elt_at_index (cm->engines, crypto_engine_index);

  return format (s, "%s", e->name);
}

u8 *
format_vnet_crypto_async_op_type (u8 * s, va_list * args)
{
  vnet_crypto_async_op_type_t opt =
    va_arg (*args, vnet_crypto_async_op_type_t);
  char *strings[] = {
#define _(n, s) [VNET_CRYPTO_ASYNC_OP_TYPE_##n] = s,
    foreach_crypto_async_op_type
#undef _
  };

  if (opt >= VNET_CRYPTO_ASYNC_OP_N_TYPES)
    return format (s, "unknown");

  return format (s, "%s", strings[opt]);
}

u8 *
format_vnet_crypto_async_alg (u8 * s, va_list * args)
{
  vnet_crypto_async_alg_t alg = va_arg (*args, vnet_crypto_async_alg_t);
  vnet_crypto_main_t *cm = &crypto_main;
  vnet_crypto_async_alg_data_t *d = vec_elt_at_index (cm->async_algs, alg);
  return format (s, "%s", d->name);
}

u8 *
format_vnet_crypto_async_op (u8 * s, va_list * args)
{
  vnet_crypto_main_t *cm = &crypto_main;
  vnet_crypto_async_op_id_t op = va_arg (*args, vnet_crypto_async_op_id_t);
  vnet_crypto_async_op_data_t *otd = cm->async_opt_data + op;

  return format (s, "%U-%U", format_vnet_crypto_async_op_type, otd->type,
		 format_vnet_crypto_async_alg, otd->alg);
}

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */