]> git.proxmox.com Git - mirror_frr.git/blob - staticd/static_nb.h
Merge pull request #8044 from SaiGomathiN/nsg
[mirror_frr.git] / staticd / static_nb.h
1 /*
2 * Copyright (C) 2018 Vmware
3 * Vishal Dhingra
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; see the file COPYING; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #ifndef _FRR_STATIC_NB_H_
19 #define _FRR_STATIC_NB_H_
20
21 extern const struct frr_yang_module_info frr_staticd_info;
22
23 /* Mandatory callbacks. */
24 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_create(
25 struct nb_cb_create_args *args);
26 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_destroy(
27 struct nb_cb_destroy_args *args);
28 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_create(
29 struct nb_cb_create_args *args);
30 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_destroy(
31 struct nb_cb_destroy_args *args);
32 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_tag_modify(
33 struct nb_cb_modify_args *args);
34 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_create(
35 struct nb_cb_create_args *args);
36 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_destroy(
37 struct nb_cb_destroy_args *args);
38 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_modify(
39 struct nb_cb_modify_args *args);
40 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_destroy(
41 struct nb_cb_destroy_args *args);
42 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_onlink_modify(
43 struct nb_cb_modify_args *args);
44 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_color_modify(
45 struct nb_cb_modify_args *args);
46 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_color_destroy(
47 struct nb_cb_destroy_args *args);
48 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_create(
49 struct nb_cb_create_args *args);
50 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_destroy(
51 struct nb_cb_destroy_args *args);
52 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify(
53 struct nb_cb_modify_args *args);
54 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy(
55 struct nb_cb_destroy_args *args);
56 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify(
57 struct nb_cb_modify_args *args);
58 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy(
59 struct nb_cb_destroy_args *args);
60 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify(
61 struct nb_cb_modify_args *args);
62 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy(
63 struct nb_cb_destroy_args *args);
64 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create(
65 struct nb_cb_create_args *args);
66 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy(
67 struct nb_cb_destroy_args *args);
68 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create(
69 struct nb_cb_create_args *args);
70 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy(
71 struct nb_cb_destroy_args *args);
72 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_tag_modify(
73 struct nb_cb_modify_args *args);
74 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_create(
75 struct nb_cb_create_args *args);
76 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_destroy(
77 struct nb_cb_destroy_args *args);
78 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify(
79 struct nb_cb_modify_args *args);
80 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_destroy(
81 struct nb_cb_destroy_args *args);
82 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_onlink_modify(
83 struct nb_cb_modify_args *args);
84 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_modify(
85 struct nb_cb_modify_args *args);
86 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_destroy(
87 struct nb_cb_destroy_args *args);
88 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_create(
89 struct nb_cb_create_args *args);
90 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_destroy(
91 struct nb_cb_destroy_args *args);
92 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify(
93 struct nb_cb_modify_args *args);
94 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy(
95 struct nb_cb_destroy_args *args);
96 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify(
97 struct nb_cb_modify_args *args);
98 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy(
99 struct nb_cb_destroy_args *args);
100 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify(
101 struct nb_cb_modify_args *args);
102 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy(
103 struct nb_cb_destroy_args *args);
104
105 /* Optional 'apply_finish' callbacks. */
106
107 void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_apply_finish(
108 struct nb_cb_apply_finish_args *args);
109 void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_apply_finish(
110 struct nb_cb_apply_finish_args *args);
111
112 /* Optional 'pre_validate' callbacks. */
113 int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate(
114 struct nb_cb_pre_validate_args *args);
115
116 /*
117 * Callback registered with routing_nb lib to validate only
118 * one instance of staticd is allowed
119 */
120 int routing_control_plane_protocols_name_validate(
121 struct nb_cb_create_args *args);
122
123 /* xpath macros */
124 /* route-list */
125 #define FRR_STATIC_ROUTE_INFO_KEY_XPATH \
126 "/frr-routing:routing/control-plane-protocols/" \
127 "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
128 "frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
129 "path-list[table-id='%u'][distance='%u']"
130
131
132 #define FRR_STATIC_ROUTE_PATH_TAG_XPATH "/tag"
133
134 /* route-list/frr-nexthops */
135 #define FRR_STATIC_ROUTE_NH_KEY_XPATH \
136 "/frr-nexthops/" \
137 "nexthop[nh-type='%s'][vrf='%s'][gateway='%s'][interface='%s']"
138
139 #define FRR_STATIC_ROUTE_NH_ONLINK_XPATH "/onlink"
140
141 #define FRR_STATIC_ROUTE_NH_COLOR_XPATH "/srte-color"
142
143 #define FRR_STATIC_ROUTE_NH_BH_XPATH "/bh-type"
144
145 #define FRR_STATIC_ROUTE_NH_LABEL_XPATH "/mpls-label-stack"
146
147 #define FRR_STATIC_ROUTE_NHLB_KEY_XPATH "/entry[id='%u']/label"
148
149 /* route-list/srclist */
150 #define FRR_S_ROUTE_SRC_INFO_KEY_XPATH \
151 "/frr-routing:routing/control-plane-protocols/" \
152 "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
153 "frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
154 "src-list[src-prefix='%s']/path-list[table-id='%u'][distance='%u']"
155
156 /* route-list/frr-nexthops */
157 #define FRR_DEL_S_ROUTE_NH_KEY_XPATH \
158 FRR_STATIC_ROUTE_INFO_KEY_XPATH \
159 FRR_STATIC_ROUTE_NH_KEY_XPATH
160
161 /* route-list/src/src-list/frr-nexthops*/
162 #define FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH \
163 FRR_S_ROUTE_SRC_INFO_KEY_XPATH \
164 FRR_STATIC_ROUTE_NH_KEY_XPATH
165
166 #endif