OpenSDN source code
tor_agent_init.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3
*/
4
#include <
cmn/agent_cmn.h
>
5
6
#include <vnc_cfg_types.h>
7
#include <bgp_schema_types.h>
8
#include <agent_types.h>
9
10
#include <
init/agent_param.h
>
11
#include <
cmn/agent_db.h
>
12
13
#include <
oper/operdb_init.h
>
14
#include <
oper/peer.h
>
15
#include <
oper/vrf.h
>
16
#include <
oper/interface_common.h
>
17
#include <
oper/nexthop.h
>
18
#include <
oper/multicast.h
>
19
#include <
oper/vn.h
>
20
#include <
oper/mirror_table.h
>
21
#include <
oper/vxlan.h
>
22
#include <
oper/mpls.h
>
23
#include <
oper/route_common.h
>
24
#include <
oper/bridge_route.h
>
25
#include <
uve/agent_uve.h
>
26
27
#include <
cfg/cfg_init.h
>
28
#include <
controller/controller_init.h
>
29
30
#include <
ovs_tor_agent/tor_agent_init.h
>
31
#include <
ovs_tor_agent/tor_agent_param.h
>
32
#include <
ovs_tor_agent/ovsdb_client/ovsdb_route_peer.h
>
33
#include <
ovs_tor_agent/ovsdb_client/ovsdb_client.h
>
34
35
#include <string>
36
37
using
std::string;
38
using
std::cout;
39
using
OVSDB::OvsdbClient
;
40
41
TorAgentInit::TorAgentInit
() {
42
}
43
44
TorAgentInit::~TorAgentInit
() {
45
}
46
47
void
TorAgentInit::ProcessOptions
48
(
const
std::string &config_file,
const
std::string &
program_name
) {
49
AgentInit::ProcessOptions
(config_file,
program_name
);
50
}
51
52
int
TorAgentInit::Start
() {
53
return
AgentInit::Start
();
54
}
55
56
/****************************************************************************
57
* Initialization routines
58
****************************************************************************/
59
string
TorAgentInit::InstanceId
() {
60
TorAgentParam
*param =
dynamic_cast<
TorAgentParam
*
>
(
agent_param
());
61
return
param->
tor_id
();
62
}
63
64
int
TorAgentInit::ModuleType
() {
65
return
Module::TOR_AGENT;
66
}
67
68
void
TorAgentInit::FactoryInit
() {
69
}
70
71
void
TorAgentInit::CreatePeers
() {
72
ovs_peer_manager_
.reset(
new
OvsPeerManager
(
agent
()));
73
}
74
75
void
TorAgentInit::CreateModules
() {
76
uve_
.reset(
new
AgentUve
(
agent
(),
AgentUveBase::kBandwidthInterval
,
77
AgentUveBase::kDefaultInterval
,
78
AgentUveBase::kIncrementalInterval
));
79
agent
()->
set_uve
(
uve_
.get());
80
ovsdb_client_
.reset(OvsdbClient::Allocate(
agent
(),
81
static_cast<
TorAgentParam
*
>
(
agent_param
()),
82
ovs_peer_manager
()));
83
agent
()->
set_ovsdb_client
(
ovsdb_client_
.get());
84
}
85
86
void
TorAgentInit::CreateDBTables
() {
87
}
88
89
void
TorAgentInit::RegisterDBClients
() {
90
uve_
->RegisterDBClients();
91
ovsdb_client_
->RegisterClients();
92
}
93
94
void
TorAgentInit::InitModules
() {
95
uve_
->Init();
96
}
97
98
void
TorAgentInit::ConnectToController
() {
99
agent
()->
controller
()->
Connect
();
100
}
101
102
/****************************************************************************
103
* Shutdown routines
104
****************************************************************************/
105
void
TorAgentInit::UveShutdown
() {
106
uve_
->Shutdown();
107
}
108
109
void
TorAgentInit::WaitForIdle
() {
110
sleep(5);
111
}
112
113
/****************************************************************************
114
* Access routines
115
****************************************************************************/
116
OvsPeerManager
*
TorAgentInit::ovs_peer_manager
()
const
{
117
return
ovs_peer_manager_
.get();
118
}
agent_cmn.h
agent_db.h
agent_param.h
agent_uve.h
bridge_route.h
cfg_init.h
AgentInit::ProcessOptions
virtual void ProcessOptions(const std::string &config_file, const std::string &program_name)
Definition:
agent_init.cc:52
AgentInit::Start
virtual int Start()
Definition:
agent_init.cc:93
AgentInit::agent_param
AgentParam * agent_param() const
Definition:
agent_init.h:28
AgentInit::agent
Agent * agent() const
Definition:
agent_init.h:26
AgentUveBase::kBandwidthInterval
static const uint64_t kBandwidthInterval
Definition:
agent_uve_base.h:70
AgentUveBase::kDefaultInterval
static const uint32_t kDefaultInterval
Definition:
agent_uve_base.h:64
AgentUveBase::kIncrementalInterval
static const uint32_t kIncrementalInterval
Definition:
agent_uve_base.h:68
AgentUve
Definition:
agent_uve.h:13
Agent::controller
VNController * controller() const
Definition:
agent.cc:984
Agent::set_uve
void set_uve(AgentUveBase *uve)
Definition:
agent.cc:916
Agent::set_ovsdb_client
void set_ovsdb_client(OVSDB::OvsdbClient *client)
Definition:
agent.h:1129
OVSDB::OvsdbClient
Definition:
ovsdb_client.h:17
OvsPeerManager
Definition:
ovsdb_route_peer.h:47
TorAgentInit::ovs_peer_manager
OvsPeerManager * ovs_peer_manager() const
Definition:
tor_agent_init.cc:116
TorAgentInit::ovs_peer_manager_
std::unique_ptr< OvsPeerManager > ovs_peer_manager_
Definition:
tor_agent_init.h:51
TorAgentInit::FactoryInit
void FactoryInit()
Definition:
tor_agent_init.cc:68
TorAgentInit::WaitForIdle
void WaitForIdle()
Definition:
tor_agent_init.cc:109
TorAgentInit::ovsdb_client_
std::unique_ptr< OVSDB::OvsdbClient > ovsdb_client_
Definition:
tor_agent_init.h:52
TorAgentInit::ModuleType
virtual int ModuleType()
Definition:
tor_agent_init.cc:64
TorAgentInit::CreateDBTables
void CreateDBTables()
Definition:
tor_agent_init.cc:86
TorAgentInit::InitModules
void InitModules()
Definition:
tor_agent_init.cc:94
TorAgentInit::Start
int Start()
Definition:
tor_agent_init.cc:52
TorAgentInit::uve_
std::unique_ptr< AgentUveBase > uve_
Definition:
tor_agent_init.h:53
TorAgentInit::TorAgentInit
TorAgentInit()
Definition:
tor_agent_init.cc:41
TorAgentInit::ProcessOptions
void ProcessOptions(const std::string &config_file, const std::string &program_name)
Definition:
tor_agent_init.cc:48
TorAgentInit::CreateModules
void CreateModules()
Definition:
tor_agent_init.cc:75
TorAgentInit::CreatePeers
void CreatePeers()
Definition:
tor_agent_init.cc:71
TorAgentInit::UveShutdown
void UveShutdown()
Definition:
tor_agent_init.cc:105
TorAgentInit::RegisterDBClients
void RegisterDBClients()
Definition:
tor_agent_init.cc:89
TorAgentInit::ConnectToController
void ConnectToController()
Definition:
tor_agent_init.cc:98
TorAgentInit::~TorAgentInit
~TorAgentInit()
Definition:
tor_agent_init.cc:44
TorAgentInit::InstanceId
virtual std::string InstanceId()
Definition:
tor_agent_init.cc:59
TorAgentParam
Definition:
tor_agent_param.h:13
TorAgentParam::tor_id
std::string tor_id() const
Definition:
tor_agent_param.h:47
VNController::Connect
void Connect()
Definition:
controller_init.cc:367
controller_init.h
interface_common.h
mirror_table.h
mpls.h
multicast.h
nexthop.h
operdb_init.h
ovsdb_client.h
ovsdb_route_peer.h
peer.h
route_common.h
program_name
string program_name(string filename)
Definition:
src/contrail-common/sandesh/compiler/main.cc:322
tor_agent_init.h
tor_agent_param.h
vn.h
vrf.h
vxlan.h
contrail
controller
src
vnsw
agent
ovs_tor_agent
tor_agent_init.cc
Generated by
1.9.1