Skip to content

Commit

Permalink
Merge "Double path delete request in succession." into R2.22.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 20, 2016
2 parents 9b69ed7 + 217fa01 commit 77645e8
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/vnsw/agent/oper/agent_route.cc
Expand Up @@ -532,12 +532,11 @@ void AgentRouteTable::SquashStalePaths(AgentRoute *route,
if (path->is_stale() && (path != exception_path)) {
// Since we squash stales, at any point of time there should be only
// one stale other than exception_path in list
break;
DeletePathFromPeer(route->get_table_partition(), route, path);
return;
}
it++;
}
DeletePathFromPeer(route->get_table_partition(), route, path);
return;
}

uint32_t AgentRoute::GetActiveLabel() const {
Expand Down
56 changes: 56 additions & 0 deletions src/vnsw/agent/test/test_l2route.cc
Expand Up @@ -1585,6 +1585,62 @@ TEST_F(RouteTest, StalePathDeleteRouteDelete) {
client->WaitForIdle();
}

class SetupTask : public Task {
public:
SetupTask(RouteTest *test, std::string name) :
Task((TaskScheduler::GetInstance()->
GetTaskId("db::DBTable")), 0), test_(test),
test_name_(name) {
}

virtual bool Run() {
if (test_name_ == "SquashPathTest_1") {
char local_vm_mac_str_[100];
MacAddress local_vm_mac_;
Ip4Address local_vm_ip4_;
char local_vm_ip4_str_[100];
strcpy(local_vm_ip4_str_, "1.1.1.10");
local_vm_ip4_ = Ip4Address::from_string(local_vm_ip4_str_);
strcpy(local_vm_mac_str_, "00:00:01:01:01:10");
local_vm_mac_ = MacAddress::FromString(local_vm_mac_str_);
EvpnRouteEntry *rt = EvpnRouteGet("vrf1",
local_vm_mac_,
local_vm_ip4_,
0);
const VrfEntry *vrf = VrfGet("vrf1");
vrf->GetEvpnRouteTable()->SquashStalePaths(rt, NULL);
}
return true;
}
std::string Description() const { return "SetupTask"; }
private:
RouteTest *test_;
std::string test_name_;
};

//Bug# 1571598
TEST_F(RouteTest, SquashPathTest_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:01:01:01:10", 1, 1},
};

client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();

EvpnRouteEntry *rt = EvpnRouteGet("vrf1", local_vm_mac_, local_vm_ip4_, 0);
EXPECT_TRUE(rt != NULL);
EXPECT_TRUE(rt->GetActivePath() != NULL);
SetupTask * task = new SetupTask(this, "SquashPathTest_1");
TaskScheduler::GetInstance()->Enqueue(task);
client->WaitForIdle();
rt = EvpnRouteGet("vrf1", local_vm_mac_, local_vm_ip4_, 0);
EXPECT_TRUE(rt != NULL);

DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
}

int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
GETUSERARGS();
Expand Down

0 comments on commit 77645e8

Please sign in to comment.