blob: a9463d60830570961956b7adb7b11f4d56deeeb1 [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,
Neale Ranns6f631152017-10-03 08:20:21 -070029 FT_LB_L2,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080030} fib_test_lb_bucket_type_t;
31
32typedef struct fib_test_lb_bucket_t_ {
33 fib_test_lb_bucket_type_t type;
34
35 union
36 {
37 struct
38 {
39 mpls_eos_bit_t eos;
40 mpls_label_t label;
41 u8 ttl;
42 adj_index_t adj;
43 } label_o_adj;
44 struct
45 {
46 mpls_eos_bit_t eos;
47 mpls_label_t label_stack[8];
48 u8 label_stack_size;
49 u8 ttl;
50 adj_index_t adj;
51 } label_stack_o_adj;
52 struct
53 {
54 mpls_eos_bit_t eos;
55 mpls_label_t label;
56 u8 ttl;
57 index_t lb;
58 } label_o_lb;
59 struct
60 {
61 index_t adj;
62 } adj;
63 struct
64 {
65 index_t lb;
66 } lb;
67 struct
68 {
69 index_t adj;
70 } special;
71 };
72} fib_test_lb_bucket_t;
73
74typedef enum fib_test_rep_bucket_type_t_ {
75 FT_REP_LABEL_O_ADJ,
Neale Ranns6f631152017-10-03 08:20:21 -070076 FT_REP_DISP_MFIB_LOOKUP,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080077 FT_REP_INTF,
78} fib_test_rep_bucket_type_t;
79
80typedef struct fib_test_rep_bucket_t_ {
81 fib_test_rep_bucket_type_t type;
82
83 union
84 {
85 struct
86 {
87 mpls_eos_bit_t eos;
88 mpls_label_t label;
89 u8 ttl;
90 adj_index_t adj;
91 } label_o_adj;
92 struct
93 {
94 adj_index_t adj;
95 } adj;
96 };
97} fib_test_rep_bucket_t;
98
99
100extern int fib_test_validate_rep_v(const replicate_t *rep,
101 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200102 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800103
104extern int fib_test_validate_lb_v(const load_balance_t *lb,
105 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200106 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800107
108extern int fib_test_validate_entry(fib_node_index_t fei,
109 fib_forward_chain_type_t fct,
Gabriel Ganned71e0fc2017-10-26 10:35:28 +0200110 int n_buckets,
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800111 ...);
112
113#endif