use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__inList.
@Test
public void deserialize__inList() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(//
"40 03 00 00 " + //
"01 00 00 8 " + "00 11 64 61 76 69 64 00"), null);
assertEquals(AfiListLcaf.class, address.getAddressType());
assertEquals("david", ((AfiList) address.getAddress()).getAfiList().getAddressList().get(0).getDistinguishedNameType().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList in project lispflowmapping by opendaylight.
the class AfiListSerializer method getLcafLength.
@Override
protected short getLcafLength(LispAddress lispAddress) {
short totalSize = 0;
AfiList afiList = (((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList) lispAddress.getAddress()).getAfiList());
for (SimpleAddress address : afiList.getAddressList()) {
totalSize += SimpleAddressSerializer.getInstance().getAddressSize(address);
}
return totalSize;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getStringFromAfiList.
protected static String getStringFromAfiList(Destination dst, AfiList addr) {
// AFI 16387, LCAF Type 1; Address List
// Example rendering:
// {192.0.2.1,192.0.2.2,2001:db8::1}
List<SimpleAddress> addresses = addr.getAfiList().getAddressList();
StringBuilder sb = new StringBuilder("{");
boolean needComma = false;
for (SimpleAddress a : addresses) {
if (needComma) {
sb.append(",");
}
sb.append(a.getValue());
needComma = true;
}
sb.append("}");
return sb.toString();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTest method registerAndQuery__ListLCAF.
public void registerAndQuery__ListLCAF() throws SocketTimeoutException {
cleanUP();
String macString = "01:02:03:04:05:06";
String ipString = "10.20.255.30";
List<SimpleAddress> addresses = new ArrayList<SimpleAddress>();
addresses.add(new SimpleAddress(new IpAddress(new Ipv4Address(ipString))));
addresses.add(new SimpleAddress(new MacAddress(macString)));
AfiListBuilder listbuilder = new AfiListBuilder();
listbuilder.setAddressList(addresses);
EidBuilder eb = new EidBuilder();
eb.setAddressType(AfiListLcaf.class);
eb.setVirtualNetworkId(null);
eb.setAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder().setAfiList(listbuilder.build()).build());
MapReply reply = registerAddressAndQuery(eb.build());
Eid receivedAddress = reply.getMappingRecordItem().get(0).getMappingRecord().getEid();
assertEquals(AfiListLcaf.class, receivedAddress.getAddressType());
AfiList listAddrFromNetwork = (AfiList) receivedAddress.getAddress();
SimpleAddress receivedAddr1 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(0);
SimpleAddress receivedAddr2 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(1);
assertNotNull(receivedAddr1.getIpAddress().getIpv4Address());
assertNotNull(receivedAddr2.getMacAddress());
assertEquals(macString, receivedAddr2.getMacAddress().getValue());
assertEquals(ipString, receivedAddr1.getIpAddress().getIpv4Address().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList in project lispflowmapping by opendaylight.
the class AfiListSerializerTest method deserialize__Simple.
@Test
public void deserialize__Simple() throws Exception {
Rloc address = LispAddressSerializer.getInstance().deserializeRloc(hexToByteBuffer(//
"40 03 00 00 " + //
"01 00 00 18 " + // IPv4
"00 01 AA BB CC DD " + // IPv6
"00 02 11 22 33 44 11 22 33 44 11 22 33 44 11 22 33 44"));
assertEquals(AfiListLcaf.class, address.getAddressType());
AfiList afiList = (AfiList) address.getAddress();
List<SimpleAddress> addressList = afiList.getAfiList().getAddressList();
assertEquals(2, addressList.size());
assertEquals("170.187.204.221", String.valueOf(addressList.get(0).getValue()));
assertEquals("1122:3344:1122:3344:1122:3344:1122:3344", String.valueOf(addressList.get(1).getValue()));
}
Aggregations