33 agent_(new
Agent()), agent_param_(NULL), trigger_(),
34 enable_controller_(true) {
44 agent_->db()->ClearFactoryRegistry();
52 (
const std::string &config_file,
const std::string &
program_name) {
57 return Module::VROUTER_AGENT;
62 return g_vns_constants.ModuleNames.find(module)->second;
70 return g_vns_constants.INSTANCE_ID_DEFAULT;
74 boost::system::error_code ec;
75 Ip4Address ip = Ip4Address::from_string(
"127.0.0.1", ec);
76 if (ec.value() != 0) {
81 agent_->set_vrouter_server_ip(ip);
83 agent_->set_pkt_interface_name(
"pkt0");
85 agent_->set_vrouter_server_ip(ip);
87 agent_->set_pkt_interface_name(
"unix");
95 agent_->set_agent_init(
this);
107 agent_->set_module_name(module_name);
108 std::vector<std::string> v_slo_destinations =
agent_param_->
109 get_slo_destination();
111 if (log_property_file.size()) {
166 agent_->SetResourceManagerReady();
177 agent_->set_init_done(
true);
250 oper_->RegisterDBClients();
301 fabric_policy_vrf_name());
304 agent_->set_fabric_vrf(vrf);
305 agent_->set_fabric_policy_vrf(policy_vrf);
308 agent_->set_fabric_inet4_multicast_table
325 if (
agent_->router_id_configured() ==
false) {
327 "Router ID not configured. Connection to controller postponed");
329 LOG(DEBUG,
"Router ID configured. Connection to controller initiated");
331 agent_->controller()->Connect();
335 if (
agent_->controller()) {
336 agent_->controller()->EnableWorkQueue();
356 uint32_t execute_delay = (20 * 1000);
357 uint32_t schedule_delay = (20 * 1000);
365 (schedule_delay * 2));
367 (schedule_delay * 2));
369 (schedule_delay * 2));
387 agent_->controller()->Cleanup();
388 agent_->controller()->DisConnect();
393 init->IoShutdownBase();
403 init->FlushFlowsBase();
413 init->VgwShutdownBase();
420 agent_->oper_db()->DeleteRoutes();
424 init->DeleteRoutesBase();
436 boost::uuids::nil_uuid(),
437 agent_->vhost_interface_name()));
439 req.
data.reset(data);
440 agent_->interface_table()->Enqueue(&req);
447 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_policy_vrf_name());
449 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_policy_vrf_name());
455 agent_->set_vhost_interface(NULL);
464 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_vrf_name());
470 agent_->nexthop_table()->set_discard_nh(NULL);
484 uint32_t count,
int msec) {
485 while ((table->
Size() > count) && (msec > 0)) {
491 return (table->
Size() == count);
511 init->ServicesShutdownBase();
521 init->PktShutdownBase();
526 if (
agent_->oper_db() &&
agent_->oper_db()->agent_profile()) {
527 agent_->oper_db()->agent_profile()->Shutdown();
532 init->ProfileShutdownBase();
539 agent_->oper_db()->Shutdown();
543 agent_->cfg()->Shutdown();
549 init->ModulesShutdownBase();
569 init->UveShutdownBase();
574 init->StatsCollectorShutdownBase();
579 init->FlowStatsCollectorShutdownBase();
589 init->KSyncShutdownBase();
617 agent_->event_manager()->Shutdown();
boost::asio::ip::address_v4 Ip4Address
#define AGENT_SHUTDOWN_TASKNAME
#define VROUTER_SERVER_PORT
#define AGENT_INIT_TASKNAME
#define kTaskSessionStatsCollector
#define kTaskFlowStatsCollector
#define kTaskSessionStatsCollectorEvent
static bool FlowStatsCollectorShutdownInternal(AgentInit *init)
static bool DeleteRoutesInternal(AgentInit *init)
static bool ProfileShutdownInternal(AgentInit *init)
static bool PktShutdownInternal(AgentInit *init)
boost::function< bool(void)> TaskFnPtr
static bool StatsCollectorShutdownInternal(AgentInit *init)
static bool KSyncShutdownInternal(AgentInit *init)
static void RunInTaskContext(AgentInit *init, uint32_t task_id, TaskFnPtr fn)
static void CreateVrfIndependentNextHop(Agent *agent)
static bool WaitForDbCount(DBTableBase *table, AgentInit *init, uint32_t count, int msec)
static bool VgwShutdownInternal(AgentInit *init)
static bool FlushTable(AgentDBTable *table)
static bool UveShutdownInternal(AgentInit *init)
static bool ServicesShutdownInternal(AgentInit *init)
static bool FlushFlowsInternal(AgentInit *init)
static bool IoShutdownInternal(AgentInit *init)
static bool ModulesShutdownInternal(AgentInit *init)
AgentDBEntry * FindActiveEntry(const DBEntry *key)
std::unique_ptr< ResourceManager > resource_manager_
virtual void PktShutdownBase()
virtual void CreateNextHopsBase()
virtual void CreateInterfacesBase()
virtual void RegisterDBClientsBase()
virtual void InitLogging()
virtual void ServicesShutdown()
virtual void FlowStatsCollectorShutdownBase()
virtual void VgwShutdown()
virtual void ModulesShutdown()
virtual void InitModules()
virtual void StatsCollectorShutdown()
virtual void FactoryInit()=0
virtual void ProcessOptions(const std::string &config_file, const std::string &program_name)
std::unique_ptr< TaskTrigger > trigger_
virtual void DeleteRoutes()
virtual void ProfileShutdownBase()
virtual void KSyncShutdownBase()
virtual std::string InstanceId()
virtual void CreateDBTables()
virtual void CreateModules()
std::unique_ptr< VNController > controller_
virtual void ConnectToController()
virtual std::string AgentName()
virtual void WaitForIdle()=0
virtual void InitLoggingBase()
virtual void UveShutdownBase()
virtual void CreateNextHops()
virtual void FlowStatsCollectorShutdown()
virtual void CreatePeers()
virtual void ConnectToControllerBase()
std::unique_ptr< EventNotifier > event_notifier_
virtual void PktShutdown()
virtual std::string ModuleName()
virtual void CreateInterfaces()
virtual void VgwShutdownBase()
virtual void CreateDBTablesBase()
virtual void KSyncShutdown()
virtual void InitDoneBase()
void SetResourceManagerReady()
std::unique_ptr< AgentStats > stats_
virtual void CreatePeersBase()
virtual void InitCollectorBase()
virtual void StatsCollectorShutdownBase()
virtual void DeleteDBEntriesBase()
virtual void InitCollector()
virtual void DeleteRoutesBase()
virtual void ServicesShutdownBase()
virtual void IoShutdown()
virtual void CreateVrfBase()
virtual void ModulesShutdownBase()
virtual void FlushFlows()
void CreateResourceManager()
virtual void RegisterDBClients()
virtual void CreateModulesBase()
std::unique_ptr< OperDB > oper_
virtual void InitModulesBase()
std::unique_ptr< Agent > agent_
std::unique_ptr< AgentConfig > cfg_
virtual void UveShutdown()
AgentParam * agent_param_
virtual void FlushFlowsBase()
Platform platform() const
uint32_t tbb_exec_delay() const
uint32_t tbb_schedule_delay() const
const long log_file_size() const
const std::string & agent_name() const
const std::string & log_category() const
const std::vector< std::string > & get_slo_destination()
const std::vector< std::string > & get_sample_destination()
const std::string log_file() const
const int log_files_count() const
void PostValidateLogConfig() const
VirtualGatewayConfigTable * vgw_config_table() const
const std::string & log_level() const
const std::string & log_property_file() const
void Init(const std::string &config_file, const std::string &program_name)
const std::string syslog_facility() const
void set_stats(AgentStats *stats)
void set_event_notifier(EventNotifier *mgr)
NextHopTable * nexthop_table() const
virtual size_t Size() const
void set_l2_receive_nh(NextHop *nh)
static const uint32_t kRpfDiscardIndex
void set_discard_nh(NextHop *nh)
static void set_send_to_collector_flags(const std::vector< std::string > &sampled_destination, const std::vector< std::string > &slo_destination)
static void set_logger_appender(const std::string &file_name, long max_file_size, int max_backup_index, const std::string &syslog_facility, const std::vector< std::string > &destn, const std::string &ident, bool is_sampled_logger)
static void SetLoggingParams(bool enable_local_log, std::string category, std::string level, bool enable_trace_print=false, bool enable_flow_log=false, bool enable_session_syslog=false)
static SandeshLevel::type StringToLevel(std::string level)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
void SetLatencyThreshold(const std::string &name, uint32_t execute, uint32_t schedule)
static TaskScheduler * GetInstance()
void EnableLatencyThresholds(uint32_t execute, uint32_t schedule)
Enable logging of tasks exceeding configured latency.
void InitDone(Agent *agent)
AgentRouteTable * GetBridgeRouteTable() const
InetUnicastAgentRouteTable * GetInet4MplsUnicastRouteTable() const
InetUnicastAgentRouteTable * GetInet4UnicastRouteTable() const
AgentRouteTable * GetEvpnRouteTable() const
AgentRouteTable * GetInet4MulticastRouteTable() const
void CreateFabricPolicyVrf(const string &name)
VrfEntry * FindVrfFromName(const string &name)
void CreateStaticVrf(const string &name)
#define LOG(_Level, _Msg)
log4cplus::LogLevel SandeshLevelTolog4Level(SandeshLevel::type slevel)
string program_name(string filename)
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data