BUG 2230: RSVP Activator 96/26196/8
authorClaudio D. Gasparini <cgaspari@cisco.com>
Sun, 30 Aug 2015 12:19:19 +0000 (14:19 +0200)
committerClaudio D. Gasparini <cgaspari@cisco.com>
Mon, 21 Sep 2015 08:42:26 +0000 (10:42 +0200)
-Implementation of RSVP Activarot
-Test RSVP objects parsers/serializers
-Test RSVP ERO, RRO Subobject parsers/serializers Tests

Change-Id: I119ccd342c2871db540a6a59a57e77841857e907
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/RSVPActivator.java [new file with mode: 0644]
rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/EROSubobjectParserTest.java [new file with mode: 0644]
rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/RROSubobjectParserTest.java [new file with mode: 0644]
rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectTest.java [new file with mode: 0644]
rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectUtil.java [new file with mode: 0644]

diff --git a/rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/RSVPActivator.java b/rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/RSVPActivator.java
new file mode 100644 (file)
index 0000000..f0df64e
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) 2015 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.rsvp.parser.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.Label.GeneralizedLabelParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.Label.Type1LabelParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.Label.WavebandSwitchingLabelParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROAsNumberSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROIpv4PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROIpv6PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROLabelSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROPathKey128SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROPathKey32SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROUnnumberedInterfaceSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SERODynamicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv4PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv6PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey128SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey32SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROUnnumberedInterfaceSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROAsNumberSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROIpv4PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROIpv6PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROPathKey128SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROPathKey32SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROSRLGSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROUnnumberedInterfaceSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.AdminStatusObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.AssociationObjectParserIPV4;
+import org.opendaylight.protocol.rsvp.parser.impl.te.AssociationObjectParserIPV6;
+import org.opendaylight.protocol.rsvp.parser.impl.te.AttributesObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.BandwidthObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.DetourObjectIpv4Parser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.DetourObjectIpv6Parser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.DynamicProtectionObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.ExcludeRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.ExplicitRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.FastRerouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.FlowSpecObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.InformationalFastRerouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.MetricObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.PrimaryPathRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.ProtectionObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.RecordRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.ReoptimizationBandwidthObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.RequiredAttributesObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.SecondaryExplicitRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.SecondaryRecordRouteObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.SenderTspecObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.SessionAttributeLspObjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.te.SessionAttributeLspRaObjectParser;
+import org.opendaylight.protocol.rsvp.parser.spi.AbstractRSVPExtensionProviderActivator;
+import org.opendaylight.protocol.rsvp.parser.spi.LabelRegistry;
+import org.opendaylight.protocol.rsvp.parser.spi.RSVPExtensionProviderContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobject.subobject.type.PathKeyCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.admin.status.object.AdminStatusObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.BasicBandwidthObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.ReoptimizationBandwidthObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.LabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.ExcludeRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.object.ExplicitRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.BasicFastRerouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.LegacyFastRerouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.flow.spec.object.FlowSpecObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.required.attributes.object.LspRequiredAttributesObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.primary.path.route.object.PrimaryPathRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.BasicProtectionObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.DynamicControlProtectionObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.object.RecordRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.SecondaryExplicitRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.BasicSessionAttributeObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.SessionAttributeObjectWithResourcesAffinities;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObject;
+
+public class RSVPActivator extends AbstractRSVPExtensionProviderActivator {
+    @Override
+    protected List<AutoCloseable> startImpl(final RSVPExtensionProviderContext context) {
+        final List<AutoCloseable> regs = new ArrayList<>();
+
+        registerLabelParsers(regs, context);
+        final LabelRegistry labelReg = context.getLabelHandlerRegistry();
+        registerRROParsers(regs, context, labelReg);
+        registerXROParsers(regs, context);
+        registerEROParsers(regs, context, labelReg);
+        registerRSVPTEParsers(context);
+
+        return regs;
+    }
+
+    private void registerRSVPTEParsers(final RSVPExtensionProviderContext context) {
+        final DetourObjectIpv4Parser detourIpv4 = new DetourObjectIpv4Parser();
+        context.registerRsvpObjectParser(DetourObjectIpv4Parser.CLASS_NUM, DetourObjectIpv4Parser.CTYPE, detourIpv4);
+        context.registerRsvpObjectSerializer(Ipv4DetourObject.class, detourIpv4);
+
+        final DetourObjectIpv6Parser detourIpv6 = new DetourObjectIpv6Parser();
+        context.registerRsvpObjectParser(DetourObjectIpv6Parser.CLASS_NUM, DetourObjectIpv6Parser.CTYPE, detourIpv6);
+        context.registerRsvpObjectSerializer(Ipv6DetourObject.class, detourIpv6);
+
+        final FastRerouteObjectParser fastC1 = new FastRerouteObjectParser();
+        context.registerRsvpObjectParser(FastRerouteObjectParser.CLASS_NUM, FastRerouteObjectParser.CTYPE, fastC1);
+        context.registerRsvpObjectSerializer(BasicFastRerouteObject.class, fastC1);
+
+        final InformationalFastRerouteObjectParser fastC7 = new InformationalFastRerouteObjectParser();
+        context.registerRsvpObjectParser(InformationalFastRerouteObjectParser.CLASS_NUM, InformationalFastRerouteObjectParser.CTYPE, fastC7);
+        context.registerRsvpObjectSerializer(LegacyFastRerouteObject.class, fastC7);
+
+        final SenderTspecObjectParser tSpec = new SenderTspecObjectParser();
+        context.registerRsvpObjectParser(SenderTspecObjectParser.CLASS_NUM, SenderTspecObjectParser.CTYPE, tSpec);
+        context.registerRsvpObjectSerializer(TspecObject.class, tSpec);
+
+        final FlowSpecObjectParser fSpec = new FlowSpecObjectParser();
+        context.registerRsvpObjectParser(FlowSpecObjectParser.CLASS_NUM, FlowSpecObjectParser.CTYPE, fSpec);
+        context.registerRsvpObjectSerializer(FlowSpecObject.class, fSpec);
+
+        final SessionAttributeLspObjectParser sAttributeC7 = new SessionAttributeLspObjectParser();
+        context.registerRsvpObjectParser(SessionAttributeLspObjectParser.CLASS_NUM, SessionAttributeLspObjectParser.CTYPE, sAttributeC7);
+        context.registerRsvpObjectSerializer(BasicSessionAttributeObject.class, sAttributeC7);
+
+        final SessionAttributeLspRaObjectParser sAttributeC1 = new SessionAttributeLspRaObjectParser();
+        context.registerRsvpObjectParser(SessionAttributeLspRaObjectParser.CLASS_NUM, SessionAttributeLspRaObjectParser.CTYPE, sAttributeC1);
+        context.registerRsvpObjectSerializer(SessionAttributeObjectWithResourcesAffinities.class, sAttributeC1);
+
+        final RecordRouteObjectParser rroParser = new RecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(RecordRouteObjectParser.CLASS_NUM, RecordRouteObjectParser.CTYPE, rroParser);
+        context.registerRsvpObjectSerializer(RecordRouteObject.class, rroParser);
+
+        final ExcludeRouteObjectParser xroParser = new ExcludeRouteObjectParser(context.getXROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(ExcludeRouteObjectParser.CLASS_NUM, ExcludeRouteObjectParser.CTYPE, xroParser);
+        context.registerRsvpObjectSerializer(ExcludeRouteObject.class, xroParser);
+
+        final ExplicitRouteObjectParser eroParser = new ExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(ExplicitRouteObjectParser.CLASS_NUM, ExplicitRouteObjectParser.CTYPE, eroParser);
+        context.registerRsvpObjectSerializer(ExplicitRouteObject.class, eroParser);
+
+        final AssociationObjectParserIPV4 ipv4AsoParser = new AssociationObjectParserIPV4();
+        context.registerRsvpObjectParser(AssociationObjectParserIPV4.CLASS_NUM, AssociationObjectParserIPV4.CTYPE_IPV4, ipv4AsoParser);
+        final AssociationObjectParserIPV6 ipv6AsoParser = new AssociationObjectParserIPV6();
+        context.registerRsvpObjectParser(AssociationObjectParserIPV6.CLASS_NUM, AssociationObjectParserIPV6.CTYPE_IPV6, ipv6AsoParser);
+        context.registerRsvpObjectSerializer(AssociationObject.class, ipv4AsoParser);
+
+        final AdminStatusObjectParser admParser = new AdminStatusObjectParser();
+        context.registerRsvpObjectParser(AdminStatusObjectParser.CLASS_NUM, AdminStatusObjectParser.CTYPE, admParser);
+        context.registerRsvpObjectSerializer(AdminStatusObject.class, admParser);
+
+        final BandwidthObjectParser bandT1Parser = new BandwidthObjectParser();
+        context.registerRsvpObjectParser(BandwidthObjectParser.CLASS_NUM, BandwidthObjectParser.CTYPE, bandT1Parser);
+        context.registerRsvpObjectSerializer(BasicBandwidthObject.class, bandT1Parser);
+
+        final ReoptimizationBandwidthObjectParser bandT2Parser = new ReoptimizationBandwidthObjectParser();
+        context.registerRsvpObjectParser(ReoptimizationBandwidthObjectParser.CLASS_NUM, ReoptimizationBandwidthObjectParser.CTYPE, bandT2Parser);
+        context.registerRsvpObjectSerializer(ReoptimizationBandwidthObject.class, bandT2Parser);
+
+        final MetricObjectParser metricParser = new MetricObjectParser();
+        context.registerRsvpObjectParser(MetricObjectParser.CLASS_NUM, MetricObjectParser.CTYPE, metricParser);
+        context.registerRsvpObjectSerializer(MetricObject.class, metricParser);
+
+        final PrimaryPathRouteObjectParser primatyParser = new PrimaryPathRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(PrimaryPathRouteObjectParser.CLASS_NUM, PrimaryPathRouteObjectParser.CTYPE, primatyParser);
+        context.registerRsvpObjectSerializer(PrimaryPathRouteObject.class, primatyParser);
+
+        final AttributesObjectParser lspAttributeParser = new AttributesObjectParser();
+        context.registerRsvpObjectParser(AttributesObjectParser.CLASS_NUM, AttributesObjectParser.CTYPE, lspAttributeParser);
+        context.registerRsvpObjectSerializer(LspAttributesObject.class, lspAttributeParser);
+
+        final RequiredAttributesObjectParser lspRequiredAttParser = new RequiredAttributesObjectParser();
+        context.registerRsvpObjectParser(RequiredAttributesObjectParser.CLASS_NUM, RequiredAttributesObjectParser.CTYPE,
+            lspRequiredAttParser);
+        context.registerRsvpObjectSerializer(LspRequiredAttributesObject.class, lspRequiredAttParser);
+
+        final ProtectionObjectParser protectionType1Parser = new ProtectionObjectParser();
+        context.registerRsvpObjectParser(ProtectionObjectParser.CLASS_NUM, ProtectionObjectParser.CTYPE, protectionType1Parser);
+        context.registerRsvpObjectSerializer(BasicProtectionObject.class, protectionType1Parser);
+
+        final DynamicProtectionObjectParser protectionType2Parser = new DynamicProtectionObjectParser();
+        context.registerRsvpObjectParser(DynamicProtectionObjectParser.CLASS_NUM, DynamicProtectionObjectParser.CTYPE, protectionType2Parser);
+        context.registerRsvpObjectSerializer(DynamicControlProtectionObject.class, protectionType2Parser);
+
+        final SecondaryExplicitRouteObjectParser serTypeParser = new SecondaryExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(SecondaryExplicitRouteObjectParser.CLASS_NUM, SecondaryExplicitRouteObjectParser.CTYPE, serTypeParser);
+        context.registerRsvpObjectSerializer(SecondaryExplicitRouteObject.class, serTypeParser);
+
+        final SecondaryRecordRouteObjectParser srroTypeParser = new SecondaryRecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+        context.registerRsvpObjectParser(SecondaryRecordRouteObjectParser.CLASS_NUM, SecondaryRecordRouteObjectParser.CTYPE, srroTypeParser);
+        context.registerRsvpObjectSerializer(SecondaryRecordRouteObject.class, srroTypeParser);
+    }
+
+    private void registerLabelParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context) {
+        final Type1LabelParser type1Parser = new Type1LabelParser();
+        regs.add(context.registerLabelParser(Type1LabelParser.CTYPE, type1Parser));
+        regs.add(context.registerLabelSerializer(Type1LabelCase.class, type1Parser));
+
+        final GeneralizedLabelParser generalizedParser = new GeneralizedLabelParser();
+        regs.add(context.registerLabelParser(GeneralizedLabelParser.CTYPE, generalizedParser));
+        regs.add(context.registerLabelSerializer(GeneralizedLabelCase.class, generalizedParser));
+
+        final WavebandSwitchingLabelParser wavebandParser = new WavebandSwitchingLabelParser();
+        regs.add(context.registerLabelParser(WavebandSwitchingLabelParser.CTYPE, wavebandParser));
+        regs.add(context.registerLabelSerializer(WavebandSwitchingLabelCase.class, wavebandParser));
+    }
+
+    private void registerRROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context, final LabelRegistry labelReg) {
+        final RROIpv4PrefixSubobjectParser ipv4prefixParser = new RROIpv4PrefixSubobjectParser();
+        regs.add(context.registerRROSubobjectParser(RROIpv4PrefixSubobjectParser.TYPE, ipv4prefixParser));
+        regs.add(context.registerRROSubobjectSerializer(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCase.class,
+            ipv4prefixParser));
+        regs.add(context.registerRROSubobjectParser(RROIpv6PrefixSubobjectParser.TYPE, new RROIpv6PrefixSubobjectParser()));
+
+        final RROUnnumberedInterfaceSubobjectParser unnumberedParser = new RROUnnumberedInterfaceSubobjectParser();
+        regs.add(context.registerRROSubobjectParser(RROUnnumberedInterfaceSubobjectParser.TYPE, unnumberedParser));
+        regs.add(context.registerRROSubobjectSerializer(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCase.class,
+            unnumberedParser));
+
+        final RROPathKey32SubobjectParser pathKey32Parser = new RROPathKey32SubobjectParser();
+        final RROPathKey128SubobjectParser pathKey128Parser = new RROPathKey128SubobjectParser();
+        regs.add(context.registerRROSubobjectParser(RROPathKey32SubobjectParser.TYPE, pathKey32Parser));
+        regs.add(context.registerRROSubobjectParser(RROPathKey128SubobjectParser.TYPE, pathKey128Parser));
+        regs.add(context.registerRROSubobjectSerializer(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.subobject.subobject.type.PathKeyCase.class,
+            pathKey32Parser));
+
+        final RROLabelSubobjectParser labelParser = new RROLabelSubobjectParser(labelReg);
+        regs.add(context.registerRROSubobjectParser(RROLabelSubobjectParser.TYPE, labelParser));
+        regs.add(context.registerRROSubobjectSerializer(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase.class,
+            labelParser));
+
+        final SRROBasicProtectionSubobjectParser srroBasicParser = new SRROBasicProtectionSubobjectParser();
+        final SRRODynamicProtectionSubobjectParser srroDynamicParser = new SRRODynamicProtectionSubobjectParser();
+        regs.add(context.registerRROSubobjectParser(SRROBasicProtectionSubobjectParser.TYPE, srroBasicParser));
+        regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.BasicProtectionCase.class, srroBasicParser));
+        regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCase.class, srroDynamicParser));
+    }
+
+    private void registerXROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context) {
+        final XROIpv4PrefixSubobjectParser ipv4prefixParser = new XROIpv4PrefixSubobjectParser();
+        regs.add(context.registerXROSubobjectParser(XROIpv4PrefixSubobjectParser.TYPE, ipv4prefixParser));
+        regs.add(context.registerXROSubobjectSerializer(IpPrefixCase.class, ipv4prefixParser));
+        regs.add(context.registerXROSubobjectParser(XROIpv6PrefixSubobjectParser.TYPE, new XROIpv6PrefixSubobjectParser()));
+
+        final XROAsNumberSubobjectParser asNumberParser = new XROAsNumberSubobjectParser();
+        regs.add(context.registerXROSubobjectParser(XROAsNumberSubobjectParser.TYPE, asNumberParser));
+        regs.add(context.registerXROSubobjectSerializer(AsNumberCase.class, asNumberParser));
+
+        final XROSRLGSubobjectParser srlgParser = new XROSRLGSubobjectParser();
+        regs.add(context.registerXROSubobjectParser(XROSRLGSubobjectParser.TYPE, srlgParser));
+        regs.add(context.registerXROSubobjectSerializer(SrlgCase.class, srlgParser));
+
+        final XROUnnumberedInterfaceSubobjectParser unnumberedParser = new XROUnnumberedInterfaceSubobjectParser();
+        regs.add(context.registerXROSubobjectParser(XROUnnumberedInterfaceSubobjectParser.TYPE, unnumberedParser));
+        regs.add(context.registerXROSubobjectSerializer(UnnumberedCase.class, unnumberedParser));
+
+        final XROPathKey32SubobjectParser pathKeyParser = new XROPathKey32SubobjectParser();
+        regs.add(context.registerXROSubobjectParser(XROPathKey32SubobjectParser.TYPE, pathKeyParser));
+        regs.add(context.registerXROSubobjectParser(XROPathKey128SubobjectParser.TYPE, new XROPathKey128SubobjectParser()));
+        regs.add(context.registerXROSubobjectSerializer(PathKeyCase.class, pathKeyParser));
+    }
+
+    private void registerEROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context, final LabelRegistry labelReg) {
+        final EROIpv4PrefixSubobjectParser ipv4prefixParser = new EROIpv4PrefixSubobjectParser();
+        regs.add(context.registerEROSubobjectParser(EROIpv4PrefixSubobjectParser.TYPE, ipv4prefixParser));
+        regs.add(context.registerEROSubobjectSerializer(IpPrefixCase.class, ipv4prefixParser));
+        regs.add(context.registerEROSubobjectParser(EROIpv6PrefixSubobjectParser.TYPE, new EROIpv6PrefixSubobjectParser()));
+
+        final EROAsNumberSubobjectParser asNumberParser = new EROAsNumberSubobjectParser();
+        regs.add(context.registerEROSubobjectParser(EROAsNumberSubobjectParser.TYPE, asNumberParser));
+        regs.add(context.registerEROSubobjectSerializer(AsNumberCase.class, asNumberParser));
+
+        final EROUnnumberedInterfaceSubobjectParser unnumberedParser = new EROUnnumberedInterfaceSubobjectParser();
+        regs.add(context.registerEROSubobjectParser(EROUnnumberedInterfaceSubobjectParser.TYPE, unnumberedParser));
+        regs.add(context.registerEROSubobjectSerializer(UnnumberedCase.class, unnumberedParser));
+
+        final EROPathKey32SubobjectParser pathKeyParser = new EROPathKey32SubobjectParser();
+        regs.add(context.registerEROSubobjectParser(EROPathKey32SubobjectParser.TYPE, pathKeyParser));
+        regs.add(context.registerEROSubobjectParser(EROPathKey128SubobjectParser.TYPE, new EROPathKey128SubobjectParser()));
+        regs.add(context.registerEROSubobjectSerializer(PathKeyCase.class, pathKeyParser));
+
+        final EROLabelSubobjectParser labelParser = new EROLabelSubobjectParser(labelReg);
+        regs.add(context.registerEROSubobjectParser(EROLabelSubobjectParser.TYPE, labelParser));
+        regs.add(context.registerEROSubobjectSerializer(LabelCase.class, labelParser));
+
+        final SERODynamicProtectionSubobjectParser seroDynamicParser = new SERODynamicProtectionSubobjectParser();
+        final SEROBasicProtectionSubobjectParser seroBasicParser = new SEROBasicProtectionSubobjectParser();
+        regs.add(context.registerEROSubobjectParser(SERODynamicProtectionSubobjectParser.TYPE, seroBasicParser));
+        regs.add(context.registerEROSubobjectSerializer(DynamicControlProtectionCase.class, seroDynamicParser));
+        regs.add(context.registerEROSubobjectSerializer(BasicProtectionCase.class, seroBasicParser));
+    }
+}
diff --git a/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/EROSubobjectParserTest.java b/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/EROSubobjectParserTest.java
new file mode 100644 (file)
index 0000000..e9e93ba
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2015 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.rsvp.parser.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import com.google.common.collect.Lists;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROAsNumberSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROExplicitExclusionRouteSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROIpv4PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROIpv6PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROLabelSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROPathKey128SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROPathKey32SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROUnnumberedInterfaceSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
+import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.protocol.util.Ipv6Util;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobject.subobject.type.PathKeyCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobject.subobject.type.path.key._case.PathKeyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.LabelCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.as.number._case.AsNumberBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.LabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.ExrsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.ExrsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder;
+
+public class EROSubobjectParserTest {
+    private static final byte[] ip4PrefixBytes = {(byte) 0x81, (byte) 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0x16, (byte) 0x00};
+    private static final byte[] ip6PrefixBytes = {(byte) 0x02, (byte) 0x14, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x00};
+    private static final byte[] asNumberBytes = {(byte) 0xa0, (byte) 0x04, (byte) 0x00, (byte) 0x64};
+    private static final byte[] unnumberedBytes = {(byte) 0x84, (byte) 0x0c, (byte) 0x00, (byte) 0x00, (byte) 0x12, (byte) 0x34,
+        (byte) 0x50, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+    private static final byte[] pathKey32Bytes = {(byte) 0xc0, (byte) 0x08, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
+        (byte) 0x50, (byte) 0x00};
+    private static final byte[] pathKey128Bytes = {(byte) 0xc1, (byte) 0x14, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
+        (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
+    private static final byte[] labelBytes = {(byte) 0x83, (byte) 0x08, (byte) 0x80, (byte) 0x02, (byte) 0x12, (byte) 0x00, (byte) 0x25,
+        (byte) 0xFF};
+    private static final byte[] exrsBytes = {(byte) 0xa1, (byte) 0x06, (byte) 0xa0, (byte) 0x04, (byte) 0x00, (byte) 0x64};
+
+    private SimpleRSVPExtensionProviderContext ctx;
+    private RSVPActivator act;
+
+    @Before
+    public void setUp() {
+        this.ctx = new SimpleRSVPExtensionProviderContext();
+        this.act = new RSVPActivator();
+        this.act.start(this.ctx);
+    }
+
+    @Test
+    public void testEROIp4PrefixSubobject() throws RSVPParsingException {
+        final EROIpv4PrefixSubobjectParser parser = new EROIpv4PrefixSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(
+            new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/22"))).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(ip4PrefixBytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(ip4PrefixBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROIp6PrefixSubobject() throws RSVPParsingException {
+        final EROIpv6PrefixSubobjectParser parser = new EROIpv6PrefixSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(
+            new IpPrefixBuilder().setIpPrefix(
+                new IpPrefix(Ipv6Util.prefixForBytes(new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}, 22))).build()).build());
+        subs.setLoose(false);
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(ip6PrefixBytes, 2)), false));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(ip6PrefixBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROAsNumberSubobject() throws RSVPParsingException {
+        final EROAsNumberSubobjectParser parser = new EROAsNumberSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        subs.setSubobjectType(new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x64L)).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(asNumberBytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(asNumberBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROUnnumberedSubobject() throws RSVPParsingException {
+        final EROUnnumberedInterfaceSubobjectParser parser = new EROUnnumberedInterfaceSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        subs.setSubobjectType(new UnnumberedCaseBuilder().setUnnumbered(
+            new UnnumberedBuilder().setRouterId(0x12345000L).setInterfaceId(0xffffffffL).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(unnumberedBytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(unnumberedBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROPathKey32Subobject() throws RSVPParsingException {
+        final EROPathKey32SubobjectParser parser = new EROPathKey32SubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        final PathKeyBuilder pBuilder = new PathKeyBuilder();
+        pBuilder.setPceId(new PceId(new byte[]{(byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00}));
+        pBuilder.setPathKey(new PathKey(4660));
+        subs.setSubobjectType(new PathKeyCaseBuilder().setPathKey(pBuilder.build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(pathKey32Bytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(pathKey32Bytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROPathKey128Subobject() throws RSVPParsingException {
+        final EROPathKey128SubobjectParser parser128 = new EROPathKey128SubobjectParser();
+        final EROPathKey32SubobjectParser parser = new EROPathKey32SubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        final PathKeyBuilder pBuilder = new PathKeyBuilder();
+        pBuilder.setPceId(new PceId(new byte[]{(byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
+            (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));
+        pBuilder.setPathKey(new PathKey(4660));
+        subs.setSubobjectType(new PathKeyCaseBuilder().setPathKey(pBuilder.build()).build());
+        assertEquals(subs.build(), parser128.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(pathKey128Bytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(pathKey128Bytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser128.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser128.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROLabelSubobject() throws Exception {
+        final EROLabelSubobjectParser parser = new EROLabelSubobjectParser(this.ctx.getLabelHandlerRegistry());
+
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        subs.setSubobjectType(new LabelCaseBuilder().setLabel(
+            new LabelBuilder().setUniDirectional(true).setLabelType(
+                new GeneralizedLabelCaseBuilder().setGeneralizedLabel(
+                    new GeneralizedLabelBuilder().setGeneralizedLabel(
+                        new byte[]{(byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF}).build()).build()).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(labelBytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(labelBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEROEXRSSubobject() throws Exception {
+        final EROExplicitExclusionRouteSubobjectParser parser = new EROExplicitExclusionRouteSubobjectParser(this.ctx.getXROSubobjectHandlerRegistry());
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setLoose(true);
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.Exrs>
+            list = Lists.newArrayList();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.
+            ExrsBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.ExrsBuilder();
+        builder.setMandatory(true);
+        builder.setSubobjectType(new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x64L)).build()).build());
+        list.add(builder.build());
+        subs.setSubobjectType(new ExrsCaseBuilder().setExrs(new ExrsBuilder().setExrs(list).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(exrsBytes, 2)), true));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(exrsBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+}
diff --git a/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/RROSubobjectParserTest.java b/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/RROSubobjectParserTest.java
new file mode 100644 (file)
index 0000000..ae22c95
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 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.rsvp.parser.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv4PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv6PrefixSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey128SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey32SubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROUnnumberedInterfaceSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
+import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.protocol.util.Ipv6Util;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.subobject.subobject.type.PathKeyCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.subobject.subobject.type.path.key._case.PathKeyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.LabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder;
+
+public class RROSubobjectParserTest {
+
+    private static final byte[] ip4PrefixBytes = {(byte) 0x01, (byte) 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0x16, (byte) 0x01};
+    private static final byte[] ip6PrefixBytes = {(byte) 0x02, (byte) 0x14, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0x16, (byte) 0x02};
+    private static final byte[] unnumberedBytes = {(byte) 0x04, (byte) 0x0c, (byte) 0x02, (byte) 0x00, (byte) 0x12, (byte) 0x34,
+        (byte) 0x50, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+    private static final byte[] pathKey32Bytes = {(byte) 0x40, (byte) 0x08, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
+        (byte) 0x50, (byte) 0x00};
+    private static final byte[] pathKey128Bytes = {(byte) 0x41, (byte) 0x14, (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34,
+        (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
+    private static final byte[] labelBytes = {0x03, 0x08, (byte) 0x80, 0x02, 0x12, 0x00, 0x25, (byte) 0xFF};
+
+    @Test
+    public void testRROIp4PrefixSubobject() throws RSVPParsingException {
+        final RROIpv4PrefixSubobjectParser parser = new RROIpv4PrefixSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setProtectionAvailable(true);
+        subs.setProtectionInUse(false);
+        subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(
+            new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/22"))).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(ip4PrefixBytes, 2))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(ip4PrefixBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRROIp6PrefixSubobject() throws RSVPParsingException {
+        final RROIpv6PrefixSubobjectParser parser = new RROIpv6PrefixSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setProtectionAvailable(false);
+        subs.setProtectionInUse(true);
+        subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(
+            new IpPrefixBuilder().setIpPrefix(
+                new IpPrefix(Ipv6Util.prefixForBytes(new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+                    (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}, 22))).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(ip6PrefixBytes, 2))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(ip6PrefixBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRROUnnumberedSubobject() throws RSVPParsingException {
+        final RROUnnumberedInterfaceSubobjectParser parser = new RROUnnumberedInterfaceSubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        subs.setProtectionAvailable(false);
+        subs.setProtectionInUse(true);
+        subs.setSubobjectType(new UnnumberedCaseBuilder().setUnnumbered(
+            new UnnumberedBuilder().setRouterId(0x12345000L).setInterfaceId(0xffffffffL).build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(unnumberedBytes, 2))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(unnumberedBytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRROPathKey32Subobject() throws RSVPParsingException {
+        final RROPathKey32SubobjectParser parser = new RROPathKey32SubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        final PathKeyBuilder pBuilder = new PathKeyBuilder();
+        pBuilder.setPceId(new PceId(new byte[]{(byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00}));
+        pBuilder.setPathKey(new PathKey(4660));
+        subs.setSubobjectType(new PathKeyCaseBuilder().setPathKey(pBuilder.build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(pathKey32Bytes, 2))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(pathKey32Bytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRROPathKey128Subobject() throws RSVPParsingException {
+        final RROPathKey128SubobjectParser parser = new RROPathKey128SubobjectParser();
+        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+        final PathKeyBuilder pBuilder = new PathKeyBuilder();
+        pBuilder.setPceId(new PceId(new byte[]{(byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
+            (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));
+        pBuilder.setPathKey(new PathKey(4660));
+        subs.setSubobjectType(new PathKeyCaseBuilder().setPathKey(pBuilder.build()).build());
+        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(pathKey128Bytes, 2))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeSubobject(subs.build(), buff);
+        Assert.assertArrayEquals(pathKey128Bytes, ByteArray.getAllBytes(buff));
+
+        try {
+            parser.parseSubobject(null);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+            Assert.fail();
+        } catch (final IllegalArgumentException e) {
+            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRROLabelSubobject() throws Exception {
+        final SimpleRSVPExtensionProviderContext ctx = new SimpleRSVPExtensionProviderContext();
+        try (RSVPActivator a = new RSVPActivator()) {
+            a.start(ctx);
+            final RROLabelSubobjectParser parser = new RROLabelSubobjectParser(ctx.getLabelHandlerRegistry());
+            final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
+            subs.setSubobjectType(new LabelCaseBuilder().setLabel(
+                new LabelBuilder().setUniDirectional(true).setGlobal(false).setLabelType(
+                    new GeneralizedLabelCaseBuilder().setGeneralizedLabel(
+                        new GeneralizedLabelBuilder().setGeneralizedLabel(
+                            new byte[]{(byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF}).build()).build()).build()).build());
+            assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(labelBytes, 2))));
+            final ByteBuf buff = Unpooled.buffer();
+            parser.serializeSubobject(subs.build(), buff);
+            Assert.assertArrayEquals(labelBytes, ByteArray.getAllBytes(buff));
+
+            try {
+                parser.parseSubobject(null);
+                Assert.fail();
+            } catch (final IllegalArgumentException e) {
+                Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+            }
+            try {
+                parser.parseSubobject(Unpooled.EMPTY_BUFFER);
+                Assert.fail();
+            } catch (final IllegalArgumentException e) {
+                Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+            }
+        }
+    }
+}
diff --git a/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectTest.java b/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectTest.java
new file mode 100644 (file)
index 0000000..d34da75
--- /dev/null
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2015 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.rsvp.parser.impl.te;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SERODynamicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser;
+import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
+import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
+
+public class TEObjectTest {
+    RSVPActivator act;
+    SimpleRSVPExtensionProviderContext context;
+
+    @Before
+    public void setUp() {
+        act = new RSVPActivator();
+        context = new SimpleRSVPExtensionProviderContext();
+        act.start(context);
+    }
+
+    @Test
+    public void testAdminStatusObjectParser() throws RSVPParsingException {
+        final AdminStatusObjectParser admParser = new AdminStatusObjectParser();
+        final RsvpTeObject obj = admParser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_ADMIN_STATUS, 4, TEObjectUtil.TE_LSP_ADMIN_STATUS.length - 4)));
+        final ByteBuf output = Unpooled.buffer();
+        admParser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_ADMIN_STATUS, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testAssociationObjectParser1() throws RSVPParsingException {
+        final AssociationObjectParserIPV4 parser = new AssociationObjectParserIPV4();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_1, 4, TEObjectUtil.TE_LSP_ASSOCIATION_1.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_1, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testAssociationObjectParser2() throws RSVPParsingException {
+        final AssociationObjectParserIPV6 parser = new AssociationObjectParserIPV6();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_ASSOCIATION_2, 4, TEObjectUtil.TE_LSP_ASSOCIATION_2.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_ASSOCIATION_2, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testBandwidthObjectParser1() throws RSVPParsingException {
+        final BandwidthObjectParser parser = new BandwidthObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_1, 4, TEObjectUtil.TE_LSP_BANDWIDTH_1
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_1, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testBandwidthObjectParser2() throws RSVPParsingException {
+        final ReoptimizationBandwidthObjectParser parser = new ReoptimizationBandwidthObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_BANDWIDTH_2, 4, TEObjectUtil.TE_LSP_BANDWIDTH_2
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_BANDWIDTH_2, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testExcludeRouteParser() throws RSVPParsingException {
+        final ExcludeRouteObjectParser parser = new ExcludeRouteObjectParser(context.getXROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, 4, TEObjectUtil.TE_LSP_EXCLUDE_ROUTE.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testExplicitRouteParser() throws RSVPParsingException {
+        final ExplicitRouteObjectParser parser = new ExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_EXPLICIT, 4,
+            TEObjectUtil.TE_LSP_EXPLICIT.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_EXPLICIT, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testAttributesObject12Parser() throws RSVPParsingException {
+        final AttributesObjectParser parser = new AttributesObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_ATTRIBUTES, 4, TEObjectUtil.TE_LSP_ATTRIBUTES.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_ATTRIBUTES, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testRequiredAttributesParser() throws RSVPParsingException {
+        final RequiredAttributesObjectParser parser = new RequiredAttributesObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, 4, TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_REQUIRED_ATTRIBUTES, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testPrimaryPathRouteParser() throws RSVPParsingException {
+        final PrimaryPathRouteObjectParser parser = new PrimaryPathRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, 4, TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, ByteArray.getAllBytes(output));
+    }
+
+
+    @Test
+    public void testProtectionObjectParser1() throws RSVPParsingException {
+        final ProtectionObjectParser parser = new ProtectionObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C1, 4, TEObjectUtil.TE_LSP_PROTECTION_C1.length - 4)));
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C1, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testProtectionObjectParser2() throws RSVPParsingException {
+        final DynamicProtectionObjectParser parser = new DynamicProtectionObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_PROTECTION_C2, 4, TEObjectUtil.TE_LSP_PROTECTION_C2.length - 4)));
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_PROTECTION_C2, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testProtectionCommonParser() {
+        final ByteBuf emptyBuff = Unpooled.buffer();
+        try {
+            ProtectionCommonParser.parseCommonProtectionBodyType2(emptyBuff);
+            Assert.fail();
+        } catch (final RSVPParsingException e) {
+            Assert.assertEquals("Wrong length of array of bytes. Passed: " + emptyBuff.readableBytes() + "; Expected:" +
+                " " + ProtectionCommonParser.CONTENT_LENGTH_C2 + ".", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testRecordRouteParser() throws RSVPParsingException {
+        final RecordRouteObjectParser parser = new RecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_RECORD_ROUTE.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_RECORD_ROUTE, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSecondaryExplicitRouteParser() throws RSVPParsingException {
+        final SecondaryExplicitRouteObjectParser parser = new SecondaryExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, 4, TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSecondaryRecordRouteObjectParser() throws RSVPParsingException {
+        final SecondaryRecordRouteObjectParser parser = new SecondaryRecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSSRODynamicProtectionSubobjectParser() throws RSVPParsingException {
+        final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
+        final SRRODynamicProtectionSubobjectParser dynamicParser = new SRRODynamicProtectionSubobjectParser();
+        final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION
+                .length - 2)));
+
+        final ByteBuf output = Unpooled.buffer();
+        dynamicParser.serializeSubobject(sub, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSSROBasicProtectionSubobjectParser() throws RSVPParsingException {
+        final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
+        final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION.length - 2)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeSubobject(sub, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWrongParseSRRO() throws RSVPParsingException {
+        final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
+        parser.parseSubobject(null);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWrongSerializeSRRO() throws RSVPParsingException {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route
+            .object.secondary.record.route.object.subobject.container.subobject.type
+            .DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn
+            .opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route
+            .object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder().build();
+        final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.
+            SubobjectContainer subContainer = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+            .rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder().setSubobjectType(dynamicProtection).build();
+        parser.serializeSubobject(subContainer, Unpooled.buffer());
+    }
+
+    @Test
+    public void testSERODynamicProtectionSubobjectParser() throws RSVPParsingException {
+        final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
+        final SERODynamicProtectionSubobjectParser dynamicParser = new SERODynamicProtectionSubobjectParser();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.
+            SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION.length - 2)), true);
+
+        final ByteBuf output = Unpooled.buffer();
+        dynamicParser.serializeSubobject(sub, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWrongParseSERO() throws RSVPParsingException {
+        final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
+        parser.parseSubobject(null, false);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWrongSerializeSERO() throws RSVPParsingException {
+        final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
+        parser.serializeSubobject(new SubobjectContainerBuilder().setSubobjectType
+            (new DynamicControlProtectionCaseBuilder().build()).build(), Unpooled.buffer());
+    }
+
+    @Test
+    public void testSEROBasicProtectionSubobjectParser() throws RSVPParsingException {
+        final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.
+            SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION.length - 2)), true);
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeSubobject(sub, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testDetourObjectParser7() throws RSVPParsingException {
+        final DetourObjectIpv4Parser parser = new DetourObjectIpv4Parser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR7, 4, TEObjectUtil.TE_LSP_DETOUR7.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR7, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testDetourObjectParser8() throws RSVPParsingException {
+        final DetourObjectIpv6Parser parser = new DetourObjectIpv6Parser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_DETOUR8, 4, TEObjectUtil.TE_LSP_DETOUR8.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_DETOUR8, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testFastRerouteObjectParser1() throws RSVPParsingException {
+        final FastRerouteObjectParser parser = new FastRerouteObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE1, 4, TEObjectUtil.TE_LSP_FAST_REROUTE1.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE1, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testFastRerouteObjectParser7() throws RSVPParsingException {
+        final InformationalFastRerouteObjectParser parser = new InformationalFastRerouteObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_FAST_REROUTE7, 4, TEObjectUtil.TE_LSP_FAST_REROUTE7.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_FAST_REROUTE7, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testFlowSpecObjectParser_HEADER_5() throws RSVPParsingException {
+        final FlowSpecObjectParser parser = new FlowSpecObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H5, 4, TEObjectUtil.TE_LSP_FLOWSPEC_H5.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H5, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testFlowSpecObjectParser_HEADER_2() throws RSVPParsingException {
+        final FlowSpecObjectParser parser = new FlowSpecObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_FLOWSPEC_H2, 4, TEObjectUtil.TE_LSP_FLOWSPEC_H2.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_FLOWSPEC_H2, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testParser_HEADER_5() throws RSVPParsingException {
+        final SenderTspecObjectParser parser = new SenderTspecObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_SENDER_TSPEC, 4, TEObjectUtil.TE_LSP_SENDER_TSPEC.length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_SENDER_TSPEC, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSessionAttributeParser1() throws RSVPParsingException {
+        final SessionAttributeLspRaObjectParser parser = new SessionAttributeLspRaObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C1, 4, TEObjectUtil.TE_LSP_SESSION_C1
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C1, ByteArray.getAllBytes(output));
+    }
+
+    @Test
+    public void testSessionAttributeParser7() throws RSVPParsingException {
+        final SessionAttributeLspObjectParser parser = new SessionAttributeLspObjectParser();
+        final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
+            ByteArray.subByte(TEObjectUtil.TE_LSP_SESSION_C7, 4, TEObjectUtil.TE_LSP_SESSION_C7
+                .length - 4)));
+
+        final ByteBuf output = Unpooled.buffer();
+        parser.serializeObject(obj, output);
+        assertArrayEquals(TEObjectUtil.TE_LSP_SESSION_C7, ByteArray.getAllBytes(output));
+    }
+}
\ No newline at end of file
diff --git a/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectUtil.java b/rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/te/TEObjectUtil.java
new file mode 100644 (file)
index 0000000..2d17ca0
--- /dev/null
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 2015 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.rsvp.parser.impl.te;
+
+public class TEObjectUtil {
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(196)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |R|                        Reserved                       |T|A|D|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_ADMIN_STATUS = {
+        0x00, (byte) 0x04, (byte) 0xc4, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x80, // Reflect
+        0x00, 0x00, // Reserved
+        0x07,};// Testing,  Administratively down, Deletion in progress (D) 1 bit-each
+
+    /**
+     * * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(207)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                         Exclude-any                           |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                         Include-any                           |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                         Include-all                           |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |   Setup Prio  | Holding Prio  |     Flags     |  Name Length  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //          Session Name      (NULL padded display string)      //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_SESSION_C1 = {
+        0x00, (byte) 0x14, (byte) 0xcf, 0x01,  // Lenght, Class, Ctype
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,
+        0x01, 0x02, 0x04, 0x04,
+        (byte) 0x41, (byte) 0x41, (byte) 0x00, (byte) 0x00,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(207)|   C-Type (7)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |   Setup Prio  | Holding Prio  |     Flags     |  Name Length  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //          Session Name      (NULL padded display string)      //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_SESSION_C7 = {
+        0x00, (byte) 0x08, (byte) 0xcf, 0x07,  // Lenght, Class, Ctype
+        0x01, 0x02, 0x04, 0x04,
+        (byte) 0x41, (byte) 0x41, (byte) 0x41, (byte) 0x41,};
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(5)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                        Bandwidth                              |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_BANDWIDTH_1 = {
+        0x00, (byte) 0x04, (byte) 0x05, 0x01,  // Lenght, Class, Ctype
+        0x01, 0x02, 0x03, 0x04,};
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(5)|   C-Type (2)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                        Bandwidth                              |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_BANDWIDTH_2 = {
+        0x00, (byte) 0x04, (byte) 0x05, 0x02,  // Lenght, Class, Ctype
+        0x01, 0x02, 0x03, 0x04,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(199)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |       Association Type        |       Association ID          |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                  IPv4 Association Source                      |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_ASSOCIATION_1 = {
+        0x00, (byte) 0x08, (byte) 0xc7, 0x01,  // Lenght, Class, Ctype
+        0x00, 0x01, 0x00, 0x02,
+        0x01, 0x02, 0x03, 0x04,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(199)|   C-Type (2)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(199)|  C-Type (2)   |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |       Association Type        |       Association ID          |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * |                  IPv6 Association Source                      |
+     * |                                                               |
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_ASSOCIATION_2 = {
+        0x00, (byte) 0x14, (byte) 0xc7, 0x02,  // Lenght, Class, Ctype
+        0x00, 0x01, 0x00, 0x02,
+        0x01, 0x02, 0x03, 0x04,
+        0x05, 0x06, 0x07, 0x08,
+        0x01, 0x02, 0x03, 0x04,
+        0x05, 0x06, 0x07, 0x08,};
+
+    /**
+     * +-------------+-------------+-------------+-------------+
+     * |       Length (bytes)      |  Class-Num  |   C-Type    |
+     * +-------------+-------------+-------------+-------------+
+     * | Setup Prio  | Hold Prio   | Hop-limit   |    Flags    |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Bandwidth                            |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Include-any                          |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Exclude-any                          |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Include-all                          |
+     * +-------------+-------------+-------------+-------------+
+     */
+    public static final byte[] TE_LSP_FAST_REROUTE1 = {
+        0x00, (byte) 0x14, (byte) 0xcd, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x01, (byte) 0x02, (byte) 0x10, (byte) 0x02,
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,
+        0x04, 0x04, 0x04, 0x04,};
+
+    /**
+     * +-------------+-------------+-------------+-------------+
+     * |       Length (bytes)      |  Class-Num  |   C-Type    |
+     * +-------------+-------------+-------------+-------------+
+     * | Setup Prio  | Hold Prio   | Hop-limit   | Reserved    |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Bandwidth                            |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Include-any                          |
+     * +-------------+-------------+-------------+-------------+
+     * |                  Exclude-any                          |
+     * +-------------+-------------+-------------+-------------+
+     */
+    public static final byte[] TE_LSP_FAST_REROUTE7 = {
+        0x00, (byte) 0x10, (byte) 0xcd, 0x07,  // Lenght, Class, Ctype
+        (byte) 0x01, (byte) 0x02, (byte) 0x10, 0x00,
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,};
+
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(6)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |          Reserved             |    Flags  |C|B|       T       |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                          metric-value                         |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_METRIC = {
+        0x00, (byte) 0x08, (byte) 0x06, 0x01,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x03, 0x02,
+        0x01, 0x02, 0x03, 0x04,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(37)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |S|                  Reserved                       | Link Flags|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_PROTECTION_C1 = {
+        0x00, (byte) 0x04, (byte) 0x25, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x80, 0x00, 0x00, (byte) 0x0a,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(37)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |S|P|N|O| Reserved  | LSP Flags |     Reserved      | Link Flags|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |I|R|   Reserved    | Seg.Flags |           Reserved            |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_PROTECTION_C2 = {
+        0x00, (byte) 0x08, (byte) 0x25, 0x02,  // Lenght, Class, Ctype
+        (byte) 0xf0, 0x08, 0x00, (byte) 0x0a,
+        (byte) 0xc0, 0x04, 0x00, (byte) 0x00,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(197)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                       Attributes TLVs                       //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * **Attributes TLVs
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |             Type              |           Length              |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                            Value                            //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_ATTRIBUTES = {
+        0x00, (byte) 0x0c, (byte) 0xc5, 0x01,  // Lenght, Class, Ctype
+        0x00, 0x01, 0x00, 0x08,
+        (byte) 0x09, 0x07, 0x03, 0x01,
+        (byte) 0x15, 0x07, 0x03, 0x01,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(43)|   C-Type (1)    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                       Attributes TLVs                       //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * **Attributes TLVs
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |             Type              |           Length              |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                            Value                            //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_REQUIRED_ATTRIBUTES = {
+        0x00, (byte) 0x0c, 0x43, 0x01,  // Lenght, Class, Ctype
+        0x00, 0x01, 0x00, 0x08,
+        (byte) 0x09, 0x07, 0x03, 0x01,
+        (byte) 0x15, 0x07, 0x03, 0x01,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(63)|   C-Type (7)    |
+     * +-------------+-------------+-------------+-------------+
+     * |       Length (bytes)      |  Class-Num  |   C-Type    |
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  1                        |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID 1                    |
+     * +-------------+-------------+-------------+-------------+
+     * //                        ....                          //
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  n                        |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID  n                   |
+     * +-------------+-------------+-------------+-------------+
+     */
+    public static final byte[] TE_LSP_DETOUR7 = {
+        0x00, (byte) 0x20, (byte) 0x3f, 0x07,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x01,
+        0x01, 0x02, 0x03, 0x01,
+        0x00, 0x00, 0x00, 0x02,
+        0x01, 0x02, 0x03, 0x02,
+        0x00, 0x00, 0x00, 0x03,
+        0x01, 0x02, 0x03, 0x03,
+        0x00, 0x00, 0x00, 0x04,
+        0x01, 0x02, 0x03, 0x04,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |     Length           | Class-Num(63)|   C-Type (7)    |
+     * +-------------+-------------+-------------+-------------+
+     * |       Length (bytes)      |  Class-Num  |   C-Type    |
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  1                        |
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  1 (continued)            |
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  1 (continued)            |
+     * +-------------+-------------+-------------+-------------+
+     * |                      PLR_ID  1 (continued)            |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID 1                    |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID 1 (continued)        |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID 1 (continued)        |
+     * +-------------+-------------+-------------+-------------+
+     * |                    Avoid_Node_ID 1 (continued)        |
+     * +-------------+-------------+-------------+-------------+
+     * //                        ....                          //
+     * +-------------+-------------+-------------+-------------+
+     */
+    public static final byte[] TE_LSP_DETOUR8 = {
+        0x00, (byte) 0x40, (byte) 0x3f, 0x08,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x01,
+        0x00, 0x00, 0x00, 0x02,
+        0x00, 0x00, 0x00, 0x03,
+        0x00, 0x00, 0x00, 0x04,
+        0x01, 0x01, 0x01, 0x01,
+        0x01, 0x01, 0x01, 0x01,
+        0x01, 0x01, 0x01, 0x01,
+        0x01, 0x01, 0x01, 0x01,
+        0x00, 0x00, 0x00, 0x04,
+        0x00, 0x00, 0x00, 0x03,
+        0x00, 0x00, 0x00, 0x02,
+        0x00, 0x00, 0x00, 0x01,
+        0x01, 0x01, 0x01, 0x02,
+        0x01, 0x01, 0x01, 0x02,
+        0x01, 0x01, 0x01, 0x02,
+        0x01, 0x01, 0x01, 0x02,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+
+     * |            Length             | Class-Num(9)|   C-Type (1)|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | 0 (a) |    reserved           |             7 (b)         |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |    1  (c)     |0| reserved    |             6 (d)         |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |   127 (e)     |    0 (f)      |             5 (g)         |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Rate [r] (32-bit IEEE floating point number)|
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Size [b] (32-bit IEEE floating point number)|
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Peak Data Rate [p] (32-bit IEEE floating point number)   |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Minimum Policed Unit [m] (32-bit integer)                |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Maximum Packet Size [M]  (32-bit integer)                |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_SENDER_TSPEC = {
+        0x00, (byte) 0x20, (byte) 0x0c, 0x02,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x07,
+        0x01, 0x00, 0x00, 0x06,
+        (byte) 0x7f, 0x00, 0x00, 0x05,
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,
+        0x01, 0x02, 0x03, 0x04,
+        0x04, 0x03, 0x02, 0x01,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+
+     * |            Length             | Class-Num(9)|   C-Type (1)|
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | 0 (a) |    reserved           |             7 (b)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |    5  (c)     |0| reserved    |             6 (d)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |   127 (e)     |    0 (f)      |             5 (g)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Rate [r] (32-bit IEEE floating point number) |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Size [b] (32-bit IEEE floating point number) |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Peak Data Rate [p] (32-bit IEEE floating point number)    |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Minimum Policed Unit [m] (32-bit integer)                 |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Maximum Packet Size [M]  (32-bit integer)                 |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_FLOWSPEC_H5 = {
+        0x00, (byte) 0x20, (byte) 0x09, 0x02,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x07,
+        0x05, 0x00, 0x00, 0x06,
+        (byte) 0x7f, 0x00, 0x00, 0x05,
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,
+        0x01, 0x02, 0x03, 0x04,
+        0x04, 0x03, 0x02, 0x01,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+
+     * |            Length             | Class-Num(9)|   C-Type (1) |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+-+
+     * | 0 (a) |    Unused             |            10 (b)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |    2  (c)     |0| reserved    |             9 (d)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |   127 (e)     |    0 (f)      |             5 (g)          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Rate [r] (32-bit IEEE floating point number) |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Token Bucket Size [b] (32-bit IEEE floating point number) |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Peak Data Rate [p] (32-bit IEEE floating point number)    |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Minimum Policed Unit [m] (32-bit integer)                 |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Maximum Packet Size [M]  (32-bit integer)                 |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |     130 (h)   |    0 (i)      |            2 (j)           |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Rate [R]  (32-bit IEEE floating point number)             |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |  Slack Term [S]  (32-bit integer)                          |
+     * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_FLOWSPEC_H2 = {
+        0x00, (byte) 0x2c, (byte) 0x09, 0x02,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x0a,
+        0x02, 0x00, 0x00, 0x09,
+        (byte) 0x7f, 0x00, 0x00, 0x05,
+        0x01, 0x01, 0x01, 0x01,
+        0x02, 0x02, 0x02, 0x02,
+        0x03, 0x03, 0x03, 0x03,
+        0x01, 0x02, 0x03, 0x04,
+        0x04, 0x03, 0x02, 0x01,
+        (byte) 0x82, 0x00, 0x00, 0x02,
+        (byte) 0x01, 0x01, 0x02, 0x02,
+        (byte) 0x06, 0x06, 0x06, 0x06,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(232)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    /**
+     * Subobject IPv4
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |L|    Type     |     Length    | IPv4 address (4 bytes)        |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | IPv4 address (continued)      | Prefix Length |   Attribute   |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * Subobject IPv6
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |L|    Type     |     Length    | IPv6 address (16 bytes)       |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | IPv6 address (continued)                                      |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | IPv6 address (continued)                                      |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | IPv6 address (continued)                                      |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * | IPv6 address (continued)      | Prefix Length |   Attribute   |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * Unnumbered Interface
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |L|    Type     |     Length    |    Reserved   |  Attribute    |
+     * | |             |               |(must be zero) |               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                        TE Router ID                           |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                     Interface ID (32 bits)                    |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * SRLG
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |L|    Type     |     Length    |       SRLG Id (4 bytes)       |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |      SRLG Id (continued)      |           Reserved            |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_EXCLUDE_ROUTE = {
+        0x00, (byte) 0x34, (byte) 0xe8, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x81, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x01,
+        (byte) 0x82, (byte) 0x14,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x80, 0x02,
+        (byte) 0x84, (byte) 0x0c, 0x00, 0x00,
+        0x01, 0x02, 0x03, 0x04, 0x04, 0x03, 0x03, 0x04,
+        (byte) 0x20, 0x04, 0x01, 0x02,
+        (byte) 0x22, 0x08, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00,};
+
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(38)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_PRIMARY_PATH_ROUTE = {
+        0x00, (byte) 0x30, (byte) 0x26, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x01, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x00,
+        (byte) 0x02, (byte) 0x14,
+        0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte) 0x80, 0x00,
+        (byte) 0x03, 0x08, 0x00, 0x01,
+        0x00, 0x00, 0x01, 0x01,
+        (byte) 0x04, (byte) 0x0c, 0x00, 0x00,
+        0x01, 0x02, 0x03, 0x04, 0x04, 0x03, 0x03, 0x04,
+    };//Maximum Packet Size
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(20)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_EXPLICIT = {
+        0x00, (byte) 0x20, (byte) 0x14, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x81, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x00,
+        (byte) 0x82, (byte) 0x14,
+        0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte) 0x80, 0x00,
+        (byte) 0x20, 0x04, 0x01, 0x02,
+    };
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(20)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_SECONDARY_EXPLICIT = {
+        0x00, (byte) 0x2c, (byte) 0xc8, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x81, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x00,
+        (byte) 0x82, (byte) 0x14,
+        0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte) 0x80, 0x00,
+        (byte) 0x20, 0x04, 0x01, 0x02,
+        (byte) 0x25, 0x0c, 0x00, 0x02,
+        (byte) 0xf0, 0x04, 0x00, 0x08,
+        (byte) 0xc0, 0x04, 0x00, 0x00,
+    };
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(21)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_RECORD_ROUTE = {
+        0x00, (byte) 0x24, (byte) 0x15, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x01, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x01,
+        (byte) 0x02, (byte) 0x14,
+        0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte) 0x80, 0x02,
+        (byte) 0x03, 0x08, 0x01, 0x01,
+        0x00, 0x00, 0x01, 0x01,
+    };
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(201)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |                                                               |
+     * //                        (Subobjects)                         //
+     * |                                                               |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    public static final byte[] TE_LSP_SECONDARY_RECORD_ROUTE = {
+        0x00, (byte) 0x30, (byte) 0xc9, 0x01,  // Lenght, Class, Ctype
+        (byte) 0x01, 0x08, 0x01, 0x02, 0x03, 0x04, (byte) 0x20, 0x01,
+        (byte) 0x02, (byte) 0x14,
+        0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte) 0x80, 0x02,
+        (byte) 0x03, 0x08, 0x01, 0x01,
+        0x00, 0x00, 0x01, 0x01,
+        (byte) 0x25, 0x0c, 0x00, 0x02,
+        (byte) 0xf0, 0x04, 0x00, 0x08,
+        (byte) 0xc0, 0x04, 0x00, 0x00,
+    };
+    public static final byte[] TE_LSP_DYNAMIC_SRRO_PROTECTION = {
+        (byte) 0x25, 0x0c, 0x00, 0x02,
+        (byte) 0xf0, 0x04, 0x00, 0x08,
+        (byte) 0xc0, 0x04, 0x00, 0x00,
+    };
+    public static final byte[] TE_LSP_BASIC_SRRO_PROTECTION = {
+        (byte) 0x25, 0x08, 0x00, 0x01,
+        (byte) 0x00, 0x00, 0x00, 0x08,
+    };
+    public static final byte[] TE_LSP_DYNAMIC_SERO_PROTECTION = {
+        (byte) 0xa5, 0x0c, 0x00, 0x02,
+        (byte) 0xf0, 0x04, 0x00, 0x08,
+        (byte) 0xc0, 0x04, 0x00, 0x00,
+    };
+    public static final byte[] TE_LSP_BASIC_SERO_PROTECTION = {
+        (byte) 0xa5, 0x08, 0x00, 0x01,
+        (byte) 0x00, 0x00, 0x00, 0x08,
+    };
+    /**
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |            Length             | Class-Num(197)|   C-Type (1)  |
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     * |R|                        Reserved                       |T|A|D|
+     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+    static final byte[] TE_LSP_ATTR = {0x00, (byte) 0x63, 0x00, (byte) 0x24, // TE LSP Attribute Type, lenght, value
+        0x00, (byte) 0x20, (byte) 0x0c, 0x02,  // Lenght, Class, Ctype
+        0x00, 0x00, 0x00, 0x07,
+        0x01, 0x00, 0x00, 0x06,
+        (byte) 0x7f, 0x00, 0x00, 0x05,
+        0x00, 0x00, 0x00, 0x01, //Token Bucket Rate
+        0x00, 0x00, 0x00, 0x02, //Token Bucket Size
+        0x00, 0x00, 0x00, 0x03, //Peak Data Rate
+        0x00, 0x00, 0x00, 0x04, //Minimum Policed Unit
+        0x00, 0x00, 0x00, 0x05};//Maximum Packet Size
+}