use of org.opendaylight.netvirt.cloudservicechain.matchers.FlowMatcher in project netvirt by opendaylight.
the class VPNServiceChainHandlerTest method testprogramScfToVpnPipeline.
@Test
public void testprogramScfToVpnPipeline() throws Exception {
// ///////////////////
// Basic stubbing //
// ///////////////////
stubGetRouteDistinguisher(VPN_NAME, RD);
stubGetVpnInstance(RD, "1.2.3.4", "eth0");
VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder("11.12.13.14", 2000L, DC_GW_IP, RouteOrigin.STATIC, null).build();
stubGetVrfEntries(RD, Collections.singletonList(vrfEntry));
stubReadVpnToDpnList(RD, DPN_ID, Collections.singletonList("iface1"));
// ///////
// SUT //
// ///////
vpnsch.programScfToVpnPipeline(VPN_NAME, SCF_TAG, SERV_CHAIN_TAG, DPN_ID.longValue(), LPORT_TAG, /* lastServiceChain */
false, NwConstants.ADD_FLOW);
// //////////
// Verify //
// //////////
// Verifying installed flows
ArgumentCaptor<Flow> argumentCaptor = ArgumentCaptor.forClass(Flow.class);
verify(mdsalMgr, times(1)).installFlow((BigInteger) anyObject(), argumentCaptor.capture());
List<Flow> installedFlowsCaptured = argumentCaptor.getAllValues();
assert installedFlowsCaptured.size() == 1;
Flow expectedLportDispatcherFlowEntity = VpnServiceChainUtils.buildLPortDispFromScfToL3VpnFlow(VPN_ID, DPN_ID, LPORT_TAG, NwConstants.ADD_FLOW);
assert new FlowMatcher(expectedLportDispatcherFlowEntity).matches(installedFlowsCaptured.get(0));
// Verifying VpnToDpn update
String vpnPseudoPortIfaceName = VpnServiceChainUtils.buildVpnPseudoPortIfName(DPN_ID.longValue(), SCF_TAG, SERV_CHAIN_TAG, LPORT_TAG);
verify(vpnFootprintService).updateVpnToDpnMapping(eq(DPN_ID), eq(VPN_NAME), eq(RD), eq(vpnPseudoPortIfaceName), eq(null), eq(Boolean.TRUE));
}
Aggregations