aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-10-18 14:15:32 +0000
committerPeter Mikus <pmikus@cisco.com>2019-10-19 04:41:03 +0000
commitfcc77752111a4fbe8caa341cf5249efbad305a2a (patch)
treedafa71db46e5ede25d50a45fd48ad3ec25bb617c /tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot
parent510f6d5140db4512ff00a43bf5b8d2ddd1f4a064 (diff)
Tests: Introduce driver layer
+ Small bugfixes in various suites Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I051af0a6da7340fe3f617400370c3846ca5241ab
Diffstat (limited to 'tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot')
-rw-r--r--tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot b/tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot
index 59de2237a0..90262b5e1e 100644
--- a/tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot
+++ b/tests/vpp/perf/ip4/2n1l-10ge2p1x710-ethip4udp-ip4base-nat44-ndrpdr.robot
@@ -50,6 +50,7 @@
| @{plugins_to_enable}= | dpdk_plugin.so | nat_plugin.so
| ${osi_layer}= | L3
| ${nic_name}= | Intel-X710
+| ${nic_driver}= | vfio-pci
| ${overhead}= | ${0}
# Traffic profile:
| ${traffic_profile}= | trex-sl-2n-ethip4udp-1u1p
@@ -77,7 +78,8 @@
| | And Set Max Rate And Jumbo And Handle Multi Seg
| | And Add NAT to all DUTs
| | And Apply startup configuration on all VPP DUTs
-| | When Initialize NAT44 in circular topology
+| | When Initialize layer driver | ${nic_driver}
+| | And Initialize NAT44 in circular topology
| | Then Find NDR and PDR intervals using optimized search
*** Test Cases ***
old } /* 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) 2018 Huawei Technologies Co.,Ltd.
* 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 <stdint.h>
#include <stddef.h>
#include "stackx_ip_addr.h"
#include "nstack_log.h"
#include "spl_def.h"

/* Here for now until needed in other places in stackx*/
#ifndef isprint
#define in_range(c, lo, up) ((u8)c >= lo && (u8)c <= up)
#define isprint(c) in_range(c, 0x20, 0x7f)
#define isdigit(c) in_range(c, '0', '9')
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
#define islower(c) in_range(c, 'a', 'z')
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#endif

/**
 * Ascii internet address interpretation routine.
 * The value returned is in network order.
 *
 * @param cp IPaddress in ascii represenation (e.g. "127.0.0.1")
 * @return ipaddress in network order
 */
u32
spl_ipaddr_addr (const char *cp)
{
  spl_ip_addr_t val;

  if (spl_ipaddr_aton (cp, &val))
    {
      return ip4_addr_get_u32 (&val);
    }

  return (SPL_IPADDR_NONE);
}

/**
 * Check whether "cp" is a valid ascii representation
 * of an Internet address and convert to a binary address.
 * Returns 1 if the address is valid, 0 if not.
 * This replaces inet_addr, the return value from which
 * cannot distinguish between failure and a local broad cast address.
 *
 * @param cp IPaddress in ascii represenation (e.g. "127.0.0.1")
 * @param addr pointer to which to save the ipaddress in network order
 * @return 1 if cp could be converted to addr, 0 on failure
 */
int
spl_ipaddr_aton (const char *cp, spl_ip_addr_t * addr)
{
  u32 val;
  u8 base;
  char c;
  u32 parts[4];
  u32 *pp = parts;

  if (cp == NULL)
    {
      return 0;
    }

  c = *cp;
  for (;;)
    {
      /*
       * Get number up to ``.''.
       * Values are specified as for C:
       * 0x=hex, 0=octal, 1-9=decimal.
       */
      if (!isdigit (c))
        {
          return (0);
        }

      val = 0;
      base = 10;
      if (c == '0')
        {
          c = *++cp;
          if ((c == 'x') || (c == 'X'))
            {
              base = 16;
              c = *++cp;
            }
          else
            {
              base = 8;
            }
        }

      for (;;)
        {
          if (isdigit (c))
            {
              val = (val * base) + (int) (c - '0');
              c = *++cp;
            }
          else if ((base == 16) && isxdigit (c))
            {
              val = (val << 4) | (int) (c + 10 - (islower (c) ? 'a' : 'A'));
              c = *++cp;
            }
          else
            {
              break;
            }
        }

      if (c == '.')
        {
          /*
           * Internet format:
           *  a.b.c.d
           *  a.b.c   (with c treated as 16 bits)
           *  a.b (with b treated as 24 bits)
           */
          if (pp >= parts + 3)
            {
              return (0);
            }

          *pp++ = val;
          c = *++cp;
        }
      else
        {
          break;
        }
    }

  /*
   * Check for trailing characters.
   */
  if ((c != '\0') && !isspace (c))
    {
      return (0);
    }

  /*
   * Concoct the address according to
   * the number of parts specified.
   */
  switch (pp - parts + 1)
    {
    case 0:
      return (0);               /* initial nondigit */

    case 1:                    /* a -- 32 bits */
      break;

    case 2:                    /* a.b -- 8.24 bits */
      if (val > 0xffffffUL)
        {
          return (0);
        }

      val |= parts[0] << 24;
      break;

    case 3:                    /* a.b.c -- 8.8.16 bits */
      if (val > 0xffff)
        {
          return (0);
        }

      val |= (parts[0] << 24) | (parts[1] << 16);
      break;

    case 4:                    /* a.b.c.d -- 8.8.8.8 bits */
      if (val > 0xff)
        {
          return (0);
        }

      val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
      break;
    default:
      NSPOL_LOGERR ("unhandled");

      return (0);
    }

  if (addr)
    {
      ip4_addr_set_u32 (addr, spl_htonl (val));
    }

  return (1);
}

/**
 * Convert numeric IPaddress into decimal dotted ASCII representation.
 * returns ptr to static buffer; not reentrant!
 *
 * @param addr ipaddress in network order to convert
 * @return pointer to a global static (!) buffer that holds the ASCII
 *         represenation of addr
 */
char *
spl_ipaddr_ntoa (const spl_ip_addr_t * addr)
{
  static char str[16];

  return spl_ipaddr_ntoa_r (addr, str, 16);
}

/**
 * Same as spl_ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
 *
 * @param addr ipaddress in network order to convert
 * @param buf target buffer where the string is stored
 * @param buflen length of buf
 * @return either pointer to buf which now holds the ASCII
 *         representation of addr or NULL if buf was too small
 */
char *
spl_ipaddr_ntoa_r (const spl_ip_addr_t * addr, char *buf, int buflen)
{
  u32 s_addr;
  char inv[3];
  char *rp;
  u8 *ap;
  u8 rem;
  u8 n;
  u8 i;
  int len = 0;

  s_addr = ip4_addr_get_u32 (addr);

  rp = buf;
  ap = (u8 *) & s_addr;
  for (n = 0; n < 4; n++)
    {
      i = 0;
      do
        {
          rem = *ap % (u8) 10;
          *ap /= (u8) 10;
          inv[i++] = '0' + rem;
        }
      while (*ap);

      while (i--)
        {
          if (len++ >= buflen)
            {
              return NULL;
            }

          *rp++ = inv[i];
        }

      if (len++ >= buflen)
        {
          return NULL;
        }

      *rp++ = '.';
      ap++;
    }

  *--rp = 0;
  return buf;
}