Search in sources :

Example 26 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 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)

Example 27 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project netvirt by opendaylight.

the class Ipv6ServiceUtils method installIcmpv6RsPuntFlow.

public void installIcmpv6RsPuntFlow(short tableId, Uint64 dpId, Long elanTag, int addOrRemove) {
    if (dpId == null || dpId.equals(Ipv6ServiceConstants.INVALID_DPID)) {
        return;
    }
    String flowId = getIPv6FlowRef(dpId, elanTag, "IPv6RS");
    if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
        LOG.trace("Removing IPv6 Router Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
        LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(Datastore.CONFIGURATION, tx -> {
            mdsalUtil.removeFlow(tx, dpId, flowId, tableId);
        }), LOG, "Error while removing flow={}", flowId);
    } else {
        List<ActionInfo> actionsInfos = new ArrayList<>();
        // Punt to controller
        actionsInfos.add(new ActionPuntToController());
        int rdPuntTimeout = ipv6serviceConfig.getRouterDiscoveryPuntTimeout().toJava();
        if (isRdPuntProtectionEnabled(rdPuntTimeout)) {
            actionsInfos.add(getLearnActionForRsPuntProtection(rdPuntTimeout));
        }
        List<InstructionInfo> instructions = Arrays.asList(new InstructionApplyActions(actionsInfos));
        List<MatchInfo> routerSolicitationMatch = getIcmpv6RSMatch(elanTag);
        FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY, "IPv6RS", 0, 0, NwConstants.COOKIE_IPV6_TABLE, routerSolicitationMatch, instructions);
        LOG.trace("Installing IPv6 Router Solicitation Flow DpId {}, elanTag {}", dpId, elanTag);
        LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.CONFIGURATION, tx -> {
            mdsalUtil.addFlow(tx, rsFlowEntity);
        }), LOG, "Error while adding flow={}", rsFlowEntity);
    }
}
Also used : Arrays(java.util.Arrays) Ipv6Util(org.opendaylight.genius.ipv6util.api.Ipv6Util) InterfacesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState) IVirtualPort(org.opendaylight.netvirt.ipv6service.api.IVirtualPort) LoggerFactory(org.slf4j.LoggerFactory) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) ActionSetIcmpv6Type(org.opendaylight.genius.mdsalutil.actions.ActionSetIcmpv6Type) StringUtils(org.apache.commons.lang3.StringUtils) ActionNdOptionType(org.opendaylight.genius.mdsalutil.actions.ActionNdOptionType) InetAddress(java.net.InetAddress) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) Ipv6Constants(org.opendaylight.genius.ipv6util.api.Ipv6Constants) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ReadTransaction(org.opendaylight.mdsal.binding.api.ReadTransaction) Nullable(org.eclipse.jdt.annotation.Nullable) ActionSetIpv6NdTarget(org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTarget) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) ActionSetIpv6NdTll(org.opendaylight.genius.mdsalutil.actions.ActionSetIpv6NdTll) MatchIpv6NdTarget(org.opendaylight.genius.mdsalutil.matches.MatchIpv6NdTarget) Datastore(org.opendaylight.mdsal.binding.util.Datastore) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) IPProtocols(org.opendaylight.genius.mdsalutil.packet.IPProtocols) BoundServicesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey) ActionNxLoadInPort(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) Interfaces(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) BoundServicesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder) Optional(java.util.Optional) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) ActionNdReserved(org.opendaylight.genius.mdsalutil.actions.ActionNdReserved) ServiceModeIngress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress) Uint64(org.opendaylight.yangtools.yang.common.Uint64) MatchIpv6Source(org.opendaylight.genius.mdsalutil.matches.MatchIpv6Source) ServicesInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) Singleton(javax.inject.Singleton) NxmOfFieldType(org.opendaylight.genius.mdsalutil.NwConstants.NxmOfFieldType) ServiceTypeFlowBased(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceTypeFlowBased) ActionSetFieldEthernetSource(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource) ActionSetSourceIpv6(org.opendaylight.genius.mdsalutil.actions.ActionSetSourceIpv6) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Icmpv6Type(org.opendaylight.genius.ipv6util.api.Icmpv6Type) FlowMod(org.opendaylight.genius.mdsalutil.actions.ActionLearn.FlowMod) MatchIcmpv6(org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) MatchIpProtocol(org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol) Logger(org.slf4j.Logger) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) StypeOpenflowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflowBuilder) MatchNdOptionType(org.opendaylight.genius.mdsalutil.ericmatches.MatchNdOptionType) UnknownHostException(java.net.UnknownHostException) ActionMoveSourceDestinationEth(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationEth) ExecutionException(java.util.concurrent.ExecutionException) Ipv6serviceConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.ipv6service.config.rev181010.Ipv6serviceConfig) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) ActionMoveSourceDestinationIpv6(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationIpv6) VirtualSubnet(org.opendaylight.netvirt.ipv6service.VirtualSubnet) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 28 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project netvirt by opendaylight.

the class Ipv6ServiceUtils method installIcmpv6NaForwardFlow.

public void installIcmpv6NaForwardFlow(short tableId, IVirtualPort vmPort, Uint64 dpId, Long elanTag, int addOrRemove) {
    List<MatchInfo> matches = getIcmpv6NAMatch(elanTag);
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
    instructions.add(new InstructionApplyActions(actionsInfos));
    for (Ipv6Address ipv6Address : vmPort.getIpv6Addresses()) {
        matches.add(new MatchIpv6Source(ipv6Address.getValue() + NwConstants.IPV6PREFIX));
        String flowId = getIPv6FlowRef(dpId, elanTag, vmPort.getIntfUUID().getValue() + Ipv6ServiceConstants.FLOWID_SEPARATOR + ipv6Address.getValue());
        FlowEntity rsFlowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, Ipv6ServiceConstants.DEFAULT_FLOW_PRIORITY, "IPv6NA", 0, 0, NwConstants.COOKIE_IPV6_TABLE, matches, instructions);
        if (addOrRemove == Ipv6ServiceConstants.DEL_FLOW) {
            LOG.trace("Removing IPv6 Neighbor Advertisement Flow DpId {}, elanTag {}, ipv6Address {}", dpId, elanTag, ipv6Address.getValue());
            mdsalUtil.removeFlow(rsFlowEntity);
        } else {
            LOG.trace("Installing IPv6 Neighbor Advertisement Flow DpId {}, elanTag {}, ipv6Address {}", dpId, elanTag, ipv6Address.getValue());
            mdsalUtil.installFlow(rsFlowEntity);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchIpv6Source(org.opendaylight.genius.mdsalutil.matches.MatchIpv6Source) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Example 29 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project netvirt by opendaylight.

the class Ipv6PktHandlerTest method testonPacketReceivedRouterSolicitationWithInvalidPayload.

@Test
public void testonPacketReceivedRouterSolicitationWithInvalidPayload() throws Exception {
    // incorrect checksum in Router Solicitation
    Uint64 mdata = Uint64.valueOf(0x1000000);
    Metadata metadata = new MetadataBuilder().setMetadata(mdata).build();
    MatchBuilder matchbuilder = new MatchBuilder().setMetadata(metadata);
    pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
    "33 33 FF F5 00 00", // Source MAC
    "00 01 02 03 04 05", // IPv6
    "86 DD", // Version 6, traffic class E0, no flowlabel
    "6E 00 00 00", // Payload length
    "00 18", // Next header is ICMPv6
    "3A", // Hop limit
    "FF", // Source IP
    "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
    "FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
    "85", // Code
    "00", // Checksum (invalid, should be 67 3C)
    "69 3E", // ICMPv6 message body
    "00 00 00 00", // Target
    "FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).setMatch(matchbuilder.build()).build());
    // wait on this thread until the async job is completed in the packet handler.
    waitForPacketProcessing();
    verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
    // Request from an unknown port (i.e., unknown MAC Address)
    when(ifMgrInstance.getInterfaceNameFromTag(anyLong())).thenReturn("ddec9dba-d831-4ad7-84b9-00d7f65f052f");
    when(ifMgrInstance.obtainV6Interface(any())).thenReturn(null);
    counter = pktHandler.getPacketProcessedCounter();
    pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
    "33 33 FF F5 00 00", // Source MAC
    "00 01 02 03 04 05", // IPv6
    "86 DD", // Version 6, traffic class E0, no flowlabel
    "6E 00 00 00", // Payload length
    "00 18", // Next header is ICMPv6
    "3A", // Hop limit
    "FF", // Source IP
    "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
    "FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
    "85", // Code
    "00", // Checksum (valid)
    "69 3C", // ICMPv6 message body
    "00 00 00 00", // Target
    "FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).setMatch(matchbuilder.build()).build());
    // wait on this thread until the async job is completed in the packet handler.
    waitForPacketProcessing();
    verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
}
Also used : MetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder) PacketMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.ipv6.nd.util.rev170210.PacketMetadataBuilder) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) Metadata(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder) Uint64(org.opendaylight.yangtools.yang.common.Uint64) PacketReceivedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder) Test(org.junit.Test)

Example 30 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project netvirt by opendaylight.

the class Ipv6PktHandlerTest method testOnPacketReceivedWithInvalidParams.

@Test
public void testOnPacketReceivedWithInvalidParams() throws Exception {
    // invalid ethtype
    pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
    "33 33 FF F5 00 00", // Source MAC
    "00 01 02 03 04 05", // Invalid (fake IPv6)
    "80 00", // Version 6, traffic class E0, no flowlabel
    "6E 00 00 00", // Payload length
    "00 18", // Next header is authentication
    "3A", // Hop limit
    "FF", // Source IP
    "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
    "FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00")).build());
    verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
    // invalid ipv6 header
    pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
    "33 33 FF F5 00 00", // Source MAC
    "00 01 02 03 04 05", // IPv6
    "86 DD", // Version 6, traffic class E0, no flowlabel
    "6E 00 00 00", // Payload length
    "00 18", // Next header is authentication
    "33", // Hop limit
    "FF", // Source IP
    "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
    "FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00")).build());
    verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
    // invalid icmpv6 header
    pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
    "33 33 FF F5 00 00", // Source MAC
    "00 01 02 03 04 05", // IPv6
    "86 DD", // Version 6, traffic class E0, no flowlabel
    "6E 00 00 00", // Payload length
    "00 18", // Next header is ICMPv6
    "3A", // Hop limit
    "FF", // Source IP
    "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
    "FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
    "85", // Code
    "00", // Checksum (valid)
    "67 3C", // ICMPv6 message body
    "00 00 00 00", // Target
    "FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).build());
    verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
}
Also used : TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) PacketReceivedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)71 ArrayList (java.util.ArrayList)44 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)38 ByteBuf (io.netty.buffer.ByteBuf)27 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)24 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)20 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)19 InetAddress (java.net.InetAddress)17 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)17 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)16 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)13 List (java.util.List)12 Inet6Address (java.net.Inet6Address)10 UnknownHostException (java.net.UnknownHostException)10 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)10 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)10 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)8