Skip to content

Commit

Permalink
Merge "* Clear delete marked flag if list entry gets reused. If a ins…
Browse files Browse the repository at this point in the history
…tance-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" into R2.21.x
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 4, 2016
2 parents 2f60ab1 + a8badbb commit f3815df
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
35 changes: 35 additions & 0 deletions src/vnsw/agent/oper/test/test_intf.cc
Expand Up @@ -3189,6 +3189,41 @@ TEST_F(IntfTest, MultipleIp3) {
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();
EXPECT_FALSE(VmPortFind(1));
client->Reset();
}

int main(int argc, char **argv) {
GETUSERARGS();

Expand Down
7 changes: 6 additions & 1 deletion src/vnsw/agent/oper/vm_interface.cc
Expand Up @@ -3295,6 +3295,7 @@ void VmInterface::InstanceIpList::Insert(const InstanceIp *rhs) {

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

void VmInterface::InstanceIpList::Remove(InstanceIpSet::iterator &it) {
Expand Down Expand Up @@ -3468,7 +3469,7 @@ void VmInterface::FloatingIpList::Insert(const FloatingIp *rhs) {

void VmInterface::FloatingIpList::Update(const FloatingIp *lhs,
const FloatingIp *rhs) {
// Nothing to do
lhs->set_del_pending(false);
}

void VmInterface::FloatingIpList::Remove(FloatingIpSet::iterator &it) {
Expand Down Expand Up @@ -3565,6 +3566,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 @@ -3726,6 +3728,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 @@ -3877,6 +3880,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 @@ -4039,6 +4043,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 f3815df

Please sign in to comment.