BUG-45 : migrated AsNumber to generated source code. 45/1345/1
authorDana Kutenicsova <dkutenic@cisco.com>
Mon, 23 Sep 2013 12:29:52 +0000 (14:29 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Mon, 23 Sep 2013 12:29:52 +0000 (14:29 +0200)
Change-Id: I281d02cafbf446f9b8f4cdd66b310b679adab69b
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
51 files changed:
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/ASPath.java
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/ASSpecificExtendedCommunity.java
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/Community.java
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/RouteOriginCommunity.java
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/RouteTargetCommunity.java
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/ASPathTest.java
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/ASSpecificExtendedCommunityTest.java
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/CommunityTest.java
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/RouteOriginCommunityTest.java
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/RouteTargetCommunityTest.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/NodeIdentifier.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/NodeIdentifierFactory.java
bgp/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/NodeIdentifierTest.java
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/message/BGPOpenMessage.java
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/AS4BytesCapability.java
bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPOpenMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathSegmentParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunitiesParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/PathAttributeParser.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java
bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionProposalImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/BGPSessionPreferences.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/Main.java
bgp/testtool/src/test/java/org/opendaylight/protocol/bgp/testtool/BGPSpeakerMock.java
bgp/util/src/test/java/org/opendaylight/protocol/bgp/util/PrefixTest.java
concepts/src/main/java/org/opendaylight/protocol/concepts/ASNumber.java [deleted file]
concepts/src/test/java/org/opendaylight/protocol/concepts/ASNumberTest.java
pcep/api/src/main/java/org/opendaylight/protocol/pcep/subobject/EROAsNumberSubobject.java
pcep/api/src/main/java/org/opendaylight/protocol/pcep/subobject/RROAsNumberSubobject.java
pcep/api/src/main/java/org/opendaylight/protocol/pcep/subobject/XROAsNumberSubobject.java
pcep/api/src/main/yang/rsvp.yang
pcep/api/src/test/java/org/opendaylight/protocol/pcep/api/APITest.java
pcep/api/src/test/java/org/opendaylight/protocol/pcep/api/ObjectsTest.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/EROAsNumberSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/RROAsNumberSubobjectParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/subobject/XROAsNumberSubobjectParser.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/CompositeTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPSubobjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPXROSubobjectParserTest.java
util/src/main/java/org/opendaylight/protocol/util/ByteArray.java

index 0f527b5d60ecf54d162b327580ed942b98cbc887..a900489cca344513bff0000cc0b7b86b95765414 100644 (file)
@@ -12,7 +12,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
@@ -29,8 +30,8 @@ public final class ASPath implements Serializable {
         */
        public static final ASPath EMPTY = new ASPath();
        private static final long serialVersionUID = 7951172606939897308L;
-       private final Set<ASNumber> aggregatedAsPath;
-       private final List<ASNumber> visibleAsPath;
+       private final Set<AsNumber> aggregatedAsPath;
+       private final List<AsNumber> visibleAsPath;
 
        private ASPath() {
                this.visibleAsPath = Collections.emptyList();
@@ -43,7 +44,7 @@ public final class ASPath implements Serializable {
         * @param visibleAsPath Ordered list of AS numbers in the path, corresponding to the concatenation of all
         *        AS_SEQUENCE components.
         */
-       public ASPath(final List<ASNumber> visibleAsPath) {
+       public ASPath(final List<AsNumber> visibleAsPath) {
                this.aggregatedAsPath = Collections.emptySet();
                this.visibleAsPath = Collections.unmodifiableList(Preconditions.checkNotNull(visibleAsPath));
        }
@@ -56,7 +57,7 @@ public final class ASPath implements Serializable {
         * @param aggregatedAsPath Unordered set of AS numbers in the path, corresponding to the concatenation of all AS_SET
         *        components.
         */
-       public ASPath(final List<ASNumber> visibleAsPath, final Set<ASNumber> aggregatedAsPath) {
+       public ASPath(final List<AsNumber> visibleAsPath, final Set<AsNumber> aggregatedAsPath) {
                Preconditions.checkNotNull(aggregatedAsPath);
                Preconditions.checkNotNull(visibleAsPath);
                this.aggregatedAsPath = Collections.unmodifiableSet(aggregatedAsPath);
@@ -70,7 +71,7 @@ public final class ASPath implements Serializable {
         * 
         * @return Ordered list of AS numbers.
         */
-       public List<ASNumber> getVisibleAsPath() {
+       public List<AsNumber> getVisibleAsPath() {
                return this.visibleAsPath;
        }
 
@@ -79,7 +80,7 @@ public final class ASPath implements Serializable {
         * 
         * @return Unordered set of AS numbers.
         */
-       public Set<ASNumber> getAggregatedAsPath() {
+       public Set<AsNumber> getAggregatedAsPath() {
                return this.aggregatedAsPath;
        }
 
index bbefef05e436a6bc84ca70cf9c63d00580ad9464..88acad30583eda6ad649a66981df34f4d0a6c270 100644 (file)
@@ -9,7 +9,8 @@ package org.opendaylight.protocol.bgp.concepts;
 
 import java.io.Serializable;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
 
@@ -19,7 +20,7 @@ import com.google.common.base.Preconditions;
  */
 public class ASSpecificExtendedCommunity extends ExtendedCommunity implements Serializable {
        private static final long serialVersionUID = 6490173838144366385L;
-       private final ASNumber globalAdmin;
+       private final AsNumber globalAdmin;
        private final byte[] localAdmin;
        private final int subType;
 
@@ -31,7 +32,7 @@ public class ASSpecificExtendedCommunity extends ExtendedCommunity implements Se
         * @param globalAdmin Globally-assigned namespace (AS number)
         * @param localAdmin Locally-assigned value, has to be 4 bytes long
         */
-       public ASSpecificExtendedCommunity(final boolean transitive, final int subType, final ASNumber globalAdmin, final byte[] localAdmin) {
+       public ASSpecificExtendedCommunity(final boolean transitive, final int subType, final AsNumber globalAdmin, final byte[] localAdmin) {
                super(false, transitive);
                Preconditions.checkArgument(subType > 0 && subType < 255, "Invalid Sub-Type");
                Preconditions.checkArgument(localAdmin.length == 4, "Invalid Local Administrator");
@@ -50,7 +51,7 @@ public class ASSpecificExtendedCommunity extends ExtendedCommunity implements Se
        /**
         * @return Globally-assigned namespace
         */
-       public final ASNumber getGlobalAdmin() {
+       public final AsNumber getGlobalAdmin() {
                return this.globalAdmin;
        }
 
index b8ce214b084c270139b1b264f38a81aa99141f8b..f18496861e9d2335178ccfde5accebddaf341c5d 100644 (file)
@@ -9,7 +9,8 @@ package org.opendaylight.protocol.bgp.concepts;
 
 import java.io.Serializable;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.base.Preconditions;
 
 /**
@@ -22,24 +23,24 @@ public final class Community implements Serializable {
         * advertised outside a BGP confederation boundary (a stand-alone autonomous system that is not part of a
         * confederation should be considered a confederation itself).
         */
-       public static final Community NO_EXPORT = new Community(new ASNumber(0xFFFF), 0xFF01);
+       public static final Community NO_EXPORT = new Community(new AsNumber((long) 0xFFFF), 0xFF01);
        /**
         * NO_ADVERTISE community. All routes received carrying a communities attribute containing this value MUST NOT be
         * advertised to other BGP peers.
         */
-       public static final Community NO_ADVERTISE = new Community(new ASNumber(0xFFFF), 0xFF02);
+       public static final Community NO_ADVERTISE = new Community(new AsNumber((long) 0xFFFF), 0xFF02);
        /**
         * NO_EXPORT_SUBCONFED community. All routes received carrying a communities attribute containing this value MUST
         * NOT be advertised to external BGP peers (this includes peers in other members autonomous systems inside a BGP
         * confederation).
         */
-       public static final Community NO_EXPORT_SUBCONFED = new Community(new ASNumber(0xFFFF), 0xFF03);
+       public static final Community NO_EXPORT_SUBCONFED = new Community(new AsNumber((long) 0xFFFF), 0xFF03);
 
        private static final long serialVersionUID = -944853598551415685L;
 
        private final int semantics;
 
-       private final ASNumber as;
+       private final AsNumber as;
 
        /**
         * Create a new community tag for a particular AS number and semantics.
@@ -47,8 +48,7 @@ public final class Community implements Serializable {
         * @param as Global semantics namespace identifier (usually the tagging Autonomous System)
         * @param semantics Sematics identifier (specific meaning defined externally by the namespace)
         */
-       public Community(final ASNumber as, final int semantics) {
-               Preconditions.checkArgument(as.getHighValue() == 0, "Invalid AS number specified");
+       public Community(final AsNumber as, final int semantics) {
                Preconditions.checkArgument(semantics > 0 && semantics < 65535, "Invalid semantics specified");
                this.semantics = semantics;
                this.as = as;
@@ -66,9 +66,9 @@ public final class Community implements Serializable {
        /**
         * Return ASNumber of community.
         * 
-        * @return {@link ASNumber}
+        * @return {@link AsNumber}
         */
-       public ASNumber getAs() {
+       public AsNumber getAs() {
                return this.as;
        }
 
@@ -105,6 +105,6 @@ public final class Community implements Serializable {
 
                final int asn = Integer.valueOf(parts[0]);
                final int sem = Integer.valueOf(parts[1]);
-               return new Community(new ASNumber(0, asn), sem);
+               return new Community(new AsNumber((long) asn), sem);
        }
 }
index 9868b3f4f39edbdda3bd6c59555d000f8c7f1f96..1e37ca125d07c2560702347df1b97324696acfc4 100644 (file)
@@ -8,24 +8,22 @@
 
 package org.opendaylight.protocol.bgp.concepts;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
- * @see <a  href="http://tools.ietf.org/html/rfc4360#section-5">Route Origin Community</a>
+ * @see <a href="http://tools.ietf.org/html/rfc4360#section-5">Route Origin Community</a>
  */
 public class RouteOriginCommunity extends ASSpecificExtendedCommunity {
 
        private static final long serialVersionUID = 540725495203637583L;
 
        /**
-        * Construct a RouteOriginCommunity based on global and local
-        * administrator values.
-        *
+        * Construct a RouteOriginCommunity based on global and local administrator values.
+        * 
         * @param globalAdmin Global administrator (AS number)
         * @param localAdmin Local administrator (AS-specific, opaque value)
         */
-       public RouteOriginCommunity(final ASNumber globalAdmin, final byte[] localAdmin) {
+       public RouteOriginCommunity(final AsNumber globalAdmin, final byte[] localAdmin) {
                super(false, 3, globalAdmin, localAdmin);
        }
 }
-
index 340fe1f1cc0ba350c0a0f7dd742d2e030d95b1ef..d134e98b834ea2e4b5fcc018bf6a782d083ddcf1 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.protocol.bgp.concepts;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * @see <a href="http://tools.ietf.org/html/rfc4360#section-4">Route Target Community</a>
@@ -18,10 +18,10 @@ public class RouteTargetCommunity extends ASSpecificExtendedCommunity {
 
        /**
         * 
-        * @param globalAdmin Globally-administered identifier, i.e. an {@link ASNumber}
+        * @param globalAdmin Globally-administered identifier, i.e. an {@link AsNumber}
         * @param localAdmin Locally-administered identifier
         */
-       public RouteTargetCommunity(final ASNumber globalAdmin, final byte[] localAdmin) {
+       public RouteTargetCommunity(final AsNumber globalAdmin, final byte[] localAdmin) {
                super(false, 2, globalAdmin, localAdmin);
        }
 }
index eb39c751d6bf14304e2d630cec6c20c295024e83..98b048cce88a2750acf425484ccd4ce26292fdac 100644 (file)
@@ -20,77 +20,75 @@ import java.util.Set;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.ASPath;
-
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class ASPathTest {
 
-       private ASNumber asn1, asn2, asn3, asn4, asn5, asn6, asn7, asn8;
+       private AsNumber asn1, asn2, asn3, asn4, asn5, asn6, asn7, asn8;
 
-       private List<ASNumber> visibleAsPath;
-       private Set<ASNumber> aggregatedAsPath;
+       private List<AsNumber> visibleAsPath;
+       private Set<AsNumber> aggregatedAsPath;
 
        @Before
        public void init() {
-               asn1 = new ASNumber(100, 200);
-               asn2 = new ASNumber(65534);
-               asn3 = new ASNumber(0, 200);
-               asn4 = new ASNumber(100, 199);
-               asn5 = new ASNumber(99, 199);
-               asn6 = new ASNumber(64538);
-               asn7 = new ASNumber(0, 200);
-               asn8 = new ASNumber(100, 0);
-
-               visibleAsPath = new ArrayList<ASNumber>();
-               aggregatedAsPath = new HashSet<ASNumber>();
-
-               visibleAsPath.add(asn1);
-               visibleAsPath.add(asn2);
-               visibleAsPath.add(asn3);
-               visibleAsPath.add(asn4);
-
-               aggregatedAsPath.add(asn5);
-               aggregatedAsPath.add(asn6);
-               aggregatedAsPath.add(asn7);
-               aggregatedAsPath.add(asn8);
+               this.asn1 = new AsNumber(429496729800L);
+               this.asn2 = new AsNumber((long) 65534);
+               this.asn3 = new AsNumber((long) 200);
+               this.asn4 = new AsNumber(429496729799L);
+               this.asn5 = new AsNumber(425201762503L);
+               this.asn6 = new AsNumber((long) 64538);
+               this.asn7 = new AsNumber((long) 200);
+               this.asn8 = new AsNumber(429496729600L);
+
+               this.visibleAsPath = new ArrayList<AsNumber>();
+               this.aggregatedAsPath = new HashSet<AsNumber>();
+
+               this.visibleAsPath.add(this.asn1);
+               this.visibleAsPath.add(this.asn2);
+               this.visibleAsPath.add(this.asn3);
+               this.visibleAsPath.add(this.asn4);
+
+               this.aggregatedAsPath.add(this.asn5);
+               this.aggregatedAsPath.add(this.asn6);
+               this.aggregatedAsPath.add(this.asn7);
+               this.aggregatedAsPath.add(this.asn8);
        }
 
        @Test
        public void testGetXXXPath() {
-               ASPath asp1 = ASPath.EMPTY;
+               final ASPath asp1 = ASPath.EMPTY;
                assertEquals(0, asp1.getVisibleAsPath().size());
                assertEquals(0, asp1.getAggregatedAsPath().size());
 
-               ASPath asp2 = new ASPath(visibleAsPath);
+               final ASPath asp2 = new ASPath(this.visibleAsPath);
                assertEquals(4, asp2.getVisibleAsPath().size());
                assertEquals(0, asp2.getAggregatedAsPath().size());
 
-               ASPath asp3 = new ASPath(visibleAsPath, aggregatedAsPath);
+               final ASPath asp3 = new ASPath(this.visibleAsPath, this.aggregatedAsPath);
                assertEquals(4, asp3.getVisibleAsPath().size());
                assertEquals(4, asp3.getAggregatedAsPath().size());
        }
 
        @Test
        public void testEqualsHashCode() {
-               ASPath asp1 = ASPath.EMPTY;
-               ASPath asp2 = asp1;
+               final ASPath asp1 = ASPath.EMPTY;
+               final ASPath asp2 = asp1;
                assertEquals(asp1, asp2);
                assertEquals(asp1.hashCode(), asp2.hashCode());
                assertNotNull(asp1);
                assertThat(asp1, not(new Object()));
 
-               ASPath asp3 = new ASPath(visibleAsPath, aggregatedAsPath);
+               final ASPath asp3 = new ASPath(this.visibleAsPath, this.aggregatedAsPath);
                assertThat(asp1, not(equalTo(asp3)));
                assertThat(asp1.hashCode(), not(equalTo(asp3.hashCode())));
 
-               ASPath asp4 = new ASPath(new ArrayList<ASNumber>(), aggregatedAsPath);
+               final ASPath asp4 = new ASPath(new ArrayList<AsNumber>(), this.aggregatedAsPath);
                assertThat(asp3, not(equalTo(asp4)));
        }
 
        @Test
        public void testToString() {
-               ASPath asp = new ASPath(visibleAsPath, aggregatedAsPath);
+               final ASPath asp = new ASPath(this.visibleAsPath, this.aggregatedAsPath);
                assertNotNull(asp.toString());
        }
 
index 66936929466aca927e43bb57c0d3de15132e0caf..b4f4d35e3f56ad0cab8a65067014b898e7c75591 100644 (file)
@@ -12,15 +12,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.ASSpecificExtendedCommunity;
-
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class ASSpecificExtendedCommunityTest {
 
        private final boolean transitive = true;
        private final int subType = 123;
-       private final ASNumber globalAdmin = new ASNumber(100, 200);
+       private final AsNumber globalAdmin = new AsNumber(429496729800L);
        private final byte[] localAdmin = new byte[] { 10, 0, 0, 1 };
 
        @Test
@@ -43,7 +41,7 @@ public class ASSpecificExtendedCommunityTest {
        public void testGetSubType() {
                final ASSpecificExtendedCommunity asSpecExCom = new ASSpecificExtendedCommunity(this.transitive, this.subType, this.globalAdmin, this.localAdmin);
                assertEquals(123, asSpecExCom.getSubType());
-               assertEquals(new ASNumber(100, 200), asSpecExCom.getGlobalAdmin());
+               assertEquals(new AsNumber(429496729800L), asSpecExCom.getGlobalAdmin());
                assertArrayEquals(new byte[] { 10, 0, 0, 1 }, asSpecExCom.getLocalAdmin());
 
                final ASSpecificExtendedCommunity a1 = new ASSpecificExtendedCommunity(this.transitive, this.subType, this.globalAdmin, this.localAdmin);
index 54f099fdb37ccf85303bb4197a232935c539d137..387a5047134be2120cb0f928b7b2acd153598a72 100644 (file)
@@ -15,19 +15,14 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.Community;
-import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
-import org.opendaylight.protocol.bgp.concepts.OpaqueExtendedCommunity;
-import org.opendaylight.protocol.bgp.concepts.RouteOriginCommunity;
-
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class CommunityTest {
 
        @Test
        public void testCommunity() {
-               new Community(new ASNumber(0, 10), 222);
-               final ASNumber as = new ASNumber(12);
+               new Community(new AsNumber((long) 10), 222);
+               final AsNumber as = new AsNumber((long) 12);
                final Community c = new Community(as, 12);
                assertEquals(as, c.getAs());
                assertEquals(12, c.getSemantics());
@@ -36,19 +31,13 @@ public class CommunityTest {
        @Test
        public void testOverflows() {
                try {
-                       new Community(new ASNumber(0, 10), -2);
+                       new Community(new AsNumber((long) 10), -2);
                        fail("Semantics under range.");
                } catch (final IllegalArgumentException e) {
                        assertEquals("Invalid semantics specified", e.getMessage());
                }
                try {
-                       new Community(new ASNumber(5, 10), 5);
-                       fail("AS high number cannot be null");
-               } catch (final IllegalArgumentException e) {
-                       assertEquals("Invalid AS number specified", e.getMessage());
-               }
-               try {
-                       new Community(new ASNumber(0, 10), 65536);
+                       new Community(new AsNumber((long) 10), 65536);
                        fail("Semantics above range.");
                } catch (final IllegalArgumentException e) {
                        assertEquals("Invalid semantics specified", e.getMessage());
@@ -57,35 +46,35 @@ public class CommunityTest {
 
        @Test
        public void testEquals() {
-               final Community c1 = new Community(new ASNumber(0, 10), 222);
-               final Community c2 = new Community(new ASNumber(0, 10), 222);
+               final Community c1 = new Community(new AsNumber((long) 10), 222);
+               final Community c2 = new Community(new AsNumber((long) 10), 222);
                assertEquals(c1, c2);
                assertThat(c1, not(new Object()));
        }
 
        @Test
        public void testHashCode() {
-               final Community c1 = new Community(new ASNumber(0, 10), 222);
-               final Community c2 = new Community(new ASNumber(0, 10), 222);
+               final Community c1 = new Community(new AsNumber((long) 10), 222);
+               final Community c2 = new Community(new AsNumber((long) 10), 222);
                assertEquals(c1.hashCode(), c2.hashCode());
        }
 
        @Test
        public void testToString() {
-               final Community c = new Community(new ASNumber(0, 10), 222);
+               final Community c = new Community(new AsNumber((long) 10), 222);
                assertNotNull(c.toString());
        }
 
        @Test
        public void testValueOf() {
                final Community comm = Community.valueOf("12:50");
-               assertEquals(comm, new Community(new ASNumber(0, 12), 50));
+               assertEquals(comm, new Community(new AsNumber((long) 12), 50));
        }
 
        @Test
        public void testExtendedCommunity() {
                final ExtendedCommunity ec = new OpaqueExtendedCommunity(false, 5, new byte[] { 1, 2, 3, 4, 5, 6 });
-               final Object ec2 = new RouteOriginCommunity(new ASNumber(84), new byte[] { 1, 2, 3, 4 });
+               final Object ec2 = new RouteOriginCommunity(new AsNumber((long) 84), new byte[] { 1, 2, 3, 4 });
                assertNotSame(ec, ec2);
                assertEquals(ec, new OpaqueExtendedCommunity(false, 5, new byte[] { 1, 2, 3, 4, 5, 6 }));
                assertEquals(ec.hashCode(), (new OpaqueExtendedCommunity(false, 5, new byte[] { 1, 2, 3, 4, 5, 6 })).hashCode());
index 8279e760c82084c729942ca3fcbbbe6cabad4b0d..026986d52ea4f4ff799dc651b91030d26ab5f051 100644 (file)
@@ -13,9 +13,7 @@ import static org.junit.Assert.assertFalse;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.RouteOriginCommunity;
-
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class RouteOriginCommunityTest {
 
@@ -23,7 +21,7 @@ public class RouteOriginCommunityTest {
 
        @Before
        public void init() {
-               final ASNumber globalAdmin = new ASNumber(100, 200);
+               final AsNumber globalAdmin = new AsNumber(429496729800L);
                final byte[] localAdmin = new byte[] { 10, 0, 0, 1 };
                this.community = new RouteOriginCommunity(globalAdmin, localAdmin);
        }
@@ -35,7 +33,7 @@ public class RouteOriginCommunityTest {
 
        @Test
        public void testGetGlobalAdmin() {
-               final ASNumber testAsn = new ASNumber(100, 200);
+               final AsNumber testAsn = new AsNumber(429496729800L);
                assertEquals(this.community.getGlobalAdmin(), testAsn);
        }
 
index 1e29a6d28d17d3bdf8af8c7396bf39cda5e60973..9606bbd5c80c808814bcce2745594522baa2a9bf 100644 (file)
@@ -13,9 +13,7 @@ import static org.junit.Assert.assertFalse;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.RouteTargetCommunity;
-
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class RouteTargetCommunityTest {
 
@@ -23,7 +21,7 @@ public class RouteTargetCommunityTest {
 
        @Before
        public void init() {
-               final ASNumber globalAdmin = new ASNumber(100, 200);
+               final AsNumber globalAdmin = new AsNumber(429496729800L);
                final byte[] localAdmin = new byte[] { 10, 0, 0, 1 };
                this.community = new RouteTargetCommunity(globalAdmin, localAdmin);
        }
@@ -35,7 +33,7 @@ public class RouteTargetCommunityTest {
 
        @Test
        public void testGetGlobalAdmin() {
-               final ASNumber testAsn = new ASNumber(100, 200);
+               final AsNumber testAsn = new AsNumber(429496729800L);
                assertEquals(this.community.getGlobalAdmin(), testAsn);
        }
 
index 162b81312556ec42d7d153911dd35bc8d0e278ac..c2ae8ed32239cbc7e1c62ea8adf85a36f45b1c19 100644 (file)
@@ -8,7 +8,8 @@
 package org.opendaylight.protocol.bgp.linkstate;
 
 import org.opendaylight.protocol.concepts.Identifier;
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
@@ -19,12 +20,12 @@ import com.google.common.base.Preconditions;
 public final class NodeIdentifier implements Identifier {
        private static final long serialVersionUID = 1L;
 
-       private final ASNumber asNumber;
+       private final AsNumber asNumber;
        private final DomainIdentifier domainIdentifier;
        private final AreaIdentifier areaIdentifier;
        private final RouterIdentifier routerIdentifier;
 
-       public NodeIdentifier(final ASNumber as, final DomainIdentifier domain, final AreaIdentifier area, final RouterIdentifier router) {
+       public NodeIdentifier(final AsNumber as, final DomainIdentifier domain, final AreaIdentifier area, final RouterIdentifier router) {
                this.routerIdentifier = Preconditions.checkNotNull(router, "Router Identifier is mandatory.");
                this.asNumber = as;
                this.domainIdentifier = domain;
@@ -36,7 +37,7 @@ public final class NodeIdentifier implements Identifier {
         * 
         * @return AS of residence
         */
-       public ASNumber getAsNumber() {
+       public AsNumber getAsNumber() {
                return this.asNumber;
        }
 
index 3aec5998784058539eebc5aa2c0d7ce9e6b0b10b..a859ecfc226d6909e1e71f15c3f2c48c1380bdf6 100644 (file)
@@ -7,21 +7,21 @@
  */
 package org.opendaylight.protocol.bgp.linkstate;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public final class NodeIdentifierFactory {
-       private final ASNumber as;
+       private final AsNumber as;
        private final DomainIdentifier domain;
        private final AreaIdentifier area;
 
-       public NodeIdentifierFactory(final ASNumber as, final DomainIdentifier domain, final AreaIdentifier area) {
+       public NodeIdentifierFactory(final AsNumber as, final DomainIdentifier domain, final AreaIdentifier area) {
                this.as = as;
                this.area = area;
                this.domain = domain;
        }
 
        public NodeIdentifier identifierForRouter(final RouterIdentifier router) {
-               return new NodeIdentifier(as, domain, area, router);
+               return new NodeIdentifier(this.as, this.domain, this.area, router);
        }
 
        public static NodeIdentifier localIdentifier(final RouterIdentifier router) {
index 8ab3fdb32ed3a52253749da837925b909781f43d..13f79355470f303c7b37f2b03234f0988e2e1caa 100644 (file)
@@ -12,14 +12,13 @@ import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.fail;
 
 import org.junit.Test;
-
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv6;
 import org.opendaylight.protocol.concepts.ISOSystemIdentifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class NodeIdentifierTest {
-       private final NodeIdentifierFactory f = new NodeIdentifierFactory(new ASNumber(25600, 0), null, null);
+       private final NodeIdentifierFactory f = new NodeIdentifierFactory(new AsNumber(109951162777600L), null, null);
 
        @Test
        public void testHashCodeEquals() {
index ad475cd61ff93478e8e006c4530e6ae1d92a493f..dab318e215ba49dd14c421b7e04870dc8686487a 100644 (file)
@@ -11,9 +11,8 @@ import java.util.List;
 
 import org.opendaylight.protocol.bgp.parser.BGPMessage;
 import org.opendaylight.protocol.bgp.parser.BGPParameter;
-
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * Representation of BGPOpen message.
@@ -29,7 +28,7 @@ public final class BGPOpenMessage implements BGPMessage {
         */
        public static final int BGP_VERSION = 4;
 
-       private final ASNumber myAS;
+       private final AsNumber myAS;
 
        private final short holdTime;
 
@@ -45,7 +44,7 @@ public final class BGPOpenMessage implements BGPMessage {
         * @param bgpId IPv4 Address of the BGP speaker
         * @param optParams List of optional parameters
         */
-       public BGPOpenMessage(final ASNumber myAS, final short holdTime, final IPv4Address bgpId, final List<BGPParameter> optParams) {
+       public BGPOpenMessage(final AsNumber myAS, final short holdTime, final IPv4Address bgpId, final List<BGPParameter> optParams) {
                super();
                this.myAS = myAS;
                this.holdTime = holdTime;
@@ -58,7 +57,7 @@ public final class BGPOpenMessage implements BGPMessage {
         * 
         * @return myAS
         */
-       public ASNumber getMyAS() {
+       public AsNumber getMyAS() {
                return this.myAS;
        }
 
index 00cdc6c9af670bf29efd9eba6f969b6ba0cf9e7e..4c2ecf088ea7bcf93d649d38cc0a493ba05cdfb9 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.protocol.bgp.parser.parameter;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * AS 4B Numbers capability.
@@ -21,9 +21,9 @@ public final class AS4BytesCapability extends CapabilityParameter {
         */
        public static final int CODE = 65;
 
-       private final ASNumber as;
+       private final AsNumber as;
 
-       public AS4BytesCapability(final ASNumber as) {
+       public AS4BytesCapability(final AsNumber as) {
                super(CODE);
                this.as = as;
        }
@@ -33,7 +33,7 @@ public final class AS4BytesCapability extends CapabilityParameter {
         * 
         * @return 4B AS Number
         */
-       public ASNumber getASNumber() {
+       public AsNumber getASNumber() {
                return this.as;
        }
 
index 7e029761c5cb69a8d3634a7621fc369f4d39b743..dad9807d87cecc4c94926b898be9d5674259be55 100644 (file)
@@ -41,13 +41,13 @@ import org.opendaylight.protocol.bgp.parser.parameter.AS4BytesCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.CapabilityParameter;
 import org.opendaylight.protocol.bgp.parser.parameter.GracefulCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.Metric;
 import org.opendaylight.protocol.concepts.TEMetric;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.protocol.util.DefaultingTypesafeContainer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
@@ -123,7 +123,7 @@ public class APITest {
 
                final BGPParameter tlv3 = new GracefulCapability(false, 0, tt);
 
-               final BGPParameter tlv4 = new AS4BytesCapability(new ASNumber(40));
+               final BGPParameter tlv4 = new AS4BytesCapability(new AsNumber((long) 40));
 
                assertFalse(((GracefulCapability) tlv3).isRestartFlag());
 
@@ -145,9 +145,9 @@ public class APITest {
 
                assertNotSame(((MultiprotocolCapability) tlv1).getAfi(), ((MultiprotocolCapability) tlv2).getAfi());
 
-               assertEquals(40, ((AS4BytesCapability) tlv4).getASNumber().getAsn());
+               assertEquals(40, ((AS4BytesCapability) tlv4).getASNumber().getValue().longValue());
 
-               assertEquals(new AS4BytesCapability(new ASNumber(40)).toString(), tlv4.toString());
+               assertEquals(new AS4BytesCapability(new AsNumber((long) 40)).toString(), tlv4.toString());
        }
 
        @Test
@@ -174,13 +174,13 @@ public class APITest {
 
        @Test
        public void testBGPOpenMessage() {
-               final BGPMessage msg = new BGPOpenMessage(new ASNumber(58), (short) 5, null, null);
+               final BGPMessage msg = new BGPOpenMessage(new AsNumber((long) 58), (short) 5, null, null);
                assertNull(((BGPOpenMessage) msg).getOptParams());
        }
 
        @Test
        public void testToString() {
-               final BGPMessage o = new BGPOpenMessage(new ASNumber(58), (short) 5, null, null);
+               final BGPMessage o = new BGPOpenMessage(new AsNumber((long) 58), (short) 5, null, null);
                final BGPMessage n = new BGPNotificationMessage(BGPError.ATTR_FLAGS_MISSING);
                assertNotSame(o.toString(), n.toString());
        }
index a16bf7c297cba58e9a01d2000b1327a8628b8591..a652b5e691aeae908d049eac384348ec2361b544 100644 (file)
@@ -12,19 +12,18 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
 import org.opendaylight.protocol.bgp.parser.BGPParameter;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.impl.message.open.BGPParameterParser;
 import org.opendaylight.protocol.bgp.parser.message.BGPOpenMessage;
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.primitives.UnsignedBytes;
@@ -80,11 +79,11 @@ public final class BGPOpenMessageParser {
                offset += VERSION_SIZE;
 
                // When our AS number does not fit into two bytes, we report it as AS_TRANS
-               ASNumber openAS = msg.getMyAS();
-               if (openAS.getHighValue() != 0)
-                       openAS = ASNumber.TRANS;
+               AsNumber openAS = msg.getMyAS();
+               if (openAS.getValue().longValue() > Integer.MAX_VALUE)
+                       openAS = new AsNumber((long) 2345);
 
-               System.arraycopy(ByteArray.intToBytes(openAS.getLowValue()), 2, msgBody, offset, AS_SIZE);
+               System.arraycopy(ByteArray.longToBytes(openAS.getValue()), 6, msgBody, offset, AS_SIZE);
                offset += AS_SIZE;
 
                System.arraycopy(ByteArray.shortToBytes(msg.getHoldTime()), 0, msgBody, offset, HOLD_TIME_SIZE);
@@ -125,7 +124,7 @@ public final class BGPOpenMessageParser {
                                        ByteArray.intToBytes(BGPOpenMessage.BGP_VERSION), 2, 2));
 
                int offset = VERSION_SIZE;
-               final ASNumber as = new ASNumber(0, ByteArray.bytesToInt(ByteArray.subByte(bytes, offset, AS_SIZE)));
+               final AsNumber as = new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(bytes, offset, AS_SIZE)));
                offset += AS_SIZE;
 
                // TODO: BAD_PEER_AS Error: when is an AS unacceptable?
index a58cefcba5a8ab16d1e10c0ceadc0d81bfc47e31..093adb79953697ecc6923c99d44e01799544d2ac 100644 (file)
@@ -16,8 +16,8 @@ import org.opendaylight.protocol.bgp.parser.parameter.AS4BytesCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.CapabilityParameter;
 import org.opendaylight.protocol.bgp.parser.parameter.GracefulCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
@@ -130,7 +130,7 @@ public final class CapabilityParameterParser {
        }
 
        private static byte[] putAS4BytesParameterValue(final AS4BytesCapability param) {
-               return ByteArray.subByte(ByteArray.longToBytes(param.getASNumber().getAsn()), 4, 4);
+               return ByteArray.subByte(ByteArray.longToBytes(param.getASNumber().getValue()), 4, 4);
        }
 
        private static MultiprotocolCapability parseMultiProtocolParameterValue(final byte[] bytes) throws BGPParsingException {
@@ -147,7 +147,7 @@ public final class CapabilityParameterParser {
        }
 
        private static AS4BytesCapability parseAS4BParameterValue(final byte[] bytes) {
-               return new AS4BytesCapability(new ASNumber(ByteArray.bytesToLong(bytes)));
+               return new AS4BytesCapability(new AsNumber(ByteArray.bytesToLong(bytes)));
        }
 
        private static byte[] putAfi(final BgpAddressFamily afi) {
index 536efd9a6f7de292494c8c7fcbdab537463ee8ee..ff71f99c350b48572682027011d4bf1116e17568 100644 (file)
@@ -13,15 +13,14 @@ import java.util.Collection;
 import java.util.HashSet;
 
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
- *
- * Representation of one AS Path Segment. It is, in fact, a TLV, but the length
- * field is representing the count of AS Numbers in the collection (in its
- * value). If the segment is of type AS_SEQUENCE, the collection is a List, if
- * AS_SET, the collection is a Set.
- *
+ * 
+ * Representation of one AS Path Segment. It is, in fact, a TLV, but the length field is representing the count of AS
+ * Numbers in the collection (in its value). If the segment is of type AS_SEQUENCE, the collection is a List, if AS_SET,
+ * the collection is a Set.
+ * 
  */
 public class AsPathSegmentParser {
 
@@ -53,14 +52,11 @@ public class AsPathSegmentParser {
                }
        }
 
-       static Collection<ASNumber> parseAsPathSegment(final SegmentType type,
-                       final int count, final byte[] bytes) {
-               final Collection<ASNumber> coll = (type == SegmentType.AS_SEQUENCE) ? new ArrayList<ASNumber>()
-                               : new HashSet<ASNumber>();
+       static Collection<AsNumber> parseAsPathSegment(final SegmentType type, final int count, final byte[] bytes) {
+               final Collection<AsNumber> coll = (type == SegmentType.AS_SEQUENCE) ? new ArrayList<AsNumber>() : new HashSet<AsNumber>();
                int byteOffset = 0;
                for (int i = 0; i < count; i++) {
-                       coll.add(new ASNumber(ByteArray.bytesToLong(ByteArray.subByte(
-                                       bytes, byteOffset, AS_NUMBER_LENGTH))));
+                       coll.add(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(bytes, byteOffset, AS_NUMBER_LENGTH))));
                        byteOffset += AS_NUMBER_LENGTH;
                }
                return coll;
index c222b6cafc10f9a9419b34f96bfcadc253b5baad..37bbab313e882c0582ce0d4879371a636456d49a 100644 (file)
@@ -19,9 +19,10 @@ import org.opendaylight.protocol.bgp.concepts.RouteOriginCommunity;
 import org.opendaylight.protocol.bgp.concepts.RouteTargetCommunity;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.primitives.UnsignedBytes;
 
@@ -61,7 +62,7 @@ public class CommunitiesParser {
                } else if (Arrays.equals(bytes, new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x03 })) {
                        return Community.NO_EXPORT_SUBCONFED;
                }
-               return new Community(new ASNumber(ByteArray.bytesToLong(Arrays.copyOfRange(bytes, 0, AS_NUMBER_LENGTH))), ByteArray.bytesToInt(Arrays.copyOfRange(
+               return new Community(new AsNumber(ByteArray.bytesToLong(Arrays.copyOfRange(bytes, 0, AS_NUMBER_LENGTH))), ByteArray.bytesToInt(Arrays.copyOfRange(
                                bytes, AS_NUMBER_LENGTH, AS_NUMBER_LENGTH + AS_NUMBER_LENGTH)));
        }
 
@@ -81,32 +82,32 @@ public class CommunitiesParser {
                switch (type) {
                case 0:
                        if (subType == 2) {
-                               return new RouteTargetCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteTargetCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else if (subType == 3) {
-                               return new RouteOriginCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteOriginCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else
-                               return new ASSpecificExtendedCommunity(false, subType, new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0,
+                               return new ASSpecificExtendedCommunity(false, subType, new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0,
                                                AS_NUMBER_LENGTH))), ByteArray.subByte(value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                case 40: // 01000000
-                       return new ASSpecificExtendedCommunity(true, subType, new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0,
+                       return new ASSpecificExtendedCommunity(true, subType, new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0,
                                        AS_NUMBER_LENGTH))), ByteArray.subByte(value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                case 2:
                        if (subType == 2) {
-                               return new RouteTargetCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteTargetCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else if (subType == 3) {
-                               return new RouteOriginCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteOriginCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else
                                throw new BGPDocumentedException("Could not parse Extended Community subtype: " + subType, BGPError.OPT_ATTR_ERROR);
                case 1:
                        if (subType == 2) {
-                               return new RouteTargetCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteTargetCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else if (subType == 3) {
-                               return new RouteOriginCommunity(new ASNumber(ByteArray.bytesToInt(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
+                               return new RouteOriginCommunity(new AsNumber(ByteArray.bytesToLong(ByteArray.subByte(value, 0, AS_NUMBER_LENGTH))), ByteArray.subByte(
                                                value, AS_NUMBER_LENGTH, AS_LOCAL_ADMIN_LENGTH));
                        } else
                                return new Inet4SpecificExtendedCommunity(false, subType, new IPv4Address(ByteArray.subByte(value, 0, 4)), ByteArray.subByte(
index c3f415a8ecd05cb4909aa10f8ed8bcf0d5440a4b..9d9a1e95cdf2f06bd475277357abf5be1f3cca71 100644 (file)
@@ -59,7 +59,6 @@ import org.opendaylight.protocol.bgp.parser.impl.BGPLinkMP;
 import org.opendaylight.protocol.bgp.parser.impl.BGPNodeMP;
 import org.opendaylight.protocol.bgp.parser.impl.ByteList;
 import org.opendaylight.protocol.bgp.parser.impl.MPReach;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.Bandwidth;
 import org.opendaylight.protocol.concepts.IGPMetric;
 import org.opendaylight.protocol.concepts.IPv4Address;
@@ -73,6 +72,7 @@ import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.protocol.concepts.SharedRiskLinkGroup;
 import org.opendaylight.protocol.concepts.TEMetric;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -382,7 +382,7 @@ public class LinkStateParser {
         */
        private static NodeIdentifier parseNodeDescriptors(final byte[] bytes) throws BGPParsingException {
                int byteOffset = 0;
-               ASNumber asnumber = null;
+               AsNumber asnumber = null;
                DomainIdentifier bgpId = null;
                AreaIdentifier ai = null;
                RouterIdentifier routerId = null;
@@ -395,7 +395,7 @@ public class LinkStateParser {
                        logger.debug("Parsing Node Descriptor: {}", Arrays.toString(value));
                        switch (type) {
                        case 512:
-                               asnumber = new ASNumber(ByteArray.bytesToLong(value));
+                               asnumber = new AsNumber(ByteArray.bytesToLong(value));
                                logger.trace("Parsed AS number {}", asnumber);
                                break;
                        case 513:
index e5b24ba5199c8d56946a87aacaaf0b3677f720f6..1fc0c21f56756639ef87cabd16bde0990038bf25 100644 (file)
@@ -26,7 +26,6 @@ import org.opendaylight.protocol.bgp.parser.impl.MPReach;
 import org.opendaylight.protocol.bgp.parser.impl.PathAttribute;
 import org.opendaylight.protocol.bgp.parser.impl.PathAttribute.TypeCode;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSegmentParser.SegmentType;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.NetworkAddress;
@@ -161,8 +160,8 @@ public class PathAttributeParser {
         */
        private static ASPath parseAsPath(final byte[] bytes) throws BGPDocumentedException, BGPParsingException {
                int byteOffset = 0;
-               List<ASNumber> list = null;
-               Set<ASNumber> set = null;
+               List<AsNumber> list = null;
+               Set<AsNumber> set = null;
                while (byteOffset < bytes.length) {
                        final int type = UnsignedBytes.toInt(bytes[byteOffset]);
                        final SegmentType segmentType = AsPathSegmentParser.parseType(type);
@@ -174,10 +173,10 @@ public class PathAttributeParser {
                        byteOffset += AsPathSegmentParser.LENGTH_SIZE;
 
                        if (segmentType == SegmentType.AS_SEQUENCE) {
-                               list = (List<ASNumber>) AsPathSegmentParser.parseAsPathSegment(segmentType, count,
+                               list = (List<AsNumber>) AsPathSegmentParser.parseAsPathSegment(segmentType, count,
                                                ByteArray.subByte(bytes, byteOffset, count * AsPathSegmentParser.AS_NUMBER_LENGTH));
                        } else {
-                               set = (Set<ASNumber>) AsPathSegmentParser.parseAsPathSegment(segmentType, count,
+                               set = (Set<AsNumber>) AsPathSegmentParser.parseAsPathSegment(segmentType, count,
                                                ByteArray.subByte(bytes, byteOffset, count * AsPathSegmentParser.AS_NUMBER_LENGTH));
                        }
                        byteOffset += count * AsPathSegmentParser.AS_NUMBER_LENGTH;
index b54ad087f833e8e70d060f5b411fd719624f0a25..7d21c1ead6d071a4f328ea28c491b80fb38ee590 100644 (file)
@@ -64,7 +64,6 @@ import org.opendaylight.protocol.bgp.util.BGPIPv4RouteImpl;
 import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
 import org.opendaylight.protocol.bgp.util.BGPLinkImpl;
 import org.opendaylight.protocol.bgp.util.BGPNodeImpl;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IGPMetric;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
@@ -182,12 +181,12 @@ public class BGPParserTest {
 
                // attributes
 
-               final ASPath asPath = new ASPath(Lists.newArrayList(new ASNumber(65002)));
+               final ASPath asPath = new ASPath(Lists.newArrayList(new AsNumber((long) 65002)));
 
                final IPv4NextHop nextHop = IPv4NextHop.forString("10.0.0.2");
 
                final Set<Community> comms = Sets.newHashSet(Community.NO_EXPORT, Community.NO_ADVERTISE, Community.NO_EXPORT_SUBCONFED,
-                               new Community(new ASNumber(0xFFFF), 0xFF10));
+                               new Community(new AsNumber((long) 0xFFFF), 0xFF10));
 
                // check path attributes
 
@@ -308,7 +307,7 @@ public class BGPParserTest {
 
                // attributes
 
-               final ASPath asPath = new ASPath(Lists.newArrayList(new ASNumber(65001)));
+               final ASPath asPath = new ASPath(Lists.newArrayList(new AsNumber((long) 65001)));
 
                final IPv6NextHop nextHop = IPv6NextHop.forString("2001:db8::1", "fe80::c001:bff:fe7e:0");
 
@@ -415,7 +414,8 @@ public class BGPParserTest {
 
                // attributes
 
-               final ASPath asPath = new ASPath(Lists.newArrayList(new ASNumber(30)), Sets.newHashSet(new ASNumber(10), new ASNumber(20)));
+               final ASPath asPath = new ASPath(Lists.newArrayList(new AsNumber((long) 30)), Sets.newHashSet(new AsNumber((long) 10),
+                               new AsNumber((long) 20)));
 
                final BgpAggregator aggregator = new BGPAggregatorImpl(new AsNumber((long) 30), new Ipv4Address("10.0.0.9"));
                final IPv4NextHop nextHop = IPv4NextHop.forString("10.0.0.9");
@@ -888,8 +888,8 @@ public class BGPParserTest {
                container.setDefaultEntry(new IGPMetric(1));
                final NetworkLinkState linkState = new NetworkLinkState(objState, container, null, LinkProtectionType.UNPROTECTED, null, null, null);
 
-               final NodeIdentifierFactory f100 = new NodeIdentifierFactory(new ASNumber(100), new DomainIdentifier(new byte[] { 25, 25, 25, 1 }), new AreaIdentifier(new byte[] {
-                               0, 0, 0, 0 }));
+               final NodeIdentifierFactory f100 = new NodeIdentifierFactory(new AsNumber((long) 100), new DomainIdentifier(new byte[] { 25, 25,
+                               25, 1 }), new AreaIdentifier(new byte[] { 0, 0, 0, 0 }));
 
                final NodeIdentifier nodeid1 = f100.identifierForRouter(new OSPFv3LANIdentifier(new OSPFRouterIdentifier(new byte[] { 3, 3, 3, 4 }), new OSPFInterfaceIdentifier(new byte[] {
                                0x0b, 0x0b, 0x0b, 0x03 })));
@@ -1018,8 +1018,8 @@ public class BGPParserTest {
 
                // network link state
 
-               final NodeIdentifierFactory f100 = new NodeIdentifierFactory(new ASNumber(100), new DomainIdentifier(new byte[] { 25, 25, 25, 1 }), new AreaIdentifier(new byte[] {
-                               0, 0, 0, 0 }));
+               final NodeIdentifierFactory f100 = new NodeIdentifierFactory(new AsNumber((long) 100), new DomainIdentifier(new byte[] { 25, 25,
+                               25, 1 }), new AreaIdentifier(new byte[] { 0, 0, 0, 0 }));
 
                final NodeIdentifier nodeid1 = f100.identifierForRouter(new OSPFv3LANIdentifier(new OSPFRouterIdentifier(new byte[] { 3, 3, 3, 4 }), new OSPFInterfaceIdentifier(new byte[] {
                                0x0b, 0x0b, 0x0b, 0x03 })));
index f4eb6189a0042a7284d8fdaee5721a2e88272e8f..862c07a0bb80c10f99c8913a30720a7737de2137 100644 (file)
@@ -34,7 +34,6 @@ import org.opendaylight.protocol.bgp.linkstate.NodeIdentifierFactory;
 import org.opendaylight.protocol.bgp.linkstate.SourceProtocol;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.CommunitiesParser;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.ISOSystemIdentifier;
 import org.opendaylight.protocol.framework.DeserializerException;
@@ -62,7 +61,7 @@ public class ComplementaryTest {
 
        @Test
        public void testBGPLinkMP() {
-               final NodeIdentifier localnodeid = new NodeIdentifier(new ASNumber(25600, 0), null, null, new ISISRouterIdentifier(new ISOSystemIdentifier(new byte[] {
+               final NodeIdentifier localnodeid = new NodeIdentifier(new AsNumber((long) 25600), null, null, new ISISRouterIdentifier(new ISOSystemIdentifier(new byte[] {
                                0x22, 0x22, 0x22, 0x22, 0x22, 0x22 })));
                final NodeIdentifier remotenodeid = NodeIdentifierFactory.localIdentifier(new ISISLANIdentifier(new ISOSystemIdentifier(new byte[] {
                                0x22, 0x22, 0x22, 0x22, 0x22, 0x22 }), (short) 1));
@@ -111,14 +110,14 @@ public class ComplementaryTest {
                } catch (final BGPDocumentedException e1) {
                        fail("Not expected exception: " + e1);
                }
-               assertEquals(as, new ASSpecificExtendedCommunity(false, 5, new ASNumber(54), new byte[] { 0, 0, 1, 76 }));
+               assertEquals(as, new ASSpecificExtendedCommunity(false, 5, new AsNumber((long) 54), new byte[] { 0, 0, 1, 76 }));
 
                try {
                        as = (ASSpecificExtendedCommunity) CommunitiesParser.parseExtendedCommunity(new byte[] { 40, 5, 0, 54, 0, 0, 1, 76 });
                } catch (final BGPDocumentedException e1) {
                        fail("Not expected exception: " + e1);
                }
-               assertEquals(as, new ASSpecificExtendedCommunity(true, 5, new ASNumber(54), new byte[] { 0, 0, 1, 76 }));
+               assertEquals(as, new ASSpecificExtendedCommunity(true, 5, new AsNumber((long) 54), new byte[] { 0, 0, 1, 76 }));
 
                RouteTargetCommunity rtc = null;
                try {
@@ -126,7 +125,7 @@ public class ComplementaryTest {
                } catch (final BGPDocumentedException e1) {
                        fail("Not expected exception: " + e1);
                }
-               assertEquals(rtc, new RouteTargetCommunity(new ASNumber(35), new byte[] { 4, 2, 8, 7 }));
+               assertEquals(rtc, new RouteTargetCommunity(new AsNumber((long) 35), new byte[] { 4, 2, 8, 7 }));
 
                RouteOriginCommunity roc = null;
                try {
@@ -134,7 +133,7 @@ public class ComplementaryTest {
                } catch (final BGPDocumentedException e1) {
                        fail("Not expected exception: " + e1);
                }
-               assertEquals(roc, new RouteOriginCommunity(new ASNumber(24), new byte[] { 4, 2, 8, 7 }));
+               assertEquals(roc, new RouteOriginCommunity(new AsNumber((long) 24), new byte[] { 4, 2, 8, 7 }));
 
                Inet4SpecificExtendedCommunity sec = null;
                try {
index db055f9ae4da8dde4dbe630c0e642c7e1bff108f..f1911ed2fb92f0dbf71436693e675d8736c622a1 100644 (file)
@@ -43,13 +43,13 @@ import org.opendaylight.protocol.bgp.parser.impl.BGPUpdateMessageImpl;
 import org.opendaylight.protocol.bgp.parser.message.BGPOpenMessage;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
 import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv6Address;
 import org.opendaylight.protocol.concepts.IPv6Prefix;
 import org.opendaylight.protocol.concepts.Identifier;
 import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.protocol.framework.DeserializerException;
 import org.opendaylight.protocol.framework.DocumentedException;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
@@ -136,10 +136,10 @@ public class BGPMessageParserMockTest {
         * 
         * @param asn this parameter is passed to ASNumber constructor
         */
-       private BGPUpdateMessage fillMessages(final int asn) throws UnknownHostException {
+       private BGPUpdateMessage fillMessages(final long asn) throws UnknownHostException {
 
-               final List<ASNumber> asnums = new ArrayList<ASNumber>();
-               asnums.add(new ASNumber(asn));
+               final List<AsNumber> asnums = new ArrayList<AsNumber>();
+               asnums.add(new AsNumber(asn));
                final ASPath asPath = new ASPath(asnums);
                final NextHop<IPv6Address> nextHop = new IPv6NextHop(new IPv6Address(InetAddress.getByName("2001:db8::1")), new IPv6Address(InetAddress.getByName("fe80::c001:bff:fe7e:0")));
 
@@ -174,7 +174,7 @@ public class BGPMessageParserMockTest {
 
                final byte[] input = new byte[] { 5, 8, 13, 21 };
 
-               openMap.put(input, Lists.newArrayList((BGPMessage) new BGPOpenMessage(new ASNumber(30), (short) 30, null, params)));
+               openMap.put(input, Lists.newArrayList((BGPMessage) new BGPOpenMessage(new AsNumber((long) 30), (short) 30, null, params)));
 
                final BGPMessageParserMock mockParser = new BGPMessageParserMock(openMap);
 
index ba7c8736b43bc6e6420e8346b9fa9dbe8fb38509..d033025a2062f8e9aed26dccb72135c61470b514 100644 (file)
@@ -149,7 +149,7 @@ public final class BGPSessionNegotiator extends AbstractSessionNegotiator<BGPMes
                                }
                                final BGPNotificationMessage ntf = new BGPNotificationMessage(BGPError.UNSPECIFIC_OPEN_ERROR);
                                this.channel.writeAndFlush(ntf);
-                               negotiationFailed(new BGPDocumentedException("Linkstate capability not advertised.", ntf.getError()));
+                               negotiationFailed(new BGPDocumentedException("Linkstate capability is not configured on router. Check the configuration of BGP speaker.", ntf.getError()));
                                this.state = State.Finished;
                                return;
                        }
index 47337243aa7b2d5b9386c064f586181c1594935c..ab2d5a78f5db79276c53914967b1f25a47e3b384 100644 (file)
@@ -15,8 +15,8 @@ import org.opendaylight.protocol.bgp.parser.parameter.AS4BytesCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionProposal;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
@@ -29,13 +29,13 @@ public final class BGPSessionProposalImpl implements BGPSessionProposal {
 
        private final short holdTimer;
 
-       private final ASNumber as;
+       private final AsNumber as;
 
        private final IPv4Address bgpId;
 
        private final BGPSessionPreferences prefs;
 
-       public BGPSessionProposalImpl(final short holdTimer, final ASNumber as, final IPv4Address bgpId) {
+       public BGPSessionProposalImpl(final short holdTimer, final AsNumber as, final IPv4Address bgpId) {
                this.holdTimer = holdTimer;
                this.as = as;
                this.bgpId = bgpId;
@@ -68,7 +68,7 @@ public final class BGPSessionProposalImpl implements BGPSessionProposal {
        /**
         * @return the as
         */
-       public ASNumber getAs() {
+       public AsNumber getAs() {
                return this.as;
        }
 
index 2899b527f46598de020f34c5f3527254837501a4..f1863b5d6be05990afa08b69f7e87cdb4880cc3f 100644 (file)
@@ -10,15 +10,15 @@ package org.opendaylight.protocol.bgp.rib.impl.spi;
 import java.util.List;
 
 import org.opendaylight.protocol.bgp.parser.BGPParameter;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * DTO for BGP Session preferences, that contains BGP Open message.
  */
 public final class BGPSessionPreferences {
 
-       private final ASNumber as;
+       private final AsNumber as;
 
        private final int hold;
 
@@ -31,7 +31,7 @@ public final class BGPSessionPreferences {
         * 
         * @param prefs BGP Open message
         */
-       public BGPSessionPreferences(final ASNumber as, final int hold, final IPv4Address bgpId, final List<BGPParameter> params) {
+       public BGPSessionPreferences(final AsNumber as, final int hold, final IPv4Address bgpId, final List<BGPParameter> params) {
                this.as = as;
                this.hold = hold;
                this.bgpId = bgpId;
@@ -43,7 +43,7 @@ public final class BGPSessionPreferences {
         * 
         * @return AS number
         */
-       public ASNumber getMyAs() {
+       public AsNumber getMyAs() {
                return this.as;
        }
 
index 9f614ed472682e022627ad953dd234223f32f164..3c3f9392b5052eead7a7ad6b37490909369ef186 100644 (file)
@@ -14,7 +14,7 @@ import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPUpdateSynchronized;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
@@ -22,10 +22,10 @@ public class ApiTest {
 
        @Test
        public void testBGPSessionPreferences() {
-               final BGPSessionPreferences sp = new BGPSessionPreferences(new ASNumber(58), (short) 5, null, null);
+               final BGPSessionPreferences sp = new BGPSessionPreferences(new AsNumber((long) 58), (short) 5, null, null);
                assertNull(sp.getBgpId());
                assertEquals((short) 5, sp.getHoldTime());
-               assertEquals(58, sp.getMyAs().getAsn());
+               assertEquals(58, sp.getMyAs().getValue().longValue());
        }
 
        @Test
index 0693412155197d404cf62e45c5941b535c4e53fe..ec7cb888e8215b935da6c3985ad39fd58d0d4019 100644 (file)
@@ -41,7 +41,7 @@ import org.opendaylight.protocol.bgp.parser.message.BGPNotificationMessage;
 import org.opendaylight.protocol.bgp.parser.message.BGPOpenMessage;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
@@ -71,7 +71,7 @@ public class FSMTest {
                final List<BGPParameter> tlvs = Lists.newArrayList();
                tlvs.add(new MultiprotocolCapability(this.ipv4tt));
                tlvs.add(new MultiprotocolCapability(this.linkstatett));
-               final BGPSessionPreferences prefs = new BGPSessionPreferences(new ASNumber(30), (short) 3, null, tlvs);
+               final BGPSessionPreferences prefs = new BGPSessionPreferences(new AsNumber((long) 30), (short) 3, null, tlvs);
                this.clientSession = new BGPSessionNegotiator(new HashedWheelTimer(), new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, prefs, new SimpleSessionListener());
                doAnswer(new Answer<Object>() {
                        @Override
@@ -85,7 +85,7 @@ public class FSMTest {
                doReturn(this.pipeline).when(this.speakerListener).pipeline();
                doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
                doReturn(mock(ChannelFuture.class)).when(this.speakerListener).close();
-               this.classicOpen = new BGPOpenMessage(new ASNumber(30), (short) 3, null, tlvs);
+               this.classicOpen = new BGPOpenMessage(new AsNumber((long) 30), (short) 3, null, tlvs);
        }
 
        @Test
@@ -114,7 +114,7 @@ public class FSMTest {
                this.clientSession.channelActive(null);
                assertEquals(1, this.receivedMsgs.size());
                assertTrue(this.receivedMsgs.get(0) instanceof BGPOpenMessage);
-               this.clientSession.handleMessage(new BGPOpenMessage(new ASNumber(30), (short) 1, null, null));
+               this.clientSession.handleMessage(new BGPOpenMessage(new AsNumber((long) 30), (short) 1, null, null));
                assertEquals(2, this.receivedMsgs.size());
                assertTrue(this.receivedMsgs.get(1) instanceof BGPNotificationMessage);
                final BGPMessage m = this.receivedMsgs.get(this.receivedMsgs.size() - 1);
@@ -141,7 +141,7 @@ public class FSMTest {
                this.clientSession.handleMessage(new BGPKeepAliveMessage());
                assertEquals(this.clientSession.getState(), BGPSessionNegotiator.State.Finished);
                try {
-                       this.clientSession.handleMessage(new BGPOpenMessage(new ASNumber(30), (short) 3, null, null));
+                       this.clientSession.handleMessage(new BGPOpenMessage(new AsNumber((long) 30), (short) 3, null, null));
                        fail("Exception should be thrown.");
                } catch (final IllegalStateException e) {
                        assertEquals("Unexpected state Finished", e.getMessage());
index 9b7a61d50f05873c25750ecbd3d64ce77982f5e7..7b0e32ac433c891968ca13d6c4c8d337dedae3d9 100644 (file)
@@ -32,12 +32,12 @@ import org.opendaylight.protocol.bgp.parser.message.BGPNotificationMessage;
 import org.opendaylight.protocol.bgp.parser.message.BGPOpenMessage;
 import org.opendaylight.protocol.bgp.parser.parameter.GracefulCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.framework.DeserializerException;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
@@ -122,14 +122,14 @@ public class ParserTest {
 
        @Test
        public void testOpenMessage() throws UnknownHostException, DeserializerException, DocumentedException {
-               final BGPMessage open = new BGPOpenMessage(new ASNumber(100), (short) 180, new IPv4Address(InetAddress.getByName("20.20.20.20")), null);
+               final BGPMessage open = new BGPOpenMessage(new AsNumber((long) 100), (short) 180, new IPv4Address(InetAddress.getByName("20.20.20.20")), null);
                final byte[] bytes = this.factory.put(open);
                assertArrayEquals(openBMsg, bytes);
 
                final BGPMessage m = this.factory.parse(bytes).get(0);
 
                assertTrue(m instanceof BGPOpenMessage);
-               assertEquals(new ASNumber(100), ((BGPOpenMessage) m).getMyAS());
+               assertEquals(new AsNumber((long) 100), ((BGPOpenMessage) m).getMyAS());
                assertEquals((short) 180, ((BGPOpenMessage) m).getHoldTime());
                assertEquals(new IPv4Address(InetAddress.getByName("20.20.20.20")), ((BGPOpenMessage) m).getBgpId());
                assertTrue(((BGPOpenMessage) m).getOptParams().isEmpty());
@@ -255,9 +255,7 @@ public class ParserTest {
                tableTypes.put(t1, true);
                tableTypes.put(t2, true);
                tlvs.add(new GracefulCapability(true, 0, tableTypes));
-               final BGPOpenMessage open = new BGPOpenMessage(new ASNumber(72), (short) 180, new IPv4Address(InetAddress.getByName("172.20.160.170")), tlvs);
-
-               // System.out.println(Arrays.toString(this.factory.put(open)));
+               final BGPOpenMessage open = new BGPOpenMessage(new AsNumber((long) 72), (short) 180, new IPv4Address(InetAddress.getByName("172.20.160.170")), tlvs);
 
                this.factory.put(open);
 
index 44ebe77f1c201c747787aeeea33ff76e1df2caaf..3f3ec0e6ee8176a2e368d4fa0536c1c0b4250f02 100644 (file)
@@ -18,9 +18,9 @@ import org.opendaylight.protocol.bgp.parser.impl.BGPMessageFactoryImpl;
 import org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl;
 import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,7 +60,7 @@ public class Main {
 
                InetSocketAddress address = null;
                short holdTimerValue = 90;
-               ASNumber as = null;
+               AsNumber as = null;
 
                int i = 0;
                while (i < args.length) {
@@ -72,7 +72,7 @@ public class Main {
                                holdTimerValue = Short.valueOf(args[i + 1]);
                                i++;
                        } else if (args[i].equalsIgnoreCase("-as")) {
-                               as = new ASNumber(Long.valueOf(args[i + 1]));
+                               as = new AsNumber(Long.valueOf(args[i + 1]));
                                i++;
                        } else {
                                System.out.println("WARNING: Unrecognized argument: " + args[i]);
index 105f130593bd8d72fae75439d9357add4cbbcedf..1fadb358b0fe59a2369a80d212385382a298741b 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl;
 import org.opendaylight.protocol.bgp.rib.impl.BGPSessionNegotiatorFactory;
 import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
@@ -33,6 +32,7 @@ import org.opendaylight.protocol.framework.ProtocolSession;
 import org.opendaylight.protocol.framework.SessionListener;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 import com.google.common.base.Preconditions;
 
@@ -64,7 +64,7 @@ public class BGPSpeakerMock<M extends ProtocolMessage, S extends ProtocolSession
                        }
                };
 
-               final BGPSessionPreferences prefs = new BGPSessionProposalImpl((short) 90, new ASNumber(25), IPv4.FAMILY.addressForString("127.0.0.2")).getProposal();
+               final BGPSessionPreferences prefs = new BGPSessionProposalImpl((short) 90, new AsNumber((long) 25), IPv4.FAMILY.addressForString("127.0.0.2")).getProposal();
 
                final SessionNegotiatorFactory<BGPMessage, BGPSessionImpl, BGPSessionListener> snf = new BGPSessionNegotiatorFactory(new HashedWheelTimer(), prefs);
 
index 72078dd921b01cb88f27baf1a4413666d7624501..63ad6e090c008414c6fde735cf1f4d24079ca592 100644 (file)
@@ -24,9 +24,9 @@ import org.opendaylight.protocol.bgp.linkstate.NetworkPrefixState;
 import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
 import org.opendaylight.protocol.bgp.linkstate.OSPFRouterIdentifier;
 import org.opendaylight.protocol.bgp.linkstate.RouteTag;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
 
 import com.google.common.collect.Lists;
@@ -34,7 +34,7 @@ import com.google.common.collect.Sets;
 
 public class PrefixTest {
        final BaseBGPObjectState base = new BaseBGPObjectState(BgpOrigin.Egp, null);
-       final NetworkObjectState state = new NetworkObjectState(new ASPath(Lists.newArrayList(new ASNumber(10L))), Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
+       final NetworkObjectState state = new NetworkObjectState(new ASPath(Lists.newArrayList(new AsNumber(10L))), Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
        final NetworkPrefixState prefixState = new NetworkPrefixState(this.state, Sets.<RouteTag> newTreeSet(), null);
 
        final BGPIPv4PrefixImpl r4 = new BGPIPv4PrefixImpl(this.base, new IPv4PrefixIdentifier(new NodeIdentifier(null, null, null, new OSPFRouterIdentifier(new byte[] {
diff --git a/concepts/src/main/java/org/opendaylight/protocol/concepts/ASNumber.java b/concepts/src/main/java/org/opendaylight/protocol/concepts/ASNumber.java
deleted file mode 100644 (file)
index b694d03..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.concepts;
-
-import javax.annotation.concurrent.Immutable;
-
-import org.opendaylight.protocol.concepts.Identifier;
-
-/**
- * Autonomous System (AS) Number. This is an Internet-level concept, where each
- * AS number identifies an administrative domain.
- * @see <a href="http://en.wikipedia.org/wiki/Autonomous_System_%28Internet%29">Wikipedia article</a>
- */
-@Immutable
-public final class ASNumber implements Comparable<ASNumber>, Identifier {
-       /**
-        * AS_TRANS as defined by RFC4893 and RFC6793.
-        */
-       public static final ASNumber TRANS = new ASNumber(23456);
-       private static final long serialVersionUID = 7654204313238963136L;
-       private final int highValue, lowValue;
-
-       /**
-        * Create an AS number representation from a pair of 16bit integers,
-        * representing high/low components, for example as carried in ASDOT+
-        * notation.
-        *
-        * @param highValue Value of high-order 16 bits
-        * @param lowValue Value of low-order 16 bits
-        * @throws
-        *     @li IllegalArgumentException when either highValue or lowValue
-        *         out of allowed range (0-65535)
-        */
-       public ASNumber(final int highValue, final int lowValue) {
-               if (highValue < 0 || highValue > 65535)
-                       throw new IllegalArgumentException("Invalid high-order value");
-               if (lowValue < 0 || lowValue > 65535)
-                       throw new IllegalArgumentException("Invalid low-order value");
-
-               this.highValue = highValue;
-               this.lowValue = lowValue;
-       }
-
-       /**
-        * Create an AS number representation from a single integer. The
-        * integer is the 'raw' AS number value, with unsigned 32bit range,
-        * for example as carried in PLAIN notation.
-        *
-        * @param asn Raw AS number
-        * @throws
-        *     @li IllegalArgumentException when asn is out of allowed range
-        *         (0-4294967295)
-        */
-       public ASNumber(final long asn) {
-               if (asn < 0 || asn > 4294967295L)
-                       throw new IllegalArgumentException("Invalid AS number");
-
-               this.highValue = (int) (asn / 65536);
-               this.lowValue = (int) (asn % 65536);
-       }
-
-       /**
-        * Get the AS number as a single integer. For 2-octet AS numbers,
-        * only low 1 bits are used.
-        *
-        * @return Raw AS number
-        */
-       public long getAsn() {
-               return highValue * 65536L + lowValue;
-       }
-
-       /**
-        * Get the high-valued part of the AS number. For 2-octet AS numbers,
-        * this will always be 0.
-        *
-        * @return High-order bits, guaranteed to be in 0-65535 range.
-        */
-       public int getHighValue() {
-               return highValue;
-       }
-
-       /**
-        * Get the low-valued part of the AS number. For 2-octet AS numbers,
-        * this value is equal to the AS number.
-        *
-        * @return Low-order bits, guaranteed to be in 0-65535 range.
-        */
-       public int getLowValue() {
-               return lowValue;
-       }
-
-       @Override
-       public boolean equals(final Object o) {
-               if (!(o instanceof ASNumber))
-                       return false;
-
-               final ASNumber as = (ASNumber)o;
-               return lowValue == as.lowValue && highValue == as.highValue;
-       }
-
-       @Override
-       public int hashCode() {
-               return 7 * lowValue + 13 * highValue;
-       }
-
-       @Override
-       public int compareTo(final ASNumber as) {
-               if (highValue != as.highValue)
-                       return highValue - as.highValue;
-               if (lowValue != as.lowValue)
-                       return lowValue - as.lowValue;
-               return 0;
-       }
-
-       /**
-        * {@inheritDoc}
-        *
-        * Output string is formated according in ASDOT notation.
-        * @see <a href="http://tools.ietf.org/html/rfc5396">RFC5396</a>
-        */
-       @Override
-       public String toString() {
-               final StringBuilder sb = new StringBuilder();
-
-               if (highValue != 0) {
-                       sb.append(highValue);
-                       sb.append('.');
-               }
-               sb.append(lowValue);
-               return sb.toString();
-       }
-}
-
index 6513e6c349cfc711038892912a54a7b874377948..d77f51750c9d397b8ede9a21aca31931184e71d5 100644 (file)
@@ -10,108 +10,54 @@ package org.opendaylight.protocol.concepts;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 
 import java.util.HashSet;
 import java.util.Set;
-import java.util.TreeSet;
 
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.*;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class ASNumberTest {
-       private ASNumber asn1, asn2, asn3, asn4;
+       private AsNumber asn1, asn2, asn3, asn4;
 
        @Before
        public void setUp() {
-               asn1 = new ASNumber(100, 200);
-               asn2 = new ASNumber(6553800);
-               asn3 = new ASNumber(0, 200);
-               asn4 = new ASNumber(100, 199);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testHighValueUnderflow() {
-               new ASNumber(-1, 0);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testHighValueOverflow() {
-               new ASNumber(65536, 0);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testLowValueUnderflow() {
-               new ASNumber(0, -1);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testLowValueOverflow() {
-               new ASNumber(0, 65536);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testAsnUnderflow() {
-               new ASNumber(0, -1);
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void testAsnOverflow() {
-               new ASNumber(4294967296L);
+               this.asn1 = new AsNumber(429496729800L);
+               this.asn3 = new AsNumber((long) 200);
+               this.asn4 = new AsNumber(429496729799L);
        }
 
        @Test
        public void testHashCode() {
-               final Set<ASNumber> set = new HashSet<ASNumber>();
+               final Set<AsNumber> set = new HashSet<>();
 
-               set.add(asn1);
+               set.add(this.asn1);
                assertEquals(1, set.size());
 
-               set.add(asn2);
-               assertEquals(1, set.size());
-
-               set.add(asn3);
-               assertEquals(2, set.size());
-       }
-
-       @Test
-       public void testCompareTo() {
-               final Set<ASNumber> set = new TreeSet<ASNumber>();
-
-               set.add(asn1);
-               assertEquals(1, set.size());
-
-               set.add(asn2);
-               assertEquals(1, set.size());
-
-               set.add(asn3);
+               set.add(this.asn3);
                assertEquals(2, set.size());
-
-               set.add(asn4);
-               assertEquals(3, set.size());
        }
 
        @Test
        public void testGetters() {
-               assertEquals(100, asn1.getHighValue());
-               assertEquals(200, asn1.getLowValue());
-               assertEquals(6553800, asn1.getAsn());
+               assertEquals(429496729800L, this.asn1.getValue().longValue());
        }
 
        @Test
        public void testEquals() {
-               assertThat(asn1, equalTo(asn2));
-               assertThat(asn1, not(equalTo(asn3)));
-               assertThat(asn1, not(equalTo(asn4)));
-               assertThat(asn1, not(equalTo(new Object())));
-               assertFalse(asn1.equals(new Object()));
+               assertThat(this.asn1, not(equalTo(this.asn3)));
+               assertThat(this.asn1, not(equalTo(this.asn4)));
+               assertThat(this.asn1, not(equalTo(new Object())));
+               assertFalse(this.asn1.equals(new Object()));
        }
 
        @Test
        public void testToString() {
-               assertEquals("100.200", asn1.toString());
-               assertEquals("200", asn3.toString());
+               assertEquals("AsNumber [_value=429496729800]", this.asn1.toString());
+               assertEquals("AsNumber [_value=200]", this.asn3.toString());
        }
 }
-
index 5e04c8df10753f01d19ddf04dce7479a9e11dd9b..ed67457f3d55b89bd030d415334383db270c5d57 100644 (file)
@@ -8,38 +8,37 @@
 
 package org.opendaylight.protocol.pcep.subobject;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.base.Objects.ToStringHelper;
 
 /**
  * Structure of Autonomous System Number Subobject.
- *
- * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.4">Section
- *      4.3.3.4.: Subobject 32: Autonomous System Number</a>
+ * 
+ * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.4">Section 4.3.3.4.: Subobject 32: Autonomous System
+ *      Number</a>
  */
 public class EROAsNumberSubobject extends ExplicitRouteSubobject {
 
-       private final ASNumber asnumber;
+       private final AsNumber asnumber;
 
        /**
         * Constructs new ASNumber Subobject.
-        *
-        * @param asnumber
-        *            ASNumber
-        * @param loose
-        *            boolean
+        * 
+        * @param asnumber ASNumber
+        * @param loose boolean
         */
-       public EROAsNumberSubobject(ASNumber asnumber, boolean loose) {
+       public EROAsNumberSubobject(final AsNumber asnumber, final boolean loose) {
                super(loose);
                this.asnumber = asnumber;
        }
 
        /**
-        * Gets {@link ASNumber}.
-        *
+        * Gets {@link AsNumber}.
+        * 
         * @return ASNumber
         */
-       public ASNumber getASNumber() {
+       public AsNumber getASNumber() {
                return this.asnumber;
        }
 
@@ -52,7 +51,7 @@ public class EROAsNumberSubobject extends ExplicitRouteSubobject {
        }
 
        @Override
-       public boolean equals(Object obj) {
+       public boolean equals(final Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
@@ -68,8 +67,8 @@ public class EROAsNumberSubobject extends ExplicitRouteSubobject {
                return true;
        }
 
-    @Override
-       protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
+       @Override
+       protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
                toStringHelper.add("asnumber", this.asnumber);
                return super.addToStringAttributes(toStringHelper);
        }
index e9c9f61ab5940f1339b0ea20aae05d2f207652e1..ba5dd02a4dc0c5c2926b4cdc1ea471e620d394fd 100644 (file)
@@ -8,70 +8,69 @@
 
 package org.opendaylight.protocol.pcep.subobject;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * Structure of Autonomous System Number Subobject.
- *
- * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.4">Section
- *      4.3.3.4.: Subobject 32: Autonomous System Number</a>
+ * 
+ * @see <a href="http://tools.ietf.org/html/rfc3209#section-4.3.3.4">Section 4.3.3.4.: Subobject 32: Autonomous System
+ *      Number</a>
  */
 public class RROAsNumberSubobject extends ReportedRouteSubobject {
 
-    private final ASNumber asnumber;
+       private final AsNumber asnumber;
 
-    /**
-     * Constructs new ASNumber Subobject.
-     *
-     * @param asnumber
-     *            ASNumber
-     */
-    public RROAsNumberSubobject(ASNumber asnumber) {
-       super();
-       this.asnumber = asnumber;
-    }
+       /**
+        * Constructs new ASNumber Subobject.
+        * 
+        * @param asnumber ASNumber
+        */
+       public RROAsNumberSubobject(final AsNumber asnumber) {
+               super();
+               this.asnumber = asnumber;
+       }
 
-    /**
-     * Gets {@link ASNumber}.
-     *
-     * @return ASNumber
-     */
-    public ASNumber getASNumber() {
-       return this.asnumber;
-    }
+       /**
+        * Gets {@link AsNumber}.
+        * 
+        * @return ASNumber
+        */
+       public AsNumber getASNumber() {
+               return this.asnumber;
+       }
 
-    @Override
-    public int hashCode() {
-       final int prime = 31;
-       int result = 1;
-       result = prime * result + ((this.asnumber == null) ? 0 : this.asnumber.hashCode());
-       return result;
-    }
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result + ((this.asnumber == null) ? 0 : this.asnumber.hashCode());
+               return result;
+       }
 
-    @Override
-    public boolean equals(Object obj) {
-       if (this == obj)
-           return true;
-       if (obj == null)
-           return false;
-       if (this.getClass() != obj.getClass())
-           return false;
-       final RROAsNumberSubobject other = (RROAsNumberSubobject) obj;
-       if (this.asnumber == null) {
-           if (other.asnumber != null)
-               return false;
-       } else if (!this.asnumber.equals(other.asnumber))
-           return false;
-       return true;
-    }
+       @Override
+       public boolean equals(final Object obj) {
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (this.getClass() != obj.getClass())
+                       return false;
+               final RROAsNumberSubobject other = (RROAsNumberSubobject) obj;
+               if (this.asnumber == null) {
+                       if (other.asnumber != null)
+                               return false;
+               } else if (!this.asnumber.equals(other.asnumber))
+                       return false;
+               return true;
+       }
 
-    @Override
-    public String toString() {
-       final StringBuilder builder = new StringBuilder();
-       builder.append("RROAsNumberSubobject [asnumber=");
-       builder.append(this.asnumber);
-       builder.append("]");
-       return builder.toString();
-    }
+       @Override
+       public String toString() {
+               final StringBuilder builder = new StringBuilder();
+               builder.append("RROAsNumberSubobject [asnumber=");
+               builder.append(this.asnumber);
+               builder.append("]");
+               return builder.toString();
+       }
 
 }
index a9b282ae3a23df3b601477f263069e0ef619f530..f6ce3f5a7ac756d5409ca2f8755e924c4388fff5 100644 (file)
@@ -7,37 +7,34 @@
  */
 package org.opendaylight.protocol.pcep.subobject;
 
-import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * Structure of Autonomous System Number Subobject. Defined in RFC5521.
- *
- * @see <a href="http://tools.ietf.org/html/rfc5521#section-2.1.1">Exclude Route
- *      Object definition</a>
+ * 
+ * @see <a href="http://tools.ietf.org/html/rfc5521#section-2.1.1">Exclude Route Object definition</a>
  */
 public class XROAsNumberSubobject extends ExcludeRouteSubobject {
 
-       private final ASNumber asnumber;
+       private final AsNumber asnumber;
 
        /**
         * Constructs new ASNumber Subobject.
-        *
-        * @param asnumber
-        *            ASNumber
-        * @param mandatory
-        *            boolean
+        * 
+        * @param asnumber ASNumber
+        * @param mandatory boolean
         */
-       public XROAsNumberSubobject(ASNumber asnumber, boolean mandatory) {
+       public XROAsNumberSubobject(final AsNumber asnumber, final boolean mandatory) {
                super(mandatory);
                this.asnumber = asnumber;
        }
 
        /**
-        * Gets {@link ASNumber}.
-        *
+        * Gets {@link AsNumber}.
+        * 
         * @return ASNumber
         */
-       public ASNumber getASNumber() {
+       public AsNumber getASNumber() {
                return this.asnumber;
        }
 
@@ -50,7 +47,7 @@ public class XROAsNumberSubobject extends ExcludeRouteSubobject {
        }
 
        @Override
-       public boolean equals(Object obj) {
+       public boolean equals(final Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
index c6085a03f42988696466ed8b6a87c41b78134cc6..5a4846fddbbd1497b1638f54b90f793e9e41b07d 100644 (file)
@@ -26,11 +26,6 @@ module rsvp {
                 reference "https://tools.ietf.org/html/rfc2205";
         }
 
-       // FIXME: BGP module
-       typedef as-number {
-               type uint32;
-       }
-
        typedef attribute-filter {
                type uint32;
        }
@@ -141,7 +136,7 @@ module rsvp {
        grouping as-number-subobject {
                leaf as-number {
                        reference "http://tools.ietf.org/html/rfc3209#section-4.3.3.4";
-                       type as-number;
+                       type inet:as-number;
                        mandatory true;
                }
        }
index ec759841277e8714780f9ec87374f041c0e91ffa..d71226d27e6a6c1af4fd1f6a31ca186dab6f7774 100644 (file)
@@ -15,8 +15,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
-
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.PCEPDocumentedException;
 import org.opendaylight.protocol.pcep.PCEPErrors;
@@ -25,6 +23,7 @@ import org.opendaylight.protocol.pcep.PCEPObject;
 import org.opendaylight.protocol.pcep.object.PCEPErrorObject;
 import org.opendaylight.protocol.pcep.subobject.EROAsNumberSubobject;
 import org.opendaylight.protocol.pcep.subobject.ExplicitRouteSubobject;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  *
@@ -58,7 +57,7 @@ public class APITest {
                        private static final long serialVersionUID = 1L;
                };
 
-               assertNotSame(msg1, msg2); //not same because they are anonymous classes
+               assertNotSame(msg1, msg2); // not same because they are anonymous classes
                assertEquals(msg1.hashCode(), msg2.hashCode());
                assertEquals(msg1.toString(), msg2.toString());
        }
@@ -80,12 +79,12 @@ public class APITest {
 
        @Test
        public void testSubobject() {
-               final ExplicitRouteSubobject sub1 = new EROAsNumberSubobject(new ASNumber(100), true);
+               final ExplicitRouteSubobject sub1 = new EROAsNumberSubobject(new AsNumber((long) 100), true);
                final ExplicitRouteSubobject sub2 = new ExplicitRouteSubobject(false) {
                };
                final ExplicitRouteSubobject sub3 = new ExplicitRouteSubobject(false) {
                };
-               final ExplicitRouteSubobject sub4 = new EROAsNumberSubobject(new ASNumber(100), true);
+               final ExplicitRouteSubobject sub4 = new EROAsNumberSubobject(new AsNumber((long) 100), true);
 
                assertNotSame(sub1, sub2);
                assertNotSame(sub2, sub3);
index 00ec0095f8d6d63ffa22d0bfd439db7690f28a7f..1d867bb09760ed103897ce7ddfdf87df5907c63a 100644 (file)
@@ -17,8 +17,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
-
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.Bandwidth;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
@@ -80,6 +78,8 @@ import org.opendaylight.protocol.pcep.subobject.XROSRLGSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROSubobjectAttribute;
 import org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject;
 import org.opendaylight.protocol.pcep.tlv.OrderTlv;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+
 import com.google.common.collect.Lists;
 
 /**
@@ -87,662 +87,620 @@ import com.google.common.collect.Lists;
  */
 public class ObjectsTest {
 
-    @Test
-    public void compositeErrorObjectTest() {
-
-       final List<PCEPErrorObject> errorObjects = new ArrayList<PCEPErrorObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPErrorObject(PCEPErrors.ATTEMPT_2ND_SESSION));
-           }
-       };
-
-       final List<PCEPRequestParameterObject> errorParams = new ArrayList<PCEPRequestParameterObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true));
-           }
-       };
-       final CompositeErrorObject m = new CompositeErrorObject(errorParams, errorObjects);
-       final CompositeErrorObject m2 = new CompositeErrorObject(errorParams, errorObjects);
-       final CompositeErrorObject m3 = new CompositeErrorObject(errorObjects);
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getErrors(), m2.getErrors());
-       assertEquals(m.getRequestParameters(), m2.getRequestParameters());
-       assertEquals(m, CompositeErrorObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeNotifyObjectTest() {
-
-       final List<PCEPNotificationObject> notifications = new ArrayList<PCEPNotificationObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPNotificationObject((short) 2, (short) 3));
-           }
-       };
-
-       final List<PCEPRequestParameterObject> reqParams = new ArrayList<PCEPRequestParameterObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true));
-           }
-       };
-       final CompositeNotifyObject m = new CompositeNotifyObject(reqParams, notifications);
-       final CompositeNotifyObject m2 = new CompositeNotifyObject(reqParams, notifications);
-       final CompositeNotifyObject m3 = new CompositeNotifyObject(notifications);
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getNotificationObjects(), m2.getNotificationObjects());
-       assertEquals(m.getRequestParameters(), m2.getRequestParameters());
-       assertEquals(m, CompositeNotifyObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositePathObjectTest() {
-
-       final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final CompositePathObject m = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2,
-               true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-           }
-       }, new PCEPIncludeRouteObject(subobjects, true, true));
-       final CompositePathObject m2 = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2,
-               true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-           }
-       }, new PCEPIncludeRouteObject(subobjects, true, true));
-       final CompositePathObject m3 = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, false));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getBandwidth(), m2.getBandwidth());
-       assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
-       assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
-       assertEquals(m.getLspa(), m2.getLspa());
-       assertEquals(m.getMetrics(), m2.getMetrics());
-       assertEquals(m, CompositePathObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeRptPathObjectTest() {
-
-       final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROUnnumberedInterfaceSubobject(new IPv4Address(
-                       new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true));
-               this.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(
-                       new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), false));
-           }
-       };
-
-       final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new RROUnnumberedInterfaceSubobject(new IPv4Address(
-                       new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2)));
-               this.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(
-                       new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), true, false));
-           }
-       };
-
-       final CompositeRptPathObject m = new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, false), new PCEPLspaObject(2, 2, 2, (short) 2,
-               (short) 2, true, true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new PCEPReportedRouteObject(rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+       private final AsNumber as = new AsNumber((long) 2555);
+
+       @Test
+       public void compositeErrorObjectTest() {
+
+               final List<PCEPErrorObject> errorObjects = new ArrayList<PCEPErrorObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPErrorObject(PCEPErrors.ATTEMPT_2ND_SESSION));
+                       }
+               };
+
+               final List<PCEPRequestParameterObject> errorParams = new ArrayList<PCEPRequestParameterObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true));
+                       }
+               };
+               final CompositeErrorObject m = new CompositeErrorObject(errorParams, errorObjects);
+               final CompositeErrorObject m2 = new CompositeErrorObject(errorParams, errorObjects);
+               final CompositeErrorObject m3 = new CompositeErrorObject(errorObjects);
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getErrors(), m2.getErrors());
+               assertEquals(m.getRequestParameters(), m2.getRequestParameters());
+               assertEquals(m, CompositeErrorObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeNotifyObjectTest() {
+
+               final List<PCEPNotificationObject> notifications = new ArrayList<PCEPNotificationObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPNotificationObject((short) 2, (short) 3));
+                       }
+               };
+
+               final List<PCEPRequestParameterObject> reqParams = new ArrayList<PCEPRequestParameterObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true));
+                       }
+               };
+               final CompositeNotifyObject m = new CompositeNotifyObject(reqParams, notifications);
+               final CompositeNotifyObject m2 = new CompositeNotifyObject(reqParams, notifications);
+               final CompositeNotifyObject m3 = new CompositeNotifyObject(notifications);
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getNotificationObjects(), m2.getNotificationObjects());
+               assertEquals(m.getRequestParameters(), m2.getRequestParameters());
+               assertEquals(m, CompositeNotifyObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositePathObjectTest() {
+
+               final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final CompositePathObject m = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
+               }, new PCEPIncludeRouteObject(subobjects, true, true));
+               final CompositePathObject m2 = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
+               }, new PCEPIncludeRouteObject(subobjects, true, true));
+               final CompositePathObject m3 = new CompositePathObject(new PCEPExplicitRouteObject(subobjects, false));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getBandwidth(), m2.getBandwidth());
+               assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
+               assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
+               assertEquals(m.getLspa(), m2.getLspa());
+               assertEquals(m.getMetrics(), m2.getMetrics());
+               assertEquals(m, CompositePathObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeRptPathObjectTest() {
+
+               final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true));
+                               this.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122,
+                                               (byte) 125, (byte) 2 }), 22), false));
+                       }
+               };
+
+               final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new RROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2)));
+                               this.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122,
+                                               (byte) 125, (byte) 2 }), 22), true, false));
+                       }
+               };
+
+               final CompositeRptPathObject m = new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, false), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPReportedRouteObject(rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                });
-       final CompositeRptPathObject m2 = new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, false), new PCEPLspaObject(2, 2, 2, (short) 2,
-               (short) 2, true, true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new PCEPReportedRouteObject(rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+               final CompositeRptPathObject m2 = new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, false), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPReportedRouteObject(rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                });
-       final CompositePathObject m3 = new CompositePathObject(new PCEPExplicitRouteObject(eroSubobjects, false));
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getBandwidth(), m2.getBandwidth());
-       assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
-       assertEquals(m.getLspa(), m2.getLspa());
-       assertEquals(m.getMetrics(), m2.getMetrics());
-       assertEquals(m, CompositeRptPathObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeUpdPathObjectTest() {
-
-       final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final CompositeUpdPathObject m = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2,
-               (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+               final CompositePathObject m3 = new CompositePathObject(new PCEPExplicitRouteObject(eroSubobjects, false));
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getBandwidth(), m2.getBandwidth());
+               assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
+               assertEquals(m.getLspa(), m2.getLspa());
+               assertEquals(m.getMetrics(), m2.getMetrics());
+               assertEquals(m, CompositeRptPathObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeUpdPathObjectTest() {
+
+               final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final CompositeUpdPathObject m = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                });
-       final CompositeUpdPathObject m2 = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2,
-               (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+               final CompositeUpdPathObject m2 = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                });
-       final CompositeUpdPathObject m3 = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, false));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getBandwidth(), m2.getBandwidth());
-       assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
-       assertEquals(m.getLspa(), m2.getLspa());
-       assertEquals(m.getMetrics(), m2.getMetrics());
-       assertEquals(m, CompositeUpdPathObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeRequestedObjectTest() {
-
-       final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new RROAsNumberSubobject(new ASNumber(2555)));
-           }
-       };
-
-       final CompositeRequestObject m = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false,
-               (short) 1, 1, new ArrayList<PCEPTlv>() {
-                   private static final long serialVersionUID = 1L;
-                   {
-                       this.add(new OrderTlv(1L, 2L));
-                   }
-               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 1 })), new PCEPClassTypeObject((short) 2), new PCEPLspObject((short) 1, true, true, true,
-               true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth(
-               (float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-           }
-       }, new PCEPReportedRouteObject(rroSubobjects, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new PCEPIncludeRouteObject(eroSubobjects, true, true), new PCEPLoadBalancingObject(2, new Bandwidth((float) 0.2), true));
-       final CompositeRequestObject m2 = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false,
-               (short) 1, 1, new ArrayList<PCEPTlv>() {
-                   private static final long serialVersionUID = 1L;
-                   {
-                       this.add(new OrderTlv(1L, 2L));
-                   }
-               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 1 })), new PCEPClassTypeObject((short) 2), new PCEPLspObject((short) 1, true, true, true,
-               true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth(
-               (float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-           }
-       }, new PCEPReportedRouteObject(rroSubobjects, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true),
-               new PCEPIncludeRouteObject(eroSubobjects, true, true), new PCEPLoadBalancingObject(2, new Bandwidth((float) 0.2), true));
-       final CompositeRequestObject m3 = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false,
-               (short) 1, 1, new ArrayList<PCEPTlv>() {
-                   private static final long serialVersionUID = 1L;
-                   {
-                       this.add(new OrderTlv(1L, 2L));
-                   }
-               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 1 })));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getBandwidth(), m2.getBandwidth());
-       assertEquals(m.getLspa(), m2.getLspa());
-       assertEquals(m.getMetrics(), m2.getMetrics());
-       assertEquals(m.getClassType(), m2.getClassType());
-       assertEquals(m.getEndPoints(), m2.getEndPoints());
-       assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
-       assertEquals(m.getLsp(), m2.getLsp());
-       assertEquals(m.getRroBandwidth(), m2.getRroBandwidth());
-       assertEquals(m, CompositeRequestObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeResponseObjectTest() {
-
-       final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final List<CompositePathObject> paths = new ArrayList<CompositePathObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true,
-                       true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
-               }, new PCEPIncludeRouteObject(subobjects, true, true)));
-           }
-       };
-
-       final CompositeResponseObject m = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false,
-               (short) 1, 1, true, true), new PCEPNoPathObject((short) 2, true, false), new PCEPLspObject((short) 1, true, true, true, true),
-               new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222),
-                       true, true), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+               final CompositeUpdPathObject m3 = new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, false));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getBandwidth(), m2.getBandwidth());
+               assertEquals(m.getExcludedRoute(), m2.getExcludedRoute());
+               assertEquals(m.getLspa(), m2.getLspa());
+               assertEquals(m.getMetrics(), m2.getMetrics());
+               assertEquals(m, CompositeUpdPathObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeRequestedObjectTest() {
+
+               final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new RROAsNumberSubobject(ObjectsTest.this.as));
+                       }
+               };
+
+               final CompositeRequestObject m = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false, (short) 1, 1, new ArrayList<PCEPTlv>() {
+                       private static final long serialVersionUID = 1L;
+                       {
+                               this.add(new OrderTlv(1L, 2L));
+                       }
+               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(new byte[] {
+                               (byte) 127, (byte) 0, (byte) 0, (byte) 1 })), new PCEPClassTypeObject((short) 2), new PCEPLspObject((short) 1, true, true, true, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
+               }, new PCEPReportedRouteObject(rroSubobjects, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPIncludeRouteObject(eroSubobjects, true, true), new PCEPLoadBalancingObject(2, new Bandwidth((float) 0.2), true));
+               final CompositeRequestObject m2 = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false, (short) 1, 1, new ArrayList<PCEPTlv>() {
+                       private static final long serialVersionUID = 1L;
+                       {
+                               this.add(new OrderTlv(1L, 2L));
+                       }
+               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(new byte[] {
+                               (byte) 127, (byte) 0, (byte) 0, (byte) 1 })), new PCEPClassTypeObject((short) 2), new PCEPLspObject((short) 1, true, true, true, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
+               }, new PCEPReportedRouteObject(rroSubobjects, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPIncludeRouteObject(eroSubobjects, true, true), new PCEPLoadBalancingObject(2, new Bandwidth((float) 0.2), true));
+               final CompositeRequestObject m3 = new CompositeRequestObject(new PCEPRequestParameterObject(true, true, true, true, true, true, false, false, false, (short) 1, 1, new ArrayList<PCEPTlv>() {
+                       private static final long serialVersionUID = 1L;
+                       {
+                               this.add(new OrderTlv(1L, 2L));
+                       }
+               }, true, true), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new IPv4Address(new byte[] {
+                               (byte) 127, (byte) 0, (byte) 0, (byte) 1 })));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getBandwidth(), m2.getBandwidth());
+               assertEquals(m.getLspa(), m2.getLspa());
+               assertEquals(m.getMetrics(), m2.getMetrics());
+               assertEquals(m.getClassType(), m2.getClassType());
+               assertEquals(m.getEndPoints(), m2.getEndPoints());
+               assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
+               assertEquals(m.getLsp(), m2.getLsp());
+               assertEquals(m.getRroBandwidth(), m2.getRroBandwidth());
+               assertEquals(m, CompositeRequestObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeResponseObjectTest() {
+
+               final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final List<CompositePathObject> paths = new ArrayList<CompositePathObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new CompositePathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                                       private static final long serialVersionUID = 1L;
+
+                                       {
+                                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                                       }
+                               }, new PCEPIncludeRouteObject(subobjects, true, true)));
+                       }
+               };
+
+               final CompositeResponseObject m = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true), new PCEPNoPathObject((short) 2, true, false), new PCEPLspObject((short) 1, true, true, true, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                }, new PCEPIncludeRouteObject(subobjects, true, true), paths);
-       final CompositeResponseObject m2 = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false,
-               (short) 1, 1, true, true), new PCEPNoPathObject((short) 2, true, false), new PCEPLspObject((short) 1, true, true, true, true),
-               new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222),
-                       true, true), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
+               final CompositeResponseObject m2 = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true), new PCEPNoPathObject((short) 2, true, false), new PCEPLspObject((short) 1, true, true, true, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                       }
                }, new PCEPIncludeRouteObject(subobjects, true, true), paths);
-       final CompositeResponseObject m3 = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false,
-               (short) 1, 1, true, true));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getBandwidth(), m2.getBandwidth());
-       assertEquals(m.getLspa(), m2.getLspa());
-       assertEquals(m.getMetrics(), m2.getMetrics());
-       assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
-       assertEquals(m.getLsp(), m2.getLsp());
-       assertEquals(m.getPaths(), m2.getPaths());
-       assertEquals(m.getRequestParameter(), m2.getRequestParameter());
-       assertEquals(m, CompositeResponseObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeStateReportObjectTest() {
-
-       final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new RROAsNumberSubobject(new ASNumber(2555)));
-           }
-       };
-
-       final List<CompositeRptPathObject> paths = new ArrayList<CompositeRptPathObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true,
-                       true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPReportedRouteObject(
-                       rroSubobjects, true), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
-               }));
-           }
-       };
-
-       final CompositeStateReportObject m = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
-       final CompositeStateReportObject m2 = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
-       final CompositeStateReportObject m3 = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getLsp(), m2.getLsp());
-       assertEquals(m.getPaths(), m2.getPaths());
-       assertEquals(m, CompositeStateReportObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeUpdateRequestObjectTest() {
-
-       final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new EROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final List<CompositeUpdPathObject> paths = new ArrayList<CompositeUpdPathObject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true,
-                       true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
-                   }
-               }));
-           }
-       };
-
-       final CompositeUpdateRequestObject m = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
-       final CompositeUpdateRequestObject m2 = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
-       final CompositeUpdateRequestObject m3 = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getLsp(), m2.getLsp());
-       assertEquals(m.getPaths(), m2.getPaths());
-       assertEquals(m, CompositeUpdateRequestObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeRequestSVECObjectTest() {
-
-       final List<ExcludeRouteSubobject> subobjects = new ArrayList<ExcludeRouteSubobject>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(new XROAsNumberSubobject(new ASNumber(2555), false));
-           }
-       };
-
-       final List<Long> requestIds = new ArrayList<Long>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(0x12345678L);
-           }
-       };
-
-       final CompositeRequestSvecObject m = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true),
-               new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new PCEPGlobalConstraintsObject((short) 2, (short) 2, (short) 2, (short) 2,
-                       true, false), new PCEPExcludeRouteObject(subobjects, true, true, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
-                   }
+               final CompositeResponseObject m3 = new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, true, true, false, false, false, (short) 1, 1, true, true));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getBandwidth(), m2.getBandwidth());
+               assertEquals(m.getLspa(), m2.getLspa());
+               assertEquals(m.getMetrics(), m2.getMetrics());
+               assertEquals(m.getIncludeRoute(), m2.getIncludeRoute());
+               assertEquals(m.getLsp(), m2.getLsp());
+               assertEquals(m.getPaths(), m2.getPaths());
+               assertEquals(m.getRequestParameter(), m2.getRequestParameter());
+               assertEquals(m, CompositeResponseObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeStateReportObjectTest() {
+
+               final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new RROAsNumberSubobject(ObjectsTest.this.as));
+                       }
+               };
+
+               final List<CompositeRptPathObject> paths = new ArrayList<CompositeRptPathObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(eroSubobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPExistingPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new PCEPReportedRouteObject(rroSubobjects, true), new ArrayList<PCEPMetricObject>() {
+                                       private static final long serialVersionUID = 1L;
+
+                                       {
+                                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                                       }
+                               }));
+                       }
+               };
+
+               final CompositeStateReportObject m = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
+               final CompositeStateReportObject m2 = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
+               final CompositeStateReportObject m3 = new CompositeStateReportObject(new PCEPLspObject((short) 1, true, true, true, true));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getLsp(), m2.getLsp());
+               assertEquals(m.getPaths(), m2.getPaths());
+               assertEquals(m, CompositeStateReportObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeUpdateRequestObjectTest() {
+
+               final List<ExplicitRouteSubobject> subobjects = new ArrayList<ExplicitRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new EROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final List<CompositeUpdPathObject> paths = new ArrayList<CompositeUpdPathObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(subobjects, true), new PCEPLspaObject(2, 2, 2, (short) 2, (short) 2, true, true, true, true), new PCEPRequestedPathBandwidthObject(new Bandwidth((float) 0.222), true, true), new ArrayList<PCEPMetricObject>() {
+                                       private static final long serialVersionUID = 1L;
+
+                                       {
+                                               this.add(new PCEPMetricObject(true, true, new TEMetric(255), true, false));
+                                       }
+                               }));
+                       }
+               };
+
+               final CompositeUpdateRequestObject m = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
+               final CompositeUpdateRequestObject m2 = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true), paths);
+               final CompositeUpdateRequestObject m3 = new CompositeUpdateRequestObject(new PCEPLspObject((short) 1, true, true, true, true));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getLsp(), m2.getLsp());
+               assertEquals(m.getPaths(), m2.getPaths());
+               assertEquals(m, CompositeUpdateRequestObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeRequestSVECObjectTest() {
+
+               final List<ExcludeRouteSubobject> subobjects = new ArrayList<ExcludeRouteSubobject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new XROAsNumberSubobject(ObjectsTest.this.as, false));
+                       }
+               };
+
+               final List<Long> requestIds = new ArrayList<Long>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(0x12345678L);
+                       }
+               };
+
+               final CompositeRequestSvecObject m = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true), new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new PCEPGlobalConstraintsObject((short) 2, (short) 2, (short) 2, (short) 2, true, false), new PCEPExcludeRouteObject(subobjects, true, true, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
+                       }
                });
-       final CompositeRequestSvecObject m2 = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true),
-               new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new PCEPGlobalConstraintsObject((short) 2, (short) 2, (short) 2, (short) 2,
-                       true, false), new PCEPExcludeRouteObject(subobjects, true, true, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
-                   }
+               final CompositeRequestSvecObject m2 = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true), new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new PCEPGlobalConstraintsObject((short) 2, (short) 2, (short) 2, (short) 2, true, false), new PCEPExcludeRouteObject(subobjects, true, true, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
+                       }
                });
-       final CompositeRequestSvecObject m3 = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getExcludeRoute(), m2.getExcludeRoute());
-       assertEquals(m.getGlobalConstraints(), m2.getGlobalConstraints());
-       assertEquals(m.getObjectiveFunction(), m2.getObjectiveFunction());
-       assertEquals(m.getSvec(), m2.getSvec());
-       assertEquals(m, CompositeRequestSvecObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void compositeRplySVECObjectTest() {
-
-       final List<Long> requestIds = new ArrayList<Long>() {
-           private static final long serialVersionUID = 1L;
-
-           {
-               this.add(0x12345678L);
-           }
-       };
-
-       final CompositeReplySvecObject m = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true),
-               new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
-
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
-                   }
+               final CompositeRequestSvecObject m3 = new CompositeRequestSvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getExcludeRoute(), m2.getExcludeRoute());
+               assertEquals(m.getGlobalConstraints(), m2.getGlobalConstraints());
+               assertEquals(m.getObjectiveFunction(), m2.getObjectiveFunction());
+               assertEquals(m.getSvec(), m2.getSvec());
+               assertEquals(m, CompositeRequestSvecObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void compositeRplySVECObjectTest() {
+
+               final List<Long> requestIds = new ArrayList<Long>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(0x12345678L);
+                       }
+               };
+
+               final CompositeReplySvecObject m = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true), new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
+
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
+                       }
                });
-       final CompositeReplySvecObject m2 = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true),
-               new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new ArrayList<PCEPMetricObject>() {
-                   private static final long serialVersionUID = 1L;
+               final CompositeReplySvecObject m2 = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true), new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false), new ArrayList<PCEPMetricObject>() {
+                       private static final long serialVersionUID = 1L;
 
-                   {
-                       this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
-                   }
+                       {
+                               this.add(new PCEPMetricObject(true, true, new TEMetric(0x123456), true, false));
+                       }
                });
