Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 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> |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 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> |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 26 | |
| 27 | typedef enum fib_test_lb_bucket_type_t_ { |
| 28 | FT_LB_LABEL_O_ADJ, |
| 29 | FT_LB_LABEL_STACK_O_ADJ, |
Neale Ranns | 1c59df7 | 2021-01-26 12:08:25 +0000 | [diff] [blame] | 30 | FT_LB_LABEL_CHAIN_O_ADJ, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 31 | FT_LB_LABEL_O_LB, |
| 32 | FT_LB_O_LB, |
Neale Ranns | 31ed744 | 2018-02-23 05:29:09 -0800 | [diff] [blame] | 33 | FT_LB_MPLS_DISP_PIPE_O_ADJ, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 34 | FT_LB_INTF, |
Neale Ranns | 6f63115 | 2017-10-03 08:20:21 -0700 | [diff] [blame] | 35 | FT_LB_L2, |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 36 | FT_LB_BIER_TABLE, |
| 37 | FT_LB_BIER_FMASK, |
| 38 | FT_LB_DROP, |
Neale Ranns | 2303cb1 | 2018-02-21 04:57:17 -0800 | [diff] [blame] | 39 | FT_LB_PUNT, |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 40 | FT_LB_ADJ, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 41 | } fib_test_lb_bucket_type_t; |
| 42 | |
| 43 | typedef struct fib_test_lb_bucket_t_ { |
| 44 | fib_test_lb_bucket_type_t type; |
| 45 | |
| 46 | union |
| 47 | { |
| 48 | struct |
| 49 | { |
| 50 | mpls_eos_bit_t eos; |
| 51 | mpls_label_t label; |
Neale Ranns | 31ed744 | 2018-02-23 05:29:09 -0800 | [diff] [blame] | 52 | fib_mpls_lsp_mode_t mode; |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 53 | u8 ttl; |
| 54 | adj_index_t adj; |
| 55 | } label_o_adj; |
| 56 | struct |
| 57 | { |
| 58 | mpls_eos_bit_t eos; |
Neale Ranns | 1c59df7 | 2021-01-26 12:08:25 +0000 | [diff] [blame] | 59 | mpls_label_t label_chain[8]; |
| 60 | fib_mpls_lsp_mode_t mode; |
| 61 | u8 label_chain_size; |
| 62 | u8 ttl; |
| 63 | adj_index_t adj; |
| 64 | } label_chain_o_adj; |
| 65 | struct |
| 66 | { |
| 67 | mpls_eos_bit_t eos; |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 68 | mpls_label_t label_stack[8]; |
Neale Ranns | 31ed744 | 2018-02-23 05:29:09 -0800 | [diff] [blame] | 69 | fib_mpls_lsp_mode_t mode; |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 70 | u8 label_stack_size; |
| 71 | u8 ttl; |
| 72 | adj_index_t adj; |
| 73 | } label_stack_o_adj; |
| 74 | struct |
| 75 | { |
| 76 | mpls_eos_bit_t eos; |
| 77 | mpls_label_t label; |
Neale Ranns | 31ed744 | 2018-02-23 05:29:09 -0800 | [diff] [blame] | 78 | fib_mpls_lsp_mode_t mode; |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 79 | u8 ttl; |
| 80 | index_t lb; |
| 81 | } label_o_lb; |
| 82 | struct |
| 83 | { |
| 84 | index_t adj; |
| 85 | } adj; |
| 86 | struct |
| 87 | { |
| 88 | index_t lb; |
| 89 | } lb; |
| 90 | struct |
| 91 | { |
| 92 | index_t adj; |
| 93 | } special; |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 94 | struct |
| 95 | { |
| 96 | union { |
| 97 | index_t table; |
| 98 | index_t fmask; |
| 99 | }; |
| 100 | } bier; |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 101 | }; |
| 102 | } fib_test_lb_bucket_t; |
| 103 | |
| 104 | typedef enum fib_test_rep_bucket_type_t_ { |
| 105 | FT_REP_LABEL_O_ADJ, |
Neale Ranns | 6f63115 | 2017-10-03 08:20:21 -0700 | [diff] [blame] | 106 | FT_REP_DISP_MFIB_LOOKUP, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 107 | FT_REP_INTF, |
| 108 | } fib_test_rep_bucket_type_t; |
| 109 | |
| 110 | typedef struct fib_test_rep_bucket_t_ { |
| 111 | fib_test_rep_bucket_type_t type; |
| 112 | |
| 113 | union |
| 114 | { |
| 115 | struct |
| 116 | { |
| 117 | mpls_eos_bit_t eos; |
| 118 | mpls_label_t label; |
| 119 | u8 ttl; |
| 120 | adj_index_t adj; |
| 121 | } label_o_adj; |
| 122 | struct |
| 123 | { |
| 124 | adj_index_t adj; |
| 125 | } adj; |
| 126 | }; |
| 127 | } fib_test_rep_bucket_t; |
| 128 | |
| 129 | |
| 130 | extern int fib_test_validate_rep_v(const replicate_t *rep, |
| 131 | u16 n_buckets, |
Christophe Fontaine | d3c008d | 2017-10-02 18:10:54 +0200 | [diff] [blame] | 132 | va_list *ap); |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 133 | |
| 134 | extern int fib_test_validate_lb_v(const load_balance_t *lb, |
Damjan Marion | bb17f3c | 2018-02-06 19:29:35 +0100 | [diff] [blame] | 135 | int n_buckets, |
Christophe Fontaine | d3c008d | 2017-10-02 18:10:54 +0200 | [diff] [blame] | 136 | va_list *ap); |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 137 | |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 138 | extern int fib_test_validate_lb(const dpo_id_t *dpo, |
Damjan Marion | bb17f3c | 2018-02-06 19:29:35 +0100 | [diff] [blame] | 139 | int n_buckets, |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 140 | ...); |
| 141 | |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 142 | extern int fib_test_validate_entry(fib_node_index_t fei, |
| 143 | fib_forward_chain_type_t fct, |
Gabriel Ganne | d71e0fc | 2017-10-26 10:35:28 +0200 | [diff] [blame] | 144 | int n_buckets, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 145 | ...); |
| 146 | |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 147 | |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 148 | #endif |