feat(nodesetinjector): Integration of the Nodesetinjector into the tests and addition of documentation.

This commit is contained in:
Noel Graf 2023-05-25 10:05:10 +02:00 committed by andreasebner
parent d0ec7f1209
commit 546e0e2c27
16 changed files with 124 additions and 151 deletions

View File

@ -1422,6 +1422,8 @@ ua_generate_nodeid_header(
FILE_CSV "${UA_FILE_NODEIDS}"
)
# we need a custom target to avoid that the generator is called concurrently and
# thus overwriting files while the other thread is compiling
add_custom_target(open62541-generator-statuscode DEPENDS
${PROJECT_BINARY_DIR}/src_generated/open62541/nodeids.h
${PROJECT_BINARY_DIR}/src_generated/open62541/statuscodes.h
@ -1915,14 +1917,5 @@ set_target_properties(open62541-generator-transport PROPERTIES FOLDER "open62541
set_target_properties(open62541-generator-types PROPERTIES FOLDER "open62541/generators")
if(UA_ENABLE_NODESET_INJECTOR)
set_target_properties(open62541-generator-nodesetinjector PROPERTIES FOLDER "open62541/generators")
endif()
assign_source_group(${lib_sources})
assign_source_group(${internal_headers})
assign_source_group(${exported_headers})
assign_source_group(${default_plugin_sources})
assign_source_group(${ua_architecture_sources})
if(UA_ENABLE_NODESET_INJECTOR)
add_subdirectory(tools/nodeset_injector)
endif()

View File

@ -476,3 +476,29 @@ Finally you need to include all these files in your build process and call the c
}
retval = UA_Server_run(server, &running);
Automatic Nodesetinjection
................................
The nodesetinjector is a mechanism for automatically loading nodeset/companion specifications during server initialization.
It provides a fast and easy way to load nodesets in all applications, focusing on the official OPCFoundation/UANodeset Repository ( https://github.com/OPCFoundation/UA-Nodeset ).
Specify the required information models using CMake.
Which nodesets are to be loaded is determined by the Cmake flag ``DUA_INFORMATION_MODEL_AUTOLOAD``. All nodesets that are to be loaded automatically are listed here.
The naming is based on the folder name of the Companion Specification in the ua-nodeset folder.
A CMake call could look like this.
.. code-block:: bash
-DCMAKE_BUILD_TYPE=Debug
-DUA_BUILD_EXAMPLES=ON
-DUA_INFORMATION_MODEL_AUTOLOAD=DI;POWERLINK;PROFINET;MachineVision
-DUA_NAMESPACE_ZERO=FULL
The order of nodesets is important! Nodesets that build on other nodesets must be placed after them in the list.
The following nodesets are currently supported.
* DI, ISA95-JOBCONTROL, OpenSCS, DEXPI, AMB, AutoID, POWERLINK, IA, Machinery, PackML, PNEM, PLCopen, MachineTool, PROFINET, MachineVision, FDT, CommercialKitchenEquipment,
PNRIO, Scales, Weihenstephan, Pumps, CAS, TMC, IJT

View File

@ -40,8 +40,7 @@ ua_generate_nodeid_header(
add_example(server_nodeset server_nodeset.c
${UA_NODESET_EXAMPLE_SOURCES}
${PROJECT_BINARY_DIR}/src_generated/open62541/example_nodeids.h
)
${PROJECT_BINARY_DIR}/src_generated/open62541/example_nodeids.h)
add_dependencies(server_nodeset open62541-generator-ns-example open62541-generator-ids_example)
if(UA_NAMESPACE_ZERO STREQUAL "FULL")
@ -75,7 +74,7 @@ else()
set(FILE_NS_DIRPREFIX ${UA_NODESET_DIR})
endif()
## PLCopen requires the full ns0 as basis
# PLCopen requires the full ns0 as basis
if(UA_NAMESPACE_ZERO STREQUAL "FULL")
# Generate types and namespace for DI

View File

@ -32,9 +32,9 @@ int main(int argc, char** argv) {
UA_StatusCode retval = UA_STATUSCODE_GOOD;
/* create nodes from nodeset */
size_t idx = LONG_MAX;
size_t idx = (size_t) -1;
UA_Server_getNamespaceByName(server, UA_STRING("http://opcfoundation.org/UA/DI/"), &idx);
if(idx == LONG_MAX) {
if(idx != (size_t) -1) {
retval = namespace_di_generated(server);
if(retval != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
@ -43,9 +43,9 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
}
idx = LONG_MAX;
idx = (size_t) -1;
UA_Server_getNamespaceByName(server, UA_STRING("http://PLCopen.org/OpcUa/IEC61131-3/"), &idx);
if(idx == LONG_MAX) {
if(idx != (size_t) -1) {
retval = namespace_plc_generated(server);
if(retval != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,

View File

@ -32,9 +32,9 @@ int main(int argc, char** argv) {
UA_StatusCode retval = UA_STATUSCODE_GOOD;
/* create nodes from nodeset */
size_t idx = LONG_MAX;
size_t idx = (size_t) -1;
UA_Server_getNamespaceByName(server, UA_STRING("http://opcfoundation.org/UA/DI/"), &idx);
if(idx == LONG_MAX) {
if(idx != (size_t) -1) {
retval = namespace_di_generated(server);
if(retval != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
@ -43,9 +43,9 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
}
idx = LONG_MAX;
idx = (size_t) -1;
UA_Server_getNamespaceByName(server, UA_STRING("http://opcfoundation.org/UA/POWERLINK/"), &idx);
if(idx == LONG_MAX) {
if(idx != (size_t) -1) {
retval = namespace_powerlink_generated(server);
if(retval != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,

View File

@ -215,9 +215,12 @@ function(ua_add_test test_path_relative)
string(REPLACE "/" ";" QUALIFIED_PATHNAME ${PATH_WITHOUT_EXTENSION})
list(POP_BACK QUALIFIED_PATHNAME TEST_NAME)
add_executable(${TEST_NAME} ${test_path_relative} $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_executable(${TEST_NAME} ${test_path_relative} ${ARGN} $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
target_link_libraries(${TEST_NAME} ${LIBS})
add_test_valgrind(${TEST_NAME} ${TESTS_BINARY_DIR}/${TEST_NAME})
if(UA_ENABLE_NODESET_INJECTOR)
set(UA_NODESETINJECTOR_TEST_NAMES ${TEST_NAME} ${UA_NODESETINJECTOR_TEST_NAMES} PARENT_SCOPE)
endif()
endfunction()
ua_add_test(check_types_builtin.c)
@ -425,9 +428,7 @@ endif()
# Test Encryption and Authentication
if(UA_ENABLE_ENCRYPTION)
add_executable(check_client_encryption client/check_client_encryption.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
target_link_libraries(check_client_encryption ${LIBS})
add_test_valgrind(client_encryption ${TESTS_BINARY_DIR}/check_client_encryption)
ua_add_test(client/check_client_encryption.c)
if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_ENCRYPTION_MBEDTLS)
ua_add_test(client/check_client_authentication.c)
@ -465,8 +466,10 @@ endif()
# Tests for interfaces
if(UA_NAMESPACE_ZERO STREQUAL "FULL")
add_executable(check_interfaces server/check_interfaces.c ${NODESET_COMPILER_OUTPUT_DIR}/namespace_tests_interfaces_generated.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
ua_add_test(server/check_interfaces.c ${NODESET_COMPILER_OUTPUT_DIR}/namespace_tests_interfaces_generated.c)
target_include_directories(check_interfaces PRIVATE ${NODESET_COMPILER_OUTPUT_DIR})
target_link_libraries(check_interfaces ${LIBS})
add_test_valgrind(check_interfaces ${TESTS_BINARY_DIR}/check_interfaces)
endif()
if(UA_ENABLE_NODESET_INJECTOR)
set(UA_NODESETINJECTOR_TEST_NAMES ${UA_NODESETINJECTOR_TEST_NAMES} PARENT_SCOPE)
endif()

View File

@ -31,15 +31,11 @@ if(UA_NAMESPACE_ZERO STREQUAL "FULL")
INTERNAL
)
add_executable(check_nodeset_compiler_adi check_nodeset_compiler_adi.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_ADI_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_ADI_SOURCES}
$<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_dependencies(check_nodeset_compiler_adi open62541-generator-ns-tests-adi)
target_link_libraries(check_nodeset_compiler_adi ${LIBS})
add_test_valgrind(nodeset_compiler_adi ${TESTS_BINARY_DIR}/check_nodeset_compiler_adi)
ua_add_test(check_nodeset_compiler_adi.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_ADI_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_ADI_SOURCES})
# generate PLCopen namespace which is using DI
ua_generate_nodeset_and_datatypes(
@ -52,15 +48,11 @@ if(UA_NAMESPACE_ZERO STREQUAL "FULL")
INTERNAL
)
add_executable(check_nodeset_compiler_plc check_nodeset_compiler_plc.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_PLC_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_PLC_SOURCES}
$<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_dependencies(check_nodeset_compiler_plc open62541-generator-ns-tests-plc)
target_link_libraries(check_nodeset_compiler_plc ${LIBS})
add_test_valgrind(nodeset_compiler_plc ${TESTS_BINARY_DIR}/check_nodeset_compiler_plc)
ua_add_test(check_nodeset_compiler_plc.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_PLC_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_PLC_SOURCES})
# generate AutoID namespace which is using DI (test e.g. for structures with optional fields)
ua_generate_nodeset_and_datatypes(
@ -74,17 +66,11 @@ if(UA_NAMESPACE_ZERO STREQUAL "FULL")
INTERNAL
)
add_executable(check_nodeset_compiler_autoid check_nodeset_compiler_autoid.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_AUTOID_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_AUTOID_SOURCES}
$<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_dependencies(check_nodeset_compiler_autoid open62541-generator-ns-tests-autoid)
target_link_libraries(check_nodeset_compiler_autoid ${LIBS})
add_test_valgrind(nodeset_compiler_autoid ${TESTS_BINARY_DIR}/check_nodeset_compiler_autoid)
ua_add_test(check_nodeset_compiler_autoid.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_AUTOID_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_AUTOID_SOURCES})
endif()
#[[ua_generate_datatypes(
@ -95,15 +81,11 @@ endif()
FILES_BSD "${PROJECT_SOURCE_DIR}/tests/nodeset-compiler/testtypes.bsd"
)
add_executable(check_nodeset_compiler_optstructs_union check_nodeset_compiler_optstructs_union.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_PLC_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_PLC_SOURCES}
$<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_dependencies(check_nodeset_compiler_optstructs_union open62541-generator-types-optstruct-union)
target_link_libraries(check_nodeset_compiler_optstructs_union ${LIBS})
add_test_valgrind(check_nodeset_compiler_optstructs_union ${TESTS_BINARY_DIR}/check_nodeset_compiler_optstructs_union)]]
ua_add_test(check_nodeset_compiler_optstructs_union.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_PLC_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_PLC_SOURCES})]]
#generate testnodeset
if(UA_NAMESPACE_ZERO STREQUAL "FULL")
@ -119,13 +101,13 @@ if(UA_NAMESPACE_ZERO STREQUAL "FULL")
DEPENDS "tests-di"
)
add_executable(check_nodeset_compiler_testnodeset check_nodeset_compiler_testnodeset.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_TESTNODESET_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_TESTNODESET_SOURCES}
$<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-testplugins>)
add_dependencies(check_nodeset_compiler_testnodeset open62541-generator-ns-tests-testnodeset)
target_link_libraries(check_nodeset_compiler_testnodeset ${LIBS})
add_test_valgrind(nodeset_compiler_testnodeset ${TESTS_BINARY_DIR}/check_nodeset_compiler_testnodeset)
ua_add_test(check_nodeset_compiler_testnodeset.c
${UA_NODESET_TESTS_DI_SOURCES}
${UA_NODESET_TESTS_TESTNODESET_SOURCES}
${UA_TYPES_TESTS_DI_SOURCES}
${UA_TYPES_TESTS_TESTNODESET_SOURCES})
endif()
if(UA_ENABLE_NODESET_INJECTOR)
set(UA_NODESETINJECTOR_TEST_NAMES ${UA_NODESETINJECTOR_TEST_NAMES} PARENT_SCOPE)
endif()

View File

@ -34,7 +34,6 @@ START_TEST(Server_compareDiNodeset) {
ck_assert(config->customDataTypes);
UA_UInt16 nsIndex = UA_Server_addNamespace(server, "http://opcfoundation.org/UA/DI/");
printf("%d\n", nsIndex);
for(int i = 0; i < UA_TYPES_NODESETLOADER_DI_COUNT; ++i) {
UA_TYPES_NODESETLOADER_DI[i].typeId.namespaceIndex = nsIndex;

View File

@ -468,13 +468,10 @@ function build_all_companion_specs {
mkdir -p build; cd build; rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DUA_BUILD_EXAMPLES=ON \
-DUA_INFORMATION_MODEL_AUTOLOAD=DI\;ISA95-JOBCONTROL\;OpenSCS\; \
DEXPI\;AMB\;AutoID\;POWERLINK\;IA\;Machinery\; \
PackML\;PNEM\;PLCopen\;MachineTool\;PROFINET\; \
MachineVision\;FDT\;CommercialKitchenEquipment\; \
PNRIO\;Scales\;Weihenstephan\;Pumps\;CAS\;TMC \
-DUA_BUILD_UNIT_TESTS=ON \
-DUA_INFORMATION_MODEL_AUTOLOAD=DI\;ISA95-JOBCONTROL\;OpenSCS\;DEXPI\;AMB\;AutoID\;POWERLINK\;IA\;Machinery\;PackML\;PNEM\;PLCopen\;MachineTool\;PROFINET\;MachineVision\;FDT\;CommercialKitchenEquipment\;Scales\;Weihenstephan\;Pumps\;CAS\;TMC \
-DUA_NAMESPACE_ZERO=FULL \
..
make ${MAKEOPTS} tutorial_server_firststeps
./bin/examples/tutorial_server_firststeps
make ${MAKEOPTS} check_nodeset_compiler_testnodeset
./bin/tests/check_nodeset_compiler_testnodeset
}

View File

@ -50,11 +50,8 @@ function(ua_generate_nodeid_header)
endif()
if(UA_GEN_ID_AUTOLOAD AND UA_ENABLE_NODESET_INJECTOR)
#TODO: Check if it is a problem that the generator and the source file may be included in the list more than once.
list(APPEND UA_NODESETINJECTOR_GENERATORS ${UA_GEN_ID_TARGET_PREFIX}-${UA_GEN_ID_TARGET_SUFFIX})
set(UA_NODESETINJECTOR_GENERATORS ${UA_NODESETINJECTOR_GENERATORS} PARENT_SCOPE)
#list(APPEND UA_NODESETINJECTOR_SOURCE_FILES ${UA_GEN_ID_OUTPUT_DIR}/${UA_GEN_ID_NAME}.h)
#set(UA_NODESETINJECTOR_SOURCE_FILES ${UA_NODESETINJECTOR_SOURCE_FILES} PARENT_SCOPE)
endif()
# Make sure that the output directory exists
@ -222,12 +219,10 @@ function(ua_generate_datatypes)
add_custom_target(${UA_GEN_DT_TARGET_PREFIX}-${UA_GEN_DT_TARGET_SUFFIX} DEPENDS
${UA_GEN_DT_OUTPUT_DIR}/${UA_GEN_DT_NAME}_generated.c
${UA_GEN_DT_OUTPUT_DIR}/${UA_GEN_DT_NAME}_generated.h
${UA_GEN_DT_OUTPUT_DIR}/${UA_GEN_DT_NAME}_generated_handling.h
)
${UA_GEN_DT_OUTPUT_DIR}/${UA_GEN_DT_NAME}_generated_handling.h)
endif()
if(UA_GEN_DT_AUTOLOAD AND UA_ENABLE_NODESET_INJECTOR)
#TODO: Check if it is a problem that the generator and the source file may be included in the list more than once.
list(APPEND UA_NODESETINJECTOR_GENERATORS ${UA_GEN_DT_TARGET_PREFIX}-${UA_GEN_DT_TARGET_SUFFIX})
set(UA_NODESETINJECTOR_GENERATORS ${UA_NODESETINJECTOR_GENERATORS} PARENT_SCOPE)
list(APPEND UA_NODESETINJECTOR_SOURCE_FILES ${PROJECT_BINARY_DIR}/src_generated/open62541/${UA_GEN_DT_NAME}_generated.c)
@ -409,8 +404,7 @@ function(ua_generate_nodeset)
add_custom_target(${UA_GEN_NS_TARGET_PREFIX}-${TARGET_SUFFIX}
DEPENDS
${UA_GEN_NS_OUTPUT_DIR}/namespace${FILE_SUFFIX}.c
${UA_GEN_NS_OUTPUT_DIR}/namespace${FILE_SUFFIX}.h
)
${UA_GEN_NS_OUTPUT_DIR}/namespace${FILE_SUFFIX}.h)
endif()
if(UA_GEN_NS_AUTOLOAD)
@ -552,18 +546,6 @@ function(ua_generate_nodeset_and_datatypes)
message(FATAL_ERROR "ua_generate_nodeset_and_datatypes function requires FILE_CSV argument if any of FILE_BSD or NAMESPACE_MAP are set")
endif()
# if((NOT UA_GEN_FILE_BSD OR "${UA_GEN_FILE_BSD}" STREQUAL "") AND
# (NOT "${UA_GEN_FILE_CSV}" STREQUAL "" OR
# NOT "${UA_GEN_NAMESPACE_MAP}" STREQUAL ""))
# message(FATAL_ERROR "ua_generate_nodeset_and_datatypes function requires FILE_BSD argument if any of FILE_CSV or NAMESPACE_MAP are set")
# endif()
# if(NOT UA_GEN_NAMESPACE_MAP OR "${UA_GEN_NAMESPACE_MAP}" STREQUAL "" AND
# (NOT "${UA_GEN_FILE_CSV}" STREQUAL "" OR
# NOT "${UA_GEN_FILE_BSD}" STREQUAL ""))
# message(FATAL_ERROR "ua_generate_nodeset_and_datatypes function requires NAMESPACE_MAP argument if any of FILE_CSV or FILE_BSD are set")
# endif()
# Set default value for output dir
if(NOT UA_GEN_OUTPUT_DIR OR "${UA_GEN_OUTPUT_DIR}" STREQUAL "")
set(UA_GEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/src_generated/open62541)
@ -605,10 +587,6 @@ function(ua_generate_nodeset_and_datatypes)
string(TOUPPER "${DEPENDS_NAME}" DEPENDS_NAME)
get_property(DEPENDS_NAMESPACE_MAP GLOBAL PROPERTY "UA_GEN_DT_DEPENDS_NAMESPACE_MAP_${DEPENDS_NAME}")
if(NOT DEPENDS_NAMESPACE_MAP OR "${DEPENDS_NAMESPACE_MAP}" STREQUAL "")
#message(FATAL_ERROR "Nodeset dependency ${f} needs to be generated before ${UA_GEN_NAME}")
endif()
set(NAMESPACE_MAP_DEPENDS ${NAMESPACE_MAP_DEPENDS} "${DEPENDS_NAMESPACE_MAP}")
endforeach()
endif()

View File

@ -1,11 +1,12 @@
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
### This Source Code Form is subject to the terms of the Mozilla Public
### License, v. 2.0. If a copy of the MPL was not distributed with this
### file, You can obtain one at http://mozilla.org/MPL/2.0/.
### Copyright 2023 (c) Fraunhofer IOSB (Author: Noel Graf)
from __future__ import print_function
import sys
import xml.dom.minidom as dom
import codecs

View File

@ -12,8 +12,6 @@
from __future__ import print_function
import re
from os.path import basename
import logging
import codecs

View File

@ -150,7 +150,6 @@ for xmlfile in args.existing:
ns.addNodeSet(xmlfile, True, typesArray=getTypesArray(nsCount))
nsCount += 1
continue
ns.addNodeSet(xmlfile, True, typesArray="UA_TYPES")
for xmlfile in args.infiles:

View File

@ -31,11 +31,10 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
INTERNAL
AUTOLOAD
)
endif()
# only one xml file
# di as dependency
if(MODEL STREQUAL "AutoID" OR MODEL STREQUAL "CSPPlusForMachine" OR MODEL STREQUAL "POWERLINK"
elseif(MODEL STREQUAL "AutoID" OR MODEL STREQUAL "CSPPlusForMachine" OR MODEL STREQUAL "POWERLINK"
OR MODEL STREQUAL "Scales" OR MODEL STREQUAL "IA" OR MODEL STREQUAL "FDT"
OR MODEL STREQUAL "CommercialKitchenEquipment" OR MODEL STREQUAL "Machinery")
# get csv file
@ -64,11 +63,9 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
AUTOLOAD
DEPENDS "di"
)
endif()
# more dependencies
if(MODEL STREQUAL "CAS")
elseif(MODEL STREQUAL "CAS")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.${MODEL}.NodeIds.csv"
@ -79,8 +76,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "machinery"
DEPENDS "ia"
)
endif()
if(MODEL STREQUAL "TMC")
elseif(MODEL STREQUAL "TMC")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.${MODEL}.NodeIds.csv"
@ -91,8 +87,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "di"
DEPENDS "packml"
)
endif()
if(MODEL STREQUAL "Pumps")
elseif(MODEL STREQUAL "Pumps")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.${MODEL}.NodeSet2.csv"
@ -102,8 +97,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "di"
DEPENDS "machinery"
)
endif()
if(MODEL STREQUAL "Weihenstephan")
elseif(MODEL STREQUAL "Weihenstephan")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/NodeIds.csv"
@ -114,8 +108,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "machinery"
DEPENDS "packml"
)
endif()
if(MODEL STREQUAL "MachineTool")
elseif(MODEL STREQUAL "MachineTool")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/NodeIds.csv"
@ -126,10 +119,8 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "machinery"
DEPENDS "ia"
)
endif()
# Extra
if(MODEL STREQUAL "DI")
elseif(MODEL STREQUAL "DI")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.Di.NodeIds.csv"
@ -137,8 +128,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
INTERNAL
AUTOLOAD
)
endif()
if(MODEL STREQUAL "PROFINET")
elseif(MODEL STREQUAL "PROFINET")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.Pn.NodeIds.csv"
@ -146,8 +136,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
INTERNAL
AUTOLOAD
)
endif()
if(MODEL STREQUAL "Glass")
elseif(MODEL STREQUAL "Glass")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Flat/NodeIds.csv"
@ -158,8 +147,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "di"
DEPENDS "machinery"
)
endif()
if(MODEL STREQUAL "IJT")
elseif(MODEL STREQUAL "IJT")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Tightening/NodeIds.csv"
@ -170,8 +158,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
DEPENDS "di"
DEPENDS "machinery"
)
endif()
if(MODEL STREQUAL "OpenSCS")
elseif(MODEL STREQUAL "OpenSCS")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/NodeIds.csv"
@ -179,8 +166,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
INTERNAL
AUTOLOAD
)
endif()
if(MODEL STREQUAL "PNEM")
elseif(MODEL STREQUAL "PNEM")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/NodeIds.csv"
@ -189,8 +175,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
AUTOLOAD
DEPENDS "di"
)
endif()
if(MODEL STREQUAL "PNRIO")
elseif(MODEL STREQUAL "PNRIO")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/NodeIds.csv"
@ -199,8 +184,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
AUTOLOAD
DEPENDS "di"
)
endif()
if(MODEL STREQUAL "ISA95-JOBCONTROL")
elseif(MODEL STREQUAL "ISA95-JOBCONTROL")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/opc.ua.isa95-jobcontrol.nodeset2.csv"
@ -208,8 +192,7 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
INTERNAL
AUTOLOAD
)
endif()
if(MODEL STREQUAL "PLCopen")
elseif(MODEL STREQUAL "PLCopen")
ua_generate_nodeset_and_datatypes(
NAME "${NODESET_NAME}"
FILE_CSV "${UA_NODESET_DIR}/${MODEL}/Opc.Ua.${MODEL}.NodeSet2_V1.02.csv"
@ -218,6 +201,8 @@ foreach(MODEL ${UA_INFORMATION_MODEL_AUTOLOAD})
AUTOLOAD
DEPENDS "di"
)
else()
MESSAGE(WARNING "The specified nodeset '${MODEL}' is not supported or is misspelled.")
endif()
endforeach()
@ -231,3 +216,12 @@ foreach(EXAMPLE_NAME ${UA_NODESETINJECTOR_EXAMPLE_NAMES})
add_dependencies(${EXAMPLE_NAME} ${UA_NODESETINJECTOR_GENERATORS})
endif()
endforeach()
if(UA_BUILD_UNIT_TESTS)
foreach(TEST_NAME ${UA_NODESETINJECTOR_TEST_NAMES})
if(UA_NODESETINJECTOR_GENERATORS)
target_link_libraries(${TEST_NAME} autoinject_library)
add_dependencies(${TEST_NAME} ${UA_NODESETINJECTOR_GENERATORS})
endif()
endforeach()
endif()

View File

@ -1,8 +1,10 @@
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
### This Source Code Form is subject to the terms of the Mozilla Public
### License, v. 2.0. If a copy of the MPL was not distributed with this
### file, You can obtain one at http://mozilla.org/MPL/2.0/.
### Copyright 2023 (c) Fraunhofer IOSB (Author: Noel Graf)
import argparse
from io import open

View File

@ -1,8 +1,10 @@
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
### This Source Code Form is subject to the terms of the Mozilla Public
### License, v. 2.0. If a copy of the MPL was not distributed with this
### file, You can obtain one at http://mozilla.org/MPL/2.0/.
### Copyright 2023 (c) Fraunhofer IOSB (Author: Noel Graf)
import argparse
import re