aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_ip4_irb.py
AgeCommit message (Collapse)AuthorFilesLines
2018-09-25L2 BD: introduce a BD interface on which to send UU packetsNeale Ranns1-1/+3
Change-Id: I21ad6b04c19c8735d057174b1f260a59f2812241 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-09-08L2 BVI/FIB: Update L2 FIB table when BVI's MAC changesNeale Ranns1-8/+19
also some moving of l2 headers to reduce dependencies Change-Id: I7a700a411a91451ef13fd65f9c90de2432b793bb Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-06-24Revert "Revert "make test: fix broken interfaces""Klement Sekera1-1/+1
This reverts commit c8efa29b6f9a91381897b54f1147daf922ed7164. Change-Id: I1d5c5773d5f86a63073e255336bd9de628e26179 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-06-22Revert "make test: fix broken interfaces"Ole Troan1-1/+1
This reverts commit d5c60b96a3fd93916fc4af5c8d6d25625c28242e. Change-Id: I3632b9c3f76c615aee897f28f76d094e7031e689 Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-22make test: fix broken interfacesKlement Sekera1-1/+1
Change-Id: I2e092774f81503e04b53cc6c6b5d357fe3fc52ab Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-23make test: improve handling of packet capturesKlement Sekera1-10/+7
Perform accounting of expected packets based on created packet infos. Use this accounting info to automatically expect (and verify) the correct number of packets to be captured. Automatically retry the read of the capture file if scapy raises an exception while doing so to handle rare cases when capture file is read while only partially written during busy wait. Don't fail assert_nothing_captured if only junk packets arrived. Change-Id: I16ec2e9410ef510d313ec16b7e13c57d0b2a63f5 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-15Update test documentation.Matej Klotton1-32/+51
- update IRB, IPv4, ipv6 doc - revert 778c2765c8ea5c6628f6d668847f0b9ae06dbf3d Change-Id: I9af5ed9329ce5fe01392cf28d5bf321cfc647e48 Signed-off-by: Matej Klotton <mklotton@cisco.com>
2016-11-11Add IRB testMatej Klotton1-0/+247
- JIRA: CSIT-255 - create loopback interfaces - move pg-interface specific arp and neighbor discovery from vpp_interface to vpp_pg_interface - base configuration of IRB tests - IP test scenario Change-Id: I9945a188163652a4e22325877aef008c4d029557 Signed-off-by: Matej Klotton <mklotton@cisco.com>
l.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) 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.
 */

/**
 * @file
 * @brief MPCAP utility definitions
 */
#ifndef included_vppinfra_mpcap_h
#define included_vppinfra_mpcap_h

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <vppinfra/time_range.h>
#include <vppinfra/lock.h>

/**
 * @brief Packet types supported by MPCAP
 *
 * null 0
 * ethernet 1
 * ppp 9
 * ip 12
 * hdlc 104
 */
#define foreach_vnet_mpcap_packet_type          \
  _ (null, 0)                                   \
  _ (ethernet, 1)                               \
  _ (ppp, 9)                                    \
  _ (ip, 12)                                    \
  _ (hdlc, 104)

typedef enum
{
#define _(f,n) MPCAP_PACKET_TYPE_##f = (n),
  foreach_vnet_mpcap_packet_type
#undef _
} mpcap_packet_type_t;

#define foreach_mpcap_file_header                       \
  /** 0xa1b2c3d4 host byte order.                       \
     0xd4c3b2a1 => need to byte swap everything. */     \
  _ (u32, magic)                                        \
                                                        \
  /** Currently major 2 minor 4. */                     \
  _ (u16, major_version)                                \
  _ (u16, minor_version)                                \
                                                        \
  /** 0 for GMT. */                                     \
  _ (u32, time_zone)                                    \
                                                        \
  /** Accuracy of timestamps.  Typically set to 0. */   \
  _ (u32, sigfigs)                                      \
                                                        \
  /** Size of largest packet in file. */                \
  _ (u32, max_packet_size_in_bytes)                     \
                                                        \
  /** One of vnet_mpcap_packet_type_t. */               \
  _ (u32, packet_type)

/** File header struct */
typedef struct
{
#define _(t, f) t f;
  foreach_mpcap_file_header
#undef _
} mpcap_file_header_t;

#define foreach_mpcap_packet_header             \
  /** Time stamp in seconds  */                 \
  _ (u32, time_in_sec)                          \
  /** Time stamp in microseconds. */            \
  _ (u32, time_in_usec)                         \
                                                \
  /** Number of bytes stored in file. */        \
  _ (u32, n_packet_bytes_stored_in_file)        \
  /** Number of bytes in actual packet. */	\
  _ (u32, n_bytes_in_packet)

/** Packet header. */
typedef struct
{
#define _(t, f) t f;
  foreach_mpcap_packet_header
#undef _
  /** Packet data follows. */
  u8 data[0];
} mpcap_packet_header_t;

/**
 * @brief MPCAP main state data structure
 */
typedef struct
{
  /** File name of mpcap output. */
  char *file_name;

  /** spinlock, initialized if flagged MPCAP_FLAG_THREAD_SAFE */
  clib_spinlock_t lock;

  /** Number of packets to capture. */
  u32 n_packets_to_capture;

  /** Packet type */
  mpcap_packet_type_t packet_type;

  /** Maximum file size */
  u64 max_file_size;

  /** Base address */
  u8 *file_baseva;

  /** current memory address */
  u8 *current_va;

  /** Number of packets currently captured. */
  u32 n_packets_captured;

  /** Pointer to file header in svm, for ease of updating */
  mpcap_file_header_t *file_header;

  /** flags */
  u32 flags;
#define MPCAP_FLAG_INIT_DONE (1 << 0)
#define MPCAP_FLAG_THREAD_SAFE (1 << 1)
#define MPCAP_FLAG_WRITE_ENABLE (1 << 2)

  /** Bytes written */
  u32 n_mpcap_data_written;

  /** Vector of mpcap data. */
  u8 *mpcap_data;

  /** Packets in mapped mpcap file. */
  u64 packets_read;

  /** Min/Max Packet bytes */
  u32 min_packet_bytes, max_packet_bytes;
} mpcap_main_t;

/* Some sensible default size */
#define MPCAP_DEFAULT_FILE_SIZE (10<<20)

/** initialize a mpcap file (for writing) */
clib_error_t *mpcap_init (mpcap_main_t * pm);

/** Flush / unmap a mpcap file */
clib_error_t *mpcap_close (mpcap_main_t * pm);

/** mmap a mpcap data file. */
clib_error_t *mpcap_map (mpcap_main_t * pm);

#endif /* included_vppinfra_mpcap_h */

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