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();
}
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()));
}
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());
}
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());
}
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));
}
Aggregations