Commit 464982ee authored by Julian Grothoff's avatar Julian Grothoff

Merge branch 'dev' into ControlComponentBehaviour

parents 1ed840a1 5bc5622c
Pipeline #260016 passed with stages
in 17 minutes and 15 seconds
......@@ -120,6 +120,8 @@ test:compliance:selfcheck:disabled:
# Test external control component example from acplt via test_compliance client
test:compliance:external:acplt:
stage: test
except:
- master
dependencies:
- build:linux64
except:
......@@ -149,9 +151,9 @@ test:compliance:external:acplt:
- curl -s 'http://localhost:7509/setVar?format=plain&path=/Tasks/UrTask.cyctime&newvalue=0.1'
# set ipsms interface to specific values and run specific compliance tests
- curl -s 'http://localhost:7509/setVar?path=/TechUnits/uaServer/ipsms.SIProfile&newvalue=3'
- ./test_compliance --nodes 'ns=1;s="/TechUnits/ESE/ControlComponent1"' --siProfile CMD --namespace 'acplt.org/' --timeout 1 --gtest_filter=-*_Optional --gtest_output="xml:test_CMD.xml"
- ./test_compliance --nodes 'ns=1;s="/TechUnits/ESE/ControlComponent1"' --siProfile CMD --namespace 'acplt.org/' --timeout 1 --gtest_filter=-*_Optional:*_Behaviour --gtest_output="xml:test_CMD.xml"
- curl -s 'http://localhost:7509/setVar?path=/TechUnits/uaServer/ipsms.SIProfile&newvalue=4'
- ./test_compliance --nodes 'ns=1;s="/TechUnits/ESE/ControlComponent1"' --siProfile OPERATIONS --namespace 'acplt.org/' --timeout 1 --gtest_filter=-*_Optional --gtest_output="xml:test_OPERATIONS.xml"
- ./test_compliance --nodes 'ns=1;s="/TechUnits/ESE/ControlComponent1"' --siProfile OPERATIONS --namespace 'acplt.org/' --timeout 1 --gtest_filter=-*_Optional:*_Behaviour --gtest_output="xml:test_OPERATIONS.xml"
artifacts:
when: always
paths:
......
......@@ -22,6 +22,9 @@
#include <open62541/util.h>
#endif
/* Create optional nodes */
static UA_Boolean CREATE_OPTIONONAL_NODES = true;
/* Print a NodeId in logs */
#define UA_NODEID_WRAP(NODEID, INPUT) \
{ \
......
......@@ -200,6 +200,8 @@ createControlComponentExample(UA_Server *server, SI_PROFILE profile, EXAMPLE exa
NULL, NULL);
/* Find the node id of the PROFILE/SI child variable */
if(!CREATE_OPTIONONAL_NODES)
return;
UA_BrowsePath bp;
UA_BrowsePath_init(&bp);
bp.startingNode = UA_NODEID_NUMERIC(NS_APPLICATION, componentNo);
......@@ -219,8 +221,7 @@ createControlComponentExample(UA_Server *server, SI_PROFILE profile, EXAMPLE exa
if(bpr.statusCode != UA_STATUSCODE_GOOD || bpr.targetsSize < 1) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND,
"Error creating new dummy control component no. %i. Browse for "
"%i:PROFILE/%i:SI"
"returned: %s with targetSize %i",
"%i:PROFILE/%i:SI returned: %s with targetSize %i",
componentNo, NS_PROFILES, NS_PROFILES,
UA_StatusCode_name(bpr.statusCode), (int)bpr.targetsSize);
return;
......
......@@ -75,27 +75,47 @@ createProfile_OPERATIONS(UA_Server *server) {
addMethod(server, "START", "Start",
"Execution state command: may be called, when operation mode is selected "
"and WORKST is READY.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, NULL);
addMethod(server, "STOP", "Stop",
"Execution state command: stops the component during IDLE, EXECUTE, HOLD, "
"SUSPEND, COMPLETE and their transient states.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, NULL);
addMethod(server, "RESET", "Reset",
"Execution state command: resets a STOPPED component.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, NULL);
addMethod(server, "CLEAR", "Clear",
"Execution state command: clears an component from ABORTED state.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, NULL);
addMethod(server, "ABORT", "Abort",
"Execution state command: aborts the commands execution from any state.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, NULL);
// TODO add other exst methods
addMethod(server, "HOLD", "Hold",
"Execution state command: holds the component because of an internal error "
"from EXECUTE.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
addMethod(server, "UNHOLD", "Unhold",
"Execution state command: resumes EXECUTE state from HELD.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
addMethod(server, "SUSPEND", "Suspend",
"Execution state command: suspends the component because of an external "
"condition from EXECUTE.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
addMethod(server, "UNSUSPEND", "Unsuspend",
"Execution state command: resumes EXECUTE state from SUSPENDED.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, NULL);
// EXMODE
addMethod(server, "AUTO", "Automatic",
"Execution mode command: change to automatic execution.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE,
cc_Operation);
addMethod(
server, "MANUAL", "Manual", "Execution mode command: change to manual execution",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE, cc_Operation);
addMethod(server, "SEMIAUTO", "SemiAutomatic",
"Execution mode command: change to semiautomatic execution.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
cc_Operation);
addMethod(
server, "MANUAL", "Manual", "Execution mode command: change to manual execution",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE, cc_Operation);
addMethod(server, "SIMULATE", "Simulate",
"Execution mode command: change to simulation mode.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
......@@ -104,17 +124,17 @@ createProfile_OPERATIONS(UA_Server *server) {
addMethod(server, "FREE", "Free",
"Occupation command: free control component, so that other senders are "
"able to occupy the component.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE,
cc_Operation);
addMethod(server, "OCCUPY", "Occupy",
"Occupation command: occupy control component, so that other senders can't "
"occupy and operate the component.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE,
cc_Operation);
addMethod(server, "PRIO", "Priority",
"Occupation command: occupy with priority to overwrite the occupation of "
"another sender. Should only be used by operator or maintainer.",
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_FALSE,
UA_NODEID_NUMERIC(NS_PROFILES, idMethod++), idFolder, UA_TRUE,
cc_Operation);
// OPMODE
addMethod(
......@@ -208,28 +228,28 @@ createControlComponentStatusType(UA_Server *server) {
addStringProperty(server, "EXMODE", "ExecutionMode",
"Current execution mode: AUTO, SEMIAUTO, MANUAL, SIMULATE",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "AUTO", UA_FALSE,
UA_FALSE);
UA_TRUE);
addStringProperty(
server, "EXST", "ExecutionState", "Current execution state (PackML State).",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "IDLE", UA_FALSE, UA_FALSE);
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "IDLE", UA_FALSE, UA_TRUE);
addStringProperty(
server, "OPMODE", "OperationMode", "Current operation mode / program.",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "BSTATE", UA_FALSE, UA_FALSE);
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "BSTATE", UA_FALSE, UA_TRUE);
// optional --> Depending on profile
addStringProperty(server, "OCCUPIER", "Occupier", "ID of current occupier.",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id,
OC_STATE_FREE_OCCUPIER, UA_FALSE, UA_FALSE);
OC_STATE_FREE_OCCUPIER, UA_FALSE, UA_TRUE);
addStringProperty(server, "OCCST", "OccupationState",
"Current occupation state: FREE, OCCUPIED, PRIO, LOCAL",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "FREE", UA_FALSE,
UA_FALSE);
UA_TRUE);
// optional --> Recommended but not mandatory states
addStringProperty(server, "OCCLAST", "LastOccupier", "ID of previous occupier.",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id,
OC_STATE_FREE_OCCUPIER, UA_FALSE, UA_FALSE);
addStringProperty(
server, "ER", "Error", "Current error state. OK if no error is present.",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "OK", UA_FALSE, UA_FALSE);
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "OK", UA_FALSE, UA_TRUE);
addStringProperty(server, "ERLAST", "LastError", "Previous error state.",
UA_NODEID_NUMERIC(NS_PROFILES, idVariable++), id, "OK", UA_FALSE,
UA_FALSE);
......@@ -260,8 +280,8 @@ createControlComponentInterface(UA_Server *server) {
UA_Server_addVariableNode(
server, profileId, id, UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
UA_QUALIFIEDNAME(NS_PROFILES, "PROFILE"), ID_CCPROFILETYPE, vAttr, NULL, NULL);
/* Make the variable mandatory */
markMandatory(server, profileId, UA_TRUE);
// Make the variable optional
markMandatory(server, profileId, UA_FALSE);
/* Create Status Variable Type and instanciate it */
createControlComponentStatusType(server);
......@@ -275,7 +295,7 @@ createControlComponentInterface(UA_Server *server) {
UA_Server_addVariableNode(
server, statusId, id, UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY),
UA_QUALIFIEDNAME(NS_PROFILES, "STATUS"), ID_CCSTATUSTYPE, vAttr, NULL, NULL);
/* Make the variable mandatory */
// Make the variable mandatory
markMandatory(server, statusId, UA_TRUE);
/* Create specialised types for every profile */
......
......@@ -243,7 +243,8 @@ createOptionalChildCallback(UA_Server *server, const UA_NodeId *sessionId,
void *sessionContext, const UA_NodeId *sourceNodeId,
const UA_NodeId *targetParentNodeId,
const UA_NodeId *referenceTypeId) {
return UA_TRUE;
// TODO add modelling rules for profiles and command line option for 'optional'
return CREATE_OPTIONONAL_NODES;
}
/* Overwrite default activateSession and closeSession callbacks from AccessControl to
......
#include <test_ProfileServer.h>
// TODO Change profile values and tests according to wiki (BASYS, PACKML, MTP, ...)
TEST_COMPLIANCE(ES, ANY) {
DOC_TEST("Checks for any execution state profile")
/* Check that status variable is present */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment