Search in sources :

Example 1 with ActionSetSourceIpv6

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