summaryrefslogtreecommitdiffstats
path: root/test/test_map.py
AgeCommit message (Expand)AuthorFilesLines
2019-05-29map: Use vl_api_string macros.Paul Vinciguerra1-4/+44
2019-04-10Tests Cleanup: Fix missing calls to setUpClass/tearDownClass.Paul Vinciguerra1-0/+8
2019-03-28Typos. A bunch of typos I've been collecting.Paul Vinciguerra1-1/+1
2019-03-11VPP-1508: Use scapy.compat to manage packet level library differences.Paul Vinciguerra1-3/+5
2019-03-04test framework: add factory function and default parametersOle Troan1-7/+15
2019-03-01Tests: Remove all wildcard imports.Paul Vinciguerra1-3/+1
2018-12-21MAP: Convert from DPO to input feature.Jon Loeliger1-7/+91
2018-12-12PAPI: Allow ipaddress object as argument and return values from API callsOle Troan1-8/+8
2018-11-22MAP: Use explicit address/prefix types in APIOle Troan1-22/+13
2018-09-28MAP: Add check for well known ports.Ole Troan1-2/+147
2018-09-11GBP Endpoint UpdatesNeale Ranns1-1/+2
2018-01-09test: consolidate the multiple versions of send_and_*Neale Ranns1-7/+0
2017-08-08L2 over MPLSNeale Ranns1-10/+9
2017-03-10Fix MAP-E UT. Add functionality in MAP code to delete the pre-resolved next-h...Neale Ranns1-9/+11
2017-03-09make test: temporary disable MAP-E testDamjan Marion1-0/+1
2017-03-09MAP pre-resolve - use FIB to track pre-resolved next-hopNeale Ranns1-0/+171
ht .l { color: #ae81ff } /* Literal */ .highlight .n { color: #f8f8f2 } /* Name */ .highlight .o { color: #f92672 } /* Operator */ .highlight .p { color: #f8f8f2 } /* Punctuation */ .highlight .ch { color: #75715e } /* Comment.Hashbang */ .highlight .cm { color: #75715e } /* Comment.Multiline */ .highlight .cp { color: #75715e } /* Comment.Preproc */ .highlight .cpf { color: #75715e } /* Comment.PreprocFile */ .highlight .c1 { color: #75715e } /* Comment.Single */ .highlight .cs { color: #75715e } /* Comment.Special */ .highlight .gd { color: #f92672 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gi { color: #a6e22e } /* Generic.Inserted */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #75715e } /* Generic.Subheading */ .highlight .kc { color: #66d9ef } /* Keyword.Constant */ .highlight .kd { color: #66d9ef } /* Keyword.Declaration */ .highlight .kn { color: #f92672 } /* Keyword.Namespace */ .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */ .highlight .kr { color: #66d9ef } /* Keyword.Reserved */ .highlight .kt { color: #66d9ef } /* Keyword.Type */ .highlight .ld { color: #e6db74 } /* Literal.Date */ .highlight .m { color: #ae81ff } /* Literal.Number */ .highlight .s { color: #e6db74 } /* Literal.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .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) 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.
 *
 * @file
 * @brief Circular doubly linked list with head sentinel.
 * List entries are allocated out of a "supporting" pool and all pool entries
 * must contain a list anchor struct for each list they pertain to.
 */

#ifndef SRC_VPPINFRA_CLIB_LLIST_H_
#define SRC_VPPINFRA_CLIB_LLIST_H_

#include <vppinfra/types.h>
#include <vppinfra/pool.h>

typedef u32 clib_llist_index_t;

typedef struct clib_llist_anchor
{
  clib_llist_index_t prev;
  clib_llist_index_t next;
} clib_llist_anchor_t;

#define CLIB_LLIST_INVALID_INDEX ((u32)~0)

/**
 * Local variable naming macro.
 */
#define _ll_var(v) _llist_##v
/**
 * Local macros to grab llist anchor next and prev from pool entry
 */
#define _lnext(E,name) ((E)->name).next
#define _lprev(E,name) ((E)->name).prev
/**
 * Get list entry index
 *
 * @param LP	linked list pool
 * @param E	pool entry
 * @return	pool entry index
 */
#define clib_llist_entry_index(LP,E) ((E) - (LP))
/**
 * Get prev list entry index
 *
 * @param E	pool entry
 * @name	list anchor name
 * @return	previous index
 */
#define clib_llist_prev_index(E,name) _lprev(E,name)
/**
 * Get next list entry index
 *
 * @param E	pool entry
 * @name	list anchor name
 * @return	next index
 */
#define clib_llist_next_index(E,name) _lnext(E,name)
/**
 * Get next pool entry
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	pool entry
 * @return	next pool entry
 */
#define clib_llist_next(LP,name,E) pool_elt_at_index((LP),_lnext((E),name))
/**
 * Get previous pool entry
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	pool entry
 * @return	previous pool entry
 */
#define clib_llist_prev(LP,name,E) pool_elt_at_index((LP),_lprev((E),name))
/**
 * Initialize element in llist for entry
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	entry whose ll anchor is to be initialized
 */
#define clib_llist_anchor_init(LP,name,E)				\
do {									\
  _lprev ((E),name) = clib_llist_entry_index ((LP), (E));		\
  _lnext ((E),name) = _lprev ((E),name);				\
} while (0)
/**
 * Initialize llist head
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 */
#define clib_llist_make_head(LP,name)					\
({									\
  typeof (LP) _ll_var (head);						\
  pool_get_zero ((LP), _ll_var (head));					\
  clib_llist_anchor_init ((LP),name,_ll_var (head));			\
  clib_llist_entry_index ((LP), _ll_var (head));			\
})
/**
 * Check is list is empty
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param H	list head
 * @return	1 if sentinel is the only node part of the list, 0 otherwise
 */
#define clib_llist_is_empty(LP,name,H) 					\
  (clib_llist_entry_index (LP,H) == (H)->name.next)
/**
 * Check if element is linked in a list
 *
 * @param E	list element
 * @param name	list anchor name
 */
#define clib_llist_elt_is_linked(E,name)				\
  ((E)->name.next != CLIB_LLIST_INVALID_INDEX				\
   && (E)->name.prev != CLIB_LLIST_INVALID_INDEX)
/**
 * Insert entry between previous and next
 *
 * Internal use.
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	new entry
 * @param P	previous in list
 * @param N	next in list
 */
#define _llist_insert(LP,name,E,P,N)					\
do {									\
  _lprev (E,name) = _lprev(N,name);					\
  _lnext (E,name) = _lnext(P,name);					\
  _lprev ((N),name) = clib_llist_entry_index ((LP),(E));		\
  _lnext ((P),name) = clib_llist_entry_index ((LP),(E));		\
} while (0)
/**
 * Insert entry after previous
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	new entry
 * @param P	previous in list
 */
#define clib_llist_insert(LP,name,E,P) 					\
do {									\
  typeof (LP) _ll_var (N) = clib_llist_next (LP,name,P);		\
  _llist_insert ((LP),name,(E),(P), _ll_var (N));			\
} while (0)

/**
 * Add entry after head
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	new entry
 * @param H	list head
 */
#define clib_llist_add(LP,name,E,H) clib_llist_insert ((LP),name,(E),(H))
/**
 * Add entry after tail
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	new entry
 * @param H	list head
 */
#define clib_llist_add_tail(LP,name,E,H)				\
do {									\
  typeof (LP) _ll_var (P) = clib_llist_prev ((LP),name,(H));		\
  _llist_insert ((LP),name,(E),_ll_var (P),(H));			\
} while (0)
/**
 * Remove entry from list
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	entry to be removed
 */
#define clib_llist_remove(LP,name,E)					\
do {									\
  ASSERT ((E) != clib_llist_next (LP,name,E));/* don't remove sentinel */\
  ASSERT (_lnext (E,name) != CLIB_LLIST_INVALID_INDEX);			\
  ASSERT (_lprev (E,name) != CLIB_LLIST_INVALID_INDEX);			\
  typeof (LP) _ll_var (P) = clib_llist_prev ((LP),name,E);		\
  typeof (LP) _ll_var (N) = clib_llist_next ((LP),name,E);		\
  _lnext (_ll_var (P),name) = _lnext (E,name);				\
  _lprev (_ll_var (N),name) = _lprev (E,name);				\
  _lnext (E,name) = _lprev (E,name) = CLIB_LLIST_INVALID_INDEX;		\
}while (0)
/**
 * Removes and returns the first element in the list.
 *
 * The element is not freed. It's the responsability of the caller to
 * free it.
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param E	storage the first entry
 * @param H	list head entry
 */
#define clib_llist_pop_first(LP,name,E,H)				\
do {									\
  E = clib_llist_next (LP,name,H);					\
  clib_llist_remove (LP,name,E);					\
} while (0)
/**
 * Splice two lists at a given position
 *
 * List spliced into destination list is left with 0 entries, i.e., head
 * is made to point to itself.
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param P	position in destination where source list is spliced
 * @param H	head of source list that will be spliced into destination
 */
#define clib_llist_splice(LP,name,P,H)					\
do {									\
  typeof (LP) _ll_var (fe) = clib_llist_next (LP,name,H);		\
  if (_ll_var (fe) != (H))						\
    {									\
      typeof (LP) _ll_var (le) = clib_llist_prev (LP,name,H);		\
      typeof (LP) _ll_var (ne) = clib_llist_next (LP,name,P);		\
      _lprev (_ll_var (fe),name) = clib_llist_entry_index(LP,P);	\
      _lnext (_ll_var (le),name) = clib_llist_entry_index(LP,_ll_var (ne));\
      _lnext (P,name) = clib_llist_entry_index (LP,_ll_var (fe));	\
      _lprev (_ll_var (ne),name) = clib_llist_entry_index(LP,_ll_var (le));\
      _lnext (H,name) = clib_llist_entry_index(LP,H);			\
      _lprev (H,name) = _lnext (H,name);				\
    }									\
} while (0)
/**
 * Walk list starting at head
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param H	head entry
 * @param E	entry iterator
 * @param body	code to be executed
 */
#define clib_llist_foreach(LP,name,H,E,body)				\
do {									\
  typeof (LP) _ll_var (n);						\
  (E) = clib_llist_next (LP,name,H);					\
  while (E != H)							\
    { 									\
      _ll_var (n) = clib_llist_next (LP,name,E);			\
      do { body; } while (0);						\
      (E) = _ll_var (n);						\
    }									\
} while (0)
/**
 * Walk list starting at head safe
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param HI	head index
 * @param EI	entry index iterator
 * @param body	code to be executed
 */
#define clib_llist_foreach_safe(LP,name,H,E,body)			\
do {									\
  clib_llist_index_t _ll_var (HI) = clib_llist_entry_index (LP, H);	\
  clib_llist_index_t _ll_var (EI), _ll_var (NI);			\
  _ll_var (EI) = _lnext ((H),name);					\
  while (_ll_var (EI) != _ll_var (HI))					\
    { 									\
      (E) = pool_elt_at_index (LP, _ll_var (EI));			\
      _ll_var (NI) = _lnext ((E),name);					\
      do { body; } while (0);						\
      _ll_var (EI) = _ll_var (NI);					\
    }									\
} while (0)
/**
 * Walk list starting at head in reverse order
 *
 * @param LP	linked list pool
 * @param name	list anchor name
 * @param H	head entry
 * @param E	entry iterator
 * @param body	code to be executed
 */
#define clib_llist_foreach_reverse(LP,name,H,E,body)			\
do {									\
  typeof (LP) _ll_var (p);						\
  (E) = clib_llist_prev (LP,name,H);					\
  while (E != H)							\
    { 									\
      _ll_var (p) = clib_llist_prev (LP,name,E);			\
      do { body; } while (0);						\
      (E) = _ll_var (p);						\
    }									\
} while (0)

#endif /* SRC_VPPINFRA_CLIB_LLIST_H_ */

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