34 agent_(new
Agent()), agent_param_(NULL), trigger_(),
35 enable_controller_(true) {
45 agent_->db()->ClearFactoryRegistry();
53 (
const std::string &config_file,
const std::string &
program_name) {
58 return Module::VROUTER_AGENT;
63 return g_vns_constants.ModuleNames.find(module)->second;
71 return g_vns_constants.INSTANCE_ID_DEFAULT;
75 boost::system::error_code ec;
76 Ip4Address ip = Ip4Address::from_string(
"127.0.0.1", ec);
77 if (ec.value() != 0) {
82 agent_->set_vrouter_server_ip(ip);
84 agent_->set_pkt_interface_name(
"pkt0");
86 agent_->set_vrouter_server_ip(ip);
88 agent_->set_pkt_interface_name(
"unix");
96 agent_->set_agent_init(
this);
108 agent_->set_module_name(module_name);
109 std::vector<std::string> v_slo_destinations =
agent_param_->
110 get_slo_destination();
112 if (log_property_file.size()) {
113 logging.
Init(log_property_file);
167 agent_->SetResourceManagerReady();
178 agent_->set_init_done(
true);
251 oper_->RegisterDBClients();
302 fabric_policy_vrf_name());
305 agent_->set_fabric_vrf(vrf);
306 agent_->set_fabric_policy_vrf(policy_vrf);
309 agent_->set_fabric_inet4_multicast_table
326 if (
agent_->router_id_configured() ==
false) {
328 "Router ID not configured. Connection to controller postponed");
330 LOG(DEBUG,
"Router ID configured. Connection to controller initiated");
332 agent_->controller()->Connect();
336 if (
agent_->controller()) {
337 agent_->controller()->EnableWorkQueue();
357 uint32_t execute_delay = (20 * 1000);
358 uint32_t schedule_delay = (20 * 1000);
366 (schedule_delay * 2));
368 (schedule_delay * 2));
370 (schedule_delay * 2));
388 agent_->controller()->Cleanup();
389 agent_->controller()->DisConnect();
394 init->IoShutdownBase();
404 init->FlushFlowsBase();
414 init->VgwShutdownBase();
421 agent_->oper_db()->DeleteRoutes();
425 init->DeleteRoutesBase();
437 boost::uuids::nil_uuid(),
438 agent_->vhost_interface_name()));
440 req.
data.reset(data);
441 agent_->interface_table()->Enqueue(&req);
448 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_policy_vrf_name());
450 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_policy_vrf_name());
456 agent_->set_vhost_interface(NULL);
465 agent_->vrf_table()->DeleteStaticVrf(
agent_->fabric_vrf_name());
471 agent_->nexthop_table()->set_discard_nh(NULL);
485 uint32_t count,
int msec) {
486 while ((table->
Size() > count) && (msec > 0)) {
492 return (table->
Size() == count);
512 init->ServicesShutdownBase();
522 init->PktShutdownBase();
527 if (
agent_->oper_db() &&
agent_->oper_db()->agent_profile()) {
528 agent_->oper_db()->agent_profile()->Shutdown();
533 init->ProfileShutdownBase();
540 agent_->oper_db()->Shutdown();
544 agent_->cfg()->Shutdown();
550 init->ModulesShutdownBase();
570 init->UveShutdownBase();
575 init->StatsCollectorShutdownBase();
580 init->FlowStatsCollectorShutdownBase();
590 init->KSyncShutdownBase();
618 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()
virtual int Start(Logging &logging)
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
A class providing basic control over logging capabilities in OpenSDN control plane.
void Init()
Performs basic initialization of the logging system ( log4cplus).
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