use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid in project lispflowmapping by opendaylight.
the class Stringifier method getString.
public static String getString(MappingRecord mapping, int indentation) {
final String indent = getSpacesAsString(indentation);
StringBuilder mrsb = new StringBuilder(indent);
// Main information, EID prefix and TTL (for now)
mrsb.append(LispAddressStringifier.getString(mapping.getEid()));
mrsb.append(", TTL: ");
mrsb.append(mapping.getRecordTtl().toString());
mrsb.append(NEW_LINE);
// Locator records
// Regular indentation for the mapping record
mrsb.append(indent);
// Extra indentation for locator records
mrsb.append(indent);
if (mapping.getLocatorRecord() == null || mapping.getLocatorRecord().isEmpty()) {
// We only print the action for negative mappings (0 locator records)
mrsb.append("-> Negative entry, action: ");
mrsb.append(mapping.getAction().getName());
} else {
mrsb.append("-> Locator State Pri/Wgt");
mrsb.append(NEW_LINE);
mrsb.append(indent);
boolean first = true;
for (LocatorRecord record : mapping.getLocatorRecord()) {
if (first) {
first = false;
} else {
mrsb.append(NEW_LINE);
mrsb.append(indent);
}
mrsb.append(getString(record, indentation + 3));
}
}
return mrsb.toString();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__EmptyString.
@Test
public void deserialize__EmptyString() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 00"), null);
assertEquals(DistinguishedNameAfi.class, address.getAddressType());
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("", distinguishedName.getDistinguishedName().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__DavidString.
@Test
public void deserialize__DavidString() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 64 61 76 69 64 00"), null);
assertEquals(DistinguishedNameAfi.class, address.getAddressType());
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("david", distinguishedName.getDistinguishedName().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid 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.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid in project lispflowmapping by opendaylight.
the class DistinguishedNameSerializerTest method deserialize__ReadUntilZero.
@Test
public void deserialize__ReadUntilZero() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("00 11 64 61 76 00 69 64"), null);
DistinguishedName distinguishedName = (DistinguishedName) address.getAddress();
assertEquals("dav", distinguishedName.getDistinguishedName().getValue());
}
Aggregations