public void ValidateOperational_2ToDisabled_0_Reader() { UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(SubscriberConfigurationFileName); UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator; // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Disabled, Disabled, Disabled, Disabled] PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration; PubSubConnectionDataType subscriberConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections[0]; ReaderGroupDataType readerGroup = subscriberConnection.ReaderGroups[0]; DataSetReaderDataType datasetReader = readerGroup.DataSetReaders[0]; configurator.Disable(pubSub); configurator.Disable(subscriberConnection); configurator.Disable(readerGroup); configurator.Disable(datasetReader); PubSubState psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection); PubSubState rgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup); PubSubState dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Disabled, Is.True); Assert.That(rgState == PubSubState.Disabled, Is.True); Assert.That(dsrState == PubSubState.Disabled, Is.True); // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Operational, Operational, Operational, Operational] configurator.Enable(pubSub); configurator.Enable(subscriberConnection); configurator.Enable(readerGroup); configurator.Enable(datasetReader); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection); rgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup); dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader); Assert.That(psState == PubSubState.Operational, Is.True); Assert.That(conState == PubSubState.Operational, Is.True); Assert.That(rgState == PubSubState.Operational, Is.True); Assert.That(dsrState == PubSubState.Operational, Is.True); // The hierarchy PubSub -> PubSubConnection -> PubSubReaderGroup -> DataSetReader brought to [Disabled, Disabled, Disabled, Disabled] configurator.Disable(pubSub); configurator.Disable(subscriberConnection); configurator.Disable(readerGroup); configurator.Disable(datasetReader); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(subscriberConnection); rgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(readerGroup); dsrState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetReader); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Disabled, Is.True); Assert.That(rgState == PubSubState.Disabled, Is.True); Assert.That(dsrState == PubSubState.Disabled, Is.True); }
public void ValidateOperational_2ToDisabled_0_Publisher() { UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(publisherConfigurationFile); UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator; // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled] PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration; PubSubConnectionDataType publisherConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections.First(); WriterGroupDataType writerGroup = publisherConnection.WriterGroups[0]; DataSetWriterDataType datasetWriter = writerGroup.DataSetWriters[0]; configurator.Disable(pubSub); configurator.Disable(publisherConnection); configurator.Disable(writerGroup); configurator.Disable(datasetWriter); PubSubState psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); PubSubState wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); PubSubState dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Disabled, Is.True); Assert.That(wgState == PubSubState.Disabled, Is.True); Assert.That(dswState == PubSubState.Disabled, Is.True); // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Operational, Operational, Operational, Operational] configurator.Enable(pubSub); configurator.Enable(publisherConnection); configurator.Enable(writerGroup); configurator.Enable(datasetWriter); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Operational, Is.True); Assert.That(conState == PubSubState.Operational, Is.True); Assert.That(wgState == PubSubState.Operational, Is.True); Assert.That(dswState == PubSubState.Operational, Is.True); // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled] configurator.Disable(pubSub); configurator.Disable(publisherConnection); configurator.Disable(writerGroup); configurator.Disable(datasetWriter); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Disabled, Is.True); Assert.That(wgState == PubSubState.Disabled, Is.True); Assert.That(dswState == PubSubState.Disabled, Is.True); }
/// <summary> /// Creates the ServerObject and attaches it to the NodeManager. /// </summary> private void CreateServerObject() { lock (m_diagnosticsNodeManager.Lock) { // get the server object. ServerObjectState serverObject = m_serverObject = (ServerObjectState)m_diagnosticsNodeManager.FindPredefinedNode( ObjectIds.Server, typeof(ServerObjectState)); // update server capabilities. serverObject.ServiceLevel.Value = 255; serverObject.ServerCapabilities.LocaleIdArray.Value = m_resourceManager.GetAvailableLocales(); serverObject.ServerCapabilities.ServerProfileArray.Value = m_configuration.ServerConfiguration.ServerProfileArray.ToArray(); serverObject.ServerCapabilities.MinSupportedSampleRate.Value = 0; serverObject.ServerCapabilities.MaxBrowseContinuationPoints.Value = (ushort)m_configuration.ServerConfiguration.MaxBrowseContinuationPoints; serverObject.ServerCapabilities.MaxQueryContinuationPoints.Value = (ushort)m_configuration.ServerConfiguration.MaxQueryContinuationPoints; serverObject.ServerCapabilities.MaxHistoryContinuationPoints.Value = (ushort)m_configuration.ServerConfiguration.MaxHistoryContinuationPoints; serverObject.ServerCapabilities.MaxArrayLength.Value = (uint)m_configuration.TransportQuotas.MaxArrayLength; serverObject.ServerCapabilities.MaxStringLength.Value = (uint)m_configuration.TransportQuotas.MaxStringLength; serverObject.ServerCapabilities.MaxByteStringLength.Value = (uint)m_configuration.TransportQuotas.MaxByteStringLength; // Any operational limits Property that is provided shall have a non zero value. var operationLimits = serverObject.ServerCapabilities.OperationLimits; var configOperationLimits = m_configuration.ServerConfiguration.OperationLimits; if (configOperationLimits != null) { operationLimits.MaxNodesPerRead = SetPropertyValue(operationLimits.MaxNodesPerRead, configOperationLimits.MaxNodesPerRead); operationLimits.MaxNodesPerHistoryReadData = SetPropertyValue(operationLimits.MaxNodesPerHistoryReadData, configOperationLimits.MaxNodesPerHistoryReadData); operationLimits.MaxNodesPerHistoryReadEvents = SetPropertyValue(operationLimits.MaxNodesPerHistoryReadEvents, configOperationLimits.MaxNodesPerHistoryReadEvents); operationLimits.MaxNodesPerWrite = SetPropertyValue(operationLimits.MaxNodesPerWrite, configOperationLimits.MaxNodesPerWrite); operationLimits.MaxNodesPerHistoryUpdateData = SetPropertyValue(operationLimits.MaxNodesPerHistoryUpdateData, configOperationLimits.MaxNodesPerHistoryUpdateData); operationLimits.MaxNodesPerHistoryUpdateEvents = SetPropertyValue(operationLimits.MaxNodesPerHistoryUpdateEvents, configOperationLimits.MaxNodesPerHistoryUpdateEvents); operationLimits.MaxNodesPerMethodCall = SetPropertyValue(operationLimits.MaxNodesPerMethodCall, configOperationLimits.MaxNodesPerMethodCall); operationLimits.MaxNodesPerBrowse = SetPropertyValue(operationLimits.MaxNodesPerBrowse, configOperationLimits.MaxNodesPerBrowse); operationLimits.MaxNodesPerRegisterNodes = SetPropertyValue(operationLimits.MaxNodesPerRegisterNodes, configOperationLimits.MaxNodesPerRegisterNodes); operationLimits.MaxNodesPerTranslateBrowsePathsToNodeIds = SetPropertyValue(operationLimits.MaxNodesPerTranslateBrowsePathsToNodeIds, configOperationLimits.MaxNodesPerTranslateBrowsePathsToNodeIds); operationLimits.MaxNodesPerNodeManagement = SetPropertyValue(operationLimits.MaxNodesPerNodeManagement, configOperationLimits.MaxNodesPerNodeManagement); operationLimits.MaxMonitoredItemsPerCall = SetPropertyValue(operationLimits.MaxMonitoredItemsPerCall, configOperationLimits.MaxMonitoredItemsPerCall); } else { operationLimits.MaxNodesPerRead = operationLimits.MaxNodesPerHistoryReadData = operationLimits.MaxNodesPerHistoryReadEvents = operationLimits.MaxNodesPerWrite = operationLimits.MaxNodesPerHistoryUpdateData = operationLimits.MaxNodesPerHistoryUpdateEvents = operationLimits.MaxNodesPerMethodCall = operationLimits.MaxNodesPerBrowse = operationLimits.MaxNodesPerRegisterNodes = operationLimits.MaxNodesPerTranslateBrowsePathsToNodeIds = operationLimits.MaxNodesPerNodeManagement = operationLimits.MaxMonitoredItemsPerCall = null; } // setup PublishSubscribe Status State value PubSubState pubSubState = PubSubState.Disabled; var default_PubSubState = (BaseVariableState)m_diagnosticsNodeManager.FindPredefinedNode( VariableIds.PublishSubscribe_Status_State, typeof(BaseVariableState)); default_PubSubState.Value = pubSubState; // setup value for SupportedTransportProfiles var default_SupportedTransportProfiles = (BaseVariableState)m_diagnosticsNodeManager.FindPredefinedNode( VariableIds.PublishSubscribe_SupportedTransportProfiles, typeof(BaseVariableState)); default_SupportedTransportProfiles.Value = "uadp"; // setup callbacks for dynamic values. serverObject.NamespaceArray.OnSimpleReadValue = OnReadNamespaceArray; serverObject.NamespaceArray.MinimumSamplingInterval = 1000; serverObject.ServerArray.OnSimpleReadValue = OnReadServerArray; serverObject.ServerArray.MinimumSamplingInterval = 1000; // dynamic change of enabledFlag is disabled to pass CTT serverObject.ServerDiagnostics.EnabledFlag.AccessLevel = AccessLevels.CurrentRead; serverObject.ServerDiagnostics.EnabledFlag.UserAccessLevel = AccessLevels.CurrentRead; serverObject.ServerDiagnostics.EnabledFlag.OnSimpleReadValue = OnReadDiagnosticsEnabledFlag; serverObject.ServerDiagnostics.EnabledFlag.OnSimpleWriteValue = OnWriteDiagnosticsEnabledFlag; serverObject.ServerDiagnostics.EnabledFlag.MinimumSamplingInterval = 1000; // initialize status. ServerStatusDataType serverStatus = new ServerStatusDataType(); serverStatus.StartTime = DateTime.UtcNow; serverStatus.CurrentTime = DateTime.UtcNow; serverStatus.State = ServerState.Shutdown; serverStatus.BuildInfo.ProductName = m_serverDescription.ProductName; serverStatus.BuildInfo.ProductUri = m_serverDescription.ProductUri; serverStatus.BuildInfo.ManufacturerName = m_serverDescription.ManufacturerName; serverStatus.BuildInfo.SoftwareVersion = m_serverDescription.SoftwareVersion; serverStatus.BuildInfo.BuildNumber = m_serverDescription.BuildNumber; serverStatus.BuildInfo.BuildDate = m_serverDescription.BuildDate; serverObject.ServerStatus.MinimumSamplingInterval = 1000; serverObject.ServerStatus.CurrentTime.MinimumSamplingInterval = 1000; m_serverStatus = new ServerStatusValue( serverObject.ServerStatus, serverStatus, m_dataLock); m_serverStatus.Timestamp = DateTime.UtcNow; m_serverStatus.OnBeforeRead = OnReadServerStatus; // initialize diagnostics. m_serverDiagnostics = new ServerDiagnosticsSummaryDataType(); m_serverDiagnostics.ServerViewCount = 0; m_serverDiagnostics.CurrentSessionCount = 0; m_serverDiagnostics.CumulatedSessionCount = 0; m_serverDiagnostics.SecurityRejectedSessionCount = 0; m_serverDiagnostics.RejectedSessionCount = 0; m_serverDiagnostics.SessionTimeoutCount = 0; m_serverDiagnostics.SessionAbortCount = 0; m_serverDiagnostics.PublishingIntervalCount = 0; m_serverDiagnostics.CurrentSubscriptionCount = 0; m_serverDiagnostics.CumulatedSubscriptionCount = 0; m_serverDiagnostics.SecurityRejectedRequestsCount = 0; m_serverDiagnostics.RejectedRequestsCount = 0; m_diagnosticsNodeManager.CreateServerDiagnostics( m_defaultSystemContext, m_serverDiagnostics, OnUpdateDiagnostics); // set the diagnostics enabled state. m_diagnosticsNodeManager.SetDiagnosticsEnabled( m_defaultSystemContext, m_configuration.ServerConfiguration.DiagnosticsEnabled); ConfigurationNodeManager configurationNodeManager = m_diagnosticsNodeManager as ConfigurationNodeManager; configurationNodeManager?.CreateServerConfiguration( m_defaultSystemContext, m_configuration); } }
public void ValidateDisabled_0ToPause_1_Publisher() { UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(PublisherConfigurationFileName); UaPubSubConfigurator configurator = uaPubSubApplication.UaPubSubConfigurator; // The hierarchy PubSub -> PubSubConnection -> PubSubWriterGroup -> DataSetWriter brought to [Disabled, Disabled, Disabled, Disabled] PubSubConfigurationDataType pubSub = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration; PubSubConnectionDataType publisherConnection = uaPubSubApplication.UaPubSubConfigurator.PubSubConfiguration.Connections[0]; WriterGroupDataType writerGroup = publisherConnection.WriterGroups[0]; DataSetWriterDataType datasetWriter = writerGroup.DataSetWriters[0]; configurator.Disable(pubSub); configurator.Disable(publisherConnection); configurator.Disable(writerGroup); configurator.Disable(datasetWriter); PubSubState psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); PubSubState conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); PubSubState wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); PubSubState dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Disabled, Is.True); Assert.That(wgState == PubSubState.Disabled, Is.True); Assert.That(dswState == PubSubState.Disabled, Is.True); // Bring connection to Enabled configurator.Enable(publisherConnection); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Paused, Is.True); Assert.That(wgState == PubSubState.Disabled, Is.True); Assert.That(dswState == PubSubState.Disabled, Is.True); // Bring writerGroup to Enabled configurator.Enable(writerGroup); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Paused, Is.True); Assert.That(wgState == PubSubState.Paused, Is.True); Assert.That(dswState == PubSubState.Disabled, Is.True); // Bring datasetWriter to Enabled configurator.Enable(datasetWriter); psState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(pubSub); conState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(publisherConnection); wgState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(writerGroup); dswState = uaPubSubApplication.UaPubSubConfigurator.FindStateForObject(datasetWriter); Assert.That(psState == PubSubState.Disabled, Is.True); Assert.That(conState == PubSubState.Paused, Is.True); Assert.That(wgState == PubSubState.Paused, Is.True); Assert.That(dswState == PubSubState.Paused, Is.True); }