BUG-50 : adjusted PathKey object. 02/2502/1
authorDana Kutenicsova <dkutenic@cisco.com>
Thu, 7 Nov 2013 14:01:04 +0000 (15:01 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Thu, 7 Nov 2013 14:01:04 +0000 (15:01 +0100)
Change-Id: I30c11c990ea7cdbe4e92402aec270f4191a7ccf8
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/PCEPPathKeyObjectParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java

index 8208418176aa8769365fc2432592d439eaaa1c49..f60677dd5f3834e4231951fddb05ad424677fd7b 100644 (file)
@@ -803,18 +803,19 @@ module pcep-types {
        grouping path-key-object {
                description "PATH-KEY Object";
                reference "https://tools.ietf.org/html/rfc5520#section-3.2.2";
-
-               uses object;
-
-               list path-keys {
-                       min-elements 1;
-
-                       leaf loose {
-                               type boolean;
-                               default false;
+               container path-key {
+                       uses object;
+       
+                       list path-keys {
+                               min-elements 1;
+       
+                               leaf loose {
+                                       type boolean;
+                                       default false;
+                               }
+       
+                               uses path-key-subobject;
                        }
-
-                       uses path-key-subobject;
                }
        }
 
@@ -1028,9 +1029,7 @@ module pcep-types {
 
                                container path-key-expansion {
                                        when "rp/path-key = true";
-                                       container path-key {
-                                               uses path-key-object;
-                                       }
+                                       uses path-key-object;
                                }
 
                                container segment-computation {
index 84af5b3fb37b795e1f46a34bda37071064c96631..555d1dc867c3b5601a77bd564adbd4fd0769b0e7 100644 (file)
@@ -86,7 +86,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.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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PathKeyObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcerrMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcinitiateMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcntfMessage;
@@ -290,7 +289,9 @@ public final class Activator implements PCEPExtensionProviderActivator {
                context.registerObjectSerializer(ErrorObject.class, new PCEPErrorObjectParser(tlvReg));
                context.registerObjectSerializer(LoadBalancingObject.class, new PCEPLoadBalancingObjectParser(tlvReg));
                context.registerObjectSerializer(CClose.class, new PCEPCloseObjectParser(tlvReg));
-               context.registerObjectSerializer(PathKeyObject.class, new PCEPPathKeyObjectParser(eroSubReg));
+               context.registerObjectSerializer(
+                               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKey.class,
+                               new PCEPPathKeyObjectParser(eroSubReg));
                context.registerObjectSerializer(Of.class, new PCEPObjectiveFunctionObjectParser(tlvReg));
                context.registerObjectSerializer(ClassType.class, new PCEPClassTypeObjectParser(tlvReg));
                context.registerObjectSerializer(GcObject.class, new PCEPGlobalConstraintsObjectParser(tlvReg));
index bf51d6d44eed09a6c9992e177a5bc4dd10945a05..8a3824bce23333c7ea073be34680c9b1214d33d3 100644 (file)
@@ -14,18 +14,17 @@ import org.opendaylight.protocol.pcep.PCEPDocumentedException;
 import org.opendaylight.protocol.pcep.spi.EROSubobjectHandlerRegistry;
 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.PathKeyObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobjects;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectsBuilder;
-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.path.key.object.PathKeys;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeysBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.path.key.expansion.PathKeyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeys;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeysBuilder;
 
 import com.google.common.collect.Lists;
 
 /**
- * Parser for {@link PathKeyObject}
+ * Parser for {@link PathKey}
  */
 public class PCEPPathKeyObjectParser extends AbstractEROWithSubobjectsParser {
 
@@ -38,15 +37,14 @@ public class PCEPPathKeyObjectParser extends AbstractEROWithSubobjectsParser {
        }
 
        @Override
-       public PathKeyObject parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public PathKey parseObject(final ObjectHeader header, final byte[] bytes) throws PCEPDeserializerException, PCEPDocumentedException {
                final PathKeyBuilder builder = new PathKeyBuilder();
                builder.setIgnore(header.isIgnore());
                builder.setProcessingRule(header.isProcessingRule());
                final List<PathKeys> pk = Lists.newArrayList();
                final List<Subobjects> subs = parseSubobjects(bytes);
                for (final Subobjects s : subs) {
-                       final PathKey k = (PathKey) s.getSubobjectType();
+                       final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobjects.subobject.type.PathKey k = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.subobjects.subobject.type.PathKey) s.getSubobjectType();
                        pk.add(new PathKeysBuilder().setLoose(s.isLoose()).setPceId(k.getPathKey().getPceId()).setPathKey(k.getPathKey().getPathKey()).build());
                }
                builder.setPathKeys(pk);
@@ -55,10 +53,10 @@ public class PCEPPathKeyObjectParser extends AbstractEROWithSubobjectsParser {
 
        @Override
        public byte[] serializeObject(final Object object) {
-               if (!(object instanceof PathKeyObject)) {
+               if (!(object instanceof PathKey)) {
                        throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed PathKeyObject.");
                }
-               final PathKeyObject pkey = (PathKeyObject) object;
+               final PathKey pkey = (PathKey) object;
                final List<PathKeys> pk = pkey.getPathKeys();
                final List<Subobjects> subs = Lists.newArrayList();
                for (final PathKeys p : pk) {
index 596754c6524750503dbc674d566f4b0ee3ddb3e8..9f0977f9a873b2087932832cd023634c741edc35 100644 (file)
@@ -81,14 +81,14 @@ 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.open.object.OpenBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.OrderBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDurationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeys;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeysBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.PathKeyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeys;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.key.object.path.key.PathKeysBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder;
 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.path.key.expansion.PathKeyBuilder;
 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;