OpenSDN source code
controller/src/vnsw/agent/vxlan_agent/linux/main.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3
*/
4
#include <
base/misc_utils.h
>
5
#include <cmn/buildinfo.h>
6
#include <
cmn/agent_cmn.h
>
7
#include <
init/agent_param.h
>
8
#include <
controller/controller_init.h
>
9
#include "
linux_vxlan_agent_init.h
"
10
11
namespace
opt = boost::program_options;
12
using namespace
std
;
13
14
void
RouterIdDepInit
(
Agent
*agent) {
15
// Parse config and then connect
16
Agent::GetInstance
()->
controller
()->
Connect
();
17
LOG
(DEBUG,
"Router ID Dependent modules (Nova and BGP) INITIALIZED"
);
18
}
19
20
int
main(
int
argc,
char
*argv[]) {
21
AgentParam
params(
false
,
false
,
false
,
false
);
22
23
const
opt::variables_map &var_map = params.var_map();
24
try
{
25
params.ParseArguments(argc, argv);
26
}
catch
(...) {
27
cout <<
"Invalid arguments. "
;
28
cout << params.options() << endl;
29
exit(0);
30
}
31
32
if
(var_map.count(
"help"
)) {
33
cout << params.options() << endl;
34
exit(0);
35
}
36
37
if
(var_map.count(
"version"
)) {
38
cout <<
BuildInfo
<< endl;
39
exit(0);
40
}
41
42
string
init_file =
""
;
43
if
(var_map.count(
"config_file"
)) {
44
init_file = var_map[
"config_file"
].as<
string
>();
45
struct
stat s;
46
if
(stat(init_file.c_str(), &s) != 0) {
47
LOG
(ERROR,
"Error opening config file <"
<< init_file
48
<<
">. Error number <"
<< errno <<
">"
);
49
exit(EINVAL);
50
}
51
}
52
53
// Read agent parameters from config file and arguments
54
params.Init(init_file, argv[0]);
55
56
// Initialize TBB
57
// Call to GetScheduler::GetInstance() will also create Task Scheduler
58
TaskScheduler::Initialize
(params.tbb_thread_count());
59
60
// Initialize the agent-init control class
61
LinuxVxlanAgentInit
init
;
62
Agent
*agent =
init
.agent();
63
64
MiscUtils::LogVersionInfo
(
BuildInfo
, Category::VROUTER);
65
66
init
.set_agent_param(¶ms);
67
68
// kick start initialization
69
int
ret = 0;
70
if
((ret =
init
.Start()) != 0) {
71
return
ret;
72
}
73
74
agent->
event_manager
()->
Run
();
75
76
return
0;
77
}
agent_cmn.h
agent_param.h
AgentParam
Definition:
agent_param.h:112
Agent
Definition:
agent.h:360
Agent::controller
VNController * controller() const
Definition:
agent.cc:984
Agent::event_manager
EventManager * event_manager() const
Definition:
agent.h:1105
Agent::GetInstance
static Agent * GetInstance()
Definition:
agent.h:438
EventManager::Run
void Run()
Definition:
event_manager.cc:23
LinuxVxlanAgentInit
Definition:
linux_vxlan_agent_init.h:18
MiscUtils::LogVersionInfo
static void LogVersionInfo(const std::string str, Category::type categ)
Definition:
misc_utils.cc:36
TaskScheduler::Initialize
static void Initialize(uint32_t thread_count=0, EventManager *evm=NULL)
Definition:
task.cc:478
VNController::Connect
void Connect()
Definition:
controller_init.cc:367
RouterIdDepInit
void RouterIdDepInit(Agent *agent)
Definition:
controller/src/vnsw/agent/vxlan_agent/linux/main.cc:14
controller_init.h
linux_vxlan_agent_init.h
LOG
#define LOG(_Level, _Msg)
Definition:
logging.h:33
misc_utils.h
bgp_log_test::init
void init()
Definition:
bgp_log.cc:37
std
Definition:
bgp_update.h:120
BuildInfo
const std::string BuildInfo
contrail
controller
src
vnsw
agent
vxlan_agent
linux
main.cc
Generated by
1.9.1