Skip to content

Commit

Permalink
* Clear delete marked flag if list entry gets reused.
Browse files Browse the repository at this point in the history
If a instance-ip is added and deleted in quick succesion
then that instance-ip would be present in the list with
delete marked flag set, and if the same instance-ip was
readded it would never be advertised.
Closes-bug:#1518220

Change-Id: I0f328d49789590ce570b1019a124492d76c44e99
  • Loading branch information
naveen-n committed Jan 4, 2016
1 parent cdebeb0 commit 2b8fe39
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/vnsw/agent/oper/test/test_intf.cc
Expand Up @@ -3519,6 +3519,40 @@ TEST_F(IntfTest, FatFlowDel) {
DelNode("virtual-machine-interface", "vnet1");
client->WaitForIdle();
EXPECT_TRUE(intf->fat_flow_list().list_.size() == 0);
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
EXPECT_FALSE(VmPortFind(1));
client->Reset();
}

TEST_F(IntfTest, IntfAddDel) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:00:00:01", 1, 1},
};

CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortFind(1));

InterfaceRef intf = static_cast<Interface *>(VmPortGet(1));
EXPECT_TRUE(RouteFind("vrf1", "1.1.1.1", 32));

DelLink("virtual-network", "vn1", "virtual-machine-interface",
"vnet1");
client->WaitForIdle();

NovaDel(1);
client->WaitForIdle();

AddLink("virtual-network", "vn1", "virtual-machine-interface",
"vnet1");
client->WaitForIdle();

NovaIntfAdd(1, "vnet1", "1.1.1.1", "00:00:00:00:00:01");
AddNode("virtual-machine-interface", "vnet1", 1);
client->WaitForIdle();

EXPECT_TRUE(RouteFind("vrf1", "1.1.1.1", 32));

DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
Expand Down
6 changes: 6 additions & 0 deletions src/vnsw/agent/oper/vm_interface.cc
Expand Up @@ -3344,6 +3344,7 @@ void VmInterface::InstanceIpList::Update(const InstanceIp *lhs,
if (lhs->ecmp_ != rhs->ecmp_) {
lhs->ecmp_ = rhs->ecmp_;
}
lhs->set_del_pending(false);
}

void VmInterface::InstanceIpList::Remove(InstanceIpSet::iterator &it) {
Expand Down Expand Up @@ -3562,6 +3563,7 @@ void VmInterface::FloatingIpList::Update(const FloatingIp *lhs,
lhs->force_l3_update_ = true;
lhs->force_l2_update_ = true;
}
lhs->set_del_pending(false);
}

void VmInterface::FloatingIpList::Remove(FloatingIpSet::iterator &it) {
Expand Down Expand Up @@ -3670,6 +3672,7 @@ void VmInterface::StaticRouteList::Insert(const StaticRoute *rhs) {

void VmInterface::StaticRouteList::Update(const StaticRoute *lhs,
const StaticRoute *rhs) {
lhs->set_del_pending(false);
}

void VmInterface::StaticRouteList::Remove(StaticRouteSet::iterator &it) {
Expand Down Expand Up @@ -3867,6 +3870,7 @@ void VmInterface::AllowedAddressPairList::Insert(const AllowedAddressPair *rhs)

void VmInterface::AllowedAddressPairList::Update(const AllowedAddressPair *lhs,
const AllowedAddressPair *rhs) {
lhs->set_del_pending(false);
}

void VmInterface::AllowedAddressPairList::Remove(AllowedAddressPairSet::iterator &it) {
Expand Down Expand Up @@ -4051,6 +4055,7 @@ void VmInterface::ServiceVlanList::Insert(const ServiceVlan *rhs) {

void VmInterface::ServiceVlanList::Update(const ServiceVlan *lhs,
const ServiceVlan *rhs) {
lhs->set_del_pending(false);
}

void VmInterface::ServiceVlanList::Remove(ServiceVlanSet::iterator &it) {
Expand Down Expand Up @@ -4226,6 +4231,7 @@ void VmInterface::VrfAssignRuleList::Insert(const VrfAssignRule *rhs) {

void VmInterface::VrfAssignRuleList::Update(const VrfAssignRule *lhs,
const VrfAssignRule *rhs) {
lhs->set_del_pending(false);
}

void VmInterface::VrfAssignRuleList::Remove(VrfAssignRuleSet::iterator &it) {
Expand Down

0 comments on commit 2b8fe39

Please sign in to comment.