Switch pce-id to a simple type 59/73759/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Jul 2018 18:11:03 +0000 (20:11 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Jul 2018 18:31:36 +0000 (20:31 +0200)
Union of binary with different lengths does not really make sense,
use length alternatives instead.

Change-Id: I76cd4ad77b51d3e6e6a0522aa5457e7ce56fd590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey128SubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey32SubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey128SubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey32SubobjectParser.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java
rsvp/api/src/main/yang/rsvp.yang
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/ero/EROPathKey32SubobjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/rro/RROPathKey128SubobjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/rro/RROPathKey32SubobjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/xro/XROPathKey32SubobjectParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParser.java

index 23c816a24cb8cca0ed7387aa58dfbab30732045f..2d499fc863bcb53b62357900777540cffdb17eb8 100644 (file)
@@ -62,7 +62,7 @@ public class RROPathKey128SubobjectParser implements RROSubobjectParser {
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        body.writeBytes(pk.getPceId().getBinary());
+        body.writeBytes(pk.getPceId().getValue());
         RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
     }
 }
index 9ffb9933914caab7687cc204a3c2bdd1e6b2f272..a5223eda1cfe6d9be2100231088bab2573d49a87 100644 (file)
@@ -62,13 +62,15 @@ public class RROPathKey32SubobjectParser implements RROSubobjectParser, RROSubob
             .subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
         final ByteBuf body = Unpooled.buffer();
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        if(pk.getPceId().getBinary().length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
+
+        final byte[] pceId = pk.getPceId().getValue();
+        if (pceId.length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
             RROPathKey128SubobjectParser.serializeSubobject(subobject,buffer);
         }
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
-        Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
-        body.writeBytes(pk.getPceId().getBinary());
+        Preconditions.checkArgument(pceId.length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
+        body.writeBytes(pceId);
         RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
     }
 }
index ac71617e7494fe64df1037a07e692458ff153eaf..e883c7a29f2fde0f8ffc1737f70b8e31a3124796 100644 (file)
@@ -61,7 +61,7 @@ public class XROPathKey128SubobjectParser implements XROSubobjectParser {
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        body.writeBytes(pk.getPceId().getBinary());
+        body.writeBytes(pk.getPceId().getValue());
         XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
     }
 }
index e002027ac921f00edc54af37f9ebaa0344cdb18a..c80255c6de5ab6973a2eeb0a7db74a8043e3122c 100644 (file)
@@ -61,13 +61,15 @@ public class XROPathKey32SubobjectParser implements XROSubobjectParser, XROSubob
             .subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
         final ByteBuf body = Unpooled.buffer();
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        if(pk.getPceId().getBinary().length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
+
+        final byte[] pceId = pk.getPceId().getValue();
+        if (pceId.length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
             XROPathKey128SubobjectParser.serializeSubobject(subobject,buffer);
         }
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
-        Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
-        body.writeBytes(pk.getPceId().getBinary());
+        Preconditions.checkArgument(pceId.length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
+        body.writeBytes(pceId);
         XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
     }
 }
index 716134adefd7b1998144821e4e65b75379a0f601..dc8299c7a7e995c572d2bc09f47538130a4b892c 100644 (file)
@@ -60,7 +60,7 @@ public abstract class AbstractEROPathKeySubobjectParser implements EROSubobjectP
             .subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
-        final byte[] pceID = pk.getPceId().getBinary();
+        final byte[] pceID = pk.getPceId().getValue();
         Preconditions.checkArgument(pceID.length == PCE_ID_F_LENGTH || pceID.length == PCE128_ID_F_LENGTH, "PceId 32/128 Bit required.");
         final ByteBuf body = Unpooled.buffer();
         writeUnsignedShort(pk.getPathKey().getValue(), body);
index dad9a4293e936d89f0199a62eb8431e60bcfe7b2..291b1fdd4dd43466483087e37bf1896343102cb5 100644 (file)
@@ -375,13 +375,8 @@ module rsvp {
     }
 
     typedef pce-id {
-        type union {
-            type binary {
-                length 4;
-            }
-            type binary {
-                length 16;
-            }
+        type binary {
+            length 4|16;
         }
     }
 
index d6cd84e28e2679257f03d28e164ee6bf5b0ab046..4e09c0f0e3ccad3aaa9d8550d477635432611214 100644 (file)
@@ -55,9 +55,9 @@ public class EROPathKey32SubobjectParser extends CommonPathKeyParser implements
             .subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType())
             .getPathKey();
         final ByteBuf body = serializePathKey(pk);
-        if (pk.getPceId().getBinary().length == PCE_ID_F_LENGTH) {
+        if (pk.getPceId().getValue().length == PCE_ID_F_LENGTH) {
             EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
-        } else if (pk.getPceId().getBinary().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
+        } else if (pk.getPceId().getValue().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
             EROSubobjectUtil.formatSubobject(EROPathKey128SubobjectParser.TYPE, subobject.isLoose(), body, buffer);
         }
     }
index b844903047f0f2ea415e6daffc8abc59c45f8337..07f76dcc6b6ef3af7075ab06cccd1d54f8c0e373 100644 (file)
@@ -41,7 +41,7 @@ public class RROPathKey128SubobjectParser implements RROSubobjectParser {
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        body.writeBytes(pk.getPceId().getBinary());
+        body.writeBytes(pk.getPceId().getValue());
         RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
     }
 
index bf7072d1958cd44232f6d670fb914aa6a40f8fe6..16cefb96b0047bd44d02126059aef0e2f76a2d1b 100644 (file)
@@ -64,14 +64,15 @@ public class RROPathKey32SubobjectParser implements RROSubobjectParser, RROSubob
             .subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
         final ByteBuf body = Unpooled.buffer();
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        if (pk.getPceId().getBinary().length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
+
+        final byte[] pceId = pk.getPceId().getValue();
+        if (pceId.length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
             RROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
         }
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
-        Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH,
-            "PathKey 32Bit is mandatory.");
+        Preconditions.checkArgument(pceId.length == PCE_ID_F_LENGTH, "PathKey 32Bit is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
-        body.writeBytes(pk.getPceId().getBinary());
+        body.writeBytes(pceId);
         RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
     }
 }
index d531a3a1d2678fa8b04a739be55913c3adbb4d63..baa0f1ec6730417207bf1251f775b0013ac307e3 100644 (file)
@@ -55,9 +55,10 @@ public class XROPathKey32SubobjectParser extends CommonPathKeyParser implements
             .subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType())
             .getPathKey();
         final ByteBuf body = serializePathKey(pk);
-        if (pk.getPceId().getBinary().length == PCE_ID_F_LENGTH) {
+        final byte[] pceId = pk.getPceId().getValue();
+        if (pceId.length == PCE_ID_F_LENGTH) {
             XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
-        } else if (pk.getPceId().getBinary().length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
+        } else if (pceId.length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
             XROSubobjectUtil.formatSubobject(XROPathKey128SubobjectParser.TYPE, subobject.isMandatory(), body, buffer);
         }
     }
index 500a254ca985fff4b7ce44f108ee7adfe1d25e5d..ae9b847bfd900e0cb004e29c49a101d0a133dee5 100644 (file)
@@ -39,7 +39,7 @@ public class CommonPathKeyParser {
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
         Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
-        body.writeBytes(pk.getPceId().getBinary());
+        body.writeBytes(pk.getPceId().getValue());
         return body;
     }
 }