Search in sources :

Example 76 with Src

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project lispflowmapping by opendaylight.

the class LispSouthboundHandlerTest method mapRequest__UsesIpv6EncapsulatedUdpPort.

@Ignore
@Test
public void mapRequest__UsesIpv6EncapsulatedUdpPort() throws Exception {
    // Internet Protocol Version 6, Src: 2610:d0:ffff:192::1
    // (2610:d0:ffff:192::1), Dst: 2610:d0:ffff:192::2
    // (2610:d0:ffff:192::2)
    // encapsulated UDP source port: 4342
    mapRequestPacket = extractWSUdpByteArray("0000   00 0c 29 34 3e 1b 00 0c 29 f6 d6 0d 08 00 45 00 " + "0010   00 b0 00 00 40 00 40 11 ea 7b 0a 00 3a 9c 0a 00 " + "0020   01 26 10 f6 10 f6 00 9c 9b 19 80 00 00 00 60 00 " + "0030   00 00 00 68 11 ff 26 10 00 d0 ff ff 01 92 00 00 " + "0040   00 00 00 00 00 01 26 10 00 d0 ff ff 01 92 00 00 " + "0050   00 00 00 00 00 02 10 f6 10 f6 00 68 94 8b 14 00 " + "0060   00 01 ff f5 bf 5d 7b 75 93 e6 00 02 26 10 00 d0 " + "0070   ff ff 01 92 00 00 00 00 00 00 00 01 00 01 0a 00 " + "0080   3a 9c 00 80 00 02 26 10 00 d0 ff ff 01 92 00 00 " + "0090   00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 " + "00a0   00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " + "00b0   00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c");
    ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
    DatagramPacket replyPacket = handleMapRequestPacket(mapRequestPacket);
    Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(Mockito.any());
    assertEquals(4342, replyPacket.recipient().getPort());
}
Also used : DatagramPacket(io.netty.channel.socket.DatagramPacket) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 77 with Src

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project lispflowmapping by opendaylight.

the class MultiSiteScenario method assertPing.

private void assertPing(final Site srcSite, final int srcHostIndex, final Site dstSite, final int dstHostIndex, boolean expectedPingWorks, final Site... additionalSitesFromMapping) {
    final MapReply mapReplyFromSrcToDst = emitMapRequestMessage(srcSite.getHost(srcHostIndex), dstSite.getHost(dstHostIndex), dstSite.getVNI());
    if (checkActionAndRloc(dstSite, expectedPingWorks, mapReplyFromSrcToDst, additionalSitesFromMapping)) {
        return;
    }
    final MapReply mapReplyFromDstToSrc = emitMapRequestMessage(dstSite.getHost(dstHostIndex), srcSite.getHost(srcHostIndex), srcSite.getVNI());
    if (checkActionAndRloc(srcSite, expectedPingWorks, mapReplyFromDstToSrc)) {
        return;
    }
    final InstanceIdType iidDst = mapReplyFromSrcToDst.getMappingRecordItem().get(0).getMappingRecord().getEid().getVirtualNetworkId();
    final InstanceIdType iidSrc = mapReplyFromDstToSrc.getMappingRecordItem().get(0).getMappingRecord().getEid().getVirtualNetworkId();
    final boolean isIIDEqual = iidDst.equals(iidSrc);
    if (expectedPingWorks != isIIDEqual) {
        fail("IID problem. Dst value " + iidDst.getValue() + ". Src value " + iidSrc.getValue() + ".");
    }
}
Also used : InstanceIdType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)

Example 78 with Src

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project lispflowmapping by opendaylight.

the class MappingSystem method getMappingNbSbIntersection.

private MappingData getMappingNbSbIntersection(Eid src, Eid dst) {
    // lookupPolicy == NB_AND_SB, we return intersection
    // of NB and SB mappings, or NB mapping if intersection is empty.
    MappingData nbMappingData = (MappingData) pmc.getMapping(src, dst);
    if (nbMappingData == null) {
        return nbMappingData;
    }
    // no intersection for Service Path mappings
    if (dst.getAddress() instanceof ServicePath) {
        return updateServicePathMappingRecord(nbMappingData, dst);
    }
    MappingData sbMappingData = getSbMappingWithExpiration(src, dst, null);
    if (sbMappingData == null) {
        return nbMappingData;
    }
    // both NB and SB mappings exist. Compute intersection of the mappings
    return MappingMergeUtil.computeNbSbIntersection(nbMappingData, sbMappingData);
}
Also used : MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) ServicePath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePath)

Example 79 with Src

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testPathKeyObject.

@Test
public void testPathKeyObject() throws Exception {
    final PCEPPathKeyObjectParser parser = new PCEPPathKeyObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
    final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPPathKeyObject.bin"));
    final PathKeyBuilder builder = new PathKeyBuilder();
    builder.setProcessingRule(true);
    builder.setIgnore(false);
    final List<PathKeys> list = Lists.newArrayList();
    list.add(new PathKeysBuilder().setLoose(true).setPathKey(new PathKey(0x1234)).setPceId(new PceId(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 })).build());
    builder.setPathKeys(list);
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer();
    parser.serializeObject(builder.build(), buf);
    assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
    try {
        parser.parseObject(new ObjectHeaderImpl(true, true), null);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
    try {
        parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
}
Also used : PathKeys(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeys) PathKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) PCEPPathKeyObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPathKeyObjectParser) PathKeysBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeysBuilder) PceId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId) PathKeyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeyBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 80 with Src

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testCloseObject.

@Test
public void testCloseObject() throws IOException, PCEPDeserializerException {
    final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(this.tlvRegistry, this.viTlvRegistry);
    final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPCloseObject1.bin"));
    final CCloseBuilder builder = new CCloseBuilder();
    builder.setProcessingRule(false);
    builder.setIgnore(false);
    builder.setReason((short) 5);
    builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.c.close.TlvsBuilder().build());
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer();
    parser.serializeObject(builder.build(), buf);
    assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
    try {
        parser.parseObject(new ObjectHeaderImpl(true, true), null);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
    try {
        parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
}
Also used : ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) PCEPCloseObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPCloseObjectParser) CCloseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.CCloseBuilder) ByteBuf(io.netty.buffer.ByteBuf) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)85 ByteBuf (io.netty.buffer.ByteBuf)51 BigInteger (java.math.BigInteger)32 ArrayList (java.util.ArrayList)29 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)25 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)23 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)20 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)20 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)18 UdpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch)18 TcpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch)17 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)16 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)15 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)15 Ipv6Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match)14 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)13 SctpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch)13 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)12 ArpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch)12 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)12