View Issue Details

IDProjectCategoryView StatusLast Update
0004135Compliance Test Tool (CTT) Unified Architecture4 - Test Case Definitionpublic2019-08-09 17:51
ReporterMartin Lang Assigned ToAlexander Allmendinger  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx64OSWindowsOS Version7
Product Version1.03.340.380 
Target Version1.03Fixed in Version1.03.341.381 
Summary0004135: Base Info Server Capabilities/005 does not recognize if the Node MaxArrayLength really exists
Description

The script tries to read the related node MaxArrayLength.
But the script does not distinguish whether the node exists or not.
Since this node is optional the script should give a additional warning if arrays are in use and the MaxArrayLength not available.

In my case the server does not expose this node although the address space contains array. (Not best practice I know. Will be changed in future)
Anyway, this node is optional by specification.

Additional Information

Modified script will recognize if an array is defined in the CTT settings and/or the MaxArrayLength is available in the address space.
Probably not the best modification solution, but good enough to show an possible solution.

/ Test prepared by Nathan Pocock: nathan.pocock@opcfoundation.org
Description: MaxArrayLength matches reality
/

function test() {
// read the value of the setting
var item = MonitoredItem.fromNodeIds( new UaNodeId( Identifier.Server_ServerCapabilities_MaxArrayLength ) )[0];

if( !ReadHelper.Execute( { NodesToRead: item, OperationResults: [ new ExpectedAndAcceptedResults( [ StatusCode.Good, StatusCode.BadNodeIdUnknown ] ) ] } ) ) return( false );
var realValue = item.Value.Value.toUInt32();
/***** modification begin ******/
// checkout the arrays that are configured and Read their values. We'll compare their lengths and see if any of them
// exceed the value.
var items = MonitoredItem.fromSettings( Settings.ServerTest.NodeIds.Static.AllProfiles.Arrays.Settings );

// check if the node MaxArrayLength is available
if( item.Value.StatusCode.isBad())
{
    if( items == null || items.length < 1 )
    {
        addSkipped( "No Arrays configured in Settings. See settings > ServerTest > NodeIds > Static > All Profiles > Arrays" );
        return( false );
    }
    else
    {
        addWarning( "ServerCapabilitiesType -> MaxArrayLength ==>[NOT FOUND], where as some array are specified. It is recommended to support this server capability. " );
    }
}
// only continue if the value is not 0
if( realValue == 0 ) {
    addWarning( "MaxArrayLength = 0, which means 'no limit'. Please verify if this is accurate. OperationLimit will be limited to this value." );
    realValue = MAX_ALLOWED_SIZE;
}
else if( realValue > MAX_ALLOWED_SIZE ) { 
    addWarning("MaxArrayLength is set to a value above " + MAX_ALLOWED_SIZE + ". OperationLimit will be limited to this value." );
    realValue = MAX_ALLOWED_SIZE;
}
/***** modification end ******/

if( !ReadHelper.Execute( { NodesToRead: items } ) ) return( false );
for( var i=0; i<items.length; i++ ) {
    if( realValue < items[i].Value.Value.getArraySize() ) addError( "Item " + items[i].NodeSetting + " has a value where the array size is greater than what is advertized as the max size (MaxArrayLength=" + realValue + ")" );
    items[i].InitialValue = items[i].Value.Value.clone(); // cache the value so we can write it back later
}

// now to see if we can re-write the array and increase the size
for( var i=0; i<items.length; i++ ) items[i].AttributeId = Attribute.ArrayDimensions;
ReadHelper.Execute( { NodesToRead: items } );
var writableNodes = [];
for( var i=0; i<items.length; i++ ) {
    if( items[i].Value.Value.toUInt32Array()[0] == 0 ) writableNodes.push( items[i] );
}
if( writableNodes.length === 0 ) return( false );

// read the values again...
for( var i=0; i<writableNodes.length; i++ ) writableNodes[i].AttributeId = Attribute.Value;                                // set the attribute back to Value 
ReadHelper.Execute( { NodesToRead: writableNodes } );

// overwrite the values by filling the array
for( var i=0; i<writableNodes.length; i++ ) UaVariant.Fill( { Variant: writableNodes[i].Value.Value, Length: realValue } );  // set the new value
if( WriteHelper.Execute( { NodesToWrite: writableNodes, ReadVerification: false } ) ) {
    // now to revert all values back to their initial value....
    for( var i=0; i<writableNodes.length; i++ ) writableNodes[i].Value.Value = writableNodes[i].InitialValue.clone();
    WriteHelper.Execute( { NodesToWrite: writableNodes, ReadVerification: false } );
}
return( true );

}

Test.Execute( { Procedure: test } );

TagsNo tags attached.
Files Affected

Activities

Martin Lang

2018-01-24 09:50

reporter   ~0008847

Or see script 006 which skips the test case.

Martin Lang

2018-01-24 09:57

reporter   ~0008848

Other scripts like 007 + 014 (probably more script, not checked yet) bring up the information "not supported". Should not all scripts from this CU handle this situation equal?

Paul Hunkar

2018-04-12 16:13

administrator   ~0008999

discussed in meeting 2018-04-12
The test should be skipped if array limits are not provided, failed if there is some other problem reading the limits and processed if provided.

This line should be broken up to allow this:
if( !ReadHelper.Execute( { NodesToRead: item, OperationResults: [ new ExpectedAndAcceptedResults( [ StatusCode.Good, StatusCode.BadNodeIdUnknown ] ) ] } ) ) return( false );

Alexander Allmendinger

2018-08-04 12:48

developer   ~0009256

Script is now skipping itself if the node is not provided.

Paul Hunkar

2019-08-09 17:51

administrator   ~0010749

Review in CMP call

Issue History

Date Modified Username Field Change
2018-01-24 09:39 Martin Lang New Issue
2018-01-24 09:50 Martin Lang Note Added: 0008847
2018-01-24 09:57 Martin Lang Note Added: 0008848
2018-04-12 16:09 Paul Hunkar Assigned To => Alexander Allmendinger
2018-04-12 16:09 Paul Hunkar Status new => assigned
2018-04-12 16:13 Paul Hunkar Note Added: 0008999
2018-08-04 12:48 Alexander Allmendinger Note Added: 0009256
2018-08-04 12:48 Alexander Allmendinger Status assigned => resolved
2018-08-04 12:48 Alexander Allmendinger Fixed in Version => 1.03.341.381
2018-08-04 12:48 Alexander Allmendinger Resolution open => fixed
2019-01-28 14:14 Paul Hunkar Category Test Case Definition => 5 - Test Case Definition
2019-01-28 14:15 Paul Hunkar Category 5 - Test Case Definition => 4 - Test Case Definition
2019-08-09 17:51 Paul Hunkar Target Version => 1.03
2019-08-09 17:51 Paul Hunkar Status resolved => closed
2019-08-09 17:51 Paul Hunkar Note Added: 0010749