BUG-50 : adjusted LoadBalancing object. 04/2504/1
authorDana Kutenicsova <dkutenic@cisco.com>
Thu, 7 Nov 2013 14:06:30 +0000 (15:06 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Thu, 7 Nov 2013 14:06:30 +0000 (15:06 +0100)
Change-Id: I60b5b27fdf77a91d633d06e6a8736e2451a8aa5e
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
pcep/api/src/main/yang/pcep-types.yang
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/Activator.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/object/PCEPLoadBalancingObjectParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java

index f60677dd5f3834e4231951fddb05ad424677fd7b..df62ec650bdf825727f713ff329ec84c3b115168 100644 (file)
@@ -753,17 +753,19 @@ module pcep-types {
        grouping load-balancing-object {
                description "LOAD-BALANCING Object";
                reference "https://tools.ietf.org/html/rfc5440#section-7.16";
-
-               // No possibility of TLVs
-               uses object;
-
-               leaf max-lsp {
-                       type uint8;
-                       mandatory true;
-               }
-
-               leaf min-bandwidth {
-                       type ieee754:float32;
+               
+               container load-balancing {
+                       // No possibility of TLVs
+                       uses object;
+       
+                       leaf max-lsp {
+                               type uint8;
+                               mandatory true;
+                       }
+       
+                       leaf min-bandwidth {
+                               type ieee754:float32;
+                       }
                }
        }
 
@@ -1046,9 +1048,7 @@ module pcep-types {
                                                        uses bandwidth-object;
                                                }
 
-                                               container load-balancing {
-                                                       uses load-balancing-object;
-                                               }
+                                               uses load-balancing-object;
 
                                                uses lsp-attributes;
 
index 555d1dc867c3b5601a77bd564adbd4fd0769b0e7..7efe92bc6153f9fcc6ad85a29df7ddcb81ba14aa 100644 (file)
@@ -82,7 +82,6 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectHandlerRegistry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.CloseMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.GcObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.KeepaliveMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LoadBalancingObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.MetricObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.NoPathObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OpenMessage;
@@ -103,6 +102,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobjects.subobject.type.PathKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.Iro;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.load.balancing.object.LoadBalancing;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.error.code.tlv.LspErrorCode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.identifiers.tlv.LspIdentifiers;
@@ -287,7 +287,7 @@ public final class Activator implements PCEPExtensionProviderActivator {
                context.registerObjectSerializer(SvecObject.class, new PCEPSvecObjectParser(tlvReg));
                context.registerObjectSerializer(CNotification.class, new PCEPNotificationObjectParser(tlvReg));
                context.registerObjectSerializer(ErrorObject.class, new PCEPErrorObjectParser(tlvReg));
-               context.registerObjectSerializer(LoadBalancingObject.class, new PCEPLoadBalancingObjectParser(tlvReg));
+               context.registerObjectSerializer(LoadBalancing.class, new PCEPLoadBalancingObjectParser(tlvReg));
                context.registerObjectSerializer(CClose.class, new PCEPCloseObjectParser(tlvReg));
                context.registerObjectSerializer(
                                org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKey.class,
index fd649e826fb3af50bc78481038df4c0759ab27c9..c614dee9cd16f9c9a06adf4908f23b9419f8a03c 100644 (file)
@@ -12,16 +12,16 @@ import org.opendaylight.protocol.pcep.PCEPDocumentedException;
 import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.LoadBalancingObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.LoadBalancingBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.load.balancing.object.LoadBalancing;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.load.balancing.object.LoadBalancingBuilder;
 
 import com.google.common.primitives.UnsignedBytes;
 
 /**
- * Parser for {@link LoadBalancingObject}
+ * Parser for {@link LoadBalancing}
  */
 public class PCEPLoadBalancingObjectParser extends AbstractObjectWithTlvsParser<LoadBalancingBuilder> {
 
@@ -44,7 +44,7 @@ public class PCEPLoadBalancingObjectParser extends AbstractObjectWithTlvsParser<
        }
 
        @Override
-       public LoadBalancingObject parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException,
+       public LoadBalancing parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException,
                        PCEPDocumentedException {
                if (bytes == null || bytes.length == 0) {
                        throw new IllegalArgumentException("Byte array is mandatory. Can't be null or empty.");
@@ -67,11 +67,11 @@ public class PCEPLoadBalancingObjectParser extends AbstractObjectWithTlvsParser<
 
        @Override
        public byte[] serializeObject(final Object object) {
-               if (!(object instanceof LoadBalancingObject)) {
+               if (!(object instanceof LoadBalancing)) {
                        throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass()
                                        + ". Needed LoadBalancingObject.");
                }
-               final LoadBalancingObject specObj = (LoadBalancingObject) object;
+               final LoadBalancing specObj = (LoadBalancing) object;
                final byte[] retBytes = new byte[SIZE];
                retBytes[MAX_LSP_F_OFFSET] = UnsignedBytes.checkedCast(specObj.getMaxLsp());
                ByteArray.copyWhole(specObj.getMinBandwidth().getValue(), retBytes, MIN_BAND_F_OFFSET);
index 9f0977f9a873b2087932832cd023634c741edc35..fbbab8ed6ec1e1877a14046b6dd1415f3b2c3bab 100644 (file)
@@ -70,6 +70,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.IroBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.load.balancing.object.LoadBalancingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.db.version.tlv.LspDbVersionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.error.code.tlv.LspErrorCode;
@@ -89,7 +90,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure.NoPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure.no.path.tlvs.NoPathVectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.SvecBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.LoadBalancingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.segment.computation.p2p.ReportedRouteBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.GcBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.MetricBuilder;