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