summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/vppapigen/vppapigen_json.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen_json.py b/src/tools/vppapigen/vppapigen_json.py
index 95f9e5e63ce..6c2a3a8d9ac 100644
--- a/src/tools/vppapigen/vppapigen_json.py
+++ b/src/tools/vppapigen/vppapigen_json.py
@@ -1,6 +1,12 @@
# JSON generation
import json
+def walk_imports(s):
+ r = []
+ for e in s:
+ r.append(str(e))
+ return r
+
def walk_enums(s):
r = []
@@ -69,4 +75,5 @@ def run(filename, s):
j['options'] = s['Option']
j['aliases'] = {o.name:o.alias for o in s['types'] if o.__class__.__name__ == 'Using'}
j['vl_api_version'] = hex(s['file_crc'])
+ j['imports'] = walk_imports(i for i in s['Import'])
return json.dumps(j, indent=4, separators=(',', ': '))
'n120' href='#n120'>120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
/*
 * 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.
 */
/**
 * @file
 * @brief LISP-GPE definitions.
 */

#ifndef __LISP_GPE_FWD_ENTRY_H__
#define __LISP_GPE_FWD_ENTRY_H__

#include <vnet/lisp-gpe/lisp_gpe.h>

/**
 * @brief A path on which to forward lisp traffic
 */
typedef struct lisp_fwd_path_t_
{
  /**
   * The adjacency constructed for the locator pair
   */
  index_t lisp_adj;

  /**
   * Priority. Only the paths with the best priority will be installed in FIB
   */
  u8 priority;

  /**
   * [UE]CMP weigt for the path
   */
  u8 weight;

} lisp_fwd_path_t;

/**
 * @brief A Forwarding entry can be 'normal' or 'negative'
 * Negative implies we deliberately want to add a FIB entry for an EID
 * that results in 'special' behaviour determined by an 'action'.
 * @normal means send it down some tunnels.
 */
typedef enum lisp_gpe_fwd_entry_type_t_
{
  LISP_GPE_FWD_ENTRY_TYPE_NORMAL,
  LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE,
} lisp_gpe_fwd_entry_type_t;


/**
 * LISP-GPE fwd entry key
 */
typedef struct lisp_gpe_fwd_entry_key_t_
{
  dp_address_t rmt;
  dp_address_t lcl;
  u32 vni;
} lisp_gpe_fwd_entry_key_t;

/**
 * @brief A LISP Forwarding Entry
 *
 * A forwarding entry is from a locai EID to a remote EID over a set of rloc pairs
 */
typedef struct lisp_gpe_fwd_entry_t_
{
  /**
   * Follows src/dst or dst only forwarding policy
   */
  u8 is_src_dst;

  /**
   * This object joins the FIB control plane graph to receive updates to
   * for changes to the graph.
   */
  fib_node_t node;

  /**
   * The Entry's key: {lEID,rEID,vni}
   */
  lisp_gpe_fwd_entry_key_t *key;

  /**
   * The forwarding entry type
   */
  lisp_gpe_fwd_entry_type_t type;

  /**
   * The tenant the entry belongs to
   */
  u32 tenant;

  /**
   * The VRF (in the case of L3) or Bridge-Domain (for L2) index
   */
  union
  {
    /**
     * Fields relevant to an L2 entry
     */
    struct
    {
      /**
       * The VRF ID
       */
      u32 eid_table_id;

      /**
       * The FIB index for the overlay, i.e. the FIB in which the EIDs
       * are present
       */
      u32 eid_fib_index;
      /**
       * The SRC-FIB index for created for anding source-route entries
       */
      u32 src_fib_index;
    };
    /**
     * Fields relevant to an L2 entry
     */
    struct
    {
      /**
       * The Bridge-Domain (for L2) index
       */
      u32 eid_bd_id;

      /**
       * The Bridge-domain index for the overlay EIDs
       */
      u32 eid_bd_index;

      /**
       * The path-list created for the forwarding
       */
      fib_node_index_t path_list_index;

      /**
       * Child index of this entry on the path-list
       */
      u32 child_index;

      /**
       * The DPO used to forward
       */
      dpo_id_t dpo;
    } l2;

    /**
     * Fields relevant to an NSH entry
     */
    struct
    {
      /**
       * The path-list created for the forwarding
       */
      fib_node_index_t path_list_index;

      /**
       * Child index of this entry on the path-list
       */
      u32 child_index;

      /**
       * The DPO contributed by NSH
       */
      dpo_id_t dpo;

      /**
       * The DPO used for forwarding. Obtained after stacking tx node
       * onto lb choice
       */
      dpo_id_t choice;
    } nsh;
  };

  union
  {
    /**
     * @brief When the type is 'normal'
     *        The RLOC pair that form the route's paths. i.e. where to send
     *        packets for this route.
     */
    lisp_fwd_path_t *paths;

    /**
     * @brief When the type is negative. The action to take.
     */
    negative_fwd_actions_e action;
  };

  /**
   * used for getting load balance statistics
   */
  index_t dpoi_index;

} lisp_gpe_fwd_entry_t;

extern int
vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
				 u32 * hw_if_indexp);

extern void vnet_lisp_gpe_fwd_entry_flush (void);

extern u32 lisp_l2_fib_lookup (lisp_gpe_main_t * lgm,
			       u16 bd_index, u8 src_mac[8], u8 dst_mac[8]);

extern const dpo_id_t *lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm,
					    u32 spi_si);
extern void
vnet_lisp_gpe_del_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
				u32 fwd_entry_index);
extern void
vnet_lisp_gpe_add_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
				u32 fwd_entry_index);
extern u32 *vnet_lisp_gpe_get_fwd_entry_vnis (void);

int
vnet_lisp_gpe_get_fwd_stats (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
			     vlib_counter_t * c);

#endif

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