12 #include "vr_genetlink.h"
17 #include <uve/stats_interval_types.h>
25 using process::ConnectionInfo;
26 using process::ConnectionType;
27 using process::ProcessState;
28 using process::ConnectionStatus;
31 using process::g_process_info_constants;
46 uint32_t default_intvl, uint32_t incremental_intvl)
47 : vn_uve_table_(NULL), vm_uve_table_(NULL), vrouter_uve_entry_(NULL),
49 interface_uve_table_(NULL),
50 default_interval_(default_intvl),
51 incremental_interval_(incremental_intvl),
52 agent_(agent), bandwidth_intvl_(intvl),
54 *(agent->event_manager()->io_service()),
65 TagList::const_iterator it = tl.begin();
66 while (it != tl.end()) {
89 if (!info->
labels.empty()) {
120 std::stringstream ss;
121 ss <<
"0x" << std::setfill(
'0') <<
122 std::setw(12) << std::hex << (uint64_t)value;
128 TagList::const_iterator it = tl.begin();
129 while (it != tl.end()) {
152 if (!info->
labels.empty()) {
179 if (new_interval == 0) {
187 if (new_interval == 0) {
212 ConnectionStateManager::
216 module_id, instance_id,
218 this, _1, _2, _3),
"ObjectVRouter");
222 uint8_t &num_dns_servers) {
245 std::string &message) {
246 if (message.empty()) {
247 message = cinfo.get_type();
249 message +=
", " + cinfo.get_type();
251 const std::string &name(cinfo.get_name());
253 message +=
":" + name;
265 (
const std::vector<ConnectionInfo> &cinfos,
267 size_t num_conns = 0;
268 uint8_t num_control_nodes = 0, num_dns_servers = 0;
269 uint8_t down_control_nodes = 0;
272 std::string cup(g_process_info_constants.ConnectionStatusNames.
273 find(ConnectionStatus::UP)->second);
275 bool is_tor_connected =
false;
276 string tor_type(g_process_info_constants.ConnectionTypeNames.
277 find(ConnectionType::TOR)->second);
279 for (std::vector<ConnectionInfo>::const_iterator it = cinfos.begin();
280 it != cinfos.end(); it++) {
281 const ConnectionInfo &cinfo(*it);
282 const std::string &conn_status(cinfo.get_status());
283 if (cinfo.get_type() == tor_type) {
284 is_tor_connected =
true;
294 if (conn_status != cup) {
295 if (cinfo.get_name().compare(0, 13,
297 down_control_nodes++;
303 if ((num_control_nodes == 0) || (num_control_nodes == down_control_nodes)) {
304 pstate = ProcessState::NON_FUNCTIONAL;
305 if ((num_control_nodes == 0) && message.empty()) {
306 message =
"No control-nodes configured";
310 pstate = ProcessState::NON_FUNCTIONAL;
311 message +=
" No ToR Config";
313 pstate = ProcessState::FUNCTIONAL;
316 message +=
" connection down";
320 pstate = ProcessState::NON_FUNCTIONAL;
321 if (message.empty()) {
322 message =
"No Configuration for self";
324 message +=
", No Configuration for self";
335 if (num_conns != expected_conns) {
std::vector< uint64_t > TagList
const std::vector< std::string > collector_server_list() const
uint32_t xmpp_reconnects(uint8_t idx) const
static const uint32_t kUveCountPerTimer
boost::scoped_ptr< VrouterStatsCollector > vrouter_stats_collector_
static const uint64_t kBandwidthInterval
void VrouterAgentProcessState(const std::vector< process::ConnectionInfo > &c, process::ProcessState::type &state, std::string &message)
virtual void RegisterDBClients()
void BuildTagIdsFromList(const TagList &tl, UveTagData *info) const
boost::scoped_ptr< VnUveTableBase > vn_uve_table_
boost::scoped_ptr< VrouterUveEntryBase > vrouter_uve_entry_
boost::scoped_ptr< InterfaceUveTable > interface_uve_table_
AgentUveBase(Agent *agent, uint64_t intvl, uint32_t default_intvl, uint32_t incremental_intvl)
uint32_t incremental_interval_
void set_incremental_interval(uint32_t new_interval=kIncrementalInterval)
Sets the incremental interval (time between dispatches of Agent's information and its remnant to UVE)...
static AgentUveBase * singleton_
void set_default_interval(uint32_t new_interval=kDefaultInterval)
Sets the default interval (time between two dispatches of Agent's information to UVE).
boost::scoped_ptr< VmUveTableBase > vm_uve_table_
void UpdateMessage(const process::ConnectionInfo &info, std::string &message)
static const uint32_t kDefaultInterval
static const uint32_t kIncrementalInterval
uint8_t ExpectedConnections(uint8_t &num_c_nodes, uint8_t &num_d_servers)
boost::scoped_ptr< ProuterUveTable > prouter_uve_table_
uint32_t default_interval_
std::string TagIDToHexString(uint64_t value) const
process::ConnectionStateManager * connection_state_manager_
void BuildTagNamesFromList(const TagList &tl, UveTagData *info) const
bool HasSelfConfiguration() const
ServicesModule * services() const
TagTable * tag_table() const
const std::string & dns_server(uint8_t idx) const
AgentParam * params() const
const std::string & agent_name() const
EventManager * event_manager() const
void set_connection_state(process::ConnectionState *state)
const std::string & controller_ifmap_xmpp_server(uint8_t idx) const
const std::string & module_name() const
static const std::string & xmpp_control_node_prefix()
bool tor_agent_enabled() const
AgentStats * stats() const
const std::string & instance_id() const
boost::asio::io_context * io_service()
GlobalVrouter * global_vrouter() const
static const uint32_t kTagTypeBitShift
const std::string & TagName(uint64_t id)
void Init(boost::asio::io_context &service, const std::string &hostname, const std::string &module, const std::string &instance_id, ProcessStateFn status_cb, std::string table)
static const std::string integerToString(const NumberType &num)
std::vector< string > label_vector
std::vector< string > custom_tag_vector
std::set< string > label_set
std::set< string > custom_tag_set