P2MP end points 16/77816/13
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 8 Nov 2018 09:23:05 +0000 (10:23 +0100)
committerRobert Varga <nite@hq.sk>
Sun, 9 Dec 2018 19:00:58 +0000 (19:00 +0000)
JIRA: BGPCEP-406

Change-Id: Ia582bf5e93aef41340bc3f7f19cf9bdfe6003655
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
pcep/api/src/main/yang/pcep-types.yang
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/BaseParserExtensionActivator.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv4ObjectParser.java [moved from pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPEndPointsIpv4ObjectParser.java with 70% similarity]
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv6ObjectParser.java [moved from pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPEndPointsIpv6ObjectParser.java with 74% similarity]
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsObjectSerializer.java [new file with mode: 0644]
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java [new file with mode: 0644]
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java [new file with mode: 0644]
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParser.java

index f6c3a9fe4d50375cbf0875b06955624bfbac6d8e..94021f76993c2661e4f6a53e3412c2609266a984 100644 (file)
@@ -313,19 +313,19 @@ module pcep-types {
             leaf fragmentation {
                 type boolean;
                 default false;
-                reference "https://tools.ietf.org/html/rfc6006#section-3.3.1";
+                reference "https://tools.ietf.org/html/rfc8306#section-3.3.1";
             }
 
             leaf p2mp {
                 type boolean;
                 default false;
-                reference "https://tools.ietf.org/html/rfc6006#section-3.3.1";
+                reference "https://tools.ietf.org/html/rfc8306#section-3.3.1";
             }
 
             leaf ero-compression {
                 type boolean;
                 default false;
-                reference "https://tools.ietf.org/html/rfc6006#section-3.3.1";
+                reference "https://tools.ietf.org/html/rfc8306#section-3.3.1";
             }
 
             leaf supply-of {
@@ -371,17 +371,67 @@ module pcep-types {
         }
     }
 
+    typedef p2mp-leaves {
+        reference "https://tools.ietf.org/html/rfc8306#section-3.3.2";
+        description "Types of leaves in a P2MP request.";
+        type enumeration {
+            enum new-leaves-to-add {
+                value 1;
+            }
+            enum old-leaves-to-remove {
+                value 2;
+            }
+            enum old-leaves-path-modified-reoptimized {
+                value 3;
+            }
+            enum old-leaves-path-unchanged {
+                value 4;
+            }
+        }
+    }
+
+    grouping p2mp-leaves-leaf {
+        leaf p2mp-leaves {
+            type p2mp-leaves;
+            mandatory true;
+        }
+    }
+
+    grouping endpoints-ipv4-source {
+        leaf source-ipv4-address {
+            type inet:ipv4-address-no-zone;
+            mandatory true;
+        }
+    }
+
+    grouping endpoints-ipv6-source {
+        leaf source-ipv6-address {
+            type inet:ipv6-address-no-zone;
+            mandatory true;
+        }
+    }
+
+    grouping ipv6-destinations {
+        leaf-list destination-ipv6-address {
+            type inet:ipv6-address-no-zone;
+            min-elements 1;
+        }
+    }
+
+    grouping ipv4-destinations {
+        leaf-list destination-ipv4-address {
+            type inet:ipv4-address-no-zone;
+            min-elements 1;
+        }
+    }
+
     grouping endpoints {
         choice address-family {
             mandatory true;
 
             case ipv4-case {
                 container ipv4 {
-                    leaf source-ipv4-address {
-                        type inet:ipv4-address-no-zone;
-                        mandatory true;
-                    }
-
+                    uses endpoints-ipv4-source;
                     leaf destination-ipv4-address {
                         type inet:ipv4-address-no-zone;
                         mandatory true;
@@ -390,17 +440,27 @@ module pcep-types {
             }
             case ipv6-case {
                 container ipv6 {
-                    leaf source-ipv6-address {
-                        type inet:ipv6-address-no-zone;
-                        mandatory true;
-                    }
-
+                    uses endpoints-ipv6-source;
                     leaf destination-ipv6-address {
                         type inet:ipv6-address-no-zone;
                         mandatory true;
                     }
                 }
             }
+            case p2mp-ipv4-case {
+                container p2mp-ipv4 {
+                    uses p2mp-leaves-leaf;
+                    uses endpoints-ipv4-source;
+                    uses ipv4-destinations;
+                }
+            }
+            case p2mp-ipv6-case {
+                container p2mp-ipv6 {
+                    uses p2mp-leaves-leaf;
+                    uses endpoints-ipv6-source;
+                    uses ipv6-destinations;
+                }
+            }
         }
     }
 
index b0db66a8633bc6e617962d7bd6b43e8bc5850351..5d0908c860524a756b38cb9acbd32473ad14d688 100644 (file)
@@ -22,8 +22,9 @@ import org.opendaylight.protocol.pcep.parser.message.PCEPStartTLSMessageParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPBandwidthObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPClassTypeObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPCloseObjectParser;
-import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv4ObjectParser;
-import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsObjectSerializer;
 import org.opendaylight.protocol.pcep.parser.object.PCEPErrorObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPExcludeRouteObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPExistingBandwidthObjectParser;
@@ -50,6 +51,8 @@ import org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectPa
 import org.opendaylight.protocol.pcep.parser.object.PCEPSecondaryExplicitRouteObjecParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPSecondaryRecordRouteObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPSvecObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv6ObjectParser;
 import org.opendaylight.protocol.pcep.parser.subobject.EROAsNumberSubobjectParser;
 import org.opendaylight.protocol.pcep.parser.subobject.EROIpv4PrefixSubobjectParser;
 import org.opendaylight.protocol.pcep.parser.subobject.EROIpv6PrefixSubobjectParser;
@@ -213,11 +216,20 @@ public final class BaseParserExtensionActivator extends AbstractPCEPExtensionPro
         regs.add(context.registerObjectParser(noPathParser));
         regs.add(context.registerObjectSerializer(NoPath.class, noPathParser));
 
+        final PCEPEndPointsObjectSerializer endpointsSerializer = new PCEPEndPointsObjectSerializer();
+        regs.add(context.registerObjectSerializer(EndpointsObj.class, endpointsSerializer));
+
         final PCEPEndPointsIpv4ObjectParser endpoints4Parser = new PCEPEndPointsIpv4ObjectParser();
-        final PCEPEndPointsIpv6ObjectParser endpoints6Parser = new PCEPEndPointsIpv6ObjectParser();
         regs.add(context.registerObjectParser(endpoints4Parser));
+
+        final PCEPEndPointsIpv6ObjectParser endpoints6Parser = new PCEPEndPointsIpv6ObjectParser();
         regs.add(context.registerObjectParser(endpoints6Parser));
-        regs.add(context.registerObjectSerializer(EndpointsObj.class, endpoints4Parser));
+
+        final PCEPP2MPEndPointsIpv4ObjectParser endpoints4Pp2mparser = new PCEPP2MPEndPointsIpv4ObjectParser();
+        regs.add(context.registerObjectParser(endpoints4Pp2mparser));
+
+        final PCEPP2MPEndPointsIpv6ObjectParser endpoints6Pp2mparser = new PCEPP2MPEndPointsIpv6ObjectParser();
+        regs.add(context.registerObjectParser(endpoints6Pp2mparser));
 
         final PCEPBandwidthObjectParser bwParser = new PCEPBandwidthObjectParser();
         final PCEPExistingBandwidthObjectParser bwExistingParser = new PCEPExistingBandwidthObjectParser();
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.pcep.parser.object;
+package org.opendaylight.protocol.pcep.parser.object.end.points;
 
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv4Address;
 
@@ -13,7 +13,6 @@ import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
-import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
@@ -21,10 +20,7 @@ import org.opendaylight.protocol.pcep.spi.UnknownObject;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4CaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObj;
@@ -35,20 +31,35 @@ import org.slf4j.LoggerFactory;
 /**
  * Parser for IPv4 {@link EndpointsObj}
  */
-public class PCEPEndPointsIpv4ObjectParser extends CommonObjectParser implements ObjectSerializer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PCEPEndPointsIpv4ObjectParser.class);
+public class PCEPEndPointsIpv4ObjectParser extends CommonObjectParser {
 
     private static final int CLASS = 4;
     private static final int TYPE = 1;
+    private static final Logger LOG = LoggerFactory.getLogger(PCEPEndPointsIpv4ObjectParser.class);
 
     public PCEPEndPointsIpv4ObjectParser() {
         super(CLASS, TYPE);
     }
 
+    public static void serializeObject(
+        final Boolean processing,
+        final Boolean ignore,
+        final Ipv4 ipv4,
+        final ByteBuf buffer) {
+        final ByteBuf body = Unpooled.buffer(Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH);
+        Preconditions.checkArgument(ipv4.getSourceIpv4Address() != null,
+            "SourceIpv4Address is mandatory.");
+        writeIpv4Address(ipv4.getSourceIpv4Address(), body);
+        Preconditions.checkArgument(ipv4.getDestinationIpv4Address() != null,
+            "DestinationIpv4Address is mandatory.");
+        writeIpv4Address(ipv4.getDestinationIpv4Address(), body);
+        ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
+    }
+
     @Override
     public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
-        Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(bytes != null && bytes.isReadable(),
+            "Array of bytes is mandatory. Can't be null or empty.");
         final EndpointsObjBuilder builder = new EndpointsObjBuilder();
         if (!header.isProcessingRule()) {
             LOG.debug("Processed bit not set on Endpoints OBJECT, ignoring it.");
@@ -65,22 +76,4 @@ public class PCEPEndPointsIpv4ObjectParser extends CommonObjectParser implements
         builder.setAddressFamily(new Ipv4CaseBuilder().setIpv4(b.build()).build());
         return builder.build();
     }
-
-    @Override
-    public void serializeObject(final Object object, final ByteBuf buffer) {
-        Preconditions.checkArgument(object instanceof EndpointsObj, "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
-        final EndpointsObj ePObj = (EndpointsObj) object;
-        final AddressFamily afi = ePObj.getAddressFamily();
-        if(afi instanceof Ipv6Case) {
-            PCEPEndPointsIpv6ObjectParser.serializeObject(object,buffer);
-        }
-        Preconditions.checkArgument(afi instanceof Ipv4Case, "Wrong instance of NetworkAddress. Passed %s. Needed IPv4", afi.getClass());
-        final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
-        final ByteBuf body = Unpooled.buffer(Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH);
-        Preconditions.checkArgument(ipv4.getSourceIpv4Address() != null, "SourceIpv4Address is mandatory.");
-        writeIpv4Address(ipv4.getSourceIpv4Address(), body);
-        Preconditions.checkArgument(ipv4.getDestinationIpv4Address() != null, "DestinationIpv4Address is mandatory.");
-        writeIpv4Address(ipv4.getDestinationIpv4Address(), body);
-        ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
-    }
-}
+}
\ No newline at end of file
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.protocol.pcep.parser.object;
+package org.opendaylight.protocol.pcep.parser.object.end.points;
 
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv6Address;
 
@@ -20,8 +20,6 @@ import org.opendaylight.protocol.pcep.spi.UnknownObject;
 import org.opendaylight.protocol.util.Ipv6Util;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6Builder;
@@ -33,20 +31,35 @@ import org.slf4j.LoggerFactory;
 /**
  * Parser for IPv6 {@link EndpointsObj}
  */
-public class PCEPEndPointsIpv6ObjectParser extends CommonObjectParser {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PCEPEndPointsIpv6ObjectParser.class);
+public final class PCEPEndPointsIpv6ObjectParser extends CommonObjectParser {
 
     private static final int CLASS = 4;
     private static final int TYPE = 2;
+    private static final Logger LOG = LoggerFactory.getLogger(PCEPEndPointsIpv6ObjectParser.class);
 
     public PCEPEndPointsIpv6ObjectParser() {
         super(CLASS, TYPE);
     }
 
+    public static void serializeObject(
+        final Boolean processing,
+        final Boolean ignore,
+        final Ipv6 ipv6,
+        final ByteBuf buffer) {
+        final ByteBuf body = Unpooled.buffer(Ipv6Util.IPV6_LENGTH + Ipv6Util.IPV6_LENGTH);
+        Preconditions.checkArgument(ipv6.getSourceIpv6Address() != null,
+            "SourceIpv6Address is mandatory.");
+        writeIpv6Address(ipv6.getSourceIpv6Address(), body);
+        Preconditions.checkArgument(ipv6.getDestinationIpv6Address() != null,
+            "DestinationIpv6Address is mandatory.");
+        writeIpv6Address(ipv6.getDestinationIpv6Address(), body);
+        ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
+    }
+
     @Override
     public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
-        Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(bytes != null && bytes.isReadable(),
+            "Array of bytes is mandatory. Can't be null or empty.");
         final EndpointsObjBuilder builder = new EndpointsObjBuilder();
         if (!header.isProcessingRule()) {
             LOG.debug("Processed bit not set on Endpoints OBJECT, ignoring it.");
@@ -63,18 +76,4 @@ public class PCEPEndPointsIpv6ObjectParser extends CommonObjectParser {
         builder.setAddressFamily(new Ipv6CaseBuilder().setIpv6(b.build()).build());
         return builder.build();
     }
-
-    public static void serializeObject(final Object object, final ByteBuf buffer) {
-        Preconditions.checkArgument(object instanceof EndpointsObj, "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
-        final EndpointsObj ePObj = (EndpointsObj) object;
-        final AddressFamily afi = ePObj.getAddressFamily();
-        Preconditions.checkArgument(afi instanceof Ipv6Case, "Wrong instance of NetworkAddress. Passed %s. Needed IPv6", afi.getClass());
-        final ByteBuf body = Unpooled.buffer(Ipv6Util.IPV6_LENGTH + Ipv6Util.IPV6_LENGTH);
-        final Ipv6 ipv6 = ((Ipv6Case) afi).getIpv6();
-        Preconditions.checkArgument(ipv6.getSourceIpv6Address() != null, "SourceIpv6Address is mandatory.");
-        writeIpv6Address(ipv6.getSourceIpv6Address(), body);
-        Preconditions.checkArgument(ipv6.getDestinationIpv6Address() != null, "DestinationIpv6Address is mandatory.");
-        writeIpv6Address(ipv6.getDestinationIpv6Address(), body);
-        ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
-    }
 }
diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsObjectSerializer.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsObjectSerializer.java
new file mode 100644 (file)
index 0000000..76c4319
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.parser.object.end.points;
+
+import com.google.common.base.Preconditions;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObj;
+
+public final class PCEPEndPointsObjectSerializer implements ObjectSerializer {
+
+    @Override
+    public void serializeObject(final Object object, final ByteBuf buffer) {
+        Preconditions.checkArgument(object instanceof EndpointsObj,
+            "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
+        final EndpointsObj ePObj = (EndpointsObj) object;
+        final AddressFamily afi = ePObj.getAddressFamily();
+        final Boolean processing = object.isProcessingRule();
+        final Boolean ignore = object.isIgnore();
+        if (afi instanceof Ipv6Case) {
+            final Ipv6 ipv6 = ((Ipv6Case) afi).getIpv6();
+            PCEPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
+        } else if (afi instanceof Ipv4Case) {
+            final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
+            PCEPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
+        } else if (afi instanceof P2mpIpv4Case) {
+            final P2mpIpv4 ipv4 = ((P2mpIpv4Case) afi).getP2mpIpv4();
+            PCEPP2MPEndPointsIpv4ObjectParser.serializeObject(processing, ignore, ipv4, buffer);
+        } else if (afi instanceof P2mpIpv6Case) {
+            final P2mpIpv6 ipv6 = ((P2mpIpv6Case) afi).getP2mpIpv6();
+            PCEPP2MPEndPointsIpv6ObjectParser.serializeObject(processing, ignore, ipv6, buffer);
+        }
+    }
+}
+
diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java
new file mode 100644 (file)
index 0000000..6eb97d8
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.parser.object.end.points;
+
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv4Address;
+
+import com.google.common.base.Preconditions;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
+import org.opendaylight.protocol.pcep.spi.ObjectUtil;
+import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
+import org.opendaylight.protocol.util.Ipv4Util;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.P2mpLeaves;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObjBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PCEPP2MPEndPointsIpv4ObjectParser extends CommonObjectParser {
+    private static final int CLASS = 4;
+    private static final int TYPE = 3;
+    private static final int LEAF_TYPE_SIZE = 32;
+    private static final Logger LOG = LoggerFactory.getLogger(PCEPP2MPEndPointsIpv4ObjectParser.class);
+
+    public PCEPP2MPEndPointsIpv4ObjectParser() {
+        super(CLASS, TYPE);
+    }
+
+    public static void serializeObject(
+        final Boolean processing,
+        final Boolean ignore,
+        final P2mpIpv4 p2mpIpv4,
+        final ByteBuf buffer) {
+        final List<Ipv4AddressNoZone> dest = p2mpIpv4.getDestinationIpv4Address();
+        Preconditions.checkArgument(dest != null, "DestinationIpv4Address is mandatory.");
+        final ByteBuf body = Unpooled.buffer(LEAF_TYPE_SIZE + Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH * dest.size());
+        Preconditions.checkArgument(p2mpIpv4.getSourceIpv4Address() != null,
+            "SourceIpv4Address is mandatory.");
+        body.writeInt(p2mpIpv4.getP2mpLeaves().getIntValue());
+        writeIpv4Address(p2mpIpv4.getSourceIpv4Address(), body);
+        dest.forEach(ipv4 -> writeIpv4Address(ipv4, body));
+        ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
+    }
+
+    @Override
+    public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
+        Preconditions.checkArgument(bytes != null && bytes.isReadable(),
+            "Array of bytes is mandatory. Can't be null or empty.");
+        final EndpointsObjBuilder builder = new EndpointsObjBuilder();
+        if (!header.isProcessingRule()) {
+            LOG.debug("Processed bit not set on Endpoints OBJECT, ignoring it.");
+            return new UnknownObject(PCEPErrors.P_FLAG_NOT_SET, builder.build());
+        }
+        if (bytes.readableBytes() % Ipv4Util.IP4_LENGTH != 0) {
+            throw new PCEPDeserializerException("Wrong length of array of bytes.");
+        }
+        builder.setIgnore(header.isIgnore());
+        builder.setProcessingRule(header.isProcessingRule());
+        final P2mpIpv4Builder p2mpIpv4Builder = new P2mpIpv4Builder();
+        p2mpIpv4Builder.setP2mpLeaves(P2mpLeaves.forValue(bytes.readInt()));
+        p2mpIpv4Builder.setSourceIpv4Address(Ipv4Util.noZoneAddressForByteBuf(bytes));
+        List<Ipv4AddressNoZone> dest = new ArrayList<>();
+        while (bytes.isReadable()) {
+            dest.add(Ipv4Util.noZoneAddressForByteBuf(bytes));
+        }
+        p2mpIpv4Builder.setDestinationIpv4Address(dest);
+        builder.setAddressFamily(new P2mpIpv4CaseBuilder().setP2mpIpv4(p2mpIpv4Builder.build()).build());
+        return builder.build();
+    }
+}
diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java
new file mode 100644 (file)
index 0000000..00797d8
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.pcep.parser.object.end.points;
+
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv6Address;
+
+import com.google.common.base.Preconditions;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
+import org.opendaylight.protocol.pcep.spi.ObjectUtil;
+import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
+import org.opendaylight.protocol.util.Ipv6Util;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.P2mpLeaves;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObjBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PCEPP2MPEndPointsIpv6ObjectParser extends CommonObjectParser {
+    private static final int CLASS = 4;
+    private static final int TYPE = 4;
+    private static final int LEAF_TYPE_SIZE = 32;
+    private static final Logger LOG = LoggerFactory.getLogger(PCEPP2MPEndPointsIpv6ObjectParser.class);
+
+    public PCEPP2MPEndPointsIpv6ObjectParser() {
+        super(CLASS, TYPE);
+    }
+
+    public static void serializeObject(
+        final Boolean processing,
+        final Boolean ignore,
+        final P2mpIpv6 p2mpIpv6,
+        final ByteBuf buffer) {
+        final List<Ipv6AddressNoZone> dest = p2mpIpv6.getDestinationIpv6Address();
+        Preconditions.checkArgument(dest != null, "DestinationIpv6Address is mandatory.");
+        final ByteBuf body = Unpooled.buffer(LEAF_TYPE_SIZE + Ipv6Util.IPV6_LENGTH + Ipv6Util.IPV6_LENGTH * dest.size());
+        Preconditions.checkArgument(p2mpIpv6.getSourceIpv6Address() != null,
+            "SourceIpv6Address is mandatory.");
+        body.writeInt(p2mpIpv6.getP2mpLeaves().getIntValue());
+        writeIpv6Address(p2mpIpv6.getSourceIpv6Address(), body);
+        dest.forEach(ipv6 -> writeIpv6Address(ipv6, body));
+        ObjectUtil.formatSubobject(TYPE, CLASS, processing, ignore, body, buffer);
+    }
+
+    @Override
+    public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
+        Preconditions.checkArgument(bytes != null && bytes.isReadable(),
+            "Array of bytes is mandatory. Can't be null or empty.");
+        final EndpointsObjBuilder builder = new EndpointsObjBuilder();
+        if (!header.isProcessingRule()) {
+            LOG.debug("Processed bit not set on Endpoints OBJECT, ignoring it.");
+            return new UnknownObject(PCEPErrors.P_FLAG_NOT_SET, builder.build());
+        }
+        if (bytes.readableBytes() % Ipv6Util.IPV6_LENGTH != 4) {
+            throw new PCEPDeserializerException("Wrong length of array of bytes.");
+        }
+        builder.setIgnore(header.isIgnore());
+        builder.setProcessingRule(header.isProcessingRule());
+        final P2mpIpv6Builder p2mpIpv6Builder = new P2mpIpv6Builder();
+        p2mpIpv6Builder.setP2mpLeaves(P2mpLeaves.forValue(bytes.readInt()));
+        p2mpIpv6Builder.setSourceIpv6Address(Ipv6Util.noZoneAddressForByteBuf(bytes));
+        List<Ipv6AddressNoZone> dest = new ArrayList<>();
+        while (bytes.isReadable()) {
+            dest.add(Ipv6Util.noZoneAddressForByteBuf(bytes));
+        }
+        p2mpIpv6Builder.setDestinationIpv6Address(dest);
+        builder.setAddressFamily(new P2mpIpv6CaseBuilder().setP2mpIpv6(p2mpIpv6Builder.build()).build());
+        return builder.build();
+    }
+}
index 1675321131c490d92e08c4297701386674e478f4..bdb239a1a46e66151ebdbf77500b8a7e4047eb44 100644 (file)
@@ -19,6 +19,7 @@ import com.google.common.primitives.UnsignedBytes;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,8 +28,6 @@ import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
 import org.opendaylight.protocol.pcep.parser.object.PCEPBandwidthObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPClassTypeObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPCloseObjectParser;
-import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv4ObjectParser;
-import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv6ObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPErrorObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPExcludeRouteObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPExistingBandwidthObjectParser;
@@ -53,6 +52,11 @@ import org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPReportedRouteObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectParser;
 import org.opendaylight.protocol.pcep.parser.object.PCEPSvecObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsObjectSerializer;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv6ObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
@@ -74,6 +78,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ClassType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.OfId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.P2mpLeaves;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ProtocolVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.RequestId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.BandwidthBuilder;
@@ -81,8 +86,12 @@ 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.rev181109.close.object.CCloseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv4CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.P2mpIpv6CaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv4._case.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.ipv6._case.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv4._case.P2mpIpv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.p2mp.ipv6._case.P2mpIpv6Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.object.EndpointsObjBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.XroBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
@@ -230,7 +239,7 @@ public class PCEPObjectParserTest {
         builder.setProcessingRule(true);
         builder.setIgnore(false);
         builder.setMaxLsp((short) UnsignedBytes.toInt((byte) 0xf1));
-        builder.setMinBandwidth(new Bandwidth(new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}));
+        builder.setMinBandwidth(new Bandwidth(new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
@@ -261,16 +270,16 @@ public class PCEPObjectParserTest {
         builder.setIgnore(false);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject> subs = Lists.newArrayList();
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder().setLoose(
-            true).setSubobjectType(
-            new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0xffffL)).build()).build()).build());
+                true).setSubobjectType(
+                        new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0xffffL)).build()).build()).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder().setLoose(
-            true).setSubobjectType(
-            new IpPrefixCaseBuilder().setIpPrefix(
-                new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/32"))).build()).build()).build());
+                true).setSubobjectType(
+                        new IpPrefixCaseBuilder().setIpPrefix(
+                                new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/32"))).build()).build()).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder().setLoose(
-            true).setSubobjectType(
-            new UnnumberedCaseBuilder().setUnnumbered(
-                new UnnumberedBuilder().setRouterId(0xffffffffL).setInterfaceId(0xffffffffL).build()).build()).build());
+                true).setSubobjectType(
+                        new UnnumberedCaseBuilder().setUnnumbered(
+                                new UnnumberedBuilder().setRouterId(0xffffffffL).setInterfaceId(0xffffffffL).build()).build()).build());
         builder.setSubobject(subs);
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
@@ -290,24 +299,24 @@ public class PCEPObjectParserTest {
     public void testIRObject() throws Exception {
         final PCEPIncludeRouteObjectParser parser = new PCEPIncludeRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin"));
-        final byte[] ip6PrefixBytes = {(byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
+        final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
 
         final IroBuilder builder = new IroBuilder();
         builder.setProcessingRule(false);
         builder.setIgnore(false);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.iro.Subobject> subs = Lists.newArrayList();
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.iro.SubobjectBuilder().setSubobjectType(
-            new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x10L)).build()).build()).setLoose(true).build());
+                new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x10L)).build()).build()).setLoose(true).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.iro.SubobjectBuilder().setSubobjectType(
-            new IpPrefixCaseBuilder().setIpPrefix(
-                new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("18.52.80.0/21"))).build()).build()).setLoose(true).build());
+                new IpPrefixCaseBuilder().setIpPrefix(
+                        new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("18.52.80.0/21"))).build()).build()).setLoose(true).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.iro.SubobjectBuilder().setSubobjectType(
-            new IpPrefixCaseBuilder().setIpPrefix(
-                new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).build()).setLoose(true).build());
+                new IpPrefixCaseBuilder().setIpPrefix(
+                        new IpPrefixBuilder().setIpPrefix(new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).build()).setLoose(true).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.iro.SubobjectBuilder().setSubobjectType(
-            new UnnumberedCaseBuilder().setUnnumbered(
-                new UnnumberedBuilder().setRouterId(0x1245678L).setInterfaceId(0x9abcdef0L).build()).build()).setLoose(true).build());
+                new UnnumberedCaseBuilder().setUnnumbered(
+                        new UnnumberedBuilder().setRouterId(0x1245678L).setInterfaceId(0x9abcdef0L).build()).build()).setLoose(true).build());
         builder.setSubobject(subs);
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
@@ -333,28 +342,28 @@ public class PCEPObjectParserTest {
     public void testRRObject() throws Exception {
         final PCEPReportedRouteObjectParser parser = new PCEPReportedRouteObjectParser(this.ctx.getRROSubobjectHandlerRegistry());
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin"));
-        final byte[] ip6PrefixBytes = {(byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
+        final byte[] ip6PrefixBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
 
         final RroBuilder builder = new RroBuilder();
         builder.setProcessingRule(false);
         builder.setIgnore(false);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject> subs = Lists.newArrayList();
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder().setSubobjectType(
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder().setIpPrefix(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder().setIpPrefix(
-                    new IpPrefix(new Ipv4Prefix("255.255.255.255/32"))).build()).build()).setProtectionAvailable(false).setProtectionInUse(
-            false).build());
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder().setIpPrefix(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder().setIpPrefix(
+                                new IpPrefix(new Ipv4Prefix("255.255.255.255/32"))).build()).build()).setProtectionAvailable(false).setProtectionInUse(
+                                        false).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder().setSubobjectType(
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder().setIpPrefix(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder().setIpPrefix(
-                    new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).build()).setProtectionAvailable(false).setProtectionInUse(
-            false).build());
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder().setIpPrefix(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder().setIpPrefix(
+                                new IpPrefix(Ipv6Util.prefixForBytes(ip6PrefixBytes, 22))).build()).build()).setProtectionAvailable(false).setProtectionInUse(
+                                        false).build());
         subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder().setSubobjectType(
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCaseBuilder().setUnnumbered(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder().setRouterId(
-                    0x1245678L).setInterfaceId(0x9abcdef0L).build()).build()).setProtectionAvailable(false).setProtectionInUse(
-            false).build());
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCaseBuilder().setUnnumbered(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder().setRouterId(
+                                0x1245678L).setInterfaceId(0x9abcdef0L).build()).build()).setProtectionAvailable(false).setProtectionInUse(
+                                        false).build());
         builder.setSubobject(subs);
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
@@ -384,7 +393,7 @@ public class PCEPObjectParserTest {
         final BandwidthBuilder builder = new BandwidthBuilder();
         builder.setProcessingRule(true);
         builder.setIgnore(true);
-        builder.setBandwidth(new Bandwidth(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));
+        builder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
@@ -415,7 +424,7 @@ public class PCEPObjectParserTest {
             .ns.yang.pcep.types.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder();
         builder.setProcessingRule(true);
         builder.setIgnore(true);
-        builder.setBandwidth(new Bandwidth(new byte[]{(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}));
+        builder.setBandwidth(new Bandwidth(new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
@@ -438,22 +447,70 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testEndPointsObjectIPv4() throws IOException, PCEPDeserializerException {
-        final byte[] srcIPBytes = {(byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E};
-        final byte[] destIPBytes = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+        final byte[] srcIPBytes = { (byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E };
+        final byte[] destIPBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
 
         final PCEPEndPointsIpv4ObjectParser parser = new PCEPEndPointsIpv4ObjectParser();
-        final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPEndPointsObject1IPv4.bin"));
+        final ByteBuf result
+            = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPEndPointsObject1IPv4.bin"));
 
         final EndpointsObjBuilder builder = new EndpointsObjBuilder();
         builder.setProcessingRule(true);
         builder.setIgnore(false);
         builder.setAddressFamily(new Ipv4CaseBuilder().setIpv4(
-            new Ipv4Builder().setSourceIpv4Address(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv4Address(
+            new Ipv4Builder().setSourceIpv4Address(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes)))
+                .setDestinationIpv4Address(
                 Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
 
-        assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
+        assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false),
+            result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
-        parser.serializeObject(builder.build(), buf);
+        final PCEPEndPointsObjectSerializer serializer = new PCEPEndPointsObjectSerializer();
+        serializer.serializeObject(builder.build(), buf);
+        assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
+
+        try {
+            parser.parseObject(new ObjectHeaderImpl(true, true), null);
+            fail();
+        } catch (final IllegalArgumentException e) {
+            assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
+            fail();
+        } catch (final IllegalArgumentException e) {
+            assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+
+    @Test
+    public void testEndPointsObjectP2MPIPv4() throws PCEPDeserializerException {
+        final byte[] srcIPBytes = { (byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E };
+        final byte[] destIPBytes = {
+            (byte) 0x04, (byte) 0x32, (byte) 0x00, (byte) 0x14,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
+            (byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+            (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFC};
+
+        final PCEPP2MPEndPointsIpv4ObjectParser parser = new PCEPP2MPEndPointsIpv4ObjectParser();
+        final ByteBuf result = Unpooled.wrappedBuffer(destIPBytes);
+
+        final EndpointsObjBuilder builder = new EndpointsObjBuilder();
+        builder.setProcessingRule(true);
+        builder.setIgnore(false);
+        builder.setAddressFamily(new P2mpIpv4CaseBuilder().setP2mpIpv4(new P2mpIpv4Builder()
+                .setP2mpLeaves(P2mpLeaves.NewLeavesToAdd)
+                .setSourceIpv4Address(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes)))
+                .setDestinationIpv4Address(Arrays.asList(new Ipv4AddressNoZone("255.255.255.255"),
+                        new Ipv4AddressNoZone("255.255.255.252"))).build()).build());
+
+        assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false),
+            result.slice(4, result.readableBytes() - 4)));
+        final ByteBuf buf = Unpooled.buffer();
+        final PCEPEndPointsObjectSerializer serializer = new PCEPEndPointsObjectSerializer();
+        serializer.serializeObject(builder.build(), buf);
         assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
 
         try {
@@ -472,10 +529,10 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testEndPointsObjectIPv6() throws IOException, PCEPDeserializerException {
-        final byte[] destIPBytes = {(byte) 0x00, (byte) 0x02, (byte) 0x5D, (byte) 0xD2, (byte) 0xFF, (byte) 0xEC, (byte) 0xA1,
-            (byte) 0xB6, (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,};
-        final byte[] srcIPBytes = {(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};
+        final byte[] destIPBytes = { (byte) 0x00, (byte) 0x02, (byte) 0x5D, (byte) 0xD2, (byte) 0xFF, (byte) 0xEC, (byte) 0xA1,
+            (byte) 0xB6, (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, };
+        final byte[] srcIPBytes = { (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 };
 
         final PCEPEndPointsIpv6ObjectParser parser = new PCEPEndPointsIpv6ObjectParser();
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPEndPointsObject2IPv6.bin"));
@@ -484,12 +541,67 @@ public class PCEPObjectParserTest {
         builder.setProcessingRule(true);
         builder.setIgnore(false);
         builder.setAddressFamily(new Ipv6CaseBuilder().setIpv6(
-            new Ipv6Builder().setSourceIpv6Address(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv6Address(
-                Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
+                new Ipv6Builder().setSourceIpv6Address(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv6Address(
+                        Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
-        PCEPEndPointsIpv6ObjectParser.serializeObject(builder.build(), buf);
+        final PCEPEndPointsObjectSerializer serializer = new PCEPEndPointsObjectSerializer();
+        serializer.serializeObject(builder.build(), buf);
+        assertArrayEquals(result.array(),ByteArray.getAllBytes(buf));
+
+        try {
+            parser.parseObject(new ObjectHeaderImpl(true, true), null);
+            fail();
+        } catch (final IllegalArgumentException e) {
+            assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+        try {
+            parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
+            fail();
+        } catch (final IllegalArgumentException e) {
+            assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEndPointsObjectP2MPIPv6() throws IOException, PCEPDeserializerException {
+        final byte[] destIPBytes = {
+            (byte) 0x04, (byte) 0x42, (byte) 0x00, (byte) 0x38,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
+            (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) 0x00, (byte) 0x02, (byte) 0x5D, (byte) 0xD2,
+            (byte) 0xFF, (byte) 0xEC, (byte) 0xA1, (byte) 0xB6,
+            (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x03, (byte) 0x5D, (byte) 0xD2,
+            (byte) 0xFF, (byte) 0xEC, (byte) 0xA1, (byte) 0xB6,
+            (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        };
+        final byte[] srcIPBytes = { (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 };
+
+        final PCEPP2MPEndPointsIpv6ObjectParser parser = new PCEPP2MPEndPointsIpv6ObjectParser();
+        final ByteBuf result = Unpooled.wrappedBuffer(destIPBytes);
+
+        final EndpointsObjBuilder builder = new EndpointsObjBuilder();
+        builder.setProcessingRule(true);
+        builder.setIgnore(false);
+        builder.setAddressFamily(new P2mpIpv6CaseBuilder().setP2mpIpv6(new P2mpIpv6Builder()
+                .setP2mpLeaves(P2mpLeaves.NewLeavesToAdd)
+                .setSourceIpv6Address(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes)))
+                .setDestinationIpv6Address(Arrays.asList(
+                        new Ipv6AddressNoZone("2:5dd2:ffec:a1b6:581e:9f50::"),
+                        new Ipv6AddressNoZone("3:5dd2:ffec:a1b6:581e:9f50::")
+                )).build()).build());
+
+        assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false),
+            result.slice(4, result.readableBytes() - 4)));
+        final ByteBuf buf = Unpooled.buffer();
+        final PCEPEndPointsObjectSerializer serializer = new PCEPEndPointsObjectSerializer();
+        serializer.serializeObject(builder.build(), buf);
         assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
 
         try {
@@ -607,7 +719,7 @@ public class PCEPObjectParserTest {
         builder.setComputed(false);
         builder.setBound(false);
         builder.setMetricType((short) 1);
-        builder.setValue(new Float32(new byte[]{0, 0, 0, 0}));
+        builder.setValue(new Float32(new byte[] { 0, 0, 0, 0 }));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         ByteBuf buf = Unpooled.buffer();
@@ -619,7 +731,7 @@ public class PCEPObjectParserTest {
         builder.setComputed(true);
         builder.setBound(false);
         builder.setMetricType((short) 2);
-        builder.setValue(new Float32(new byte[]{(byte) 0x4f, (byte) 0x70, (byte) 0x00, (byte) 0x00}));
+        builder.setValue(new Float32(new byte[] { (byte) 0x4f, (byte) 0x70, (byte) 0x00, (byte) 0x00 }));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         buf = Unpooled.buffer();
@@ -665,7 +777,7 @@ public class PCEPObjectParserTest {
         final NoPathVectorBuilder b = new NoPathVectorBuilder();
         b.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags(false, true, false, true, false, true, true, true));
         builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder().setNoPathVector(
-            b.build()).build());
+                b.build()).build());
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         buf = Unpooled.buffer();
@@ -700,14 +812,14 @@ public class PCEPObjectParserTest {
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         ByteBuf buf = Unpooled.buffer();
         parser.serializeObject(builder.build(), buf);
-        assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
+        assertArrayEquals(result.array(),ByteArray.getAllBytes(buf));
 
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPNotificationObject1WithTlv.bin"));
 
         builder.setType((short) 2);
         builder.setValue((short) 1);
         builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.notification.object.c.notification.TlvsBuilder().setOverloadDuration(
-            new OverloadDurationBuilder().setDuration(0xff0000a2L).build()).build());
+                new OverloadDurationBuilder().setDuration(0xff0000a2L).build()).build());
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         buf = Unpooled.buffer();
@@ -753,7 +865,7 @@ public class PCEPObjectParserTest {
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         ByteBuf buf = Unpooled.buffer();
         parser.serializeObject(builder.build(), buf);
-        assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
+        assertArrayEquals(result.array(),ByteArray.getAllBytes(buf));
 
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPRPObject2.bin"));
 
@@ -766,7 +878,7 @@ public class PCEPObjectParserTest {
         b.setSetup(1L);
 
         builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp.object.rp.TlvsBuilder().setOrder(
-            b.build()).build());
+                b.build()).build());
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, true), result.slice(4, result.readableBytes() - 4)));
         buf = Unpooled.buffer();
@@ -847,7 +959,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testClassTypeObject() throws PCEPDeserializerException {
         final PCEPClassTypeObjectParser parser = new PCEPClassTypeObjectParser();
-        final ByteBuf result = Unpooled.wrappedBuffer(new byte[]{(byte) 0x16, (byte) 0x12, (byte) 0x00, (byte) 0x08, 0, 0, 0, (byte) 0x04});
+        final ByteBuf result = Unpooled.wrappedBuffer(new byte[] { (byte) 0x16, (byte) 0x12, (byte) 0x00, (byte) 0x08, 0, 0, 0, (byte) 0x04 });
 
         final ClassTypeBuilder builder = new ClassTypeBuilder();
         builder.setProcessingRule(true);
@@ -884,11 +996,11 @@ public class PCEPObjectParserTest {
         builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.Xro.Flags(true));
         final List<Subobject> subs = Lists.newArrayList();
         subs.add(new SubobjectBuilder().setMandatory(true).setSubobjectType(
-            new IpPrefixCaseBuilder().setIpPrefix(
-                new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("192.168.0.0/16"))).build()).build()).setAttribute(
-            Attribute.Node).build());
+                new IpPrefixCaseBuilder().setIpPrefix(
+                        new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("192.168.0.0/16"))).build()).build()).setAttribute(
+                                Attribute.Node).build());
         subs.add(new SubobjectBuilder().setMandatory(false).setSubobjectType(
-            new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x1234L)).build()).build()).build());
+                new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new AsNumber(0x1234L)).build()).build()).build());
         builder.setSubobject(subs);
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
@@ -920,7 +1032,7 @@ public class PCEPObjectParserTest {
         builder.setIgnore(false);
         final List<PathKeys> list = Lists.newArrayList();
         list.add(new PathKeysBuilder().setLoose(true).setPathKey(new PathKey(0x1234)).setPceId(
-            new PceId(new byte[]{(byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00})).build());
+                new PceId(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 })).build());
         builder.setPathKeys(list);
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
@@ -1074,7 +1186,7 @@ public class PCEPObjectParserTest {
 
         final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
         final VendorInformationTlv viTlv = new VendorInformationTlvBuilder().setEnterpriseNumber(new EnterpriseNumber(0L))
-            .setEnterpriseSpecificInformation(esInfo).build();
+                .setEnterpriseSpecificInformation(esInfo).build();
         final CCloseBuilder builder = new CCloseBuilder();
         builder.setProcessingRule(false);
         builder.setIgnore(false);
@@ -1102,7 +1214,7 @@ public class PCEPObjectParserTest {
         final TestVendorInformationObjectParser parser = new TestVendorInformationObjectParser();
         final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
         final VendorInformationObject viObj = new VendorInformationObjectBuilder().setEnterpriseNumber(new EnterpriseNumber(0L))
-            .setEnterpriseSpecificInformation(esInfo).build();
+                .setEnterpriseSpecificInformation(esInfo).build();
         final ByteBuf result = Unpooled.wrappedBuffer(viObjBytes);
         result.readerIndex(8);
         final VendorInformationObject o = (VendorInformationObject) parser.parseObject(new ObjectHeaderImpl(false, false), result.readSlice(result.readableBytes()));
@@ -1183,7 +1295,7 @@ public class PCEPObjectParserTest {
         };
         final PCEPPceIdIPv4ObjectParser parser = new PCEPPceIdIPv4ObjectParser();
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId pceId = new PceIdBuilder().setIpAddress(new IpAddressNoZone(
-            new Ipv4AddressNoZone("127.0.0.1"))).build();
+                new Ipv4AddressNoZone("127.0.0.1"))).build();
         final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
         assertEquals(pceId, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
 
@@ -1205,7 +1317,7 @@ public class PCEPObjectParserTest {
         };
         final PCEPPceIdIPv6ObjectParser parser = new PCEPPceIdIPv6ObjectParser();
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pce.id.object.PceId pccIdReq = new PceIdBuilder().setIpAddress(new IpAddressNoZone(
-            new Ipv6AddressNoZone("::1"))).build();
+                new Ipv6AddressNoZone("::1"))).build();
         final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
         assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
 
@@ -1269,10 +1381,10 @@ public class PCEPObjectParserTest {
     @Test
     public void testRpObjectWithPstTlvParser() throws PCEPDeserializerException {
 
-        final byte[] rpObjectWithPstTlvBytes = {0x2, 0x10, 0x0, 0x14, 0x0, 0x0, 0x4, 0x2d, (byte) 0xde,
+        final byte[] rpObjectWithPstTlvBytes = { 0x2, 0x10, 0x0, 0x14, 0x0, 0x0, 0x4, 0x2d, (byte) 0xde,
             (byte) 0xad, (byte) 0xbe, (byte) 0xef,
             /* pst-tlv */
-            0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0};
+            0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
 
         final PCEPRequestParameterObjectParser parser = new PCEPRequestParameterObjectParser(this.tlvRegistry, this.viTlvRegistry);
         final RpBuilder builder = new RpBuilder();
@@ -1291,11 +1403,11 @@ public class PCEPObjectParserTest {
         builder.setPriority((short) 5);
         builder.setRequestId(new RequestId(0xdeadbeefL));
         builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp.object.rp.TlvsBuilder().setPathSetupType(
-            new PathSetupTypeBuilder().setPst((short) 0).build()).build());
+                new PathSetupTypeBuilder().setPst((short) 0).build()).build());
 
         final ByteBuf result = Unpooled.wrappedBuffer(rpObjectWithPstTlvBytes);
         assertEquals(builder.build(),
-            parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
+                parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
         final ByteBuf buf = Unpooled.buffer();
         parser.serializeObject(builder.build(), buf);
         assertArrayEquals(rpObjectWithPstTlvBytes, ByteArray.getAllBytes(buf));
index 8f747871640eeb94e077f11e1f90a6c3c591a9ff..06e351defd3dfe32df9ab5185a2a0011a8729258 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.pcc.mock;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv4ObjectParser;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;