Skip to content

Commit

Permalink
Merge "* Pick route table from dependent route" into R3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jan 3, 2017
2 parents 5c64ff7 + e29c193 commit d699f7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vnsw/agent/oper/path_preference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ PathPreferenceState::~PathPreferenceState() {
//Given a VRF table the table listener id for given route
bool
PathPreferenceState::GetRouteListenerId(const VrfEntry* vrf,
const Agent::RouteTableType &table_type,
DBTableBase::ListenerId &rt_id) const {
if (vrf == NULL) {
return false;
Expand All @@ -676,11 +677,11 @@ PathPreferenceState::GetRouteListenerId(const VrfEntry* vrf,
}

rt_id = DBTableBase::kInvalidId;
if (rt_->GetTableType() == Agent::EVPN) {
if (table_type == Agent::EVPN) {
rt_id = vrf_state->evpn_rt_id_;
} else if (rt_->GetTableType() == Agent::INET4_UNICAST) {
} else if (table_type == Agent::INET4_UNICAST) {
rt_id = vrf_state->uc_rt_id_;
} else if (rt_->GetTableType() == Agent::INET6_UNICAST) {
} else if (table_type == Agent::INET6_UNICAST) {
rt_id = vrf_state->uc6_rt_id_;
} else {
return false;
Expand Down Expand Up @@ -709,20 +710,22 @@ PathPreferenceState::GetDependentPath(const AgentPath *path) const {
}

AgentRouteTable *table = NULL;
Agent::RouteTableType table_type = Agent::INET4_UNICAST;
if (path->path_preference().dependent_ip().is_v4()) {
table = static_cast<AgentRouteTable *>(
vrf->GetInet4UnicastRouteTable());
} else if (path->path_preference().dependent_ip().is_v6()) {
table = static_cast<AgentRouteTable *>(
vrf->GetInet6UnicastRouteTable());
table_type = Agent::INET6_UNICAST;
}
AgentRoute *rt = static_cast<AgentRoute *>(table->Find(&key));
if (rt == NULL) {
return NULL;
}

DBTableBase::ListenerId rt_id = DBTableBase::kInvalidId;
GetRouteListenerId(vrf, rt_id);
GetRouteListenerId(vrf, table_type, rt_id);

PathPreferenceState *state = static_cast<PathPreferenceState *>(
rt->GetState(table, rt_id));
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/oper/path_preference.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class PathPreferenceState: public DBState {
PathPreferenceSM* GetDependentPath(const AgentPath *path) const;
private:
bool GetRouteListenerId(const VrfEntry *vrf,
const Agent::RouteTableType &table,
DBTableBase::ListenerId &rt_id) const;
Agent *agent_;
AgentRoute *rt_;
Expand Down

0 comments on commit d699f7d

Please sign in to comment.