blob: 53697cb62aee104499aed62af20aad2d02452639 [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 Ranns62fe07c2017-10-31 12:28:22 -070032 FT_LB_MPLS_DISP_O_ADJ,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080033 FT_LB_INTF,
Neale Ranns6f631152017-10-03 08:20:21 -070034 FT_LB_L2,
Neale Rannsd792d9c2017-10-21 10:53:20 -070035 FT_LB_BIER_TABLE,
36 FT_LB_BIER_FMASK,
37 FT_LB_DROP,
38 FT_LB_ADJ,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080039} fib_test_lb_bucket_type_t;
40
41typedef 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 u8 ttl;
51 adj_index_t adj;
52 } label_o_adj;
53 struct
54 {
55 mpls_eos_bit_t eos;
56 mpls_label_t label_stack[8];
57 u8 label_stack_size;
58 u8 ttl;
59 adj_index_t adj;
60 } label_stack_o_adj;
61 struct
62 {
63 mpls_eos_bit_t eos;
64 mpls_label_t label;
65 u8 ttl;
66 index_t lb;
67 } label_o_lb;
68 struct
69 {
70 index_t adj;
71 } adj;
72 struct
73 {
74 index_t lb;
75 } lb;
76 struct
77 {
78 index_t adj;
79 } special;
Neale Rannsd792d9c2017-10-21 10:53:20 -070080 struct
81 {
82 union {
83 index_t table;
84 index_t fmask;
85 };
86 } bier;
Neale Ranns0f26c5a2017-03-01 15:12:11 -080087 };
88} fib_test_lb_bucket_t;
89
90typedef enum fib_test_rep_bucket_type_t_ {
91 FT_REP_LABEL_O_ADJ,
Neale Ranns6f631152017-10-03 08:20:21 -070092 FT_REP_DISP_MFIB_LOOKUP,
Neale Ranns0f26c5a2017-03-01 15:12:11 -080093 FT_REP_INTF,
94} fib_test_rep_bucket_type_t;
95
96typedef struct fib_test_rep_bucket_t_ {
97 fib_test_rep_bucket_type_t type;
98
99 union
100 {
101 struct
102 {
103 mpls_eos_bit_t eos;
104 mpls_label_t label;
105 u8 ttl;
106 adj_index_t adj;
107 } label_o_adj;
108 struct
109 {
110 adj_index_t adj;
111 } adj;
112 };
113} fib_test_rep_bucket_t;
114
115
116extern int fib_test_validate_rep_v(const replicate_t *rep,
117 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200118 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800119
120extern int fib_test_validate_lb_v(const load_balance_t *lb,
121 u16 n_buckets,
Christophe Fontained3c008d2017-10-02 18:10:54 +0200122 va_list *ap);
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800123
Neale Rannsd792d9c2017-10-21 10:53:20 -0700124extern int fib_test_validate_lb(const dpo_id_t *dpo,
125 u16 n_buckets,
126 ...);
127
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800128extern int fib_test_validate_entry(fib_node_index_t fei,
129 fib_forward_chain_type_t fct,
Gabriel Ganned71e0fc2017-10-26 10:35:28 +0200130 int n_buckets,
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800131 ...);
132
Neale Rannsd792d9c2017-10-21 10:53:20 -0700133
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800134#endif