gbp: add anonymous l3-out external interfaces
[vpp.git] / src / plugins / gbp / gbp_policy.c
1 /*
2  * Copyright (c) 2018 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 #include <plugins/gbp/gbp.h>
17 #include <plugins/gbp/gbp_policy_dpo.h>
18
19 gbp_policy_main_t gbp_policy_main;
20
21 static clib_error_t *
22 gbp_policy_init (vlib_main_t * vm)
23 {
24   gbp_policy_main_t *gpm = &gbp_policy_main;
25   clib_error_t *error = 0;
26
27   /* Initialize the feature next-node indexes */
28   vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-port");
29   feat_bitmap_init_next_nodes (vm,
30                                node->index,
31                                L2OUTPUT_N_FEAT,
32                                l2output_get_feat_names (),
33                                gpm->l2_output_feat_next[GBP_POLICY_PORT]);
34
35   node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-mac");
36   feat_bitmap_init_next_nodes (vm,
37                                node->index,
38                                L2OUTPUT_N_FEAT,
39                                l2output_get_feat_names (),
40                                gpm->l2_output_feat_next[GBP_POLICY_MAC]);
41
42   node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-lpm");
43   feat_bitmap_init_next_nodes (vm,
44                                node->index,
45                                L2OUTPUT_N_FEAT,
46                                l2output_get_feat_names (),
47                                gpm->l2_output_feat_next[GBP_POLICY_LPM]);
48
49   return error;
50 }
51
52 VLIB_INIT_FUNCTION (gbp_policy_init);
53
54 /*
55  * fd.io coding-style-patch-verification: ON
56  *
57  * Local Variables:
58  * eval: (c-set-style "gnu")
59  * End:
60  */