View Issue Details

IDProjectCategoryView StatusLast Update
0006715Compliance Test Tool (CTT) Unified Architecture1 - Script Issuepublic2021-05-27 15:46
ReporterEtienne Rossignon Assigned ToSebastian Allmendinger  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.04.09.396 
Fixed in Version1.03.341.399 
Summary0006715: Take into account maxNotificationPerPublish
Description

The CTT scripts dealing with a large number of monitored Items need to take into account the fact that the server may not send all the initial notification changes in a single PublishRequest due to the maxNotificiationPerPublish limit.

At this time, most of the scripts assume that all monitored item initial change notification will be receive in the first PublishRequest.
It appears also that maxNotificiationPerPublish has to be appropriately set as PublishResponse may exceed the message maximum buffer size ( which seems to be limited to 16M with the CTT framework);

Instead we need to iterate and continue sending a PublishRequest until the moreNotification flags comes to false or we receive a KeepAlive Publish Response.

(in createMonitoredItems591025 for instance )

Additional Information

How I resolved it :

     // return true if some DataChangeNotifications were found
            function GetAllDataChangeNotifications() {

                PublishHelper.Execute( { FirstPublish: true } );
                if (!PublishHelper.CurrentlyContainsData()) { return false; }
                // is dataChange value received of type array?
                while( PublishHelper.CurrentlyContainsData() ) {
                      PublishHelper.Execute();
                }
                return true;
            }
            //~~~~~~~~~~~~ NOW TO SUBSCRIBE, WRITE AND VERIFY ~~~~~~~~~~~~~~~~~~~~~

            // create the monitored items
            if( CreateMonitoredItemsHelper.Execute( { ItemsToCreate: monitoredItems, TimestampsToReturn: TimestampsToReturn.Both, SubscriptionId: MonitorBasicSubscription } ) ) {
                // wait one publishing cycle before calling publish
                PublishHelper.WaitInterval( { Items: monitoredItems, Subscription: MonitorBasicSubscription } );
                // call Publish(), and make sure we receive data for all MonitoredItems, and that each 
                GetAllDataChangeNotifications();

                // Now, WRITE to the items in range
                // first, lets' create set some values within the MonitoredItems 
                SetArrayWriteValuesInMonitoredItems( monitoredItems, 3 );

                var expectedResults = [];
                for( var e=0; e<monitoredItems.length; e++ ) expectedResults[e] = new ExpectedAndAcceptedResults( StatusCode.Good );
                if( WriteHelper.Execute( { NodesToWrite: monitoredItems, OperationResults: expectedResults, CheckNotSupported: true } ) ) {
                    // check if the writesAreNotSupported, if the first one fails then its highly
                    // likely that the rest did too.
                    if( WriteHelper.Response.Results[0].StatusCode !== StatusCode.BadWriteNotSupported ) {
                        // wait one publishing cycle before calling publish
                        PublishHelper.WaitInterval( { Items: monitoredItems, Subscription: MonitorBasicSubscription } );
                        // call Publish()(), we do expect data changes!
                        const CurrentlyContainsData1 = GetAllDataChangeNotifications();
                        Assert.True( CurrentlyContainsData1, "We expected a DataChange within the Publish response." );
                        // Now, WRITE to the items out of range
                        for( m=0; m<monitoredItems.length; m++ ) {
                            monitoredItems[m].OriginalIndexRange = monitoredItems[m].IndexRange;
                            monitoredItems[m].IndexRange = "0:1";
                        }// for m...
                        SetArrayWriteValuesInMonitoredItems( monitoredItems, 2 );
                        if( WriteHelper.Execute( { NodesToWrite: monitoredItems } ) ) {
                            // wait one publishing cycle before calling publish
                            PublishHelper.WaitInterval( { Items: monitoredItems, Subscription: MonitorBasicSubscription } );
                            // call Publish()(), we do NOT expect any data changes!
                             const CurrentlyContainsData2 = GetAllDataChangeNotifications();
                             if( Assert.False( CurrentlyContainsData2, "We expected NO DataChange within the Publish response. For example, CreateMonitoredItems item #1 setup with IndexRange: " + monitoredItems[0].OriginalIndexRange + "; but we just wrote to IndexRange: " + monitoredItems[0].IndexRange ) ) {
                                addLog( "Publish Received: " + PublishHelper.PrintDataChanges() );
                            }
                        }
                    }
                    else addNotSupported( "Write IndexRange" );

                }// if( p.InvokePublish( Test.Session.Session ) )
                // clean-up
                DeleteMonitoredItemsHelper.Execute( { ItemsToDelete: monitoredItems, SubscriptionId: MonitorBasicSubscription } );
            }
        }//if( reader.Read() )
        revertOriginalValuesArrayStatic();
        return( true );
    }

    Test.Execute( { Procedure: createMonit
TagsNo tags attached.
Files Affected

Activities

Etienne Rossignon

2021-03-29 12:34

reporter   ~0014103

I am refering to maintree\Monitored Item Services\Monitor Value Change\Test Cases\015.js

Paul Hunkar

2021-04-01 15:54

administrator   ~0014161

Need to review what test case 15 is actually testing, library function should not be updated (affects to many other scripts)

Sebastian Allmendinger

2021-05-21 04:50

developer   ~0014415

A new library function "GetAllNotifications()" has been introduced that is part of the Publish service. The function can be called directly in the test scripts or as part of the Execute-function by setting the parameter "GetAllNotifications" to true.

By default the received Notifications are pushed in the arrays like it is done if a single Publish has been issued. By setting the parameter AllNotificationsInCurrentArray, the Notifications, gained while MoreNotifications is set to true, are stored in the same Current... array and will be treatened like they were all received in a single response.

In the test script (Monitored Item Services\Monitor Value Change\Test Cases\015.js) itself, only the new parameter in the Execute function are set.

Paul Hunkar

2021-05-27 15:46

administrator   ~0014433

Reviewed code in CMP call, agreed to changes/updates, closed issue

Issue History

Date Modified Username Field Change
2021-03-29 12:06 Etienne Rossignon New Issue
2021-03-29 12:34 Etienne Rossignon Note Added: 0014103
2021-04-01 15:54 Paul Hunkar Note Added: 0014161
2021-04-01 15:54 Paul Hunkar Assigned To => Alexander Allmendinger
2021-04-01 15:54 Paul Hunkar Status new => assigned
2021-05-21 04:50 Sebastian Allmendinger Assigned To Alexander Allmendinger => Sebastian Allmendinger
2021-05-21 04:50 Sebastian Allmendinger Status assigned => resolved
2021-05-21 04:50 Sebastian Allmendinger Resolution open => fixed
2021-05-21 04:50 Sebastian Allmendinger Fixed in Version => 1.03.341.399
2021-05-21 04:50 Sebastian Allmendinger Note Added: 0014415
2021-05-27 15:46 Paul Hunkar Status resolved => closed
2021-05-27 15:46 Paul Hunkar Note Added: 0014433