diff --git a/src/vnsw/agent/oper/test/test_intf.cc b/src/vnsw/agent/oper/test/test_intf.cc index c1c51e80dae..be50bd50ccb 100644 --- a/src/vnsw/agent/oper/test/test_intf.cc +++ b/src/vnsw/agent/oper/test/test_intf.cc @@ -3213,6 +3213,41 @@ TEST_F(IntfTest, Add_vmi_with_zero_mac_and_update_with_correct_mac) { 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 a11351c0ee5..ee8e0522bc2 100644 --- a/src/vnsw/agent/oper/vm_interface.cc +++ b/src/vnsw/agent/oper/vm_interface.cc @@ -3291,6 +3291,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) { @@ -3462,7 +3463,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) { @@ -3559,6 +3560,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) { @@ -3720,6 +3722,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) { @@ -3871,6 +3874,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) { @@ -4033,6 +4037,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) {