diff --git a/src/vnsw/agent/oper/test/test_intf.cc b/src/vnsw/agent/oper/test/test_intf.cc index 5ec44fb86a8..332fc73df4a 100644 --- a/src/vnsw/agent/oper/test/test_intf.cc +++ b/src/vnsw/agent/oper/test/test_intf.cc @@ -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(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(); diff --git a/src/vnsw/agent/oper/vm_interface.cc b/src/vnsw/agent/oper/vm_interface.cc index b5e4381fb0a..ce99b690ab5 100644 --- a/src/vnsw/agent/oper/vm_interface.cc +++ b/src/vnsw/agent/oper/vm_interface.cc @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) {