use of org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTll in project netvirt by opendaylight.
the class Ipv6ServiceUtils method installIcmpv6NaResponderFlow.
public void installIcmpv6NaResponderFlow(short tableId, Uint64 dpId, Long elanTag, int lportTag, IVirtualPort intf, Ipv6Address ndTargetAddr, String rtrIntMacAddress, int addOrRemove, TypedReadWriteTransaction tx, Boolean isTllOptionSet) throws ExecutionException, InterruptedException {
List<MatchInfo> neighborAdvertisementMatch = getIcmpv6NaResponderMatch(elanTag, lportTag, intf.getMacAddress(), ndTargetAddr, isTllOptionSet);
short priority = isTllOptionSet ? Ipv6ServiceConstants.SLLOPTION_SET_FLOW_PRIORITY : Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY;
if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, Boolean.TRUE.equals(isTllOptionSet) ? getIPv6OvsFlowRef(tableId, dpId, lportTag, ndTargetAddr.getValue(), intf.getMacAddress()) : getIPv6OvsFlowRef(tableId, dpId, lportTag, ndTargetAddr.getValue()), priority, "IPv6NA", 0, 0, NwConstants.COOKIE_IPV6_TABLE, neighborAdvertisementMatch, null);
LOG.debug("installIcmpv6NaResponderFlow: Removing IPv6 Neighbor Advertisement Flow on " + "DpId {} for the NDTraget {}, elanTag {}, lportTag {}", dpId, ndTargetAddr.getValue(), elanTag, lportTag);
// mdsalUtil.removeFlowToTx(rsFlowEntity, tx);
mdsalUtil.removeFlow(tx, rsFlowEntity);
} else {
List<ActionInfo> actionsInfos = new ArrayList<>();
// Move Eth Src to Eth Dst
actionsInfos.add(new ActionMoveSourceDestinationEth());
actionsInfos.add(new ActionSetFieldEthernetSource(new MacAddress(rtrIntMacAddress)));
// Move Ipv6 Src to Ipv6 Dst
actionsInfos.add(new ActionMoveSourceDestinationIpv6());
actionsInfos.add(new ActionSetSourceIpv6(ndTargetAddr.getValue()));
actionsInfos.add(new ActionSetIpv6NdTarget(ndTargetAddr));
if (Boolean.TRUE.equals(isTllOptionSet)) {
actionsInfos.add(new ActionSetIpv6NdTll(new MacAddress(rtrIntMacAddress)));
actionsInfos.add(new ActionNdReserved(Long.parseLong("3758096384")));
} else {
actionsInfos.add(new ActionNdReserved(Long.parseLong("3221225472")));
}
actionsInfos.add(new ActionNxLoadInPort(Uint64.ZERO));
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, Boolean.TRUE.equals(isTllOptionSet) ? getIPv6OvsFlowRef(tableId, dpId, lportTag, ndTargetAddr.getValue(), intf.getMacAddress()) : getIPv6OvsFlowRef(tableId, dpId, lportTag, ndTargetAddr.getValue()), priority, "IPv6NA", 0, 0, NwConstants.COOKIE_IPV6_TABLE, neighborAdvertisementMatch, instructions);
LOG.debug("installIcmpv6NaResponderFlow: Installing IPv6 Neighbor Advertisement Flow on " + "DpId {} for the NDTraget {}, elanTag {}, lportTag {}", dpId, ndTargetAddr.getValue(), elanTag, lportTag);
mdsalUtil.addFlow(tx, rsFlowEntity);
}
}
Aggregations