use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializer method getLcafLength.
@Override
protected short getLcafLength(LispAddress lispAddress) {
short totalSize = 0;
ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
if (elp.getExplicitLocatorPath() != null) {
for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
totalSize += SimpleAddressSerializer.getInstance().getAddressSize(hop.getAddress()) + 2;
}
}
return totalSize;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
if (elp.getExplicitLocatorPath() != null) {
for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
buffer.put((byte) 0);
if (hop.getLrsBits() != null) {
buffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isLookup()), Flags.LOOKUP) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isRlocProbe()), Flags.RLOC_PROBE) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isStrict()), Flags.STRICT)));
} else {
buffer.put((byte) 0);
}
SimpleAddressSerializer.getInstance().serialize(buffer, hop.getAddress());
}
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getStringFromExplicitLocatorPath.
protected static String getStringFromExplicitLocatorPath(Destination dst, ExplicitLocatorPath addr) {
// AFI = 16387, LCAF Type 10, Explicit Locator Path
// Example rendering:
// {192.0.2.1->192.0.2.2|lps->192.0.2.3}
List<Hop> hops = addr.getExplicitLocatorPath().getHop();
StringBuilder sb = new StringBuilder();
sb.append("{");
boolean needArrow = false;
for (Hop hop : hops) {
if (needArrow) {
sb.append("->");
}
sb.append(LispSimpleAddressStringifier.getString(dst, hop.getAddress()));
LrsBits lrs = hop.getLrsBits();
if (lrs.isLookup() || lrs.isRlocProbe() || lrs.isStrict()) {
sb.append("|");
}
if (lrs.isLookup()) {
sb.append("l");
}
if (lrs.isRlocProbe()) {
sb.append("p");
}
if (lrs.isStrict()) {
sb.append("s");
}
needArrow = true;
}
sb.append("}");
return sb.toString();
}
Aggregations