-       final CompositeReplySvecObject m3 = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true));
-
-       assertEquals(m, m2);
-       assertEquals(m.toString(), m2.toString());
-       assertEquals(m.hashCode(), m2.hashCode());
-       assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
-       assertEquals(m.getObjectiveFunction(), m2.getObjectiveFunction());
-       assertEquals(m.getSvec(), m2.getSvec());
-       assertEquals(m, CompositeReplySvecObject.getCompositeFromList(m.getCompositeAsList()));
-       assertFalse(m.equals(null));
-       assertFalse(m.equals(m3));
-       assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(m.equals(m));
-    }
-
-    @Test
-    public void subobjectsTest() {
-       final EROAsNumberSubobject as = new EROAsNumberSubobject(new ASNumber(2555), false);
-       final EROUnnumberedInterfaceSubobject uis = new EROUnnumberedInterfaceSubobject(new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true);
-       final EROIPPrefixSubobject<IPv4Prefix> ips = new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), false);
-
-       assertEquals(as.getASNumber().getAsn(), 2555);
-       assertEquals(as.isLoose(), false);
-       assertFalse(as.equals(null));
-       assertFalse(as.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(as.equals(as));
-
-       assertEquals(uis.getInterfaceID().getInterfaceId(), 2);
-       assertEquals(uis.getRouterID(),
-               new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }));
-       assertEquals(uis.isLoose(), true);
-       assertFalse(uis.equals(null));
-       assertFalse(uis.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(uis.equals(uis));
-
-       assertEquals(
-               ips.getPrefix(),
-               new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22));
-       assertEquals(ips.isLoose(), false);
-       assertFalse(ips.equals(null));
-       assertFalse(ips.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(ips.equals(ips));
-    }
-
-    @Test
-    public void xroSubobjectsTest() {
-       final XROAsNumberSubobject as = new XROAsNumberSubobject(new ASNumber(2555), false);
-       final XROUnnumberedInterfaceSubobject uis = new XROUnnumberedInterfaceSubobject(new IPv4Address(
-               new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true, XROSubobjectAttribute.SRLG);
-       final XROIPPrefixSubobject<IPv4Prefix> ips = new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), false, XROSubobjectAttribute.SRLG);
-       final XROSRLGSubobject srlg = new XROSRLGSubobject(new SharedRiskLinkGroup(0x1234L), true);
-
-       assertEquals(as.getASNumber().getAsn(), 2555);
-       assertEquals(as.isMandatory(), false);
-       assertFalse(as.equals(null));
-       assertFalse(as.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(as.equals(as));
-       assertEquals(as.toString(), "XROAsNumberSubobject [asnumber=2555, mandatory=false]");
-
-       assertEquals(uis.getInterfaceID().getInterfaceId(), 2);
-       assertEquals(uis.getRouterID(),
-               new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }));
-       assertEquals(uis.isMandatory(), true);
-       assertFalse(uis.equals(null));
-       assertFalse(uis.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(uis.equals(uis));
-       assertEquals(uis.getAttribute(), XROSubobjectAttribute.SRLG);
-       assertEquals(uis.toString(),
-               "XROUnnumberedInterfaceSubobject [attribute=SRLG, interfaceID=UnnumberedInterfaceIdentifier [interfaceId=2], routerID=127.0.0.2, mandatory=true]");
-
-       assertEquals(
-               ips.getPrefix(),
-               new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22));
-       assertEquals(ips.isMandatory(), false);
-       assertFalse(ips.equals(null));
-       assertFalse(ips.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(ips.equals(ips));
-       assertEquals(ips.getAttribute(), XROSubobjectAttribute.SRLG);
-       assertEquals(ips.toString(), "XROIPPrefixSubobject [attribute=SRLG, prefix=12.122.124.0/22, mandatory=false]");
-
-       assertEquals(srlg.getSrlgId().getValue(), 0x1234L);
-       assertEquals(srlg.getAttribute(), XROSubobjectAttribute.SRLG);
-       assertFalse(srlg.equals(null));
-       assertFalse(srlg.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
-       assertTrue(srlg.equals(srlg));
-       assertEquals(srlg.toString(), "XROSRLGSubobject [attribute=SRLG, srlgId=4660, mandatory=true]");
-    }
-
-    @Test
-    public void testToString(){
-       final List<PCEPObject> objects = Lists.newArrayList();
-       objects.add(new PCEPExistingPathBandwidthObject(new Bandwidth(22.0), true, false));
-       objects.add(new PCEPRequestedPathBandwidthObject(new Bandwidth(22.0), true, false));
-       objects.add(new PCEPEndPointsObject<IPv4Address>(IPv4.FAMILY.addressForBytes(new byte[]{1,1,1,1}),
-                       IPv4.FAMILY.addressForBytes(new byte[]{1,1,1,2})));
-               objects.add(new PCEPP2MPEndPointsObject<IPv4Address>(0, IPv4.FAMILY.addressForBytes(new byte[] { 1, 1, 1, 1 }),
-                               Lists.newArrayList(IPv4.FAMILY.addressForBytes(new byte[] { 1, 1, 1, 1 })), true, false));
-
-       for (final PCEPObject o: objects) {
+               final CompositeReplySvecObject m3 = new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIds, true));
+
+               assertEquals(m, m2);
+               assertEquals(m.toString(), m2.toString());
+               assertEquals(m.hashCode(), m2.hashCode());
+               assertEquals(m.getCompositeAsList(), m2.getCompositeAsList());
+               assertEquals(m.getObjectiveFunction(), m2.getObjectiveFunction());
+               assertEquals(m.getSvec(), m2.getSvec());
+               assertEquals(m, CompositeReplySvecObject.getCompositeFromList(m.getCompositeAsList()));
+               assertFalse(m.equals(null));
+               assertFalse(m.equals(m3));
+               assertFalse(m.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(m.equals(m));
+       }
+
+       @Test
+       public void subobjectsTest() {
+               final EROAsNumberSubobject xas = new EROAsNumberSubobject(this.as, false);
+               final EROUnnumberedInterfaceSubobject uis = new EROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 127, (byte) 0,
+                               (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true);
+               final EROIPPrefixSubobject<IPv4Prefix> ips = new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] {
+                               (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), false);
+
+               assertEquals(xas.getASNumber().getValue().longValue(), 2555);
+               assertEquals(xas.isLoose(), false);
+               assertFalse(xas.equals(null));
+               assertFalse(xas.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(xas.equals(xas));
+
+               assertEquals(uis.getInterfaceID().getInterfaceId(), 2);
+               assertEquals(uis.getRouterID(), new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }));
+               assertEquals(uis.isLoose(), true);
+               assertFalse(uis.equals(null));
+               assertFalse(uis.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(uis.equals(uis));
+
+               assertEquals(ips.getPrefix(), new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22));
+               assertEquals(ips.isLoose(), false);
+               assertFalse(ips.equals(null));
+               assertFalse(ips.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(ips.equals(ips));
+       }
+
+       @Test
+       public void xroSubobjectsTest() {
+               final XROAsNumberSubobject xas = new XROAsNumberSubobject(this.as, false);
+               final XROUnnumberedInterfaceSubobject uis = new XROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 127, (byte) 0,
+                               (byte) 0, (byte) 2 }), new UnnumberedInterfaceIdentifier(2), true, XROSubobjectAttribute.SRLG);
+               final XROIPPrefixSubobject<IPv4Prefix> ips = new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] {
+                               (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22), false, XROSubobjectAttribute.SRLG);
+               final XROSRLGSubobject srlg = new XROSRLGSubobject(new SharedRiskLinkGroup(0x1234L), true);
+
+               assertEquals(xas.getASNumber().getValue().longValue(), 2555);
+               assertEquals(xas.isMandatory(), false);
+               assertFalse(xas.equals(null));
+               assertFalse(xas.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(xas.equals(xas));
+               assertEquals(xas.toString(), "XROAsNumberSubobject [asnumber=AsNumber [_value=2555], mandatory=false]");
+
+               assertEquals(uis.getInterfaceID().getInterfaceId(), 2);
+               assertEquals(uis.getRouterID(), new IPv4Address(new byte[] { (byte) 127, (byte) 0, (byte) 0, (byte) 2 }));
+               assertEquals(uis.isMandatory(), true);
+               assertFalse(uis.equals(null));
+               assertFalse(uis.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(uis.equals(uis));
+               assertEquals(uis.getAttribute(), XROSubobjectAttribute.SRLG);
+               assertEquals(
+                               uis.toString(),
+                               "XROUnnumberedInterfaceSubobject [attribute=SRLG, interfaceID=UnnumberedInterfaceIdentifier [interfaceId=2], routerID=127.0.0.2, mandatory=true]");
+
+               assertEquals(ips.getPrefix(), new IPv4Prefix(new IPv4Address(new byte[] { (byte) 12, (byte) 122, (byte) 125, (byte) 2 }), 22));
+               assertEquals(ips.isMandatory(), false);
+               assertFalse(ips.equals(null));
+               assertFalse(ips.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(ips.equals(ips));
+               assertEquals(ips.getAttribute(), XROSubobjectAttribute.SRLG);
+               assertEquals(ips.toString(), "XROIPPrefixSubobject [attribute=SRLG, prefix=12.122.124.0/22, mandatory=false]");
+
+               assertEquals(srlg.getSrlgId().getValue(), 0x1234L);
+               assertEquals(srlg.getAttribute(), XROSubobjectAttribute.SRLG);
+               assertFalse(srlg.equals(null));
+               assertFalse(srlg.equals(new PCEPOpenMessage(new PCEPOpenObject(10, 10, 1))));
+               assertTrue(srlg.equals(srlg));
+               assertEquals(srlg.toString(), "XROSRLGSubobject [attribute=SRLG, srlgId=4660, mandatory=true]");
+       }
+
+       @Test
+       public void testToString() {
+               final List<PCEPObject> objects = Lists.newArrayList();
+               objects.add(new PCEPExistingPathBandwidthObject(new Bandwidth(22.0), true, false));
+               objects.add(new PCEPRequestedPathBandwidthObject(new Bandwidth(22.0), true, false));
+               objects.add(new PCEPEndPointsObject<IPv4Address>(IPv4.FAMILY.addressForBytes(new byte[] { 1, 1, 1, 1 }), IPv4.FAMILY.addressForBytes(new byte[] {
+                               1, 1, 1, 2 })));
+               objects.add(new PCEPP2MPEndPointsObject<IPv4Address>(0, IPv4.FAMILY.addressForBytes(new byte[] { 1, 1, 1, 1 }), Lists.newArrayList(IPv4.FAMILY.addressForBytes(new byte[] {
+                               1, 1, 1, 1 })), true, false));
+
+               for (final PCEPObject o : objects) {
                        assertThat(o.toString(), containsString("processed=true"));
                        assertThat(o.toString(), containsString("ignored=false"));
-                       if(o instanceof PCEPBandwidthObject)
+                       if (o instanceof PCEPBandwidthObject)
                                assertThat(o.toString(), containsString("bandwidth=Bandwidth [bytesPerSecond=22.0]"));
-                       if(o instanceof PCEPEndPoints)
+                       if (o instanceof PCEPEndPoints)
                                assertThat(o.toString(), containsString("sourceAddress=1.1.1.1"));
-                       if(o instanceof PCEPP2MPEndPointsObject)
+                       if (o instanceof PCEPP2MPEndPointsObject)
                                assertThat(o.toString(), containsString("destinationAddresses=[1.1.1.1]"));
                }
-    }
+       }
 
 }
