MPLS Unifom mode
[vpp.git] / src / vnet / fib / fib_test.h
1 /*
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>
20 #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>
26
27 typedef 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,
32     FT_LB_MPLS_DISP_PIPE_O_ADJ,
33     FT_LB_INTF,
34     FT_LB_L2,
35     FT_LB_BIER_TABLE,
36     FT_LB_BIER_FMASK,
37     FT_LB_DROP,
38     FT_LB_ADJ,
39 } fib_test_lb_bucket_type_t;
40
41 typedef struct fib_test_lb_bucket_t_ {
42     fib_test_lb_bucket_type_t type;
43
44     union
45     {
46         struct
47         {
48             mpls_eos_bit_t eos;
49             mpls_label_t label;
50             fib_mpls_lsp_mode_t mode;
51             u8 ttl;
52             adj_index_t adj;
53         } label_o_adj;
54         struct
55         {
56             mpls_eos_bit_t eos;
57             mpls_label_t label_stack[8];
58             fib_mpls_lsp_mode_t mode;
59             u8 label_stack_size;
60             u8 ttl;
61             adj_index_t adj;
62         } label_stack_o_adj;
63         struct
64         {
65             mpls_eos_bit_t eos;
66             mpls_label_t label;
67             fib_mpls_lsp_mode_t mode;
68             u8 ttl;
69             index_t lb;
70         } label_o_lb;
71         struct
72         {
73             index_t adj;
74         } adj;
75         struct
76         {
77             index_t lb;
78         } lb;
79         struct
80         {
81             index_t adj;
82         } special;
83         struct
84         {
85             union {
86                 index_t table;
87                 index_t fmask;
88             };
89         } bier;
90     };
91 } fib_test_lb_bucket_t;
92
93 typedef enum fib_test_rep_bucket_type_t_ {
94     FT_REP_LABEL_O_ADJ,
95     FT_REP_DISP_MFIB_LOOKUP,
96     FT_REP_INTF,
97 } fib_test_rep_bucket_type_t;
98
99 typedef struct fib_test_rep_bucket_t_ {
100     fib_test_rep_bucket_type_t type;
101
102     union
103     {
104         struct
105         {
106             mpls_eos_bit_t eos;
107             mpls_label_t label;
108             u8 ttl;
109             adj_index_t adj;
110         } label_o_adj;
111         struct
112         {
113             adj_index_t adj;
114         } adj;
115    };
116 } fib_test_rep_bucket_t;
117
118
119 extern int fib_test_validate_rep_v(const replicate_t *rep,
120                                    u16 n_buckets,
121                                    va_list *ap);
122
123 extern int fib_test_validate_lb_v(const load_balance_t *lb,
124                                   int n_buckets,
125                                   va_list *ap);
126
127 extern int fib_test_validate_lb(const dpo_id_t *dpo,
128                                 int n_buckets,
129                                 ...);
130
131 extern int fib_test_validate_entry(fib_node_index_t fei,
132                                    fib_forward_chain_type_t fct,
133                                    int n_buckets,
134                                    ...);
135
136
137 #endif