Search in sources :

Example 1 with AfiList

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.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());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 2 with AfiList

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.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;
}
Also used : AfiList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiList) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 3 with AfiList

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.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();
}
Also used : SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 4 with AfiList

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.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());
}
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) ArrayList(java.util.ArrayList) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) AfiList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList) AfiListBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiListBuilder) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) 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 AfiList

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.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()));
}
Also used : Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) AfiList(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) Test(org.junit.Test)

Aggregations

SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)5 Test (org.junit.Test)3 AfiList (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiList)3 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)2 Rloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc)2 ArrayList (java.util.ArrayList)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)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 AfiListBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiListBuilder)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)1 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)1 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)1 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)1