X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=openflowplugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fopenflow%2Fmd%2Fcore%2Fsal%2FAbstractModelDrivenSwitch.java;h=ad4bdbc3ffa3a62df25e9eea6eaecc934af13b4b;hb=42a6894c46d279712feac0f317529b3525755e76;hp=81b3bd3a550f9f0a8e40053fc8ffa2e2d33dd876;hpb=1650b3e09320d3dad33fbe27e405fc59fe59b288;p=openflowplugin.git diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java index 81b3bd3a55..ad4bdbc3ff 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java @@ -7,10 +7,10 @@ */ package org.opendaylight.openflowplugin.openflow.md.core.sal; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.openflowplugin.openflow.md.ModelDrivenSwitch; -import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch; +import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService; @@ -20,6 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeCon import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService; import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalPortService; import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService; @@ -36,32 +37,10 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch { private final InstanceIdentifier identifier; - private RoutedRpcRegistration flowRegistration; - - private RoutedRpcRegistration groupRegistration; - - private RoutedRpcRegistration tableRegistration; - - private RoutedRpcRegistration meterRegistration; - - private RoutedRpcRegistration packetRegistration; - - private RoutedRpcRegistration portRegistration; - - private RoutedRpcRegistration flowStatisticsRegistration; - - private RoutedRpcRegistration groupStatisticsRegistration; - - private RoutedRpcRegistration meterStatisticsRegistration; - - private RoutedRpcRegistration portStatisticsRegistration; - - private RoutedRpcRegistration flowTableStatisticsRegistration; - - private RoutedRpcRegistration queueStatisticsRegistration; - protected final SessionContext sessionContext; + private boolean isEntityOwner = false; + protected AbstractModelDrivenSwitch(InstanceIdentifier identifier,SessionContext conductor) { this.identifier = identifier; this.sessionContext = conductor; @@ -73,67 +52,79 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch { } @Override - public CompositeObjectRegistration register(ProviderContext ctx) { + public CompositeObjectRegistration register(RpcProviderRegistry rpcProviderRegistry) { CompositeObjectRegistrationBuilder builder = CompositeObjectRegistration . builderFor(this); - flowRegistration = ctx.addRoutedRpcImplementation(SalFlowService.class, this); + final RoutedRpcRegistration flowRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalFlowService.class, this); flowRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(flowRegistration); - meterRegistration = ctx.addRoutedRpcImplementation(SalMeterService.class, this); + final RoutedRpcRegistration portRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalPortService.class, this); + portRegistration.registerPath(NodeContext.class, getIdentifier()); + builder.add(portRegistration); + + final RoutedRpcRegistration meterRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalMeterService.class, this); meterRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(meterRegistration); - groupRegistration = ctx.addRoutedRpcImplementation(SalGroupService.class, this); + final RoutedRpcRegistration groupRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalGroupService.class, this); groupRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(groupRegistration); - - tableRegistration = ctx.addRoutedRpcImplementation(SalTableService.class, this); + + final RoutedRpcRegistration tableRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalTableService.class, this); tableRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(tableRegistration); - portRegistration = ctx.addRoutedRpcImplementation(SalPortService.class, this); - portRegistration.registerPath(NodeContext.class, getIdentifier()); - builder.add(portRegistration); - - - packetRegistration = ctx.addRoutedRpcImplementation(PacketProcessingService.class, this); + final RoutedRpcRegistration packetRegistration = rpcProviderRegistry.addRoutedRpcImplementation(PacketProcessingService.class, this); packetRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(packetRegistration); - flowStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowStatisticsService.class, this); + final RoutedRpcRegistration flowStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightFlowStatisticsService.class, this); flowStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(flowStatisticsRegistration); - groupStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightGroupStatisticsService.class, this); + final RoutedRpcRegistration groupStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightGroupStatisticsService.class, this); groupStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(groupStatisticsRegistration); - meterStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightMeterStatisticsService.class, this); + final RoutedRpcRegistration meterStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightMeterStatisticsService.class, this); meterStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(meterStatisticsRegistration); - portStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightPortStatisticsService.class, this); + final RoutedRpcRegistration portStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightPortStatisticsService.class, this); portStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(portStatisticsRegistration); - flowTableStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowTableStatisticsService.class, this); + final RoutedRpcRegistration nodeConfigRegistration = rpcProviderRegistry.addRoutedRpcImplementation(NodeConfigService.class, this); + nodeConfigRegistration.registerPath(NodeContext.class, getIdentifier()); + builder.add(nodeConfigRegistration); + + final RoutedRpcRegistration flowTableStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightFlowTableStatisticsService.class, this); flowTableStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(flowTableStatisticsRegistration); - - queueStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightQueueStatisticsService.class, this); + + final RoutedRpcRegistration queueStatisticsRegistration = rpcProviderRegistry.addRoutedRpcImplementation(OpendaylightQueueStatisticsService.class, this); queueStatisticsRegistration.registerPath(NodeContext.class, getIdentifier()); builder.add(queueStatisticsRegistration); - return builder.toInstance(); + return builder.build(); } /** - * @return session context + * @return session context */ public SessionContext getSessionContext() { return sessionContext; } + @Override + public boolean isEntityOwner() { + return isEntityOwner; + } + + @Override + public void setEntityOwnership(boolean isOwner) { + isEntityOwner = isOwner; + } }