index 580232bff15b7ad5560f39d4a6cc6b0e5b7306dc..60d14e968031bf766ca0d376bd8cb9ced4e2fbb2 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.protocol.pcep.impl.subobject;
 
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.subobject.EROAsNumberSubobject;
 import org.opendaylight.protocol.pcep.subobject.ExplicitRouteSubobject;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
- * Parser for {@link org.opendaylight.protocol.pcep.subobject.EROAsNumberSubobject
- * EROAsNumberSubobject}
+ * Parser for {@link org.opendaylight.protocol.pcep.subobject.EROAsNumberSubobject EROAsNumberSubobject}
  */
 
 public class EROAsNumberSubobjectParser {
@@ -25,24 +24,25 @@ public class EROAsNumberSubobjectParser {
 
        public static final int CONTENT_LENGTH = AS_NUMBER_LENGTH + AS_NUMBER_OFFSET;
 
-       public static EROAsNumberSubobject parse(byte[] soContentsBytes, boolean loose) throws PCEPDeserializerException {
+       public static EROAsNumberSubobject parse(final byte[] soContentsBytes, final boolean loose) throws PCEPDeserializerException {
                if (soContentsBytes == null || soContentsBytes.length == 0)
                        throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
                if (soContentsBytes.length != CONTENT_LENGTH)
-                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: " + CONTENT_LENGTH + ".");
+                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: "
+                                       + CONTENT_LENGTH + ".");
 
-               return new EROAsNumberSubobject(new ASNumber((ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)), loose);
+               return new EROAsNumberSubobject(new AsNumber((long) (ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)), loose);
        }
 
-       public static byte[] put(ExplicitRouteSubobject objToSerialize) {
+       public static byte[] put(final ExplicitRouteSubobject objToSerialize) {
                if (!(objToSerialize instanceof EROAsNumberSubobject))
                        throw new IllegalArgumentException("Unknown ExplicitRouteSubobject instance. Passed " + objToSerialize.getClass()
                                        + ". Needed EROAsNumberSubobject.");
 
                final byte[] retBytes = new byte[CONTENT_LENGTH];
 
-               System.arraycopy(ByteArray.longToBytes(((EROAsNumberSubobject) objToSerialize).getASNumber().getAsn()), Long.SIZE / Byte.SIZE - AS_NUMBER_LENGTH,
-                               retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
+               System.arraycopy(ByteArray.longToBytes(((EROAsNumberSubobject) objToSerialize).getASNumber().getValue()), Long.SIZE / Byte.SIZE
+                               - AS_NUMBER_LENGTH, retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
 
                return retBytes;
        }
index 84e31589cee90b61eb0e5c2aaffc2fa2e0984e57..99227d39b0abeba3ecbbbeef42ed7947d07b4232 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.protocol.pcep.impl.subobject;
 
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.subobject.RROAsNumberSubobject;
 import org.opendaylight.protocol.pcep.subobject.ReportedRouteSubobject;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
- * Parser for {@link org.opendaylight.protocol.pcep.subobject.RROAsNumberSubobject
- * RROAsNumberSubobject}
+ * Parser for {@link org.opendaylight.protocol.pcep.subobject.RROAsNumberSubobject RROAsNumberSubobject}
  */
 
 public class RROAsNumberSubobjectParser {
@@ -25,24 +24,25 @@ public class RROAsNumberSubobjectParser {
 
        public static final int CONTENT_LENGTH = AS_NUMBER_LENGTH + AS_NUMBER_OFFSET;
 
-       public static RROAsNumberSubobject parse(byte[] soContentsBytes) throws PCEPDeserializerException {
+       public static RROAsNumberSubobject parse(final byte[] soContentsBytes) throws PCEPDeserializerException {
                if (soContentsBytes == null || soContentsBytes.length == 0)
                        throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
                if (soContentsBytes.length != CONTENT_LENGTH)
-                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: " + CONTENT_LENGTH + ".");
+                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: "
+                                       + CONTENT_LENGTH + ".");
 
-               return new RROAsNumberSubobject(new ASNumber((ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)));
+               return new RROAsNumberSubobject(new AsNumber((long) (ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)));
        }
 
-       public static byte[] put(ReportedRouteSubobject objToSerialize) {
+       public static byte[] put(final ReportedRouteSubobject objToSerialize) {
                if (!(objToSerialize instanceof RROAsNumberSubobject))
                        throw new IllegalArgumentException("Unknown ReportedRouteSubobject instance. Passed " + objToSerialize.getClass()
                                        + ". Needed RROAsNumberSubobject.");
 
                final byte[] retBytes = new byte[CONTENT_LENGTH];
 
-               System.arraycopy(ByteArray.longToBytes(((RROAsNumberSubobject) objToSerialize).getASNumber().getAsn()), Long.SIZE / Byte.SIZE - AS_NUMBER_LENGTH,
-                               retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
+               System.arraycopy(ByteArray.longToBytes(((RROAsNumberSubobject) objToSerialize).getASNumber().getValue()), Long.SIZE / Byte.SIZE
+                               - AS_NUMBER_LENGTH, retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
 
                return retBytes;
        }
index e9cc60aff5b8ea2cea2e68aa9e97533464de69cd..0d84bbffdc3dee24b78686a2cc53cbd07d519abe 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.protocol.pcep.impl.subobject;
 
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.subobject.ExcludeRouteSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROAsNumberSubobject;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
- * Parser for {@link org.opendaylight.protocol.pcep.subobject.XROAsNumberSubobject
- * XROAsNumberSubobject}
+ * Parser for {@link org.opendaylight.protocol.pcep.subobject.XROAsNumberSubobject XROAsNumberSubobject}
  */
 
 public class XROAsNumberSubobjectParser {
@@ -25,23 +24,25 @@ public class XROAsNumberSubobjectParser {
 
        public static final int CONTENT_LENGTH = AS_NUMBER_LENGTH + AS_NUMBER_OFFSET;
 
-       public static XROAsNumberSubobject parse(byte[] soContentsBytes, boolean mandatory) throws PCEPDeserializerException {
+       public static XROAsNumberSubobject parse(final byte[] soContentsBytes, final boolean mandatory) throws PCEPDeserializerException {
                if (soContentsBytes == null || soContentsBytes.length == 0)
                        throw new IllegalArgumentException("Array of bytes is mandatory. Can't be null or empty.");
                if (soContentsBytes.length != CONTENT_LENGTH)
-                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: " + CONTENT_LENGTH + ".");
+                       throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + soContentsBytes.length + "; Expected: "
+                                       + CONTENT_LENGTH + ".");
 
-               return new XROAsNumberSubobject(new ASNumber((ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)), mandatory);
+               return new XROAsNumberSubobject(new AsNumber((long) (ByteArray.bytesToShort(soContentsBytes) & 0xFFFF)), mandatory);
        }
 
-       public static byte[] put(ExcludeRouteSubobject objToSerialize) {
+       public static byte[] put(final ExcludeRouteSubobject objToSerialize) {
                if (!(objToSerialize instanceof XROAsNumberSubobject))
-                       throw new IllegalArgumentException("Unknown PCEPXROSubobject instance. Passed " + objToSerialize.getClass() + ". Needed XROAsNumberSubobject.");
+                       throw new IllegalArgumentException("Unknown PCEPXROSubobject instance. Passed " + objToSerialize.getClass()
+                                       + ". Needed XROAsNumberSubobject.");
 
                final byte[] retBytes = new byte[CONTENT_LENGTH];
 
-               System.arraycopy(ByteArray.longToBytes(((XROAsNumberSubobject) objToSerialize).getASNumber().getAsn()), Long.SIZE / Byte.SIZE - AS_NUMBER_LENGTH,
-                               retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
+               System.arraycopy(ByteArray.longToBytes(((XROAsNumberSubobject) objToSerialize).getASNumber().getValue()), Long.SIZE / Byte.SIZE
+                               - AS_NUMBER_LENGTH, retBytes, AS_NUMBER_OFFSET, AS_NUMBER_LENGTH);
 
                return retBytes;
        }
index f6c1ada55a55ccec76c55a26a3d6d19fbebb0df7..d455e583561298743d0eda79f029b921470ac889 100644 (file)
@@ -16,7 +16,6 @@ import java.util.List;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.Bandwidth;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.TEMetric;
@@ -54,6 +53,7 @@ import org.opendaylight.protocol.pcep.subobject.RROAsNumberSubobject;
 import org.opendaylight.protocol.pcep.subobject.ReportedRouteSubobject;
 import org.opendaylight.protocol.pcep.tlv.LSPCleanupTlv;
 import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class CompositeTest {
 
@@ -65,7 +65,7 @@ public class CompositeTest {
                private static final long serialVersionUID = 1L;
 
                {
-                       this.add(new EROAsNumberSubobject(new ASNumber(0L), true));
+                       this.add(new EROAsNumberSubobject(new AsNumber(0L), true));
                }
        }, false, false);
        public PCEPRequestParameterObject requestParameter;
@@ -93,7 +93,7 @@ public class CompositeTest {
                private static final long serialVersionUID = 1L;
 
                {
-                       this.add(new RROAsNumberSubobject(new ASNumber(0L)));
+                       this.add(new RROAsNumberSubobject(new AsNumber(0L)));
                }
        }, false);
 
@@ -103,7 +103,7 @@ public class CompositeTest {
                        private static final long serialVersionUID = 1L;
 
                        {
-                               this.add(new EROAsNumberSubobject(new ASNumber(0L), true));
+                               this.add(new EROAsNumberSubobject(new AsNumber(0L), true));
                        }
                }, false);
                this.ct = new PCEPClassTypeObject((short) 5);
@@ -130,14 +130,14 @@ public class CompositeTest {
                this.notifications.add(this.notification);
 
                final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>();
-               eroSubobjects.add(new EROAsNumberSubobject(new ASNumber(0x0L), false));
-               eroSubobjects.add(new EROAsNumberSubobject(new ASNumber(0x0L), false));
-               eroSubobjects.add(new EROAsNumberSubobject(new ASNumber(0x0L), false));
+               eroSubobjects.add(new EROAsNumberSubobject(new AsNumber(0x0L), false));
+               eroSubobjects.add(new EROAsNumberSubobject(new AsNumber(0x0L), false));
+               eroSubobjects.add(new EROAsNumberSubobject(new AsNumber(0x0L), false));
 
                final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>();
-               rroSubobjects.add(new RROAsNumberSubobject(new ASNumber(0x0L)));
-               rroSubobjects.add(new RROAsNumberSubobject(new ASNumber(0x0L)));
-               rroSubobjects.add(new RROAsNumberSubobject(new ASNumber(0x0L)));
+               rroSubobjects.add(new RROAsNumberSubobject(new AsNumber(0x0L)));
+               rroSubobjects.add(new RROAsNumberSubobject(new AsNumber(0x0L)));
+               rroSubobjects.add(new RROAsNumberSubobject(new AsNumber(0x0L)));
 
                this.reportedRoute = new PCEPReportedRouteObject(rroSubobjects, true);
                this.rroBandwidth = new PCEPExistingPathBandwidthObject(new Bandwidth(Float.intBitsToFloat(0xFF)), true, false);
@@ -147,8 +147,7 @@ public class CompositeTest {
                this.endPoints = new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipbytes), new IPv4Address(ipbytes));
 
                this.lsp = new PCEPLspObject(0, false, false, true, true, null);
-               this.compositePaths.add(new CompositePathObject(new PCEPExplicitRouteObject(eroSubobjects, true), this.lspa, this.bandwidth, this.metrics,
-                               this.includeRoute));
+               this.compositePaths.add(new CompositePathObject(new PCEPExplicitRouteObject(eroSubobjects, true), this.lspa, this.bandwidth, this.metrics, this.includeRoute));
                this.compositePaths.add(new CompositePathObject(new PCEPExplicitRouteObject(eroSubobjects, true)));
 
                this.compositeUpdPaths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(eroSubobjects, true), this.lspa, this.bandwidth, this.metrics));
@@ -254,7 +253,8 @@ public class CompositeTest {
 
                objects.addAll(this.requestParameters);
                objects.addAll(this.errors);
-               compositeErrors = new CompositeErrorObject(this.requestParameters.subList(0, this.requestParameters.size()), this.errors.subList(0, this.errors.size()));
+               compositeErrors = new CompositeErrorObject(this.requestParameters.subList(0, this.requestParameters.size()), this.errors.subList(0,
+                               this.errors.size()));
                assertEquals(compositeErrors, CompositeErrorObject.getCompositeFromList(objects));
 
                objects.clear();
@@ -271,8 +271,8 @@ public class CompositeTest {
 
                objects.addAll(this.requestParameters);
                objects.addAll(this.notifications);
-               compositeNotifications = new CompositeNotifyObject(this.requestParameters.subList(0, this.requestParameters.size()), this.notifications.subList(0,
-                               this.notifications.size()));
+               compositeNotifications = new CompositeNotifyObject(this.requestParameters.subList(0, this.requestParameters.size()), this.notifications.subList(
+                               0, this.notifications.size()));
                assertEquals(compositeNotifications, CompositeNotifyObject.getCompositeFromList(objects));
 
                objects.clear();
@@ -310,8 +310,8 @@ public class CompositeTest {
                objects.add(this.includeRoute);
                objects.add(this.loadBalancing);
 
-               compositeRequest = new CompositeRequestObject(this.requestParameter, this.endPoints, this.ct, this.lsp, this.lspa, this.bandwidth,
-                               this.metrics.subList(0, this.metrics.size()), this.reportedRoute, this.rroBandwidth, this.includeRoute, this.loadBalancing);
+               compositeRequest = new CompositeRequestObject(this.requestParameter, this.endPoints, this.ct, this.lsp, this.lspa, this.bandwidth, this.metrics.subList(
+                               0, this.metrics.size()), this.reportedRoute, this.rroBandwidth, this.includeRoute, this.loadBalancing);
                assertEquals(compositeRequest, CompositeRequestObject.getCompositeFromList(objects));
 
                objects.clear();
index 9d9a4f2b83d748e7432a649ed3cebfa23f7916e6..24bb988d491b27b0d13611bb958b0fb927f08ad7 100644 (file)
@@ -19,9 +19,6 @@ import java.util.NoSuchElementException;
 
 import org.junit.Ignore;
 import org.junit.Test;
-
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.Bandwidth;
 import org.opendaylight.protocol.concepts.IGPMetric;
 import org.opendaylight.protocol.concepts.IPv4Address;
@@ -79,6 +76,8 @@ import org.opendaylight.protocol.pcep.tlv.NodeIdentifierTlv;
 import org.opendaylight.protocol.pcep.tlv.OrderTlv;
 import org.opendaylight.protocol.pcep.tlv.OverloadedDurationTlv;
 import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * Used resources<br/>
@@ -249,7 +248,7 @@ import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
  * - PCE currently unavailable: false<br/>
  * - unknown destination: true<br/>
  * - unknown source: false<br/>
- *
+ * 
  * <br/>
  * NoPathObject2WithoutTLV.bin<br/>
  * objClass: 3 (RP)<br/>
@@ -397,8 +396,8 @@ public class PCEPObjectParserTest {
 
        IPv4Address ipv4addr = new IPv4Address(new byte[] { (byte) 192, (byte) 168, 1, 8 });
 
-       IPv6Address ipv6addr = new IPv6Address(new byte[] { (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168,
-                       2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1 });
+       IPv6Address ipv6addr = new IPv6Address(new byte[] { (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168,
+                       2, 1, (byte) 192, (byte) 168, 2, 1 });
 
        @SuppressWarnings("unchecked")
        private static <T extends PCEPObject> void serDeserTest(final String srcFile, final T specObject) throws IOException,
@@ -415,23 +414,23 @@ public class PCEPObjectParserTest {
         * Standard serialization test<br/>
         * Used resources:<br/>
         * - PCEPOpenObject1.bin<br/>
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       @Ignore //FIXME: temporary
-       public void testObjectDeserialization() throws PCEPDeserializerException, IOException,
-                       PCEPDocumentedException {
+       @Ignore
+       // FIXME: temporary
+       public void testObjectDeserialization() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
                PCEPObjectFactory.parseObjects(ByteArray.fileToBytes("src/test/resources/PCEPOpenObject1.bin"));
        }
 
        @Test
        public void testUnknownClass() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
 
-               final PCEPObject obj = PCEPObjectFactory.parseObjects(
-                               ByteArray.fileToBytes("src/test/resources/PCEPObject1UnknownClass.bin")).get(0);
+               final PCEPObject obj = PCEPObjectFactory.parseObjects(ByteArray.fileToBytes("src/test/resources/PCEPObject1UnknownClass.bin")).get(
+                               0);
 
                assertTrue(obj instanceof UnknownObject);
                assertEquals(((UnknownObject) obj).getError(), PCEPErrors.UNRECOGNIZED_OBJ_CLASS);
@@ -439,8 +438,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testUnknownType() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
-               final PCEPObject obj = PCEPObjectFactory.parseObjects(
-                               ByteArray.fileToBytes("src/test/resources/PCEPObject2UnknownType.bin")).get(0);
+               final PCEPObject obj = PCEPObjectFactory.parseObjects(ByteArray.fileToBytes("src/test/resources/PCEPObject2UnknownType.bin")).get(0);
 
                assertTrue(obj instanceof UnknownObject);
                assertEquals(((UnknownObject) obj).getError(), PCEPErrors.UNRECOGNIZED_OBJ_TYPE);
@@ -448,31 +446,25 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testCloseObjSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPCloseObject1.bin", new PCEPCloseObject(
-                               Reason.TOO_MANY_UNKNOWN_MSG));
+               serDeserTest("src/test/resources/PCEPCloseObject1.bin", new PCEPCloseObject(Reason.TOO_MANY_UNKNOWN_MSG));
        }
 
        @Test
-       public void testLoadBalancingObjSerDeser() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPLoadBalancingObject1.bin", new PCEPLoadBalancingObject(0xF1,
-                               new Bandwidth(Float.intBitsToFloat(0xFFFFFFFF)), true));
+       public void testLoadBalancingObjSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPLoadBalancingObject1.bin",
+                               new PCEPLoadBalancingObject(0xF1, new Bandwidth(Float.intBitsToFloat(0xFFFFFFFF)), true));
        }
 
        @Test
-       public void testLspObjectSerDeser() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPLspObject1NoTlvsUpperBounds.bin", new PCEPLspObject(0xFFFFF,
-                               true, false, true, false, null));
+       public void testLspObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPLspObject1NoTlvsUpperBounds.bin", new PCEPLspObject(0xFFFFF, true, false, true, false, null));
        }
 
        @Test
        public void testERObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-               final byte[] bytesFromFile = ByteArray
-                               .fileToBytes("src/test/resources/PCEPExplicitRouteObject1PackOfSubobjects.bin");
+               final byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/PCEPExplicitRouteObject1PackOfSubobjects.bin");
 
-               final PCEPExplicitRouteObject specObj = (PCEPExplicitRouteObject) PCEPObjectFactory.parseObjects(
-                               bytesFromFile).get(0);
+               final PCEPExplicitRouteObject specObj = (PCEPExplicitRouteObject) PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
 
                assertEquals(8, specObj.getSubobjects().size());
 
@@ -482,11 +474,9 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testIRObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-               final byte[] bytesFromFile = ByteArray
-                               .fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin");
+               final byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin");
 
-               final PCEPIncludeRouteObject specObj = (PCEPIncludeRouteObject) PCEPObjectFactory.parseObjects(
-                               bytesFromFile).get(0);
+               final PCEPIncludeRouteObject specObj = (PCEPIncludeRouteObject) PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
 
                assertEquals(8, specObj.getSubobjects().size());
 
@@ -496,11 +486,9 @@ public class PCEPObjectParserTest {
 
        @Test
        public void tesRRObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
-               final byte[] bytesFromFile = ByteArray
-                               .fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin");
+               final byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin");
 
-               final PCEPReportedRouteObject specObj = (PCEPReportedRouteObject) PCEPObjectFactory.parseObjects(
-                               bytesFromFile).get(0);
+               final PCEPReportedRouteObject specObj = (PCEPReportedRouteObject) PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
 
                assertEquals(6, specObj.getSubobjects().size());
 
@@ -513,63 +501,55 @@ public class PCEPObjectParserTest {
         * Used resources:<br/>
         * - PCEPBandwidthObject2UpperBounds.bin<br/>
         * - PCEPBandwidthObject1LowerBounds.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testBandwidthObjectBounds() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testBandwidthObjectBounds() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final byte[] bytesFloat = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
                serDeserTest("src/test/resources/PCEPBandwidthObject2UpperBounds.bin",
-                               new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.bytesToFloat(bytesFloat)), true,
-                                               true));
+                               new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.bytesToFloat(bytesFloat)), true, true));
                serDeserTest("src/test/resources/PCEPBandwidthObject1LowerBounds.bin",
                                new PCEPRequestedPathBandwidthObject(new Bandwidth(0), true, true));
        }
 
        /**
-        * Test for upper/lower bounds of IPv4 EndPoints
-        * (Serialization/Deserialization)<br/>
+        * Test for upper/lower bounds of IPv4 EndPoints (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPEndPointsObject1IPv4.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testEndPointsObjectSerDeserIPv4() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testEndPointsObjectSerDeserIPv4() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final byte[] srcIPBytes = { (byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E };
                final byte[] destIPBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
-               serDeserTest("src/test/resources/PCEPEndPointsObject1IPv4.bin", new PCEPEndPointsObject<IPv4Address>(
-                               new IPv4Address(srcIPBytes), new IPv4Address(destIPBytes)));
+               serDeserTest("src/test/resources/PCEPEndPointsObject1IPv4.bin",
+                               new PCEPEndPointsObject<IPv4Address>(new IPv4Address(srcIPBytes), new IPv4Address(destIPBytes)));
        }
 
        /**
-        * Test for upper/lower bounds of IPv6 EndPoints
-        * (Serialization/Deserialization)<br/>
+        * Test for upper/lower bounds of IPv6 EndPoints (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPEndPointsObject2IPv6.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testEndPointsObjectSerDeserIPv6() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               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 };
+       public void testEndPointsObjectSerDeserIPv6() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               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 };
 
-               serDeserTest("src/test/resources/PCEPEndPointsObject2IPv6.bin", new PCEPEndPointsObject<IPv6Address>(
-                               new IPv6Address(srcIPBytes), new IPv6Address(destIPBytes)));
+               serDeserTest("src/test/resources/PCEPEndPointsObject2IPv6.bin",
+                               new PCEPEndPointsObject<IPv6Address>(new IPv6Address(srcIPBytes), new IPv6Address(destIPBytes)));
        }
 
        /**
@@ -578,72 +558,60 @@ public class PCEPObjectParserTest {
         * Used resources:<br/>
         * - PCEPErrorObject1.bin<br/>
         * - PCEPErrorObject3.bin<br/>
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testErrorObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPErrorObject1.bin", new PCEPErrorObject(
-                               PCEPErrors.NON_OR_INVALID_OPEN_MSG));
-               serDeserTest("src/test/resources/PCEPErrorObject3.bin", new PCEPErrorObject(
-                               PCEPErrors.CAPABILITY_NOT_SUPPORTED));
+       public void testErrorObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPErrorObject1.bin", new PCEPErrorObject(PCEPErrors.NON_OR_INVALID_OPEN_MSG));
+               serDeserTest("src/test/resources/PCEPErrorObject3.bin", new PCEPErrorObject(PCEPErrors.CAPABILITY_NOT_SUPPORTED));
        }
 
        /**
-        * Test of validity of PCEPErrorObjectParser. Expect throwed
-        * NoSuchElementException.<br/>
+        * Test of validity of PCEPErrorObjectParser. Expect throwed NoSuchElementException.<br/>
         * <br/>
         * Used resources:<br/>
         * - PCEPErrorObject2Invalid.bin<br/>
-        *
+        * 
         * @throws NoSuchElementException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test(expected = PCEPDeserializerException.class)
        public void testUnknownError() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
-               PCEPObjectFactory.parseObjects(
-                               ByteArray.fileToBytes("src/test/resources/PCEPErrorObject2Invalid.bin")).get(0);
+               PCEPObjectFactory.parseObjects(ByteArray.fileToBytes("src/test/resources/PCEPErrorObject2Invalid.bin")).get(0);
        }
 
        /**
-        * Test for upper/lower bounds of PCEPLspaObject
-        * (Serialization/Deserialization)<br/>
+        * Test for upper/lower bounds of PCEPLspaObject (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPLspaObject1LowerBounds.bin<br/>
         * - PCEPLspaObject2UpperBounds.bin<br/>
         * - PCEPLspaObject3RandVals.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testLspaObjectSerDeser() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPLspaObject2UpperBounds.bin", new PCEPLspaObject(0xFFFFFFFFL,
-                               0xFFFFFFFFL, 0xFFFFFFFFL, (short) 0xFF, (short) 0xFF, false, true, true, true));
-               serDeserTest("src/test/resources/PCEPLspaObject1LowerBounds.bin", new PCEPLspaObject(0x00000000L,
-                               0x00000000L, 0x00000000L, (short) 0x00, (short) 0x00, false, false, true, true));
-               serDeserTest("src/test/resources/PCEPLspaObject3RandVals.bin", new PCEPLspaObject(0x20A1FEE3L,
-                               0x1A025CC7L, 0x2BB66532L, (short) 0x03, (short) 0x02, false, true, true, true));
+       public void testLspaObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPLspaObject2UpperBounds.bin",
+                               new PCEPLspaObject(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL, (short) 0xFF, (short) 0xFF, false, true, true, true));
+               serDeserTest("src/test/resources/PCEPLspaObject1LowerBounds.bin",
+                               new PCEPLspaObject(0x00000000L, 0x00000000L, 0x00000000L, (short) 0x00, (short) 0x00, false, false, true, true));
+               serDeserTest("src/test/resources/PCEPLspaObject3RandVals.bin",
+                               new PCEPLspaObject(0x20A1FEE3L, 0x1A025CC7L, 0x2BB66532L, (short) 0x03, (short) 0x02, false, true, true, true));
        }
 
        @Test
-       public void testMetricObjectSerDeserBounds() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               final byte[] bytesFromFileUB = ByteArray
-                               .fileToBytes("src/test/resources/PCEPMetricObject2UpperBounds.bin");
-               final byte[] bytesFromFileLB = ByteArray
-                               .fileToBytes("src/test/resources/PCEPMetricObject1LowerBounds.bin");
+       public void testMetricObjectSerDeserBounds() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               final byte[] bytesFromFileUB = ByteArray.fileToBytes("src/test/resources/PCEPMetricObject2UpperBounds.bin");
+               final byte[] bytesFromFileLB = ByteArray.fileToBytes("src/test/resources/PCEPMetricObject1LowerBounds.bin");
 
-               final PCEPMetricObject metricObjectLB = (PCEPMetricObject) PCEPObjectFactory.parseObjects(
-                               bytesFromFileLB).get(0);
-               final PCEPMetricObject metricObjectUB = (PCEPMetricObject) PCEPObjectFactory.parseObjects(
-                               bytesFromFileUB).get(0);
+               final PCEPMetricObject metricObjectLB = (PCEPMetricObject) PCEPObjectFactory.parseObjects(bytesFromFileLB).get(0);
+               final PCEPMetricObject metricObjectUB = (PCEPMetricObject) PCEPObjectFactory.parseObjects(bytesFromFileUB).get(0);
 
                assertEquals(new PCEPMetricObject(false, false, new IGPMetric(0), true, true), metricObjectLB);
                assertEquals(new PCEPMetricObject(false, true, new TEMetric(4026531840L), true, true), metricObjectUB);
@@ -659,20 +627,17 @@ public class PCEPObjectParserTest {
         * Used resources:<br/>
         * - NoPathObject1WithTLV.bin<br/>
         * - NoPathObject2WithoutTLV.bin<br/>
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testNoPathObjectDeserialization() throws PCEPDeserializerException, IOException,
-                       PCEPDocumentedException {
+       public void testNoPathObjectDeserialization() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>(1);
                tlvs.add(new NoPathVectorTlv(false, false, true, false, false, false));
-               serDeserTest("src/test/resources/NoPathObject1WithTLV.bin", new PCEPNoPathObject((short) 2, true,
-                               tlvs, false));
-               serDeserTest("src/test/resources/NoPathObject2WithoutTLV.bin", new PCEPNoPathObject((short) 0x10,
-                               false, true));
+               serDeserTest("src/test/resources/NoPathObject1WithTLV.bin", new PCEPNoPathObject((short) 2, true, tlvs, false));
+               serDeserTest("src/test/resources/NoPathObject2WithoutTLV.bin", new PCEPNoPathObject((short) 0x10, false, true));
 
        }
 
@@ -681,17 +646,15 @@ public class PCEPObjectParserTest {
         * Used resources:<br/>
         * - NoPathObject1WithTLV.bin<br/>
         * - NoPathObject2WithoutTLV.bin<br/>
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testNoPathObjectSerialization() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testNoPathObjectSerialization() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/NoPathObject2WithoutTLV.bin");
-               PCEPNoPathObject noPathObject = (PCEPNoPathObject) PCEPObjectFactory.parseObjects(bytesFromFile).get(
-                               0);
+               PCEPNoPathObject noPathObject = (PCEPNoPathObject) PCEPObjectFactory.parseObjects(bytesFromFile).get(0);
                byte[] bytesActual = PCEPObjectFactory.put(Arrays.asList((PCEPObject) noPathObject));
                assertArrayEquals(bytesFromFile, bytesActual);
 
@@ -704,42 +667,37 @@ public class PCEPObjectParserTest {
        /**
         * Specific test with/without tlvs (Ser/Deser)<br/>
         * Used resources:<br/>
-        * - PCEPNotificationObject1WithTlv.bin -
-        * PCEPNotificationObject2WithoutTlv.bin
-        *
+        * - PCEPNotificationObject1WithTlv.bin - PCEPNotificationObject2WithoutTlv.bin
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testNotifyObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException,
-                       PCEPDocumentedException {
+       public void testNotifyObjectSerDeserWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>(1);
                tlvs.add(new OverloadedDurationTlv(0xFF0000A2));
-               serDeserTest("src/test/resources/PCEPNotificationObject1WithTlv.bin", new PCEPNotificationObject(
-                               (short) 1, (short) 1, tlvs));
-               serDeserTest("src/test/resources/PCEPNotificationObject2WithoutTlv.bin", new PCEPNotificationObject(
-                               (short) 0xFF, (short) 0xFF));
+               serDeserTest("src/test/resources/PCEPNotificationObject1WithTlv.bin", new PCEPNotificationObject((short) 1, (short) 1, tlvs));
+               serDeserTest("src/test/resources/PCEPNotificationObject2WithoutTlv.bin", new PCEPNotificationObject((short) 0xFF, (short) 0xFF));
        }
 
        /**
         * Standard ser deser test<br/>
         * used resources:<br/>
         * - PCEPOpenObject1.bin
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       @Ignore //FIXME: temporary
-       public void testOpenObjectSerDeser() throws PCEPDeserializerException, IOException,
-                       PCEPDocumentedException {
+       @Ignore
+       // FIXME: temporary
+       public void testOpenObjectSerDeser() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>();
                tlvs.add(new PCEStatefulCapabilityTlv(false, true, true));
                tlvs.add(new LSPStateDBVersionTlv(0x80));
-               final byte[] valueBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A,
-                               (byte) 0xBC, (byte) 0xDE, (byte) 0xF0 };
+               final byte[] valueBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0xF0 };
                tlvs.add(new NodeIdentifierTlv(valueBytes));
                final PCEPOpenObject specObject = new PCEPOpenObject(30, 120, 1, tlvs);
 
@@ -750,37 +708,34 @@ public class PCEPObjectParserTest {
         * Specific test for upper bounds and without tlvs<br/>
         * Used resources:<br/>
         * - PCEPOpenObject2UpperBoundsNoTlv.bin
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testOpenObjectBoundsWithoutTlvs() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testOpenObjectBoundsWithoutTlvs() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>();
-               serDeserTest("src/test/resources/PCEPOpenObject2UpperBoundsNoTlv.bin", new PCEPOpenObject(0xFF, 0xFF,
-                               0xFF, tlvs));
-               serDeserTest("src/test/resources/PCEPOpenObject2UpperBoundsNoTlv.bin", new PCEPOpenObject(0xFF, 0xFF,
-                               0xFF, null));
+               serDeserTest("src/test/resources/PCEPOpenObject2UpperBoundsNoTlv.bin", new PCEPOpenObject(0xFF, 0xFF, 0xFF, tlvs));
+               serDeserTest("src/test/resources/PCEPOpenObject2UpperBoundsNoTlv.bin", new PCEPOpenObject(0xFF, 0xFF, 0xFF, null));
        }
 
        /**
         * Standard deserialization test<br/>
         * Used resources:<br/>
         * - PCEPRPObject1.bin
-        *
+        * 
         * @throws PCEPDeserializerException
         * @throws IOException
         * @throws PCEPDocumentedException
         */
        @Test
        public void testRPObjectSerDeser() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPRPObject1.bin", new PCEPRequestParameterObject(true, false,
-                               true, true, false, false, false, false, (short) 5, 0xdeadbeefL, false, false));
-               serDeserTest("src/test/resources/PCEPRPObject2.bin", new PCEPRequestParameterObject(true, false,
-                               false, false, true, false, true, false, true, (short) 5, 0xdeadbeefL,
-                               new ArrayList<PCEPTlv>() {
+               serDeserTest("src/test/resources/PCEPRPObject1.bin",
+                               new PCEPRequestParameterObject(true, false, true, true, false, false, false, false, (short) 5, 0xdeadbeefL, false, false));
+               serDeserTest(
+                               "src/test/resources/PCEPRPObject2.bin",
+                               new PCEPRequestParameterObject(true, false, false, false, true, false, true, false, true, (short) 5, 0xdeadbeefL, new ArrayList<PCEPTlv>() {
                                        private static final long serialVersionUID = 1L;
 
                                        {
@@ -790,18 +745,16 @@ public class PCEPObjectParserTest {
        }
 
        /**
-        * Test for upper/lower bounds of PCEPSvecObject
-        * (Serialization/Deserialization)<br/>
+        * Test for upper/lower bounds of PCEPSvecObject (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPSvecObject1_10ReqIDs.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testSvecObjectSerDeser() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testSvecObjectSerDeser() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final List<Long> requestIDs = new ArrayList<Long>(10);
                requestIDs.add(0xFFFFFFFFL);
                requestIDs.add(0x00000000L);
@@ -814,26 +767,24 @@ public class PCEPObjectParserTest {
                requestIDs.add(0x25FB7E52L);
                requestIDs.add(0xB2F2546BL);
 
-               serDeserTest("src/test/resources/PCEPSvecObject1_10ReqIDs.bin", new PCEPSvecObject(true, false, true,
-                               false, true, requestIDs, true));
+               serDeserTest("src/test/resources/PCEPSvecObject1_10ReqIDs.bin",
+                               new PCEPSvecObject(true, false, true, false, true, requestIDs, true));
        }
 
        /**
         * Test for lowest bounds of PCEPSvecObject (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPSvecObject2.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testSvecObjectSerDeserNoReqIDs() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testSvecObjectSerDeserNoReqIDs() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final List<Long> requestIDs = new ArrayList<Long>();
                requestIDs.add(0xFFL);
-               serDeserTest("src/test/resources/PCEPSvecObject2.bin", new PCEPSvecObject(false, false, false, false,
-                               false, requestIDs, false));
+               serDeserTest("src/test/resources/PCEPSvecObject2.bin", new PCEPSvecObject(false, false, false, false, false, requestIDs, false));
        }
 
        @Test
@@ -848,33 +799,29 @@ public class PCEPObjectParserTest {
         * Test PCEPExcludeRouteObjectObject (Serialization/Deserialization)<br/>
         * Used resources:<br/>
         * - PCEPExcludeRouteObject.1.bin<br/>
-        *
+        * 
         * @throws IOException
         * @throws PCEPDeserializerException
         * @throws PCEPDocumentedException
         */
        @Test
-       public void testExcludeRouteObject() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
+       public void testExcludeRouteObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
                final List<ExcludeRouteSubobject> xroSubobjects = new ArrayList<ExcludeRouteSubobject>();
-               xroSubobjects.add(new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] {
-                               (byte) 192, (byte) 168, (byte) 100, (byte) 100 }), 16), true, XROSubobjectAttribute.NODE));
-               xroSubobjects.add(new XROAsNumberSubobject(new ASNumber(0x1234L), false));
+               xroSubobjects.add(new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 192, (byte) 168,
+                               (byte) 100, (byte) 100 }), 16), true, XROSubobjectAttribute.NODE));
+               xroSubobjects.add(new XROAsNumberSubobject(new AsNumber(0x1234L), false));
 
        }
 
        @Test
