use of org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort in project netvirt by opendaylight.
the class ExternalRoutersListener method buildNaptPfibFlowEntity.
public FlowEntity buildNaptPfibFlowEntity(BigInteger dpId, long segmentId) {
LOG.debug("buildNaptPfibFlowEntity : called for dpId {}, segmentId {}", dpId, segmentId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID));
ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
instructionInfo.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRefTs(dpId, NwConstants.NAPT_PFIB_TABLE, segmentId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
LOG.debug("buildNaptPfibFlowEntity : Returning NaptPFib Flow Entity {}", flowEntity);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort in project netvirt by opendaylight.
the class ExternalRoutersListener method buildNaptPfibFlowEntityWithUpdatedVpnId.
public FlowEntity buildNaptPfibFlowEntityWithUpdatedVpnId(BigInteger dpId, long segmentId, long changedVpnId) {
LOG.debug("buildNaptPfibFlowEntityWithUpdatedVpnId : called for dpId {}, " + "segmentId {}, BGP VPN ID {}", dpId, segmentId, changedVpnId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
instructionInfo.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRefTs(dpId, NwConstants.NAPT_PFIB_TABLE, segmentId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
LOG.debug("buildNaptPfibFlowEntityWithUpdatedVpnId : Returning NaptPFib Flow Entity {}", flowEntity);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort in project netvirt by opendaylight.
the class ConntrackBasedSnatService method installNaptPfibFlow.
protected void installNaptPfibFlow(Routers routers, BigInteger dpnId, long routerId, long extSubnetId, int addOrRemove) {
Long extNetId = NatUtil.getVpnId(getDataBroker(), routers.getNetworkId().getValue());
LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
List<ActionInfo> listActionInfo = new ArrayList<>();
if (addOrRemove == NwConstants.ADD_FLOW) {
if (extSubnetId == NatConstants.INVALID_ID) {
LOG.error("installNaptPfibFlow : external subnet id is invalid.");
return;
}
ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil.getVpnIdMetadata(extSubnetId), LOAD_START, LOAD_END);
listActionInfo.add(actionLoadMeta);
}
ArrayList<InstructionInfo> instructions = new ArrayList<>();
listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
instructions.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId);
flowRef = flowRef + "OUTBOUND";
syncFlow(dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions, addOrRemove);
}
use of org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort in project netvirt by opendaylight.
the class IPv6Handler method installPing6ResponderFlowEntry.
public void installPing6ResponderFlowEntry(BigInteger dpnId, long vpnId, String routerInternalIp, MacAddress routerMac, long label, int addOrRemove) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchIpProtocol.ICMPV6);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
matches.add(new MatchIcmpv6((short) 128, (short) 0));
matches.add(MatchEthernetType.IPV6);
matches.add(new MatchIpv6Destination(routerInternalIp));
List<ActionInfo> actionsInfos = new ArrayList<>();
// Set Eth Src and Eth Dst
actionsInfos.add(new ActionMoveSourceDestinationEth());
actionsInfos.add(new ActionSetFieldEthernetSource(routerMac));
// Move Ipv6 Src to Ipv6 Dst
actionsInfos.add(new ActionMoveSourceDestinationIpv6());
actionsInfos.add(new ActionSetSourceIpv6(new Ipv6Prefix(routerInternalIp)));
// Set the ICMPv6 type to 129 (echo reply)
actionsInfos.add(new ActionSetIcmpv6Type((short) 129));
actionsInfos.add(new ActionNxLoadInPort(BigInteger.ZERO));
actionsInfos.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
int priority = FibConstants.DEFAULT_FIB_FLOW_PRIORITY + FibConstants.DEFAULT_IPV6_PREFIX_LENGTH;
String flowRef = FibUtil.getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, label, priority);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_FIB_TABLE, flowRef, priority, flowRef, 0, 0, NwConstants.COOKIE_VM_FIB_TABLE, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
mdsalManager.syncInstallFlow(flowEntity);
} else {
mdsalManager.syncRemoveFlow(flowEntity);
}
}
use of org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort in project netvirt by opendaylight.
the class BaseVrfEntryHandler method installPingResponderFlowEntry.
public void installPingResponderFlowEntry(BigInteger dpnId, long vpnId, String routerInternalIp, MacAddress routerMac, long label, int addOrRemove) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchIpProtocol.ICMP);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
matches.add(new MatchIcmpv4((short) 8, (short) 0));
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchIpv4Destination(routerInternalIp, "32"));
List<ActionInfo> actionsInfos = new ArrayList<>();
// Set Eth Src and Eth Dst
actionsInfos.add(new ActionMoveSourceDestinationEth());
actionsInfos.add(new ActionSetFieldEthernetSource(routerMac));
// Move Ip Src to Ip Dst
actionsInfos.add(new ActionMoveSourceDestinationIp());
actionsInfos.add(new ActionSetSourceIp(routerInternalIp, "32"));
// Set the ICMP type to 0 (echo reply)
actionsInfos.add(new ActionSetIcmpType((short) 0));
actionsInfos.add(new ActionNxLoadInPort(BigInteger.ZERO));
actionsInfos.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
int priority = FibConstants.DEFAULT_FIB_FLOW_PRIORITY + FibConstants.DEFAULT_PREFIX_LENGTH;
String flowRef = FibUtil.getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, label, priority);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_FIB_TABLE, flowRef, priority, flowRef, 0, 0, NwConstants.COOKIE_VM_FIB_TABLE, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
mdsalManager.syncInstallFlow(flowEntity);
} else {
mdsalManager.syncRemoveFlow(flowEntity);
}
}
Aggregations