Skip to content

Commit

Permalink
Remove systemlog messages generated for every route add/delete
Browse files Browse the repository at this point in the history
A collector systemlog message for every route add/delete will result in
overloading of controller with route logs. Removed the sytemlog for
route messages and made them trace messages

Change-Id: I133ea8c0727c4bd81edc880e2f765e1a3b23d302
Closes-Bug: #1563773
  • Loading branch information
praveenkv committed Mar 31, 2016
1 parent 7e57e6a commit d88bbac
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 25 deletions.
56 changes: 56 additions & 0 deletions src/vnsw/agent/controller/controller_route_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ bool CheckPeerValidity(const AgentXmppChannel *channel,
return false;
}

// Error string for invalid-peer
std::string GetInvalidPeerMsg(const std::string &type,
const AgentXmppChannel *channel,
uint64_t sequence_number) {
if (sequence_number == ControllerPeerPath::kInvalidPeerIdentifier) {
return type + " : Invalid sequence number";
}

assert(channel);
if (channel->bgp_peer_id() == NULL) {
return type + " : bgp-peer-id NULL";
}

if (sequence_number != channel->unicast_sequence_number()) {
return type + " : sequence number mis-match";
}

return type + " : Unexpected error";
}


ControllerPeerPath::ControllerPeerPath(const Peer *peer) :
AgentRouteData(false), peer_(peer) {
if ((peer != NULL) && (peer->GetType() == Peer::BGP_PEER) ) {
Expand All @@ -58,6 +79,11 @@ ControllerPeerPath::ControllerPeerPath(const Peer *peer) :
}
}

string ControllerEcmpRoute::PeerInvalidMsg(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ControllerEcmpRoute", channel(),
sequence_number());
}

bool ControllerEcmpRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel(), sequence_number());
}
Expand Down Expand Up @@ -106,6 +132,10 @@ ControllerVmRoute *ControllerVmRoute::MakeControllerVmRoute(const Peer *peer,
return data;
}

string ControllerVmRoute::PeerInvalidMsg(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ControllerVmRoute", channel(), sequence_number());
}

bool ControllerVmRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel(), sequence_number());
}
Expand Down Expand Up @@ -267,6 +297,11 @@ ControllerLocalVmRoute::ControllerLocalVmRoute(const VmInterfaceKey &intf,
path_preference, Ip4Address(0), ecmp_load_balance),
sequence_number_(sequence_number), channel_(channel) { }

string ControllerLocalVmRoute::PeerInvalidMsg(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ControllerLocalVmRoute", channel_,
sequence_number_);
}

bool ControllerLocalVmRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel_, sequence_number_);
}
Expand All @@ -282,6 +317,11 @@ ControllerVlanNhRoute::ControllerVlanNhRoute(const VmInterfaceKey &intf,
VlanNhRoute(intf, tag, label, dest_vn_list, sg_list, path_preference),
sequence_number_(sequence_number), channel_(channel) { }

string ControllerVlanNhRoute::PeerInvalidMsg(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ControllerVlanNhRoute", channel_,
sequence_number_);
}

bool ControllerVlanNhRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel_, sequence_number_);
}
Expand All @@ -295,6 +335,12 @@ ControllerInetInterfaceRoute::ControllerInetInterfaceRoute(const InetInterfaceKe
InetInterfaceRoute(intf, label, tunnel_bmap, dest_vn_list),
sequence_number_(sequence_number), channel_(channel) { }

string ControllerInetInterfaceRoute::PeerInvalidMsg
(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ConrollerInetInterfaceRoute", channel_,
sequence_number_);
}

bool ControllerInetInterfaceRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel_, sequence_number_);
}
Expand Down Expand Up @@ -367,6 +413,10 @@ bool ClonedLocalPath::AddChangePath(Agent *agent, AgentPath *path,
return ret;
}

string ClonedLocalPath::PeerInvalidMsg(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ClonedLocalPath", channel_, sequence_number_);
}

