Line data Source code
1 : /* 2 : * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef vnsw_agent_init_contrail_cmn_init_hpp 6 : #define vnsw_agent_init_contrail_cmn_init_hpp 7 : 8 : #include <boost/program_options.hpp> 9 : #include <init/agent_init.h> 10 : 11 : class Agent; 12 : class AgentParam; 13 : 14 : // The class to drive agent initialization. 15 : // Defines control parameters used to enable/disable agent features 16 : class ContrailInitCommon : public AgentInit { 17 : public: 18 : ContrailInitCommon(); 19 : virtual ~ContrailInitCommon(); 20 : 21 : void ProcessOptions(const std::string &config_file, 22 : const std::string &program_name); 23 : void ProcessComputeAddress(AgentParam *param); 24 : int Start(Logging &logging); 25 : 26 : // Initialization virtual methods 27 : void CreateModules(); 28 : void RegisterDBClients(); 29 : void InitModules(); 30 : void CreateVrf(); 31 : void CreateInterfaces(); 32 : virtual void InitDone(); 33 : 34 : // Shutdown virtual methods 35 : void IoShutdown(); 36 : void FlushFlows(); 37 : void ServicesShutdown(); 38 : virtual void ModulesShutdown(); 39 : void PktShutdown(); 40 : 41 55 : bool ksync_enable() const { return ksync_enable_; } 42 : bool services_enable() const { return services_enable_; } 43 : bool packet_enable() const { return packet_enable_; } 44 : bool create_vhost() const { return create_vhost_; } 45 : bool uve_enable() const { return uve_enable_; } 46 : bool vgw_enable() const { return vgw_enable_; } 47 : bool router_id_dep_enable() const { return router_id_dep_enable_; } 48 : 49 4 : void set_ksync_enable(bool flag) { ksync_enable_ = flag; } 50 4 : void set_services_enable(bool flag) { services_enable_ = flag; } 51 4 : void set_packet_enable(bool flag) { packet_enable_ = flag; } 52 4 : void set_create_vhost(bool flag) { create_vhost_ = flag; } 53 4 : void set_uve_enable(bool flag) { uve_enable_ = flag; } 54 4 : void set_vgw_enable(bool flag) { vgw_enable_ = flag; } 55 4 : void set_router_id_dep_enable(bool flag) { router_id_dep_enable_ = flag; } 56 : private: 57 : bool create_vhost_; 58 : bool ksync_enable_; 59 : bool services_enable_; 60 : bool packet_enable_; 61 : bool uve_enable_; 62 : bool vgw_enable_; 63 : bool router_id_dep_enable_; 64 : 65 : std::unique_ptr<KSync> ksync_; 66 : std::unique_ptr<AgentUveBase> uve_; 67 : 68 : std::unique_ptr<DiagTable> diag_table_; 69 : std::unique_ptr<ServicesModule> services_; 70 : std::unique_ptr<PktModule> pkt_; 71 : std::unique_ptr<VirtualGateway> vgw_; 72 : std::unique_ptr<MacLearningModule> mac_learning_module_; 73 : DISALLOW_COPY_AND_ASSIGN(ContrailInitCommon); 74 : }; 75 : 76 : #endif // vnsw_agent_init_contrail_cmn_init_hpp