package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
private static final Logger LOG = LoggerFactory
.getLogger(OpenflowpluginTestServiceProvider.class);
- private DataBroker dataService;
+ private final DataBroker dataService;
private RoutedRpcRegistration<SalFlowService> flowRegistration;
- private NotificationProviderService notificationProviderService;
+ private final NotificationProviderService notificationProviderService;
+
+ public OpenflowpluginTestServiceProvider(DataBroker dataService,
+ NotificationProviderService notificationProviderService) {
+ this.dataService = dataService;
+ this.notificationProviderService = notificationProviderService;
+ }
/**
- * get data service
+ * Get data service.
*
* @return {@link #dataService}
*/
}
/**
- * set {@link #dataService}
- *
- * @param dataService
- */
- public void setDataService(final DataBroker dataService) {
- this.dataService = dataService;
- }
-
- /**
- * get flow registration
+ * Get flow registration.
*
* @return {@link #flowRegistration}
*/
}
/**
- * set {@link #flowRegistration}
- *
- * @param flowRegistration
+ * Set {@link #flowRegistration}.
*/
public void setFlowRegistration(
final RoutedRpcRegistration<SalFlowService> flowRegistration) {
}
/**
- * get notification service
+ * Get notification service.
*
* @return {@link #notificationProviderService}
*/
return notificationProviderService;
}
- /**
- * set {@link #notificationProviderService}
- *
- * @param notificationProviderService
- */
- public void setNotificationService(
- final NotificationProviderService notificationProviderService) {
- this.notificationProviderService = notificationProviderService;
- }
-
- public void start() {
- OpenflowpluginTestServiceProvider.LOG
- .info("SalFlowServiceProvider Started.");
- }
-
/*
* (non-Javadoc)
*
* service.rev130819.AddFlowInput)
*/
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
- String plus = ("addFlow - " + input);
- OpenflowpluginTestServiceProvider.LOG.info(plus);
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+ OpenflowpluginTestServiceProvider.LOG.info("addFlow - {}", input);
return null;
}
* .service.rev130819.RemoveFlowInput)
*/
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
- String plus = ("removeFlow - " + input);
- OpenflowpluginTestServiceProvider.LOG.info(plus);
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+ OpenflowpluginTestServiceProvider.LOG.info("removeFlow - {}", input);
return null;
}
* .service.rev130819.UpdateFlowInput)
*/
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
- String plus = ("updateFlow - " + input);
- OpenflowpluginTestServiceProvider.LOG.info(plus);
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+ OpenflowpluginTestServiceProvider.LOG.info("updateFlow - {}", input);
return null;
}
- /**
- * @param ctx
- * @return {@link ObjectRegistration}
- */
- public ObjectRegistration<OpenflowpluginTestServiceProvider> register(
- final ProviderContext ctx) {
- RoutedRpcRegistration<SalFlowService> addRoutedRpcImplementation = ctx
- .<SalFlowService> addRoutedRpcImplementation(
- SalFlowService.class, this);
+ public ObjectRegistration<OpenflowpluginTestServiceProvider> register(RpcProviderRegistry rpcRegistry) {
+ RoutedRpcRegistration<SalFlowService> addRoutedRpcImplementation =
+ rpcRegistry.addRoutedRpcImplementation(SalFlowService.class, this);
setFlowRegistration(addRoutedRpcImplementation);
InstanceIdentifierBuilder<Nodes> builderII = InstanceIdentifier
- .<Nodes> builder(Nodes.class);
+ .<Nodes>builder(Nodes.class);
NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
NodeKey nodeKey = new NodeKey(nodeId);
InstanceIdentifierBuilder<Node> nodeIdentifier = builderII
- .<Node, NodeKey> child(Node.class, nodeKey);
+ .<Node, NodeKey>child(Node.class, nodeKey);
InstanceIdentifier<Node> instance = nodeIdentifier.build();