Update MRI upstreams for Phosphorus
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / RoleService.java
index ff642d73668bce060a3476cca708e96477e3c24a..6cbae9a91bdbbb534f9194e2fcf5cc47be0543ea 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -12,10 +12,8 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
-import java.math.BigInteger;
 import java.util.Collection;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
@@ -32,6 +30,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetR
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,16 +53,16 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
         return input.build();
     }
 
-    public Future<BigInteger> getGenerationIdFromDevice(final Short version) {
+    public ListenableFuture<Uint64> getGenerationIdFromDevice(final Uint8 version) {
         LOG.info("getGenerationIdFromDevice called for device: {}", getDeviceInfo().getNodeId().getValue());
 
         // send a dummy no-change role request to get the generation-id of the switch
         final RoleRequestInputBuilder roleRequestInputBuilder = new RoleRequestInputBuilder();
         roleRequestInputBuilder.setRole(toOFJavaRole(OfpRole.NOCHANGE));
         roleRequestInputBuilder.setVersion(version);
-        roleRequestInputBuilder.setGenerationId(BigInteger.ZERO);
+        roleRequestInputBuilder.setGenerationId(Uint64.ZERO);
 
-        final SettableFuture<BigInteger> finalFuture = SettableFuture.create();
+        final SettableFuture<Uint64> finalFuture = SettableFuture.create();
         final ListenableFuture<RpcResult<RoleRequestOutput>> genIdListenableFuture =
                 handleServiceCall(roleRequestInputBuilder);
         Futures.addCallback(genIdListenableFuture, new FutureCallback<RpcResult<RoleRequestOutput>>() {
@@ -97,9 +97,8 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
     }
 
 
-    public Future<RpcResult<SetRoleOutput>> submitRoleChange(final OfpRole ofpRole,
-                                                             final Short version,
-                                                             final BigInteger generationId) {
+    public ListenableFuture<RpcResult<SetRoleOutput>> submitRoleChange(final OfpRole ofpRole, final Uint8 version,
+                                                                       final Uint64 generationId) {
         LOG.info("submitRoleChange called for device:{}, role:{}",
                 getDeviceInfo().getNodeId(), ofpRole);
         final RoleRequestInputBuilder roleRequestInputBuilder = new RoleRequestInputBuilder();
@@ -121,7 +120,7 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
                 if (roleRequestOutput != null) {
                     final SetRoleOutputBuilder setRoleOutputBuilder = new SetRoleOutputBuilder();
                     setRoleOutputBuilder
-                            .setTransactionId(new TransactionId(BigInteger.valueOf(roleRequestOutput.getXid())));
+                            .setTransactionId(new TransactionId(Uint64.valueOf(roleRequestOutput.getXid())));
                     finalFuture.set(RpcResultBuilder.<SetRoleOutput>success()
                             .withResult(setRoleOutputBuilder.build()).build());