Search in sources :

Example 1 with KeyValueAddress

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

the class LispAddressUtil method asKeyValueAddressEid.

public static Eid asKeyValueAddressEid(SimpleAddress key, SimpleAddress value) {
    KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
    kvab.setKey(key);
    kvab.setValue(value);
    KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(kvab.build()).build();
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(KeyValueAddressLcaf.class);
    builder.setVirtualNetworkId(null);
    builder.setAddress((Address) address);
    return builder.build();
}
Also used : EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Preconditions(com.google.common.base.Preconditions) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) KeyValueAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder)

Example 2 with KeyValueAddress

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

the class KeyValueAddressSerializerTest method deserialize__Simple.

@Test
public void deserialize__Simple() throws Exception {
    Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(// 
    "40 03 00 00 " + // 
    "0F 20 00 0C " + // AFI=1, IP=0x11223344
    "00 01 11 22 33 44 " + "00 01 22 33 44 55"), // AFI=1, IP=0x22334455
    null);
    assertEquals(KeyValueAddressLcaf.class, address.getAddressType());
    KeyValueAddress srcDestAddress = (KeyValueAddress) address.getAddress();
    assertEquals("17.34.51.68", String.valueOf(srcDestAddress.getKeyValueAddress().getKey().getValue()));
    assertEquals("34.51.68.85", String.valueOf(srcDestAddress.getKeyValueAddress().getValue().getValue()));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Test(org.junit.Test)

Example 3 with KeyValueAddress

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress 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 4 with KeyValueAddress

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

the class MappingServiceIntegrationTest method registerAndQuery__KeyValueLCAF.

public void registerAndQuery__KeyValueLCAF() throws SocketTimeoutException {
    cleanUP();
    String ipString = "10.20.30.200";
    String macString = "01:02:03:04:05:06";
    SimpleAddress addrToSend1 = new SimpleAddress(new IpAddress(new Ipv4Address(ipString)));
    SimpleAddress addrToSend2 = new SimpleAddress(new MacAddress(macString));
    Eid kv = LispAddressUtil.asKeyValueAddressEid(addrToSend1, addrToSend2);
    MapReply reply = registerAddressAndQuery(kv);
    Eid fromNetwork = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
    assertEquals(KeyValueAddressLcaf.class, fromNetwork.getAddressType());
    KeyValueAddress keyValueFromNetwork = (KeyValueAddress) fromNetwork.getAddress();
    SimpleAddress receivedAddr1 = keyValueFromNetwork.getKeyValueAddress().getKey();
    SimpleAddress receivedAddr2 = keyValueFromNetwork.getKeyValueAddress().getValue();
    assertNotNull(receivedAddr1.getIpAddress().getIpv4Address());
    assertNotNull(receivedAddr2.getMacAddress());
    Ipv4Address receivedIP = receivedAddr1.getIpAddress().getIpv4Address();
    MacAddress receivedMAC = receivedAddr2.getMacAddress();
    assertEquals(ipString, receivedIP.getValue());
    assertEquals(macString, receivedMAC.getValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 5 with KeyValueAddress

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

the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withKeyValueAddress.

/**
 * Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with KeyValueAddress type address.
 */
@Test
public void getTransportAddressFromRlocTest_withKeyValueAddress() {
    final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(PORT)).build();
    assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_KEYVALUE_ADDRESS));
}
Also used : IpAddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder) Test(org.junit.Test)

Aggregations

KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)7 Test (org.junit.Test)3 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)3 Preconditions (com.google.common.base.Preconditions)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)2 KeyValueAddressBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder)2 IpAddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary)2 TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)2 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)2 InetAddress (java.net.InetAddress)1 Iterator (java.util.Iterator)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)1 ApplicationData (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationData)1 DistinguishedName (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedName)1 Ipv4 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4)1 Ipv6 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1