Bump mdsal to 5.0.2 28/84228/26
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 5 Sep 2019 16:48:14 +0000 (18:48 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 9 Oct 2019 09:16:24 +0000 (11:16 +0200)
This bumps mdsal to 5.0.2 as part of Magnesium MRI.

Change-Id: Id9ab45edf28477dca8acf8f7538cfd26f237f6f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
157 files changed:
bgp/benchmark-app/src/main/java/org/opendaylight/protocol/bgp/benchmark/app/AppPeerBenchmark.java
bgp/extensions/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/EsiModelUtil.java
bgp/extensions/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/NlriModelUtil.java
bgp/extensions/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnTestUtil.java
bgp/extensions/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/LanParserTest.java
bgp/extensions/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/MacParserTest.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FSDscpHandler.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/FSTcpFlagsHandler.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/handlers/NumericOneByteOperandParser.java
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/handlers/NumericTwoByteOperandParser.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/AbstractLabeledUnicastRIBSupport.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/LinkAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/NodeAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/BindingSidLabelParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/RangeTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/SrLinkAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/UnnumberedEroParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/LinkNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/LinkstateNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/NodeNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/LinkIdTlvParser.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParserTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateNlriParserTest.java
bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/OpaqueUtil.java
bgp/extensions/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/PMSITunnelAttributeHandler.java
bgp/extensions/route-target/src/main/java/org/opendaylight/protocol/bgp/route/targetcontrain/impl/RouteTargetConstrainRIBSupport.java
bgp/openconfig-api/src/main/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/bgp/policy/rev151009/BgpSetMedTypeBuilder.java
bgp/openconfig-api/src/main/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/bgp/types/rev151009/BgpStdCommunityTypeBuilder.java
bgp/openconfig-api/src/main/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/bgp/types/rev151009/RrClusterIdTypeBuilder.java
bgp/openconfig-api/src/main/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/policy/types/rev151009/TagTypeBuilder.java
bgp/openconfig-api/src/test/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/bgp/policy/rev151009/BgpSetMedTypeBuilderTest.java
bgp/openconfig-rp-spi/pom.xml
bgp/openconfig-rp-spi/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/spi/registry/ActionsRegistryImpl.java
bgp/openconfig-rp-spi/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/spi/registry/BgpAttributeConditionsUtil.java
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPError.java
bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java
bgp/parser-impl/pom.xml
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPNotificationMessageParser.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/GracefulCapabilityHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/LlGracefulCapabilityHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LocalPreferenceAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MultiExitDiscriminatorAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/UnrecognizedAttributesSerializer.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/AsTwoOctetSpecificEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/RouteOriginAsTwoOctetEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/SourceASHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/route/target/RouteTargetExtendedCommunityHandler.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/GracefulCapabilityHandlerTest.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtil.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/PathIdUtilTest.java
bgp/path-selection-mode/pom.xml
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/BesthPathStateUtil.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/api/BestPathState.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/api/RouteEntry.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/BestPathStateImpl.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/AddPathAbstractRouteEntry.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/AddPathBestPath.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/AddPathSelector.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/add/RouteKey.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/base/BaseBestPath.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/base/BaseRouteEntry.java
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/spi/AbstractBestPathSelector.java
bgp/path-selection-mode/src/test/java/org/opendaylight/protocol/bgp/mode/impl/base/BaseBestPathTest.java
bgp/peer-acceptor/src/main/java/org/opendaylight/protocol/bgp/peer/acceptor/BGPPeerAcceptorImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BgpPeerRpc.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BGPClusterSingletonService.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/GracefulRestartUtil.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtil.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImpl.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationAndExceptionTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtilTest.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilder.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/ProtocolUtil.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/UriBuilder.java
binding-parent/pom.xml
bmp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/app/BmpMonitoringStationImpl.java
bmp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/app/BmpRibInWriter.java
bmp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/app/TableContext.java
bmp/bmp-mock/pom.xml
parent/pom.xml
pcep/base-parser/pom.xml
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPErrorObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPNotificationObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPRequestParameterObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSRLGSubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/PathSetupTypeTlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/PathBindingTlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCReportMessageParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/DefaultPCEPSessionNegotiatorFactory.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImpl.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/FiniteStateMachineTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPSessionImplTest.java
pcep/pcc-mock/pom.xml
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/Main.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCSyncOptimization.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCTunnelBuilder.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCTunnelManagerImpl.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCsBuilder.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/TimerHandler.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/api/PCCDispatcher.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCPeerProposal.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCServerPeerProposal.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/spi/MsgBuilderUtil.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCIncrementalSyncTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCSessionListenerTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCSyncAvoidanceProcedureTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCTriggeredFullDBResyncTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCTriggeredLspResyncTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCTriggeredSyncTest.java
pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/AbstractSrSubobjectParser.java
pcep/spi/pom.xml
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPErrors.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PSTUtil.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyProviderBean.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyProviderUtil.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/session/stats/SessionStateImpl.java
pcep/topology/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/IncrementalSynchronizationProcedureTest.java
pcep/topology/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTriggeredReSynchronizationProcedureTest.java
pcep/topology/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/PCETriggeredInitialSyncProcedureTest.java
pcep/topology/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/StateSynchronizationAvoidanceProcedureTest.java
pcep/topology/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListenerTest.java
pcep/topology/topology-stats/src/main/java/org/opendaylight/bgpcep/pcep/topology/stats/provider/TopologyStatsProviderImpl.java
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/CreateTunnelInstructionExecutor.java
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/PCEPTunnelClusterSingletonService.java
programming/api/src/test/java/org/opendaylight/bgpcep/programming/NanotimeUtilTest.java
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImpl.java
programming/impl/src/test/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImplTest.java
programming/spi/src/main/java/org/opendaylight/bgpcep/programming/spi/SchedulerException.java
programming/spi/src/main/java/org/opendaylight/bgpcep/programming/spi/SuccessfulRpcResult.java
rsvp/impl/pom.xml
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/xro/XROSrlgSubobjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/AbstractAssociationParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/FastRerouteObjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/InformationalFastRerouteObjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/MetricObjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/SessionAttributeLspObjectParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/SessionAttributeLspRaObjectParser.java
rsvp/spi/pom.xml
rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CUISubobjectParserTest.java
util/pom.xml
util/src/main/java/org/opendaylight/protocol/util/ByteBufWriteUtil.java
util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/test/java/org/opendaylight/protocol/util/ByteBufWriteUtilTest.java

index 00a03953bfbd62f37d3c2c87767acb52f3d87386..92f20a4a51072be9a1808da1949e031d3e938bd7 100644 (file)
@@ -5,7 +5,6 @@
  * 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.bgp.benchmark.app;
 
 import static java.util.Objects.requireNonNull;
@@ -74,6 +73,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -188,7 +188,8 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         return this.routesIId;
     }
 
-    private long addRoute(final Ipv4Prefix ipv4Prefix, final Ipv4Address nextHop, final long count, final long batch) {
+    private long addRoute(final Ipv4Prefix ipv4Prefix, final Ipv4Address nextHop, final Uint32 count,
+            final Uint32 batch) {
         final AttributesBuilder attributesBuilder = new AttributesBuilder();
         attributesBuilder.setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(
                 new Ipv4NextHopBuilder().setGlobal(new Ipv4Address(nextHop)).build()).build());
@@ -200,16 +201,18 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         return processRoutes(ipv4Prefix, count, batch, attributes);
     }
 
