Search in sources :

Example 11 with LispAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.

the class KeyValueAddressSerializer method serializeData.

@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
    KeyValueAddress kva = (KeyValueAddress) lispAddress.getAddress();
    SimpleAddressSerializer.getInstance().serialize(buffer, kva.getKeyValueAddress().getKey());
    SimpleAddressSerializer.getInstance().serialize(buffer, kva.getKeyValueAddress().getValue());
}
Also used : KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)

Example 12 with LispAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.

the class ServicePathSerializer method serializeData.

@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
    ServicePath sp = (ServicePath) lispAddress.getAddress();
    buffer.put(ByteUtil.partialIntToByteArray(NumberUtil.asInt(sp.getServicePath().getServicePathId().getValue().intValue()), Length.SPI));
    buffer.put((byte) NumberUtil.asShort(sp.getServicePath().getServiceIndex()));
}
Also used : ServicePath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePath)

Example 13 with LispAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.

the class LispSouthboundHandlerTest method mapRequest__VerifyBasicFields.

@Test
public void mapRequest__VerifyBasicFields() throws Exception {
    ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
    handleMapRequestAsByteArray(mapRequestPacket);
    Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
    List<EidItem> eids = captor.getValue().getMapRequest().getEidItem();
    assertEquals(1, eids.size());
    Eid lispAddress = eids.get(0).getEid();
    assertEquals(Ipv4PrefixBinaryAfi.class, lispAddress.getAddressType());
    assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), lispAddress);
    assertEquals(0x3d8d2acd39c8d608L, captor.getValue().getMapRequest().getNonce().longValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) EidItem(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) Test(org.junit.Test)

Example 14 with LispAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.

the class ExplicitLocatorPathSerializer method getLcafLength.

@Override
protected short getLcafLength(LispAddress lispAddress) {
    short totalSize = 0;
    ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
    if (elp.getExplicitLocatorPath() != null) {
        for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
            totalSize += SimpleAddressSerializer.getInstance().getAddressSize(hop.getAddress()) + 2;
        }
    }
    return totalSize;
}
Also used : Hop(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop) ExplicitLocatorPath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath)

Example 15 with LispAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.

the class ExplicitLocatorPathSerializer method serializeData.

@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
    ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
    if (elp.getExplicitLocatorPath() != null) {
        for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
            buffer.put((byte) 0);
            if (hop.getLrsBits() != null) {
                buffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isLookup()), Flags.LOOKUP) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isRlocProbe()), Flags.RLOC_PROBE) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isStrict()), Flags.STRICT)));
            } else {
                buffer.put((byte) 0);
            }
            SimpleAddressSerializer.getInstance().serialize(buffer, hop.getAddress());
        }
    }
}
Also used : Hop(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop) ExplicitLocatorPath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath)

Aggregations

SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)3 ExplicitLocatorPath (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath)2 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)2 Hop (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.explicit.locator.path.explicit.locator.path.Hop)2 Inet4Address (java.net.Inet4Address)1 Inet6Address (java.net.Inet6Address)1 Test (org.junit.Test)1 LispAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress)1 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)1 DistinguishedName (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName)1 InstanceId (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.InstanceId)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix)1 Ipv6 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6)1 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix)1 Mac (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac)1 NoAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress)1 ServicePath (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePath)1 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)1 AfiList (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiList)1 ApplicationData (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationData)1