L2 BD API to flush all IP-MAC entries in the specified BD
[vpp.git] / extras / vom / vom / CMakeLists.txt
1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 unset (VPPAPICLIENT_LIB)
15 unset (VAPICLIENT_LIB)
16 unset (ACL_FILE)
17 unset (NAT_FILE)
18 unset (L2E_FILE)
19 unset (GBP_FILE)
20 unset (IGMP_FILE)
21 unset (VOM_SOURCES)
22 unset (VOM_HEADERS)
23
24 find_library(VPPAPICLIENT_LIB NAMES vppapiclient REQUIRED)
25 find_path(VPPAPICLIENT_INCLUDE_DIR NAMES vpp-api/client/vppapiclient.h)
26 find_library(VAPICLIENT_LIB NAMES vapiclient REQUIRED)
27 find_path(VAPICLIENT_INCLUDE_DIR NAMES vapi/vapi.hpp)
28
29
30 if(NOT VPPAPICLIENT_INCLUDE_DIR OR NOT VPPAPICLIENT_LIB)
31   message(FATAL_ERROR "Cannot find vppapiclient library and/or headers")
32 endif()
33 if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB)
34   message(FATAL_ERROR "Cannot find vapiclient library and/or headers")
35 endif()
36
37 include_directories(${VPPAPICLIENT_INCLUDE_DIR})
38 include_directories(${VAPICLIENT_INCLUDE_DIR})
39 include_directories(${CMAKE_SOURCE_DIR})
40
41 find_file(ACL_FILE NAMES acl.api.vapi.hpp PATH_SUFFIXES vapi)
42 find_file(NAT_FILE NAMES nat.api.vapi.hpp PATH_SUFFIXES vapi)
43 find_file(L2E_FILE NAMES l2e.api.vapi.hpp PATH_SUFFIXES vapi)
44 find_file(GBP_FILE NAMES gbp.api.vapi.hpp PATH_SUFFIXES vapi)
45 find_file(IGMP_FILE NAMES igmp.api.vapi.hpp PATH_SUFFIXES vapi)
46
47 if(ACL_FILE)
48   list(APPEND VOM_SOURCES
49     acl_binding_cmds.cpp
50     acl_binding.cpp
51     acl_ethertype_cmds.cpp
52     acl_ethertype.cpp
53     acl_l2_rule.cpp
54     acl_l3_rule.cpp
55     acl_list_cmds.cpp
56     acl_list.cpp
57     acl_types.cpp
58   )
59 endif()
60
61 if(NAT_FILE)
62   list(APPEND VOM_SOURCES
63     nat_static.cpp
64     nat_static_cmds.cpp
65     nat_binding.cpp
66     nat_binding_cmds.cpp
67   )
68 endif()
69
70 if (L2E_FILE)
71   list(APPEND VOM_SOURCES
72     l2_emulation_cmds.cpp
73     l2_emulation.cpp
74   )
75 endif()
76
77 if(GBP_FILE)
78   list(APPEND VOM_SOURCES
79     gbp_contract_cmds.cpp
80     gbp_contract.cpp
81     gbp_bridge_domain_cmds.cpp
82     gbp_bridge_domain.cpp
83     gbp_endpoint_cmds.cpp
84     gbp_endpoint.cpp
85     gbp_endpoint_group_cmds.cpp
86     gbp_endpoint_group.cpp
87     gbp_ext_itf.cpp
88     gbp_ext_itf_cmds.cpp
89     gbp_recirc_cmds.cpp
90     gbp_recirc.cpp
91     gbp_route_domain_cmds.cpp
92     gbp_route_domain.cpp
93     gbp_rule.cpp
94     gbp_subnet_cmds.cpp
95     gbp_subnet.cpp
96     gbp_vxlan.cpp
97     gbp_vxlan_cmds.cpp
98   )
99 endif()
100
101 if (IGMP_FILE)
102   list(APPEND VOM_SOURCES
103     igmp_binding_cmds.cpp
104     igmp_binding.cpp
105     igmp_listen_cmds.cpp
106     igmp_listen.cpp
107   )
108 endif()
109
110 list(APPEND VOM_SOURCES
111   types.cpp
112   api_types.cpp
113   arp_proxy_binding_cmds.cpp
114   arp_proxy_binding.cpp
115   arp_proxy_config_cmds.cpp
116   arp_proxy_config.cpp
117   bond_group_binding_cmds.cpp
118   bond_group_binding.cpp
119   bond_interface_cmds.cpp
120   bond_interface.cpp
121   bond_member.cpp
122   bridge_domain_cmds.cpp
123   bridge_domain.cpp
124   bridge_domain_arp_entry.cpp
125   bridge_domain_arp_entry_cmds.cpp
126   bridge_domain_entry_cmds.cpp
127   bridge_domain_entry.cpp
128   client_db.cpp
129   cmd.cpp
130   connection.cpp
131   dhcp_client_cmds.cpp
132   dhcp_client.cpp
133   hw_cmds.cpp
134   hw.cpp
135   inspect.cpp
136   interface_cmds.cpp
137   interface.cpp
138   interface_factory.cpp
139   interface_ip6_nd_cmds.cpp
140   interface_span_cmds.cpp
141   interface_span.cpp
142   interface_types.cpp
143   ip_punt_redirect_cmds.cpp
144   ip_punt_redirect.cpp
145   ip_unnumbered_cmds.cpp
146   ip_unnumbered.cpp
147   l2_binding_cmds.cpp
148   l2_binding.cpp
149   l2_xconnect_cmds.cpp
150   l2_xconnect.cpp
151   l3_binding_cmds.cpp
152   l3_binding.cpp
153   lldp_binding_cmds.cpp
154   lldp_binding.cpp
155   lldp_global_cmds.cpp
156   lldp_global.cpp
157   logger.cpp
158   neighbour.cpp
159   neighbour_cmds.cpp
160   object_base.cpp
161   om.cpp
162   pipe.cpp
163   pipe_cmds.cpp
164   prefix.cpp
165   ra_config.cpp
166   ra_prefix.cpp
167   route.cpp
168   route_cmds.cpp
169   route_domain.cpp
170   route_domain_cmds.cpp
171   stat_client.cpp
172   stat_reader.cpp
173   sub_interface_cmds.cpp
174   sub_interface.cpp
175   tap_interface.cpp
176   tap_interface_cmds.cpp
177   vxlan_gbp_tunnel_cmds.cpp
178   vxlan_tunnel_cmds.cpp
179   vxlan_tunnel.cpp
180 )
181
182 if(ACL_FILE)
183   list(APPEND VOM_HEADERS
184     acl_binding.hpp
185     acl_ethertype.hpp
186     acl_l2_rule.hpp
187     acl_l3_rule.hpp
188     acl_list.hpp
189     acl_types.hpp
190   )
191 endif()
192
193 if(NAT_FILE)
194   list(APPEND VOM_HEADERS
195     nat_static.hpp
196     nat_binding.hpp
197   )
198 endif()
199
200 if(L2E_FILE)
201   list(APPEND VOM_HEADERS
202     l2_emulation.hpp
203   )
204 endif()
205
206 if(GBP_FILE)
207   list(APPEND VOM_HEADERS
208     gbp_contract.hpp
209     gbp_bridge_domain.hpp
210     gbp_endpoint.hpp
211     gbp_endpoint_group.hpp
212     gbp_ext_itf.hpp
213     gbp_recirc.hpp
214     gbp_route_domain.hpp
215     gbp_rule.hpp
216     gbp_subnet.hpp
217     gbp_vxlan.hpp
218   )
219 endif()
220
221 if(IGMP_FILE)
222   list(APPEND VOM_HEADERS
223     igmp_binding.hpp
224     igmp_listen.hpp
225   )
226 endif()
227
228 list(APPEND VOM_HEADERS
229   arp_proxy_binding.hpp
230   arp_proxy_config.hpp
231   bond_group_binding.hpp
232   bond_interface.hpp
233   bond_member.hpp
234   bridge_domain.hpp
235   bridge_domain_arp_entry.hpp
236   bridge_domain_entry.hpp
237   client_db.hpp
238   cmd.hpp
239   connection.hpp
240   dhcp_client.hpp
241   dump_cmd.hpp
242   enum_base.hpp
243   event_cmd.hpp
244   hw.hpp
245   inspect.hpp
246   interface.hpp
247   interface_cmds.hpp
248   interface_ip6_nd.hpp
249   interface_span.hpp
250   ip_punt_redirect.hpp
251   ip_unnumbered.hpp
252   l2_binding.hpp
253   l2_xconnect.hpp
254   l3_binding.hpp
255   lldp_binding.hpp
256   lldp_global.hpp
257   logger.hpp
258   neighbour.hpp
259   object_base.hpp
260   om.hpp
261   pipe.hpp
262   prefix.hpp
263   ra_config.hpp
264   ra_prefix.hpp
265   route.hpp
266   route_domain.hpp
267   rpc_cmd.hpp
268   singular_db.hpp
269   singular_db_funcs.hpp
270   stat_client.hpp
271   stat_reader.hpp
272   sub_interface.hpp
273   tap_interface.hpp
274   types.hpp
275   api_types.hpp
276   vxlan_tunnel.hpp
277 )
278
279 add_definitions(-Wall -Werror -std=gnu++11)
280
281 add_vpp_library(vom
282   SOURCES ${VOM_SOURCES}
283
284   INSTALL_HEADERS ${VOM_HEADERS}
285
286   LINK_LIBRARIES ${VPPAPICLIENT_LIB} ${VAPICLIENT_LIB} Threads::Threads
287     ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} m rt
288
289   COMPONENT libvom
290 )
291
292 if (Boost_FOUND)
293   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
294     add_definitions(-stdlib=libstdc++)
295   endif()
296   add_executable(vom_stats_test test_stats.cpp)
297   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
298     target_link_libraries(vom_stats_test vom stdc++)
299   else()
300     target_link_libraries(vom_stats_test vom)
301   endif()
302 endif()