-       public void tesObjectiveFunctionObject() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPObjectiveFunctionObject.1.bin", new PCEPObjectiveFunctionObject(
-                               PCEPOFCodes.MBC, true, false));
+       public void tesObjectiveFunctionObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPObjectiveFunctionObject.1.bin", new PCEPObjectiveFunctionObject(PCEPOFCodes.MBC, true, false));
        }
 
        @Test
-       public void tesGlobalConstraintsObject() throws IOException, PCEPDeserializerException,
-                       PCEPDocumentedException {
-               serDeserTest("src/test/resources/PCEPGlobalConstraintsObject.1.bin", new PCEPGlobalConstraintsObject(
-                               (short) 1, (short) 0, (short) 100, (short) 0xFF, true, false));
+       public void tesGlobalConstraintsObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+               serDeserTest("src/test/resources/PCEPGlobalConstraintsObject.1.bin",
+                               new PCEPGlobalConstraintsObject((short) 1, (short) 0, (short) 100, (short) 0xFF, true, false));
        }
 
        // FIXME: add at least one test with true value
@@ -886,8 +833,7 @@ public class PCEPObjectParserTest {
                this.testOpenObjectWithSpecTlv(new PCEStatefulCapabilityTlv(false, true, true));
        }
 
-       private void testOpenObjectWithSpecTlv(final PCEPTlv tlv) throws PCEPDeserializerException,
-                       PCEPDocumentedException {
+       private void testOpenObjectWithSpecTlv(final PCEPTlv tlv) throws PCEPDeserializerException, PCEPDocumentedException {
                final List<PCEPObject> objs = new ArrayList<PCEPObject>();
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>();
                tlvs.add(tlv);
@@ -900,8 +846,7 @@ public class PCEPObjectParserTest {
 
        @Test
        public void testErrorsMapping() {
-               final PCEPErrorObjectParser.PCEPErrorsMaping mapper = PCEPErrorObjectParser.PCEPErrorsMaping
-                               .getInstance();
+               final PCEPErrorObjectParser.PCEPErrorsMaping mapper = PCEPErrorObjectParser.PCEPErrorsMaping.getInstance();
 
                for (final PCEPErrors error : PCEPErrors.values()) {
                        final PCEPErrorIdentifier errorId = mapper.getFromErrorsEnum(error);
@@ -920,8 +865,8 @@ public class PCEPObjectParserTest {
        }
 
        @SuppressWarnings("unchecked")
-       private static <T extends PCEPObject> void serDeserTestWithoutBin(final T object)
-                       throws PCEPDeserializerException, PCEPDocumentedException {
+       private static <T extends PCEPObject> void serDeserTestWithoutBin(final T object) throws PCEPDeserializerException,
+                       PCEPDocumentedException {
                final byte[] serBytes = PCEPObjectFactory.put(Arrays.asList((PCEPObject) object));
                final T deserObj = (T) PCEPObjectFactory.parseObjects(serBytes).get(0);
 
@@ -934,11 +879,9 @@ public class PCEPObjectParserTest {
        @Test
        public void testBranchNodeObjects() throws PCEPDocumentedException, PCEPDeserializerException {
                final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>();
-               eroSubobjects.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] {
-                               (byte) 192, (byte) 168, 1, 8 }), 16), false));
-               eroSubobjects.add(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(new byte[] {
-                               (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1,
-                               (byte) 192, (byte) 168, 2, 1 }), 64), false));
+               eroSubobjects.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 192, (byte) 168, 1, 8 }), 16), false));
+               eroSubobjects.add(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(new byte[] { (byte) 192, (byte) 168, 2, 1,
+                               (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1 }), 64), false));
 
                serDeserTestWithoutBin(new PCEPBranchNodeListObject(eroSubobjects, true, false));
                serDeserTestWithoutBin(new PCEPNonBranchNodeListObject(eroSubobjects, true, false));
