public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenFlowPluginExtensionRegistratorProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderImpl.class);
+ private static final MessageIntelligenceAgency messageIntelligenceAgency = new MessageIntelligenceAgencyImpl();
+ private final int rpcRequestsQuota;
+ private final long globalNotificationQuota;
private DeviceManager deviceManager;
private RpcManager rpcManager;
private RpcProviderRegistry rpcProviderRegistry;
private DataBroker dataBroker;
private OfpRole role;
private Collection<SwitchConnectionProvider> switchConnectionProviders;
- private Long rpcRequestsQuota;
+ private boolean switchFeaturesMandatory = false;
+ private boolean isStatisticsPollingOff = false;
- public OpenFlowPluginProviderImpl(final Long rpcRequestsQuota) {
- this.rpcRequestsQuota = rpcRequestsQuota;
+ public OpenFlowPluginProviderImpl(final long rpcRequestsQuota, final Long globalNotificationQuota) {
+ Preconditions.checkArgument(rpcRequestsQuota > 0 && rpcRequestsQuota <= Integer.MAX_VALUE, "rpcRequestQuota has to be in range <1,%s>", Integer.MAX_VALUE);
+ this.rpcRequestsQuota = (int) rpcRequestsQuota;
+ this.globalNotificationQuota = Preconditions.checkNotNull(globalNotificationQuota);
}
+ @Override
+ public boolean isStatisticsPollingOff() {
+ return isStatisticsPollingOff;
+ }
+
+ @Override
+ public void setIsStatisticsPollingOff(final boolean isStatisticsPollingOff) {
+ this.isStatisticsPollingOff = isStatisticsPollingOff;
+ }
private void startSwitchConnections() {
final List<ListenableFuture<Boolean>> starterChain = new ArrayList<>(switchConnectionProviders.size());
});
}
+ public boolean isSwitchFeaturesMandatory() {
+ return switchFeaturesMandatory;
+ }
+
+ public void setSwitchFeaturesMandatory(final boolean switchFeaturesMandatory) {
+ this.switchFeaturesMandatory = switchFeaturesMandatory;
+ }
+
+ public static MessageIntelligenceAgency getMessageIntelligenceAgency() {
+ return OpenFlowPluginProviderImpl.messageIntelligenceAgency;
+ }
+
@Override
public void setSwitchConnectionProviders(final Collection<SwitchConnectionProvider> switchConnectionProviders) {
this.switchConnectionProviders = switchConnectionProviders;
OFSessionUtil.getSessionManager().setExtensionConverterProvider(extensionConverterManager);
connectionManager = new ConnectionManagerImpl();
- MessageIntelligenceAgency messageIntelligenceAgency = new MessageIntelligenceAgencyImpl();
registerMXBean(messageIntelligenceAgency);
- deviceManager = new DeviceManagerImpl(dataBroker, messageIntelligenceAgency);
+ deviceManager = new DeviceManagerImpl(dataBroker, messageIntelligenceAgency, switchFeaturesMandatory, globalNotificationQuota);
statisticsManager = new StatisticsManagerImpl();
rpcManager = new RpcManagerImpl(rpcProviderRegistry, rpcRequestsQuota);
rpcManager.setDeviceInitializationPhaseHandler(deviceManager);
TranslatorLibraryUtil.setBasicTranslatorLibrary(deviceManager);
+ deviceManager.initialize();
+
startSwitchConnections();
}
- private void registerMXBean(final MessageIntelligenceAgency messageIntelligenceAgency) {
+ private static void registerMXBean(final MessageIntelligenceAgency messageIntelligenceAgency) {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try {
String pathToMxBean = String.format("%s:type=%s",