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  * Copyright Contributors to the OpenSDN project
4  */
5 #include <cmn/agent_cmn.h>
6 
7 #include <vnc_cfg_types.h>
8 #include <bgp_schema_types.h>
9 #include <agent_types.h>
10 
11 #include <init/agent_param.h>
12 #include <cmn/agent_db.h>
13 
14 #include <oper/operdb_init.h>
15 #include <oper/peer.h>
16 #include <oper/vrf.h>
17 #include <oper/interface_common.h>
18 #include <oper/nexthop.h>
19 #include <oper/multicast.h>
20 #include <oper/vn.h>
21 #include <oper/mirror_table.h>
22 #include <oper/vxlan.h>
23 #include <oper/mpls.h>
24 #include <oper/route_common.h>
25 #include <oper/bridge_route.h>
26 #include <uve/agent_uve.h>
27 
28 #include <cfg/cfg_init.h>
30 
35 
36 #include <string>
37 
38 using std::string;
39 using std::cout;
40 using OVSDB::OvsdbClient;
41 
43 }
44 
46 }
47 
49  (const std::string &config_file, const std::string &program_name) {
51 }
52 
54  return AgentInit::Start();
55 }
56 
57 /****************************************************************************
58  * Initialization routines
59 ****************************************************************************/
61  TorAgentParam *param = dynamic_cast<TorAgentParam *>(agent_param());
62  return param->tor_id();
63 }
64 
66  return Module::TOR_AGENT;
67 }
68 
70 }
71 
74 }
75 
80  agent()->set_uve(uve_.get());
81  ovsdb_client_.reset(OvsdbClient::Allocate(agent(),
82  static_cast<TorAgentParam *>(agent_param()),
83  ovs_peer_manager()));
85 }
86 
88 }
89 
91  uve_->RegisterDBClients();
92  ovsdb_client_->RegisterClients();
93 }
94 
96  uve_->Init();
97 }
98 
100  agent()->controller()->Connect();
101 }
102 
103 /****************************************************************************
104  * Shutdown routines
105  ****************************************************************************/
107  uve_->Shutdown();
108 }
109 
111  sleep(5);
112 }
113 
114 /****************************************************************************
115  * Access routines
116  ****************************************************************************/
118  return ovs_peer_manager_.get();
119 }
virtual void ProcessOptions(const std::string &config_file, const std::string &program_name)
Definition: agent_init.cc:53
AgentParam * agent_param() const
Definition: agent_init.h:31
virtual int Start(Logging &logging)
Definition: agent_init.cc:94
Agent * agent() const
Definition: agent_init.h:29
static const uint64_t kBandwidthInterval
static const uint32_t kDefaultInterval
static const uint32_t kIncrementalInterval
VNController * controller() const
Definition: agent.cc:985
void set_uve(AgentUveBase *uve)
Definition: agent.cc:917
void set_ovsdb_client(OVSDB::OvsdbClient *client)
Definition: agent.h:1130
A class providing basic control over logging capabilities in OpenSDN control plane.
Definition: logging.h:44
OvsPeerManager * ovs_peer_manager() const
int Start(Logging &logging)
std::unique_ptr< OvsPeerManager > ovs_peer_manager_
void FactoryInit()
std::unique_ptr< OVSDB::OvsdbClient > ovsdb_client_
virtual int ModuleType()
void CreateDBTables()
void InitModules()
std::unique_ptr< AgentUveBase > uve_
void ProcessOptions(const std::string &config_file, const std::string &program_name)
void CreateModules()
void CreatePeers()
void RegisterDBClients()
void ConnectToController()
virtual std::string InstanceId()
std::string tor_id() const
string program_name(string filename)