@@ -948,11 +891,9 @@ public class PCEPObjectParserTest {
        @Test
        public void testSERObjects() throws PCEPDocumentedException, PCEPDeserializerException {
                final List<ExplicitRouteSubobject> eroSubobjects = new ArrayList<ExplicitRouteSubobject>();
-               eroSubobjects.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] {
-                               (byte) 192, (byte) 168, 1, 8 }), 16), false));
-               eroSubobjects.add(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(new byte[] {
-                               (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1,
-                               (byte) 192, (byte) 168, 2, 1 }), 64), false));
+               eroSubobjects.add(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 192, (byte) 168, 1, 8 }), 16), false));
+               eroSubobjects.add(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(new byte[] { (byte) 192, (byte) 168, 2, 1,
+                               (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1, (byte) 192, (byte) 168, 2, 1 }), 64), false));
 
                serDeserTestWithoutBin(new PCEPSecondaryExplicitRouteObject(eroSubobjects, true, false));
        }
@@ -960,35 +901,27 @@ public class PCEPObjectParserTest {
        @Test
        public void testSRRObject() throws PCEPDocumentedException, PCEPDeserializerException {
                final List<ReportedRouteSubobject> rroSubobjects = new ArrayList<ReportedRouteSubobject>();
-               rroSubobjects.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(this.ipv4addr, 16), true,
-                               false));
-               rroSubobjects.add(new RROIPAddressSubobject<IPv6Prefix>(new IPv6Prefix(this.ipv6addr, 64), false,
-                               true));
+               rroSubobjects.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(this.ipv4addr, 16), true, false));
+               rroSubobjects.add(new RROIPAddressSubobject<IPv6Prefix>(new IPv6Prefix(this.ipv6addr, 64), false, true));
 
                serDeserTestWithoutBin(new PCEPSecondaryRecordRouteObject(rroSubobjects, true, false));
        }
 
        @Test
        public void testP2MPEndpointsObjects() throws PCEPDeserializerException, PCEPDocumentedException {
-               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv4Address>(2, this.ipv4addr, Arrays.asList(
-                               this.ipv4addr, this.ipv4addr, this.ipv4addr), true, false));
-               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv4Address>(1, this.ipv4addr,
-                               Arrays.asList(this.ipv4addr), true, false));
-               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv6Address>(2, this.ipv6addr, Arrays.asList(
-                               this.ipv6addr, this.ipv6addr, this.ipv6addr), true, false));
-               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv6Address>(1, this.ipv6addr,
-                               Arrays.asList(this.ipv6addr), true, false));
+               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv4Address>(2, this.ipv4addr, Arrays.asList(this.ipv4addr, this.ipv4addr,
+                               this.ipv4addr), true, false));
+               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv4Address>(1, this.ipv4addr, Arrays.asList(this.ipv4addr), true, false));
+               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv6Address>(2, this.ipv6addr, Arrays.asList(this.ipv6addr, this.ipv6addr,
+                               this.ipv6addr), true, false));
+               serDeserTestWithoutBin(new PCEPP2MPEndPointsObject<IPv6Address>(1, this.ipv6addr, Arrays.asList(this.ipv6addr), true, false));
        }
 
        @Test
        public void testUnreachedDestinationObjects() throws PCEPDeserializerException, PCEPDocumentedException {
-               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv4Address>(Arrays.asList(this.ipv4addr,
-                               this.ipv4addr, this.ipv4addr), true, false));
-               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv4Address>(Arrays.asList(this.ipv4addr),
-                               true, false));
-               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv6Address>(Arrays.asList(this.ipv6addr,
-                               this.ipv6addr, this.ipv6addr), true, false));
-               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv6Address>(Arrays.asList(this.ipv6addr),
-                               true, false));
+               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv4Address>(Arrays.asList(this.ipv4addr, this.ipv4addr, this.ipv4addr), true, false));
+               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv4Address>(Arrays.asList(this.ipv4addr), true, false));
+               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv6Address>(Arrays.asList(this.ipv6addr, this.ipv6addr, this.ipv6addr), true, false));
+               serDeserTestWithoutBin(new PCEPUnreachedDestinationObject<IPv6Address>(Arrays.asList(this.ipv6addr), true, false));
        }
 }
