use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class DhcpManager method setupTableMissForHandlingExternalTunnel.
private void setupTableMissForHandlingExternalTunnel(BigInteger dpId) {
List<MatchInfo> matches = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionGotoTable(NwConstants.EXTERNAL_TUNNEL_TABLE));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL, "DHCPTableMissFlowForExternalTunnel", 0, "DHCP Table Miss Flow For External Tunnel", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
DhcpServiceCounters.install_dhcp_table_miss_flow_for_external_table.inc();
mdsalUtil.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class DhcpManager method setupDhcpAllocationPoolFlow.
private void setupDhcpAllocationPoolFlow(BigInteger dpId) {
List<MatchInfo> matches = DhcpServiceUtils.getDhcpMatch();
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
instructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE, "DhcpAllocationPoolFlow", DhcpMConstants.DEFAULT_DHCP_ALLOCATION_POOL_FLOW_PRIORITY, "Dhcp Allocation Pool Flow", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
LOG.trace("Installing DHCP Allocation Pool Flow DpId {}", dpId);
DhcpServiceCounters.install_dhcp_flow.inc();
mdsalUtil.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class VPNServiceChainHandlerTest method testProgramVpnToScfWithIfacesNotBound.
@Test
public void testProgramVpnToScfWithIfacesNotBound() throws Exception {
// ///////////////////
// Basic stubbing //
// ///////////////////
String ifaceName = "eth0";
stubGetRouteDistinguisher(VPN_NAME, RD);
stubGetVpnInstance(RD, "1.2.3.4", ifaceName);
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(ifaceName));
stubScfIsNotBoundOnIface(SCF_TAG, ifaceName);
// ///////
// SUT //
// ///////
short tableId = 10;
vpnsch.programVpnToScfPipeline(VPN_NAME, tableId, SCF_TAG, LPORT_TAG, NwConstants.ADD_FLOW);
// //////////
// Verify //
// //////////
ArgumentCaptor<FlowEntity> argumentCaptor = ArgumentCaptor.forClass(FlowEntity.class);
verify(ifaceMgr).bindService(eq(ifaceName), eq(ServiceModeIngress.class), anyObject());
verify(mdsalMgr, times(2)).installFlow(argumentCaptor.capture());
List<FlowEntity> installedFlowsCaptured = argumentCaptor.getAllValues();
assert installedFlowsCaptured.size() == 2;
RoutePaths routePath = vrfEntry.getRoutePaths().get(0);
FlowEntity expectedLFibFlowEntity = VpnServiceChainUtils.buildLFibVpnPseudoPortFlow(DPN_ID, routePath.getLabel(), routePath.getNexthopAddress(), LPORT_TAG);
assert new FlowEntityMatcher(expectedLFibFlowEntity).matches(installedFlowsCaptured.get(0));
FlowEntity expectedLPortDispatcher = VpnServiceChainUtils.buildLportFlowDispForVpnToScf(DPN_ID, LPORT_TAG, SCF_TAG, tableId);
assert new FlowEntityMatcher(expectedLPortDispatcher).matches(installedFlowsCaptured.get(1));
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class FlowEntityMatcher method matches.
@Override
public boolean matches(Object actualFlow) {
if (!(actualFlow instanceof FlowEntity)) {
return false;
}
boolean result = true;
FlowEntity flow = (FlowEntity) actualFlow;
// && sameMatch(flow.getMatch(), expectedFlow.getMatch());
return result;
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class IPV6InternetDefaultRouteProgrammer method removeDefaultRoute.
public void removeDefaultRoute(BigInteger dpnId, long bgpVpnId, long routerId) {
FlowEntity flowEntity = buildIPv6FallbacktoExternalVpn(dpnId, bgpVpnId, routerId);
LOG.trace("removeDefaultRoute: flowEntity: {} ", flowEntity);
mdsalManager.removeFlow(flowEntity);
}
Aggregations