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