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