Skip to content

Commit

Permalink
BUM tree subscription skipped.
Browse files Browse the repository at this point in the history
With the introduction of same RD for Tor agent for vrf, change of vnid was not
handled. In cases where a vn was added with vnid as not set or 0 and then
updated later with non zero value, vrf was not notified.
This used to result in skipping of notify registeration for the problematic vrf.
In turn subscriptions were missed.

Solution:
Handle vnid change.

Change-Id: I7ea7332eb1e64cb0e534f992ef5c8680a54b0313
Closes-bug: #1692795
  • Loading branch information
manishsing committed Jun 8, 2017
1 parent 7972360 commit 8a922e3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vnsw/agent/controller/controller_peer.cc
Expand Up @@ -1766,7 +1766,7 @@ bool AgentXmppChannel::ControllerSendSubscribe(AgentXmppChannel *peer,
pugi->AddAttribute("node", vrf->GetName());
pugi->AddChildNode("options", "" );
stringstream vrf_id;
vrf_id << vrf->RDInstanceId();
vrf_id << vrf->rd();
pugi->AddChildNode("instance-id", vrf_id.str());

datalen_ = XmppProto::EncodeMessage(impl.get(), data_, sizeof(data_));
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/controller/controller_vrf_export.cc
Expand Up @@ -29,7 +29,7 @@ void VrfExport::Notify(const Agent *agent, AgentXmppChannel *bgp_xmpp_peer,

BgpPeer *bgp_peer = static_cast<BgpPeer *>(bgp_xmpp_peer->bgp_peer_id());
VrfEntry *vrf = static_cast<VrfEntry *>(e);
uint32_t instance_id = vrf->RDInstanceId();
uint32_t instance_id = vrf->rd();
//Instance ID being zero is possible because of VN unavailability and VRF
//ending up with NULL VRF. Reason being config sequence.
//So seeing 0 instance_id delete the state so that resubscribe can be done
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/oper/agent_route_walker.cc
Expand Up @@ -25,6 +25,7 @@ AgentRouteWalker::AgentRouteWalker(Agent *agent, WalkType type) :
walk_count_ = AgentRouteWalker::kInvalidWalkCount;
queued_walk_count_ = AgentRouteWalker::kInvalidWalkCount;
queued_walk_done_count_ = AgentRouteWalker::kInvalidWalkCount;
walkable_route_tables_ = 0;
for (uint8_t table_type = (Agent::INVALID + 1);
table_type < Agent::ROUTE_TABLE_MAX;
table_type++) {
Expand Down
23 changes: 18 additions & 5 deletions src/vnsw/agent/oper/vrf.cc
Expand Up @@ -63,7 +63,8 @@ VrfEntry::VrfEntry(const string &name, uint32_t flags, Agent *agent) :
table_label_(MplsTable::kInvalidLabel),
vxlan_id_(VxLanTable::kInvalidvxlan_id),
rt_table_delete_bmap_(0),
route_resync_walker_(NULL), allow_route_add_on_deleted_vrf_(false) {
route_resync_walker_(NULL), allow_route_add_on_deleted_vrf_(false),
rd_(0) {
}

VrfEntry::~VrfEntry() {
Expand Down Expand Up @@ -376,9 +377,8 @@ void VrfEntry::ResyncRoutes() {
// two different RD causing undefined behavior.
// To avoid this both TA should generate same RD. As VN id is generated by config
// it is unique and common across both TA so same can be used.
int VrfEntry::RDInstanceId() const {
Agent *agent = (static_cast<VrfTable *>(get_table()))->agent();
if (agent->tor_agent_enabled() == false) {
int VrfEntry::RDInstanceId(bool tor_agent_enabled) const {
if (tor_agent_enabled == false) {
return id_;
}

Expand Down Expand Up @@ -450,6 +450,7 @@ DBEntry *VrfTable::OperDBAdd(const DBRequest *req) {
name_tree_.insert( VrfNamePair(key->name_, vrf));

vrf->vn_.reset(agent()->vn_table()->Find(data->vn_uuid_));
vrf->set_rd(vrf->RDInstanceId(agent()->tor_agent_enabled()));
return vrf;
}

Expand All @@ -460,12 +461,24 @@ bool VrfTable::OperDBOnChange(DBEntry *entry, const DBRequest *req) {
vrf->set_flags(data->flags_);

VnEntry *vn = agent()->vn_table()->Find(data->vn_uuid_);
bool resync_routes = false;

if (vn != vrf->vn_.get()) {
resync_routes = true;
vrf->vn_.reset(vn);
vrf->ResyncRoutes();
ret = true;
}

if (vrf->rd() != vrf->RDInstanceId(agent()->tor_agent_enabled())) {
resync_routes = true;
vrf->set_rd(vrf->RDInstanceId(agent()->tor_agent_enabled()));
ret = true;
}

if (resync_routes) {
vrf->ResyncRoutes();
}

uint32_t vxlan_id = VxLanTable::kInvalidvxlan_id;
if (vn) {
vxlan_id = vn->GetVxLanId();
Expand Down
5 changes: 4 additions & 1 deletion src/vnsw/agent/oper/vrf.h
Expand Up @@ -131,11 +131,13 @@ class VrfEntry : AgentRefCount<VrfEntry>, public AgentOperDBEntry {
allow_route_add_on_deleted_vrf_ = val;
}
InetUnicastAgentRouteTable *GetInetUnicastRouteTable(const IpAddress &addr) const;
int RDInstanceId() const;
int rd() const {return rd_;}
void set_rd(int rd) {rd_ = rd;}

private:
friend class VrfTable;
void CreateRouteTables();
int RDInstanceId(bool tor_agent_enabled) const;

class DeleteActor;
string name_;
Expand All @@ -152,6 +154,7 @@ class VrfEntry : AgentRefCount<VrfEntry>, public AgentOperDBEntry {
IFMapDependencyManager::IFMapNodePtr vrf_node_ptr_;
boost::scoped_ptr<AgentRouteResync> route_resync_walker_;
bool allow_route_add_on_deleted_vrf_;
int rd_;
DISALLOW_COPY_AND_ASSIGN(VrfEntry);
};

Expand Down

0 comments on commit 8a922e3

Please sign in to comment.