index 7bceaa32a8d5bbb69d369747fb22a06870dca606..280a7e6896db42d4b1d7ac90956c046786e5295c 100644 (file)
@@ -17,9 +17,6 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.junit.Test;
-
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.IPv4Prefix;
 import org.opendaylight.protocol.concepts.IPv6Address;
@@ -59,243 +56,235 @@ import org.opendaylight.protocol.pcep.subobject.XROIPPrefixSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROSRLGSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROSubobjectAttribute;
 import org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 /**
  * Tests for subobjects
  */
 public class PCEPSubobjectParserTest {
-    final byte[] ipv6bytes1 = { (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[] ipv6bytes2 = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12, (byte) 0x34,
-           (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-
-    final byte[] ipv4bytes1 = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
-    final byte[] ipv4bytes2 = { (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 };
-
-    @Test
-    public void testSerDeser() throws PCEPDeserializerException, IOException {
-       final byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/PackOfSubobjects.bin");
-       final List<ExplicitRouteSubobject> objsToTest = PCEPEROSubobjectParser.parse(bytesFromFile);
-
-       assertEquals(8, objsToTest.size());
-
-       assertEquals(objsToTest.get(0), new EROAsNumberSubobject(new ASNumber(0xFFFFL), true));
-       assertEquals(objsToTest.get(1), new EROAsNumberSubobject(new ASNumber(0x0010L), false));
-       assertEquals(objsToTest.get(2),
-               new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1), 0x20),
-                       true));
-
-       assertEquals(objsToTest.get(3),
-               new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes2), 0x15),
-                       false));
-       assertEquals(objsToTest.get(4),
-               new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes1), 0x80),
-                       true));
-
-       assertEquals(objsToTest.get(5),
-               new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2), 0x16),
-                       false));
-       final byte[] addr1 = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
-       assertEquals(objsToTest.get(6), new EROUnnumberedInterfaceSubobject(new IPv4Address(addr1),
-               new UnnumberedInterfaceIdentifier(0xFFFFFFFFL), true));
-
-       final byte[] addr2 = { (byte) 0x01, (byte) 0x24, (byte) 0x56, (byte) 0x78 };
-       assertEquals(objsToTest.get(7), new EROUnnumberedInterfaceSubobject(new IPv4Address(addr2),
-               new UnnumberedInterfaceIdentifier(0x9ABCDEF0L), false));
-
-       assertArrayEquals(bytesFromFile, PCEPEROSubobjectParser.put(objsToTest));
-
-    }
-
-    @Test
-    public void testEROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
-       final List<ExplicitRouteSubobject> objsToTest = new ArrayList<ExplicitRouteSubobject>();
-       objsToTest.add(new EROType1LabelSubobject(0xFFFF51F2L, true, false));
-       objsToTest.add(new EROType1LabelSubobject(0x12345648L, false, true));
-       objsToTest.add(new EROGeneralizedLabelSubobject(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }, true, true));
-       objsToTest.add(new EROWavebandSwitchingLabelSubobject(0x12345678L, 0x87654321L, 0xFFFFFFFFL, false, false));
-       objsToTest.add(new EROProtectionType1Subobject(true, (byte) 0x05, true));
-       objsToTest.add(new EROProtectionType2Subobject(true, false, true, true, (byte) 0x06, (byte) 0x3f, true, false, (byte) 0x00, false));
-       objsToTest.add(new EROPathKeyWith32PCEIDSubobject(0x1235, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }, true));
-       objsToTest.add(new EROPathKeyWith128PCEIDSubobject(0x5432, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55,
-               (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }, true));
-       objsToTest.add(new EROExplicitExclusionRouteSubobject(Arrays.asList((ExcludeRouteSubobject) new XROAsNumberSubobject(new ASNumber(2588), true))));
-
-       assertEquals(objsToTest, PCEPEROSubobjectParser.parse(PCEPEROSubobjectParser.put(objsToTest)));
-    }
-
-    @Test
-    public void testRROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
-       final List<ReportedRouteSubobject> objsToTest = new ArrayList<ReportedRouteSubobject>();
-       objsToTest.add(new RROIPAddressSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2),
-               0x16), true, false));
-       objsToTest.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1),
-               0x16), true, false));
-       objsToTest.add(new RROType1LabelSubobject(0xFFFF51F2L, true));
-       objsToTest.add(new RROType1LabelSubobject(0x12345648L, false));
-       objsToTest.add(new RROGeneralizedLabelSubobject(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }, true));
-       objsToTest.add(new RROWavebandSwitchingLabelSubobject(0x12345678L, 0x87654321L, 0xFFFFFFFFL, false));
-       objsToTest.add(new RROProtectionType1Subobject(true, (byte) 0x05));
-       objsToTest.add(new RROProtectionType2Subobject(true, false, true, true, (byte) 0x06, (byte) 0x3f, true, false, (byte) 0x00));
-       objsToTest.add(new RROPathKeyWith32PCEIDSubobject(0x1235, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }));
-       objsToTest.add(new RROPathKeyWith128PCEIDSubobject(0x5432, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55,
-               (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }));
-       objsToTest.add(new RROAttributesSubobject(new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF,
-               (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }));
-
-       assertEquals(objsToTest, PCEPRROSubobjectParser.parse(PCEPRROSubobjectParser.put(objsToTest)));
-    }
-
-    @Test
-    public void testXROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
-       final List<ExcludeRouteSubobject> objsToTest = new ArrayList<ExcludeRouteSubobject>();
-       objsToTest.add(new XROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2),
-               0x16), true, XROSubobjectAttribute.INTERFACE));
-       objsToTest.add(new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1),
-               0x16), false, XROSubobjectAttribute.INTERFACE));
-       objsToTest.add(new XROAsNumberSubobject(new ASNumber(0x1234), true));
-       objsToTest.add(new XROUnnumberedInterfaceSubobject(new IPv4Address(this.ipv4bytes1),
-               new UnnumberedInterfaceIdentifier(0xFFFFFFFFL), true, XROSubobjectAttribute.SRLG));
-       objsToTest.add(new XROSRLGSubobject(new SharedRiskLinkGroup(0x12345678L), false));
-
-       assertEquals(objsToTest, PCEPXROSubobjectParser.parse(PCEPXROSubobjectParser.put(objsToTest)));
-    }
-
-    @Test
-    public void testDifferentLengthExceptions() {
-       final byte[] bytes = { (byte) 0x00 }; // not empty but not enought data
-                                             // for parsing subobjects
-
-       try {
-           EROAsNumberSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final PCEPDeserializerException e) {
-       }
+       final byte[] ipv6bytes1 = { (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[] ipv6bytes2 = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0x12,
+                       (byte) 0x34, (byte) 0x54, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
 
-       try {
-           EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final PCEPDeserializerException e) {
-       }
+       final byte[] ipv4bytes1 = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+       final byte[] ipv4bytes2 = { (byte) 0x12, (byte) 0x34, (byte) 0x50, (byte) 0x00 };
 
-       try {
-           EROIPv4PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final PCEPDeserializerException e) {
-       }
+       @Test
+       public void testSerDeser() throws PCEPDeserializerException, IOException {
+               final byte[] bytesFromFile = ByteArray.fileToBytes("src/test/resources/PackOfSubobjects.bin");
+               final List<ExplicitRouteSubobject> objsToTest = PCEPEROSubobjectParser.parse(bytesFromFile);
 
-       try {
-           EROIPv6PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final PCEPDeserializerException e) {
-       }
-    }
+               assertEquals(8, objsToTest.size());
 
-    @Test
-    public void testNullExceptions() throws PCEPDeserializerException {
-       final byte[] bytes = null; // not empty but not enought data for parsing
-                                  // subobjects
+               assertEquals(objsToTest.get(0), new EROAsNumberSubobject(new AsNumber(0xFFFFL), true));
+               assertEquals(objsToTest.get(1), new EROAsNumberSubobject(new AsNumber(0x0010L), false));
+               assertEquals(objsToTest.get(2), new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1), 0x20), true));
 
-       try {
-           EROAsNumberSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
+               assertEquals(objsToTest.get(3), new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes2), 0x15), false));
+               assertEquals(objsToTest.get(4), new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes1), 0x80), true));
 