bool ClonedLocalPath::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel_, sequence_number_);
}
Expand All @@ -382,6 +432,12 @@ ControllerMulticastRoute::ControllerMulticastRoute(const string &vn_name,
MulticastRoute(vn_name, label, vxlan_id, tunnel_type, nh_req, comp_nh_type),
sequence_number_(sequence_number), channel_(channel) { }

string ControllerMulticastRoute::PeerInvalidMsg
(const AgentRouteKey *key) const {
return GetInvalidPeerMsg("ControllerMulticastRoute", channel_,
sequence_number_);
}

bool ControllerMulticastRoute::IsPeerValid(const AgentRouteKey *key) const {
return CheckPeerValidity(channel_, sequence_number_);
}
7 changes: 7 additions & 0 deletions src/vnsw/agent/controller/controller_route_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class ControllerVmRoute : public ControllerPeerPath {
const AgentRoute *rt);
virtual bool UpdateRoute(AgentRoute *route);
virtual string ToString() const {return "remote VM";}
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;
const SecurityGroupList &sg_list() const {return sg_list_;}
static ControllerVmRoute *MakeControllerVmRoute(const Peer *peer,
Expand Down Expand Up @@ -143,6 +144,7 @@ class ControllerEcmpRoute : public ControllerPeerPath {
virtual bool AddChangePath(Agent *agent, AgentPath *path,
const AgentRoute *);
virtual string ToString() const {return "inet4 ecmp";}
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;

private:
Expand Down Expand Up @@ -176,6 +178,7 @@ class ControllerLocalVmRoute : public LocalVmRoute {
const EcmpLoadBalance &ecmp_load_balance,
const AgentXmppChannel *channel);
virtual ~ControllerLocalVmRoute() { }
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;

private:
Expand All @@ -196,6 +199,7 @@ class ControllerInetInterfaceRoute : public InetInterfaceRoute {
uint64_t sequence_number,
const AgentXmppChannel *channel);
virtual ~ControllerInetInterfaceRoute() { }
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;

private:
Expand All @@ -219,6 +223,7 @@ class ControllerVlanNhRoute : public VlanNhRoute {
uint64_t sequence_number,
const AgentXmppChannel *channel);
virtual ~ControllerVlanNhRoute() { }
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;

private:
Expand All @@ -244,6 +249,7 @@ class ClonedLocalPath : public AgentRouteData {
AgentRouteData(false), sequence_number_(seq),
channel_(channel), mpls_label_(label), vn_list_(vn_list), sg_list_(sg_list) {}
virtual ~ClonedLocalPath() {}
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;
virtual bool AddChangePath(Agent *agent, AgentPath *path,
const AgentRoute *rt);
Expand All @@ -270,6 +276,7 @@ class ControllerMulticastRoute : public MulticastRoute {
uint64_t sequence_number,
const AgentXmppChannel *channel);
virtual ~ControllerMulticastRoute() { }
virtual std::string PeerInvalidMsg(const AgentRouteKey *key) const;
virtual bool IsPeerValid(const AgentRouteKey *key) const;

private:
Expand Down
4 changes: 2 additions & 2 deletions src/vnsw/agent/oper/agent.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -1611,12 +1611,12 @@ traceobject sandesh OperNextHop {
}

/**
* @description: System log for agent route
* @description: Log for agent route
* @type: systemlog
* @severity: DEBUG
* @cause: Normal operation
*/
systemlog sandesh AgentRouteLog {
trace sandesh AgentRouteLog {
1: string message;
2: string ip;
3: "in VRF";
Expand Down
16 changes: 8 additions & 8 deletions src/vnsw/agent/oper/agent_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ void AgentRouteTable::Input(DBTablePartition *part, DBClient *client,

if (data) {
if (data->IsPeerValid(key) == false) {
AGENT_ROUTE_LOG("Invalid/Inactive Peer ",
key->ToString(),
vrf_name(),
"");
AGENT_ROUTE_LOG(this,
"Route operation ignored. Invalid/Inactive Peer ",
key->ToString(), vrf_name(),
data->InvalidPeerMsg(key));
return;
}
} else {
Expand Down Expand Up @@ -402,8 +402,6 @@ void AgentRouteTable::Input(DBTablePartition *part, DBClient *client,
rt->FillTrace(rt_info, AgentRoute::ADD, NULL);
OPER_TRACE_ROUTE_ENTRY(Route, this, rt_info);
route_added = true;
AGENT_ROUTE_LOG("Added route", rt->ToString(), vrf_name(),
GETPEERNAME(key->peer()));
} else {
// RT present. Check if path is also present by peer
path = rt->FindPathUsingKeyData(key, data);
Expand All @@ -424,8 +422,6 @@ void AgentRouteTable::Input(DBTablePartition *part, DBClient *client,
RouteInfo rt_info;
rt->FillTrace(rt_info, AgentRoute::ADD_PATH, path);
OPER_TRACE_ROUTE_ENTRY(Route, this, rt_info);
AGENT_ROUTE_LOG("Path add", rt->ToString(), vrf_name(),
GETPEERNAME(key->peer()));
} else {
// Let path know of route change and update itself
path->set_is_stale(false);
Expand Down Expand Up @@ -816,6 +812,10 @@ bool AgentRouteData::IsPeerValid(const AgentRouteKey *key) const {
return true;
}

std::string AgentRouteData::InvalidPeerMsg(const AgentRouteKey *key) const {
return "AgentRouteData: Unknown Reason";
}

AgentPath *AgentRouteData::CreateAgentPath(const Peer *peer,
AgentRoute *rt) const {
return (new AgentPath(peer, rt));
Expand Down
7 changes: 4 additions & 3 deletions src/vnsw/agent/oper/agent_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct AgentRouteData : public AgentData {
virtual bool AddChangePath(Agent *agent, AgentPath *path,
const AgentRoute *rt) = 0;
virtual bool IsPeerValid(const AgentRouteKey *key) const;
virtual std::string InvalidPeerMsg(const AgentRouteKey *key) const;
virtual bool UpdateRoute(AgentRoute *rt) {return false;}

bool is_multicast() const {return is_multicast_;}
Expand Down Expand Up @@ -319,10 +320,10 @@ extern SandeshTraceBufferPtr AgentDBwalkTraceBuf;
} while (0);

#define GETPEERNAME(peer) (peer)? peer->GetName() : ""
#define AGENT_ROUTE_LOG(oper, route, vrf, peer_name)\
#define AGENT_ROUTE_LOG(table, msg, route, vrf, peer_info)\
do {\
AgentRouteLog::Send("Agent", SandeshLevel::SYS_INFO, __FILE__, __LINE__,\
oper, route, vrf, peer_name);\
AgentRouteLog::TraceMsg(table->GetOperDBTraceBuf(), __FILE__, __LINE__,\
msg, route, vrf, peer_info);\
} while(false);\

#endif
21 changes: 9 additions & 12 deletions src/vnsw/agent/oper/inet_unicast_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,9 @@ AgentPath *InetUnicastRouteEntry::AllocateEcmpPath(Agent *agent,

RouteInfo rt_info;
FillTrace(rt_info, AgentRoute::CHANGE_PATH, path);
OPER_TRACE_ROUTE_ENTRY(Route,
static_cast<AgentRouteTable *>(get_table()),
rt_info);
AGENT_ROUTE_LOG("Path change", ToString(), vrf()->GetName(),
AgentRouteTable *table = static_cast<AgentRouteTable *>(get_table());
OPER_TRACE_ROUTE_ENTRY(Route, table, rt_info);
AGENT_ROUTE_LOG(table, "Path change", ToString(), vrf()->GetName(),
GETPEERNAME(agent->ecmp_peer()));

return path;
Expand Down Expand Up @@ -701,10 +700,9 @@ void InetUnicastRouteEntry::AppendEcmpPath(Agent *agent,

RouteInfo rt_info;
FillTrace(rt_info, AgentRoute::CHANGE_PATH, path);
OPER_TRACE_ROUTE_ENTRY(Route,
static_cast<AgentRouteTable *>(get_table()),
rt_info);
AGENT_ROUTE_LOG("Path change", ToString(), vrf()->GetName(),
AgentRouteTable *table = static_cast<AgentRouteTable *>(get_table());
OPER_TRACE_ROUTE_ENTRY(Route, table, rt_info);
AGENT_ROUTE_LOG(table, "Path change", ToString(), vrf()->GetName(),
GETPEERNAME(agent->ecmp_peer()));
}

Expand Down Expand Up @@ -745,10 +743,9 @@ void InetUnicastRouteEntry::DeleteComponentNH(Agent *agent, AgentPath *path) {

RouteInfo rt_info;
FillTrace(rt_info, AgentRoute::CHANGE_PATH, path);
OPER_TRACE_ROUTE_ENTRY(Route,
static_cast<AgentRouteTable *>(get_table()),
rt_info);
AGENT_ROUTE_LOG("Path change", ToString(), vrf()->GetName(),
AgentRouteTable *table = static_cast<AgentRouteTable *>(get_table());
OPER_TRACE_ROUTE_ENTRY(Route, table, rt_info);
AGENT_ROUTE_LOG(table, "Path change", ToString(), vrf()->GetName(),
GETPEERNAME(agent->ecmp_peer()));
}

Expand Down

0 comments on commit d88bbac

Please sign in to comment.