blob: f3d8346aab3dd60d2a0ac488d5dfd438dc417fdb [file] [log] [blame]
Neale Ranns0f26c5a2017-03-01 15:12:11 -08001/*
2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __FIB_TEST_H__
17#define __FIB_TEST_H__
18
19#include <vnet/fib/fib_types.h>
Neale Rannsd792d9c2017-10-21 10:53:20 -070020#include <vnet/mpls/mpls_types.h>
21#include <vnet/fib/fib_types.h>
22#include <vnet/mpls/packet.h>
23#include <vnet/dpo/load_balance.h>
24#include <vnet/adj/adj_types.h>
25#include <vnet/dpo/replicate_dpo.h>
Neale Ranns0f26c5a2017-03-01 15:12:11 -080026
27typedef enum fib_test_lb_bucket_type_t_ {
28 FT_LB_LABEL_O_ADJ,
29 FT_LB_LABEL_STACK_O_ADJ,
30 FT_LB_LABEL_O_LB,
31 FT_LB_O_LB,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080032 FT_LB_INTF,
Neale Ranns6f631152017-10-03 08:20:21 -070033 FT_LB_L2,
Neale Rannsd792d9c2017-10-21 10:53:20 -070034 FT_LB_BIER_TABLE,
35 FT_LB_BIER_FMASK,
36 FT_LB_DROP,
37 FT_LB_ADJ,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080038} fib_test_lb_bucket_type_t;
39
40typedef struct fib_test_lb_bucket_t_ {
41 fib_test_lb_bucket_type_t type;
42
43 union
44 {
45 struct
46 {
47 mpls_eos_bit_t eos;
48 mpls_label_t label;
49 u8 ttl;
50 adj_index_t adj;
51 } label_o_adj;
52 struct
53 {
54 mpls_eos_bit_t eos;
55 mpls_label_t label_stack[8];
56 u8 label_stack_size;
57 u8 ttl;
58 adj_index_t adj;
59 } label_stack_o_adj;
60 struct
61 {
62 mpls_eos_bit_t eos;
63 mpls_label_t label;
64 u8 ttl;
65 index_t lb;
66 } label_o_lb;
67 struct
68 {
69 index_t adj;
70 } adj;
71 struct
72 {
73 index_t lb;
74 } lb;
75 struct
76 {
77 index_t adj;
78 } special;
Neale Rannsd792d9c2017-10-21 10:53:20 -070079 struct
80 {
81 union {
82 index_t table;
83 index_t fmask;
84 };
85 } bier;
Neale Ranns0f26c5a2017-03-01 15:12:11 -080086 };
87} fib_test_lb_bucket_t;
88
89typedef enum fib_test_rep_bucket_type_t_ {
90 FT_REP_LABEL_O_ADJ,
Neale Ranns6f631152017-10-03 08:20:21 -070091 FT_REP_DISP_MFIB_LOOKUP,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080092 FT_REP_INTF,
93} fib_test_rep_bucket_type_t;
94
95typedef struct fib_test_rep_bucket_t_ {
96 fib_test_rep_bucket_type_t type;
97
98 union
99 {
100 struct
101 {
102 mpls_eos_bit_t eos;
103 mpls_label_t label;
104 u8 ttl;
105 adj_index_t adj;
106 } label_o_adj;
107 struct
108 {
109 adj_index_t adj;
110 } adj;
111 };
112} fib_test_rep_bucket_t;
113
114
115extern int fib_test_validate_rep_v(const replicate_t *rep,
116 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200117 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800118
119extern int fib_test_validate_lb_v(const load_balance_t *lb,
120 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200121 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800122
Neale Rannsd792d9c2017-10-21 10:53:20 -0700123extern int fib_test_validate_lb(const dpo_id_t *dpo,
124 u16 n_buckets,
125 ...);
126
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800127extern int fib_test_validate_entry(fib_node_index_t fei,
128 fib_forward_chain_type_t fct,
Gabriel Ganned71e0fc2017-10-26 10:35:28 +0200129 int n_buckets,
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800130 ...);
131
Neale Rannsd792d9c2017-10-21 10:53:20 -0700132
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800133#endif