-       try {
-           EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
+               assertEquals(objsToTest.get(5), new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2), 0x16), false));
+               final byte[] addr1 = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+               assertEquals(objsToTest.get(6),
+                               new EROUnnumberedInterfaceSubobject(new IPv4Address(addr1), new UnnumberedInterfaceIdentifier(0xFFFFFFFFL), true));
 
-       try {
-           EROIPv4PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
-
-       try {
-           EROIPv6PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
-    }
-
-    @Test
-    public void testUnknownInstanceExceptions() {
+               final byte[] addr2 = { (byte) 0x01, (byte) 0x24, (byte) 0x56, (byte) 0x78 };
+               assertEquals(objsToTest.get(7),
+                               new EROUnnumberedInterfaceSubobject(new IPv4Address(addr2), new UnnumberedInterfaceIdentifier(0x9ABCDEF0L), false));
 
-       final ExplicitRouteSubobject instance = new ExplicitRouteSubobject() {
-       };
+               assertArrayEquals(bytesFromFile, PCEPEROSubobjectParser.put(objsToTest));
 
-       try {
-           EROAsNumberSubobjectParser.put(instance);
-           fail("");
-       } catch (final IllegalArgumentException e) {
        }
 
-       try {
-           EROUnnumberedInterfaceSubobjectParser.put(instance);
-           fail("");
-       } catch (final IllegalArgumentException e) {
+       @Test
+       public void testEROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
+               final List<ExplicitRouteSubobject> objsToTest = new ArrayList<ExplicitRouteSubobject>();
+               objsToTest.add(new EROType1LabelSubobject(0xFFFF51F2L, true, false));
+               objsToTest.add(new EROType1LabelSubobject(0x12345648L, false, true));
+               objsToTest.add(new EROGeneralizedLabelSubobject(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }, true, true));
+               objsToTest.add(new EROWavebandSwitchingLabelSubobject(0x12345678L, 0x87654321L, 0xFFFFFFFFL, false, false));
+               objsToTest.add(new EROProtectionType1Subobject(true, (byte) 0x05, true));
+               objsToTest.add(new EROProtectionType2Subobject(true, false, true, true, (byte) 0x06, (byte) 0x3f, true, false, (byte) 0x00, false));
+               objsToTest.add(new EROPathKeyWith32PCEIDSubobject(0x1235, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }, true));
+               objsToTest.add(new EROPathKeyWith128PCEIDSubobject(0x5432, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1,
+                               (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00,
+                               (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }, true));
+               objsToTest.add(new EROExplicitExclusionRouteSubobject(Arrays.asList((ExcludeRouteSubobject) new XROAsNumberSubobject(new AsNumber((long) 2588), true))));
+
+               assertEquals(objsToTest, PCEPEROSubobjectParser.parse(PCEPEROSubobjectParser.put(objsToTest)));
        }
 
-       try {
-           EROIPv4PrefixSubobjectParser.put(instance);
-           fail("");
-       } catch (final IllegalArgumentException e) {
+       @Test
+       public void testRROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
+               final List<ReportedRouteSubobject> objsToTest = new ArrayList<ReportedRouteSubobject>();
+               objsToTest.add(new RROIPAddressSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2), 0x16), true, false));
+               objsToTest.add(new RROIPAddressSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1), 0x16), true, false));
+               objsToTest.add(new RROType1LabelSubobject(0xFFFF51F2L, true));
+               objsToTest.add(new RROType1LabelSubobject(0x12345648L, false));
+               objsToTest.add(new RROGeneralizedLabelSubobject(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }, true));
+               objsToTest.add(new RROWavebandSwitchingLabelSubobject(0x12345678L, 0x87654321L, 0xFFFFFFFFL, false));
+               objsToTest.add(new RROProtectionType1Subobject(true, (byte) 0x05));
+               objsToTest.add(new RROProtectionType2Subobject(true, false, true, true, (byte) 0x06, (byte) 0x3f, true, false, (byte) 0x00));
+               objsToTest.add(new RROPathKeyWith32PCEIDSubobject(0x1235, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }));
+               objsToTest.add(new RROPathKeyWith128PCEIDSubobject(0x5432, new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1,
+                               (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00,
+                               (byte) 0x55, (byte) 0xFF, (byte) 0xF1 }));
+               objsToTest.add(new RROAttributesSubobject(new byte[] { (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00,
+                               (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55, (byte) 0xFF, (byte) 0xF1, (byte) 0x00, (byte) 0x55,
+                               (byte) 0xFF, (byte) 0xF1 }));
+
+               assertEquals(objsToTest, PCEPRROSubobjectParser.parse(PCEPRROSubobjectParser.put(objsToTest)));
        }
 
-       try {
-           final byte[] ipv6addr = { (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, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-           EROIPv4PrefixSubobjectParser.put(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(ipv6addr), 1), false));
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
+       @Test
+       public void testXROSubojectsSerDeserWithoutBin() throws PCEPDeserializerException {
+               final List<ExcludeRouteSubobject> objsToTest = new ArrayList<ExcludeRouteSubobject>();
+               objsToTest.add(new XROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(this.ipv6bytes2), 0x16), true, XROSubobjectAttribute.INTERFACE));
+               objsToTest.add(new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(this.ipv4bytes1), 0x16), false, XROSubobjectAttribute.INTERFACE));
+               objsToTest.add(new XROAsNumberSubobject(new AsNumber((long) 0x1234), true));
+               objsToTest.add(new XROUnnumberedInterfaceSubobject(new IPv4Address(this.ipv4bytes1), new UnnumberedInterfaceIdentifier(0xFFFFFFFFL), true, XROSubobjectAttribute.SRLG));
+               objsToTest.add(new XROSRLGSubobject(new SharedRiskLinkGroup(0x12345678L), false));
 
-       try {
-           EROIPv6PrefixSubobjectParser.put(instance);
-           fail("");
-       } catch (final IllegalArgumentException e) {
+               assertEquals(objsToTest, PCEPXROSubobjectParser.parse(PCEPXROSubobjectParser.put(objsToTest)));
        }
 
