use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class SNATDefaultRouteProgrammer method installDefNATRouteInDPN.
void installDefNATRouteInDPN(BigInteger dpnId, long vpnId, String subnetId) {
FlowEntity flowEntity = NatUtil.buildDefaultNATFlowEntityForExternalSubnet(dpnId, vpnId, subnetId, idManager);
if (flowEntity == null) {
LOG.error("installDefNATRouteInDPN : Flow entity received is NULL." + "Cannot proceed with installation of Default NAT flow");
return;
}
NatServiceCounters.install_default_nat_flow.inc();
mdsalManager.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class FloatingIPListener method buildSNATDeleteFlowEntity.
private FlowEntity buildSNATDeleteFlowEntity(BigInteger dpId, String externalIp, long routerId) {
LOG.info("buildSNATDeleteFlowEntity : Building Delete SNAT Flow entity for ip {} ", externalIp);
String flowRef = NatUtil.getFlowRef(dpId, NwConstants.SNAT_TABLE, routerId, externalIp);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.SNAT_TABLE, flowRef, NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_DNAT_TABLE, null, null);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class FloatingIPListener method buildPreSNATDeleteFlowEntity.
private FlowEntity buildPreSNATDeleteFlowEntity(BigInteger dpId, String internalIp, long routerId) {
LOG.info("buildPreSNATDeleteFlowEntity : Building Delete PSNAT Flow entity for ip {} ", internalIp);
String flowRef = NatUtil.getFlowRef(dpId, NwConstants.PSNAT_TABLE, routerId, internalIp);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_DNAT_TABLE, null, null);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class FloatingIPListener method createDNATTblEntry.
private void createDNATTblEntry(BigInteger dpnId, InternalToExternalPortMap mapping, long routerId, long associatedVpnId, WriteTransaction writeFlowInvTx) {
FlowEntity preFlowEntity = buildPreDNATFlowEntity(dpnId, mapping, routerId, associatedVpnId);
if (preFlowEntity == null) {
LOG.error("createDNATTblEntry : Flow entity received as NULL. " + "Cannot proceed with installation of Pre-DNAT flow table {} --> table {} on DpnId {}", NwConstants.PDNAT_TABLE, NwConstants.DNAT_TABLE, dpnId);
} else {
mdsalManager.addFlowToTx(preFlowEntity, writeFlowInvTx);
FlowEntity flowEntity = buildDNATFlowEntity(dpnId, mapping, routerId, associatedVpnId);
if (flowEntity != null) {
mdsalManager.addFlowToTx(flowEntity, writeFlowInvTx);
}
}
}
use of org.opendaylight.genius.mdsalutil.FlowEntity in project netvirt by opendaylight.
the class FloatingIPListener method buildDNATFlowEntity.
private FlowEntity buildDNATFlowEntity(BigInteger dpId, InternalToExternalPortMap mapping, long routerId, long associatedVpn) {
String externalIp = mapping.getExternalIp();
LOG.info("buildDNATFlowEntity : Bulding DNAT Flow entity for ip {} ", externalIp);
long segmentId = associatedVpn == NatConstants.INVALID_ID ? routerId : associatedVpn;
LOG.debug("buildDNATFlowEntity : Segment id {} in build DNAT", segmentId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID));
matches.add(MatchEthernetType.IPV4);
String internalIp = mapping.getInternalIp();
matches.add(new MatchIpv4Destination(internalIp, "32"));
List<ActionInfo> actionsInfos = new ArrayList<>();
// actionsInfos.add(new ActionSetDestinationIp(internalIp, "32"));
List<InstructionInfo> instructions = new ArrayList<>();
// instructions.add(new InstructionWriteMetadata(BigInteger.valueOf
// (routerId), MetaDataUtil.METADATA_MASK_VRFID));
actionsInfos.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
// instructions.add(new InstructionGotoTable(NatConstants.L3_FIB_TABLE));
String flowRef = NatUtil.getFlowRef(dpId, NwConstants.DNAT_TABLE, routerId, internalIp);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DNAT_TABLE, flowRef, NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
return flowEntity;
}
Aggregations