-    private long deleteRoute(final Ipv4Prefix ipv4Prefix, final long count, final long batch) {
+    private long deleteRoute(final Ipv4Prefix ipv4Prefix, final Uint32 count, final Uint32 batch) {
         return processRoutes(ipv4Prefix, count, batch, null);
     }
 
-    private long processRoutes(final Ipv4Prefix ipv4Prefix, final long count, final long batch,
+    private long processRoutes(final Ipv4Prefix ipv4Prefix, final Uint32 count, final Uint32 batch,
         final Attributes attributes) {
         WriteTransaction wt = this.txChain.newWriteOnlyTransaction();
         String address = getAdddressFromPrefix(ipv4Prefix);
+        final long countLong = count.longValue();
+        final long batchLong = batch.longValue();
         final Stopwatch stopwatch = Stopwatch.createStarted();
-        for (int i = 1; i <= count; i++) {
+        for (int i = 1; i <= countLong; i++) {
             final Ipv4RouteKey routeKey = new Ipv4RouteKey(NON_PATH_ID, createKey(address));
             final KeyedInstanceIdentifier<Ipv4Route, Ipv4RouteKey> routeIId =
                 this.routesIId.child(Ipv4Route.class, routeKey);
@@ -225,7 +228,7 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
             } else {
                 wt.delete(LogicalDatastoreType.CONFIGURATION, routeIId);
             }
-            if (i % batch == 0) {
+            if (i % batchLong == 0) {
                 wt.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
                     public void onSuccess(final CommitInfo result) {
@@ -255,19 +258,19 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         return stopwatch.stop().elapsed(TimeUnit.MILLISECONDS);
     }
 
-    private static long countRate(final long durationMillis, final long count) {
+    private static long countRate(final long durationMillis, final Uint32 count) {
         final long durationSec = TimeUnit.MILLISECONDS.toSeconds(durationMillis);
         if (durationSec != 0) {
-            return count / durationSec;
+            return count.toJava() / durationSec;
         }
-        return count;
+        return count.toJava();
     }
 
     private static String increasePrefix(final String prefix) {
         return InetAddresses.increment(InetAddresses.forString(prefix)).getHostAddress();
     }
 
-    private static Result createResult(final long count, final long duration, final long rate) {
+    private static Result createResult(final Uint32 count, final long duration, final long rate) {
         return new ResultBuilder().setCount(count).setDuration(duration).setRate(rate).build();
     }
 
index ac1187c854f77e2b38c42a1f4f238d8b26326b4e..3dae118bf3bc838d8e82d372de731e6d1dab297b 100644 (file)
@@ -16,6 +16,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.arbitrary._case.ArbitraryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.evpn.EvpnChoice;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
@@ -43,8 +45,8 @@ final class EsiModelUtil {
         throw new UnsupportedOperationException();
     }
 
-    static Long extractLD(final ContainerNode cont) {
-        return (Long) cont.getChild(LD_NID).get().getValue();
+    static Uint32 extractLD(final ContainerNode cont) {
+        return (Uint32) cont.getChild(LD_NID).get().getValue();
     }
 
     static Arbitrary extractArbitrary(final ContainerNode esi) {
@@ -55,14 +57,12 @@ final class EsiModelUtil {
         return new ArbitraryBuilder().setArbitrary(arbitrary).build();
     }
 
-
     static AsNumber extractAS(final ContainerNode asGen) {
-        return new AsNumber((Long) asGen.getChild(AS_NID).get().getValue());
+        return new AsNumber((Uint32) asGen.getChild(AS_NID).get().getValue());
     }
 
-
-    static Integer extractPK(final ContainerNode t1) {
-        return (Integer) t1.getChild(PK_NID).get().getValue();
+    static Uint16 extractPK(final ContainerNode t1) {
+        return (Uint16) t1.getChild(PK_NID).get().getValue();
     }
 
     static MacAddress extractLacpMac(final ContainerNode t1) {
@@ -73,12 +73,12 @@ final class EsiModelUtil {
         return new MacAddress((String) lan.getChild(BRIDGE_MAC_NID).get().getValue());
     }
 
-    static Integer extractBP(final ContainerNode lan) {
-        return (Integer) lan.getChild(RBP_NID).get().getValue();
+    static Uint16 extractBP(final ContainerNode lan) {
+        return (Uint16) lan.getChild(RBP_NID).get().getValue();
     }
 
     static Uint24 extractUint24LD(final ContainerNode esiVal) {
-        return new Uint24((Long) esiVal.getChild(LD_NID).get().getValue());
+        return new Uint24((Uint32) esiVal.getChild(LD_NID).get().getValue());
     }
 
     static MacAddress extractSystmeMac(final ContainerNode macGEn) {
@@ -88,5 +88,4 @@ final class EsiModelUtil {
     static Ipv4Address extractRD(final ContainerNode t4) {
         return new Ipv4Address((String) t4.getChild(RD_NID).get().getValue());
     }
-
 }
index e549d3120ea70a60c153c0dc00c710bb29f8d6cc..36784e59000060cc971ac12c8ee8133768467abf 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisherBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -57,7 +58,7 @@ final class NlriModelUtil {
 
     static EthernetTagId extractETI(final ContainerNode evpn) {
         final ContainerNode eti = (ContainerNode) evpn.getChild(ETI_NID).get();
-        return new EthernetTagIdBuilder().setVlanId((Long) eti.getChild(VLAN_NID).get().getValue()).build();
+        return new EthernetTagIdBuilder().setVlanId((Uint32) eti.getChild(VLAN_NID).get().getValue()).build();
     }
 
     static MacAddress extractMAC(final DataContainerNode<? extends PathArgument> evpn) {
@@ -75,7 +76,7 @@ final class NlriModelUtil {
     static MplsLabel extractMplsLabel(final DataContainerNode<? extends PathArgument> evpn,
             final NodeIdentifier mplsNid) {
         if (evpn.getChild(mplsNid).isPresent()) {
-            return new MplsLabel((Long) evpn.getChild(mplsNid).get().getValue());
+            return new MplsLabel((Uint32) evpn.getChild(mplsNid).get().getValue());
         }
         return null;
     }
index 3006ec2b02979ddbb69326535cf66889e02692a8..027636dc9af228a2326f5105e18d1a02405c2989 100644 (file)
@@ -16,6 +16,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisherBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
@@ -24,22 +26,22 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLe
 
 public final class EvpnTestUtil {
     public static final int VALUE_SIZE = 9;
-    public static final long LD = 33686018;
+    public static final Uint32 LD = Uint32.valueOf(33686018);
     public static final String MAC_MODEL = "f2:0c:dd:80:9f:f7";
     public static final MacAddress MAC = new MacAddress(MAC_MODEL);
-    public static final long AS_MODEL = 16843009;
+    public static final Uint32 AS_MODEL = Uint32.valueOf(16843009);
     public static final AsNumber AS_NUMBER = new AsNumber(AS_MODEL);
-    public static final Integer PORT = 514;
-    public static final MplsLabel MPLS_LABEL = new MplsLabel(24001L);
+    public static final Uint16 PORT = Uint16.valueOf(514);
+    public static final Uint32 MPLS_LABEL_MODEL = Uint32.valueOf(24001L);
+    public static final MplsLabel MPLS_LABEL = new MplsLabel(MPLS_LABEL_MODEL);
     public static final int COMMUNITY_VALUE_SIZE = 6;
-    public static final long VLAN = 10L;
+    public static final Uint32 VLAN = Uint32.valueOf(10);
     public static final String IP_MODEL = "127.0.0.1";
     public static final IpAddress IP = new IpAddress(new Ipv4Address(IP_MODEL));
     public static final String IPV6_MODEL = "2001::1";
     public static final IpAddress IPV6 = new IpAddress(new Ipv6Address(IPV6_MODEL));
-    public static final long MPLS_LABEL_MODEL = 24001L;
-    public static final MplsLabel MPLS_LABEL2 = new MplsLabel(24002L);
-    public static final long MPLS_LABEL2_MODEL = 24002L;
+    public static final Uint32 MPLS_LABEL2_MODEL = Uint32.valueOf(24002L);
+    public static final MplsLabel MPLS_LABEL2 = new MplsLabel(MPLS_LABEL2_MODEL);
     public static final String RD_MODEL = "1.2.3.4:258";
     public static final RouteDistinguisher RD = RouteDistinguisherBuilder.getDefaultInstance(RD_MODEL);
 
index cf7517ad0791defc10989f1c08953a698c4e3eb4..8bfe0c8cf38a9ef64bc86ec95f73cf834344b3cc 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.LanAutoGeneratedCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.lan.auto.generated._case.LanAutoGenerated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.lan.auto.generated._case.LanAutoGeneratedBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -35,7 +36,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 
 public class LanParserTest {
-    private static final Integer PRIORITY = 514;
+    private static final Uint16 PRIORITY = Uint16.valueOf(514);
     public static final LanAutoGeneratedCase LAN_AUT_GEN_CASE = new LanAutoGeneratedCaseBuilder()
             .setLanAutoGenerated(new LanAutoGeneratedBuilder()
         .setRootBridgeMacAddress(MAC).setRootBridgePriority(PRIORITY).build()).build();
index 2f020d524048657608f80dd9cb87d55a5156427b..68da2182e8836b11e040fe92fb3dde2a33b6e1b0 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.MacAutoGeneratedCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.mac.auto.generated._case.MacAutoGenerated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.esi.esi.mac.auto.generated._case.MacAutoGeneratedBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
@@ -37,7 +38,7 @@ public final class MacParserTest {
         (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private static final byte[] RESULT = {(byte) 0x03, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f,
         (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00};
-    private static final long UINT24_LD_MODEL = 131584L;
+    private static final Uint32 UINT24_LD_MODEL = Uint32.valueOf(131584L);
     private static final Uint24 UINT24_LD = new Uint24(UINT24_LD_MODEL);
     private MacParser parser;
 
index 5d3a7c48e612a7d09ee7481b5e50cc3d04b7cd9d..8ec58f146aad5bc874ae75f2401abb3314ec3723 100644 (file)
@@ -33,7 +33,7 @@ public final class FSDscpHandler implements FlowspecTypeParser, FlowspecTypeSeri
         for (final Iterator<Dscps> it = dscps.iterator(); it.hasNext(); ) {
             final Dscps dscp = it.next();
             NumericOneByteOperandParser.INSTANCE.serialize(dscp.getOp(), 1, !it.hasNext(), nlriByteBuf);
-            Util.writeShortest(dscp.getValue().getValue(), nlriByteBuf);
+            Util.writeShortest(dscp.getValue().getValue().toJava(), nlriByteBuf);
         }
     }
 
index f54340d2f07eed8986ea65f8179095841182cd0b..e84d00314739024488b30f13d75d4517501115f9 100644 (file)
@@ -35,7 +35,7 @@ public final class FSTcpFlagsHandler implements FlowspecTypeParser, FlowspecType
         for (final Iterator<TcpFlags> it = flags.iterator(); it.hasNext(); ) {
             final TcpFlags flag = it.next();
             final ByteBuf flagsBuf = Unpooled.buffer();
-            Util.writeShortest(flag.getValue(), flagsBuf);
+            Util.writeShortest(flag.getValue().toJava(), flagsBuf);
             BitmaskOperandParser.INSTANCE.serialize(flag.getOp(), flagsBuf.readableBytes(),
                     !it.hasNext(), nlriByteBuf);
             nlriByteBuf.writeBytes(flagsBuf);
index e7d885e4cf60dfebbfc8359b5c23beecb8a1cb0c..dc83e7a07f9249980fbd378d4033cd77f9c9237a 100644 (file)
@@ -12,11 +12,12 @@ import java.util.Iterator;
 import java.util.List;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericOneByteValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericOperand;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Parser class for NumericOneByteValues.
  */
-public final class NumericOneByteOperandParser extends AbstractNumericByteOperandParser<NumericOneByteValue, Short> {
+public final class NumericOneByteOperandParser extends AbstractNumericByteOperandParser<NumericOneByteValue, Uint8> {
 
     public static final NumericOneByteOperandParser INSTANCE;
 
@@ -39,12 +40,12 @@ public final class NumericOneByteOperandParser extends AbstractNumericByteOperan
         for (final Iterator<T> it = list.iterator(); it.hasNext(); ) {
             final T operand = it.next();
             super.serialize(operand.getOp(), 1, !it.hasNext(), nlriByteBuf);
-            Util.writeShortest(operand.getValue(), nlriByteBuf);
+            Util.writeShortest(operand.getValue().toJava(), nlriByteBuf);
         }
     }
 
     @Override
-    protected <T extends NumericOneByteValue> Short getValue(final T item) {
+    protected <T extends NumericOneByteValue> Uint8 getValue(final T item) {
         return item.getValue();
     }
 
index 020b6367b5e21396fb07b2ad81a41933af803e16..1fa116a2868cae511e87dc9b979184420d2dd06e 100644 (file)
@@ -11,14 +11,14 @@ import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Iterator;
 import java.util.List;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericOperand;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericTwoByteValue;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 /**
  * Parser class for NumericTwoByteValues.
  */
-public final class NumericTwoByteOperandParser extends AbstractNumericByteOperandParser<NumericTwoByteValue, Integer> {
+public final class NumericTwoByteOperandParser extends AbstractNumericByteOperandParser<NumericTwoByteValue, Uint16> {
 
     public static final NumericTwoByteOperandParser INSTANCE;
 
@@ -41,14 +41,14 @@ public final class NumericTwoByteOperandParser extends AbstractNumericByteOperan
         for (final Iterator<T> it = list.iterator(); it.hasNext(); ) {
             final T operand = it.next();
             final ByteBuf protoBuf = Unpooled.buffer();
-            Util.writeShortest(operand.getValue(), protoBuf);
+            Util.writeShortest(operand.getValue().toJava(), protoBuf);
             super.serialize(operand.getOp(), protoBuf.readableBytes(), !it.hasNext(), nlriByteBuf);
             nlriByteBuf.writeBytes(protoBuf);
         }
     }
 
     @Override
-    protected <T extends NumericTwoByteValue> Integer getValue(final T item) {
+    protected <T extends NumericTwoByteValue> Uint16 getValue(final T item) {
         return item.getValue();
     }
 
index d60c95c1f3dca592fa6d92ac95c7a7e3e3db1802..dd35af3bb3638644438c01ec017c7e9d9afaf16d 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -161,7 +162,7 @@ abstract class AbstractLabeledUnicastRIBSupport<
                         = label.getChild(labelValueNid);
                 if (labelStack.isPresent()) {
                     final LabelStackBuilder labelStackbuilder = new LabelStackBuilder();
-                    labelStackbuilder.setLabelValue(new MplsLabel((Long) labelStack.get().getValue()));
+                    labelStackbuilder.setLabelValue(new MplsLabel((Uint32) labelStack.get().getValue()));
                     labels.add(labelStackbuilder.build());
                 }
             }
index 8f77c5ef3a8d68a0f1cf0b0f3da1ba9ab6a4e0b6..805fb3bff2e5be4deae7881b1fbffb0dc8d210d0 100644 (file)
@@ -302,7 +302,7 @@ public final class LinkAttributesParser {
             Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
         serializeUnreservedBw(linkAttributes.getUnreservedBandwidth(), output);
         ifPresentApply(linkAttributes.getTeMetric(), value -> TlvUtil.writeTLV(TE_METRIC,
-            Unpooled.copyLong(((TeMetric) value).getValue()), output));
+            Unpooled.copyLong(((TeMetric) value).getValue().toJava()), output));
         ifPresentApply(linkAttributes.getLinkProtection(), value -> TlvUtil.writeTLV(LINK_PROTECTION_TYPE,
             Unpooled.copyShort(((LinkProtectionType) value).getIntValue()), output));
         serializeMplsProtocolMask(linkAttributes.getMplsProtocol(), output);
index 125e0a2b76f1d703653bc018e9b9f0b690b2a8b1..66ace44af0b702f8c26e9dd1bbd76c79de0f36df 100644 (file)
@@ -188,7 +188,7 @@ public final class NodeAttributesParser {
         if (topList != null) {
             final ByteBuf mpIdBuf = Unpooled.buffer();
             for (final TopologyIdentifier topologyIdentifier : topList) {
-                mpIdBuf.writeShort(topologyIdentifier.getValue());
+                mpIdBuf.writeShort(topologyIdentifier.getValue().toJava());
             }
             TlvUtil.writeTLV(TlvUtil.MULTI_TOPOLOGY_ID, mpIdBuf, byteAggregator);
         }
index 7421a7944e6ca3d58f25d069918875e2c0b25c7e..9519ea0621e2c935327c77bef40c76d15d36ba82 100644 (file)
@@ -68,7 +68,7 @@ public final class BindingSidLabelParser {
 
     public static void serializeBindingSidAttributes(final Weight weight, final Flags flags,
             final List<BindingSubTlvs> bindingSubTlvs, final ByteBuf aggregator) {
-        aggregator.writeByte(weight.getValue());
+        aggregator.writeByte(weight.getValue().toJava());
         final BitArray bitFlags = serializeBindingSidFlags(flags);
         bitFlags.toByteBuf(aggregator);
         aggregator.writeZero(RESERVED_BINDING_SID);
index 333b93d0f33e3695c6b7b49f1b55681155ba4e27..b5527fbe0fd682b15e81f585a647e153afb3ae72 100644 (file)
@@ -101,7 +101,7 @@ public final class RangeTlvParser {
         flags.set(INNER_AREA, srRange.isInterArea());
         flags.toByteBuf(aggregator);
         aggregator.writeZero(RESERVED);
-        aggregator.writeShort(srRange.getRangeSize());
+        aggregator.writeShort(srRange.getRangeSize().toJava());
         serializeSubTlvs(aggregator, srRange.getSubTlvs());
     }
 
index 460eb2ae1ff6b0c0b3ae8b279a40a5c394dac232..ec7c1f97a11f37de4cfca016a5ecc49770eeb107 100644 (file)
@@ -178,7 +178,7 @@ public final class SrLinkAttributesParser {
         } else {
             value.writeZero(FLAGS_BYTE_SIZE);
         }
-        value.writeByte(adjSid.getWeight().getValue());
+        value.writeByte(adjSid.getWeight().getValue().toJava());
         value.writeZero(RESERVED);
         value.writeBytes(SidLabelIndexParser.serializeSidValue(adjSid.getSidLabelIndex()));
         return value;
@@ -195,7 +195,7 @@ public final class SrLinkAttributesParser {
         final ByteBuf value = Unpooled.buffer();
         final BitArray flags = serializeAdjFlags(srLanAdjId.getFlags(), srLanAdjId.getSidLabelIndex());
         flags.toByteBuf(value);
-        value.writeByte(srLanAdjId.getWeight().getValue());
+        value.writeByte(srLanAdjId.getWeight().getValue().toJava());
         value.writeZero(RESERVED);
         if (srLanAdjId.getIsoSystemId() != null) {
             value.writeBytes(srLanAdjId.getIsoSystemId().getValue());
index bccacbc15bd1040c0b95a47451578d91af1fe2c7..502799fd5cd87961e3c70a6db4d983ee04fa9333 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.BindingSubTlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.UnnumberedInterfaceIdEroCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.UnnumberedInterfaceIdEroCaseBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class UnnumberedEroParser implements BindingSubTlvsParser, BindingSubTlvsSerializer {
     private static final int UNNUMBERED_ERO = 1165;
@@ -55,7 +56,7 @@ public final class UnnumberedEroParser implements BindingSubTlvsParser, BindingS
         return builder.build();
     }
 
-    static ByteBuf serializeUnnumberedIdEro(final Boolean loose, final Long routerId, final Long interfaceId) {
+    static ByteBuf serializeUnnumberedIdEro(final Boolean loose, final Uint32 routerId, final Uint32 interfaceId) {
         final ByteBuf buffer = Unpooled.buffer();
         Ipv4EroParser.serializeEroFlags(buffer, loose);
         buffer.writeInt(routerId.intValue());
index 9af5f9c4ef5218b2a92634a1dbb25ce717eb8670..1e862816c951136127b76171be8a7388432f62ce 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LocalNodeDescriptors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.RemoteNodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
@@ -63,8 +64,8 @@ public final class LinkNlriParser extends AbstractNlriTypeCodec {
         final LinkDescriptorsBuilder linkDescBuilder = new LinkDescriptorsBuilder();
 
         if (descriptors.getChild(LINK_LOCAL_NID).isPresent() && descriptors.getChild(LINK_REMOTE_NID).isPresent()) {
-            linkDescBuilder.setLinkLocalIdentifier((Long) descriptors.getChild(LINK_LOCAL_NID).get().getValue());
-            linkDescBuilder.setLinkRemoteIdentifier((Long) descriptors.getChild(LINK_REMOTE_NID).get().getValue());
+            linkDescBuilder.setLinkLocalIdentifier((Uint32) descriptors.getChild(LINK_LOCAL_NID).get().getValue());
+            linkDescBuilder.setLinkRemoteIdentifier((Uint32) descriptors.getChild(LINK_REMOTE_NID).get().getValue());
         }
         ifPresentApply(descriptors, IPV4_IFACE_NID,
             value -> linkDescBuilder.setIpv4InterfaceAddress(new Ipv4InterfaceIdentifier((String) value)));
index 7d71126e59de17e2ccb516d1d28fb3e052be3fa9..24a6705dd96a3789f24eb1c975d328de010d3f58 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.bgp.linkstate.impl.nlri;
 
 import com.google.common.annotations.VisibleForTesting;
 import io.netty.buffer.ByteBuf;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -47,6 +46,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
@@ -282,6 +282,6 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
                 .forValue(domProtocolIdValue((String) dataContainerChild.getValue()))));
         final Optional<DataContainerChild<? extends PathArgument, ?>> identifier = linkstate.getChild(IDENTIFIER_NID);
         identifier.ifPresent(dataContainerChild -> builder
-                .setIdentifier(new Identifier((BigInteger) dataContainerChild.getValue())));
+                .setIdentifier(new Identifier((Uint64) dataContainerChild.getValue())));
     }
 }
index 9b8b189b56fc98039f1a10f2a2850444dda9feb4..152c260e5b1f612be7d7d2d609286fb0b404787d 100644 (file)
@@ -53,6 +53,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
@@ -140,9 +142,9 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
         nodeBuilder.setIsIsRouterIdentifier(isisRouterId.build());
 
         if (pseudoIsisNode.getChild(PSN_NID).isPresent()) {
-            nodeBuilder.setPsn((Short) pseudoIsisNode.getChild(PSN_NID).get().getValue());
+            nodeBuilder.setPsn((Uint8) pseudoIsisNode.getChild(PSN_NID).get().getValue());
         } else {
-            nodeBuilder.setPsn((short) 0);
+            nodeBuilder.setPsn(Uint8.ZERO);
         }
 
         return new IsisPseudonodeCaseBuilder().setIsisPseudonode(nodeBuilder.build()).build();
@@ -152,7 +154,7 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
         final OspfNodeCaseBuilder builder = new OspfNodeCaseBuilder();
         if (ospf.getChild(OSPF_ROUTER_NID).isPresent()) {
             final OspfNodeBuilder nodeBuilder = new OspfNodeBuilder();
-            nodeBuilder.setOspfRouterId((Long) ospf.getChild(OSPF_ROUTER_NID).get().getValue());
+            nodeBuilder.setOspfRouterId((Uint32) ospf.getChild(OSPF_ROUTER_NID).get().getValue());
             builder.setOspfNode(nodeBuilder.build());
         }
         return builder.build();
@@ -162,11 +164,11 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
         final OspfPseudonodeCaseBuilder builder = new OspfPseudonodeCaseBuilder();
         final OspfPseudonodeBuilder nodeBuilder = new OspfPseudonodeBuilder();
         if (ospfPseudonode.getChild(LAN_IFACE_NID).isPresent()) {
-            nodeBuilder.setLanInterface(new OspfInterfaceIdentifier((Long)ospfPseudonode.getChild(LAN_IFACE_NID)
+            nodeBuilder.setLanInterface(new OspfInterfaceIdentifier((Uint32)ospfPseudonode.getChild(LAN_IFACE_NID)
                     .get().getValue()));
         }
         if (ospfPseudonode.getChild(OSPF_ROUTER_NID).isPresent()) {
-            nodeBuilder.setOspfRouterId((Long)ospfPseudonode.getChild(OSPF_ROUTER_NID).get().getValue());
+            nodeBuilder.setOspfRouterId((Uint32)ospfPseudonode.getChild(OSPF_ROUTER_NID).get().getValue());
         }
         builder.setOspfPseudonode(nodeBuilder.build());
         return builder.build();
@@ -193,17 +195,17 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
 
     private static AsNumber serializeAsNumber(final ContainerNode descriptorsData) {
         return descriptorsData.getChild(AS_NUMBER_NID).map(
-            dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
+            dataContainerChild -> new AsNumber((Uint32) dataContainerChild.getValue())).orElse(null);
     }
 
     private static DomainIdentifier serializeDomainId(final ContainerNode descriptorsData) {
         return descriptorsData.getChild(DOMAIN_NID).map(
-            dataContainerChild -> new DomainIdentifier((Long) dataContainerChild.getValue())).orElse(null);
+            dataContainerChild -> new DomainIdentifier((Uint32) dataContainerChild.getValue())).orElse(null);
     }
 
     private static AreaIdentifier serializeAreaId(final ContainerNode descriptorsData) {
         return descriptorsData.getChild(AREA_NID).map(
-            dataContainerChild -> new AreaIdentifier((Long) dataContainerChild.getValue())).orElse(null);
+            dataContainerChild -> new AreaIdentifier((Uint32) dataContainerChild.getValue())).orElse(null);
     }
 
     private static Ipv4Address serializeBgpRouterId(final ContainerNode descriptorsData) {
@@ -213,7 +215,7 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
 
     private static AsNumber serializeMemberAsn(final ContainerNode descriptorsData) {
         return descriptorsData.getChild(MEMBER_ASN_NID).map(
-            dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
+            dataContainerChild -> new AsNumber((Uint32) dataContainerChild.getValue())).orElse(null);
     }
 
     static LocalNodeDescriptors serializeLocalNodeDescriptors(final ContainerNode descriptorsData) {
index 7bbf2680d1f63207e83c66e9a934a247d09f4960..190ff0abf361946b56b8c1f7fd2186ec77f4d286 100644 (file)
@@ -12,6 +12,7 @@ import org.opendaylight.protocol.bgp.linkstate.spi.LinkstateTlvParser;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkLrIdentifiers;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSerializer<LinkLrIdentifiers>,
         LinkstateTlvParser<LinkLrIdentifiers> {
@@ -26,8 +27,8 @@ public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSer
 
     @Override
     public LinkLrIdentifiers parseTlvBody(final ByteBuf value) {
-        final long localId = value.readUnsignedInt();
-        final long remoteId = value.readUnsignedInt();
+        final Uint32 localId = Uint32.valueOf(value.readUnsignedInt());
+        final Uint32 remoteId = Uint32.valueOf(value.readUnsignedInt());
         return new LinkLrIdentifiers() {
             @Override
             public Class<LinkLrIdentifiers> implementedInterface() {
@@ -35,12 +36,12 @@ public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSer
             }
 
             @Override
-            public Long getLinkRemoteIdentifier() {
+            public Uint32 getLinkRemoteIdentifier() {
                 return remoteId;
             }
 
             @Override
-            public Long getLinkLocalIdentifier() {
+            public Uint32 getLinkLocalIdentifier() {
                 return localId;
             }
         };
index b5fbf2b929ce783000bb8eb957f85d8a1e6df7fa..05850bb27b5d74c9420fd3c6a1a5099deefedec2 100644 (file)
@@ -70,6 +70,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AssociationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObject;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class LinkstateAttributeParserTest {
 
@@ -225,7 +227,7 @@ public class LinkstateAttributeParserTest {
 
         assertEquals("42.42.42.42", ls.getLocalIpv4RouterId().getValue());
         assertEquals("43.43.43.43", ls.getRemoteIpv4RouterId().getValue());
-        assertEquals(Long.valueOf(0L), ls.getAdminGroup().getValue());
+        assertEquals(Uint32.ZERO, ls.getAdminGroup().getValue());
         assertArrayEquals(new byte[] { (byte) 0x49, (byte) 0x98, (byte) 0x96, (byte) 0x80 },
             ls.getMaxLinkBandwidth().getValue());
         assertArrayEquals(new byte[] { (byte) 0x46, (byte) 0x43, (byte) 0x50, (byte) 0x00 },
@@ -235,7 +237,7 @@ public class LinkstateAttributeParserTest {
         assertEquals(LinkProtectionType.Dedicated1to1, ls.getLinkProtection());
         assertTrue(ls.getMplsProtocol().isLdp());
         assertTrue(ls.getMplsProtocol().isRsvpte());
-        assertEquals(new Long(10), ls.getMetric().getValue());
+        assertEquals(Uint32.valueOf(10), ls.getMetric().getValue());
         assertEquals(2, ls.getSharedRiskLinkGroups().size());
         assertEquals(305419896, ls.getSharedRiskLinkGroups().get(0).getValue().intValue());
         assertEquals("12K-2", ls.getLinkName());
@@ -243,23 +245,23 @@ public class LinkstateAttributeParserTest {
                 .setBackup(Boolean.FALSE).setSet(Boolean.FALSE).build();
         assertEquals(flags, ls.getSrAdjIds().get(0).getFlags());
         assertEquals(flags, ls.getSrAdjIds().get(1).getFlags());
-        assertEquals(new Long(1048575L), ((LocalLabelCase)ls.getSrAdjIds().get(0).getSidLabelIndex()).getLocalLabel()
-            .getValue());
-        assertEquals(new Long(1048559L), ((LocalLabelCase)ls.getSrAdjIds().get(1).getSidLabelIndex()).getLocalLabel()
-            .getValue());
-        assertEquals(new Long(168496141L), ((SidCase) ls.getPeerNodeSid().getSidLabelIndex()).getSid());
-        assertEquals(new Short("5"), ls.getPeerNodeSid().getWeight().getValue());
-        assertEquals(new Long(168496142L), ((SidCase) ls.getPeerSetSids().get(0).getSidLabelIndex()).getSid());
-        assertEquals(new Short("5"), ls.getPeerSetSids().get(0).getWeight().getValue());
-        assertEquals(new Long(168496143L), ((SidCase) ls.getPeerAdjSid().getSidLabelIndex()).getSid());
-        assertEquals(new Short("5"), ls.getPeerAdjSid().getWeight().getValue());
+        assertEquals(Uint32.valueOf(1048575L),
+            ((LocalLabelCase)ls.getSrAdjIds().get(0).getSidLabelIndex()).getLocalLabel().getValue());
+        assertEquals(Uint32.valueOf(1048559L),
+            ((LocalLabelCase)ls.getSrAdjIds().get(1).getSidLabelIndex()).getLocalLabel().getValue());
+        assertEquals(Uint32.valueOf(168496141L), ((SidCase) ls.getPeerNodeSid().getSidLabelIndex()).getSid());
+        assertEquals(Uint8.valueOf(5), ls.getPeerNodeSid().getWeight().getValue());
+        assertEquals(Uint32.valueOf(168496142L), ((SidCase) ls.getPeerSetSids().get(0).getSidLabelIndex()).getSid());
+        assertEquals(Uint8.valueOf(5), ls.getPeerSetSids().get(0).getWeight().getValue());
+        assertEquals(Uint32.valueOf(168496143L), ((SidCase) ls.getPeerAdjSid().getSidLabelIndex()).getSid());
+        assertEquals(Uint8.valueOf(5), ls.getPeerAdjSid().getWeight().getValue());
 
         // Performance Metrics
-        assertEquals(new Long(10000L), ls.getLinkDelay().getValue());
-        assertEquals(new Long(5000L), ls.getLinkMinMaxDelay().getMinDelay().getValue());
-        assertEquals(new Long(20000L), ls.getLinkMinMaxDelay().getMaxDelay().getValue());
-        assertEquals(new Long(10000L), ls.getDelayVariation().getValue());
-        assertEquals(new Long(0L), ls.getLinkLoss().getValue());
+        assertEquals(Uint32.valueOf(10000L), ls.getLinkDelay().getValue());
+        assertEquals(Uint32.valueOf(5000L), ls.getLinkMinMaxDelay().getMinDelay().getValue());
+        assertEquals(Uint32.valueOf(20000L), ls.getLinkMinMaxDelay().getMaxDelay().getValue());
+        assertEquals(Uint32.valueOf(10000L), ls.getDelayVariation().getValue());
+        assertEquals(Uint32.valueOf(0L), ls.getLinkLoss().getValue());
         assertArrayEquals(new byte[] { (byte) 0x46, (byte) 0x43, (byte) 0x50, (byte) 0x00 },
                 ls.getResidualBandwidth().getValue());
         assertArrayEquals(new byte[] { (byte) 0x46, (byte) 0x43, (byte) 0x50, (byte) 0x00 },
@@ -362,8 +364,8 @@ public class LinkstateAttributeParserTest {
             teLspAttributes.getTspecObject().getTokenBucketSize());
         assertEquals(new Float32(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03}),
             tSpec.getPeakDataRate());
-        assertEquals(new Long("4"), tSpec.getMinimumPolicedUnit());
-        assertEquals(new Long("5"), tSpec.getMaximumPacketSize());
+        assertEquals(Uint32.valueOf(4), tSpec.getMinimumPolicedUnit());
+        assertEquals(Uint32.valueOf(5), tSpec.getMaximumPacketSize());
 
         final AssociationObject associationObject = teLspAttributes.getAssociationObject();
         assertEquals(AssociationType.Recovery, associationObject.getAssociationType());
index 90141b635056fd2ef6db3a7676cea17f3cd2434a..5214a09bfbcbeca38d2c43c007bedac03e541cab 100644 (file)
@@ -16,7 +16,6 @@ import static org.opendaylight.protocol.bgp.linkstate.impl.tlvs.ReachTlvParser.I
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.math.BigInteger;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
@@ -77,6 +76,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
@@ -180,7 +182,7 @@ public class LinkstateNlriParserTest {
         // test BA form
         assertNull(this.dest.getRouteDistinguisher());
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
-        assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+        assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
         final NodeCase nCase = (NodeCase) this.dest.getObjectType();
 
         final NodeDescriptors nodeD = nCase.getNodeDescriptors();
@@ -206,9 +208,9 @@ public class LinkstateNlriParserTest {
         protocolId.withValue("isis-level2");
         linkstateBI.addChild(protocolId.build());
 
-        final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
         identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
-        identifier.withValue(BigInteger.ONE);
+        identifier.withValue(Uint64.ONE);
         linkstateBI.addChild(identifier.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
@@ -217,19 +219,19 @@ public class LinkstateNlriParserTest {
         final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> nodeDescriptors = Builders.containerBuilder();
         nodeDescriptors.withNodeIdentifier(LinkstateNlriParser.NODE_DESCRIPTORS_NID);
 
-        final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
         asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
-        asNumber.withValue(72L);
+        asNumber.withValue(Uint32.valueOf(72));
         nodeDescriptors.addChild(asNumber.build());
 
-        final ImmutableLeafNodeBuilder<Long> areaID = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> areaID = new ImmutableLeafNodeBuilder<>();
         areaID.withNodeIdentifier(NodeNlriParser.AREA_NID);
-        areaID.withValue(2697513L);
+        areaID.withValue(Uint32.valueOf(2697513L));
         nodeDescriptors.addChild(areaID.build());
 
-        final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
         domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
-        domainID.withValue(0x28282828L);
+        domainID.withValue(Uint32.valueOf(0x28282828L));
         nodeDescriptors.addChild(domainID.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
@@ -248,7 +250,7 @@ public class LinkstateNlriParserTest {
         isisPseudoRouter.addChild(isoSystemID.build());
 
         isisNode.addChild(isisPseudoRouter.build());
-        isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue((short) 5)
+        isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue(Uint8.valueOf(5))
             .build());
         crouterId.addChild(isisNode.build());
 
@@ -266,7 +268,7 @@ public class LinkstateNlriParserTest {
         // test BA form
         assertNull(this.dest.getRouteDistinguisher());
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
-        assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+        assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
 
         final LinkCase lCase = (LinkCase) this.dest.getObjectType();
 
@@ -308,9 +310,9 @@ public class LinkstateNlriParserTest {
         protocolId.withValue("isis-level2");
         linkstateBI.addChild(protocolId.build());
 
-        final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
         identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
-        identifier.withValue(BigInteger.ONE);
+        identifier.withValue(Uint64.ONE);
         linkstateBI.addChild(identifier.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
@@ -321,14 +323,14 @@ public class LinkstateNlriParserTest {
                 Builders.containerBuilder();
         localNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.LOCAL_NODE_DESCRIPTORS_NID);
 
-        final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
         asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
-        asNumber.withValue(72L);
+        asNumber.withValue(Uint32.valueOf(72));
         localNodeDescriptors.addChild(asNumber.build());
 
-        final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
         domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
-        domainID.withValue(0x28282828L);
+        domainID.withValue(Uint32.valueOf(0x28282828L));
         localNodeDescriptors.addChild(domainID.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
@@ -349,9 +351,9 @@ public class LinkstateNlriParserTest {
         bgpRouterId.withNodeIdentifier(NodeNlriParser.BGP_ROUTER_NID);
         bgpRouterId.withValue("1.1.1.1");
 
-        final ImmutableLeafNodeBuilder<Long> memberAsn = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> memberAsn = new ImmutableLeafNodeBuilder<>();
         memberAsn.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
-        memberAsn.withValue(258L);
+        memberAsn.withValue(Uint32.valueOf(258L));
 
         localNodeDescriptors.addChild(bgpRouterId.build());
         localNodeDescriptors.addChild(memberAsn.build());
@@ -369,9 +371,9 @@ public class LinkstateNlriParserTest {
         final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> ospfNode = Builders.containerBuilder();
         ospfNode.withNodeIdentifier(NodeNlriParser.OSPF_NODE_NID);
 
-        final ImmutableLeafNodeBuilder<Long> ospfRouterId = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> ospfRouterId = new ImmutableLeafNodeBuilder<>();
         ospfRouterId.withNodeIdentifier(NodeNlriParser.OSPF_ROUTER_NID);
-        ospfRouterId.withValue(0x00000040L);
+        ospfRouterId.withValue(Uint32.valueOf(0x00000040L));
         ospfNode.addChild(ospfRouterId.build());
         crouterId2.addChild(ospfNode.build());
         remoteNodeDescriptors.addChild(crouterId2.build());
@@ -380,22 +382,22 @@ public class LinkstateNlriParserTest {
         bgpRouterIdRemote.withValue("1.1.1.2");
         remoteNodeDescriptors.addChild(bgpRouterIdRemote.build());
 
-        final ImmutableLeafNodeBuilder<Long> memberAsnRemote = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> memberAsnRemote = new ImmutableLeafNodeBuilder<>();
         memberAsnRemote.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
-        memberAsnRemote.withValue(259L);
+        memberAsnRemote.withValue(Uint32.valueOf(259));
         remoteNodeDescriptors.addChild(memberAsnRemote.build());
 
         // link descritpors
         final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> linkDescriptors = Builders.containerBuilder();
         linkDescriptors.withNodeIdentifier(LinkstateNlriParser.LINK_DESCRIPTORS_NID);
 
-        final ImmutableLeafNodeBuilder<Long> linkLocalIdentifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> linkLocalIdentifier = new ImmutableLeafNodeBuilder<>();
         linkLocalIdentifier.withNodeIdentifier(LinkNlriParser.LINK_LOCAL_NID);
-        linkLocalIdentifier.withValue(16909060L);
+        linkLocalIdentifier.withValue(Uint32.valueOf(16909060L));
 
-        final ImmutableLeafNodeBuilder<Long> linkRemoteIdentifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> linkRemoteIdentifier = new ImmutableLeafNodeBuilder<>();
         linkRemoteIdentifier.withNodeIdentifier(LinkNlriParser.LINK_REMOTE_NID);
-        linkRemoteIdentifier.withValue(168496141L);
+        linkRemoteIdentifier.withValue(Uint32.valueOf(168496141L));
 
         final ImmutableLeafNodeBuilder<String> ipv4InterfaceAddress = new ImmutableLeafNodeBuilder<>();
         ipv4InterfaceAddress.withNodeIdentifier(LinkNlriParser.IPV4_IFACE_NID);
@@ -430,7 +432,7 @@ public class LinkstateNlriParserTest {
         // test BA form
         assertNull(this.dest.getRouteDistinguisher());
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
-        assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+        assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
 
         final PrefixCase pCase = (PrefixCase) this.dest.getObjectType();
 
@@ -461,9 +463,9 @@ public class LinkstateNlriParserTest {
         protocolId.withValue("isis-level2");
         linkstateBI.addChild(protocolId.build());
 
-        final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
         identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
-        identifier.withValue(BigInteger.ONE);
+        identifier.withValue(Uint64.ONE);
         linkstateBI.addChild(identifier.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
@@ -474,14 +476,14 @@ public class LinkstateNlriParserTest {
                 Builders.containerBuilder();
         advertisingNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.ADVERTISING_NODE_DESCRIPTORS_NID);
 
-        final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
         asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
-        asNumber.withValue(72L);
+        asNumber.withValue(Uint32.valueOf(72));
         advertisingNodeDescriptors.addChild(asNumber.build());
 
-        final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
         domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
-        domainID.withValue(673720360L);
+        domainID.withValue(Uint32.valueOf(673720360L));
         advertisingNodeDescriptors.addChild(domainID.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
@@ -536,7 +538,7 @@ public class LinkstateNlriParserTest {
         // test BA form
         assertNull(this.dest.getRouteDistinguisher());
         assertEquals(ProtocolId.RsvpTe, this.dest.getProtocolId());
-        assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+        assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
         final TeLspCase teCase = (TeLspCase) this.dest.getObjectType();
 
         assertEquals(new LspId(1L), teCase.getLspId());
@@ -554,9 +556,9 @@ public class LinkstateNlriParserTest {
         protocolId.withValue("rsvp-te");
         linkstateBI.addChild(protocolId.build());
 
-        final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+        final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
         identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
-        identifier.withValue(BigInteger.ONE);
+        identifier.withValue(Uint64.ONE);
         linkstateBI.addChild(identifier.build());
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
index 808482b2496ceb559af23cdb41f43b4a3969c488..a023975851a5d9ad1f42c4256dc3fcf46b0880d3 100644 (file)
@@ -21,6 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.Opaque;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,8 +38,8 @@ public final class OpaqueUtil {
     }
 
     public static boolean serializeOpaque(final Opaque opaque, final ByteBuf byteBuf) {
-        final Short type = opaque.getOpaqueType();
-        switch (type) {
+        final Uint8 type = opaque.getOpaqueType();
+        switch (type.toJava()) {
             case GENERIC_LSP_IDENTIFIER:
                 ByteBufWriteUtil.writeUnsignedByte(type, byteBuf);
                 writeGeneric(opaque.getOpaque(), byteBuf);
@@ -53,16 +55,16 @@ public final class OpaqueUtil {
         return true;
     }
 
-    private static void writeExtended(final HexString opaque, final Integer opaqueExtendedType, final ByteBuf byteBuf) {
+    private static void writeExtended(final HexString opaque, final Uint16 opaqueExtendedType, final ByteBuf byteBuf) {
         final byte[] output = writeOpaqueValue(opaque.getValue());
         ByteBufWriteUtil.writeUnsignedShort(opaqueExtendedType, byteBuf);
-        ByteBufWriteUtil.writeUnsignedShort(output.length, byteBuf);
+        byteBuf.writeShort(output.length);
         byteBuf.writeBytes(output);
     }
 
     private static void writeGeneric(final HexString opaque, final ByteBuf byteBuf) {
         final byte[] output = writeOpaqueValue(opaque.getValue());
-        ByteBufWriteUtil.writeUnsignedShort(output.length, byteBuf);
+        byteBuf.writeShort(output.length);
         byteBuf.writeBytes(output);
     }
 
index 9db67eff16cb4abfa07be331acdaaf47292d8a49..ac9a8f0260c4c556af3e60fd0fbd3ee2da2a851a 100644 (file)
@@ -40,7 +40,7 @@ public final class PMSITunnelAttributeHandler implements AttributeParser, Attrib
 
     private static void parseMpls(final PmsiTunnelBuilder pmsiTunnelBuilder, final ByteBuf buffer) {
         final MplsLabel mpls = MplsLabelUtil.mplsLabelForByteBuf(buffer);
-        if (mpls.getValue() != 0) {
+        if (mpls.getValue().toJava() != 0) {
             pmsiTunnelBuilder.setMplsLabel(mpls);
         }
     }
index 7cb2afdf8e8d502f48b0050b49563e9264bd90ba..749ee44523b2132d977e5d64248862b994576826 100644 (file)
@@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.yang.binding.BindingObject;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -141,7 +142,7 @@ public final class RouteTargetConstrainRIBSupport
                 .setRouteTargetConstrainChoice(extractRouteTargetChoice(rtDest));
         final Optional<Object> originAs = NormalizedNodes
                 .findNode(rtDest, this.originAsNid).map(NormalizedNode::getValue);
-        originAs.ifPresent(o -> builder.setOriginAs(new AsNumber((Long) o)));
+        originAs.ifPresent(o -> builder.setOriginAs(new AsNumber((Uint32) o)));
         return builder.build();
     }
 
index 265de3ca049657b7b662c26f15c6c40db193aa6d..869ee9a758ca7ddec3106f08d9586856ad34228a 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev1510
 
 import java.util.regex.Pattern;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.BgpSetMedType.Enumeration;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,8 +30,8 @@ public final class BgpSetMedTypeBuilder {
         }
 
         try {
-            return new BgpSetMedType(Integer.toUnsignedLong(Integer.parseUnsignedInt(defaultValue)));
-        } catch (final NumberFormatException e) {
+            return new BgpSetMedType(Uint32.valueOf(defaultValue));
+        } catch (final IllegalArgumentException e) {
             LOG.debug("Could not interpret \"{}\" as an unsinged integer", defaultValue, e);
         }
 
index 6dde0be93f5fe4c61df1ea36ed2d0e1eda4c5857..368efa40db65f68b5c23bd90c493307c4fb10bda 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009;
 
+import org.opendaylight.yangtools.yang.common.Uint32;
+
 /**
  * Customized handler for instantiating {@link BgpStdCommunityType} from a String.
  */
@@ -22,8 +24,8 @@ public final class BgpStdCommunityTypeBuilder {
         }
 
         try {
-            return new BgpStdCommunityType(Integer.toUnsignedLong(Integer.parseUnsignedInt(defaultValue)));
-        } catch (final NumberFormatException e) {
+            return new BgpStdCommunityType(Uint32.valueOf(defaultValue));
+        } catch (final IllegalArgumentException e) {
             throw new IllegalArgumentException("Cannot create BgpStdCommunityType from " + defaultValue, e);
         }
     }
index 5002fb5042baf3f7c34c319688d7198c0a09265e..af4f458583d97dd176dff9f86338d5f3268304dc 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009;
 
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Customized handler for instantiating {@link RrClusterIdType} from a String.
@@ -24,8 +25,8 @@ public final class RrClusterIdTypeBuilder {
         }
 
         try {
-            return new RrClusterIdType(Integer.toUnsignedLong(Integer.parseUnsignedInt(defaultValue)));
-        } catch (final NumberFormatException e) {
+            return new RrClusterIdType(Uint32.valueOf(defaultValue));
+        } catch (final IllegalArgumentException e) {
             throw new IllegalArgumentException("Cannot create RrClusterIdType from " + defaultValue, e);
         }
     }
index 2550f8303f2e53bbfe23fe735355c1a9cb9a4da8..cb09f085f01ffe70ae85b98576d5fdbfeaf29306 100644 (file)
@@ -5,11 +5,10 @@
  * 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.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009;
 
-import com.google.common.primitives.UnsignedInts;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation.
@@ -24,9 +23,8 @@ public class TagTypeBuilder {
 
     public static TagType getDefaultInstance(final java.lang.String defaultValue) {
         try {
-            final long parseUnsignedInt = UnsignedInts.parseUnsignedInt(defaultValue);
-            return new TagType(parseUnsignedInt);
-        } catch (final NumberFormatException e) {
+            return new TagType(Uint32.valueOf(defaultValue));
+        } catch (final IllegalArgumentException e) {
             return new TagType(new HexString(defaultValue));
         }
     }
index 6409a1def2791913ac3e5a62536d206bfe0d835b..3e932f02f55554b93483796c12d65333cdaca987 100644 (file)
@@ -5,43 +5,44 @@
  * 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.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009;
 
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.BgpSetMedType.Enumeration;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class BgpSetMedTypeBuilderTest {
 
     @Test
     public void testString() {
         final BgpSetMedType medType = BgpSetMedTypeBuilder.getDefaultInstance("+1");
-        Assert.assertEquals("+1", medType.getString());
+        assertEquals("+1", medType.getString());
     }
 
     @Test
     public void testUint32() {
         final BgpSetMedType medType = BgpSetMedTypeBuilder.getDefaultInstance("1");
-        Assert.assertEquals(Long.valueOf(1L), medType.getUint32());
+        assertEquals(Uint32.ONE, medType.getUint32());
     }
 
     @Test
     public void testEnumLowerCase() {
         final BgpSetMedType medType = BgpSetMedTypeBuilder.getDefaultInstance("igp");
-        Assert.assertEquals(Enumeration.IGP, medType.getEnumeration());
+        assertEquals(Enumeration.IGP, medType.getEnumeration());
     }
 
     @Test
     public void testEnumFirstUpperCase() {
         final BgpSetMedType medType = BgpSetMedTypeBuilder.getDefaultInstance("Igp");
-        Assert.assertEquals(Enumeration.IGP, medType.getEnumeration());
+        assertEquals(Enumeration.IGP, medType.getEnumeration());
     }
 
     @Test
     public void testEnumUpperCase() {
         final BgpSetMedType medType = BgpSetMedTypeBuilder.getDefaultInstance("IGP");
-        Assert.assertEquals(Enumeration.IGP, medType.getEnumeration());
+        assertEquals(Enumeration.IGP, medType.getEnumeration());
     }
 
     @Test(expected=IllegalArgumentException.class)
index 5412e9a4f2d6ccd1ce627bf1e46c620ae9c74dc0..bc2098fdce2dc84af12dd4266cb114d160eaced1 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
index 3e4265006b0985e9802c38c26f289cba84d69dcd..bb2fb9a8a9bc2cea8959105f46d3ae45bf79eaf0 100644 (file)
@@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.concepts.AbstractRegistration;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 final class ActionsRegistryImpl {
     @GuardedBy("this")
@@ -126,7 +127,7 @@ final class ActionsRegistryImpl {
             final BgpActions bgpAction = augmentation.getBgpActions();
 
             final SetAsPathPrepend asPrependAction = bgpAction.getSetAsPathPrepend();
-            final Long localPrefPrependAction = bgpAction.getSetLocalPref();
+            final Uint32 localPrefPrependAction = bgpAction.getSetLocalPref();
             final BgpOriginAttrType localOriginAction = bgpAction.getSetRouteOrigin();
             final BgpSetMedType medAction = bgpAction.getSetMed();
             final BgpNextHopType nhAction = bgpAction.getSetNextHop();
index a61227196a6c8b3b4c3920604b1a4ae159301173..ba17382bbef0a6dd68e9bc36822fe72a5413d971 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.EmptyNextHopCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv4NextHopCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv6NextHopCase;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Bgp Attribute Conditions Util per check conditions matches.
@@ -58,7 +59,7 @@ final class BgpAttributeConditionsUtil {
         return afiSafiIn == null ? true : afiSafiIn.contains(afiSafi);
     }
 
-    private static boolean matchMED(final MultiExitDisc multiExitDisc, final Long med) {
+    private static boolean matchMED(final MultiExitDisc multiExitDisc, final Uint32 med) {
         return multiExitDisc == null || med == null || med.equals(multiExitDisc.getMed());
     }
 
@@ -81,7 +82,7 @@ final class BgpAttributeConditionsUtil {
         }
 
         final Class<? extends AttributeComparison> comp = asPathLength.getOperator();
-        final long asLength = asPathLength.getValue();
+        final long asLength = asPathLength.getValue().toJava();
         if (comp == AttributeEq.class) {
             return total == asLength;
         } else if (comp == AttributeGe.class) {
@@ -106,7 +107,7 @@ final class BgpAttributeConditionsUtil {
         return nextHopIn.contains(global);
     }
 
-    private static boolean matchLocalPref(final LocalPref localPref, final Long localPrefEq) {
+    private static boolean matchLocalPref(final LocalPref localPref, final Uint32 localPrefEq) {
         return localPref == null || localPrefEq == null || localPrefEq.equals(localPref.getPref());
     }
 }
index 7aeb71dba184477dd84402a496fcda51b08c6a43..0de8bddca3d7840b9fc87b3429198fae9b2b355d 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
 import java.io.Serializable;
 import java.util.Arrays;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Possible errors from implemented RFCs and drafts. Each error consists of error code and error subcode
@@ -165,8 +166,8 @@ public enum BGPError {
         this.errorId = new BGPErrorIdentifier(code, subcode);
     }
 
-    public static BGPError forValue(final int code, final int subcode) {
-        final BGPError e = VALUE_MAP.get(new BGPErrorIdentifier((short) code, (short) subcode));
+    public static BGPError forValue(final Uint8 code, final Uint8 subcode) {
+        final BGPError e = VALUE_MAP.get(new BGPErrorIdentifier(code.toJava(), subcode.toJava()));
         checkArgument(e != null, "BGP Error code %s and subcode %s not recognized.", code, subcode);
         return e;
     }
index 9728677b798c7fee253454c325814b1ef5862096..151277e6a36c2215f7ee3b8f905212c3e6a9cd9d 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.MultiprotocolCapabilityBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class APITest {
 
@@ -51,7 +52,7 @@ public class APITest {
 
     @Test
     public void testBGPError() {
-        assertEquals(BGPError.BAD_MSG_TYPE, BGPError.forValue(1, 3));
+        assertEquals(BGPError.BAD_MSG_TYPE, BGPError.forValue(Uint8.ONE, Uint8.valueOf(3)));
     }
 
     @Test
index 6a23b3201ce0235d40fd355b3c15d3ea54d7799a..87b97953066d65447ecd734dbe146de64c2af8f7 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>mockito-configuration</artifactId>
index 6f792b26b62bb6b46c24c0d449d8b7c38f2fc2c1..800668565cca03ec32ce92bebcb10b6843fa35cf 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.Notify;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.NotifyBuilder;
 import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -49,8 +50,8 @@ public final class BGPNotificationMessageParser implements MessageParser, Messag
         final Notify ntf = (Notify) msg;
 
         final ByteBuf msgBody = Unpooled.buffer()
-                .writeByte(ntf.getErrorCode())
-                .writeByte(ntf.getErrorSubcode());
+                .writeByte(ntf.getErrorCode().toJava())
+                .writeByte(ntf.getErrorSubcode().toJava());
         final byte[] data = ntf.getData();
         if (data != null) {
             msgBody.writeBytes(data);
@@ -76,10 +77,10 @@ public final class BGPNotificationMessageParser implements MessageParser, Messag
         if (body.readableBytes() < ERROR_SIZE) {
             throw BGPDocumentedException.badMessageLength("Notification message too small.", messageLength);
         }
-        final int errorCode = body.readUnsignedByte();
-        final int errorSubcode = body.readUnsignedByte();
+        final Uint8 errorCode = Uint8.valueOf(body.readUnsignedByte());
+        final Uint8 errorSubcode = Uint8.valueOf(body.readUnsignedByte());
         final NotifyBuilder builder = new NotifyBuilder()
-                .setErrorCode((short) errorCode).setErrorSubcode((short) errorSubcode);
+                .setErrorCode(errorCode).setErrorSubcode(errorSubcode);
         if (body.isReadable()) {
             builder.setData(ByteArray.readAllBytes(body));
         }
index 06a28a2c4ed98e5c58cbc407796034b8bf5ddc92..74400fd62e32faf31ef526091f7716de555d0d47 100644 (file)
@@ -88,13 +88,13 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
                 .writeByte(BGP_VERSION);
 
         // When our AS number does not fit into two bytes, we report it as AS_TRANS
-        int openAS = open.getMyAsNumber();
+        int openAS = open.getMyAsNumber().toJava();
         if (openAS > Values.UNSIGNED_SHORT_MAX_VALUE) {
             openAS = AS_TRANS;
         }
         msgBody
             .writeShort(openAS)
-            .writeShort(open.getHoldTimer())
+            .writeShort(open.getHoldTimer().toJava())
             .writeBytes(Ipv4Util.bytesForAddress(open.getBgpIdentifier()));
 
         serializeParameters(open.getBgpParameters(), msgBody);
index 55a8e1c9e3fcdc8ce3056358b17b6e40782ebe3d..85dd22c193e63321e5ffb713f6a3938449bcdd44 100644 (file)
@@ -34,6 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.TablesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -94,13 +95,12 @@ public final class GracefulCapabilityHandler implements CapabilityParser, Capabi
         final List<Tables> tables = grace.getTables();
         final int tablesSize = tables != null ? tables.size() : 0;
         final ByteBuf bytes = Unpooled.buffer(HEADER_SIZE + PER_AFI_SAFI_SIZE * tablesSize);
-        int timeval = 0;
-        Integer time = grace.getRestartTime();
+        Uint16 time = grace.getRestartTime();
         if (time == null) {
-            time = 0;
+            time = Uint16.ZERO;
         }
-        Preconditions.checkArgument(time >= 0 && time <= MAX_RESTART_TIME, "Restart time is " + time);
-        timeval = time;
+        final int timeval = time.toJava();
+        Preconditions.checkArgument(timeval >= 0 && timeval <= MAX_RESTART_TIME, "Restart time is " + time);
         final GracefulRestartCapability.RestartFlags flags = grace.getRestartFlags();
         if (flags != null && flags.isRestartState()) {
             writeUnsignedShort(RESTART_FLAG_STATE | timeval, bytes);
index d86aa26ce9bd302993c998e68f5ed6b8fe34e78f..5dfa4425ac7c6e5f41670a09a36ddf0c64b6c26f 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -129,7 +130,7 @@ public final class LlGracefulCapabilityHandler implements CapabilityParser, Capa
             } else {
                 buffer.writeZero(1);
             }
-            final Long staleTime = table.getLongLivedStaleTime();
+            final Uint32 staleTime = table.getLongLivedStaleTime();
             final int timeval = staleTime != null ? staleTime.intValue() : 0;
             checkArgument(timeval >= 0 && timeval <= MAX_STALE_TIME, "Restart time is %s", staleTime);
             buffer.writeMedium(timeval);
index e9156a0ce866e5a93a48913e3efc696483bb5e54..cc1fd27d4226abc332ab616cf369ae51158b884b 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.LocalPref;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.LocalPrefBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,7 +52,7 @@ public final class LocalPreferenceAttributeParser extends AbstractAttributeParse
     public void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator) {
         final LocalPref lp = attribute.getLocalPref();
         if (lp != null) {
-            final Long pref = lp.getPref();
+            final Uint32 pref = lp.getPref();
             if (pref != null) {
                 AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.copyInt(pref.intValue()),
                     byteAggregator);
index 38a66dedc5d001ab4d05093e9317618091c90c93..79412f27d5bf671aa4717514c209ca36194539e2 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDisc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.MultiExitDiscBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class MultiExitDiscriminatorAttributeParser extends AbstractAttributeParser
         implements AttributeSerializer {
@@ -42,7 +43,7 @@ public final class MultiExitDiscriminatorAttributeParser extends AbstractAttribu
     public void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator) {
         final MultiExitDisc multiExitDisc = attribute.getMultiExitDisc();
         if (multiExitDisc != null) {
-            final Long med = multiExitDisc.getMed();
+            final Uint32 med = multiExitDisc.getMed();
             if (med != null) {
                 AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, Unpooled.copyInt(med.intValue()),
                     byteAggregator);
index 859148a2f944d806b7b2ad6e8c80b6d743175e0d..98644ab38e96a3d3984272bbaf405af0bbad53e6 100755 (executable)
@@ -36,7 +36,7 @@ public class UnrecognizedAttributesSerializer implements AttributeSerializer {
             if (unrecognizedAttr.isTransitive()) {
                 flags |= AttributeUtil.TRANSITIVE;
             }
-            AttributeUtil.formatAttribute(flags, unrecognizedAttr.getType(),
+            AttributeUtil.formatAttribute(flags, unrecognizedAttr.getType().toJava(),
                     Unpooled.wrappedBuffer(unrecognizedAttr.getValue()), byteAggregator);
         }
     }
index 432346df6524d61083f4e4134ee3945e4a5b08fc..9f3d5c25f43ffd7e5450d1c07b9b315b385c7d57 100644 (file)
@@ -5,23 +5,21 @@
  * 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.bgp.parser.impl.message.update.extended.communities;
 
 import com.google.common.base.Preconditions;
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractTwoOctetAsExtendedCommunity;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ShortAsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.AsSpecificExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.AsSpecificExtendedCommunityCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.as.specific.extended.community._case.AsSpecificExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.as.specific.extended.community._case.AsSpecificExtendedCommunityBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class AsTwoOctetSpecificEcHandler extends AbstractTwoOctetAsExtendedCommunity {
 
@@ -31,7 +29,7 @@ public class AsTwoOctetSpecificEcHandler extends AbstractTwoOctetAsExtendedCommu
     public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
             throws BGPDocumentedException, BGPParsingException {
         final AsSpecificExtendedCommunity asSpecific = new AsSpecificExtendedCommunityBuilder()
-            .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()))
+            .setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(buffer.readUnsignedShort())))
             .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH))
             .build();
         return new AsSpecificExtendedCommunityCaseBuilder().setAsSpecificExtendedCommunity(asSpecific).build();
@@ -44,8 +42,7 @@ public class AsTwoOctetSpecificEcHandler extends AbstractTwoOctetAsExtendedCommu
                 extendedCommunity);
         final AsSpecificExtendedCommunity asSpecific = ((AsSpecificExtendedCommunityCase) extendedCommunity)
                 .getAsSpecificExtendedCommunity();
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(asSpecific.getGlobalAdministrator().getValue()),
-                byteAggregator);
+        byteAggregator.writeShort(asSpecific.getGlobalAdministrator().getValue().intValue());
         byteAggregator.writeBytes(asSpecific.getLocalAdministrator());
     }
 
index 2318d6d61d911335877a4fe93e7a40b7acf99aa4..0b8de2f2af0bb88e017fa0560356ad6614710aa4 100644 (file)
@@ -5,23 +5,21 @@
  * 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.bgp.parser.impl.message.update.extended.communities;
 
 import com.google.common.base.Preconditions;
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractTwoOctetAsExtendedCommunity;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ShortAsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.RouteOriginExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.RouteOriginExtendedCommunityCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.route.origin.extended.community._case.RouteOriginExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.route.origin.extended.community._case.RouteOriginExtendedCommunityBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class RouteOriginAsTwoOctetEcHandler extends AbstractTwoOctetAsExtendedCommunity {
 
@@ -31,7 +29,7 @@ public final class RouteOriginAsTwoOctetEcHandler extends AbstractTwoOctetAsExte
     public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
             throws BGPDocumentedException, BGPParsingException {
         final RouteOriginExtendedCommunity targetOrigin = new RouteOriginExtendedCommunityBuilder()
-            .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()))
+            .setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(buffer.readUnsignedShort())))
             .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH))
             .build();
         return new RouteOriginExtendedCommunityCaseBuilder().setRouteOriginExtendedCommunity(targetOrigin).build();
@@ -44,8 +42,7 @@ public final class RouteOriginAsTwoOctetEcHandler extends AbstractTwoOctetAsExte
                 extendedCommunity);
         final RouteOriginExtendedCommunity routeOrigin
                 = ((RouteOriginExtendedCommunityCase) extendedCommunity).getRouteOriginExtendedCommunity();
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(routeOrigin.getGlobalAdministrator().getValue()),
-                byteAggregator);
+        byteAggregator.writeShort(routeOrigin.getGlobalAdministrator().getValue().intValue());
         byteAggregator.writeBytes(routeOrigin.getLocalAdministrator());
     }
 
index a88298cbcaaa78f50818008443dc9ae348e9b344..7c03d978cc2c6f41ae8b752ea8dc80c31dbf5c4d 100644 (file)
@@ -9,16 +9,15 @@
 package org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities;
 
 import com.google.common.base.Preconditions;
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractTwoOctetAsExtendedCommunity;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ShortAsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.SourceAsExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.SourceAsExtendedCommunityCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.source.as.extended.community._case.SourceAsExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.source.as.extended.community._case.SourceAsExtendedCommunityBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class SourceASHandler extends AbstractTwoOctetAsExtendedCommunity {
     private static final short SUBTYPE = 9;
@@ -27,7 +26,7 @@ public final class SourceASHandler extends AbstractTwoOctetAsExtendedCommunity {
     @Override
     public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
         final SourceAsExtendedCommunityBuilder builder = new SourceAsExtendedCommunityBuilder();
-        builder.setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()));
+        builder.setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(buffer.readUnsignedShort())));
         buffer.skipBytes(AS_LOCAL_ADMIN_LENGTH);
         return new SourceAsExtendedCommunityCaseBuilder().setSourceAsExtendedCommunity(builder.build()).build();
     }
@@ -39,8 +38,8 @@ public final class SourceASHandler extends AbstractTwoOctetAsExtendedCommunity {
                 extendedCommunity);
         final SourceAsExtendedCommunity excomm = ((SourceAsExtendedCommunityCase) extendedCommunity)
                 .getSourceAsExtendedCommunity();
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(excomm.getGlobalAdministrator().getValue()), body);
-        ByteBufWriteUtil.writeInt(LOCAL_ADMIN, body);
+        body.writeShort(excomm.getGlobalAdministrator().getValue().intValue());
+        body.writeInt(LOCAL_ADMIN);
     }
 
     @Override
index a1b80e074c680c1ad4ff79d0df75da336a4df4d4..2cbad773c28cd5ecce8c11eec4e216dbf39fce04 100644 (file)
@@ -5,18 +5,16 @@
  * 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.bgp.parser.impl.message.update.extended.communities.route.target;
 
 import static org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractTwoOctetAsExtendedCommunity.AS_LOCAL_ADMIN_LENGTH;
 
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ShortAsNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.route.target.extended.community.grouping.RouteTargetExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.route.target.extended.community.grouping.RouteTargetExtendedCommunityBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * Route Target Extended Community Parser / Serializer.
@@ -30,14 +28,13 @@ public final class RouteTargetExtendedCommunityHandler {
 
     public static RouteTargetExtendedCommunity parse(final ByteBuf buffer) {
         return new RouteTargetExtendedCommunityBuilder()
-                .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()))
+                .setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(buffer.readUnsignedShort())))
                 .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH))
                 .build();
     }
 
     public static void serialize(final RouteTargetExtendedCommunity routeTarget, final ByteBuf byteAggregator) {
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(routeTarget.getGlobalAdministrator().getValue()),
-                byteAggregator);
+        byteAggregator.writeShort(routeTarget.getGlobalAdministrator().getValue().intValue());
         byteAggregator.writeBytes(routeTarget.getLocalAdministrator());
     }
 }
index b42a96ff0cccc25254404cf5dba362b21c910554..84007879154ddd85fec91795820f953cf4bdf253 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 public class GracefulCapabilityHandlerTest {
 
@@ -87,7 +88,7 @@ public class GracefulCapabilityHandlerTest {
 
         capaBuilder.setRestartFlags(null);
         tablesBuilder.setAfiFlags(null);
-        capaBuilder.setRestartTime(null);
+        capaBuilder.setRestartTime((Uint16) null);
         capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
         buffer.clear();
         handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class,
index 279efbc0d983f50dcf634577e35d59a3bd0641c0..3aa19010644c4e053eb7bc4a0e6212c8ed4a0a75 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yangtools.util.ImmutableOffsetMapTemplate;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -24,7 +25,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 
 public final class PathIdUtil {
-    public static final long NON_PATH_ID_VALUE = 0;
+    public static final Uint32 NON_PATH_ID_VALUE = Uint32.ZERO;
     public static final PathId NON_PATH_ID = new PathId(NON_PATH_ID_VALUE);
 
     private PathIdUtil() {
@@ -39,8 +40,11 @@ public final class PathIdUtil {
      * @param buffer The ByteBuf where path-id value can be written.
      */
     public static void writePathId(final PathId pathId, final ByteBuf buffer) {
-        if (pathId != null && pathId.getValue() != 0) {
-            ByteBufWriteUtil.writeUnsignedInt(pathId.getValue(), buffer);
+        if (pathId != null) {
+            final Uint32 value = pathId.getValue();
+            if (value.toJava() != 0) {
+                ByteBufWriteUtil.writeUnsignedInt(value, buffer);
+            }
         }
     }
 
@@ -62,8 +66,8 @@ public final class PathIdUtil {
      * @param pathNii Path Id NodeIdentifier specific per each Rib support
      * @return The path identifier from data change
      */
-    public static Long extractPathId(final NormalizedNode<?, ?> data, final NodeIdentifier pathNii) {
-        return (Long) NormalizedNodes.findNode(data, pathNii).map(NormalizedNode::getValue).orElse(null);
+    public static Uint32 extractPathId(final NormalizedNode<?, ?> data, final NodeIdentifier pathNii) {
+        return (Uint32) NormalizedNodes.findNode(data, pathNii).map(NormalizedNode::getValue).orElse(null);
     }
 
     /**
@@ -75,7 +79,7 @@ public final class PathIdUtil {
      */
     public static PathId buildPathId(final DataContainerNode<? extends PathArgument> routesCont,
             final NodeIdentifier pathIdNii) {
-        final Long pathIdVal = PathIdUtil.extractPathId(routesCont, pathIdNii);
+        final Uint32 pathIdVal = PathIdUtil.extractPathId(routesCont, pathIdNii);
         return pathIdVal == null ? null : new PathId(pathIdVal);
     }
 
index c6563ebd68953e2bd7fb4612e53fa50fac0af181..9c9981a26a8bcf6c2c43d4c62c7599928d1a39ba 100644 (file)
@@ -17,6 +17,7 @@ import org.junit.Test;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeSchemaAwareBuilder;
@@ -61,10 +62,9 @@ public class PathIdUtilTest {
     public void testExtractPathId() {
         final NodeIdentifier NII = new NodeIdentifier(QName.create("urn:opendaylight:params:xml:ns:yang:bgp-inet",
             "2015-03-05", "path-id").intern());
-        final long pathIdValue = 0;
         final ContainerNode cont = ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(NII).addChild(
-            new ImmutableLeafNodeBuilder<>().withNodeIdentifier(NII).withValue(pathIdValue).build()).build();
-        Assert.assertEquals(pathIdValue, PathIdUtil.extractPathId(cont, NII).longValue());
+            new ImmutableLeafNodeBuilder<>().withNodeIdentifier(NII).withValue(Uint32.ZERO).build()).build();
+        Assert.assertEquals(0L, PathIdUtil.extractPathId(cont, NII).longValue());
     }
 
 
index 2172091144799adabd4a1cf3448da793723ff080..ba0136cec5820da3a88309ddfd3b444e459053c2 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>yang-binding</artifactId>
index 78b356060f80743c95337450b3646b2f6448a024..32cf17e6e6dc7699ada42a832f2ddee39d735ebd 100644 (file)
@@ -18,7 +18,7 @@ public final class BesthPathStateUtil {
     public static long getPeerAs(final List<Segments> segments) {
         for (final Segments seg : segments) {
             if (seg.getAsSequence() != null && !seg.getAsSequence().isEmpty()) {
-                return segments.get(0).getAsSequence().get(0).getValue();
+                return segments.get(0).getAsSequence().get(0).getValue().toJava();
             }
         }
         return 0;
index 82590dc7797781295e821a774f1d45e00e3d7182..871ef6fe333436697529cbf0107e0141c87c6dac 100644 (file)
@@ -11,9 +11,10 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpOrigin;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public interface BestPathState {
-    @Nullable Long getLocalPref();
+    @Nullable Uint32 getLocalPref();
 
     long getMultiExitDisc();
 
index 96c51c67cc9bb0ecfa186cfdeabdfcd41b0bfebe..109ebdf3fb9930ce2ebf5df2897bbf278af6a98d 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.yangtools.yang.binding.ChoiceIn;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
  * A single route entry inside a route table. Maintains the attributes of
@@ -41,7 +42,7 @@ public interface RouteEntry<C extends Routes & DataObject & ChoiceIn<Tables>, S
      * @param remotePathId remote path Id received
      * @return return true if it was the last route on entry
      */
-    boolean removeRoute(@NonNull RouterId routerId, Long remotePathId);
+    boolean removeRoute(@NonNull RouterId routerId, Uint32 remotePathId);
 
     /**
      * Indicates whether best has changed.
@@ -59,7 +60,7 @@ public interface RouteEntry<C extends Routes & DataObject & ChoiceIn<Tables>, S
      * @param route        route Data change
      * @return returns the offset
      */
-    int addRoute(@NonNull RouterId routerId, Long remotePathId, @NonNull R route);
+    int addRoute(@NonNull RouterId routerId, Uint32 remotePathId, @NonNull R route);
 
     /**
      * Returns collections of present selected best path.
index 8c3199c37b2301faaef9f59db977cf9b6faeccc0..ccdfbc8b80946e0d4dd13f9c128ab88dbc5b1ed7 100644 (file)
@@ -24,12 +24,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.Origin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.as.path.Segments;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpOrigin;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class BestPathStateImpl implements BestPathState {
     private final Attributes attributes;
     private long peerAs = 0L;
     private int asPathLength = 0;
-    private Long localPref;
+    private Uint32 localPref;
     private long multiExitDisc;
     private BgpOrigin origin;
     private boolean depreferenced;
@@ -68,8 +69,8 @@ public final class BestPathStateImpl implements BestPathState {
 
         final MultiExitDisc attrMed = attributes.getMultiExitDisc();
         if (attrMed != null) {
-            final Long med = attrMed.getMed();
-            multiExitDisc = med == null ? 0L : med;
+            final Uint32 med = attrMed.getMed();
+            multiExitDisc = med == null ? 0L : med.toJava();
         } else {
             multiExitDisc = 0L;
         }
@@ -93,7 +94,7 @@ public final class BestPathStateImpl implements BestPathState {
     }
 
     @Override
-    public Long getLocalPref() {
+    public Uint32 getLocalPref() {
         resolveValues();
         return this.localPref;
     }
index cd0555ad777e19b0a3110645e4eb51f31aab28f3..6b0a4f6de6fa21bae77797d311fe0644a6fae23a 100644 (file)
@@ -35,6 +35,7 @@ import org.opendaylight.yangtools.yang.binding.ChoiceIn;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -88,16 +89,16 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
     }
 
     private static final Logger LOG = LoggerFactory.getLogger(AddPathAbstractRouteEntry.class);
-    private static final Long[] EMPTY_PATHS_ID = new Long[0];
+    private static final Uint32[] EMPTY_PATHS_ID = new Uint32[0];
     private static final Route[] EMPTY_VALUES = new Route[0];
 
     private RouteKeyOffsets offsets = RouteKeyOffsets.EMPTY;
     private R[] values = (R[]) EMPTY_VALUES;
-    private Long[] pathsId = EMPTY_PATHS_ID;
+    private Uint32[] pathsId = EMPTY_PATHS_ID;
     private List<AddPathBestPath> bestPath;
     private List<AddPathBestPath> bestPathRemoved;
     private List<AddPathBestPath> newBestPathToBeAdvertised;
-    private List<Long> removedPathsId;
+    private List<Uint32> removedPathsId;
 
     private long pathIdCounter = 0L;
     private boolean isNonAddPathBestPathNew;
@@ -110,18 +111,18 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
     }
 
     @Override
-    public final int addRoute(final RouterId routerId, final Long remotePathId, final R route) {
+    public final int addRoute(final RouterId routerId, final Uint32 remotePathId, final R route) {
         final RouteKey key = new RouteKey(routerId, remotePathId);
         int offset = this.offsets.offsetOf(key);
         if (offset < 0) {
             final RouteKeyOffsets newOffsets = this.offsets.with(key);
             offset = newOffsets.offsetOf(key);
             final R[] newRoute = newOffsets.expand(this.offsets, this.values, offset);
-            final Long[] newPathsId = newOffsets.expand(this.offsets, this.pathsId, offset);
+            final Uint32[] newPathsId = newOffsets.expand(this.offsets, this.pathsId, offset);
             this.values = newRoute;
             this.offsets = newOffsets;
             this.pathsId = newPathsId;
-            this.offsets.setValue(this.pathsId, offset, ++this.pathIdCounter);
+            this.offsets.setValue(this.pathsId, offset, Uint32.valueOf(++this.pathIdCounter));
         }
         this.offsets.setValue(this.values, offset, route);
         LOG.trace("Added route {} from {}", route, routerId);
@@ -129,10 +130,10 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
     }
 
     @Override
-    public final boolean removeRoute(final RouterId routerId, final Long remotePathId) {
+    public final boolean removeRoute(final RouterId routerId, final Uint32 remotePathId) {
         final RouteKey key = new RouteKey(routerId, remotePathId);
         final int offset = this.offsets.offsetOf(key);
-        final Long pathId = this.offsets.getValue(this.pathsId, offset);
+        final Uint32 pathId = this.offsets.getValue(this.pathsId, offset);
         this.values = this.offsets.removeValue(this.values, offset, (R[]) EMPTY_VALUES);
         this.pathsId = this.offsets.removeValue(this.pathsId, offset, EMPTY_PATHS_ID);
         this.offsets = this.offsets.without(key);
@@ -148,7 +149,7 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
             final String routeKey) {
         final List<PathId> stalePaths;
         if (bestPathRemoved != null && !bestPathRemoved.isEmpty()) {
-            stalePaths = bestPathRemoved.stream().map(AddPathBestPath::getPathId)
+            stalePaths = bestPathRemoved.stream().map(AddPathBestPath::getPathIdLong)
                     .map(AddPathAbstractRouteEntry::pathIdObj).collect(Collectors.toList());
             bestPathRemoved = null;
         } else {
@@ -220,7 +221,7 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
     protected final void processOffset(final AddPathSelector selector, final int offset) {
         final RouteKey key = offsets.getKey(offset);
         final R route = offsets.getValue(values, offset);
-        final Long pathId = offsets.getValue(pathsId, offset);
+        final Uint32 pathId = offsets.getValue(pathsId, offset);
         LOG.trace("Processing router key {} route {}", key, route);
         selector.processPath(route.getAttributes(), key, offset, pathId);
     }
@@ -272,7 +273,7 @@ public abstract class AddPathAbstractRouteEntry<C extends Routes & DataObject &
         });
     }
 
-    private static PathId pathIdObj(final Long pathId) {
-        return pathId == NON_PATH_ID_VALUE ? NON_PATH_ID : new PathId(pathId);
+    private static PathId pathIdObj(final Uint32 pathId) {
+        return NON_PATH_ID_VALUE.equals(pathId) ? NON_PATH_ID : new PathId(pathId);
     }
 }
index c2eb9351ba0a612b72e83d3fc0c0101e760ce64c..22cfb7451a52c6ae5393e75a3e7f759d52e16d12 100644 (file)
@@ -14,13 +14,14 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.protocol.bgp.mode.api.BestPathState;
 import org.opendaylight.protocol.bgp.mode.spi.AbstractBestPath;
 import org.opendaylight.protocol.bgp.rib.spi.RouterId;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class AddPathBestPath extends AbstractBestPath {
     private final @NonNull RouteKey routeKey;
-    private final @NonNull Long pathId;
+    private final @NonNull Uint32 pathId;
     private final int offset;
 
-    AddPathBestPath(final @NonNull BestPathState state, final @NonNull RouteKey key, final @NonNull Long pathId,
+    AddPathBestPath(final @NonNull BestPathState state, final @NonNull RouteKey key, final @NonNull Uint32 pathId,
             final int offset) {
         super(state);
         this.routeKey = requireNonNull(key);
@@ -82,7 +83,8 @@ public final class AddPathBestPath extends AbstractBestPath {
 
     @Override
     public long getPathId() {
-        return this.pathId;
+        // FIXME: this should return int bits...
+        return this.pathId.longValue();
     }
 
     /**
@@ -91,7 +93,7 @@ public final class AddPathBestPath extends AbstractBestPath {
      *
      * @return Path Id as a {@link Long}
      */
-    @NonNull Long getPathIdLong() {
+    @NonNull Uint32 getPathIdLong() {
         return this.pathId;
     }
 }
index 29644f74f0858af1529f448b709bafef90dfe190..0e03e460b859d2f600ffafcaf316638cc142070a 100644 (file)
@@ -12,6 +12,7 @@ import org.opendaylight.protocol.bgp.mode.impl.BestPathStateImpl;
 import org.opendaylight.protocol.bgp.mode.spi.AbstractBestPathSelector;
 import org.opendaylight.protocol.bgp.rib.spi.RouterId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -19,14 +20,14 @@ public final class AddPathSelector extends AbstractBestPathSelector {
     private static final Logger LOG = LoggerFactory.getLogger(AddPathSelector.class);
 
     private RouteKey bestRouteKey;
-    private Long bestPathId;
+    private Uint32 bestPathId;
     private int bestOffset;
 
     public AddPathSelector(final long ourAs) {
         super(ourAs);
     }
 
-    void processPath(final Attributes attrs, final RouteKey key, final int offsetPosition, final Long pathId) {
+    void processPath(final Attributes attrs, final RouteKey key, final int offsetPosition, final Uint32 pathId) {
         // Consider only non-null attributes
         if (attrs != null) {
             final RouterId routerId = key.getRouterId();
index 1558da8873aead4bccab71663200d1f9d96bfb62..b22750a5d3559c7e1a3354392a3938bb368a28aa 100644 (file)
@@ -14,15 +14,17 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.protocol.bgp.rib.spi.RouterId;
 import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 @NonNullByDefault
 final class RouteKey implements Comparable<RouteKey>, Immutable {
     private final RouterId routerId;
+    // FIXME: consider dropping this down to an int (but then note Compare() needs to treat it as unsigned)
     private final long remotePathId;
 
-    RouteKey(final RouterId routerId, final Long remotePathId) {
+    RouteKey(final RouterId routerId, final Uint32 remotePathId) {
         this.routerId = requireNonNull(routerId);
-        this.remotePathId = remotePathId.longValue();
+        this.remotePathId = remotePathId.toJava();
     }
 
     RouterId getRouterId() {
index 9837d1c070dd3de17f465cb3e3bc2de8a82280f3..3d4518c735ad16f79ec97687e1694742096fdc9e 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.bgp.mode.impl.base;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID_VALUE;
 
 import com.google.common.base.MoreObjects.ToStringHelper;
 import org.eclipse.jdt.annotation.NonNull;
@@ -31,7 +30,8 @@ final class BaseBestPath extends AbstractBestPath {
 
     @Override
     public long getPathId() {
-        return NON_PATH_ID_VALUE;
+        // PathIdUtil.NON_PATH_ID_VALUE
+        return 0;
     }
 
     @Override
index 0d019eefd11ddaa5b66cb8fc8edc75fdcdf06102..8b984bde1c6261000b2487a65b1b7cb7f175ba51 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.yangtools.yang.binding.ChoiceIn;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -67,7 +68,7 @@ final class BaseRouteEntry<C extends Routes & DataObject & ChoiceIn<Tables>,
     }
 
     @Override
-    public boolean removeRoute(final RouterId routerId, final Long remotePathId) {
+    public boolean removeRoute(final RouterId routerId, final Uint32 remotePathId) {
         final int offset = this.offsets.offsetOf(routerId);
         this.values = this.offsets.removeValue(this.values, offset, (R[]) EMPTY_VALUES);
         this.offsets = this.offsets.without(routerId);
@@ -109,7 +110,7 @@ final class BaseRouteEntry<C extends Routes & DataObject & ChoiceIn<Tables>,
     }
 
     @Override
-    public int addRoute(final RouterId routerId, final Long remotePathId, final R route) {
+    public int addRoute(final RouterId routerId, final Uint32 remotePathId, final R route) {
         int offset = this.offsets.offsetOf(routerId);
         if (offset < 0) {
             final RouterIdOffsets newOffsets = this.offsets.with(routerId);
index fc70e2da0fadb349ef8d2d1ff94eaec0bb7269d6..e7889c5344c0a3a40e065adffd526e49861e62f4 100644 (file)
@@ -12,6 +12,7 @@ import org.opendaylight.protocol.bgp.mode.api.BestPathState;
 import org.opendaylight.protocol.bgp.rib.spi.RouterId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.OriginatorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpOrigin;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class AbstractBestPathSelector {
     private final long ourAs;
@@ -55,16 +56,16 @@ public class AbstractBestPathSelector {
          * FIXME: for eBGP cases (when the LOCAL_PREF is missing), we should assign a policy-based preference
          *        before we ever get here.
          */
-        final Long bestLocal = this.bestState.getLocalPref();
-        final Long stateLocal = state.getLocalPref();
+        final Uint32 bestLocal = this.bestState.getLocalPref();
+        final Uint32 stateLocal = state.getLocalPref();
         if (stateLocal != null) {
             if (bestLocal == null) {
                 return true;
             }
 
-            final Boolean bool = firstLower(stateLocal, bestLocal);
-            if (bool != null) {
-                return bool;
+            final int cmp = stateLocal.compareTo(bestLocal);
+            if (cmp != 0) {
+                return cmp < 0;
             }
         } else if (bestLocal != null) {
             return false;
index 94fabb7229fa8275f805bd21a402e6c1cc0b67ad..0b5c38a07b32f07e10f3dee0e83db65f72a5344a 100644 (file)
@@ -44,7 +44,7 @@ public class BaseBestPathTest {
 
     @Test
     public void testGetPathId() {
-        assertEquals(NON_PATH_ID_VALUE, this.baseBestPath.getPathId());
+        assertEquals(NON_PATH_ID_VALUE.toJava(), this.baseBestPath.getPathId());
     }
 
     @Test
index fe04400c5fbef8d4ed4ef8b5ae64c1aa8620bb9f..fc132dc69693352e7f025cf9f04f85e32075f3b5 100644 (file)
@@ -44,7 +44,7 @@ public final class BGPPeerAcceptorImpl implements AutoCloseable {
         this.bgpDispatcher = requireNonNull(bgpDispatcher);
         this.address = getAddress(requireNonNull(bindingAddress), requireNonNull(portNumber));
         if (!PlatformDependent.isWindows() && !PlatformDependent.maybeSuperUser()
-                && portNumber.getValue() < PRIVILEGED_PORTS) {
+                && portNumber.getValue().toJava() < PRIVILEGED_PORTS) {
             throw new AccessControlException("Unable to bind port " + portNumber.getValue()
                     + " while running as non-root user.");
         }
@@ -74,7 +74,7 @@ public final class BGPPeerAcceptorImpl implements AutoCloseable {
         } catch (final UnknownHostException e) {
             throw new IllegalArgumentException("Illegal binding address " + ipAddress, e);
         }
-        return new InetSocketAddress(inetAddr, portNumber.getValue());
+        return new InetSocketAddress(inetAddr, portNumber.getValue().toJava());
     }
 
     /**
index 3b020082c7655a2f6302e69852ef4bc2a1b6d711..12287f9b36dd4ea950ce16b794340989dbc41522 100644 (file)
@@ -203,8 +203,7 @@ final class AdjRibInWriter {
             final DOMDataTreeWriteTransaction tx, final Builder<TablesKey, TableContext> tb) {
         // We will use table keys very often, make sure they are optimized
         final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(newPeerPath
-                .node(EMPTY_ADJRIBIN.getIdentifier()).node(TABLES_NID));
-        idb.nodeWithKey(instanceIdentifierKey.getNodeType(), instanceIdentifierKey.getKeyValues());
+                .node(EMPTY_ADJRIBIN.getIdentifier()).node(TABLES_NID)).node(instanceIdentifierKey);
 
         final TableContext ctx = new TableContext(rs, idb.build());
         ctx.createEmptyTableStructure(tx);
@@ -221,7 +220,7 @@ final class AdjRibInWriter {
         final NodeIdentifierWithPredicates supTablesKey = RibSupportUtils.toYangKey(SupportedTables.QNAME, tableKey);
         final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tt =
                 Builders.mapEntryBuilder().withNodeIdentifier(supTablesKey);
-        for (final Entry<QName, Object> e : supTablesKey.getKeyValues().entrySet()) {
+        for (final Entry<QName, Object> e : supTablesKey.entrySet()) {
             tt.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
         }
         if (sendReceive != null) {
index ef56d69921e172fc143c636e7e7aa8e29e6ea160..e46a735512a273f1611ad0d77e94c6b54cff5965 100644 (file)
@@ -424,7 +424,8 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
             setAdvertizedGracefulRestartTableTypes(advertisedTables.stream()
                     .map(t -> new TablesKey(t.getAfi(), t.getSafi())).collect(Collectors.toList()));
         }
-        setAfiSafiGracefulRestartState(advertisedGracefulRestartCapability.getRestartTime(), false, restartingLocally);
+        setAfiSafiGracefulRestartState(advertisedGracefulRestartCapability.getRestartTime().toJava(), false,
+            restartingLocally);
 
         final Map<TablesKey, Integer> llTablesReceived;
         if (advertisedLLTables != null) {
index 74459f74063d8ea93d39fb4cb97f8a5bd33e005c..2c4c5c7e52f7cf76315bf11ed9de9113e565d208 100644 (file)
@@ -76,6 +76,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -138,8 +139,8 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
         this.limiter = new ChannelOutputLimiter(this);
         this.channel.pipeline().addLast(this.limiter);
 
-        final int holdTimerValue = remoteOpen.getHoldTimer() < localHoldTimer ? remoteOpen.getHoldTimer()
-                : localHoldTimer;
+        final int remoteHoldTimer = remoteOpen.getHoldTimer().toJava();
+        final int holdTimerValue = Math.min(remoteHoldTimer, localHoldTimer);
         LOG.info("BGP HoldTimer new value: {}", holdTimerValue);
         this.holdTimerNanos = TimeUnit.SECONDS.toNanos(holdTimerValue);
         this.keepAliveNanos = TimeUnit.SECONDS.toNanos(holdTimerValue / KA_TO_DEADTIMER_RATIO);
@@ -305,7 +306,14 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
     }
 
     @Holding("this")
-    private void notifyTerminationReasonAndCloseWithoutMessage(final Short errorCode, final Short errorSubcode) {
+    private void notifyTerminationReasonAndCloseWithoutMessage(final BGPError error) {
+        this.terminationReasonNotified = true;
+        this.closeWithoutMessage();
+        this.listener.onSessionTerminated(this, new BGPTerminationReason(error));
+    }
+
+    @Holding("this")
+    private void notifyTerminationReasonAndCloseWithoutMessage(final Uint8 errorCode, final Uint8 errorSubcode) {
         this.terminationReasonNotified = true;
         this.closeWithoutMessage();
         this.listener.onSessionTerminated(this, new BGPTerminationReason(BGPError.forValue(errorCode, errorSubcode)));
@@ -388,7 +396,7 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
             builder.setData(data);
         }
         writeAndFlush(builder.build());
-        notifyTerminationReasonAndCloseWithoutMessage(error.getCode(), error.getSubcode());
+        notifyTerminationReasonAndCloseWithoutMessage(error);
     }
 
     private void removePeerSession() {
index f2bbc33f33438f761ef40ae677e81f46cbc2b9a4..5b74d72e47e594e0b241e939dd21513e4452c211 100644 (file)
@@ -68,19 +68,20 @@ public class BgpPeerRpc implements BgpPeerRpcService {
     @Override
     public ListenableFuture<RpcResult<RestartGracefullyOutput>> restartGracefully(final RestartGracefullyInput input) {
         final SettableFuture<RpcResult<RestartGracefullyOutput>> ret = SettableFuture.create();
-        Futures.addCallback(peerRPCs.restartGracefully(input.getSelectionDeferralTime()), new FutureCallback<Object>() {
-            @Override
-            public void onSuccess(final Object result) {
-                ret.set(RpcResultBuilder.success(new RestartGracefullyOutputBuilder().build()).build());
-            }
+        Futures.addCallback(peerRPCs.restartGracefully(input.getSelectionDeferralTime().toJava()),
+            new FutureCallback<Object>() {
+                @Override
+                public void onSuccess(final Object result) {
+                    ret.set(RpcResultBuilder.success(new RestartGracefullyOutputBuilder().build()).build());
+                }
 
-            @Override
-            public void onFailure(final Throwable throwable) {
-                LOG.error("Failed to perform graceful restart", throwable);
-                ret.set(RpcResultBuilder.<RestartGracefullyOutput>failed()
-                    .withError(ErrorType.RPC, throwable.getMessage()).build());
-            }
-        }, MoreExecutors.directExecutor());
+                @Override
+                public void onFailure(final Throwable throwable) {
+                    LOG.error("Failed to perform graceful restart", throwable);
+                    ret.set(RpcResultBuilder.<RestartGracefullyOutput>failed()
+                        .withError(ErrorType.RPC, throwable.getMessage()).build());
+                }
+            }, MoreExecutors.directExecutor());
         return ret;
     }
 
index 99f2fc89464539c5bf80fd527759c127f362b920..5406584136c376e1087e40248bcc2bf725916b95 100644 (file)
@@ -66,6 +66,7 @@ import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -96,7 +97,7 @@ final class LocRibWriter<C extends Routes & DataObject & ChoiceIn<Tables>, S ext
     private LocRibWriter(final RIBSupport<C, S, R, I> ribSupport,
             final TransactionChain chain,
             final KeyedInstanceIdentifier<Rib, RibKey> ribIId,
-            final Long ourAs,
+            final Uint32 ourAs,
             final DataBroker dataBroker,
             final BGPRibRoutingPolicy ribPolicies,
             final BGPPeerTracker peerTracker,
@@ -106,7 +107,7 @@ final class LocRibWriter<C extends Routes & DataObject & ChoiceIn<Tables>, S ext
         this.ribIId = requireNonNull(ribIId);
         this.ribSupport = requireNonNull(ribSupport);
         this.locRibTableIID = ribIId.child(LocRib.class).child(Tables.class, ribSupport.getTablesKey());
-        this.ourAs = ourAs;
+        this.ourAs = ourAs.toJava();
         this.dataBroker = requireNonNull(dataBroker);
         this.peerTracker = peerTracker;
         this.pathSelectionMode = pathSelectionMode;
index 29e480eed8516d81338f104639eaeecd8f42b06a..0870f9778853a58497344985f3070fe12acd4622 100644 (file)
@@ -338,7 +338,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
         }
 
         boolean hasHigherAsNumber(final BGPSessionId other) {
-            return this.asNumber.getValue() > other.asNumber.getValue();
+            return this.asNumber.getValue().compareTo(other.asNumber.getValue()) > 0;
         }
 
         private static long toLong(final Ipv4Address from) {
index a8d7fab3d351eaafeb7418228b439fb007bf4c18..6a823d2cbc19c56bbd1ab7d90282d81e5efd2a69 100644 (file)
@@ -87,7 +87,7 @@ public final class BGPClusterSingletonService implements ClusterSingletonService
         this.bgpIid = bgpIid;
         final String ribInstanceName = getRibInstanceName(bgpIid);
         this.serviceGroupIdentifier = ServiceGroupIdentifier.create(ribInstanceName + "-service-group");
-        LOG.info("BGPClusterSingletonService {} registered", this.serviceGroupIdentifier.getValue());
+        LOG.info("BGPClusterSingletonService {} registered", this.serviceGroupIdentifier.getName());
         ClusterSingletonServiceRegistrationHelper
                 .registerSingletonService(provider, this);
     }
@@ -99,12 +99,12 @@ public final class BGPClusterSingletonService implements ClusterSingletonService
             this.peers.values().forEach(PeerBean::instantiateServiceInstance);
         }
         this.instantiated.set(true);
-        LOG.info("BGPClusterSingletonService {} instantiated", this.serviceGroupIdentifier.getValue());
+        LOG.info("BGPClusterSingletonService {} instantiated", this.serviceGroupIdentifier.getName());
     }
 
     @Override
     public synchronized ListenableFuture<? extends CommitInfo> closeServiceInstance() {
-        LOG.info("BGPClusterSingletonService {} close service instance", this.serviceGroupIdentifier.getValue());
+        LOG.info("BGPClusterSingletonService {} close service instance", this.serviceGroupIdentifier.getName());
         this.instantiated.set(false);
 
         final List<ListenableFuture<? extends CommitInfo>> futurePeerCloseList = this.peers.values().stream()
@@ -223,7 +223,7 @@ public final class BGPClusterSingletonService implements ClusterSingletonService
 
     @Override
     public void close() {
-        LOG.info("BGPClusterSingletonService {} close", this.serviceGroupIdentifier.getValue());
+        LOG.info("BGPClusterSingletonService {} close", this.serviceGroupIdentifier.getName());
         this.peers.values().iterator().forEachRemaining(PeerBean::close);
         this.ribImpl.close();
         this.peers.clear();
index ccac885ebf055fefcfe956a3244a69a73e252e0c..a0c78d65fd5d0cacb3b6af010622ca9bd33fec8b 100644 (file)
@@ -41,6 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.Tables.AfiFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.ll.graceful.restart.capability.TablesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -131,8 +132,8 @@ public final class GracefulRestartUtil {
                                 .rev181112.afi.safi.ll.graceful.restart.ll.graceful.restart.Config config =
                                 llGracefulRestart.getConfig();
                         if (config != null) {
-                            final Long staleTime = config.getLongLivedStaleTime();
-                            if (staleTime != null && staleTime > 0) {
+                            final Uint32 staleTime = config.getLongLivedStaleTime();
+                            if (staleTime != null && staleTime.toJava() > 0) {
                                 final Optional<TablesKey> key = tableTypeRegistry.getTableKey(afiSafi.getAfiSafiName());
                                 if (key.isPresent()) {
                                     timers.put(key.get(), staleTime.intValue());
index f394ecf804c9625c63f59fd344c923040b25cf01..0a336103067326c09062c2923a086026cfc40ce2 100644 (file)
@@ -67,6 +67,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 final class OpenConfigMappingUtil {
 
@@ -117,7 +118,10 @@ final class OpenConfigMappingUtil {
             final boolean anyMatch = afiSafi.stream()
                     .anyMatch(input -> input.getAfiSafiName().equals(IPV4UNICAST.class));
             if (!anyMatch) {
-                afiSafi.add(IPV4_AFISAFI);
+                final List<AfiSafi> newAfiSafi = new ArrayList<>(afiSafi.size() + 1);
+                newAfiSafi.addAll(afiSafi);
+                newAfiSafi.add(IPV4_AFISAFI);
+                return newAfiSafi;
             }
         }
         return afiSafi;
@@ -164,7 +168,7 @@ final class OpenConfigMappingUtil {
             if (afiSafi2 != null) {
                 final Optional<BgpTableType> bgpTableType = tableTypeRegistry.getTableType(afiSafi.getAfiSafiName());
                 if (bgpTableType.isPresent()) {
-                    final int sendMax = afiSafi2.getSendMax();
+                    final short sendMax = afiSafi2.getSendMax().toJava();
                     final PathSelectionMode selectionMode;
                     if (sendMax > 1) {
                         selectionMode = new AddPathBestNPathSelection(sendMax);
@@ -325,7 +329,7 @@ final class OpenConfigMappingUtil {
     }
 
     static int getGracefulRestartTimer(final Neighbor neighbor, final PeerGroup peerGroup, final int holdTimer) {
-        Integer timer = null;
+        Uint16 timer = null;
         if (peerGroup != null) {
             timer = getGracefulRestartTimer(peerGroup.getGracefulRestart());
         }
@@ -338,14 +342,10 @@ final class OpenConfigMappingUtil {
          * RFC4724: "A suggested default for the Restart Time is a value less than or
          * equal to the HOLDTIME carried in the OPEN."
          */
-        if (timer == null) {
-            timer = holdTimer;
-        }
-
-        return timer;
+        return timer == null ? holdTimer : timer.toJava();
     }
 
-    private static @Nullable Integer getGracefulRestartTimer(final GracefulRestart gracefulRestart) {
+    private static @Nullable Uint16 getGracefulRestartTimer(final GracefulRestart gracefulRestart) {
         if (gracefulRestart != null) {
             final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.graceful
                     .restart.Config config = gracefulRestart.getConfig();
index f086b8f3a27de1dcc7c066ec01130e37b83f38f7..0ed4c7dcda5d1ee608f88710be1ee0bbb46bb92f 100644 (file)
@@ -255,7 +255,7 @@ public final class RibImpl implements RIB, BGPRibStateConsumer, AutoCloseable {
                 .collect(Collectors.toMap(entry ->
                         new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
 
-        final BGPRibRoutingPolicy ribPolicy = this.policyProvider.buildBGPRibPolicy(this.asNumber.getValue(),
+        final BGPRibRoutingPolicy ribPolicy = this.policyProvider.buildBGPRibPolicy(this.asNumber.getValue().toJava(),
                 this.routerId, this.clusterId, RoutingPolicyUtil.getApplyPolicy(global.getApplyPolicy()));
         final CodecsRegistryImpl codecsRegistry = CodecsRegistryImpl.create(codecTreeFactory,
                 this.extensions.getClassLoadingStrategy());
index 04c17c5ea81b761b33061a002696339ef49269b7..a9b56c1237724c8e8e6b5656b4bf617cfa840bc0 100644 (file)
@@ -152,7 +152,7 @@ public class BGPSessionImplTest {
         doReturn(futureChannel).when(this.speakerListener).close();
         this.listener = new SimpleSessionListener();
         this.bgpSession = new BGPSessionImpl(this.listener, this.speakerListener, this.classicOpen,
-            this.classicOpen.getHoldTimer(), null);
+            this.classicOpen.getHoldTimer().toJava(), null);
         this.bgpSession.setChannelExtMsgCoder(this.classicOpen);
     }
 
@@ -226,7 +226,7 @@ public class BGPSessionImplTest {
         doThrow(mockedEx).when(mockListener).onSessionUp(any());
         doNothing().when(mockListener).onSessionTerminated(any(), any());
         this.bgpSession = spy(new BGPSessionImpl(mockListener, this.speakerListener, this.classicOpen,
-                this.classicOpen.getHoldTimer(), null));
+                this.classicOpen.getHoldTimer().toJava(), null));
         this.bgpSession.setChannelExtMsgCoder(this.classicOpen);
 
         verify(this.bgpSession, never()).handleException(any());
index 5d4774c3ac367201131a05cffafaf1ccaa8794f2..e4a704854dc429454e344bf60afedc615b141eca 100644 (file)
@@ -218,7 +218,7 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
             ribImpl, null, PeerRole.Ibgp, this.serverRegistry, AFI_SAFIS_ADVERTIZED, Collections.emptySet());
         bgpPeer.instantiateServiceInstance();
         final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen,
-                this.classicOpen.getHoldTimer(), null);
+                this.classicOpen.getHoldTimer().toJava(), null);
         bgpSession.setChannelExtMsgCoder(this.classicOpen);
         bgpPeer.onSessionUp(bgpSession);
 
@@ -267,7 +267,7 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
             ribImpl, null, PeerRole.Ibgp, this.serverRegistry, AFI_SAFIS_ADVERTIZED, Collections.emptySet());
         bgpPeer.instantiateServiceInstance();
         final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen,
-                this.classicOpen.getHoldTimer(), null);
+                this.classicOpen.getHoldTimer().toJava(), null);
         bgpSession.setChannelExtMsgCoder(this.classicOpen);
         bgpPeer.onSessionUp(bgpSession);
 
index fbbff9ad8f2cbe9430b2306c6854701fa8848e27..ac7875e73454a9efd97cb7bafccb90fe69ee34a7 100644 (file)
@@ -344,9 +344,6 @@ public class OpenConfigMappingUtilTest {
         assertTrue(OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafi, false).isEmpty());
         assertEquals(afiSafiIpv6, OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder()
                 .setAfiSafi(afiSafiIpv6List).build(), false).get(0));
-        assertEquals(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build(),
-            OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(),
-                    false).get(1));
         assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), false));
     }
 
index bd3d44e2686b26cab2b4523fc871a4eac4bdddb4..10e2f86f6b85bd0eff55ce0c2514e9e61f816bc8 100644 (file)
@@ -87,6 +87,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.IpBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.UnnumberedBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -103,11 +104,11 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         private final TerminationPoint tp;
 
-        private TpHolder(final TerminationPoint tp) {
+        TpHolder(final TerminationPoint tp) {
             this.tp = requireNonNull(tp);
         }
 
-        private synchronized void addLink(final LinkId id, final boolean isRemote) {
+        synchronized void addLink(final LinkId id, final boolean isRemote) {
             if (isRemote) {
                 this.remote.add(id);
             } else {
@@ -115,7 +116,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             }
         }
 
-        private synchronized boolean removeLink(final LinkId id, final boolean isRemote) {
+        synchronized boolean removeLink(final LinkId id, final boolean isRemote) {
             final boolean removed;
             if (isRemote) {
                 removed = this.remote.remove(id);
@@ -129,7 +130,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             return this.local.isEmpty() && this.remote.isEmpty();
         }
 
-        private TerminationPoint getTp() {
+        TerminationPoint getTp() {
             return this.tp;
         }
     }
@@ -141,7 +142,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         private IgpNodeAttributesBuilder inab;
         private NodeBuilder nb;
 
-        private NodeHolder(final NodeId id) {
+        NodeHolder(final NodeId id) {
             this.inab = new IgpNodeAttributesBuilder();
             this.nb = new NodeBuilder().withKey(new NodeKey(id)).setNodeId(id);
         }
@@ -152,7 +153,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
          * @param trans data modification transaction which to use
          * @return True if the node has been purged, false otherwise.
          */
-        private boolean syncState(final WriteTransaction trans) {
+        boolean syncState(final WriteTransaction trans) {
             final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
 
             /*
@@ -185,7 +186,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             return false;
         }
 
-        private boolean checkForRemoval(final WriteTransaction trans) {
+        boolean checkForRemoval(final WriteTransaction trans) {
             final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
 
             if (!this.advertized) {
@@ -201,7 +202,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             return false;
         }
 
-        private synchronized void removeTp(final TpId tp, final LinkId link, final boolean isRemote) {
+        synchronized void removeTp(final TpId tp, final LinkId link, final boolean isRemote) {
             final TpHolder h = this.tps.get(tp);
             if (h != null) {
                 if (h.removeLink(link, isRemote)) {
@@ -213,34 +214,34 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             }
         }
 
-        private void addTp(final TerminationPoint tp, final LinkId link, final boolean isRemote) {
+        void addTp(final TerminationPoint tp, final LinkId link, final boolean isRemote) {
             final TpHolder h = this.tps.computeIfAbsent(tp.getTpId(), k -> new TpHolder(tp));
             h.addLink(link, isRemote);
         }
 
-        private void addPrefix(final Prefix pfx) {
+        void addPrefix(final Prefix pfx) {
             this.prefixes.put(pfx.key(), pfx);
         }
 
-        private void removePrefix(final PrefixCase prefixCase) {
+        void removePrefix(final PrefixCase prefixCase) {
             this.prefixes.remove(new PrefixKey(prefixCase.getPrefixDescriptors().getIpReachabilityInformation()));
         }
 
-        private void unadvertized() {
+        void unadvertized() {
             this.inab = new IgpNodeAttributesBuilder();
             this.nb = new NodeBuilder().withKey(this.nb.key()).setNodeId(this.nb.getNodeId());
             this.advertized = false;
             LOG.debug("Node {} is unadvertized", this.nb.getNodeId());
         }
 
-        private void advertized(final NodeBuilder nodeBuilder, final IgpNodeAttributesBuilder igpNodeAttBuilder) {
+        void advertized(final NodeBuilder nodeBuilder, final IgpNodeAttributesBuilder igpNodeAttBuilder) {
             this.nb = requireNonNull(nodeBuilder);
             this.inab = requireNonNull(igpNodeAttBuilder);
             this.advertized = true;
             LOG.debug("Node {} is advertized", nodeBuilder.getNodeId());
         }
 
-        private NodeId getNodeId() {
+        NodeId getNodeId() {
             return this.nb.getNodeId();
         }
     }
@@ -274,7 +275,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
     private static TpId buildTpId(final UriBuilder base, final TopologyIdentifier topologyIdentifier,
             final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier,
-            final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final Long id) {
+            final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final Uint32 id) {
         final UriBuilder b = new UriBuilder(base, "tp");
         if (topologyIdentifier != null) {
             b.add("mt", topologyIdentifier.getValue());
@@ -309,7 +310,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
     }
 
     private static TerminationPointType getTpType(final Ipv4InterfaceIdentifier ipv4InterfaceIdentifier,
-            final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final Long id) {
+            final Ipv6InterfaceIdentifier ipv6InterfaceIdentifier, final Uint32 id) {
         // Order of preference: Unnumbered first, then IP
         if (id != null) {
             LOG.debug("Unnumbered termination point type: {}", id);
index 6bde021485c98317e37b34e0bb80506047aae161..99f6cd65015f99aa236fb429fbfe9106abfbf56c 100644 (file)
@@ -56,6 +56,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.PseudonodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.prefix.attributes.OspfPrefixAttributesBuilder;
 import org.opendaylight.yangtools.yang.common.Empty;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public final class ProtocolUtil {
     private ProtocolUtil() {
@@ -214,10 +215,10 @@ public final class ProtocolUtil {
                 .collect(Collectors.toList());
     }
 
-    private static List<Short> nodeMultiTopology(final List<TopologyIdentifier> list) {
-        final List<Short> ret = new ArrayList<>(list.size());
+    private static List<Uint8> nodeMultiTopology(final List<TopologyIdentifier> list) {
+        final List<Uint8> ret = new ArrayList<>(list.size());
         for (final TopologyIdentifier id : list) {
-            ret.add(id.getValue().shortValue());
+            ret.add(Uint8.valueOf(id.getValue()));
         }
         return ret;
     }
index 6b9e830fb264ee8af0fc25fc8c948c26d6dc4855..dd970106cac489b435265a58e30f69db5427c7f9 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.bgpcep.bgp.topology.provider;
 
 import com.google.common.io.BaseEncoding;
-import com.google.common.primitives.UnsignedBytes;
 import java.util.Arrays;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.IsisAreaIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.NodeIdentifier;
@@ -121,7 +120,7 @@ final class UriBuilder {
         if (routerIdentifier instanceof IsisPseudonodeCase) {
             final IsisPseudonode r = ((IsisPseudonodeCase) routerIdentifier).getIsisPseudonode();
             return isoId(r.getIsIsRouterIdentifier().getIsoSystemId().getValue()) + '.'
-                    + BaseEncoding.base16().encode(new byte[] { UnsignedBytes.checkedCast(r.getPsn()) });
+                    + BaseEncoding.base16().encode(new byte[] { r.getPsn().byteValue() });
         }
         if (routerIdentifier instanceof OspfNodeCase) {
             return ((OspfNodeCase) routerIdentifier).getOspfNode().getOspfRouterId().toString();
index 22663ae241ffe88ef28648c0cd9a4ee1cd171dff..8b43119e7505534f64046e1b0e6fcabff36a36ad 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>binding-parent</artifactId>
-        <version>4.0.6</version>
+        <version>5.0.2</version>
         <relativePath/>
     </parent>
 
index 88c1154d399c5383b1b25e10e0053067dbacede8..b081181d2c8e7e40826d3a40c55a143a5572fa86 100644 (file)
@@ -79,7 +79,7 @@ public final class BmpMonitoringStationImpl implements BmpMonitoringStation, Clu
                 bmpDeployerDependencies.getExtensions(), bmpDeployerDependencies.getTree());
 
         LOG.info("BMP Monitor Singleton Service {} registered, Monitor Id {}",
-                getIdentifier().getValue(), this.monitorId.getValue());
+                getIdentifier().getName(), this.monitorId.getValue());
         this.singletonServiceRegistration = bmpDeployerDependencies.getClusterSingletonProvider()
                 .registerClusterSingletonService(this);
     }
@@ -87,7 +87,7 @@ public final class BmpMonitoringStationImpl implements BmpMonitoringStation, Clu
     @Override
     public synchronized void instantiateServiceInstance() {
         LOG.info("BMP Monitor Singleton Service {} instantiated, Monitor Id {}",
-                getIdentifier().getValue(), this.monitorId.getValue());
+                getIdentifier().getName(), this.monitorId.getValue());
 
         final ChannelFuture channelFuture = this.dispatcher.createServer(this.address, this.sessionManager,
                 constructKeys(this.monitoredRouters));
@@ -107,7 +107,7 @@ public final class BmpMonitoringStationImpl implements BmpMonitoringStation, Clu
     @Override
     public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
         LOG.info("BMP Monitor Singleton Service {} instance closed, Monitor Id {}",
-                getIdentifier().getValue(), this.monitorId.getValue());
+                getIdentifier().getName(), this.monitorId.getValue());
         if (this.channel != null) {
             this.channel.close().addListener((ChannelFutureListener) future -> {
                 Preconditions.checkArgument(future.isSuccess(),
index 1fc09eec0d6fe579f2ebb54efdafc799394dfa9b..a2b9970325085735786e2353756a72bc2eca3ddf 100644 (file)
@@ -138,7 +138,7 @@ final class BmpRibInWriter {
             }
             final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(yangTableRootIId);
             final NodeIdentifierWithPredicates key = TablesUtil.toYangTablesKey(k);
-            idb.nodeWithKey(key.getNodeType(), key.getKeyValues());
+            idb.nodeWithKey(key.getNodeType(), key.asMap());
             final TableContext ctx = new TableContext(rs, idb.build(), tree);
             ctx.createTable(tx);
 
index 28a31a7f310425ab585fbb77e6ae3fa37261b99e..159edda218834805c0a04edb9ee69585f2dbb406 100644 (file)
@@ -91,7 +91,7 @@ final class TableContext {
         // tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
         final NodeIdentifierWithPredicates tableKey =
                 (NodeIdentifierWithPredicates) this.tableId.getLastPathArgument();
-        for (final Map.Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
+        for (final Map.Entry<QName, Object> e : tableKey.entrySet()) {
             tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
         }
 
index 56df9b89062d116f0e4f48c5aea292f080fd1a84..4c43e81be0fb4b1fdecc98c2a7dc874a688e7e28 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>util</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991-ietf-inet-types</artifactId>
index 5e9b691565fea7c7a44c1b09a4fe04b5b094bed9..92de040cceb2e0905e9571a8ab0655e0b30254fe 100644 (file)
@@ -59,7 +59,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>4.0.6</version>
+                <version>5.0.2</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
index 8d8f1ba4368c34daa4c54839b8a9db5df2f256b1..51aa3bbdd064f6fb611593eade4d4f679e9ed259 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991-ietf-inet-types</artifactId>
index a23785d6b63ef2785a087731df8c7121745c04c7..f59cf94e86792205ca053d845271e536aae8efb5 100644 (file)
@@ -59,7 +59,8 @@ public final class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<Er
 
     @Override
     public void addTlv(final ErrorObjectBuilder builder, final Tlv tlv) {
-        if (tlv instanceof ReqMissing && builder.getType() == PCEPErrors.SYNC_PATH_COMP_REQ_MISSING.getErrorType()) {
+        if (tlv instanceof ReqMissing
+                && builder.getType().toJava() == PCEPErrors.SYNC_PATH_COMP_REQ_MISSING.getErrorType()) {
             builder.setTlvs(new TlvsBuilder().setReqMissing((ReqMissing) tlv).build());
         }
     }
@@ -90,7 +91,7 @@ public final class PCEPErrorObjectParser extends AbstractObjectWithTlvsParser<Er
     }
 
     @Override
-    protected final void addVendorInformationTlvs(
+    protected void addVendorInformationTlvs(
         final ErrorObjectBuilder builder,
         final List<VendorInformationTlv> tlvs) {
         if (!tlvs.isEmpty()) {
index a7c9172615c35917a71dabe8f86a9c30bf4f66be..739647c44c282790e65d0f46254943bd70c7032a 100644 (file)
@@ -61,7 +61,7 @@ public final class PCEPNotificationObjectParser extends AbstractObjectWithTlvsPa
 
     @Override
     public void addTlv(final CNotificationBuilder builder, final Tlv tlv) {
-        if (tlv instanceof OverloadDuration && builder.getType() == 2 && builder.getValue() == 1) {
+        if (tlv instanceof OverloadDuration && builder.getType().toJava() == 2 && builder.getValue().toJava() == 1) {
             builder.setTlvs(new TlvsBuilder().setOverloadDuration((OverloadDuration) tlv).build());
         }
     }
@@ -93,7 +93,7 @@ public final class PCEPNotificationObjectParser extends AbstractObjectWithTlvsPa
     }
 
     @Override
-    protected final void addVendorInformationTlvs(
+    protected void addVendorInformationTlvs(
         final CNotificationBuilder builder,
         final List<VendorInformationTlv> tlvs) {
         if (!tlvs.isEmpty()) {
index f7aede3b08006dd841aca9fa4c3178cb6071607b..63ad84ab9364ff1adc0344958f611a10704ada5e 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.pcep.parser.object;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
 
 import com.google.common.base.Preconditions;
-import com.google.common.primitives.UnsignedBytes;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.List;
@@ -155,7 +154,7 @@ public class PCEPRequestParameterObjectParser extends AbstractObjectWithTlvsPars
         flags.set(E_FLAG_OFFSET, rpObj.isEroCompression());
         final byte[] res = flags.array();
         if (rpObj.getPriority() != null) {
-            final byte p = UnsignedBytes.checkedCast(rpObj.getPriority());
+            final byte p = rpObj.getPriority().byteValue();
             res[res.length - 1] = (byte) (res[res.length - 1] | p);
         }
         body.writeBytes(res);
index 551d7d99d37fb4faeb31aac59ebc0163ce66665c..c58ed4c97adef90affb5b7954bf40493b9c0bd18 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Parser for {@link SrlgCase}
@@ -59,7 +60,7 @@ public class XROSRLGSubobjectParser implements XROSubobjectParser, XROSubobjectS
         Preconditions.checkArgument(specObj.getSrlgId() != null, "SrlgId is mandatory.");
         writeUnsignedInt(specObj.getSrlgId().getValue(), body);
         Preconditions.checkArgument(subobject.getAttribute() != null, "Attribute is mandatory.");
-        writeUnsignedByte(null, body);
+        writeUnsignedByte((Uint8) null, body);
         writeUnsignedByte((short) subobject.getAttribute().getIntValue(), body);
         XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
     }
index a2a903521ff83834623fff25802584181481ba49..d37bf376f7e81d292abc7c1b522b6e883e81017a 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.protocol.pcep.spi.TlvUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupTypeBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class PathSetupTypeTlvParser implements TlvParser, TlvSerializer {
 
@@ -33,15 +34,15 @@ public class PathSetupTypeTlvParser implements TlvParser, TlvSerializer {
     private static final short RSVP_TE_PST = 0;
     private static final String UNSUPPORTED_PST = "Unsupported path setup type.";
 
-    private static final Set<Short> PSTS = new HashSet<>();
+    private static final Set<Uint8> PSTS = new HashSet<>();
 
     public PathSetupTypeTlvParser() {
-        PSTS.add(RSVP_TE_PST);
+        PSTS.add(Uint8.valueOf(RSVP_TE_PST));
     }
 
     public PathSetupTypeTlvParser(final short srTePst) {
         this();
-        PSTS.add(srTePst);
+        PSTS.add(Uint8.valueOf(srTePst));
     }
 
     @Override
@@ -60,14 +61,14 @@ public class PathSetupTypeTlvParser implements TlvParser, TlvSerializer {
         if (buffer == null) {
             return null;
         }
-        final short pst = buffer.readerIndex(OFFSET).readUnsignedByte();
+        final Uint8 pst = Uint8.valueOf(buffer.readerIndex(OFFSET).readUnsignedByte());
         if (!checkPST(pst)) {
             throw new PCEPDeserializerException(UNSUPPORTED_PST);
         }
         return new PathSetupTypeBuilder().setPst(pst).build();
     }
 
-    private static boolean checkPST(final Short pst) {
+    private static boolean checkPST(final Uint8 pst) {
         return pst != null && PSTS.contains(pst);
     }
 }
index fa32e69aa74ece6fe756aebc2009406fad4f7f0d..4b94f73c978eaba238ff21309a8d97deb45e542d 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Map;
@@ -26,7 +27,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.path.binding.tlv.path.binding.binding.type.value.MplsLabelEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.path.binding.tlv.path.binding.binding.type.value.MplsLabelEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
-import org.opendaylight.yangtools.concepts.Codec;
+import org.opendaylight.yangtools.concepts.IllegalArgumentCodec;
 
 /**
  * Parser for {@link PathBinding}.
@@ -133,9 +134,9 @@ public final class PathBindingTlvParser implements TlvParser, TlvSerializer {
             final MplsLabelEntry mplsEntry = (MplsLabelEntry) bindingValue;
             final ByteBuf value = Unpooled.buffer(MPLS_ENTRY_LENGTH);
             final long entry = getMplsStackEntry(mplsEntry.getLabel())
-                    | mplsEntry.getTrafficClass() << TC_SHIFT
+                    | mplsEntry.getTrafficClass().toJava() << TC_SHIFT
                     | (mplsEntry.isBottomOfStack() ? 1 : 0) << S_SHIFT
-                    | mplsEntry.getTimeToLive();
+                    | mplsEntry.getTimeToLive().toJava();
             ByteBufWriteUtil.writeUnsignedInt(entry, value);
             return value;
         }
@@ -157,19 +158,22 @@ public final class PathBindingTlvParser implements TlvParser, TlvSerializer {
         }
     }
 
-    private interface PathBindingTlvCodec extends Codec<ByteBuf, BindingTypeValue> {
+    private interface PathBindingTlvCodec extends IllegalArgumentCodec<ByteBuf, BindingTypeValue> {
         int getBindingType();
     }
 
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel
         getMplsLabel(final long mplsStackEntry) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125
                 .MplsLabel(mplsStackEntry >> LABEL_SHIFT & LABEL_MASK);
     }
 
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static long getMplsStackEntry(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network
             .concepts.rev131125.MplsLabel mplsLabel) {
-        return mplsLabel.getValue() << LABEL_SHIFT;
+        return mplsLabel.getValue().toJava() << LABEL_SHIFT;
     }
-
 }
index 530e42255f4ea369fc3af6d1bfb1239083083c6c..8efd94053252736eca8665ba1e938d4b42188efc 100644 (file)
@@ -141,7 +141,8 @@ public class Stateful07PCReportMessageParser extends AbstractMessageParser {
             final Lsp lsp = (Lsp) object;
             final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                 .object.lsp.Tlvs tlvs = lsp.getTlvs();
-            if (!lspViaSR && lsp.getPlspId().getValue() != 0 && (tlvs == null || tlvs.getLspIdentifiers() == null)) {
+            if (!lspViaSR && lsp.getPlspId().getValue().toJava() != 0
+                    && (tlvs == null || tlvs.getLspIdentifiers() == null)) {
                 final Message errorMsg = createErrorMsg(PCEPErrors.LSP_IDENTIFIERS_TLV_MISSING, Optional.empty());
                 errors.add(errorMsg);
                 return false;
index ad9229f67ea8798c44764efd180944ec5b16a182..acfc687f7dc2bdbb0cf59daffcad55d8e88a8bbd 100644 (file)
@@ -34,8 +34,9 @@ public final class DefaultPCEPSessionNegotiatorFactory extends AbstractPCEPSessi
         this.tlsConfiguration = tlsConfiguration;
     }
 
-    public DefaultPCEPSessionNegotiatorFactory(final PCEPSessionProposalFactory spf, final PcepDispatcherConfig config) {
-        this(spf, config.getMaxUnknownMessages(), config.getTls());
+    public DefaultPCEPSessionNegotiatorFactory(final PCEPSessionProposalFactory spf,
+            final PcepDispatcherConfig config) {
+        this(spf, config.getMaxUnknownMessages().toJava(), config.getTls());
     }
 
     @Override
index c2cfc3f4e4d5c7114c13d1ea6f73e7345cf9941f..fc926856f8a63d7daf1ee50fec9964b1328fbf76 100644 (file)
@@ -345,7 +345,7 @@ public class PCEPSessionImpl extends SimpleChannelInboundHandler<Message> implem
              */
             close();
             this.listener.onSessionTerminated(this, new PCEPCloseTermination(TerminationReason
-                    .forValue(((CloseMessage) msg).getCCloseMessage().getCClose().getReason())));
+                    .forValue(((CloseMessage) msg).getCCloseMessage().getCClose().getReason().toJava())));
         } else {
             // This message needs to be handled by the user
             if (msg instanceof PcerrMessage) {
index 0cf55d977011d66a0b23f7ca2d3b94da82ccbc04..2162675c89c1de12da07168b36a459ee747fe85a 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.OpenBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors;
 import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class FiniteStateMachineTest extends AbstractPCEPSessionTest {
 
@@ -153,8 +154,8 @@ public class FiniteStateMachineTest extends AbstractPCEPSessionTest {
             for (final Notification m : this.msgsSend) {
                 if (m instanceof Pcerr) {
                     final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
-                    assertEquals(new Short((short) 1), obj.getErrorObject().getType());
-                    assertEquals(new Short((short) 1), obj.getErrorObject().getValue());
+                    assertEquals(Uint8.ONE, obj.getErrorObject().getType());
+                    assertEquals(Uint8.ONE, obj.getErrorObject().getValue());
                 }
             }
         });
@@ -175,8 +176,8 @@ public class FiniteStateMachineTest extends AbstractPCEPSessionTest {
             for (final Notification m : this.msgsSend) {
                 if (m instanceof Pcerr) {
                     final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
-                    assertEquals(new Short((short) 1), obj.getErrorObject().getType());
-                    assertEquals(new Short((short) 7), obj.getErrorObject().getValue());
+                    assertEquals(Uint8.ONE, obj.getErrorObject().getType());
+                    assertEquals(Uint8.valueOf(7), obj.getErrorObject().getValue());
                 }
             }
         });
@@ -196,8 +197,8 @@ public class FiniteStateMachineTest extends AbstractPCEPSessionTest {
             for (final Notification m : this.msgsSend) {
                 if (m instanceof Pcerr) {
                     final Errors obj = ((Pcerr) m).getPcerrMessage().getErrors().get(0);
-                    assertEquals(new Short((short) 1), obj.getErrorObject().getType());
-                    assertEquals(new Short((short) 2), obj.getErrorObject().getValue());
+                    assertEquals(Uint8.ONE, obj.getErrorObject().getType());
+                    assertEquals(Uint8.valueOf(2), obj.getErrorObject().getValue());
                 }
             }
         });
index aeb29a195694bbd0b8f749d2ce57558f003fa562..0d668dbe3522dd63a8d9eff0def16267921a327b 100644 (file)
@@ -87,12 +87,14 @@ public class PCEPSessionImplTest extends AbstractPCEPSessionTest {
         Assert.assertTrue(this.msgsSend.get(0) instanceof Pcerr);
         final Pcerr pcErr = (Pcerr) this.msgsSend.get(0);
         final ErrorObject errorObj = pcErr.getPcerrMessage().getErrors().get(0).getErrorObject();
-        Assert.assertEquals(PCEPErrors.CAPABILITY_NOT_SUPPORTED, PCEPErrors.forValue(errorObj.getType(), errorObj.getValue()));
+        Assert.assertEquals(PCEPErrors.CAPABILITY_NOT_SUPPORTED, PCEPErrors.forValue(errorObj.getType(),
+            errorObj.getValue()));
         Assert.assertEquals(1, this.session.getMessages().getUnknownMsgReceived().intValue());
         // exceeded max. unknown messages count - terminate session
         Assert.assertTrue(this.msgsSend.get(1) instanceof CloseMessage);
         final CloseMessage closeMsg = (CloseMessage) this.msgsSend.get(1);
-        Assert.assertEquals(TerminationReason.TOO_MANY_UNKNOWN_MSGS, TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason()));
+        Assert.assertEquals(TerminationReason.TOO_MANY_UNKNOWN_MSGS,
+            TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason().toJava()));
         Mockito.verify(this.channel, Mockito.times(1)).close();
     }
 
@@ -109,7 +111,8 @@ public class PCEPSessionImplTest extends AbstractPCEPSessionTest {
         Assert.assertEquals(1, this.msgsSend.size());
         Assert.assertTrue(this.msgsSend.get(0) instanceof CloseMessage);
         final CloseMessage closeMsg = (CloseMessage) this.msgsSend.get(0);
-        Assert.assertEquals(TerminationReason.UNKNOWN, TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason()));
+        Assert.assertEquals(TerminationReason.UNKNOWN,
+            TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason().toJava()));
         Mockito.verify(this.channel, Mockito.times(1)).close();
     }
 
index 2109e6c75abfe2913cfa879a87e9e1f1de070be9..15dd40e8a333cd25249f5646dbd9b7c1636a2704 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991-ietf-inet-types</artifactId>
index 89b781524b78afe4237d895ff4043007b050e820..c7a22e8ff1182127249a5328f4cba4b89b043ea5 100755 (executable)
@@ -12,7 +12,6 @@ import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.LoggerContext;
 import com.google.common.base.Preconditions;
 import com.google.common.net.InetAddresses;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.Collections;
@@ -21,6 +20,7 @@ import java.util.Optional;
 import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
 import org.opendaylight.protocol.util.InetSocketAddressUtil;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +37,7 @@ public final class Main {
     private static boolean includeDbv = Boolean.FALSE;
     private static boolean incrementalSync = Boolean.FALSE;
     private static boolean triggeredResync = Boolean.FALSE;
-    private static BigInteger syncOptDBVersion;
+    private static Uint64 syncOptDBVersion;
     private static int reconnectAfterXSeconds;
     private static int disonnectAfterXSeconds;
 
@@ -109,7 +109,7 @@ public final class Main {
                     final Long dbVersionAfterReconnect = Long.valueOf(args[++argIdx]);
                     disonnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
                     reconnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
-                    syncOptDBVersion = BigInteger.valueOf(dbVersionAfterReconnect);
+                    syncOptDBVersion = Uint64.valueOf(dbVersionAfterReconnect);
                     break;
                 case "--incremental-sync-procedure":
                     //TODO Check that DBv > Lsp always ??
@@ -119,7 +119,7 @@ public final class Main {
                     final Long initialDbVersionAfterReconnect = Long.valueOf(args[++argIdx]);
                     disonnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
                     reconnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
-                    syncOptDBVersion = BigInteger.valueOf(initialDbVersionAfterReconnect);
+                    syncOptDBVersion = Uint64.valueOf(initialDbVersionAfterReconnect);
                     break;
                 case "--triggered-initial-sync":
                     triggeredInitSync = Boolean.TRUE;
@@ -140,13 +140,13 @@ public final class Main {
                             + "reconnectes requires to be higher than lsps");
         }
 
-        final Optional<BigInteger> dBVersion = Optional.ofNullable(syncOptDBVersion);
+        final Optional<Uint64> dBVersion = Optional.ofNullable(syncOptDBVersion);
         final PCCsBuilder pccs = new PCCsBuilder(lsps, pcError, pccCount, localAddress, remoteAddress, ka, dt,
                 password, reconnectTime, redelegationTimeout,
             stateTimeout, getCapabilities());
         final TimerHandler timerHandler = new TimerHandler(pccs, dBVersion, disonnectAfterXSeconds,
                 reconnectAfterXSeconds);
-        pccs.createPCCs(BigInteger.valueOf(lsps), Optional.ofNullable(timerHandler));
+        pccs.createPCCs(Uint64.valueOf(lsps), Optional.ofNullable(timerHandler));
         if (!triggeredInitSync) {
             timerHandler.createDisconnectTask();
         }
@@ -161,7 +161,7 @@ public final class Main {
     }
 
     private static ch.qos.logback.classic.Logger getRootLogger(final LoggerContext lc) {
-        return lc.getLoggerList().stream().filter(input -> (input != null) && input.getName()
+        return lc.getLoggerList().stream().filter(input -> input != null && input.getName()
             .equals(Logger.ROOT_LOGGER_NAME)).findFirst().get();
     }
 }
index eeb6f0b1089826cfb448bb9d9a9c45985888f64f..f9134be27c4c8dd347c8cad42cff3a61466b7bca 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static java.util.Objects.requireNonNull;
 
-import java.math.BigInteger;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession;
@@ -18,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.lsp.db.version.tlv.LspDbVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.Tlvs1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 final class PCCSyncOptimization {
     private final boolean dbVersionMatch;
@@ -27,7 +27,7 @@ final class PCCSyncOptimization {
     private final boolean isTriggeredReSyncEnable;
     private final LspDbVersion localLspDbVersion;
     private final LspDbVersion remoteLspDbVersion;
-    private BigInteger lspDBVersion = BigInteger.ONE;
+    private Uint64 lspDBVersion = Uint64.ONE;
     private Boolean resynchronizing = Boolean.FALSE;
 
     PCCSyncOptimization(final @NonNull PCCSession session) {
@@ -64,16 +64,16 @@ final class PCCSyncOptimization {
         return this.isTriggeredReSyncEnable;
     }
 
-    public BigInteger getLocalLspDbVersionValue() {
+    public Uint64 getLocalLspDbVersionValue() {
         if (this.localLspDbVersion == null) {
             return null;
         }
         return this.localLspDbVersion.getLspDbVersionValue();
     }
 
-    public BigInteger getRemoteLspDbVersionValue() {
+    public Uint64 getRemoteLspDbVersionValue() {
         if (this.remoteLspDbVersion == null) {
-            return BigInteger.ONE;
+            return Uint64.ONE;
         }
         return this.remoteLspDbVersion.getLspDbVersionValue();
     }
@@ -138,7 +138,7 @@ final class PCCSyncOptimization {
         return false;
     }
 
-    public Optional<BigInteger> incrementLspDBVersion() {
+    public Optional<Uint64> incrementLspDBVersion() {
         if (!isSyncAvoidanceEnabled()) {
             return Optional.empty();
         } else if (isSyncNeedIt() && getLocalLspDbVersionValue() != null && !this.resynchronizing) {
@@ -148,7 +148,7 @@ final class PCCSyncOptimization {
             return Optional.of(this.lspDBVersion);
         }
 
-        this.lspDBVersion = this.lspDBVersion.add(BigInteger.ONE);
+        this.lspDBVersion = Uint64.fromLongBits(lspDBVersion.longValue() + 1);
         return Optional.of(this.lspDBVersion);
     }
 
index 3b6ab1a611bf39da9f49e045d4b347a45dc186cf..b601aa33fb959bba19e7dc10612390fb7ec598c1 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 final class PCCTunnelBuilder {
     static final int PCC_DELEGATION = -1;
@@ -36,7 +37,7 @@ final class PCCTunnelBuilder {
     static Map<PlspId, PCCTunnel> createTunnels(final String address, final int lsps) {
         final Map<PlspId, PCCTunnel> tunnels = new HashMap<>();
         for (int i = 1; i <= lsps; i++) {
-            final PCCTunnel tunnel = new PCCTunnel(MsgBuilderUtil.getDefaultPathName(address, i),
+            final PCCTunnel tunnel = new PCCTunnel(MsgBuilderUtil.getDefaultPathName(address, Uint32.valueOf(i)),
                     PCC_DELEGATION, LspType.PCC_LSP, createPath(Lists.newArrayList(DEFAULT_ENDPOINT_HOP)));
             tunnels.put(new PlspId((long) i), tunnel);
         }
index 3a149cf5c51ac9a0c295cf41343970447e830258..bf2445e02f1fa323031ff8a676ec23d78ea04379 100644 (file)
@@ -21,7 +21,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.net.InetAddresses;
 import io.netty.util.Timeout;
 import io.netty.util.Timer;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.util.Collections;
 import java.util.HashMap;
@@ -56,6 +55,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.SrpBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public final class PCCTunnelManagerImpl implements PCCTunnelManager {
 
@@ -88,10 +89,10 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     protected void reportToAll(final Updates update, final PCCSession session) {
         final PlspId plspId = update.getLsp().getPlspId();
         final PCCTunnel tunnel = this.tunnels.get(plspId);
-        final long srpId = update.getSrp().getOperationId().getValue();
+        final Uint32 srpId = update.getSrp().getOperationId().getValue();
         if (tunnel != null) {
             if (hasDelegation(tunnel, session)) {
-                final Srp srp = createSrp(update.getSrp().getOperationId().getValue());
+                final Srp srp = createSrp(srpId);
                 final Path path = updToRptPath(update.getPath());
                 final List<Subobject> subobjects = update.getPath().getEro().getSubobject();
                 final Lsp lsp = update.getLsp();
@@ -109,7 +110,7 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     private void returnDelegation(final Updates update, final PCCSession session) {
         final PlspId plspId = update.getLsp().getPlspId();
         final PCCTunnel tunnel = this.tunnels.get(plspId);
-        final long srpId = update.getSrp().getOperationId().getValue();
+        final Uint32 srpId = update.getSrp().getOperationId().getValue();
         if (tunnel != null) {
             //check if session really has a delegation
             if (hasDelegation(tunnel, session)) {
@@ -139,7 +140,7 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     protected void takeDelegation(final Requests request, final PCCSession session) {
         final PlspId plspId = request.getLsp().getPlspId();
         final PCCTunnel tunnel = this.tunnels.get(plspId);
-        final long srpId = request.getSrp().getOperationId().getValue();
+        final Uint32 srpId = request.getSrp().getOperationId().getValue();
         if (tunnel != null) {
             //check if tunnel has no delegation
             if (tunnel.getType() == LspType.PCE_LSP && (tunnel.getDelegationHolder() == -1
@@ -206,7 +207,7 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     protected void removeTunnel(final Requests request, final PCCSession session) {
         final PlspId plspId = request.getLsp().getPlspId();
         final PCCTunnel tunnel = this.tunnels.get(plspId);
-        final long srpId = request.getSrp().getOperationId().getValue();
+        final Uint32 srpId = request.getSrp().getOperationId().getValue();
         if (tunnel != null) {
             if (tunnel.getType() == LspType.PCE_LSP) {
                 if (hasDelegation(tunnel, session)) {
@@ -261,7 +262,8 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
         }
     }
 
-    private Tlvs buildTlvs(final PCCTunnel tunnel, final Long plspId, final Optional<List<Subobject>> subobjectsList) {
+    private Tlvs buildTlvs(final PCCTunnel tunnel, final Uint32 plspId,
+            final Optional<List<Subobject>> subobjectsList) {
         final List<Subobject> subObject = subobjectsList.isPresent() ? subobjectsList.get() :
                 tunnel.getLspState().getEro().getSubobject();
         final String destinationAddress = getDestinationAddress(subObject, this.address);
@@ -272,8 +274,8 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
 
     private synchronized void lazyTunnelInicialization() {
         if (this.tunnels.isEmpty()) {
-            final BigInteger dbV = this.syncOptimization.getLocalLspDbVersionValue();
-            if (dbV != null && this.syncOptimization.isSyncAvoidanceEnabled() && !dbV.equals(BigInteger.ONE)) {
+            final Uint64 dbV = this.syncOptimization.getLocalLspDbVersionValue();
+            if (dbV != null && this.syncOptimization.isSyncAvoidanceEnabled() && !dbV.equals(Uint64.ONE)) {
                 this.tunnels.putAll(PCCTunnelBuilder.createTunnels(this.address, dbV.intValue()));
             } else {
                 this.tunnels.putAll(PCCTunnelBuilder.createTunnels(this.address, this.lspsCount));
@@ -286,13 +288,14 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     }
 
     private boolean isInitialSyncTriggered(final Lsp lsp) {
-        return lsp.getPlspId().getValue() == 0 && lsp.isSync() && this.syncOptimization.isTriggeredInitSyncEnabled();
+        return lsp.getPlspId().getValue().toJava() == 0 && lsp.isSync()
+                && this.syncOptimization.isTriggeredInitSyncEnabled();
     }
 
     private void handledDbTriggeredResync(final Updates update, final PCCSession session) {
         this.syncOptimization.setResynchronizingState(Boolean.TRUE);
         final SrpIdNumber operationId = update.getSrp().getOperationId();
-        if (update.getLsp().getPlspId().getValue() == 0) {
+        if (update.getLsp().getPlspId().getValue().toJava() == 0) {
             reportAllKnownLsp(Optional.of(operationId), session);
         } else {
             reportLsp(update.getLsp().getPlspId(), operationId, session);
@@ -324,13 +327,14 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
     private void reportMissedLsp(final PCCSession session) {
         for (long missedLsp = this.syncOptimization.getRemoteLspDbVersionValue().longValue() + 1;
              missedLsp <= this.syncOptimization.getLocalLspDbVersionValue().longValue(); missedLsp++) {
-            final PlspId plspId = new PlspId(missedLsp);
+            final Uint32 missed = Uint32.valueOf(missedLsp);
+            final PlspId plspId = new PlspId(missed);
             final PCCTunnel tunnel = this.tunnels.get(plspId);
-            createLspAndSendReport(missedLsp, tunnel, session, Optional.empty(), NO_SRP);
+            createLspAndSendReport(missed, tunnel, session, Optional.empty(), NO_SRP);
         }
     }
 
-    private void createLspAndSendReport(final long plspId, final PCCTunnel tunnel, final PCCSession session,
+    private void createLspAndSendReport(final Uint32 plspId, final PCCTunnel tunnel, final PCCSession session,
             final Optional<Boolean> isSync, final Optional<Srp> srp) {
         final boolean delegation = hasDelegation(tunnel, session);
         if (delegation) {
@@ -360,7 +364,7 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
         if (this.syncOptimization.isSyncAvoidanceEnabled()) {
             tlv = createLspTlvsEndofSync(this.syncOptimization.incrementLspDBVersion().get());
         }
-        final Pcrpt pcrtp = createPcRtpMessage(createLsp(0, false, tlv, true, false),
+        final Pcrpt pcrtp = createPcRtpMessage(createLsp(Uint32.ZERO, false, tlv, true, false),
                 Optional.ofNullable(srp), createPath(Collections.emptyList()));
         session.sendReport(pcrtp);
     }
@@ -377,7 +381,7 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
 
         for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
             final PCCTunnel tunnel = entry.getValue();
-            final long plspId = entry.getKey().getValue();
+            final Uint32 plspId = entry.getKey().getValue();
             createLspAndSendReport(plspId, tunnel, session, Optional.empty(), Optional.ofNullable(srp));
         }
     }
@@ -417,8 +421,8 @@ public final class PCCTunnelManagerImpl implements PCCTunnelManager {
                 if (tunnel.getType() == LspType.PCE_LSP) {
                     PCCTunnelManagerImpl.this.tunnels.remove(plspId);
                     //report tunnel removal to all
-                    sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(0), new PathBuilder().build(),
-                        createLsp(plspId.getValue(), false, Optional.empty(), false, true));
+                    sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(Uint32.ZERO),
+                        new PathBuilder().build(), createLsp(plspId.getValue(), false, Optional.empty(), false, true));
                 }
             }, this.stateTimeout, TimeUnit.SECONDS);
             tunnel.setStateTimeout(newStateTimeout);
index 8596e4b40ef77152c0cc556b05c28cb5c103cf53..3d113832e6b154aeafc80fe8eeaa2f7abefaacf8 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.collect.Lists;
 import com.google.common.net.InetAddresses;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.List;
@@ -32,6 +31,7 @@ import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener;
 import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
 import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 final class PCCsBuilder {
     private final int lsps;
@@ -68,7 +68,7 @@ final class PCCsBuilder {
         startActivators();
     }
 
-    void createPCCs(final BigInteger initialDBVersion, final Optional<TimerHandler> timerHandler) {
+    void createPCCs(final Uint64 initialDBVersion, final Optional<TimerHandler> timerHandler) {
         InetAddress currentAddress = this.localAddress.getAddress();
         this.pccDispatcher = new PCCDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance()
                 .getMessageHandlerRegistry());
@@ -85,7 +85,7 @@ final class PCCsBuilder {
     }
 
     private void createPCC(final @NonNull InetSocketAddress plocalAddress,
-            final PCCTunnelManager tunnelManager, final BigInteger initialDBVersion) {
+            final PCCTunnelManager tunnelManager, final Uint64 initialDBVersion) {
         final PCEPSessionNegotiatorFactory<PCEPSessionImpl> snf = getSessionNegotiatorFactory();
         for (final InetSocketAddress pceAddress : this.remoteAddress) {
             this.pccDispatcher.createClient(pceAddress, this.reconnectTime, () -> new PCCSessionListener(
index ed02a7b157cc75d098844230c1d59aced991c772..36b127e8be2ede23e7b458c20230d496103c6fe3 100644 (file)
@@ -11,10 +11,10 @@ import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timeout;
 import io.netty.util.Timer;
 import io.netty.util.TimerTask;
-import java.math.BigInteger;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -24,11 +24,11 @@ public class TimerHandler {
     private final Timer timer = new HashedWheelTimer();
     private PCCDispatcherImpl pccDispatcher;
     private final int reconnectAfter;
-    private final Optional<BigInteger> syncOptDBVersion;
+    private final Optional<Uint64> syncOptDBVersion;
     private final PCCsBuilder pcCsBuilder;
     private boolean reconnectActive = false;
 
-    public TimerHandler(final PCCsBuilder pcCsBuilder, final Optional<BigInteger> syncOptDBVersion,
+    public TimerHandler(final PCCsBuilder pcCsBuilder, final Optional<Uint64> syncOptDBVersion,
             final int disconnectAfter, final int reconnectAfter) {
         this.pcCsBuilder = pcCsBuilder;
         this.syncOptDBVersion = syncOptDBVersion;
@@ -52,8 +52,8 @@ public class TimerHandler {
         @Override
         public void run(final Timeout timeout) {
             LOG.debug("Reconnecting PCCs}");
-            TimerHandler.this.pcCsBuilder.createPCCs(TimerHandler.this.syncOptDBVersion.isPresent()
-                    ? TimerHandler.this.syncOptDBVersion.get() : BigInteger.ONE, Optional.empty());
+            TimerHandler.this.pcCsBuilder.createPCCs(TimerHandler.this.syncOptDBVersion.orElse(Uint64.ONE),
+                Optional.empty());
         }
     }
 
index a6f56de52c4202caf5b3deafeb979d53b23fe801..7254c5012958432341b827cd78492c14e1ecd486 100644 (file)
@@ -8,20 +8,20 @@
 package org.opendaylight.protocol.pcep.pcc.mock.api;
 
 import io.netty.util.concurrent.Future;
-import java.math.BigInteger;
 import java.net.InetSocketAddress;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.PCEPSessionListenerFactory;
 import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public interface PCCDispatcher {
 
     @NonNull Future<PCEPSession> createClient(@NonNull InetSocketAddress remoteAddress,
             long reconnectTime, @NonNull PCEPSessionListenerFactory listenerFactory,
             @NonNull PCEPSessionNegotiatorFactory<? extends PCEPSession> negotiatorFactory, @NonNull KeyMapping keys,
-            @NonNull InetSocketAddress localAddress, @NonNull BigInteger dbVersion);
+            @NonNull InetSocketAddress localAddress, @NonNull Uint64 dbVersion);
 
     @NonNull Future<PCEPSession> createClient(@NonNull InetSocketAddress remoteAddress,
             long reconnectTime, @NonNull PCEPSessionListenerFactory listenerFactory,
index ea85cee57ce6e49f200a394e381376388a9e148e..0a940c198ee49950207610ca5c66db3199f464a9 100755 (executable)
@@ -23,7 +23,6 @@ import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.channel.socket.nio.NioSocketChannel;
 import io.netty.util.concurrent.Future;
-import java.math.BigInteger;
 import java.net.InetSocketAddress;
 import java.util.concurrent.ExecutionException;
 import org.eclipse.jdt.annotation.NonNull;
@@ -36,6 +35,7 @@ import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactoryDependencies;
 import org.opendaylight.protocol.pcep.impl.PCEPHandlerFactory;
 import org.opendaylight.protocol.pcep.pcc.mock.api.PCCDispatcher;
 import org.opendaylight.protocol.pcep.spi.MessageRegistry;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,14 +63,14 @@ public final class PCCDispatcherImpl implements PCCDispatcher, AutoCloseable {
             final PCEPSessionNegotiatorFactory<? extends PCEPSession> negotiatorFactory, final KeyMapping keys,
             final InetSocketAddress localAddress) {
         return createClient(remoteAddress, reconnectTime, listenerFactory, negotiatorFactory, keys, localAddress,
-                BigInteger.ONE);
+            Uint64.ONE);
     }
 
     @Override
     @SuppressWarnings("unchecked")
     public Future<PCEPSession> createClient(final InetSocketAddress remoteAddress, final long reconnectTime,
             final PCEPSessionListenerFactory listenerFactory, final PCEPSessionNegotiatorFactory negotiatorFactory,
-            final KeyMapping keys, final InetSocketAddress localAddress, final BigInteger dbVersion) {
+            final KeyMapping keys, final InetSocketAddress localAddress, final Uint64 dbVersion) {
         final Bootstrap b = new Bootstrap();
         b.group(this.workerGroup);
         b.localAddress(localAddress);
@@ -81,7 +81,7 @@ public final class PCCDispatcherImpl implements PCCDispatcher, AutoCloseable {
         final long retryTimer = reconnectTime == -1 ? 0 : reconnectTime;
         final PCCReconnectPromise promise =
                 new PCCReconnectPromise(remoteAddress, (int) retryTimer, CONNECT_TIMEOUT, b);
-        final ChannelInitializer<SocketChannel> channelInitializer = new ChannelInitializer<SocketChannel>() {
+        final ChannelInitializer<SocketChannel> channelInitializer = new ChannelInitializer<>() {
             @Override
             protected void initChannel(final SocketChannel ch) {
                 ch.pipeline().addLast(PCCDispatcherImpl.this.factory.getDecoders());
index bf0ba007ee7860d75c844a0f225af1f6f0cfa9e9..cd669290cc7c721dc58e5c27b4d1b154ab073a98 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.pcep.pcc.mock.protocol;
 
 import static java.util.Objects.requireNonNull;
 
-import java.math.BigInteger;
 import java.net.InetSocketAddress;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.protocol.pcep.PCEPPeerProposal;
@@ -18,11 +17,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.lsp.db.version.tlv.LspDbVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.lsp.db.version.tlv.LspDbVersionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public final class PCCPeerProposal implements PCEPPeerProposal {
-    private final BigInteger dbVersion;
+    private final Uint64 dbVersion;
 
-    public PCCPeerProposal(final @NonNull BigInteger dbVersion) {
+    public PCCPeerProposal(final @NonNull Uint64 dbVersion) {
         this.dbVersion = dbVersion;
     }
 
index 4fad7d06075a4d3afeff2a8b28ed2592a6e850a2..da326d5486fb5baecaa3376ff62b4b1914c54070 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.pcep.pcc.mock.protocol;
 
 import static java.util.Objects.requireNonNull;
 
-import java.math.BigInteger;
 import java.net.InetSocketAddress;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.protocol.pcep.PCEPPeerProposal;
@@ -17,12 +16,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs3Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.lsp.db.version.tlv.LspDbVersionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCServerPeerProposal implements PCEPPeerProposal {
     private boolean isAfterReconnection;
-    private final BigInteger dbVersion;
+    private final Uint64 dbVersion;
 
-    public PCCServerPeerProposal(final @NonNull BigInteger dbVersion) {
+    public PCCServerPeerProposal(final @NonNull Uint64 dbVersion) {
         this.dbVersion = dbVersion;
     }
 
index 8821935d80f508f5840534737becc8f280cfdd2c..6ea2217c923517f0a16b6d963b1aa44d21f1e8e5 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.protocol.pcep.pcc.mock.spi;
 
 import com.google.common.collect.Lists;
-import java.math.BigInteger;
 import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.List;
@@ -54,6 +53,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public final class MsgBuilderUtil {
 
@@ -73,7 +74,7 @@ public final class MsgBuilderUtil {
         return rptBuilder.build();
     }
 
-    public static Lsp createLsp(final long plspId, final boolean sync, final Optional<Tlvs> tlvs,
+    public static Lsp createLsp(final Uint32 plspId, final boolean sync, final Optional<Tlvs> tlvs,
             final boolean isDelegatedLsp, final boolean remove) {
         final LspBuilder lspBuilder = new LspBuilder();
         lspBuilder.setAdministrative(true);
@@ -88,7 +89,7 @@ public final class MsgBuilderUtil {
         return lspBuilder.build();
     }
 
-    public static Lsp createLsp(final long plspId, final boolean sync, final Optional<Tlvs> tlvs,
+    public static Lsp createLsp(final Uint32 plspId, final boolean sync, final Optional<Tlvs> tlvs,
             final boolean isDelegatedLspe) {
         return createLsp(plspId, sync, tlvs, isDelegatedLspe, false);
     }
@@ -99,7 +100,7 @@ public final class MsgBuilderUtil {
         return pathBuilder.build();
     }
 
-    public static Srp createSrp(final long srpId) {
+    public static Srp createSrp(final Uint32 srpId) {
         final SrpBuilder srpBuilder = new SrpBuilder();
         srpBuilder.setProcessingRule(false);
         srpBuilder.setIgnore(false);
@@ -124,15 +125,15 @@ public final class MsgBuilderUtil {
         return pathBuilder.build();
     }
 
-    public static Tlvs createLspTlvs(final long lspId, final boolean symbolicPathName, final String tunnelEndpoint,
+    public static Tlvs createLspTlvs(final Uint32 lspId, final boolean symbolicPathName, final String tunnelEndpoint,
             final String tunnelSender, final String extendedTunnelAddress, final Optional<byte[]> symbolicName) {
         return createLspTlvs(lspId, symbolicPathName, tunnelEndpoint, tunnelSender, extendedTunnelAddress, symbolicName,
                 Optional.empty());
     }
 
-    public static Tlvs createLspTlvs(final long lspId, final boolean symbolicPathName, final String tunnelEndpoint,
+    public static Tlvs createLspTlvs(final Uint32 lspId, final boolean symbolicPathName, final String tunnelEndpoint,
             final String tunnelSender, final String extendedTunnelAddress, final Optional<byte[]> symbolicName,
-            final Optional<BigInteger> lspDBVersion) {
+            final Optional<Uint64> lspDBVersion) {
         final TlvsBuilder tlvs = new TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder()
                 .setLspId(new LspId(lspId))
                 .setAddressFamily(
@@ -142,7 +143,7 @@ public final class MsgBuilderUtil {
                                         .setIpv4TunnelSenderAddress(new Ipv4AddressNoZone(tunnelSender))
                                         .setIpv4ExtendedTunnelId(
                                                 new Ipv4ExtendedTunnelId(extendedTunnelAddress))
-                                        .build()).build()).setTunnelId(new TunnelId((int) lspId)).build());
+                                        .build()).build()).setTunnelId(new TunnelId(lspId.intValue())).build());
         if (symbolicPathName) {
             if (symbolicName.isPresent()) {
                 tlvs.setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(
@@ -160,30 +161,41 @@ public final class MsgBuilderUtil {
         return tlvs.build();
     }
 
-    public static Optional<Tlvs> createLspTlvsEndofSync(final @NonNull BigInteger bigInteger) {
+    public static Optional<Tlvs> createLspTlvsEndofSync(final @NonNull Uint64 dbVersion) {
         final Tlvs tlvs = new TlvsBuilder().addAugmentation(Tlvs1.class, new Tlvs1Builder().setLspDbVersion(
-            new LspDbVersionBuilder().setLspDbVersionValue(bigInteger).build()).build()).build();
+            new LspDbVersionBuilder().setLspDbVersionValue(dbVersion).build()).build()).build();
         return Optional.of(tlvs);
     }
 
+    public static Pcerr createErrorMsg(final @NonNull PCEPErrors pcepErrors, final Uint32 srpId) {
+        return new PcerrBuilder()
+                .setPcerrMessage(new PcerrMessageBuilder()
+                    .setErrorType(new StatefulCaseBuilder()
+                        .setStateful(new StatefulBuilder()
+                            .setSrps(Collections.singletonList(new SrpsBuilder()
+                                .setSrp(new SrpBuilder()
+                                    .setProcessingRule(false)
+                                    .setIgnore(false)
+                                    .setOperationId(new SrpIdNumber(srpId))
+                                    .build())
+                                .build()))
+                            .build())
+                        .build())
+                    .setErrors(Collections.singletonList(new ErrorsBuilder()
+                        .setErrorObject(new ErrorObjectBuilder()
+                            .setType(pcepErrors.getErrorType())
+                            .setValue(pcepErrors.getErrorValue())
+                            .build())
+                        .build()))
+                    .build())
+                .build();
+    }
+
     public static Pcerr createErrorMsg(final @NonNull PCEPErrors pcepErrors, final long srpId) {
-        final PcerrMessageBuilder msgBuilder = new PcerrMessageBuilder();
-        return new PcerrBuilder().setPcerrMessage(
-            msgBuilder
-                .setErrorType(
-                    new StatefulCaseBuilder().setStateful(
-                        new StatefulBuilder().setSrps(
-                            Lists.newArrayList(new SrpsBuilder().setSrp(
-                                new SrpBuilder().setProcessingRule(false).setIgnore(false)
-                                    .setOperationId(new SrpIdNumber(srpId)).build())
-                                .build())).build()).build())
-                .setErrors(
-                    Collections.singletonList(new ErrorsBuilder().setErrorObject(
-                        new ErrorObjectBuilder().setType(pcepErrors.getErrorType()).setValue(pcepErrors.getErrorValue())
-                            .build()).build())).build()).build();
+        return createErrorMsg(pcepErrors, Uint32.valueOf(srpId));
     }
 
-    public static byte[] getDefaultPathName(final String address, final long lspId) {
+    public static byte[] getDefaultPathName(final String address, final Uint32 lspId) {
         return ("pcc_" + address + "_tunnel_" + lspId).getBytes(StandardCharsets.UTF_8);
     }
 
index 2b18e1a0f9634385d7fdbd1017704b8b77797cd5..8d772568c4eee88b8d90843fb489edeb8d206fb8 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCServerPeerProposal;
 import org.opendaylight.protocol.util.InetSocketAddressUtil;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCIncrementalSyncTest extends PCCMockCommon {
 
@@ -35,14 +36,14 @@ public class PCCIncrementalSyncTest extends PCCMockCommon {
     @Test
     public void testSessionIncrementalSyncEstablishment() throws Exception {
         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
-        final BigInteger numberOflspAndDBv = BigInteger.valueOf(8);
+        final Uint64 numberOflspAndDBv = Uint64.valueOf(8);
         final Channel channel = createServer(factory, this.remoteAddress, new PCCServerPeerProposal(numberOflspAndDBv));
         Main.main(this.mainInputIncrementalSync);
         final TestingSessionListener pceSessionListener = getListener(factory);
         checkSynchronizedSession(8, pceSessionListener, numberOflspAndDBv);
         Thread.sleep(6000);
         final int expetecdNumberOfLspAndEndOfSync = 3;
-        final BigInteger expectedFinalDBVersion = BigInteger.valueOf(10);
+        final Uint64 expectedFinalDBVersion = Uint64.valueOf(10);
         final TestingSessionListener sessionListenerAfterReconnect = getListener(factory);
         checkResyncSession(Optional.empty(), expetecdNumberOfLspAndEndOfSync, 3, numberOflspAndDBv,
                 expectedFinalDBVersion, sessionListenerAfterReconnect);
index 661921a737761d96254b8a7de1a44c1be815ec63..c86b59177a3cc0f0bb7fcb79afbf9967c92ea863 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static org.junit.Assert.assertEquals;
@@ -24,7 +23,6 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.Future;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.List;
@@ -60,6 +58,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp.object.Lsp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt.message.pcrpt.message.Reports;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public abstract class PCCMockCommon {
     private static final short KEEP_ALIVE = 30;
@@ -135,12 +134,12 @@ public abstract class PCCMockCommon {
     }
 
     static void checkSynchronizedSession(final int numberOfLsp,
-            final TestingSessionListener pceSessionListener, final BigInteger expectedeInitialDb) throws Exception {
+            final TestingSessionListener pceSessionListener, final Uint64 expectedeInitialDb) throws Exception {
         assertTrue(pceSessionListener.isUp());
         //Send Open with LspDBV = 1
         final int numberOfSyncMessage = 1;
         int numberOfLspExpected = numberOfLsp;
-        if (!expectedeInitialDb.equals(BigInteger.ZERO)) {
+        if (!expectedeInitialDb.equals(Uint64.ZERO)) {
             checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedeInitialDb));
             numberOfLspExpected += numberOfSyncMessage;
         }
@@ -155,7 +154,7 @@ public abstract class PCCMockCommon {
     }
 
     static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp,
-            final int expectedTotalMessages, final BigInteger startingDBVersion, final BigInteger expectedDBVersion,
+            final int expectedTotalMessages, final Uint64 startingDBVersion, final Uint64 expectedDBVersion,
             final TestingSessionListener pceSessionListener) throws Exception {
         assertNotNull(pceSessionListener.getSession());
         assertTrue(pceSessionListener.isUp());
@@ -175,7 +174,7 @@ public abstract class PCCMockCommon {
 
         assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful()
                 .augmentation(Stateful1.class).isInitiation());
-        final BigInteger pceDBVersion = session.getLocalTlvs().augmentation(Tlvs3.class)
+        final Uint64 pceDBVersion = session.getLocalTlvs().augmentation(Tlvs3.class)
                 .getLspDbVersion().getLspDbVersionValue();
         assertEquals(startingDBVersion, pceDBVersion);
     }
@@ -191,25 +190,26 @@ public abstract class PCCMockCommon {
     }
 
     protected static void checkSequequenceDBVersionSync(final TestingSessionListener pceSessionListener,
-            final BigInteger expectedDbVersion) {
+            final Uint64 expectedDbVersion) {
         for (final Message msg : pceSessionListener.messages()) {
             final List<Reports> pcrt = ((Pcrpt) msg).getPcrptMessage().getReports();
             for (final Reports report : pcrt) {
                 final Lsp lsp = report.getLsp();
-                if (lsp.getPlspId().getValue() == 0) {
+                if (lsp.getPlspId().getValue().toJava() == 0) {
                     assertEquals(false, lsp.isSync());
                 } else {
                     assertEquals(true, lsp.isSync());
                 }
-                final BigInteger actuaLspDBVersion = lsp.getTlvs().augmentation(org.opendaylight.yang.gen
-                    .v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class)
-                    .getLspDbVersion().getLspDbVersionValue();
+                final Uint64 actuaLspDBVersion = lsp.getTlvs()
+                        .augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep
+                            .sync.optimizations.rev181109.Tlvs1.class)
+                        .getLspDbVersion().getLspDbVersionValue();
                 assertEquals(expectedDbVersion, actuaLspDBVersion);
             }
         }
     }
 
-    Future<PCEPSession> createPCCSession(final BigInteger dbVersion) {
+    Future<PCEPSession> createPCCSession(final Uint64 dbVersion) {
         final PCCDispatcherImpl pccDispatcher = new PCCDispatcherImpl(this.messageRegistry);
         final PCEPSessionNegotiatorFactory<PCEPSessionImpl> snf = getSessionNegotiatorFactory();
         final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(3, this.localAddress.getAddress(),
index 475a912def7db97459ac5551a42dcfc9b7c735b0..ac4f5f0d08e5e314357d4cf8567e73b47c873a71 100644 (file)
@@ -51,6 +51,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class PCCSessionListenerTest {
 
@@ -129,7 +130,7 @@ public class PCCSessionListenerTest {
     public void testSendError() {
         final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
         listener.onSessionUp(this.mockedSession);
-        listener.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.ATTEMPT_2ND_SESSION, 0));
+        listener.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.ATTEMPT_2ND_SESSION, Uint32.ZERO));
         verify(this.mockedSession).sendMessage(Mockito.any());
     }
 
@@ -162,7 +163,7 @@ public class PCCSessionListenerTest {
         final List<Requests> requests = Lists.newArrayList();
         final RequestsBuilder reqBuilder = new RequestsBuilder()
             .setLsp(lspBuilder.build())
-            .setSrp(new SrpBuilder(MsgBuilderUtil.createSrp(123)).addAugmentation(Srp1.class,
+            .setSrp(new SrpBuilder(MsgBuilderUtil.createSrp(Uint32.valueOf(123))).addAugmentation(Srp1.class,
                 new Srp1Builder().setRemove(remove).build()).build());
         if (endpoint) {
             reqBuilder.setEndpointsObj(new EndpointsObjBuilder().build());
index 95db7568ae5758ea090339661980d87854549e3b..312c428449d8e01fa421f5df0649e7b3471a74bf 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static org.junit.Assert.assertNotNull;
 
 import io.netty.channel.Channel;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -20,6 +18,7 @@ import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
     @Test
@@ -27,13 +26,12 @@ public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
 
         final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
-        final PCEPSession session = createPCCSession(BigInteger.TEN).get();
+        final PCEPSession session = createPCCSession(Uint64.valueOf(10)).get();
         assertNotNull(session);
         final TestingSessionListener pceSessionListener = getListener(factory);
         assertNotNull(pceSessionListener);
         assertNotNull(pceSessionListener.getSession());
-        checkResyncSession(Optional.empty(), 11, 11, null,
-            BigInteger.valueOf(10), pceSessionListener);
+        checkResyncSession(Optional.empty(), 11, 11, null, Uint64.valueOf(10), pceSessionListener);
         channel.close().get();
     }
 
index 81170b7a83a22fee916a7b49ce357efbff9181a9..4a7feeb95d3b8ce2e28ea12b405055d94d98510f 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static org.junit.Assert.assertNotNull;
 
 import io.netty.channel.Channel;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -32,6 +30,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.Srp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.SrpBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCTriggeredFullDBResyncTest extends PCCMockCommon {
 
@@ -39,7 +38,7 @@ public class PCCTriggeredFullDBResyncTest extends PCCMockCommon {
     public void testSessionTriggeredFullDBReSync() throws Exception {
         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
         final int lspQuantity = 3;
-        final BigInteger numberOflspAndDBv = BigInteger.valueOf(lspQuantity);
+        final Uint64 numberOflspAndDBv = Uint64.valueOf(lspQuantity);
         final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
         final PCEPSession session = createPCCSession(numberOflspAndDBv).get();
         assertNotNull(session);
index fd11ca0cb9c57481e1e5e6961c0b00a3bf782263..6f6e5f3effaba19b113b16f237923765d9a4de10 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static org.junit.Assert.assertNotNull;
 
 import io.netty.channel.Channel;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -32,13 +30,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.Srp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.SrpBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCTriggeredLspResyncTest extends PCCMockCommon {
     @Test
     public void testSessionTriggeredLspReSync() throws Exception {
         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
         final int lspQuantity = 3;
-        final BigInteger numberOflspAndDBv = BigInteger.valueOf(lspQuantity);
+        final Uint64 numberOflspAndDBv = Uint64.valueOf(lspQuantity);
 
         final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
         final PCEPSession session = createPCCSession(numberOflspAndDBv).get();
index b4102d139b994a90fff63bb60e8f5fce670a63e1..9a85f22a12238356c7893745490b8b5528c32261 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.pcc.mock;
 
 import static org.junit.Assert.assertNotNull;
 
 import io.netty.channel.Channel;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -31,18 +29,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.Srp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.srp.object.SrpBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCCTriggeredSyncTest extends PCCMockCommon {
     @Test
     public void testSessionTriggeredSync() throws Exception {
         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
         final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
-        final BigInteger numberOflspAndDBv = BigInteger.valueOf(3);
+        final Uint64 numberOflspAndDBv = Uint64.valueOf(3);
         final PCEPSession session = createPCCSession(numberOflspAndDBv).get();
         assertNotNull(session);
         final TestingSessionListener pceSessionListener = getListener(factory);
         assertNotNull(pceSessionListener);
-        checkSynchronizedSession(0, pceSessionListener, BigInteger.ZERO);
+        checkSynchronizedSession(0, pceSessionListener, Uint64.ZERO);
         this.pccSessionListener.onMessage(session, createTriggerMsg());
         checkSynchronizedSession(3, pceSessionListener, numberOflspAndDBv);
         channel.close().get();
index 3abafc51ba1d35a474c500ff95e3da2da03d6cba..9f088433178b8ded44a2d008d6075fbc7ecfbe48 100644 (file)
@@ -30,8 +30,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.seg
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacency;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
-public abstract class AbstractSrSubobjectParser   {
+public abstract class AbstractSrSubobjectParser {
 
     protected static final int MINIMAL_LENGTH = 4;
     protected static final int BITSET_LENGTH = 8;
@@ -47,10 +48,10 @@ public abstract class AbstractSrSubobjectParser   {
         private final boolean mflag;
         private final boolean cflag;
         private final SidType sidType;
-        private final Long sid;
+        private final Uint32 sid;
         private final Nai nai;
 
-        SrSubobjectImpl(final boolean mflag, final boolean cflag, final SidType sidType, final Long sid,
+        SrSubobjectImpl(final boolean mflag, final boolean cflag, final SidType sidType, final Uint32 sid,
                 final Nai nai) {
             this.mflag = mflag;
             this.cflag = cflag;
@@ -80,7 +81,7 @@ public abstract class AbstractSrSubobjectParser   {
         }
 
         @Override
-        public Long getSid() {
+        public Uint32 getSid() {
             return this.sid;
         }
 
@@ -111,7 +112,7 @@ public abstract class AbstractSrSubobjectParser   {
                 "Both SID and NAI are absent in SR subobject.");
         if (srSubobject.getSid() != null) {
             if (srSubobject.isMFlag()) {
-                writeUnsignedInt(srSubobject.getSid() << MPLS_LABEL_OFFSET, buffer);
+                writeUnsignedInt(srSubobject.getSid().toJava() << MPLS_LABEL_OFFSET, buffer);
             } else {
                 writeUnsignedInt(srSubobject.getSid(), buffer);
             }
@@ -189,15 +190,14 @@ public abstract class AbstractSrSubobjectParser   {
         if (f && s) {
             throw new PCEPDeserializerException("Both SID and NAI are absent in SR subobject.");
         }
-        Long tmp = null;
+
+        final Uint32 sid;
         if (!s) {
-            if (m) {
-                tmp = buffer.readUnsignedInt() >>> MPLS_LABEL_OFFSET;
-            } else {
-                tmp = buffer.readUnsignedInt();
-            }
+            final long tmp = buffer.readUnsignedInt();
+            sid = Uint32.valueOf(m ? tmp >> MPLS_LABEL_OFFSET : tmp);
+        } else {
+            sid = null;
         }
-        final Long sid = tmp;
         final Nai nai;
         if (sidType != null && !f) {
             nai = parseNai(sidType, buffer);
index fa923370a00c2776e59f6232c343ede41eb779c1..3fa83d6f36ee550ac7a86a4711eec8e605bb0278 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>yang-binding</artifactId>
index 4dea524dc05f6d87699206e0912b3f1c48dde678..48b8548de73467c8d288c4feb1c8b433a6d5b34e 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.pcep.spi;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
 import java.util.Arrays;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Possible errors listed in RFC5440, RFC 5455 and stateful draft.
@@ -352,8 +353,8 @@ public enum PCEPErrors {
 
     private PCEPErrorIdentifier errorId;
 
-    public static PCEPErrors forValue(final short errorType, final short errorValue) {
-        return VALUE_MAP.get(new PCEPErrorIdentifier(errorType, errorValue));
+    public static PCEPErrors forValue(final Uint8 errorType, final Uint8 errorValue) {
+        return VALUE_MAP.get(new PCEPErrorIdentifier(errorType.toJava(), errorValue.toJava()));
     }
 
     PCEPErrors(final int type, final int value) {
index 8ffa4311c77b16733ec3d3ea3db191c4030f9039..3d0747453f49da1a1e1e66d014c25dfca0c24b42 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.protocol.pcep.spi;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public final class PSTUtil {
     private PSTUtil() {
@@ -20,8 +21,11 @@ public final class PSTUtil {
      * @return true if setup is via RSVP-TE signaling protocol
      */
     public static boolean isDefaultPST(final PathSetupType pst) {
-        if (pst != null && pst.getPst() != null && pst.getPst() != 0) {
-            return false;
+        if (pst != null) {
+            final Uint8 value = pst.getPst();
+            if (value != null && value.toJava() != 0) {
+                return false;
+            }
         }
         return true;
     }
index 35cfdaa07c96b065675919c7e2a970380c57ee91..081f53915f070d76d8c1eb055ee4274189c633ba 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import java.util.Optional;
 import org.opendaylight.protocol.concepts.HandlerRegistry;
@@ -30,7 +29,7 @@ public class SimpleVendorInformationObjectRegistry implements VendorInformationO
 
     public Registration registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber,
             final ObjectParser parser) {
-        return this.handlers.registerParser(Ints.checkedCast(enterpriseNumber.getValue()), parser);
+        return this.handlers.registerParser(enterpriseNumber.getValue().intValue(), parser);
     }
 
     public Registration registerVendorInformationObjectSerializer(
@@ -43,7 +42,7 @@ public class SimpleVendorInformationObjectRegistry implements VendorInformationO
     public Optional<? extends Object> parseVendorInformationObject(final EnterpriseNumber enterpriseNumber,
             final ObjectHeader header, final ByteBuf buffer)
             throws PCEPDeserializerException {
-        final ObjectParser parser = this.handlers.getParser(Ints.checkedCast(enterpriseNumber.getValue()));
+        final ObjectParser parser = this.handlers.getParser(enterpriseNumber.getValue().intValue());
         if (parser == null) {
             if (!header.isProcessingRule()) {
                 return Optional.empty();
index 46d2fde9b7f27735123b689c4bc14696a4b1881c..b5da4d22826e9d0c69089ce999f77f66ecf047d2 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.spi.pojo;
 
-import com.google.common.primitives.Ints;
 import io.netty.buffer.ByteBuf;
 import java.util.Optional;
 import org.opendaylight.protocol.concepts.HandlerRegistry;
@@ -27,7 +26,7 @@ public class SimpleVendorInformationTlvRegistry implements VendorInformationTlvR
 
     public Registration registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber,
             final TlvParser parser) {
-        return this.handlers.registerParser(Ints.checkedCast(enterpriseNumber.getValue()), parser);
+        return this.handlers.registerParser(enterpriseNumber.getValue().intValue(), parser);
     }
 
     public Registration registerVendorInformationTlvSerializer(
@@ -38,7 +37,7 @@ public class SimpleVendorInformationTlvRegistry implements VendorInformationTlvR
     @Override
     public Optional<VendorInformationTlv> parseVendorInformationTlv(final EnterpriseNumber enterpriseNumber,
             final ByteBuf buffer) throws PCEPDeserializerException {
-        final TlvParser parser = this.handlers.getParser(Ints.checkedCast(enterpriseNumber.getValue()));
+        final TlvParser parser = this.handlers.getParser(enterpriseNumber.getValue().intValue());
         if (parser == null) {
             return Optional.empty();
         }
index 50a345bbc9c7f9bc6fb0efdeb92219279ca4f6f7..23ee56d4af395dac901094d49f88058702948560 100644 (file)
@@ -39,6 +39,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.RepliesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.objects.VendorInformationObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.objects.VendorInformationObjectBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 @RunWith(MockitoJUnitRunner.class)
 public class AbstractMessageParserTest {
@@ -71,8 +72,8 @@ public class AbstractMessageParserTest {
                     new PcrepMessageBuilder().setReplies(Arrays.asList(repsBuilder.build())).build())
                         .build();
             } else if (objects.get(0) instanceof ErrorObject) {
-                final short errorType = ((ErrorObject) objects.get(0)).getType();
-                final short errorValue = ((ErrorObject) objects.get(0)).getValue();
+                final Uint8 errorType = ((ErrorObject) objects.get(0)).getType();
+                final Uint8 errorValue = ((ErrorObject) objects.get(0)).getValue();
                 return createErrorMsg(PCEPErrors.forValue(errorType, errorValue), Optional.empty());
             }
             return null;
index f4026048853321e35de5644a56ba6db56110ae61..71cfb6e76ceb4e28a2b4081872279f6ae98bbb31 100755 (executable)
@@ -16,6 +16,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.FutureListener;
 import java.net.InetAddress;
 import java.util.ArrayList;
@@ -447,7 +448,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements TopologyS
         final List<Path> updatedPaths;
         //lspId = 0 and remove = false -> tunnel is down, still exists but no path is signaled
         //remove existing tunnel's paths now, as explicit path remove will not come
-        if (!remove && reportedLspId.getValue() == 0) {
+        if (!remove && reportedLspId.getValue().toJava() == 0) {
             updatedPaths = new ArrayList<>();
             LOG.debug("Remove previous paths {} to this lsp name {}", previous.getPath(), name);
         } else {
@@ -456,7 +457,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements TopologyS
             LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
             for (final Path path : previous.getPath()) {
                 //we found reported path in previous reports
-                if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
+                if (path.getLspId().getValue().toJava() == 0 || path.getLspId().equals(reportedLspId)) {
                     LOG.debug("Match on lsp-id {}", path.getLspId().getValue());
                     // path that was reported previously and does have the same lsp-id, path will be updated
                     final boolean r = updatedPaths.remove(path);
@@ -470,7 +471,7 @@ public abstract class AbstractTopologySessionListener<S, L> implements TopologyS
         LOG.trace("Adding new path {} to {}", rlb.getPath(), updatedPaths);
         updatedPaths.addAll(rlb.getPath());
         if (remove) {
-            if (reportedLspId.getValue() == 0) {
+            if (reportedLspId.getValue().toJava() == 0) {
                 // if lsp-id also 0, remove all paths
                 LOG.debug("Removing all paths.");
                 updatedPaths.clear();
@@ -633,6 +634,8 @@ public abstract class AbstractTopologySessionListener<S, L> implements TopologyS
             this.requests.add(req);
         }
 
+        @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+                justification = "https://github.com/spotbugs/spotbugs/issues/811")
         private void notifyRequests() {
             for (final PCEPRequest r : this.requests) {
                 r.done(OperationResults.SUCCESS);
index 8799d7ba6d863e8e9b916bc44d6163dc44ef6cd2..ad28c5b8a077682af7dcde7e017ce1fa1b8a623d 100644 (file)
@@ -230,7 +230,7 @@ class Stateful07TopologySessionListener extends AbstractTopologySessionListener<
             final StatefulCase stat = (StatefulCase) errMsg.getErrorType();
             for (final Srps srps : stat.getStateful().getSrps()) {
                 final SrpIdNumber id = srps.getSrp().getOperationId();
-                if (id.getValue() != 0) {
+                if (id.getValue().toJava() != 0) {
                     final PCEPRequest req = removeRequest(id);
                     if (req != null) {
                         req.done(OperationResults.createFailed(errMsg.getErrors()));
@@ -251,7 +251,7 @@ class Stateful07TopologySessionListener extends AbstractTopologySessionListener<
             return false;
         }
         final SrpIdNumber id = srp.getOperationId();
-        if (id.getValue() == 0) {
+        if (id.getValue().toJava() == 0) {
             return false;
         }
         switch (lsp.getOperational()) {
@@ -285,14 +285,14 @@ class Stateful07TopologySessionListener extends AbstractTopologySessionListener<
         final PlspId plspid = lsp.getPlspId();
         final Srp srp = report.getSrp();
 
-        if (!lsp.isSync() && (plspid == null || plspid.getValue() == 0)) {
+        if (!lsp.isSync() && (plspid == null || plspid.getValue().toJava() == 0)) {
             purgeStaleLsps(ctx);
             if (isTriggeredSyncInProcess()) {
                 if (srp == null) {
                     return false;
                 }
                 final SrpIdNumber id = srp.getOperationId();
-                if (id.getValue() == 0) {
+                if (id.getValue().toJava() == 0) {
                     return false;
                 }
                 final PCEPRequest req = removeRequest(id);
@@ -440,6 +440,8 @@ class Stateful07TopologySessionListener extends AbstractTopologySessionListener<
         return rb.build();
     }
 
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private ListenableFuture<OperationResult> redelegate(final Lsp reportedLsp, final Srp srp, final Lsp lsp,
             final UpdateLspArgs input) {
         // the D bit that was reported decides the type of PCE message sent
index 0ab194a7cef214855f1ee1237d0c9d0166fa7f6d..b38582dc9e2d9b8f6c657f355ce1d4ffeb68094b 100644 (file)
@@ -144,14 +144,14 @@ public final class PCEPTopologyProviderBean implements PCEPTopologyProviderDepen
             properties.put(PCEPTopologyProvider.class.getName(), configDependencies.getTopologyId().getValue());
             this.serviceRegistration = bean.bundleContext
                     .registerService(DefaultTopologyReference.class.getName(), this.pcepTopoProvider, properties);
-            LOG.info("PCEP Topology Provider service {} registered", getIdentifier().getValue());
+            LOG.info("PCEP Topology Provider service {} registered", getIdentifier().getName());
             this.cssRegistration = bean.cssp.registerClusterSingletonService(this);
         }
 
         @Override
         @SuppressWarnings("checkstyle:IllegalCatch")
         public synchronized void instantiateServiceInstance() {
-            LOG.info("PCEP Topology Provider Singleton Service {} instantiated", getIdentifier().getValue());
+            LOG.info("PCEP Topology Provider Singleton Service {} instantiated", getIdentifier().getName());
             try {
                 this.pcepTopoProvider.instantiateServiceInstance();
             } catch (final Exception e) {
@@ -162,7 +162,7 @@ public final class PCEPTopologyProviderBean implements PCEPTopologyProviderDepen
 
         @Override
         public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
-            LOG.info("Close PCEP Topology Provider Singleton Service {}", getIdentifier().getValue());
+            LOG.info("Close PCEP Topology Provider Singleton Service {}", getIdentifier().getName());
             if (this.serviceInstantiated) {
                 this.serviceInstantiated = false;
                 return this.pcepTopoProvider.closeServiceInstance();
index a7207c7a45806a5dc402e7fb036e572e3db9e528..9ae63ede24281eeb836787452b3c909ade389e0e 100644 (file)
@@ -56,7 +56,7 @@ final class PCEPTopologyProviderUtil {
     }
 
     static InetSocketAddress getInetSocketAddress(final @NonNull IpAddress address, final @NonNull PortNumber port) {
-        return new InetSocketAddress(IetfInetUtil.INSTANCE.inetAddressFor(address), port.getValue());
+        return new InetSocketAddress(IetfInetUtil.INSTANCE.inetAddressFor(address), port.getValue().toJava());
     }
 
     static boolean filterPcepTopologies(final @Nullable TopologyTypes topologyTypes) {
index 725f34d3d287f83d357dea9d6463fa8f4018c659..db372ae447f024b9c8129144b4f116560252aa2b 100644 (file)
@@ -37,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.sta
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTimeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open;
+import org.opendaylight.yangtools.yang.common.Uint16;
 
 public final class SessionStateImpl implements PcepSessionState {
     private final LongAdder lastReceivedRptMsgTimestamp = new LongAdder();
@@ -109,6 +110,7 @@ public final class SessionStateImpl implements PcepSessionState {
         }
     }
 
+    @Override
     public synchronized String getSessionDuration() {
         return StatisticsUtil.formatElapsedTime(this.sessionUpDuration.elapsed(TimeUnit.SECONDS));
     }
@@ -173,8 +175,8 @@ public final class SessionStateImpl implements PcepSessionState {
     }
 
     @Override
-    public Integer getDelegatedLspsCount() {
-        return this.topologySessionStats.getDelegatedLspsCount();
+    public Uint16 getDelegatedLspsCount() {
+        return Uint16.valueOf(this.topologySessionStats.getDelegatedLspsCount());
     }
 
     @Override
index 0bdc5c3646c60c9fe0c88a1a51d7c8e7e6997c20..c7b843a9e31ed2422aa593ade73e80b75461a553 100644 (file)
@@ -14,7 +14,6 @@ import static org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createL
 import static org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createPath;
 import static org.opendaylight.protocol.util.CheckTestUtil.readDataOperational;
 
-import java.math.BigInteger;
 import java.util.Collections;
 import java.util.Optional;
 import org.junit.Before;
@@ -42,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.PccSyncState;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class IncrementalSynchronizationProcedureTest
         extends AbstractPCEPSessionTest<Stateful07TopologySessionListenerFactory> {
@@ -60,7 +61,7 @@ public class IncrementalSynchronizationProcedureTest
         PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
         this.listener.onSessionUp(session);
         //report LSP + LSP-DB version number
-        final Pcrpt pcRpt = getPcrpt(1L, "test");
+        final Pcrpt pcRpt = getPcrpt(Uint32.ONE, "test");
         this.listener.onMessage(session, pcRpt);
         readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
             assertFalse(pcc.getReportedLsp().isEmpty());
@@ -72,7 +73,7 @@ public class IncrementalSynchronizationProcedureTest
 
         //session up - expect sync (LSP-DBs do not match)
         final LspDbVersion localDbVersion = new LspDbVersionBuilder()
-                .setLspDbVersionValue(BigInteger.valueOf(2L)).build();
+                .setLspDbVersionValue(Uint64.valueOf(2L)).build();
         session = getPCEPSession(getOpen(localDbVersion), getOpen(null));
         this.listener.onSessionUp(session);
         readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
@@ -84,7 +85,7 @@ public class IncrementalSynchronizationProcedureTest
         });
 
         //report LSP2 + LSP-DB version number 2
-        final Pcrpt pcRpt2 = getPcrpt(2L,"testsecond");
+        final Pcrpt pcRpt2 = getPcrpt(Uint32.valueOf(2), "testsecond");
         this.listener.onMessage(session, pcRpt2);
         readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
             //check node - synchronized
@@ -106,7 +107,7 @@ public class IncrementalSynchronizationProcedureTest
         });
 
         //report LSP3 + LSP-DB version number 4
-        final Pcrpt pcRpt3 = getPcrpt(3L,"testthird");
+        final Pcrpt pcRpt3 = getPcrpt(Uint32.valueOf(3), "testthird");
         this.listener.onMessage(session, pcRpt3);
         readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
             //check node - synchronized
@@ -128,7 +129,7 @@ public class IncrementalSynchronizationProcedureTest
             .build()).build();
     }
 
-    private Pcrpt getPcrpt(final Long val, final String pathname) {
+    private static Pcrpt getPcrpt(final Uint32 val, final String pathname) {
         return MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(val)).setTlvs(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                     .object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder()
@@ -137,20 +138,20 @@ public class IncrementalSynchronizationProcedureTest
                     pathname.getBytes())).build()).addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params
                 .xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class, new org.opendaylight.yang.gen.v1
                     .urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1Builder()
-                .setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(val)).build())
+                .setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.valueOf(val)).build())
                 .build()).build()).setPlspId(new PlspId(val)
         ).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.empty(),
             createPath(Collections.emptyList()));
     }
 
-    private Pcrpt getSyncPcrt() {
-        return MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(
+    private static Pcrpt getSyncPcrt() {
+        return MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109
                         .lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
                                 .params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class,
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
                                 .optimizations.rev181109.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder()
-                                .setLspDbVersionValue(BigInteger.valueOf(3L)).build()).build()).build()),
+                                .setLspDbVersionValue(Uint64.valueOf(3L)).build()).build()).build()),
                 true, false), Optional.empty(),
                 createPath(Collections.emptyList()));
     }
index 1ee9d05fd08ba4526d3893dcd5282a4c94254afc..ea78b967bf0f81e9f53c4fe04fdc6407b61be457 100644 (file)
@@ -48,6 +48,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.PccSyncState;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.TriggerSyncInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.pcep.client.attributes.path.computation.client.ReportedLsp;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCEPTriggeredReSynchronizationProcedureTest
         extends AbstractPCEPSessionTest<Stateful07TopologySessionListenerFactory> {
@@ -182,33 +184,33 @@ public class PCEPTriggeredReSynchronizationProcedureTest
             .setLspDbVersion(this.lspDbVersion).build()).build()).build();
     }
 
-    private Pcrpt getSyncMsg() {
+    private static Pcrpt getSyncMsg() {
         final SrpBuilder srpBuilder = new SrpBuilder();
         // not sue whether use 0 instead of nextRequest() or do not insert srp == SRP-ID-number = 0
-        srpBuilder.setOperationId(new SrpIdNumber(1L));
-        return MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(
+        srpBuilder.setOperationId(new SrpIdNumber(Uint32.ONE));
+        return MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                         .object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params
                                 .xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class,
                     new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
                             .optimizations.rev181109.Tlvs1Builder()
-                        .setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(3L))
+                        .setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.valueOf(3L))
                                 .build()).build()).build()), true, false),
                             Optional.of(srpBuilder.build()), createPath(Collections.emptyList()));
     }
 
-    private Pcrpt getPcrt() {
-        return MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(
+    private static Pcrpt getPcrt() {
+        return MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(Uint32.ONE)).setTlvs(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                         .object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder()
-                        .setLspId(new LspId(1L)).build()).setSymbolicPathName(
+                        .setLspId(new LspId(Uint32.ONE)).build()).setSymbolicPathName(
                     new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("test".getBytes())).build())
                     .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep
                                     .sync.optimizations.rev181109.Tlvs1.class,
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
                                 .optimizations.rev181109.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder()
-                                .setLspDbVersionValue(BigInteger.ONE).build()).build()).build())
-                .setPlspId(new PlspId(1L)).setSync(true).setRemove(false)
+                                .setLspDbVersionValue(Uint64.ONE).build()).build()).build())
+                .setPlspId(new PlspId(Uint32.ONE)).setSync(true).setRemove(false)
                         .setOperational(OperationalStatus.Active).build(), Optional.empty(),
             createPath(Collections.emptyList()));
     }
index c3826c547dc1d872ba96706ff6e470ab7827abf8..0c49ebc3b192e3aaa8ad4f7860b7ce2c2dddb073 100644 (file)
@@ -43,6 +43,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.PccSyncState;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class PCETriggeredInitialSyncProcedureTest
         extends AbstractPCEPSessionTest<Stateful07TopologySessionListenerFactory> {
@@ -114,28 +116,28 @@ public class PCETriggeredInitialSyncProcedureTest
                 .build()).build();
     }
 
-    private Pcrpt getsyncMsg() {
-        return MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(
+    private static Pcrpt getsyncMsg() {
+        return MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                     .object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params
                         .xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class, new org.opendaylight
                         .yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109
-                        .Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger
+                        .Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64
                         .valueOf(2L)).build()).build()).build()), true, false), Optional.empty(),
                         createPath(Collections.emptyList()));
     }
 
-    private Pcrpt getPcrpt() {
-        return MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(
+    private static Pcrpt getPcrpt() {
+        return MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(Uint32.ONE)).setTlvs(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.lsp
                         .object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder()
-                        .setLspId(new LspId(1L)).build()).setSymbolicPathName(new SymbolicPathNameBuilder()
+                        .setLspId(new LspId(Uint32.ONE)).build()).setSymbolicPathName(new SymbolicPathNameBuilder()
                         .setPathName(new SymbolicPathName("test".getBytes())).build()).addAugmentation(org.opendaylight
                         .yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109
                         .Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller
                         .pcep.sync.optimizations.rev181109.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder()
-                        .setLspDbVersionValue(BigInteger.valueOf(3L)).build())
-                        .build()).build()).setPlspId(new PlspId(1L)).setSync(true).setRemove(false)
+                        .setLspDbVersionValue(Uint64.valueOf(3L)).build())
+                        .build()).build()).setPlspId(new PlspId(Uint32.ONE)).setSync(true).setRemove(false)
                 .setOperational(OperationalStatus.Active).build(), Optional.empty(),
                 createPath(Collections.emptyList()));
     }
index d7f5c0b9b0050ac40563684b4baeec6678037226..2d1165c21e57fd0fb828aae2c0e6ef0b186d9ce7 100644 (file)
@@ -45,6 +45,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.PccSyncState;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
 
 public class StateSynchronizationAvoidanceProcedureTest extends
     AbstractPCEPSessionTest<Stateful07TopologySessionListenerFactory> {
@@ -69,10 +71,10 @@ public class StateSynchronizationAvoidanceProcedureTest extends
                                 .xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class,
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
                                 .optimizations.rev181109.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder()
-                                .setLspDbVersionValue(BigInteger.ONE).build()).build()).build())
-                        .setPlspId(new PlspId(1L)).setSync(false).setRemove(false)
+                                .setLspDbVersionValue(Uint64.ONE).build()).build()).build())
+                        .setPlspId(new PlspId(Uint32.ONE)).setSync(false).setRemove(false)
                         .setOperational(OperationalStatus.Active).build(),
-                Optional.of(MsgBuilderUtil.createSrp(1L)), null);
+                Optional.of(MsgBuilderUtil.createSrp(Uint32.ONE)), null);
         this.listener.onMessage(session, pcRpt);
         //check topology
         readDataOperational(getDataBroker(), this.pathComputationClientIId.builder()
@@ -144,13 +146,13 @@ public class StateSynchronizationAvoidanceProcedureTest extends
         });
 
         //sync rpt + LSP-DB
-        final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(
+        final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109
                         .lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight
                                 .params.xml.ns.yang.controller.pcep.sync.optimizations.rev181109.Tlvs1.class,
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
                                 .optimizations.rev181109.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder()
-                                .setLspDbVersionValue(BigInteger.valueOf(2L)).build()).build()).build()),
+                                .setLspDbVersionValue(Uint64.valueOf(2L)).build()).build()).build()),
                 true, false), Optional.empty(),
                 createPath(Collections.emptyList()));
         this.listener.onMessage(session, syncMsg);
index c6e99a66353520d6fec7e39d03ee73c1dba67202..d95706ee4dbf83bf9a0cb098dc7d2d94df890226 100755 (executable)
@@ -99,6 +99,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.pcep.client.attributes.path.computation.client.ReportedLsp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev181109.pcep.client.attributes.path.computation.client.reported.lsp.Path;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class Stateful07TopologySessionListenerTest
         extends AbstractPCEPSessionTest<Stateful07TopologySessionListenerFactory> {
@@ -142,7 +143,7 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp())
@@ -150,7 +151,7 @@ public class Stateful07TopologySessionListenerTest
                         .setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)),
                 MsgBuilderUtil.createPath(req.getEro().getSubobject()));
         final Pcrpt esm = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setSync(false).build(),
-                Optional.of(MsgBuilderUtil.createSrp(0L)), null);
+                Optional.of(MsgBuilderUtil.createSrp(Uint32.ZERO)), null);
         this.listener.onMessage(this.session, esm);
         readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
             assertEquals(this.testAddress, pcc.getIpAddress().getIpv4Address().getValue());
@@ -176,7 +177,7 @@ public class Stateful07TopologySessionListenerTest
         checkEquals(() -> assertEquals(1, listenerState.getDelegatedLspsCount().intValue()));
         checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
         checkEquals(() -> assertTrue(listenerState.getMessages()
-                .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
+                .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp().toJava() > 0));
         checkEquals(() -> assertEquals(2, listenerState.getMessages()
                 .augmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
         checkEquals(() -> assertEquals(1, listenerState.getMessages()
@@ -199,7 +200,7 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(1) instanceof Pcupd);
         final Pcupd updateMsg = (Pcupd) this.receivedMsgs.get(1);
         final Updates upd = updateMsg.getPcupdMessage().getUpdates().get(0);
-        final long srpId2 = upd.getSrp().getOperationId().getValue();
+        final Uint32 srpId2 = upd.getSrp().getOperationId().getValue();
         final Tlvs tlvs2 = createLspTlvs(upd.getLsp().getPlspId().getValue(), false,
                 this.newDestinationAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt2 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(upd.getLsp()).setTlvs(tlvs2)
@@ -221,13 +222,13 @@ public class Stateful07TopologySessionListenerTest
             assertTrue(this.listener.isSessionSynchronized());
             final StatefulMessagesStatsAug statefulstate = listenerState.getMessages()
                     .augmentation(StatefulMessagesStatsAug.class);
-            assertTrue(statefulstate.getLastReceivedRptMsgTimestamp() > 0);
+            assertTrue(statefulstate.getLastReceivedRptMsgTimestamp().toJava() > 0);
             assertEquals(3, statefulstate.getReceivedRptMsgCount().intValue());
             assertEquals(1, statefulstate.getSentInitMsgCount().intValue());
             assertEquals(1, statefulstate.getSentUpdMsgCount().intValue());
             final ReplyTime replyTime = listenerState.getMessages().getReplyTime();
-            assertTrue(replyTime.getAverageTime() > 0);
-            assertTrue(replyTime.getMaxTime() > 0);
+            assertTrue(replyTime.getAverageTime().toJava() > 0);
+            assertTrue(replyTime.getMaxTime().toJava() > 0);
             final StatefulCapabilitiesStatsAug statefulCapabilities = listenerState
                     .getPeerCapabilities().augmentation(StatefulCapabilitiesStatsAug.class);
             assertFalse(statefulCapabilities.isActive());
@@ -257,7 +258,7 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(2) instanceof Pcinitiate);
         final Pcinitiate pcinitiate2 = (Pcinitiate) this.receivedMsgs.get(2);
         final Requests req2 = pcinitiate2.getPcinitiateMessage().getRequests().get(0);
-        final long srpId3 = req2.getSrp().getOperationId().getValue();
+        final Uint32 srpId3 = req2.getSrp().getOperationId().getValue();
         final Tlvs tlvs3 = createLspTlvs(req2.getLsp().getPlspId().getValue(), false,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt3 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req2.getLsp()).setTlvs(tlvs3)
@@ -274,7 +275,7 @@ public class Stateful07TopologySessionListenerTest
         checkEquals(() -> assertEquals(0, listenerState.getDelegatedLspsCount().intValue()));
         checkEquals(() -> assertTrue(this.listener.isSessionSynchronized()));
         checkEquals(() -> assertTrue(listenerState.getMessages()
-                .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp() > 0));
+                .augmentation(StatefulMessagesStatsAug.class).getLastReceivedRptMsgTimestamp().toJava() > 0));
         checkEquals(() -> assertEquals(4, listenerState.getMessages()
                 .augmentation(StatefulMessagesStatsAug.class).getReceivedRptMsgCount().intValue()));
         checkEquals(() -> assertEquals(2, listenerState.getMessages()
@@ -294,7 +295,7 @@ public class Stateful07TopologySessionListenerTest
 
     @Test
     public void testOnErrorMessage() throws InterruptedException, ExecutionException {
-        final Message errorMsg = MsgBuilderUtil.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, 1L);
+        final Message errorMsg = MsgBuilderUtil.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, Uint32.ONE);
         this.listener.onSessionUp(this.session);
         final Future<RpcResult<AddLspOutput>> futureOutput = this.topologyRpcs.addLsp(createAddLspInput());
         this.listener.onMessage(this.session, errorMsg);
@@ -392,7 +393,7 @@ public class Stateful07TopologySessionListenerTest
         this.topologyRpcs.addLsp(createAddLspInput());
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(true)
@@ -416,7 +417,7 @@ public class Stateful07TopologySessionListenerTest
         this.topologyRpcs.addLsp(createAddLspInput());
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(true)
@@ -455,7 +456,7 @@ public class Stateful07TopologySessionListenerTest
         this.topologyRpcs.addLsp(createAddLspInput());
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(true)
@@ -534,11 +535,11 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs)
-                .setPlspId(new PlspId(1L))
+                .setPlspId(new PlspId(Uint32.ONE))
                 .setSync(false)
                 .setRemove(false)
                 .setOperational(OperationalStatus.Active)
@@ -583,7 +584,7 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         //delegate set to true
@@ -607,13 +608,12 @@ public class Stateful07TopologySessionListenerTest
         assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
         final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
         final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
-        final long srpId = req.getSrp().getOperationId().getValue();
+        final Uint32 srpId = req.getSrp().getOperationId().getValue();
         final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
                 this.testAddress, this.testAddress, this.testAddress, Optional.empty());
         //delegate set to false
         final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs)
-                        .setPlspId(
-                                new PlspId(1L))
+                        .setPlspId(new PlspId(Uint32.ONE))
                         .setSync(false)
                         .setRemove(false)
                         .setOperational(OperationalStatus.Active)
index d3ff3eef50c8d5738b765bb256bf1b144e6c7bb5..6aaac4560ee53b974cbbb6149cd1457e638144fa 100644 (file)
@@ -12,6 +12,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.TimerTask;
@@ -73,6 +74,8 @@ public final class TopologyStatsProviderImpl implements TransactionChainListener
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void updatePcepStats() {
         final WriteTransaction tx = TopologyStatsProviderImpl.this.transactionChain.newWriteOnlyTransaction();
 
index ee8e415917584673f85fc0a0c325f8ff2d10b9e1..76b83288b5d2a7817d1add10be7058ad3478cb89 100644 (file)
@@ -221,11 +221,11 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
             }
         }
 
-        private Node getNode() {
+        Node getNode() {
             return (Node) read(this.nii);
         }
 
-        private TerminationPoint getTp() {
+        TerminationPoint getTp() {
             return (TerminationPoint) read(this.tii);
         }
     }
index 479e43ec50b06e1751eda9bbef04187dd209aa8d..42ba385acef3937f11ec1206aa580bf5b57712ba 100644 (file)
@@ -94,14 +94,14 @@ public final class PCEPTunnelClusterSingletonService implements ClusterSingleton
         this.serviceRegistration = dependencies.getBundleContext()
                 .registerService(DefaultTopologyReference.class.getName(), this.ttp, properties);
 
-        LOG.info("PCEP Tunnel Cluster Singleton service {} registered", getIdentifier().getValue());
+        LOG.info("PCEP Tunnel Cluster Singleton service {} registered", getIdentifier().getName());
         this.pcepTunnelCssReg = dependencies.getCssp().registerClusterSingletonService(this);
     }
 
 
     @Override
     public synchronized void instantiateServiceInstance() {
-        LOG.info("Instantiate PCEP Tunnel Topology Provider Singleton Service {}", getIdentifier().getValue());
+        LOG.info("Instantiate PCEP Tunnel Topology Provider Singleton Service {}", getIdentifier().getName());
 
         final InstanceIdentifier<Topology> topology = InstanceIdentifier
                 .builder(NetworkTopology.class).child(Topology.class, new TopologyKey(this.tunnelTopologyId)).build();
@@ -114,7 +114,7 @@ public final class PCEPTunnelClusterSingletonService implements ClusterSingleton
     @Override
     public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
         LOG.info("Close Service Instance PCEP Tunnel Topology Provider Singleton Service {}",
-                getIdentifier().getValue());
+                getIdentifier().getName());
         this.reg.close();
         this.tp.close();
         this.ttp.close();
@@ -129,13 +129,13 @@ public final class PCEPTunnelClusterSingletonService implements ClusterSingleton
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
     public synchronized void close() {
-        LOG.info("Close PCEP Tunnel Topology Provider Singleton Service {}", getIdentifier().getValue());
+        LOG.info("Close PCEP Tunnel Topology Provider Singleton Service {}", getIdentifier().getName());
 
         if (this.pcepTunnelCssReg != null) {
             try {
                 this.pcepTunnelCssReg.close();
             } catch (final Exception e) {
-                LOG.debug("Failed to close PCEP Tunnel Topology service {}", this.sgi.getValue(), e);
+                LOG.debug("Failed to close PCEP Tunnel Topology service {}", this.sgi.getName(), e);
             }
             this.pcepTunnelCssReg = null;
         }
index e4cd2154b9e0f4f767501f6a54be68c8fca943a0..2c9bb3c19b74e50f641284e1fa2688f1b5abaaca 100644 (file)
@@ -20,7 +20,7 @@ public class NanotimeUtilTest {
 
     @Test
     public void testCurrentTime() {
-        assertTrue(NanotimeUtil.currentTime().getValue().divide(BigInteger.valueOf(1000000)).subtract(
+        assertTrue(NanotimeUtil.currentTime().getValue().toJava().divide(BigInteger.valueOf(1000000)).subtract(
                 BigInteger.valueOf(System.currentTimeMillis())).shortValue() <= 0);
     }
 
index b0f62cebec19541750530a0677f2bfd2041da5db..6eac0eabe0a3ad3a88415c740fb3b470885201da 100644 (file)
@@ -169,13 +169,13 @@ public final class ProgrammingServiceImpl implements ClusterSingletonService, In
         this.qid = KeyedInstanceIdentifier.builder(InstructionsQueue.class,
                 new InstructionsQueueKey(this.instructionId)).build();
         this.sgi = ServiceGroupIdentifier.create(this.instructionId + "-service-group");
-        LOG.info("Creating Programming Service {}.", this.sgi.getValue());
+        LOG.info("Creating Programming Service {}.", this.sgi.getName());
         this.csspReg = cssp.registerClusterSingletonService(this);
     }
 
     @Override
     public synchronized void instantiateServiceInstance() {
-        LOG.info("Instruction Queue service {} instantiated", this.sgi.getValue());
+        LOG.info("Instruction Queue service {} instantiated", this.sgi.getName());
         this.reg = this.rpcProviderRegistry.registerRpcImplementation(ProgrammingService.class, this);
 
         final WriteTransaction wt = this.dataProvider.newWriteOnlyTransaction();
@@ -329,7 +329,7 @@ public final class ProgrammingServiceImpl implements ClusterSingletonService, In
 
         // First things first: check the deadline
         final Nanotime now = NanotimeUtil.currentTime();
-        final BigInteger left = input.getDeadline().getValue().subtract(now.getValue());
+        final BigInteger left = input.getDeadline().getValue().toJava().subtract(now.getValue().toJava());
 
         if (left.compareTo(BigInteger.ZERO) <= 0) {
             LOG.debug("Instruction {} deadline has already passed by {}ns", id, left);
@@ -417,7 +417,7 @@ public final class ProgrammingServiceImpl implements ClusterSingletonService, In
 
     @Override
     public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
-        LOG.info("Closing Instruction Queue service {}", this.sgi.getValue());
+        LOG.info("Closing Instruction Queue service {}", this.sgi.getName());
 
         if (this.reg != null) {
             this.reg.close();
index 86852ba617282ae020328c4f08639ecd77e5d412..2b1996568c7087cabb8ec724661c7f00399b2e4a 100644 (file)
@@ -224,7 +224,7 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
         final BigInteger deadlineOffset = BigInteger.valueOf(
                 1000L * 1000 * 1000 * INSTRUCTION_DEADLINE_OFFSET_IN_SECONDS /* seconds */);
         final Nanotime current = NanotimeUtil.currentTime();
-        final Nanotime deadlineNano = new Nanotime(current.getValue().add(deadlineOffset));
+        final Nanotime deadlineNano = new Nanotime(current.getValue().toJava().add(deadlineOffset));
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
@@ -244,7 +244,7 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
         final BigInteger deadlineOffset = BigInteger.valueOf(
                 1000L * 1000 * 1000 * INSTRUCTION_DEADLINE_OFFSET_IN_SECONDS /* seconds */);
         final Nanotime current = NanotimeUtil.currentTime();
-        final Nanotime deadlineNano = new Nanotime(current.getValue().add(deadlineOffset));
+        final Nanotime deadlineNano = new Nanotime(current.getValue().toJava().add(deadlineOffset));
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
@@ -269,7 +269,7 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
         final BigInteger deadlineOffset = BigInteger.valueOf(
                 1000L * 1000 * 1000 * INSTRUCTION_DEADLINE_OFFSET_IN_SECONDS /* seconds */);
         final Nanotime current = NanotimeUtil.currentTime();
-        final Nanotime deadlineNano = new Nanotime(current.getValue().add(deadlineOffset));
+        final Nanotime deadlineNano = new Nanotime(current.getValue().toJava().add(deadlineOffset));
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
index 59fc7df469ddc4b140b5ea299ca5270edb89b555..a139a1ed503f6c6c1c85d28ec45676f60b4cd627 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.bgpcep.programming.spi;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.submit.instruction.output.result.failure._case.Failure;
 
 public class SchedulerException extends Exception {
+    private static final long serialVersionUID = 1L;
+
     private final Failure failure;
 
     public SchedulerException(final String message, final Failure failure) {
index 9db92e3a69170ec27bbed484f81ca79c62edc3f2..4202d619adfa764a81e457e08088bd5e72b27110 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.bgpcep.programming.spi;
 
-import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
@@ -34,7 +34,7 @@ public final class SuccessfulRpcResult<T> implements RpcResult<T> {
     }
 
     @Override
-    public Collection<RpcError> getErrors() {
+    public List<RpcError> getErrors() {
         return Collections.emptyList();
     }
 }
\ No newline at end of file
index 54191f27b54ba899d1129bad59fb7d2440f14054..ade5b7fe820d99f9a0469fda101517ea6cb885ac 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991-ietf-inet-types</artifactId>
index 2cf71840c5f93b510d77d9513b0f91ea593b7416..e99725fb50feda13b8d68fe4de2938423e3ac307 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.exclude.route.object.SubobjectContainer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.exclude.route.object.SubobjectContainerBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Parser for {@link SrlgCase}.
@@ -63,7 +64,7 @@ public class XROSrlgSubobjectParser implements XROSubobjectParser, XROSubobjectS
         Preconditions.checkArgument(specObj.getSrlgId() != null, "SrlgId is mandatory.");
         writeUnsignedInt(specObj.getSrlgId().getValue(), body);
         Preconditions.checkArgument(subobject.getAttribute() != null, "Attribute is mandatory.");
-        writeUnsignedByte(null, body);
+        writeUnsignedByte((Uint8) null, body);
         writeUnsignedByte((short) subobject.getAttribute().getIntValue(), body);
         XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
     }
index 5498839295374c22db1a7cc677a24decd5caa161..003e9640eaca10816782c3b0a27fc4fb433906c3 100644 (file)
@@ -37,12 +37,12 @@ public abstract class AbstractAssociationParser extends AbstractRSVPObjectParser
         if (assObject.getIpAddress().getIpv4AddressNoZone() != null) {
             serializeAttributeHeader(BODY_SIZE_IPV4, CLASS_NUM, CTYPE_IPV4, output);
             output.writeShort(assObject.getAssociationType().getIntValue());
-            output.writeShort(assObject.getAssociationId());
+            output.writeShort(assObject.getAssociationId().toJava());
             output.writeBytes(Ipv4Util.byteBufForAddress(assObject.getIpAddress().getIpv4AddressNoZone()));
         } else {
             serializeAttributeHeader(BODY_SIZE_IPV6, CLASS_NUM, CTYPE_IPV6, output);
             output.writeShort(assObject.getAssociationType().getIntValue());
-            output.writeShort(assObject.getAssociationId());
+            output.writeShort(assObject.getAssociationId().toJava());
             output.writeBytes(Ipv6Util.byteBufForAddress(assObject.getIpAddress().getIpv6AddressNoZone()));
         }
     }
index 1b4be74f384c8bb0cb7d8ec3ce11fdbec700d63f..3dbb69c1c2da4c16a27385b6f90b429b04b96c36 100644 (file)
@@ -45,9 +45,9 @@ public final class FastRerouteObjectParser extends AbstractRSVPObjectParser {
         final BasicFastRerouteObject fastRerouteObject = (BasicFastRerouteObject) teLspObject;
 
         serializeAttributeHeader(BODY_SIZE_C1, CLASS_NUM, CTYPE, byteAggregator);
-        byteAggregator.writeByte(fastRerouteObject.getSetupPriority());
-        byteAggregator.writeByte(fastRerouteObject.getHoldPriority());
-        byteAggregator.writeByte(fastRerouteObject.getHopLimit());
+        byteAggregator.writeByte(fastRerouteObject.getSetupPriority().toJava());
+        byteAggregator.writeByte(fastRerouteObject.getHoldPriority().toJava());
+        byteAggregator.writeByte(fastRerouteObject.getHopLimit().toJava());
         byteAggregator.writeByte(fastRerouteObject.getFlags().getIntValue());
         byteAggregator.writeBytes(Unpooled.wrappedBuffer(fastRerouteObject.getBandwidth().getValue()));
         writeAttributeFilter(fastRerouteObject.getIncludeAny(), byteAggregator);
index 53e3688a26ca0b6c3507b7299791d3f6b80543ab..c71661d7eac94d4fa459bcb56664afa76dfcee4f 100644 (file)
@@ -48,9 +48,9 @@ public final class InformationalFastRerouteObjectParser extends AbstractRSVPObje
         final LegacyFastRerouteObject fastRerouteObject = (LegacyFastRerouteObject) teLspObject;
         serializeAttributeHeader(BODY_SIZE_C7, CLASS_NUM, CTYPE, byteAggregator);
 
-        byteAggregator.writeByte(fastRerouteObject.getSetupPriority());
-        byteAggregator.writeByte(fastRerouteObject.getHoldPriority());
-        byteAggregator.writeByte(fastRerouteObject.getHopLimit());
+        byteAggregator.writeByte(fastRerouteObject.getSetupPriority().toJava());
+        byteAggregator.writeByte(fastRerouteObject.getHoldPriority().toJava());
+        byteAggregator.writeByte(fastRerouteObject.getHopLimit().toJava());
         byteAggregator.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
         byteAggregator.writeBytes(Unpooled.wrappedBuffer(fastRerouteObject.getBandwidth().getValue()));
         writeAttributeFilter(fastRerouteObject.getIncludeAny(), byteAggregator);
index a43f521d09bad7aa6ec2264429b6114b4dbf6ddd..690a611dcd385e572feedfcfb38c37f0cc8f4a4d 100644 (file)
@@ -51,7 +51,7 @@ public final class MetricObjectParser extends AbstractRSVPObjectParser {
         reflect.set(BOUND, metric.isBound());
         reflect.set(COMPUTED, metric.isComputed());
         reflect.toByteBuf(output);
-        output.writeByte(metric.getMetricType());
+        output.writeByte(metric.getMetricType().toJava());
         writeFloat32(metric.getValue(), output);
     }
 }
index 7b48d1e64d65c39ce4a9546d283d6c4ef1966be4..e40c7e3c667d7b09c82da2ef46a4f6b0552c45dd 100644 (file)
@@ -30,7 +30,7 @@ public final class SessionAttributeLspObjectParser extends AbstractRSVPObjectPar
     private static final int PADDING = 4;
 
     static int getPadding(final int length) {
-        return (PADDING - (length % PADDING)) % PADDING;
+        return (PADDING - length % PADDING) % PADDING;
     }
 
     @Override
@@ -59,8 +59,8 @@ public final class SessionAttributeLspObjectParser extends AbstractRSVPObjectPar
             .getSessionName()));
         final int pad = getPadding(sessionName.readableBytes());
         serializeAttributeHeader(BODY_SIZE_C7 + pad + sessionName.readableBytes(), CLASS_NUM, CTYPE, output);
-        output.writeByte(sessionObject.getSetupPriority());
-        output.writeByte(sessionObject.getHoldPriority());
+        output.writeByte(sessionObject.getSetupPriority().toJava());
+        output.writeByte(sessionObject.getHoldPriority().toJava());
         final BitArray bs = new BitArray(FLAGS_SIZE);
         bs.set(LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
         bs.set(LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
index 7bf85d04a0347add0c39cd00542bbc6318fc451a..dd4356717f532a8797bae6324edd6825b22c4ba5 100644 (file)
@@ -60,8 +60,8 @@ public final class SessionAttributeLspRaObjectParser extends AbstractRSVPObjectP
         writeAttributeFilter(sessionObject.getIncludeAny(), output);
         writeAttributeFilter(sessionObject.getExcludeAny(), output);
         writeAttributeFilter(sessionObject.getIncludeAll(), output);
-        output.writeByte(sessionObject.getSetupPriority());
-        output.writeByte(sessionObject.getHoldPriority());
+        output.writeByte(sessionObject.getSetupPriority().toJava());
+        output.writeByte(sessionObject.getHoldPriority().toJava());
         final BitArray bs = new BitArray(FLAGS_SIZE);
         bs.set(SessionAttributeLspObjectParser.LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
         bs.set(SessionAttributeLspObjectParser.LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
index e99071f4f78e59573f031a69c7d97a96f4cf8f67..b0f692be1d4f8a64effbf1e726b0d3ca11657a51 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>concepts</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>yang-binding</artifactId>
index 0e2c3d52d8a50c69e44229f4747db8263cfdd197..96212e95106f9fe5e1b28d8762ff0ae7f62c22f2 100644 (file)
@@ -16,12 +16,14 @@ import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.unnumbered._case.Unnumbered;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class CUISubobjectParserTest {
-    private final Long routerId = 3735928559L;
-    private final Long interfaceId = 3736059631L;
-    private final Unnumbered unnumbered1 = new UnnumberedBuilder().setRouterId(null).build();
-    private final Unnumbered unnumbered2 = new UnnumberedBuilder().setRouterId(1L).setInterfaceId(null).build();
+    private final Uint32 routerId = Uint32.valueOf(3735928559L);
+    private final Uint32 interfaceId = Uint32.valueOf(3736059631L);
+    private final Unnumbered unnumbered1 = new UnnumberedBuilder().setRouterId((Uint32) null).build();
+    private final Unnumbered unnumbered2 = new UnnumberedBuilder().setRouterId(Uint32.ONE).setInterfaceId((Uint32) null)
+            .build();
 
     @Test
     public void testProcessing() {
index 27165029ed5f26e3da92f1a75ff7de4a61834b2a..4bac6cdabe9e3c7f594336d66cf90d66d8d42521 100644 (file)
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-common</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-buffer</artifactId>
index 4ffd5e918754de1aa6d624429c9f704ef663b2f0..6a205886dd0696f7b6545b4258a9260d0019856b 100644 (file)
@@ -18,6 +18,10 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Utility class for ByteBuf's write methods.
@@ -142,7 +146,9 @@ public final class ByteBufWriteUtil {
      *            Short value to be write to the output.
      * @param output
      *            ByteBuf, where value or zeros are written.
+     * @deprecated Use {@link #writeUnsignedByte(Uint8, ByteBuf)} instead.
      */
+    @Deprecated(forRemoval = true)
     public static void writeUnsignedByte(final Short value, final ByteBuf output) {
         if (value != null) {
             output.writeByte(value);
@@ -151,6 +157,24 @@ public final class ByteBufWriteUtil {
         }
     }
 
+    /**
+     * Writes unsigned byte <code>value</code> if not null, otherwise writes
+     * zero to the <code>output</code> ByteBuf. ByteBuf's writerIndex is
+     * increased by 1.
+     *
+     * @param value
+     *            Short value to be write to the output.
+     * @param output
+     *            ByteBuf, where value or zeros are written.
+     */
+    public static void writeUnsignedByte(final Uint8 value, final ByteBuf output) {
+        if (value != null) {
+            output.writeByte(value.byteValue());
+        } else {
+            output.writeZero(ONE_BYTE_LENGTH);
+        }
+    }
+
     /**
      * Writes unsigned 16-bit short integer <code>value</code> if not null,
      * otherwise writes zeros to the <code>output</code> ByteBuf. ByteBuf's
@@ -160,7 +184,9 @@ public final class ByteBufWriteUtil {
      *            Integer value to be written to the output.
      * @param output
      *            ByteBuf, where value or zeros are written.
+     * @deprecated Use {@link #writeUnsignedShort(Uint16, ByteBuf)} instead.
      */
+    @Deprecated(forRemoval = true)
     public static void writeUnsignedShort(final Integer value, final ByteBuf output) {
         if (value != null) {
             output.writeShort(value.shortValue());
@@ -169,6 +195,24 @@ public final class ByteBufWriteUtil {
         }
     }
 
+    /**
+     * Writes unsigned 16-bit short integer <code>value</code> if not null,
+     * otherwise writes zeros to the <code>output</code> ByteBuf. ByteBuf's
+     * writerIndex is increased by 2.
+     *
+     * @param value
+     *            Integer value to be written to the output.
+     * @param output
+     *            ByteBuf, where value or zeros are written.
+     */
+    public static void writeUnsignedShort(final Uint16 value, final ByteBuf output) {
+        if (value != null) {
+            output.writeShort(value.shortValue());
+        } else {
+            output.writeZero(SHORT_BYTES_LENGTH);
+        }
+    }
+
     /**
      * Writes unsigned 32-bit integer <code>value</code> if not null, otherwise
      * writes zeros to the <code>output</code> ByteBuf. ByteBuf's writerIndex is
@@ -178,7 +222,9 @@ public final class ByteBufWriteUtil {
      *            Long value to be written to the output.
      * @param output
      *            ByteBuf, where value or zeros are written.
+     * @deprecated Use {@link #writeUnsignedInt(Uint32, ByteBuf)} instead.
      */
+    @Deprecated(forRemoval = true)
     public static void writeUnsignedInt(final Long value, final ByteBuf output) {
         if (value != null) {
             output.writeInt(value.intValue());
@@ -187,6 +233,24 @@ public final class ByteBufWriteUtil {
         }
     }
 
+    /**
+     * Writes unsigned 32-bit integer <code>value</code> if not null, otherwise
+     * writes zeros to the <code>output</code> ByteBuf. ByteBuf's writerIndex is
+     * increased by 4.
+     *
+     * @param value
+     *            Long value to be written to the output.
+     * @param output
+     *            ByteBuf, where value or zeros are written.
+     */
+    public static void writeUnsignedInt(final Uint32 value, final ByteBuf output) {
+        if (value != null) {
+            output.writeInt(value.intValue());
+        } else {
+            output.writeZero(INT_BYTES_LENGTH);
+        }
+    }
+
     /**
      * Writes unsigned 64-bit integer <code>value</code> if not null, otherwise
      * writes zeros to the <code>output</code> ByteBuf. ByteBuf's writerIndex is
@@ -196,7 +260,9 @@ public final class ByteBufWriteUtil {
      *            BigInteger value to be written to the output.
      * @param output
      *            ByteBuf, where value or zeros are written.
+     * @deprecated Use {@link #writeUnsignedLong(Uint64, ByteBuf)} instead.
      */
+    @Deprecated(forRemoval = true)
     public static void writeUnsignedLong(final BigInteger value, final ByteBuf output) {
         if (value != null) {
             output.writeLong(value.longValue());
@@ -205,6 +271,24 @@ public final class ByteBufWriteUtil {
         }
     }
 
+    /**
+     * Writes unsigned 64-bit integer <code>value</code> if not null, otherwise
+     * writes zeros to the <code>output</code> ByteBuf. ByteBuf's writerIndex is
+     * increased by 8.
+     *
+     * @param value
+     *            BigInteger value to be written to the output.
+     * @param output
+     *            ByteBuf, where value or zeros are written.
+     */
+    public static void writeUnsignedLong(final Uint64 value, final ByteBuf output) {
+        if (value != null) {
+            output.writeLong(value.longValue());
+        } else {
+            output.writeZero(LONG_BYTES_LENGTH);
+        }
+    }
+
     /**
      * Writes IPv4 address if not null, otherwise writes zeros to the
      * <code>output</code> ByteBuf. ByteBuf's writerIndex is increased by 4.
index db027416986dde7d9428c37ba7c4ec5632e3e9dc..a1e95bc0bd6fd0071b6bbf1213547aaca41f2c18 100644 (file)
@@ -212,7 +212,7 @@ public final class Ipv4Util {
      */
     public static InetSocketAddress toInetSocketAddress(final IpAddress ipAddress, final PortNumber port) {
         final String ipString = toStringIP(ipAddress);
-        return new InetSocketAddress(InetAddresses.forString(ipString), port.getValue());
+        return new InetSocketAddress(InetAddresses.forString(ipString), port.getValue().toJava());
     }
 
     /**
index 2d86e767c7a05d89e34b8cc8f8ebb9fe4dd79ffd..e6f25e8d32bd90709cd19077948bcfe346d121a4 100644 (file)
@@ -26,13 +26,16 @@ import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.math.BigInteger;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 public class ByteBufWriteUtilTest {
 
@@ -109,11 +112,11 @@ public class ByteBufWriteUtilTest {
     public void testWriteUnsignedByteValue() {
         final byte[] result = { 5 };
         final ByteBuf output = Unpooled.buffer(ByteBufWriteUtil.ONE_BYTE_LENGTH);
-        writeUnsignedByte((short) 5, output);
+        writeUnsignedByte(Uint8.valueOf(5), output);
         assertArrayEquals(result, output.array());
 
         output.clear();
-        writeUnsignedByte(null, output);
+        writeUnsignedByte((Uint8) null, output);
         assertArrayEquals(ONE_BYTE_ZERO, output.array());
     }
 
@@ -121,11 +124,11 @@ public class ByteBufWriteUtilTest {
     public void testWriteUnsignedShortValue() {
         final byte[] result = { 0, 5 };
         final ByteBuf output = Unpooled.buffer(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
-        writeUnsignedShort(5, output);
+        writeUnsignedShort(Uint16.valueOf(5), output);
         assertArrayEquals(result, output.array());
 
         output.clear();
-        writeUnsignedShort(null, output);
+        writeUnsignedShort((Uint16) null, output);
         assertArrayEquals(TWO_BYTE_ZEROS, output.array());
     }
 
@@ -133,11 +136,11 @@ public class ByteBufWriteUtilTest {
     public void testWriteUnsignedIntValue() {
         final byte[] result = { 0, 0, 0, 5 };
         final ByteBuf output = Unpooled.buffer(ByteBufWriteUtil.INT_BYTES_LENGTH);
-        ByteBufWriteUtil.writeUnsignedInt((long) 5, output);
+        ByteBufWriteUtil.writeUnsignedInt(Uint32.valueOf(5), output);
         assertArrayEquals(result, output.array());
 
         output.clear();
-        writeUnsignedInt(null, output);
+        writeUnsignedInt((Uint32) null, output);
         assertArrayEquals(FOUR_BYTE_ZEROS, output.array());
     }
 
@@ -145,11 +148,11 @@ public class ByteBufWriteUtilTest {
     public void testWriteUnsignedLongValue() {
         final byte[] result = { 0, 0, 0, 0, 0, 0, 0, 5 };
         final ByteBuf output = Unpooled.buffer(ByteBufWriteUtil.LONG_BYTES_LENGTH);
-        writeUnsignedLong(new BigInteger("5"), output);
+        writeUnsignedLong(Uint64.valueOf(5), output);
         assertArrayEquals(result, output.array());
 
         output.clear();
-        writeUnsignedLong(null, output);
+        writeUnsignedLong((Uint64) null, output);
         assertArrayEquals(EIGHT_BYTE_ZEROS, output.array());
     }