blob: 3692f57386d1e5a2d2421f83ed1d7c88f13de461 [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>
20
21typedef enum fib_test_lb_bucket_type_t_ {
22 FT_LB_LABEL_O_ADJ,
23 FT_LB_LABEL_STACK_O_ADJ,
24 FT_LB_LABEL_O_LB,
25 FT_LB_O_LB,
26 FT_LB_SPECIAL,
27 FT_LB_ADJ,
28 FT_LB_INTF,
29} fib_test_lb_bucket_type_t;
30
31typedef struct fib_test_lb_bucket_t_ {
32 fib_test_lb_bucket_type_t type;
33
34 union
35 {
36 struct
37 {
38 mpls_eos_bit_t eos;
39 mpls_label_t label;
40 u8 ttl;
41 adj_index_t adj;
42 } label_o_adj;
43 struct
44 {
45 mpls_eos_bit_t eos;
46 mpls_label_t label_stack[8];
47 u8 label_stack_size;
48 u8 ttl;
49 adj_index_t adj;
50 } label_stack_o_adj;
51 struct
52 {
53 mpls_eos_bit_t eos;
54 mpls_label_t label;
55 u8 ttl;
56 index_t lb;
57 } label_o_lb;
58 struct
59 {
60 index_t adj;
61 } adj;
62 struct
63 {
64 index_t lb;
65 } lb;
66 struct
67 {
68 index_t adj;
69 } special;
70 };
71} fib_test_lb_bucket_t;
72
73typedef enum fib_test_rep_bucket_type_t_ {
74 FT_REP_LABEL_O_ADJ,
75 FT_REP_INTF,
76} fib_test_rep_bucket_type_t;
77
78typedef struct fib_test_rep_bucket_t_ {
79 fib_test_rep_bucket_type_t type;
80
81 union
82 {
83 struct
84 {
85 mpls_eos_bit_t eos;
86 mpls_label_t label;
87 u8 ttl;
88 adj_index_t adj;
89 } label_o_adj;
90 struct
91 {
92 adj_index_t adj;
93 } adj;
94 };
95} fib_test_rep_bucket_t;
96
97
98extern int fib_test_validate_rep_v(const replicate_t *rep,
99 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200100 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800101
102extern int fib_test_validate_lb_v(const load_balance_t *lb,
103 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200104 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800105
106extern int fib_test_validate_entry(fib_node_index_t fei,
107 fib_forward_chain_type_t fct,
108 u16 n_buckets,
109 ...);
110
111#endif