use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project bgpcep by opendaylight.
the class Stateful07PCReportMessageParser method validateLsp.
private static boolean validateLsp(final Object object, final boolean lspViaSR, final List<Message> errors, final ReportsBuilder builder) {
if (object instanceof Lsp) {
final Lsp lsp = (Lsp) object;
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs tlvs = lsp.getTlvs();
if (!lspViaSR && lsp.getPlspId().getValue() != 0 && (tlvs == null || tlvs.getLspIdentifiers() == null)) {
final Message errorMsg = createErrorMsg(PCEPErrors.LSP_IDENTIFIERS_TLV_MISSING, Optional.absent());
errors.add(errorMsg);
return false;
}
builder.setLsp(lsp);
return true;
}
errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.absent()));
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project bgpcep by opendaylight.
the class Stateful07PCReportMessageParser method validatePath.
private static boolean validatePath(final List<Object> objects, final List<Message> errors, final ReportsBuilder builder) {
final PathBuilder pBuilder = new PathBuilder();
Object object = objects.remove(0);
if (object instanceof Ero) {
pBuilder.setEro((Ero) object);
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.absent()));
return false;
}
parsePath(objects, pBuilder);
builder.setPath(pBuilder.build());
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project bgpcep by opendaylight.
the class Stateful07PCUpdateRequestMessageParser method getValidUpdates.
protected Updates getValidUpdates(final List<Object> objects, final List<Message> errors) {
final UpdatesBuilder builder = new UpdatesBuilder();
Object object = objects.remove(0);
if (object instanceof Srp) {
builder.setSrp((Srp) object);
if (objects.isEmpty()) {
object = null;
} else {
object = objects.remove(0);
}
} else {
errors.add(createErrorMsg(PCEPErrors.SRP_MISSING, Optional.absent()));
}
if (validateLsp(object, errors, builder)) {
if (!objects.isEmpty()) {
if (!validatePath(objects, errors, builder)) {
return null;
}
}
return builder.build();
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project bgpcep by opendaylight.
the class Stateful07SrpObjectParser method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof Srp, "Wrong instance of PCEPObject. Passed %s . Needed SrpObject.", object.getClass());
final Srp srp = (Srp) object;
final ByteBuf body = Unpooled.buffer();
serializeFlags(srp, body);
final SrpIdNumber srpId = srp.getOperationId();
Preconditions.checkArgument(srpId != null, "SrpId is mandatory.");
writeUnsignedInt(srpId.getValue(), body);
serializeTlvs(srp.getTlvs(), body);
ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project lispflowmapping by opendaylight.
the class AuthKeyDb method getAuthenticationKey.
/*
* Retrieves authentication key from the database. As opposed to the mapping cache, Source/Dest keys are treated as
* exact match keys here, and a two level longest prefix match is NOT performed.
*/
@Override
public MappingAuthkey getAuthenticationKey(Eid eid) {
ILispDAO table = getVniTable(eid);
if (table == null) {
return null;
}
if (MaskUtil.isMaskable(eid.getAddress()) && !(eid.getAddress() instanceof SourceDestKey)) {
return getAuthKeyLpm(eid, table);
} else {
Eid key = MaskUtil.normalize(eid);
Object password = table.getSpecific(key, SubKeys.AUTH_KEY);
if (password != null && password instanceof MappingAuthkey) {
return (MappingAuthkey) password;
} else {
LOG.warn("Failed to find password!");
return null;
}
}
}
Aggregations