Search in sources :

Example 1 with ActionSetIpv6NdTarget

use of org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTarget 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);
    }
}
Also used : ActionSetIpv6NdTarget(org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTarget) ActionSetIpv6NdTll(org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTll) ActionSetSourceIpv6(org.opendaylight.genius.mdsalutil.actions.ActionSetSourceIpv6) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionNdReserved(org.opendaylight.genius.mdsalutil.actions.ActionNdReserved) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) ActionMoveSourceDestinationIpv6(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationIpv6) ActionNxLoadInPort(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort) ActionSetFieldEthernetSource(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionMoveSourceDestinationEth(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationEth) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

ArrayList (java.util.ArrayList)1 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)1 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)1 ActionMoveSourceDestinationEth (org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationEth)1 ActionMoveSourceDestinationIpv6 (org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationIpv6)1 ActionNdReserved (org.opendaylight.genius.mdsalutil.actions.ActionNdReserved)1 ActionNxLoadInPort (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort)1 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)1 ActionSetFieldEthernetSource (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource)1 ActionSetIpv6NdTarget (org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTarget)1 ActionSetIpv6NdTll (org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTll)1 ActionSetSourceIpv6 (org.opendaylight.genius.mdsalutil.actions.ActionSetSourceIpv6)1 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1