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.

Closes-bug: #1692795

Conflicts:
	src/vnsw/agent/controller/controller_vrf_export.cc
	src/vnsw/agent/oper/agent_route_walker.cc
	src/vnsw/agent/oper/vrf.cc
	src/vnsw/agent/oper/vrf.h

Conflicts:
	src/vnsw/agent/oper/vrf.h
Change-Id: I7ea7332eb1e64cb0e534f992ef5c8680a54b0313
  • Loading branch information
manishsing committed Jul 19, 2017
1 parent 37e877d commit 72efe8e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/vnsw/agent/controller/controller_peer.cc
Expand Up @@ -1665,7 +1665,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 @@ -50,7 +50,7 @@ void VrfExport::Notify(const Agent *agent, AgentXmppChannel *bgp_xmpp_peer,
//building ingress replication tree
bool send_subscribe = vrf->ShouldExportRoute();

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
26 changes: 20 additions & 6 deletions src/vnsw/agent/oper/vrf.cc
Expand Up @@ -66,7 +66,8 @@ VrfEntry::VrfEntry(const string &name, uint32_t flags, Agent *agent) :
vxlan_id_(VxLanTable::kInvalidvxlan_id),
rt_table_delete_bmap_(0),
route_resync_walker_(NULL), allow_route_add_on_deleted_vrf_(false),
layer2_control_word_(false) {
layer2_control_word_(false),
rd_(0) {
nh_.reset();
}

Expand Down Expand Up @@ -317,7 +318,8 @@ bool VrfEntry::DBEntrySandesh(Sandesh *sresp, std::string &name) const {
data.set_table_label(table_label());
VrfTable *table = static_cast<VrfTable *>(get_table());
stringstream rd;
rd << table->agent()->compute_node_ip().to_string() << ":" << RDInstanceId();
rd << table->agent()->compute_node_ip().to_string() << ":" <<
RDInstanceId(table->agent()->tor_agent_enabled());
data.set_RD(rd.str());

std::vector<VrfSandeshData> &list =
Expand Down Expand Up @@ -399,9 +401,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 @@ -489,6 +490,7 @@ DBEntry *VrfTable::OperDBAdd(const DBRequest *req) {
if (vrf->vn_.get()) {
vrf->layer2_control_word_ = vrf->vn_->layer2_control_word();
}
vrf->set_rd(vrf->RDInstanceId(agent()->tor_agent_enabled()));
return vrf;
}

Expand All @@ -505,9 +507,11 @@ bool VrfTable::OperDBOnChange(DBEntry *entry, const DBRequest *req) {
}

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;
}

Expand All @@ -532,6 +536,16 @@ bool VrfTable::OperDBOnChange(DBEntry *entry, const DBRequest *req) {
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
7 changes: 6 additions & 1 deletion src/vnsw/agent/oper/vrf.h
Expand Up @@ -171,7 +171,7 @@ class VrfEntry : AgentRefCount<VrfEntry>, public AgentOperDBEntry {
allow_route_add_on_deleted_vrf_ = val;
}
InetUnicastAgentRouteTable *GetInetUnicastRouteTable(const IpAddress &addr) const;
int RDInstanceId() const;
void ReleaseWalker();

uint32_t isid() const {
return isid_;
Expand All @@ -193,10 +193,14 @@ class VrfEntry : AgentRefCount<VrfEntry>, public AgentOperDBEntry {
mac_aging_time_ = aging_time;
}

int rd() const {return rd_;}
void set_rd(int rd) {rd_ = rd;}

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

class DeleteActor;
string name_;
Expand All @@ -220,6 +224,7 @@ class VrfEntry : AgentRefCount<VrfEntry>, public AgentOperDBEntry {
bool learning_enabled_;
bool layer2_control_word_;
bool l2_;
int rd_;
DISALLOW_COPY_AND_ASSIGN(VrfEntry);
};

Expand Down

0 comments on commit 72efe8e

Please sign in to comment.