Skip to content

Commit

Permalink
* Add service vlan mac routes with vm interface peer
Browse files Browse the repository at this point in the history
If there is a ecmp of transparent service instance
then service vlan mac must be deleted only when last service
instance is deleted, hence use vm interface peer
Closes-bug:#1411669

Change-Id: Id033bde7a385ae894f3098dbcadc246cdbfbe26e
(cherry picked from commit 527ff01)
  • Loading branch information
naveen-n committed Feb 2, 2015
1 parent 28118eb commit b45f702
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/vnsw/agent/oper/vm_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3335,12 +3335,11 @@ void VmInterface::ServiceVlanRouteAdd(const ServiceVlan &entry) {

// With IRB model, add L2 Receive route for SMAC and DMAC to ensure
// packets from service vm go thru routing
Agent *agent = static_cast<InterfaceTable *>(get_table())->agent();
BridgeAgentRouteTable *table = static_cast<BridgeAgentRouteTable *>
(vrf_->GetBridgeRouteTable());
table->AddBridgeReceiveRoute(agent->local_vm_peer(), entry.vrf_->GetName(),
table->AddBridgeReceiveRoute(peer_.get(), entry.vrf_->GetName(),
0, entry.dmac_, vn()->GetName());
table->AddBridgeReceiveRoute(agent->local_vm_peer(), entry.vrf_->GetName(),
table->AddBridgeReceiveRoute(peer_.get(), entry.vrf_->GetName(),
0, entry.smac_, vn()->GetName());
InetUnicastAgentRouteTable::AddVlanNHRoute
(peer_.get(), entry.vrf_->GetName(), entry.addr_, 32,
Expand All @@ -3360,12 +3359,11 @@ void VmInterface::ServiceVlanRouteDel(const ServiceVlan &entry) {
(peer_.get(), entry.vrf_->GetName(), entry.addr_, 32);

// Delete the L2 Recive routes added for smac_ and dmac_
Agent *agent = static_cast<InterfaceTable *>(get_table())->agent();
BridgeAgentRouteTable *table = static_cast<BridgeAgentRouteTable *>
(entry.vrf_->GetBridgeRouteTable());
table->Delete(agent->local_vm_peer(), entry.vrf_->GetName(), entry.dmac_,
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.dmac_,
0);
table->Delete(agent->local_vm_peer(), entry.vrf_->GetName(), entry.smac_,
table->Delete(peer_.get(), entry.vrf_->GetName(), entry.smac_,
0);
entry.installed_ = false;
return;
Expand Down
13 changes: 11 additions & 2 deletions src/vnsw/agent/pkt/test/test_ecmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,9 @@ TEST_F(EcmpTest, ServiceVlanTest_5) {
"virtual-machine-interface", "vnet14");
client->WaitForIdle();

const MacAddress mac("02:00:00:00:00:02");
EXPECT_TRUE(L2RouteFind("service-vrf1",mac));

uint32_t vrf_id = Agent::GetInstance()->vrf_table()->FindVrfFromName("vrf11")->vrf_id();
uint32_t service_vrf_id =
Agent::GetInstance()->vrf_table()->FindVrfFromName("service-vrf1")->vrf_id();
Expand Down Expand Up @@ -1770,12 +1773,18 @@ TEST_F(EcmpTest, ServiceVlanTest_5) {
dport++;
}

DelLink("virtual-machine-interface-routing-instance", "ser1",
"routing-instance", "service-vrf1");
DelLink("virtual-machine-interface-routing-instance", "ser1",
"virtual-machine-interface", "vnet13");
client->WaitForIdle();
EXPECT_TRUE(L2RouteFind("service-vrf1",mac));

DelLink("virtual-machine-interface-routing-instance", "ser1",
"virtual-machine-interface", "vnet14");
client->WaitForIdle();
EXPECT_FALSE(L2RouteFind("service-vrf1",mac));

DelLink("virtual-machine-interface-routing-instance", "ser1",
"routing-instance", "service-vrf1");
DeleteVmportEnv(input2, 2, true);
DelVrf("service-vrf1");
client->WaitForIdle();
Expand Down

0 comments on commit b45f702

Please sign in to comment.