Preconditions.checkState(registrations == null);
final List<AutoCloseable> regs = new ArrayList<>();
- final SubobjectHandlerRegistry subReg = context.getSubobjectHandlerRegistry();
- subReg.registerSubobjectParser(EROAsNumberSubobjectParser.TYPE, new EROAsNumberSubobjectParser());
- subReg.registerSubobjectSerializer(AsNumberSubobject.class, new EROAsNumberSubobjectParser());
+ final SubobjectHandlerRegistry eroSubReg = context.getEROSubobjectHandlerRegistry();
+ eroSubReg.registerSubobjectParser(EROAsNumberSubobjectParser.TYPE, new EROAsNumberSubobjectParser());
+ eroSubReg.registerSubobjectSerializer(AsNumberSubobject.class, new EROAsNumberSubobjectParser());
final TlvHandlerRegistry tlvReg = context.getTlvHandlerRegistry();
tlvReg.registerTlvParser(NoPathVectorTlvParser.TYPE, new NoPathVectorTlvParser());
tlvReg.registerTlvSerializer(PredundancyGroupIdTlv.class, new PredundancyGroupTlvParser());
final ObjectHandlerRegistry objReg = context.getObjectHandlerRegistry();
- objReg.registerObjectParser(PCEPOpenObjectParser.CLASS, PCEPOpenObjectParser.TYPE, new PCEPOpenObjectParser(subReg, tlvReg));
+ objReg.registerObjectParser(PCEPOpenObjectParser.CLASS, PCEPOpenObjectParser.TYPE, new PCEPOpenObjectParser(tlvReg));
objReg.registerObjectParser(PCEPRequestParameterObjectParser.CLASS, PCEPRequestParameterObjectParser.TYPE,
- new PCEPRequestParameterObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPNoPathObjectParser.CLASS, PCEPNoPathObjectParser.TYPE, new PCEPNoPathObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPEndPointsObjectParser.CLASS, PCEPEndPointsObjectParser.TYPE, new PCEPEndPointsObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPEndPointsObjectParser.CLASS_6, PCEPEndPointsObjectParser.TYPE_6, new PCEPEndPointsObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPBandwidthObjectParser.CLASS, PCEPBandwidthObjectParser.TYPE, new PCEPBandwidthObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPBandwidthObjectParser.E_CLASS, PCEPBandwidthObjectParser.E_TYPE, new PCEPBandwidthObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPMetricObjectParser.CLASS, PCEPMetricObjectParser.TYPE, new PCEPMetricObjectParser(subReg, tlvReg));
+ new PCEPRequestParameterObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPNoPathObjectParser.CLASS, PCEPNoPathObjectParser.TYPE, new PCEPNoPathObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPEndPointsObjectParser.CLASS, PCEPEndPointsObjectParser.TYPE, new PCEPEndPointsObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPEndPointsObjectParser.CLASS_6, PCEPEndPointsObjectParser.TYPE_6, new PCEPEndPointsObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPBandwidthObjectParser.CLASS, PCEPBandwidthObjectParser.TYPE, new PCEPBandwidthObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPBandwidthObjectParser.E_CLASS, PCEPBandwidthObjectParser.E_TYPE, new PCEPBandwidthObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPMetricObjectParser.CLASS, PCEPMetricObjectParser.TYPE, new PCEPMetricObjectParser(tlvReg));
objReg.registerObjectParser(PCEPExplicitRouteObjectParser.CLASS, PCEPExplicitRouteObjectParser.TYPE,
- new PCEPExplicitRouteObjectParser(subReg, tlvReg));
+ new PCEPExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry()));
objReg.registerObjectParser(PCEPReportedRouteObjectParser.CLASS, PCEPReportedRouteObjectParser.TYPE,
- new PCEPReportedRouteObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPLspaObjectParser.CLASS, PCEPLspaObjectParser.TYPE, new PCEPLspaObjectParser(subReg, tlvReg));
+ new PCEPReportedRouteObjectParser(context.getRROSubobjectHandlerRegistry()));
+ objReg.registerObjectParser(PCEPLspaObjectParser.CLASS, PCEPLspaObjectParser.TYPE, new PCEPLspaObjectParser( tlvReg));
objReg.registerObjectParser(PCEPIncludeRouteObjectParser.CLASS, PCEPIncludeRouteObjectParser.TYPE,
- new PCEPIncludeRouteObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPSvecObjectParser.CLASS, PCEPSvecObjectParser.TYPE, new PCEPSvecObjectParser(subReg, tlvReg));
+ new PCEPIncludeRouteObjectParser(context.getEROSubobjectHandlerRegistry()));
+ objReg.registerObjectParser(PCEPSvecObjectParser.CLASS, PCEPSvecObjectParser.TYPE, new PCEPSvecObjectParser(tlvReg));
objReg.registerObjectParser(PCEPNotificationObjectParser.CLASS, PCEPNotificationObjectParser.TYPE,
- new PCEPNotificationObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPErrorObjectParser.CLASS, PCEPErrorObjectParser.TYPE, new PCEPErrorObjectParser(subReg, tlvReg));
+ new PCEPNotificationObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPErrorObjectParser.CLASS, PCEPErrorObjectParser.TYPE, new PCEPErrorObjectParser(tlvReg));
objReg.registerObjectParser(PCEPLoadBalancingObjectParser.CLASS, PCEPLoadBalancingObjectParser.TYPE,
- new PCEPLoadBalancingObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPCloseObjectParser.CLASS, PCEPCloseObjectParser.TYPE, new PCEPCloseObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPPathKeyObjectParser.CLASS, PCEPPathKeyObjectParser.TYPE, new PCEPPathKeyObjectParser(subReg, tlvReg));
+ new PCEPLoadBalancingObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPCloseObjectParser.CLASS, PCEPCloseObjectParser.TYPE, new PCEPCloseObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPPathKeyObjectParser.CLASS, PCEPPathKeyObjectParser.TYPE, new PCEPPathKeyObjectParser(tlvReg));
objReg.registerObjectParser(PCEPObjectiveFunctionObjectParser.CLASS, PCEPObjectiveFunctionObjectParser.TYPE,
- new PCEPObjectiveFunctionObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPClassTypeObjectParser.CLASS, PCEPClassTypeObjectParser.TYPE, new PCEPClassTypeObjectParser(subReg, tlvReg));
+ new PCEPObjectiveFunctionObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPClassTypeObjectParser.CLASS, PCEPClassTypeObjectParser.TYPE, new PCEPClassTypeObjectParser(tlvReg));
objReg.registerObjectParser(PCEPGlobalConstraintsObjectParser.CLASS, PCEPGlobalConstraintsObjectParser.TYPE,
- new PCEPGlobalConstraintsObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPLspObjectParser.CLASS, PCEPLspObjectParser.TYPE, new PCEPLspObjectParser(subReg, tlvReg));
- objReg.registerObjectParser(PCEPSrpObjectParser.CLASS, PCEPSrpObjectParser.TYPE, new PCEPSrpObjectParser(subReg, tlvReg));
+ new PCEPGlobalConstraintsObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPLspObjectParser.CLASS, PCEPLspObjectParser.TYPE, new PCEPLspObjectParser(tlvReg));
+ objReg.registerObjectParser(PCEPSrpObjectParser.CLASS, PCEPSrpObjectParser.TYPE, new PCEPSrpObjectParser(tlvReg));
// objReg.registerObjectParser(PCEPExcludeRouteObjectParser.CLASS, PCEPExcludeRouteObjectParser.TYPE, new
- // PCEPExcludeRouteObjectParser(reg));
+ // PCEPExcludeRouteObjectParser(context.getXROSubobjectHandlerRegistry()));
- objReg.registerObjectSerializer(OpenObject.class, new PCEPOpenObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(RpObject.class, new PCEPRequestParameterObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(NoPathObject.class, new PCEPNoPathObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(EndpointsObject.class, new PCEPEndPointsObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(BandwidthObject.class, new PCEPBandwidthObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(MetricObject.class, new PCEPMetricObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(ExplicitRouteObject.class, new PCEPExplicitRouteObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(ReportedRouteObject.class, new PCEPReportedRouteObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(LspaObject.class, new PCEPLspaObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(IncludeRouteObject.class, new PCEPIncludeRouteObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(SvecObject.class, new PCEPSvecObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(NotificationObject.class, new PCEPNotificationObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(PcepErrorObject.class, new PCEPErrorObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(LoadBalancingObject.class, new PCEPLoadBalancingObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(CloseObject.class, new PCEPCloseObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(PathKeyObject.class, new PCEPPathKeyObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(OfObject.class, new PCEPObjectiveFunctionObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(ClasstypeObject.class, new PCEPClassTypeObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(GcObject.class, new PCEPGlobalConstraintsObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(LspObject.class, new PCEPLspObjectParser(subReg, tlvReg));
- objReg.registerObjectSerializer(SrpObject.class, new PCEPSrpObjectParser(subReg, tlvReg));
+ objReg.registerObjectSerializer(OpenObject.class, new PCEPOpenObjectParser(tlvReg));
+ objReg.registerObjectSerializer(RpObject.class, new PCEPRequestParameterObjectParser(tlvReg));
+ objReg.registerObjectSerializer(NoPathObject.class, new PCEPNoPathObjectParser(tlvReg));
+ objReg.registerObjectSerializer(EndpointsObject.class, new PCEPEndPointsObjectParser(tlvReg));
+ objReg.registerObjectSerializer(BandwidthObject.class, new PCEPBandwidthObjectParser(tlvReg));
+ objReg.registerObjectSerializer(MetricObject.class, new PCEPMetricObjectParser(tlvReg));
+ objReg.registerObjectSerializer(ExplicitRouteObject.class, new PCEPExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry()));
+ objReg.registerObjectSerializer(ReportedRouteObject.class, new PCEPReportedRouteObjectParser(context.getRROSubobjectHandlerRegistry()));
+ objReg.registerObjectSerializer(LspaObject.class, new PCEPLspaObjectParser(tlvReg));
+ objReg.registerObjectSerializer(IncludeRouteObject.class, new PCEPIncludeRouteObjectParser(context.getEROSubobjectHandlerRegistry()));
+ objReg.registerObjectSerializer(SvecObject.class, new PCEPSvecObjectParser(tlvReg));
+ objReg.registerObjectSerializer(NotificationObject.class, new PCEPNotificationObjectParser(tlvReg));
+ objReg.registerObjectSerializer(PcepErrorObject.class, new PCEPErrorObjectParser(tlvReg));
+ objReg.registerObjectSerializer(LoadBalancingObject.class, new PCEPLoadBalancingObjectParser(tlvReg));
+ objReg.registerObjectSerializer(CloseObject.class, new PCEPCloseObjectParser(tlvReg));
+ objReg.registerObjectSerializer(PathKeyObject.class, new PCEPPathKeyObjectParser(tlvReg));
+ objReg.registerObjectSerializer(OfObject.class, new PCEPObjectiveFunctionObjectParser(tlvReg));
+ objReg.registerObjectSerializer(ClasstypeObject.class, new PCEPClassTypeObjectParser(tlvReg));
+ objReg.registerObjectSerializer(GcObject.class, new PCEPGlobalConstraintsObjectParser(tlvReg));
+ objReg.registerObjectSerializer(LspObject.class, new PCEPLspObjectParser(tlvReg));
+ objReg.registerObjectSerializer(SrpObject.class, new PCEPSrpObjectParser(tlvReg));
// reg.registerObjectSerializer(ExcludeRouteObject.class, new PCEPExcludeRouteObjectParser(reg));
final MessageHandlerRegistry msgReg = context.getMessageHandlerRegistry();
private final LabelHandlerRegistry labelReg = new SimpleLabelHandlerRegistry();
private final MessageHandlerRegistry msgReg = new SimpleMessageHandlerRegistry();
private final ObjectHandlerRegistry objReg = new SimpleObjectHandlerRegistry();
- private final SubobjectHandlerRegistry subobjReg = new SimpleSubobjectHandlerFactory();
+ private final SubobjectHandlerRegistry eroSubReg = new SimpleSubobjectHandlerFactory();
+ private final SubobjectHandlerRegistry rroSubReg = new SimpleSubobjectHandlerFactory();
+ private final SubobjectHandlerRegistry xroSubReg = new SimpleSubobjectHandlerFactory();
private final TlvHandlerRegistry tlvReg = new SimpleTlvHandlerRegistry();
private SingletonPCEPProviderContext() {
}
@Override
- public SubobjectHandlerRegistry getSubobjectHandlerRegistry() {
- return subobjReg;
+ public SubobjectHandlerRegistry getEROSubobjectHandlerRegistry() {
+ return eroSubReg;
+ }
+
+ @Override
+ public SubobjectHandlerRegistry getRROSubobjectHandlerRegistry() {
+ return rroSubReg;
+ }
+
+ @Override
+ public SubobjectHandlerRegistry getXROSubobjectHandlerRegistry() {
+ return xroSubReg;
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.BandwidthObject;
/**
* Parser for {@link BandwidthObject}
*/
-public class PCEPBandwidthObjectParser extends AbstractObjectParser<BandwidthBuilder> {
+public class PCEPBandwidthObjectParser extends AbstractObjectWithTlvsParser<BandwidthBuilder> {
public static final int E_CLASS = 5;
private static final int BANDWIDTH_F_LENGTH = 4;
- public PCEPBandwidthObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPBandwidthObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClasstypeObject;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPClassTypeObject PCEPClassTypeObject}
*/
-public class PCEPClassTypeObjectParser extends AbstractObjectParser<ClassTypeBuilder> {
+public class PCEPClassTypeObjectParser extends AbstractObjectWithTlvsParser<ClassTypeBuilder> {
public static final int CLASS = 22;
*/
public static final int SIZE = (RESERVED + CT_F_LENGTH) / 8;
- public PCEPClassTypeObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPClassTypeObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.CloseObject;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPCloseObject PCEPCloseObject}
*/
-public class PCEPCloseObjectParser extends AbstractObjectParser<CCloseBuilder> {
+public class PCEPCloseObjectParser extends AbstractObjectWithTlvsParser<CCloseBuilder> {
public static final int CLASS = 15;
*/
public static final int TLVS_OFFSET = REASON_F_OFFSET + REASON_F_LENGTH;
- public PCEPCloseObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPCloseObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.EndpointsObject;
/**
* Parser for IPv4 {@link EndpointsObject}
*/
-public class PCEPEndPointsObjectParser extends AbstractObjectParser<EndpointsBuilder> {
+public class PCEPEndPointsObjectParser extends AbstractObjectWithTlvsParser<EndpointsBuilder> {
public static final int CLASS = 4;
public static final int SRC6_F_OFFSET = 0;
public static final int DEST6_F_OFFSET = SRC6_F_OFFSET + SRC6_F_LENGTH;
- public PCEPEndPointsObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPEndPointsObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPErrorObject PCEPErrorObject}
*/
-public class PCEPErrorObjectParser extends AbstractObjectParser<ErrorsBuilder> {
+public class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<ErrorsBuilder> {
public static final int CLASS = 13;
public static final int EV_F_OFFSET = ET_F_OFFSET + ET_F_LENGTH;
public static final int TLVS_OFFSET = EV_F_OFFSET + EV_F_LENGTH;
- public PCEPErrorObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPErrorObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithSubobjectsParser;
import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ExplicitRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Subobjects;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.definition.ExplicitRouteBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
/**
* Parser for {@link ExplicitRouteObject}
*/
-public class PCEPExplicitRouteObjectParser extends AbstractObjectParser<ExplicitRouteBuilder> {
+public class PCEPExplicitRouteObjectParser extends AbstractObjectWithSubobjectsParser<ExplicitRouteBuilder> {
public static final int CLASS = 7;
public static final int TYPE = 1;
- public PCEPExplicitRouteObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPExplicitRouteObjectParser(final SubobjectHandlerRegistry subobjReg) {
+ super(subobjReg);
}
@Override
return builder.build();
}
- @Override
- public void addTlv(final ExplicitRouteBuilder builder, final Tlv tlv) {
- // No tlvs defined
- }
-
@Override
public byte[] serializeObject(final Object object) {
if (!(object instanceof ExplicitRouteObject)) {
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.GcObject;
/**
* Parser for {@link GcObject}
*/
-public class PCEPGlobalConstraintsObjectParser extends AbstractObjectParser<GcBuilder> {
+public class PCEPGlobalConstraintsObjectParser extends AbstractObjectWithTlvsParser<GcBuilder> {
public static final int CLASS = 24;
private final static int TLVS_OFFSET = OVER_BOOKING_FACTOR_F_OFFSET + OVER_BOOKING_FACTOR_F_LENGTH;
- public PCEPGlobalConstraintsObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPGlobalConstraintsObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithSubobjectsParser;
import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.IncludeRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.IncludeRouteBuilder;
/**
* Parser for {@link IncludeRouteObject}
*/
-public class PCEPIncludeRouteObjectParser extends AbstractObjectParser<IncludeRouteBuilder> {
+public class PCEPIncludeRouteObjectParser extends AbstractObjectWithSubobjectsParser<IncludeRouteBuilder> {
public static final int CLASS = 10;
public static final int TYPE = 1;
- public PCEPIncludeRouteObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPIncludeRouteObjectParser(final SubobjectHandlerRegistry subobjReg) {
+ super(subobjReg);
}
@Override
return builder.build();
}
- @Override
- public void addTlv(final IncludeRouteBuilder builder, final Tlv tlv) {
- // No tlvs defined
- }
-
@Override
public byte[] serializeObject(final Object object) {
if (!(object instanceof IncludeRouteObject)) {
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPLoadBalancingObject PCEPLoadBalancingObject}
*/
-public class PCEPLoadBalancingObjectParser extends AbstractObjectParser<LoadBalancingBuilder> {
+public class PCEPLoadBalancingObjectParser extends AbstractObjectWithTlvsParser<LoadBalancingBuilder> {
public static final int CLASS = 14;
public static final int SIZE = MIN_BAND_F_OFFSET + MIN_BAND_F_LENGTH;
- public PCEPLoadBalancingObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPLoadBalancingObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspObject;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPLspObject PCEPLspObject}
*/
-public class PCEPLspObjectParser extends AbstractObjectParser<LspBuilder> {
+public class PCEPLspObjectParser extends AbstractObjectWithTlvsParser<LspBuilder> {
public static final int CLASS = 32;
private static final int SYNC_FLAG_OFFSET = 14;
private static final int REMOVE_FLAG_OFFSET = 12;
- public PCEPLspObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPLspObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspaObject;
/**
* Parser for {@link LspaObject}
*/
-public class PCEPLspaObjectParser extends AbstractObjectParser<LspaBuilder> {
+public class PCEPLspaObjectParser extends AbstractObjectWithTlvsParser<LspaBuilder> {
public static final int CLASS = 9;
public static final int FLAGS_F_OFFSET = HOLD_PRIO_F_OFFSET + HOLD_PRIO_F_LENGTH;
public static final int TLVS_F_OFFSET = FLAGS_F_OFFSET + FLAGS_F_LENGTH + 1; // added reserved field of length 1B
- public PCEPLspaObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPLspaObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
/**
* Parser for {@link org.opendaylight.protocol.pcep.object.PCEPMetricObject PCEPMetricObject}
*/
-public class PCEPMetricObjectParser extends AbstractObjectParser<MetricBuilder> {
+public class PCEPMetricObjectParser extends AbstractObjectWithTlvsParser<MetricBuilder> {
public static final int CLASS = 6;
public static final int SIZE = METRIC_VALUE_F_OFFSET + METRIC_VALUE_F_LENGTH;
- public PCEPMetricObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPMetricObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.pcrep.pcrep.message.replies.result.failure.NoPath;
/**
* Parser for {@link NoPathObject}
*/
-public class PCEPNoPathObjectParser extends AbstractObjectParser<NoPathBuilder> {
+public class PCEPNoPathObjectParser extends AbstractObjectWithTlvsParser<NoPathBuilder> {
public static final int CLASS = 3;
public static final int C_FLAG_OFFSET = 0;
- public PCEPNoPathObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPNoPathObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NotificationObject;
/**
* Parser for {@link NotificationObject}
*/
-public class PCEPNotificationObjectParser extends AbstractObjectParser<NotificationsBuilder> {
+public class PCEPNotificationObjectParser extends AbstractObjectWithTlvsParser<NotificationsBuilder> {
public static final int CLASS = 12;
public static final int NV_F_OFFSET = NT_F_OFFSET + NT_F_LENGTH;
public static final int TLVS_OFFSET = NV_F_OFFSET + NV_F_LENGTH;
- public PCEPNotificationObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPNotificationObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
/**
* Parser for {@link OfObject}
*/
-public class PCEPObjectiveFunctionObjectParser extends AbstractObjectParser<OfBuilder> {
+public class PCEPObjectiveFunctionObjectParser extends AbstractObjectWithTlvsParser<OfBuilder> {
public static final int CLASS = 21;
public static final int OF_CODE_F_OFFSET = 0;
public static final int TLVS_OFFSET = OF_CODE_F_OFFSET + OF_CODE_F_LENGTH + 2; // added reserved field of size 2
- public PCEPObjectiveFunctionObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPObjectiveFunctionObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.PCEPErrors;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LspDbVersionTlv;
* Parser for {@link OpenObject}
*/
-public class PCEPOpenObjectParser extends AbstractObjectParser<OpenBuilder> {
+public class PCEPOpenObjectParser extends AbstractObjectWithTlvsParser<OpenBuilder> {
public static final int CLASS = 1;
private static final int PCEP_VERSION = 1;
- public PCEPOpenObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPOpenObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
/**
* Parser for {@link PathKeyObject}
*/
-public class PCEPPathKeyObjectParser extends AbstractObjectParser<PathKeyBuilder> {
+public class PCEPPathKeyObjectParser extends AbstractObjectWithTlvsParser<PathKeyBuilder> {
public static final int CLASS = 16;
public static final int TYPE = 1;
- public PCEPPathKeyObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPPathKeyObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithSubobjectsParser;
import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ReportedRouteObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.ReportedRouteBuilder;
/**
* Parser for {@link ReportedRouteObject}
*/
-public class PCEPReportedRouteObjectParser extends AbstractObjectParser<ReportedRouteBuilder> {
+public class PCEPReportedRouteObjectParser extends AbstractObjectWithSubobjectsParser<ReportedRouteBuilder> {
public static final int CLASS = 8;
public static final int TYPE = 1;
- public PCEPReportedRouteObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPReportedRouteObjectParser(final SubobjectHandlerRegistry subobjReg) {
+ super(subobjReg);
}
@Override
return builder.build();
}
- @Override
- public void addTlv(final ReportedRouteBuilder builder, final Tlv tlv) {
- // No tlvs defined
- }
-
@Override
public byte[] serializeObject(final Object object) {
if (!(object instanceof ReportedRouteObject)) {
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.Util;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
* Parser for {@link RpObject}
*/
-public class PCEPRequestParameterObjectParser extends AbstractObjectParser<RpBuilder> {
+public class PCEPRequestParameterObjectParser extends AbstractObjectWithTlvsParser<RpBuilder> {
public static final int CLASS = 2;
private static int E_FLAG_OFFSET = 20;
- public PCEPRequestParameterObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPRequestParameterObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.requests.SrpBuilder;
-public final class PCEPSrpObjectParser extends AbstractObjectParser<SrpBuilder> {
+public final class PCEPSrpObjectParser extends AbstractObjectWithTlvsParser<SrpBuilder> {
public static final int CLASS = 33;
public static final int TYPE = 1;
- public PCEPSrpObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPSrpObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.spi.AbstractObjectParser;
-import org.opendaylight.protocol.pcep.spi.SubobjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
/**
* Parser for {@link SvecObject}
*/
-public class PCEPSvecObjectParser extends AbstractObjectParser<SvecBuilder> {
+public class PCEPSvecObjectParser extends AbstractObjectWithTlvsParser<SvecBuilder> {
public static final int CLASS = 11;
*/
public static final int MIN_SIZE = FLAGS_F_LENGTH + FLAGS_F_OFFSET;
- public PCEPSvecObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
- super(subobjReg, tlvReg);
+ public PCEPSvecObjectParser(final TlvHandlerRegistry tlvReg) {
+ super(tlvReg);
}
@Override
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.CSubobject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-public abstract class AbstractObjectParser<BUILDER> implements ObjectParser, ObjectSerializer {
+public abstract class AbstractObjectWithSubobjectsParser<BUILDER> implements ObjectParser, ObjectSerializer {
- private static final Logger logger = LoggerFactory.getLogger(AbstractObjectParser.class);
-
- private static final int TLV_TYPE_F_LENGTH = 2;
- private static final int TLV_LENGTH_F_LENGTH = 2;
- private static final int TLV_HEADER_LENGTH = TLV_LENGTH_F_LENGTH + TLV_TYPE_F_LENGTH;
+ private static final Logger logger = LoggerFactory.getLogger(AbstractObjectWithSubobjectsParser.class);
private static final int SUB_TYPE_FLAG_F_LENGTH = 1;
private static final int SUB_LENGTH_F_LENGTH = 1;
protected static final int PADDED_TO = 4;
private final SubobjectHandlerRegistry subobjReg;
- private final TlvHandlerRegistry tlvReg;
- protected AbstractObjectParser(final SubobjectHandlerRegistry subobjReg, final TlvHandlerRegistry tlvReg) {
+ protected AbstractObjectWithSubobjectsParser(final SubobjectHandlerRegistry subobjReg) {
this.subobjReg = Preconditions.checkNotNull(subobjReg);
- this.tlvReg = Preconditions.checkNotNull(tlvReg);
- }
-
- protected final void parseTlvs(final BUILDER builder, final byte[] bytes) throws PCEPDeserializerException {
- if (bytes == null) {
- throw new IllegalArgumentException("Byte array is mandatory.");
- }
-
- int length;
- int byteOffset = 0;
- int type = 0;
-
- while (byteOffset < bytes.length) {
- type = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, TLV_TYPE_F_LENGTH));
- byteOffset += TLV_TYPE_F_LENGTH;
- length = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, TLV_LENGTH_F_LENGTH));
- byteOffset += TLV_LENGTH_F_LENGTH;
-
- if (TLV_HEADER_LENGTH + length > bytes.length - byteOffset) {
- throw new PCEPDeserializerException("Wrong length specified. Passed: " + (TLV_HEADER_LENGTH + length) + "; Expected: <= "
- + (bytes.length - byteOffset) + ".");
- }
-
- final byte[] tlvBytes = ByteArray.subByte(bytes, byteOffset, length);
-
- logger.trace("Attempt to parse tlv from bytes: {}", ByteArray.bytesToHexString(tlvBytes));
- final Tlv tlv = this.tlvReg.getTlvParser(type).parseTlv(tlvBytes);
- logger.trace("Tlv was parsed. {}", tlv);
-
- addTlv(builder, tlv);
-
- byteOffset += length + getPadding(TLV_HEADER_LENGTH + length, PADDED_TO);
- }
- }
-
- protected final byte[] serializeTlv(final Tlv tlv) {
-
- final TlvSerializer serializer = this.tlvReg.getTlvSerializer(tlv);
-
- final byte[] typeBytes = (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - TLV_TYPE_F_LENGTH));
-
- final byte[] valueBytes = serializer.serializeTlv(tlv);
-
- final byte[] lengthBytes = ByteArray.cutBytes(ByteArray.intToBytes(valueBytes.length), (Integer.SIZE / 8) - TLV_LENGTH_F_LENGTH);
-
- final byte[] bytes = new byte[TLV_HEADER_LENGTH + valueBytes.length + getPadding(TLV_HEADER_LENGTH + valueBytes.length, PADDED_TO)];
-
- int byteOffset = 0;
- System.arraycopy(typeBytes, 0, bytes, byteOffset, TLV_TYPE_F_LENGTH);
- System.arraycopy(lengthBytes, 0, bytes, byteOffset += TLV_TYPE_F_LENGTH, TLV_LENGTH_F_LENGTH);
- System.arraycopy(valueBytes, 0, bytes, byteOffset += TLV_LENGTH_F_LENGTH, valueBytes.length);
- return bytes;
}
protected final void parseSubobjects(final BUILDER builder, final byte[] bytes) throws PCEPDeserializerException {
// public abstract void addSubobject(final BUILDER builder, final Map<CSubobject, Boolean> subobjects);
- public abstract void addTlv(final BUILDER builder, final Tlv tlv);
-
- private static int getPadding(final int length, final int padding) {
- return (padding - (length % padding)) % padding;
- }
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.spi;
+
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+
+public abstract class AbstractObjectWithTlvsParser<BUILDER> implements ObjectParser, ObjectSerializer {
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractObjectWithTlvsParser.class);
+
+ private static final int TLV_TYPE_F_LENGTH = 2;
+ private static final int TLV_LENGTH_F_LENGTH = 2;
+ private static final int TLV_HEADER_LENGTH = TLV_LENGTH_F_LENGTH + TLV_TYPE_F_LENGTH;
+
+ protected static final int PADDED_TO = 4;
+
+ private final TlvHandlerRegistry tlvReg;
+
+ protected AbstractObjectWithTlvsParser(final TlvHandlerRegistry tlvReg) {
+ this.tlvReg = Preconditions.checkNotNull(tlvReg);
+ }
+
+ protected final void parseTlvs(final BUILDER builder, final byte[] bytes) throws PCEPDeserializerException {
+ if (bytes == null) {
+ throw new IllegalArgumentException("Byte array is mandatory.");
+ }
+
+ int length;
+ int byteOffset = 0;
+ int type = 0;
+
+ while (byteOffset < bytes.length) {
+ type = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, TLV_TYPE_F_LENGTH));
+ byteOffset += TLV_TYPE_F_LENGTH;
+ length = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, TLV_LENGTH_F_LENGTH));
+ byteOffset += TLV_LENGTH_F_LENGTH;
+
+ if (TLV_HEADER_LENGTH + length > bytes.length - byteOffset) {
+ throw new PCEPDeserializerException("Wrong length specified. Passed: " + (TLV_HEADER_LENGTH + length) + "; Expected: <= "
+ + (bytes.length - byteOffset) + ".");
+ }
+
+ final byte[] tlvBytes = ByteArray.subByte(bytes, byteOffset, length);
+
+ logger.trace("Attempt to parse tlv from bytes: {}", ByteArray.bytesToHexString(tlvBytes));
+ final Tlv tlv = this.tlvReg.getTlvParser(type).parseTlv(tlvBytes);
+ logger.trace("Tlv was parsed. {}", tlv);
+
+ addTlv(builder, tlv);
+
+ byteOffset += length + getPadding(TLV_HEADER_LENGTH + length, PADDED_TO);
+ }
+ }
+
+ protected final byte[] serializeTlv(final Tlv tlv) {
+
+ final TlvSerializer serializer = this.tlvReg.getTlvSerializer(tlv);
+
+ final byte[] typeBytes = (ByteArray.cutBytes(ByteArray.intToBytes(serializer.getType()), (Integer.SIZE / 8) - TLV_TYPE_F_LENGTH));
+
+ final byte[] valueBytes = serializer.serializeTlv(tlv);
+
+ final byte[] lengthBytes = ByteArray.cutBytes(ByteArray.intToBytes(valueBytes.length), (Integer.SIZE / 8) - TLV_LENGTH_F_LENGTH);
+
+ final byte[] bytes = new byte[TLV_HEADER_LENGTH + valueBytes.length + getPadding(TLV_HEADER_LENGTH + valueBytes.length, PADDED_TO)];
+
+ int byteOffset = 0;
+ System.arraycopy(typeBytes, 0, bytes, byteOffset, TLV_TYPE_F_LENGTH);
+ System.arraycopy(lengthBytes, 0, bytes, byteOffset += TLV_TYPE_F_LENGTH, TLV_LENGTH_F_LENGTH);
+ System.arraycopy(valueBytes, 0, bytes, byteOffset += TLV_LENGTH_F_LENGTH, valueBytes.length);
+ return bytes;
+ }
+
+ public abstract void addTlv(final BUILDER builder, final Tlv tlv);
+
+ private static int getPadding(final int length, final int padding) {
+ return (padding - (length % padding)) % padding;
+ }
+}
public LabelHandlerRegistry getHandlerRegistry();
public MessageHandlerRegistry getMessageHandlerRegistry();
public ObjectHandlerRegistry getObjectHandlerRegistry();
- public SubobjectHandlerRegistry getSubobjectHandlerRegistry();
+ public SubobjectHandlerRegistry getEROSubobjectHandlerRegistry();
+ public SubobjectHandlerRegistry getRROSubobjectHandlerRegistry();
+ public SubobjectHandlerRegistry getXROSubobjectHandlerRegistry();
public TlvHandlerRegistry getTlvHandlerRegistry();
}