super.serializeTlvs(tlvs, body);
if (tlvs.getAugmentation(Tlvs1.class) != null) {
serializePathSetupType(tlvs.getAugmentation(Tlvs1.class), body);
- } else if(tlvs.getAugmentation(Tlvs2.class) != null) {
+ } else if (tlvs.getAugmentation(Tlvs2.class) != null) {
serializePathSetupType(tlvs.getAugmentation(Tlvs2.class), body);
- } else if(tlvs.getAugmentation(Tlvs3.class) != null) {
+ } else if (tlvs.getAugmentation(Tlvs3.class) != null) {
serializePathSetupType(tlvs.getAugmentation(Tlvs3.class), body);
- } else if(tlvs.getAugmentation(Tlvs4.class) != null) {
+ } else if (tlvs.getAugmentation(Tlvs4.class) != null) {
serializePathSetupType(tlvs.getAugmentation(Tlvs4.class), body);
}
}
@Override
protected void addTlvs(InetSocketAddress address, TlvsBuilder builder) {
super.addTlvs(address, builder);
- if(this.isSegmentRoutingCapable) {
- builder.addAugmentation(Tlvs1.class, new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short)0).build()).build());
+ if (this.isSegmentRoutingCapable) {
+ builder.addAugmentation(Tlvs1.class,
+ new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 0).build())
+ .build());
}
}
/* Objects */
final TlvRegistry tlvReg = context.getTlvHandlerRegistry();
- regs.add(context.registerObjectParser(CInitiated00SrpObjectWithPstTlvParser.CLASS, CInitiated00SrpObjectWithPstTlvParser.TYPE, new CInitiated00SrpObjectWithPstTlvParser(tlvReg)));
- regs.add(context.registerObjectParser(PcepRpObjectWithPstTlvParser.CLASS, PcepRpObjectWithPstTlvParser.TYPE, new PcepRpObjectWithPstTlvParser(tlvReg)));
- regs.add(context.registerObjectParser(PcepOpenObjectWithSpcTlvParser.CLASS, PcepOpenObjectWithSpcTlvParser.TYPE, new PcepOpenObjectWithSpcTlvParser(tlvReg)));
+ regs.add(context.registerObjectParser(CInitiated00SrpObjectWithPstTlvParser.CLASS,
+ CInitiated00SrpObjectWithPstTlvParser.TYPE, new CInitiated00SrpObjectWithPstTlvParser(tlvReg)));
+ regs.add(context.registerObjectParser(PcepRpObjectWithPstTlvParser.CLASS, PcepRpObjectWithPstTlvParser.TYPE,
+ new PcepRpObjectWithPstTlvParser(tlvReg)));
+ regs.add(context.registerObjectParser(PcepOpenObjectWithSpcTlvParser.CLASS,
+ PcepOpenObjectWithSpcTlvParser.TYPE, new PcepOpenObjectWithSpcTlvParser(tlvReg)));
regs.add(context.registerObjectSerializer(Srp.class, new CInitiated00SrpObjectWithPstTlvParser(tlvReg)));
regs.add(context.registerObjectSerializer(Rp.class, new PcepRpObjectWithPstTlvParser(tlvReg)));
/* Messages */
final ObjectRegistry objRegistry = context.getObjectHandlerRegistry();
regs.add(context.registerMessageParser(SrPcRepMessageParser.TYPE, new SrPcRepMessageParser(objRegistry)));
- regs.add(context.registerMessageParser(SrPcInitiateMessageParser.TYPE, new SrPcInitiateMessageParser(objRegistry)));
+ regs.add(context.registerMessageParser(SrPcInitiateMessageParser.TYPE, new SrPcInitiateMessageParser(
+ objRegistry)));
regs.add(context.registerMessageParser(SrPcRptMessageParser.TYPE, new SrPcRptMessageParser(objRegistry)));
regs.add(context.registerMessageParser(SrPcUpdMessageParser.TYPE, new SrPcUpdMessageParser(objRegistry)));
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject;
-public class SrEroUtil {
+public final class SrEroUtil {
private static final int MPLS_LABEL_MIN_VALUE = 16;
+ private SrEroUtil() {
+ }
+
protected static PCEPErrors validateSrEroSubobjects(final Ero ero) {
- if(ero.getSubobject() == null || ero.getSubobject().isEmpty()) {
+ if (ero.getSubobject() == null || ero.getSubobject().isEmpty()) {
return null;
}
- for(final Subobject subobject : ero.getSubobject()) {
- if(!(subobject.getSubobjectType() instanceof SrEroSubobject)) {
+ for (final Subobject subobject : ero.getSubobject()) {
+ if (!(subobject.getSubobjectType() instanceof SrEroSubobject)) {
return PCEPErrors.NON_IDENTICAL_ERO_SUBOBJECTS;
}
- final SrEroSubobject srEroSubobject = (SrEroSubobject) subobject.getSubobjectType();
- if(srEroSubobject.getFlags().isM() && srEroSubobject.getSid() < MPLS_LABEL_MIN_VALUE) {
+ final SrEroSubobject srEroSubobject = (SrEroSubobject) subobject.getSubobjectType();
+ if (srEroSubobject.getFlags().isM() && srEroSubobject.getSid() < MPLS_LABEL_MIN_VALUE) {
return PCEPErrors.BAD_LABEL_VALUE;
}
}
}
protected static boolean isPst(final PathSetupTypeTlv tlv) {
- if(tlv != null && tlv.getPathSetupType() != null) {
- if(tlv.getPathSetupType().isPst()) {
+ if (tlv != null && tlv.getPathSetupType() != null) {
+ if (tlv.getPathSetupType().isPst()) {
return true;
}
}
@Override
protected void serializeRequest(Requests req, ByteBuf buffer) {
- if(isSegmentRoutingPath(req.getSrp())) {
+ if (isSegmentRoutingPath(req.getSrp())) {
serializeObject(req.getSrp(), buffer);
- if(req.getLsp() != null) {
+ if (req.getLsp() != null) {
serializeObject(req.getLsp(), buffer);
}
final Ero srEro = req.getEro();
- if(srEro != null) {
+ if (srEro != null) {
serializeObject(srEro, buffer);
}
} else {
@Override
protected Requests getValidRequest(List<Object> objects) {
final Srp srp = (Srp) objects.get(0);
- if(isSegmentRoutingPath(srp)) {
+ if (isSegmentRoutingPath(srp)) {
final RequestsBuilder builder = new RequestsBuilder();
builder.setSrp(srp);
objects.remove(0);
objects.remove(0);
final Object obj = objects.get(0);
- if(obj != null) {
- if(obj instanceof Ero) {
- builder.setEro((Ero)obj);
+ if (obj != null) {
+ if (obj instanceof Ero) {
+ builder.setEro((Ero) obj);
objects.remove(0);
}
}
}
private boolean isSegmentRoutingPath(final Srp srp) {
- if(srp != null && srp.getTlvs() != null) {
- return SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs5.class)) || SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs7.class));
+ if (srp != null && srp.getTlvs() != null) {
+ return SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs5.class))
+ || SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs7.class));
}
return false;
}
@Override
protected void serializeReply(Replies reply, ByteBuf buffer) {
final Rp rp = reply.getRp();
- if(isSegmentRoutingPath(rp)) {
+ if (isSegmentRoutingPath(rp)) {
serializeObject(rp, buffer);
if (reply.getResult() != null) {
if (reply.getResult() instanceof SuccessCase) {
return null;
}
final Rp rp = (Rp) objects.get(0);
- if(isSegmentRoutingPath(rp)) {
+ if (isSegmentRoutingPath(rp)) {
objects.remove(0);
Result res = null;
if (!objects.isEmpty()) {
final PathsBuilder pBuilder = new PathsBuilder();
while (!objects.isEmpty()) {
final Object object = objects.get(0);
- if(object instanceof Ero) {
+ if (object instanceof Ero) {
final Ero ero = (Ero) object;
final PCEPErrors error = SrEroUtil.validateSrEroSubobjects(ero);
- if(error != null) {
+ if (error != null) {
errors.add(createErrorMsg(error));
return null;
} else {
}
private boolean isSegmentRoutingPath(final Rp rp) {
- if(rp.getTlvs() != null) {
- return SrEroUtil.isPst(rp.getTlvs().getAugmentation(Tlvs1.class)) || SrEroUtil.isPst(rp.getTlvs().getAugmentation(Tlvs2.class));
+ if (rp.getTlvs() != null) {
+ return SrEroUtil.isPst(rp.getTlvs().getAugmentation(Tlvs1.class))
+ || SrEroUtil.isPst(rp.getTlvs().getAugmentation(Tlvs2.class));
}
return false;
}
@Override
protected void serializeReport(Reports report, ByteBuf buffer) {
- if(isSegmentRoutingPath(report.getSrp())) {
+ if (isSegmentRoutingPath(report.getSrp())) {
serializeObject(report.getSrp(), buffer);
serializeObject(report.getLsp(), buffer);
final Ero srEro = report.getPath().getEro();
- if(srEro != null) {
+ if (srEro != null) {
serializeObject(srEro, buffer);
}
} else {
@Override
protected Reports getValidReports(List<Object> objects, List<Message> errors) {
- if(!(objects.get(0) instanceof Srp)) {
+ if (!(objects.get(0) instanceof Srp)) {
errors.add(createErrorMsg(PCEPErrors.SRP_MISSING));
}
final Srp srp = (Srp) objects.get(0);
- if(isSegmentRoutingPath(srp)) {
+ if (isSegmentRoutingPath(srp)) {
boolean isValid = true;
final ReportsBuilder builder = new ReportsBuilder();
builder.setSrp(srp);
}
final Object obj = objects.get(0);
- if(obj instanceof Ero) {
+ if (obj instanceof Ero) {
final Ero ero = (Ero) obj;
final PCEPErrors error = SrEroUtil.validateSrEroSubobjects(ero);
- if(error != null) {
+ if (error != null) {
errors.add(createErrorMsg(error));
isValid = false;
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING));
isValid = false;
}
- if(isValid) {
+ if (isValid) {
return builder.build();
}
return null;
}
private boolean isSegmentRoutingPath(final Srp srp) {
- if(srp != null && srp.getTlvs() != null) {
+ if (srp != null && srp.getTlvs() != null) {
return SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs7.class));
}
return false;
@Override
protected void serializeUpdate(Updates update, ByteBuf buffer) {
- if(isSegmentRoutingPath(update.getSrp())) {
+ if (isSegmentRoutingPath(update.getSrp())) {
serializeObject(update.getSrp(), buffer);
- if(update.getLsp() != null) {
+ if (update.getLsp() != null) {
serializeObject(update.getLsp(), buffer);
}
final Ero srEro = update.getPath().getEro();
- if(srEro != null) {
+ if (srEro != null) {
serializeObject(srEro, buffer);
}
} else {
@Override
protected Updates getValidUpdates(List<Object> objects, List<Message> errors) {
- if(objects.get(0) instanceof Srp && isSegmentRoutingPath((Srp) objects.get(0))) {
+ if (objects.get(0) instanceof Srp && isSegmentRoutingPath((Srp) objects.get(0))) {
boolean isValid = true;
final Srp srp = (Srp) objects.get(0);
final UpdatesBuilder builder = new UpdatesBuilder();
}
final Object obj = objects.get(0);
- if(obj instanceof Ero) {
+ if (obj instanceof Ero) {
final Ero ero = (Ero) obj;
final PCEPErrors error = SrEroUtil.validateSrEroSubobjects(ero);
- if(error != null) {
+ if (error != null) {
errors.add(createErrorMsg(error));
isValid = false;
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING));
isValid = false;
}
- if(isValid) {
+ if (isValid) {
return builder.build();
}
return null;
}
private boolean isSegmentRoutingPath(final Srp srp) {
- if(srp != null && srp.getTlvs() != null) {
- return SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs6.class)) || SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs7.class));
+ if (srp != null && srp.getTlvs() != null) {
+ return SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs6.class))
+ || SrEroUtil.isPst(srp.getTlvs().getAugmentation(Tlvs7.class));
}
return false;
}
createInstance();
final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
assertBeanCount(1, FACTORY_NAME);
- transaction.newMBeanProxy(transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
+ transaction.newMXBeanProxy(transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
final CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
private ObjectName createInstance(final ConfigTransactionJMXClient transaction, final Short deadTimer, final Short keepAlive,
final Boolean stateful, final Boolean active, final Boolean instant, final Boolean srCapable) throws InstanceAlreadyExistsException {
final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
- final Sr02PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+ final Sr02PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
Sr02PCEPSessionProposalFactoryModuleMXBean.class);
mxBean.setActive(active);
mxBean.setDeadTimerValue(deadTimer);