Line data Source code
1 : /*
2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3 : * Copyright Contributors to the OpenSDN project
4 : */
5 :
6 : #ifndef vnsw_agent_param_hpp
7 : #define vnsw_agent_param_hpp
8 :
9 : #include <boost/property_tree/ptree.hpp>
10 : #include <boost/program_options.hpp>
11 : #include <cmn/agent_cmn.h>
12 :
13 : class Agent;
14 : class VirtualGatewayConfigTable;
15 :
16 : struct LlgrParams {
17 : public:
18 : //In seconds
19 : static const int kStaleConfigCleanupTime = 100;
20 : static const int kConfigPollTime = 5;
21 : static const int kConfigInactivityTime = 15;
22 : static const int kConfigFallbackTimeOut = 900;
23 : static const int kEorTxPollTime = 5;
24 : static const int kEorTxFallbackTimeOut = 60;
25 : static const int kEorTxInactivityTime = 15;
26 : static const int kEorRxFallbackTime = 60;
27 : static const int kLlgrStaleTime = 2592000; //One month
28 :
29 : LlgrParams();
30 2 : virtual ~LlgrParams() { }
31 :
32 : /*
33 : * stale_config_cleanup_time_ - On receiving all config, remove stale
34 : * config.
35 : */
36 2 : uint16_t stale_config_cleanup_time() const {return stale_config_cleanup_time_;}
37 :
38 : /*
39 : * config_poll_time_ - Timer poll time
40 : */
41 2 : uint16_t config_poll_time() const {return config_poll_time_;}
42 : /*
43 : * config_inactivity_time_ - Silence time to conclude end of config
44 : */
45 0 : uint16_t config_inactivity_time() const {
46 0 : return config_inactivity_time_;
47 : }
48 : /*
49 : * config_fallback_time_ - Maximum time to wait for silence. In case
50 : * silence is never seen use this time to conclude end of config.
51 : */
52 0 : uint16_t config_fallback_time() const {
53 0 : return config_fallback_time_;
54 : }
55 :
56 : /*
57 : * end_of_rib_tx_poll_time_ - End of rib timer poll time.
58 : */
59 21 : uint16_t end_of_rib_tx_poll_time() const {
60 21 : return end_of_rib_tx_poll_time_;
61 : }
62 : /*
63 : * end_of_rib_tx_fallback_time_ - Maximum time to wait for silence, if
64 : * silence not seen then use this time to conclude fallback
65 : */
66 0 : uint16_t end_of_rib_tx_fallback_time() const {
67 0 : return end_of_rib_tx_fallback_time_;
68 : }
69 : /*
70 : * end_of_rib_tx_inactivity_time_ - Silence time on route publish to
71 : * conclude end of rib
72 : */
73 0 : uint16_t end_of_rib_tx_inactivity_time() const {
74 0 : return end_of_rib_tx_inactivity_time_;
75 : }
76 :
77 : /*
78 : * end_of_rib_rx_fallback_time_ - Maximum time to wait for end of rib from
79 : * CN on a channel
80 : */
81 21 : uint16_t end_of_rib_rx_fallback_time() const {
82 21 : return end_of_rib_rx_fallback_time_;
83 : }
84 :
85 : /*
86 : * llgr_stale_time_ - Maximum time to wait after CN is not ready to retain
87 : * stale routes.
88 : */
89 0 : uint32_t llgr_stale_time() const {
90 0 : return llgr_stale_time_;
91 : }
92 :
93 : private:
94 : friend class AgentParam;
95 :
96 : /** stale config cleanup time */
97 : uint16_t stale_config_cleanup_time_;
98 : /** end of config timer time values */
99 : uint16_t config_poll_time_;
100 : uint16_t config_inactivity_time_;
101 : uint16_t config_fallback_time_;
102 : /** End of rib Tx times */
103 : uint16_t end_of_rib_tx_poll_time_;
104 : uint16_t end_of_rib_tx_fallback_time_;
105 : uint16_t end_of_rib_tx_inactivity_time_;
106 : /** End of rib rx times */
107 : uint16_t end_of_rib_rx_fallback_time_;
108 : uint32_t llgr_stale_time_;
109 : };
110 :
111 : // Class handling agent configuration parameters from config file and
112 : // arguments
113 : class AgentParam {
114 : public:
115 : static const uint32_t kAgentStatsInterval = (30 * 1000); // time in millisecs
116 : static const uint32_t kFlowStatsInterval = (1000); // time in milliseconds
117 : static const uint32_t kVrouterStatsInterval = (30 * 1000); //time-millisecs
118 : typedef std::vector<Ip4Address> AddressList;
119 :
120 : // Agent mode we are running in
121 : enum AgentMode {
122 : VROUTER_AGENT,
123 : TSN_AGENT,
124 : TSN_NO_FORWARDING_AGENT,
125 : TOR_AGENT,
126 : };
127 :
128 : // Gateway mode that the agent is running in
129 : enum GatewayMode {
130 : VCPE,
131 : SERVER, // also has VMs on a remote server & vrouter maps vlans to VMIs
132 : PBB,
133 : NONE
134 : };
135 :
136 : // Hypervisor mode we are working on
137 : enum HypervisorMode {
138 : MODE_INVALID,
139 : MODE_KVM,
140 : MODE_XEN,
141 : MODE_VMWARE,
142 : MODE_DOCKER,
143 : };
144 :
145 : enum VmwareMode {
146 : ESXI_NEUTRON,
147 : VCENTER
148 : };
149 :
150 : enum Platform {
151 : VROUTER_ON_HOST,
152 : VROUTER_ON_HOST_DPDK,
153 : VROUTER_ON_NIC
154 : };
155 :
156 : struct PortInfo {
157 4 : PortInfo() :
158 4 : name_(""), vrf_(""), addr_(0), prefix_(0), plen_(0), gw_(0) {}
159 4 : ~PortInfo() { };
160 :
161 : std::string name_;
162 : std::string vrf_;
163 : Ip4Address addr_;
164 : Ip4Address prefix_;
165 : int plen_;
166 : Ip4Address gw_;
167 : };
168 :
169 : std::map<std::string, uint32_t>::iterator trace_buff_size_iter;
170 : AgentParam(bool enable_flow_options = true,
171 : bool enable_vhost_options = true,
172 : bool enable_hypervisor_options = true,
173 : bool enable_service_options = true,
174 : AgentMode agent_mode = VROUTER_AGENT);
175 : virtual ~AgentParam();
176 :
177 : virtual int Validate();
178 :
179 : bool IsVHostConfigured() {
180 : return vhost_.addr_.to_ulong() != 0? true : false;
181 : }
182 :
183 2 : const std::string &vhost_name() const { return vhost_.name_; }
184 8 : const Ip4Address &vhost_addr() const { return vhost_.addr_; }
185 : void set_vhost_addr(const Ip4Address &ip) {
186 : vhost_.addr_ = ip;
187 : }
188 3 : const Ip4Address &vhost_prefix() const { return vhost_.prefix_; }
189 4 : const int vhost_plen() const { return vhost_.plen_; }
190 : const Ip4Address &vhost_gw() const { return gateway_list_[0]; }
191 8 : const AddressList &gateway_list() const {
192 8 : return gateway_list_;
193 : }
194 :
195 0 : const std::string &xen_ll_name() const { return xen_ll_.name_; }
196 0 : const void set_xen_ll_name(const std::string &name) {
197 0 : xen_ll_.name_ = name;
198 0 : }
199 0 : const Ip4Address &xen_ll_addr() const { return xen_ll_.addr_; }
200 2 : const Ip4Address &xen_ll_prefix() const { return xen_ll_.prefix_; }
201 0 : const int xen_ll_plen() const { return xen_ll_.plen_; }
202 0 : const Ip4Address &xen_ll_gw() const { return xen_ll_.gw_; }
203 :
204 2 : const std::string &agent_name() const { return agent_name_; }
205 14 : const std::vector<std::string> ð_port_list() const {return eth_port_list_;};
206 2 : const bool ð_port_no_arp() const { return eth_port_no_arp_; }
207 2 : const std::string ð_port_encap_type() const { return eth_port_encap_type_; }
208 2 : const AddressList ð_port_addr_list() const {
209 2 : return eth_port_addr_list_;
210 : }
211 0 : const std::vector<int>& eth_port_plen_list() const {return eth_port_plen_list_;}
212 : void BuildAddrList(const std::string &val, AddressList& addr_list);
213 4 : const std::string &crypt_port() const { return crypt_port_; }
214 0 : const bool &crypt_port_no_arp() const { return crypt_port_no_arp_; }
215 0 : const std::string &crypt_port_encap_type() const { return crypt_port_encap_type_; }
216 :
217 6 : const std::vector<std::string> controller_server_list() const {
218 6 : return controller_server_list_;
219 : }
220 2 : const std::string &subcluster_name() const { return subcluster_name_; }
221 6 : const std::vector<std::string> dns_server_list() const {
222 6 : return dns_server_list_;
223 : }
224 2 : const std::vector<std::string> tsn_server_list() const {
225 2 : return tsn_server_list_;
226 : }
227 4 : const uint16_t dns_client_port() const {
228 4 : if (test_mode_)
229 2 : return 0;
230 2 : return dns_client_port_;
231 : }
232 2 : const uint32_t dns_timeout() const { return dns_timeout_; }
233 2 : const uint32_t dns_max_retries() const { return dns_max_retries_; }
234 2 : const uint16_t mirror_client_port() const {
235 2 : if (test_mode_)
236 2 : return 0;
237 0 : return mirror_client_port_;
238 : }
239 1 : const Ip4Address &mgmt_ip() const { return mgmt_ip_; }
240 4 : const std::string &tunnel_type() const { return tunnel_type_; }
241 3 : const std::string &metadata_shared_secret() const { return metadata_shared_secret_; }
242 4 : uint16_t metadata_proxy_port() const {
243 4 : if (test_mode_)
244 2 : return 0;
245 2 : return metadata_proxy_port_;
246 : }
247 0 : const bool metadata_use_ssl() const { return metadata_use_ssl_; }
248 0 : std::string metadata_client_cert() const { return metadata_client_cert_;}
249 0 : std::string metadata_client_cert_type() const {
250 0 : return metadata_client_cert_type_;
251 : }
252 0 : std::string metadata_client_key() const { return metadata_client_key_;}
253 0 : std::string metadata_ca_cert() const { return metadata_ca_cert_;}
254 0 : uint32_t linklocal_system_flows() const { return linklocal_system_flows_; }
255 0 : uint32_t linklocal_vm_flows() const { return linklocal_vm_flows_; }
256 8 : uint32_t flow_cache_timeout() const {return flow_cache_timeout_;}
257 2 : uint16_t flow_index_sm_log_count() const {return flow_index_sm_log_count_;}
258 2 : uint32_t flow_add_tokens() const {return flow_add_tokens_;}
259 2 : uint32_t flow_ksync_tokens() const {return flow_ksync_tokens_;}
260 2 : uint32_t flow_del_tokens() const {return flow_del_tokens_;}
261 2 : uint32_t flow_update_tokens() const {return flow_update_tokens_;}
262 2 : uint32_t stale_interface_cleanup_timeout() const {
263 2 : return stale_interface_cleanup_timeout_;
264 : }
265 5 : bool dhcp_relay_mode() const {return dhcp_relay_mode_;}
266 2 : bool xmpp_auth_enabled() const {return xmpp_auth_enable_;}
267 2 : std::string xmpp_server_cert() const { return xmpp_server_cert_;}
268 2 : std::string xmpp_server_key() const { return xmpp_server_key_;}
269 2 : std::string xmpp_ca_cert() const { return xmpp_ca_cert_;}
270 2 : bool xmpp_dns_auth_enabled() const {return xmpp_dns_auth_enable_;}
271 2 : bool simulate_evpn_tor() const {return simulate_evpn_tor_;}
272 2 : std::string si_netns_command() const {return si_netns_command_;}
273 2 : std::string si_docker_command() const {return si_docker_command_;}
274 2 : const int si_netns_workers() const {return si_netns_workers_;}
275 2 : const int si_netns_timeout() const {return si_netns_timeout_;}
276 0 : std::string si_lb_ssl_cert_path() const {
277 0 : return si_lb_ssl_cert_path_;
278 : }
279 0 : std::string si_lbaas_auth_conf() const {
280 0 : return si_lbaas_auth_conf_;
281 : }
282 :
283 2 : std::string nexthop_server_endpoint() const {
284 2 : return nexthop_server_endpoint_;
285 : }
286 :
287 3 : const std::string &config_file() const { return config_file_; }
288 2 : const std::string &program_name() const { return program_name_;}
289 9 : const std::string log_file() const { return log_file_; }
290 8 : const int log_files_count() const { return log_files_count_; }
291 8 : const long log_file_size() const { return log_file_size_; }
292 5 : bool log_local() const { return log_local_; }
293 5 : bool log_flow() const { return log_flow_; }
294 4 : const std::vector<std::string> &get_sample_destination() {
295 4 : return sample_destination_;
296 : }
297 12 : const std::vector<std::string> &get_slo_destination() {
298 12 : return slo_destination_;
299 : }
300 9 : const std::string &log_level() const { return log_level_; }
301 5 : const std::string &log_category() const { return log_category_; }
302 2 : const std::string &log_property_file() const { return log_property_file_; }
303 2 : const bool use_syslog() const { return use_syslog_; }
304 6 : const std::string syslog_facility() const { return syslog_facility_; }
305 68 : const std::vector<std::string> collector_server_list() const {
306 68 : return collector_server_list_;
307 : }
308 2 : const std::map<std::string, std::map<std::string, std::string> > derived_stats_map() const {
309 2 : return derived_stats_map_;
310 : }
311 4 : uint16_t http_server_port() const { return http_server_port_; }
312 0 : uint16_t rest_port() const { return rest_port_; }
313 4 : const std::string &host_name() const { return host_name_; }
314 2 : int agent_stats_interval() const {
315 2 : if (test_mode_) {
316 2 : return agent_stats_interval_;
317 : }
318 0 : return vmi_vm_vn_uve_interval_msecs();
319 : }
320 4 : int flow_stats_interval() const { return flow_stats_interval_; }
321 2 : int vrouter_stats_interval() const { return vrouter_stats_interval_; }
322 3 : void set_agent_stats_interval(int val) { agent_stats_interval_ = val; }
323 3 : void set_flow_stats_interval(int val) { flow_stats_interval_ = val; }
324 3 : void set_vrouter_stats_interval(int val) { vrouter_stats_interval_ = val; }
325 : void set_subnet_hosts_resolvable(bool val) {
326 : subnet_hosts_resolvable_ = val;
327 : }
328 2 : VirtualGatewayConfigTable *vgw_config_table() const {
329 2 : return vgw_config_table_.get();
330 : }
331 0 : const std::string &vmware_physical_port() const {
332 0 : return vmware_physical_port_;
333 : }
334 :
335 7 : HypervisorMode mode() const { return hypervisor_mode_; }
336 1206 : bool isXenMode() const { return hypervisor_mode_ == MODE_XEN; }
337 0 : bool isKvmMode() const { return hypervisor_mode_ == MODE_KVM; }
338 0 : bool isDockerMode() const { return hypervisor_mode_ == MODE_DOCKER; }
339 28507 : bool isVmwareMode() const { return hypervisor_mode_ == MODE_VMWARE; }
340 0 : bool isVmwareVcenterMode() const { return vmware_mode_ == VCENTER; }
341 5 : VmwareMode vmware_mode() const { return vmware_mode_; }
342 4 : Platform platform() const { return platform_; }
343 167 : bool vrouter_on_nic_mode() const {
344 167 : return platform_ == VROUTER_ON_NIC;
345 : }
346 173 : bool vrouter_on_host_dpdk() const {
347 173 : return platform_ == VROUTER_ON_HOST_DPDK;
348 : }
349 0 : bool vrouter_on_host() const {
350 0 : return platform_ == VROUTER_ON_HOST;
351 : }
352 12 : bool subnet_hosts_resolvable() const {
353 12 : return subnet_hosts_resolvable_;
354 : }
355 :
356 : void Init(const std::string &config_file,
357 : const std::string &program_name);
358 : void ReInit();
359 : void DebugInit();
360 :
361 : void LogConfig() const;
362 : void LogFilteredConfig() const;
363 : void PostValidateLogConfig() const;
364 : void InitVhostAndXenLLPrefix();
365 : void InitPlatform();
366 : void set_test_mode(bool mode);
367 2 : bool test_mode() const { return test_mode_; }
368 :
369 : void AddOptions(const boost::program_options::options_description &opt);
370 : void ConfigAddOptions(const boost::program_options::options_description &opt);
371 : void ParseArguments(int argc, char *argv[]);
372 2 : const boost::program_options::variables_map &var_map() const {
373 2 : return var_map_;
374 : }
375 :
376 : boost::program_options::options_description options() const {
377 : return options_;
378 : }
379 1307 : AgentMode agent_mode() const { return agent_mode_; }
380 4 : bool isTsnAgent() const {
381 4 : return ((agent_mode_ == TSN_AGENT) |
382 4 : (agent_mode_ == TSN_NO_FORWARDING_AGENT));
383 : }
384 2 : bool isTorAgent() const { return agent_mode_ == TOR_AGENT; }
385 2 : bool IsForwardingEnabled() const {
386 2 : return agent_mode_ != TSN_NO_FORWARDING_AGENT;
387 : }
388 2 : bool isServerGatewayMode() const { return gateway_mode_ == SERVER; }
389 2 : bool isVcpeGatewayMode() const { return gateway_mode_ == VCPE; }
390 2 : bool isPbbGatewayMode() const { return gateway_mode_ == PBB; }
391 : GatewayMode gateway_mode() const { return gateway_mode_; }
392 :
393 4 : const AddressList &compute_node_address_list() const {
394 4 : return compute_node_address_list_;
395 : }
396 : void BuildAddressList(const std::string &val);
397 : void SplitByDelimiter(const std::string &txt,
398 : std::vector<std::string> &strs, char ch);
399 :
400 : std::string exception_packet_interface() const {
401 : return exception_packet_interface_;
402 : }
403 0 : const std::vector<std::string> &physical_interface_pci_addr_list() const {
404 0 : return physical_interface_pci_addr_list_;
405 : }
406 0 : const std::vector<std::string> &physical_interface_mac_addr_list() const {
407 0 : return physical_interface_mac_addr_list_;
408 : }
409 3 : std::string agent_base_dir() const { return agent_base_dir_; }
410 : const std::string &bgp_as_a_service_port_range() const {
411 : return bgp_as_a_service_port_range_;
412 : }
413 3 : const std::vector<uint16_t> &bgp_as_a_service_port_range_value() const {
414 3 : return bgp_as_a_service_port_range_value_;
415 : }
416 22 : uint32_t services_queue_limit() { return services_queue_limit_; }
417 2 : uint32_t bgpaas_max_shared_sessions() const {
418 2 : return bgpaas_max_shared_sessions_;
419 : }
420 30 : void set_bgpaas_max_shared_sessions(uint32_t val) {
421 30 : bgpaas_max_shared_sessions_ = val;
422 30 : }
423 :
424 :
425 2 : const SandeshConfig &sandesh_config() const { return sandesh_config_; }
426 :
427 2 : uint16_t flow_thread_count() const { return flow_thread_count_; }
428 : void set_flow_thread_count(uint16_t count) { flow_thread_count_ = count; }
429 :
430 2 : bool flow_trace_enable() const { return flow_trace_enable_; }
431 : void set_flow_trace_enable(bool val) { flow_trace_enable_ = val; }
432 :
433 62 : bool flow_use_rid_in_hash() const { return !flow_hash_excl_rid_; }
434 :
435 4 : uint16_t flow_task_latency_limit() const { return flow_latency_limit_; }
436 : void set_flow_task_latency_limit(uint16_t count) {
437 : flow_latency_limit_ = count;
438 : }
439 :
440 28 : uint16_t max_sessions_per_aggregate() const {
441 28 : return max_sessions_per_aggregate_;
442 : }
443 80 : uint16_t max_aggregates_per_session_endpoint() const {
444 80 : return max_aggregates_per_session_endpoint_;
445 : }
446 4 : uint16_t max_endpoints_per_session_msg() const {
447 4 : return max_endpoints_per_session_msg_;
448 : }
449 2 : std::string ksync_thread_cpu_pin_policy() const {
450 2 : return ksync_thread_cpu_pin_policy_;
451 : }
452 2 : uint32_t tbb_thread_count() const { return tbb_thread_count_; }
453 6 : uint32_t tbb_exec_delay() const { return tbb_exec_delay_; }
454 6 : uint32_t tbb_schedule_delay() const { return tbb_schedule_delay_; }
455 2 : uint32_t tbb_keepawake_timeout() const { return tbb_keepawake_timeout_; }
456 2 : uint32_t task_monitor_timeout_msec() const {
457 2 : return task_monitor_timeout_msec_;
458 : }
459 2 : uint16_t min_aap_prefix_len() const {
460 2 : if ((min_aap_prefix_len_ < 1) || (min_aap_prefix_len_ > 31)) {
461 0 : return Agent::kMinAapPrefixLen;
462 : }
463 2 : return min_aap_prefix_len_;
464 : }
465 2 : uint16_t vmi_vm_vn_uve_interval() const { return vmi_vm_vn_uve_interval_; }
466 0 : uint32_t vmi_vm_vn_uve_interval_msecs() const {
467 0 : return (vmi_vm_vn_uve_interval_ * 1000);
468 : }
469 :
470 2 : uint16_t fabric_snat_hash_table_size() const {
471 2 : return fabric_snat_hash_table_size_;
472 : }
473 :
474 : // Restart parameters
475 2 : bool restart_backup_enable() const { return restart_backup_enable_; }
476 6 : void set_restart_backup_enable(bool val) {
477 6 : restart_backup_enable_ = val;
478 6 : }
479 0 : uint64_t restart_backup_idle_timeout() const {
480 0 : return restart_backup_idle_timeout_;
481 : }
482 0 : const std::string& restart_backup_dir() const {
483 0 : return restart_backup_dir_;
484 : }
485 3 : uint16_t restart_backup_count() const { return restart_backup_count_; }
486 3 : bool restart_restore_enable() const { return restart_restore_enable_; }
487 3 : uint64_t restart_restore_audit_timeout() const {
488 3 : return restart_restore_audit_timeout_;
489 : }
490 :
491 2 : const std::string huge_page_file_1G(uint16_t index) const {
492 2 : if (huge_page_file_1G_.size() > index)
493 2 : return huge_page_file_1G_[index];
494 : else
495 0 : return "";
496 : }
497 2 : const std::string huge_page_file_2M(uint16_t index) const {
498 2 : if (huge_page_file_2M_.size() > index)
499 2 : return huge_page_file_2M_[index];
500 : else
501 0 : return "";
502 : }
503 :
504 : // pkt0 tx buffer
505 4 : uint32_t pkt0_tx_buffer_count() const { return pkt0_tx_buffer_count_; }
506 : void set_pkt0_tx_buffer_count(uint32_t val) { pkt0_tx_buffer_count_ = val; }
507 126 : bool measure_queue_delay() const { return measure_queue_delay_; }
508 0 : void set_measure_queue_delay(bool val) { measure_queue_delay_ = val; }
509 6 : const std::set<uint16_t>& nic_queue_list() const {
510 6 : return nic_queue_list_;
511 : }
512 0 : uint16_t get_nic_queue(uint16_t queue) {
513 0 : std::map<uint16_t, uint16_t>::iterator it = qos_queue_map_.find(queue);
514 0 : if (it != qos_queue_map_.end()) {
515 0 : return it->second;
516 : }
517 0 : return default_nic_queue_;
518 : }
519 :
520 0 : uint16_t default_nic_queue() const {
521 0 : return default_nic_queue_;
522 : }
523 :
524 1 : void add_nic_queue(uint16_t queue, uint16_t nic_queue) {
525 1 : qos_queue_map_[queue] = nic_queue;
526 1 : }
527 46 : const LlgrParams &llgr_params() const {return llgr_params_;}
528 :
529 : void set_mac_learning_thread_count(uint32_t threads) {
530 : mac_learning_thread_count_ = threads;
531 : }
532 :
533 5 : uint32_t mac_learning_thread_count() const {
534 5 : return mac_learning_thread_count_;
535 : }
536 :
537 : void set_mac_learning_add_tokens(uint32_t add_tokens) {
538 : mac_learning_add_tokens_ = add_tokens;
539 : }
540 :
541 3 : uint32_t mac_learning_add_tokens() const {
542 3 : return mac_learning_add_tokens_;
543 : }
544 :
545 : void set_mac_learning_update_tokens(uint32_t update_tokens) {
546 : mac_learning_update_tokens_ = update_tokens;
547 : }
548 :
549 3 : uint32_t mac_learning_update_tokens() const {
550 3 : return mac_learning_update_tokens_;
551 : }
552 :
553 : void set_mac_learning_delete_tokens(uint32_t delete_tokens) {
554 : mac_learning_delete_tokens_ = delete_tokens;
555 : }
556 :
557 3 : uint32_t mac_learning_delete_tokens() {
558 3 : return mac_learning_delete_tokens_;
559 : }
560 :
561 3 : bool qos_priority_tagging() const { return qos_priority_tagging_; }
562 : bool IsConfiguredTsnHostRoute(std::string addr) const;
563 :
564 683 : bool mvpn_ipv4_enable() const { return mvpn_ipv4_enable_; }
565 5 : void set_mvpn_ipv4_enable(bool val) { mvpn_ipv4_enable_ = val; }
566 :
567 : //ATF stands for Agent Test Framework
568 8 : bool cat_is_agent_mocked() const { return AgentMock_; }
569 :
570 2 : bool cat_is_dpdk_mocked() const { return cat_MockDPDK_; }
571 :
572 0 : std::string cat_ksocketdir() const { return cat_kSocketDir_; }
573 :
574 2 : float vr_object_high_watermark() const { return vr_object_high_watermark_; }
575 :
576 4 : const Ip4Address &loopback_ip() const { return loopback_ip_; }
577 :
578 : protected:
579 : void set_hypervisor_mode(HypervisorMode m) { hypervisor_mode_ = m; }
580 : virtual void InitFromSystem();
581 : virtual void InitFromConfig();
582 : virtual void ReInitFromConfig();
583 : virtual void DebugInitFromConfig();
584 : virtual void ProcessArguments();
585 : boost::property_tree::ptree &tree() { return tree_; }
586 : template <typename ValueType>
587 4 : bool GetValueFromTree(ValueType &var, const std::string &val) {
588 4 : boost::optional<ValueType> opt = tree_.get_optional<ValueType>(val);
589 4 : if (opt) {
590 0 : var = opt.get();
591 0 : return true;
592 : }
593 4 : return false;
594 : }
595 : bool GetIpAddress(const std::string &str, Ip4Address *addr);
596 : bool ParseIp(const std::string &key, Ip4Address *server);
597 : bool ParseServerList(const std::string &key, Ip4Address *s1, Ip4Address *s2);
598 : bool ParseAddress(const std::string &addr_string,
599 : Ip4Address *server, uint16_t *port);
600 : bool ParseServerList(const std::string &key, Ip4Address *server1,
601 : uint16_t *port1, Ip4Address *server2, uint16_t *port2);
602 : void ParseIpArgument(const boost::program_options::variables_map &var_map,
603 : Ip4Address &server, const std::string &key);
604 : bool ParseServerListArguments
605 : (const boost::program_options::variables_map &var_map, Ip4Address &server1,
606 : Ip4Address &server2, const std::string &key);
607 : bool ParseServerListArguments
608 : (const boost::program_options::variables_map &var_map, Ip4Address *server1,
609 : uint16_t *port1, Ip4Address *server2, uint16_t *port2,
610 : const std::string &key);
611 : void ParseTestFrameworkArguments
612 : (const boost::program_options::variables_map &var_map);
613 :
614 : private:
615 : friend class AgentParamTest;
616 : void UpdateBgpAsaServicePortRange();
617 : void UpdateBgpAsaServicePortRangeValue();
618 :
619 : /// Update linklocal max flows if they are greater than the max allowed for the
620 : /// process. Also, ensure that the process is allowed to open upto
621 : /// linklocal_system_flows + kMaxOtherOpenFds files
622 : void ComputeFlowAndFileLimits();
623 :
624 : void ComputeVrWatermark();
625 : static std::map<string, std::map<string, string> > ParseDerivedStats(
626 : const std::vector<std::string> &dsvec);
627 : void ParseQueue();
628 : void set_agent_mode(const std::string &mode);
629 : void set_gateway_mode(const std::string &mode);
630 :
631 : void ParseCollectorDSArguments
632 : (const boost::program_options::variables_map &v);
633 : void ParseCollectorArguments
634 : (const boost::program_options::variables_map &var_map);
635 : void ParseControllerServersArguments
636 : (const boost::program_options::variables_map &var_map);
637 : void ParseDnsServersArguments
638 : (const boost::program_options::variables_map &var_map);
639 : void ParseTsnServersArguments
640 : (const boost::program_options::variables_map &var_map);
641 : void ParseVirtualHostArguments
642 : (const boost::program_options::variables_map &v);
643 : void ParseDnsArguments
644 : (const boost::program_options::variables_map &v);
645 : void ParseNetworksArguments
646 : (const boost::program_options::variables_map &v);
647 : void ParseHypervisorArguments
648 : (const boost::program_options::variables_map &v);
649 : void ParseDefaultSectionArguments
650 : (const boost::program_options::variables_map &v);
651 : void ParseTaskSectionArguments
652 : (const boost::program_options::variables_map &v);
653 : void ParseMetadataProxyArguments
654 : (const boost::program_options::variables_map &v);
655 : void ParseFlowArguments
656 : (const boost::program_options::variables_map &v);
657 : void ParseDhcpRelayModeArguments
658 : (const boost::program_options::variables_map &var_map);
659 : void ParseSimulateEvpnTorArguments
660 : (const boost::program_options::variables_map &var_map);
661 : void ParseServiceInstanceArguments
662 : (const boost::program_options::variables_map &v);
663 : void ParseAgentInfoArguments
664 : (const boost::program_options::variables_map &v);
665 : void ParseNexthopServerArguments
666 : (const boost::program_options::variables_map &v);
667 : void ParsePlatformArguments
668 : (const boost::program_options::variables_map &v);
669 : void ParseServicesArguments
670 : (const boost::program_options::variables_map &v);
671 : void ParseSandeshArguments
672 : (const boost::program_options::variables_map &v);
673 : void ParseRestartArguments
674 : (const boost::program_options::variables_map &v);
675 : void ParseLlgrArguments
676 : (const boost::program_options::variables_map &v);
677 : void ParseMacLearning
678 : (const boost::program_options::variables_map &v);
679 : void ParseCryptArguments
680 : (const boost::program_options::variables_map &v);
681 : void ParseSessionDestinationArguments
682 : (const boost::program_options::variables_map &v);
683 :
684 : boost::program_options::variables_map var_map_;
685 : boost::program_options::options_description options_;
686 : boost::program_options::options_description config_file_options_;
687 : bool enable_flow_options_;
688 : bool enable_vhost_options_;
689 : bool enable_hypervisor_options_;
690 : bool enable_service_options_;
691 : AgentMode agent_mode_;
692 : GatewayMode gateway_mode_;
693 :
694 : Agent *agent_;
695 : PortInfo vhost_;
696 : // Number of tx-buffers on pkt0 device
697 : uint32_t pkt0_tx_buffer_count_;
698 : bool measure_queue_delay_;
699 :
700 : std::string agent_name_;
701 : std::vector<std::string> eth_port_list_;
702 : AddressList eth_port_addr_list_;
703 : std::vector<int> eth_port_plen_list_;
704 : bool eth_port_no_arp_;
705 : std::string eth_port_encap_type_;
706 : std::string crypt_port_;
707 : bool crypt_port_no_arp_;
708 : std::string crypt_port_encap_type_;
709 : std::vector<std::string> controller_server_list_;
710 : std::string subcluster_name_;
711 : std::vector<std::string> dns_server_list_;
712 : std::vector<std::string> tsn_server_list_;
713 : uint16_t dns_client_port_;
714 : uint32_t dns_timeout_;
715 : uint32_t dns_max_retries_;
716 : uint16_t mirror_client_port_;
717 : Ip4Address mgmt_ip_;
718 : HypervisorMode hypervisor_mode_;
719 : PortInfo xen_ll_;
720 : std::string tunnel_type_;
721 : std::string metadata_shared_secret_;
722 : uint16_t metadata_proxy_port_;
723 : bool metadata_use_ssl_;
724 : std::string metadata_client_cert_;
725 : std::string metadata_client_cert_type_;
726 : std::string metadata_client_key_;
727 : std::string metadata_ca_cert_;
728 : uint16_t linklocal_system_flows_;
729 : uint16_t linklocal_vm_flows_;
730 : uint16_t flow_cache_timeout_;
731 : uint16_t flow_index_sm_log_count_;
732 : uint32_t flow_add_tokens_;
733 : uint32_t flow_ksync_tokens_;
734 : uint32_t flow_del_tokens_;
735 : uint32_t flow_update_tokens_;
736 : uint32_t flow_netlink_pin_cpuid_;
737 : uint32_t stale_interface_cleanup_timeout_;
738 :
739 : // Parameters configured from command line arguments only (for now)
740 : std::string config_file_;
741 : std::string program_name_;
742 : std::string log_file_;
743 : int log_files_count_;
744 : long log_file_size_;
745 : std::string log_property_file_;
746 : bool log_local_;
747 : bool log_flow_;
748 : std::vector<std::string> slo_destination_;
749 : std::vector<std::string> sample_destination_;
750 : std::string log_level_;
751 : std::string log_category_;
752 : bool use_syslog_;
753 : std::string syslog_facility_;
754 : std::vector<std::string> collector_server_list_;
755 : std::map<std::string, std::map<std::string, std::string> > derived_stats_map_;
756 : uint16_t http_server_port_;
757 : uint16_t rest_port_;
758 : std::string host_name_;
759 : int agent_stats_interval_;
760 : int flow_stats_interval_;
761 : int vrouter_stats_interval_;
762 : std::string vmware_physical_port_;
763 : bool test_mode_;
764 : boost::property_tree::ptree tree_;
765 : std::unique_ptr<VirtualGatewayConfigTable> vgw_config_table_;
766 : bool dhcp_relay_mode_;
767 : bool xmpp_auth_enable_;
768 : std::string xmpp_server_cert_;
769 : std::string xmpp_server_key_;
770 : std::string xmpp_ca_cert_;
771 : bool xmpp_dns_auth_enable_;
772 : //Simulate EVPN TOR mode moves agent into L2 mode. This mode is required
773 : //only for testing where MX and bare metal are simulated. VM on the
774 : //simulated compute node behaves as bare metal.
775 : bool simulate_evpn_tor_;
776 : std::string si_netns_command_;
777 : std::string si_docker_command_;
778 : int si_netns_workers_;
779 : int si_netns_timeout_;
780 : std::string si_lb_ssl_cert_path_;
781 : std::string si_lbaas_auth_conf_;
782 : VmwareMode vmware_mode_;
783 : // List of IP addresses on the compute node.
784 : AddressList compute_node_address_list_;
785 : std::string nexthop_server_endpoint_;
786 : bool nexthop_server_add_pid_;
787 : bool vrouter_on_nic_mode_;
788 : std::string exception_packet_interface_;
789 : Platform platform_;
790 : std::vector<std::string> physical_interface_pci_addr_list_;
791 : std::vector<std::string> physical_interface_mac_addr_list_;
792 : std::string agent_base_dir_;
793 : uint16_t flow_thread_count_;
794 : bool flow_trace_enable_;
795 : bool flow_hash_excl_rid_;
796 : uint16_t flow_latency_limit_;
797 : uint16_t max_sessions_per_aggregate_;
798 : uint16_t max_aggregates_per_session_endpoint_;
799 : uint16_t max_endpoints_per_session_msg_;
800 : bool subnet_hosts_resolvable_;
801 : std::string bgp_as_a_service_port_range_;
802 : std::vector<uint16_t> bgp_as_a_service_port_range_value_;
803 : uint32_t services_queue_limit_;
804 : uint32_t bgpaas_max_shared_sessions_;
805 :
806 : // Sandesh config options
807 : SandeshConfig sandesh_config_;
808 :
809 : // Agent config backup options
810 : bool restart_backup_enable_;
811 : // Config backup idle timeout in msec
812 : // Backup is trigerred if there is no config change in this time
813 : uint64_t restart_backup_idle_timeout_;
814 : // Config backup directory
815 : std::string restart_backup_dir_;
816 : // Number of config backup files
817 : uint16_t restart_backup_count_;
818 : // Config restore options
819 : bool restart_restore_enable_;
820 : // Config restore audit timeout in msec
821 : uint64_t restart_restore_audit_timeout_;
822 :
823 : std::vector<std::string> huge_page_file_1G_;
824 : std::vector<std::string> huge_page_file_2M_;
825 :
826 : std::string ksync_thread_cpu_pin_policy_;
827 : // TBB related
828 : uint32_t tbb_thread_count_;
829 : uint32_t tbb_exec_delay_;
830 : uint32_t tbb_schedule_delay_;
831 : uint32_t tbb_keepawake_timeout_;
832 : // Monitor task library and assert if inactivity detected
833 : uint32_t task_monitor_timeout_msec_;
834 : //Knob to configure priority tagging when in DCB mode.
835 : bool qos_priority_tagging_;
836 : std::map<uint16_t, uint16_t> qos_queue_map_;
837 : std::set<uint16_t> nic_queue_list_;
838 : uint16_t default_nic_queue_;
839 : LlgrParams llgr_params_;
840 : uint32_t mac_learning_thread_count_;
841 : uint32_t mac_learning_add_tokens_;
842 : uint32_t mac_learning_update_tokens_;
843 : uint32_t mac_learning_delete_tokens_;
844 : uint16_t min_aap_prefix_len_;
845 : uint16_t vmi_vm_vn_uve_interval_;
846 : uint16_t fabric_snat_hash_table_size_;
847 : bool mvpn_ipv4_enable_;
848 : //test framework parameters
849 : bool AgentMock_;
850 : bool cat_MockDPDK_;
851 : std::string cat_kSocketDir_;
852 : float vr_object_high_watermark_;
853 : Ip4Address loopback_ip_;
854 : AddressList gateway_list_;
855 : DISALLOW_COPY_AND_ASSIGN(AgentParam);
856 : };
857 :
858 : #endif // vnsw_agent_param_hpp
|