-       try {
-           final byte[] ipv4addr = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-           EROIPv6PrefixSubobjectParser.put(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(ipv4addr), 1), false));
-           fail("");
-       } catch (final IllegalArgumentException e) {
+       @Test
+       public void testDifferentLengthExceptions() {
+               final byte[] bytes = { (byte) 0x00 }; // not empty but not enought data
+               // for parsing subobjects
+
+               try {
+                       EROAsNumberSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final PCEPDeserializerException e) {
+               }
+
+               try {
+                       EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final PCEPDeserializerException e) {
+               }
+
+               try {
+                       EROIPv4PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final PCEPDeserializerException e) {
+               }
+
+               try {
+                       EROIPv6PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final PCEPDeserializerException e) {
+               }
        }
 
-    }
-
-    @Test
-    public void testEmptyExceptions() throws PCEPDeserializerException {
-       final byte[] bytes = {}; // not empty but not enought data for parsing
-                                // subobjects
-
-       try {
-           EROAsNumberSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
+       @Test
+       public void testNullExceptions() throws PCEPDeserializerException {
+               final byte[] bytes = null; // not empty but not enought data for parsing
+               // subobjects
+
+               try {
+                       EROAsNumberSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv4PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv6PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
        }
 
-       try {
-           EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
-       }
+       @Test
+       public void testUnknownInstanceExceptions() {
+
+               final ExplicitRouteSubobject instance = new ExplicitRouteSubobject() {
+               };
+
+               try {
+                       EROAsNumberSubobjectParser.put(instance);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROUnnumberedInterfaceSubobjectParser.put(instance);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv4PrefixSubobjectParser.put(instance);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       final byte[] ipv6addr = { (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, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+                       EROIPv4PrefixSubobjectParser.put(new EROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(ipv6addr), 1), false));
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv6PrefixSubobjectParser.put(instance);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       final byte[] ipv4addr = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+                       EROIPv6PrefixSubobjectParser.put(new EROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(ipv4addr), 1), false));
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
 
-       try {
-           EROIPv4PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
        }
 
-       try {
-           EROIPv6PrefixSubobjectParser.parse(bytes, true);
-           fail("");
-       } catch (final IllegalArgumentException e) {
+       @Test
+       public void testEmptyExceptions() throws PCEPDeserializerException {
+               final byte[] bytes = {}; // not empty but not enought data for parsing
+               // subobjects
+
+               try {
+                       EROAsNumberSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROUnnumberedInterfaceSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv4PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
+
+               try {
+                       EROIPv6PrefixSubobjectParser.parse(bytes, true);
+                       fail("");
+               } catch (final IllegalArgumentException e) {
+               }
        }
-    }
 
 }
index fcd1334091e8c40210352b0bbbcd4f5489caf322..0a9790015a72d394da2b2cb6788ca8738bad74d1 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.Bandwidth;
 import org.opendaylight.protocol.concepts.IGPMetric;
 import org.opendaylight.protocol.concepts.IPv4;
@@ -88,13 +87,14 @@ import org.opendaylight.protocol.pcep.tlv.LSPStateDBVersionTlv;
 import org.opendaylight.protocol.pcep.tlv.LSPSymbolicNameTlv;
 import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class PCEPValidatorTest {
 
        private static final PCEPLspaObject lspa = new PCEPLspaObject(0L, 0L, 0L, (short) 0, (short) 0, false, false, false, false);
 
        private final List<ExplicitRouteSubobject> eroSubobjects = asList(
-                       new EROAsNumberSubobject(new ASNumber(0xFFFFL), false),
+                       new EROAsNumberSubobject(new AsNumber(0xFFFFL), false),
                        new EROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33 }), new UnnumberedInterfaceIdentifier(0x00FF00FF), false));
 
        private final List<ReportedRouteSubobject> rroSubobjects = asList((ReportedRouteSubobject) new RROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] {
@@ -237,7 +237,7 @@ public class PCEPValidatorTest {
                        private static final long serialVersionUID = 1L;
 
                        {
-                               this.add(new XROAsNumberSubobject(new ASNumber(0x12), true));
+                               this.add(new XROAsNumberSubobject(new AsNumber((long) 0x12), true));
                        }
                }, true, true, false), new ArrayList<PCEPMetricObject>() {
                        private static final long serialVersionUID = 1L;
@@ -616,7 +616,7 @@ public class PCEPValidatorTest {
        public void testPCCreateMessage() throws DeserializerException, DocumentedException, PCEPDeserializerException {
                final List<CompositeInstantiationObject> insts = new ArrayList<CompositeInstantiationObject>();
                final List<ExplicitRouteSubobject> subs = new ArrayList<ExplicitRouteSubobject>();
-               subs.add(new EROAsNumberSubobject(new ASNumber(10), false));
+               subs.add(new EROAsNumberSubobject(new AsNumber((long) 10), false));
                final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>();
                final LSPSymbolicNameTlv tlv = new LSPSymbolicNameTlv(new LSPSymbolicName(new byte[] { 5, 4 }));
                tlvs.add(tlv);
index 3f0c7f7d251439addb432118401fcdacb2eff43a..762cb98437e8ce184dde562e32437a22563ca5dd 100644 (file)
@@ -15,9 +15,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.junit.Test;
-
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.IPv4Prefix;
 import org.opendaylight.protocol.concepts.IPv6Address;
@@ -35,6 +32,8 @@ import org.opendaylight.protocol.pcep.subobject.XROIPPrefixSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROSRLGSubobject;
 import org.opendaylight.protocol.pcep.subobject.XROSubobjectAttribute;
 import org.opendaylight.protocol.pcep.subobject.XROUnnumberedInterfaceSubobject;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
 
 public class PCEPXROSubobjectParserTest {
 
@@ -45,22 +44,14 @@ public class PCEPXROSubobjectParserTest {
 
                assertEquals(5, objsToTest.size());
 
-               assertEquals(
-                               objsToTest.get(0),
-                               new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(
-                                               new byte[] { (byte) 192, (byte) 168, (byte) 0, (byte) 0 }), 16), true, XROSubobjectAttribute.NODE));
-               assertEquals(
-                               objsToTest.get(1),
-                               new XROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(
-                                               new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x90, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
-                                                               (byte) 0x90, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0, (byte) 0 }), 112), true,
-                                               XROSubobjectAttribute.INTERFACE));
-               assertEquals(
-                               objsToTest.get(2),
-                               new XROUnnumberedInterfaceSubobject(new IPv4Address(
-                                               new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0x20 }), new UnnumberedInterfaceIdentifier(0x1234L), false,
-                                               XROSubobjectAttribute.SRLG));
-               assertEquals(objsToTest.get(3), new XROAsNumberSubobject(new ASNumber(0x1234), false));
+               assertEquals(objsToTest.get(0), new XROIPPrefixSubobject<IPv4Prefix>(new IPv4Prefix(new IPv4Address(new byte[] { (byte) 192,
+                               (byte) 168, (byte) 0, (byte) 0 }), 16), true, XROSubobjectAttribute.NODE));
+               assertEquals(objsToTest.get(1), new XROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(new byte[] { (byte) 0x12,
+                               (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x90, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x90,
+                               (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0, (byte) 0 }), 112), true, XROSubobjectAttribute.INTERFACE));
+               assertEquals(objsToTest.get(2), new XROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 0, (byte) 0, (byte) 0,
+                               (byte) 0x20 }), new UnnumberedInterfaceIdentifier(0x1234L), false, XROSubobjectAttribute.SRLG));
+               assertEquals(objsToTest.get(3), new XROAsNumberSubobject(new AsNumber((long) 0x1234), false));
                assertEquals(objsToTest.get(4), new XROSRLGSubobject(new SharedRiskLinkGroup(0x12345678L), false));
 
                assertArrayEquals(bytesFromFile, PCEPXROSubobjectParser.put(objsToTest));
@@ -69,7 +60,7 @@ public class PCEPXROSubobjectParserTest {
 
        @Test
        public void testDifferentLengthExceptions() {
-               final byte[] bytes = { (byte) 0x00 }; //not empty but not enought data for parsing subobjects
+               final byte[] bytes = { (byte) 0x00 }; // not empty but not enought data for parsing subobjects
 
                try {
                        XROAsNumberSubobjectParser.parse(bytes, true);
@@ -98,7 +89,7 @@ public class PCEPXROSubobjectParserTest {
 
        @Test
        public void testNullExceptions() throws PCEPDeserializerException {
-               final byte[] bytes = null; //not empty but not enought data for parsing subobjects
+               final byte[] bytes = null; // not empty but not enought data for parsing subobjects
 
                try {
                        XROAsNumberSubobjectParser.parse(bytes, true);
@@ -150,8 +141,8 @@ public class PCEPXROSubobjectParserTest {
                }
 
                try {
-                       final byte[] ipv6addr = { (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, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+                       final byte[] ipv6addr = { (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, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
                        XROIPv4PrefixSubobjectParser.put(new XROIPPrefixSubobject<IPv6Prefix>(new IPv6Prefix(new IPv6Address(ipv6addr), 1), false, XROSubobjectAttribute.INTERFACE));
                        fail("");
                } catch (final IllegalArgumentException e) {
@@ -174,7 +165,7 @@ public class PCEPXROSubobjectParserTest {
 
        @Test
        public void testEmptyExceptions() throws PCEPDeserializerException {
-               final byte[] bytes = {}; //not empty but not enought data for parsing subobjects
+               final byte[] bytes = {}; // not empty but not enought data for parsing subobjects
 
                try {
                        XROAsNumberSubobjectParser.parse(bytes, true);
index 74052bccda11b970999e3cb3c86c1a2654093c05..04ecad78db18e57a7b35180768176dd22d34411b 100644 (file)
@@ -19,29 +19,26 @@ import java.util.BitSet;
 import org.apache.commons.codec.binary.Hex;
 
 /**
- *
+ * 
  * Util class for methods working with byte array.
- *
+ * 
  */
 public final class ByteArray {
        private ByteArray() {
        }
 
        /**
-        * Returns a new byte array from given byte array, starting at start index
-        * with the size of the length parameter. Byte array given as parameter
-        * stays untouched.
-        *
-        * @param bytes
-        *            original byte array
-        * @param startIndex
-        *            beginning index, inclusive
-        * @param length
-        *            how many bytes should be in the sub-array
+        * Returns a new byte array from given byte array, starting at start index with the size of the length parameter.
+        * Byte array given as parameter stays untouched.
+        * 
+        * @param bytes original byte array
+        * @param startIndex beginning index, inclusive
+        * @param length how many bytes should be in the sub-array
         * @return a new byte array that is a sub-array of the original
         */
-       public static byte[] subByte(final byte[] bytes, int startIndex, int length) {
-               if (bytes.length == 0 || length < 0 || length > bytes.length || startIndex < 0 || startIndex > bytes.length || startIndex + length > bytes.length) {
+       public static byte[] subByte(final byte[] bytes, final int startIndex, final int length) {
+               if (bytes.length == 0 || length < 0 || length > bytes.length || startIndex < 0 || startIndex > bytes.length
+                               || startIndex + length > bytes.length) {
                        throw new IllegalArgumentException("Cannot create subByte, invalid arguments: Length: " + length + " startIndex: " + startIndex);
                }
                final byte[] res = new byte[length];
@@ -50,15 +47,13 @@ public final class ByteArray {
        }
 
        /**
-        * Converts byte array to Integer. If there are less bytes in the array as
-        * required (4), the method will push adequate number of zero bytes
-        * prepending given byte array.
-        *
-        * @param bytes
-        *            array to be converted to int
+        * Converts byte array to Integer. If there are less bytes in the array as required (4), the method will push
+        * adequate number of zero bytes prepending given byte array.
+        * 
+        * @param bytes array to be converted to int
         * @return int
         */
-       public static int bytesToInt(byte[] bytes) {
+       public static int bytesToInt(final byte[] bytes) {
                if (bytes.length > Integer.SIZE / 8) {
                        throw new IllegalArgumentException("Cannot convert bytes to integer. Byte array too big.");
                }
@@ -73,15 +68,13 @@ public final class ByteArray {
        }
 
        /**
-        * Converts byte array to long. If there are less bytes in the array as
-        * required (Long.Size), the method will push adequate number of zero bytes
-        * prepending given byte array.
-        *
-        * @param bytes
-        *            array to be converted to long
+        * Converts byte array to long. If there are less bytes in the array as required (Long.Size), the method will push
+        * adequate number of zero bytes prepending given byte array.
+        * 
+        * @param bytes array to be converted to long
         * @return long
         */
-       public static long bytesToLong(byte[] bytes) {
+       public static long bytesToLong(final byte[] bytes) {
                if (bytes.length > Long.SIZE / 8) {
                        throw new IllegalArgumentException("Cannot convert bytes to long.Byte array too big.");
                }
@@ -96,15 +89,13 @@ public final class ByteArray {
        }
 
        /**
-        * Converts byte array to float IEEE 754 format. If there are less bytes in
-        * the array as required (Float.Size), the method will push adequate number
-        * of zero bytes prepending given byte array.
-        *
-        * @param bytes
-        *            array to be converted to float
+        * Converts byte array to float IEEE 754 format. If there are less bytes in the array as required (Float.Size), the
+        * method will push adequate number of zero bytes prepending given byte array.
+        * 
+        * @param bytes array to be converted to float
         * @return float
         */
-       public static float bytesToFloat(byte[] bytes) {
+       public static float bytesToFloat(final byte[] bytes) {
                if (bytes.length > Float.SIZE / 8) {
                        throw new IllegalArgumentException("Cannot convert bytes to float.Byte array too big.");
                }
@@ -120,14 +111,12 @@ public final class ByteArray {
 
        /**
         * Cuts 'count' number of bytes from the beginning of given byte array.
-        *
-        * @param bytes
-        *            array to be cut, cannot be null
-        * @param count
-        *            how many bytes needed to be cut, needs to be > 0
+        * 
+        * @param bytes array to be cut, cannot be null
+        * @param count how many bytes needed to be cut, needs to be > 0
         * @return bytes array without first 'count' bytes
         */
-       public static byte[] cutBytes(byte[] bytes, int count) {
+       public static byte[] cutBytes(final byte[] bytes, final int count) {
                if (bytes.length == 0 || count > bytes.length || count <= 0) {
                        throw new IllegalArgumentException("Cannot cut bytes, invalid arguments: Count: " + count + " bytes.length: " + bytes.length);
                }
@@ -136,12 +125,11 @@ public final class ByteArray {
 
        /**
         * Parse byte to bits, from the leftmost bit.
-        *
-        * @param b
-        *            byte to be parsed
+        * 
+        * @param b byte to be parsed
         * @return array of booleans with size of 8
         */
-       public static boolean[] parseBits(byte b) {
+       public static boolean[] parseBits(final byte b) {
                final boolean[] bits = new boolean[Byte.SIZE];
                int j = 0;
                for (int i = Byte.SIZE - 1; i >= 0; i--) {
@@ -153,12 +141,11 @@ public final class ByteArray {
 
        /**
         * Parses array of bytes to BitSet, from left most bit.
-        *
-        * @param bytes
-        *            array of bytes to be parsed
+        * 
+        * @param bytes array of bytes to be parsed
         * @return BitSet with length = bytes.length * Byte.SIZE
         */
-       public static BitSet bytesToBitSet(byte[] bytes) {
+       public static BitSet bytesToBitSet(final byte[] bytes) {
                final BitSet bitSet = new BitSet(bytes.length * Byte.SIZE);
                for (int bytes_iter = 0; bytes_iter < bytes.length; bytes_iter++) {
                        final int offset = bytes_iter * Byte.SIZE;
@@ -171,14 +158,12 @@ public final class ByteArray {
 
        /**
         * Parses BitSet to bytes, from most left bit.
-        *
-        * @param bitSet
-        *            BitSet to be parsed
-        * @param returnedLength
-        *            Length of returned array. Overlapping flags are truncated.
+        * 
+        * @param bitSet BitSet to be parsed
+        * @param returnedLength Length of returned array. Overlapping flags are truncated.
         * @return parsed array of bytes with length of bitSet.length / Byte.SIZE
         */
-       public static byte[] bitSetToBytes(BitSet bitSet, int returnedLength) {
+       public static byte[] bitSetToBytes(final BitSet bitSet, final int returnedLength) {
                final byte[] bytes = new byte[returnedLength];
 
                for (int bytes_iter = 0; bytes_iter < bytes.length; bytes_iter++) {
@@ -193,12 +178,11 @@ public final class ByteArray {
 
        /**
         * Parses file to array of bytes
-        *
-        * @param name
-        *            path to file to by parsed
+        * 
+        * @param name path to file to by parsed
         * @return parsed array of bytes
         */
-       public static byte[] fileToBytes(String name) throws IOException {
+       public static byte[] fileToBytes(final String name) throws IOException {
                final File file = new File(name);
                int offset = 0;
                int numRead = 0;
@@ -223,12 +207,11 @@ public final class ByteArray {
 
        /**
         * Parses integer to array of bytes
-        *
-        * @param num
-        *            integer to be parsed
+        * 
+        * @param num integer to be parsed
         * @return parsed array of bytes with length of Integer.SIZE/Byte.SIZE
         */
-       public static byte[] intToBytes(int num) {
+       public static byte[] intToBytes(final int num) {
                final ByteBuffer bytesBuffer = ByteBuffer.allocate(Integer.SIZE / Byte.SIZE);
                bytesBuffer.putInt(num);
 
@@ -236,13 +219,12 @@ public final class ByteArray {
        }
 
        /**
-        * Parses integer to array of bytes
-        *
-        * @param num
-        *            integer to be parsed
+        * Parses long to array of bytes
+        * 
+        * @param num long to be parsed
         * @return parsed array of bytes with length of Long.SIZE/Byte.SIZE
         */
-       public static byte[] longToBytes(long num) {
+       public static byte[] longToBytes(final long num) {
                final ByteBuffer bytesBuffer = ByteBuffer.allocate(Long.SIZE / Byte.SIZE);
                bytesBuffer.putLong(num);
 
@@ -251,16 +233,13 @@ public final class ByteArray {
 
        /**
         * Copies range of bits from passed byte and align to right.<br/>
-        *
-        * @param src
-        *            source byte to copy from
-        * @param fromBit
-        *            bit from which will copy (inclusive) - numbered from 0
-        * @param length
-        *            of bits to by copied - <1,8>
+        * 
+        * @param src source byte to copy from
+        * @param fromBit bit from which will copy (inclusive) - numbered from 0
+        * @param length of bits to by copied - <1,8>
         * @return copied value aligned to right
         */
-       public static byte copyBitsRange(byte src, int fromBit, int length) {
+       public static byte copyBitsRange(final byte src, final int fromBit, final int length) {
                if (fromBit < 0 | fromBit > Byte.SIZE - 1 | length < 1 | length > Byte.SIZE) {
                        throw new IllegalArgumentException("fromBit or toBit is out of range.");
                }
@@ -286,15 +265,12 @@ public final class ByteArray {
        /**
         * Copies whole source byte array to destination from offset.<br/>
         * Length of src can't be bigger than dest length minus offset
-        *
-        * @param src
-        *            byte[]
-        * @param dest
-        *            byte[]
-        * @param offset
-        *            int
+        * 
+        * @param src byte[]
+        * @param dest byte[]
+        * @param offset int
         */
-       public static void copyWhole(byte[] src, byte[] dest, int offset) {
+       public static void copyWhole(final byte[] src, final byte[] dest, final int offset) {
                if (dest.length - offset < src.length) {
                        throw new ArrayIndexOutOfBoundsException("Can't copy whole array.");
                }
@@ -305,12 +281,11 @@ public final class ByteArray {
        /**
         * Convert array of bytes to java short.<br/>
         * Size can't be bigger than size of short in bytes.
-        *
-        * @param bytes
-        *            byte[]
+        * 
+        * @param bytes byte[]
         * @return array of bytes
         */
-       public static short bytesToShort(byte[] bytes) {
+       public static short bytesToShort(final byte[] bytes) {
                if (bytes.length > Short.SIZE / Byte.SIZE) {
                        throw new IllegalArgumentException("Cannot convert bytes to short. Byte array too big.");
                }
@@ -326,12 +301,11 @@ public final class ByteArray {
 
        /**
         * Convert short java representation to array of bytes.
-        *
-        * @param num
-        *            short
+        * 
+        * @param num short
         * @return short represented as array of bytes
         */
-       public static byte[] shortToBytes(short num) {
+       public static byte[] shortToBytes(final short num) {
                final ByteBuffer bytesBuffer = ByteBuffer.allocate(Short.SIZE / Byte.SIZE);
                bytesBuffer.putShort(num);
 
@@ -340,12 +314,11 @@ public final class ByteArray {
 
        /**
         * Convert float java representation to array of bytes.
-        *
-        * @param num
-        *            float
+        * 
+        * @param num float
         * @return float represented as array of bytes
         */
-       public static byte[] floatToBytes(float num) {
+       public static byte[] floatToBytes(final float num) {
                final ByteBuffer bytesBuffer = ByteBuffer.allocate(Float.SIZE / Byte.SIZE);
                bytesBuffer.putFloat(num);
 
@@ -353,17 +326,15 @@ public final class ByteArray {
        }
 
        /**
-        * Pretty print array of bytes as hex encoded string with 16 bytes per line.
-        * Each byte is separated by space, after first 8 bytes there are 2 spaces
-        * instead of one.
+        * Pretty print array of bytes as hex encoded string with 16 bytes per line. Each byte is separated by space, after
+        * first 8 bytes there are 2 spaces instead of one.
         */
-       public static String bytesToHexString(byte[] array) {
+       public static String bytesToHexString(final byte[] array) {
                return bytesToHexString(array, 16, " ", 8, " ");
        }
 
        /**
-        * Pretty-print an array of bytes as hex-encoded string. Separate them
-        * with specified separator.
+        * Pretty-print an array of bytes as hex-encoded string. Separate them with specified separator.
         */
        public static String toHexString(final byte[] array, final String separator) {
                final StringBuilder sb = new StringBuilder();
@@ -377,19 +348,16 @@ public final class ByteArray {
 
        /**
         * Convert array of bytes to hexadecimal String.
-        *
+        * 
         * @param array
-        * @param bytesOnLine
-        *            number of bytes that should by displayed in one line
-        * @param byteSeparator
-        *            string that will be placed after each byte
-        * @param wordCount
-        *            number of bytes that make a 'word' (group of bytes)
-        * @param wordSeparator
-        *            string that will be placed after each word
+        * @param bytesOnLine number of bytes that should by displayed in one line
+        * @param byteSeparator string that will be placed after each byte
+        * @param wordCount number of bytes that make a 'word' (group of bytes)
+        * @param wordSeparator string that will be placed after each word
         * @return Hexadecimal string representation of given byte array
         */
-       public static String bytesToHexString(byte[] array, int bytesOnLine, String byteSeparator, int wordCount, String wordSeparator) {
+       public static String bytesToHexString(final byte[] array, final int bytesOnLine, final String byteSeparator, final int wordCount,
+                       final String wordSeparator) {
                final StringBuilder sb = new StringBuilder();
                for (int i = 0; i < array.length; i++) {
                        sb.append(Hex.encodeHexString(new byte[] { array[i] }));
@@ -407,14 +375,12 @@ public final class ByteArray {
        }
 
        /**
-        * Decodes bytes to human readable UTF-8 string. If bytes are not valid
-        * UTF-8, they are represented as raw binary.
-        *
-        * @param bytes
-        *            bytes to be decoded to string
+        * Decodes bytes to human readable UTF-8 string. If bytes are not valid UTF-8, they are represented as raw binary.
+        * 
+        * @param bytes bytes to be decoded to string
         * @return String representation of passed bytes
         */
-       public static String bytesToHRString(byte[] bytes) {
+       public static String bytesToHRString(final byte[] bytes) {
                try {
                        return Charset.forName("UTF-8").newDecoder().decode(ByteBuffer.wrap(bytes)).toString();
                } catch (final CharacterCodingException e) {
@@ -423,14 +389,15 @@ public final class ByteArray {
        }
 
        /**
-        * Searches for byte sequence in given array. Returns the index of first occurrence of
-        * this sequence (where it starts).
+        * Searches for byte sequence in given array. Returns the index of first occurrence of this sequence (where it
+        * starts).
+        * 
         * @param bytes byte array where to search for sequence
         * @param sequence to be searched in given byte array
-        * @return -1 if the sequence could not be found in given byte array
-        *                      int index of first occurrence of the sequence in bytes
+        * @return -1 if the sequence could not be found in given byte array int index of first occurrence of the sequence
+        *         in bytes
         */
-       public static int findByteSequence(byte[] bytes, byte[] sequence) {
+       public static int findByteSequence(final byte[] bytes, final byte[] sequence) {
                if (bytes.length < sequence.length)
                        throw new IllegalArgumentException("Sequence to be found is longer than the given byte array.");
                if (bytes.length == sequence.length)
@@ -451,22 +418,22 @@ public final class ByteArray {
        }
 
        private static final byte maskBits[] = new byte[] { 0, -128, -64, -32, -16, -8, -4, -2 };
-       public static final byte[] maskBytes(final byte[] original,
-                       final int bits) {
+
+       public static final byte[] maskBytes(final byte[] original, final int bits) {
                if (original.length * 8 < bits)
                        throw new IllegalArgumentException("Attempted to apply invalid mask (too long)");
 
-               final int needbytes = (bits +7) / 8;
+               final int needbytes = (bits + 7) / 8;
                // We need to have a new copy of the underlying byte array, so that
                // the original bytes stay untouched
                final byte[] bytes = Arrays.copyOf(original, original.length);
 
                final int needmask = bits % 8;
                if (needmask != 0)
-                       bytes[needbytes-1] &= maskBits[needmask];
+                       bytes[needbytes - 1] &= maskBits[needmask];
 
-               // zero-out  the rest of the bytes
-               for (int i = needbytes ; i < bytes.length; i++) {
+               // zero-out the rest of the bytes
+               for (int i = needbytes; i < bytes.length; i++) {
                        bytes[i] = 0;
                }
                return bytes;