From a8afadc66fa65f2d668d3b2296f49bc56298a2b9 Mon Sep 17 00:00:00 2001 From: "m.nabywaniec" <mateusz.nabywaniec@s2innovation.com> Date: Fri, 9 Sep 2022 08:35:12 +0000 Subject: [PATCH] silecs-cli: Add support for "release param" feature (Issue #59) MR !3 --- silecs_cli/README.md | 13 +- silecs_cli/silecs.py | 101 ++++++- .../examples/SilecsTestClass.silecsdesign | 16 -- .../examples/SilecsTestClassDU.silecsdeploy | 21 -- .../SilecsTestClassDU_invalid.silecsdeploy | 3 +- .../examples/SilecsTestClass_2_DU.deploy | 24 -- .../src}/SilecsTestClass.design | 268 +++++++++--------- .../client/tsts7001.silecsparam | 40 +++ .../generated-silecs/controller/tsts7001.scl | 82 ++++++ .../generated-silecs/controller/tsts7001.sdf | 5 + .../generated-silecs/wrapper/SilecsHeader.h | 38 +++ .../wrapper/SilecsTestClass.h | 38 +++ .../generated-silecs/wrapper/Tsts7001.h | 167 +++++++++++ .../src/SilecsTestClass_DU.deploy} | 15 +- .../src/SilecsTestClass_DU.silecsdeploy | 14 + silecs_cli/tests/test_silecs.py | 53 ++-- 16 files changed, 671 insertions(+), 227 deletions(-) delete mode 100644 silecs_cli/tests/examples/SilecsTestClass.silecsdesign delete mode 100644 silecs_cli/tests/examples/SilecsTestClassDU.silecsdeploy delete mode 100644 silecs_cli/tests/examples/SilecsTestClass_2_DU.deploy rename silecs_cli/tests/{examples => testClasses/SilecsTestClass/src}/SilecsTestClass.design (73%) create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/client/tsts7001.silecsparam create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.scl create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.sdf create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsHeader.h create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsTestClass.h create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/Tsts7001.h rename silecs_cli/tests/{examples/SilecsTestClassDU.deploy => testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.deploy} (63%) create mode 100644 silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.silecsdeploy diff --git a/silecs_cli/README.md b/silecs_cli/README.md index 571e1df..0cb0e32 100644 --- a/silecs_cli/README.md +++ b/silecs_cli/README.md @@ -2,4 +2,15 @@ Command line tool for silecs project creation, xml validation, code generation, etc. -Component of the opensilecs PLC-framework. \ No newline at end of file +Component of the opensilecs PLC-framework. + + +## Tests + +In [tests](tests) directory there is a file [tests_silecs.py](tests/tests_silecs.py) containg unit tests written using `unittest` framework. +Directory [testClasses](tests/testClasses) contain example classes uses for tests and some extra example files used for tests are provided in directory [examples](tests/examples). + +Tests can be run using following command: +``` +python3 -m unittest +``` diff --git a/silecs_cli/silecs.py b/silecs_cli/silecs.py index 3b92c39..78f2e2d 100644 --- a/silecs_cli/silecs.py +++ b/silecs_cli/silecs.py @@ -7,7 +7,7 @@ import shutil import subprocess import lxml.etree - +from xml.dom import minidom SILECS_VERSION = "2.3.0" SILECSDESIGN = "silecsdesign" @@ -37,6 +37,12 @@ SILECS_CODEGEN_MIGRATION=f"{SILECS_BASE}/silecs-codegen/xml/migration" # See here for details: https://gitlab.com/al.schwinn/silecs-cli/-/issues/4 SILECS_CODEGEN_FESA=f"{SILECS_BASE}/silecs-codegen/xml/fesa/fesa_7_3_0/" + +try: + RELEASE_PARAM_DIR=(os.environ['RELEASE_PARAM_DIR']) +except KeyError: + RELEASE_PARAM_DIR="/common/export/fesa/local" + # import files for generating sources sys.path.append(SILECS_CODEGEN_BASE) sys.path.append(SILECS_CODEGEN_MIGRATION) @@ -70,6 +76,8 @@ class SilecsArgumentParser(argparse.ArgumentParser): "\t To add missing properties and value-items specified in 'MyClass.silecsdesign' into the FESA document 'MyClass.design'.\n" \ "\t This will as well ate C++ code.\n" \ "\t\t silces -g ~/workspace/MyClass/src/MyClass.silecsdesign\n\n" \ + "\t To release silecs deploy param to FEC specific FESA release directory.\n" \ + "\t\t silces -r ~/workspace/MyClass_DU/src/MyClass_DU.silecsdeploy\n\n" \ "\nCheck the Silecs Wiki for more info: https://www-acc.gsi.de/wiki/Frontend/SILECS\n" \ print(examples) @@ -90,6 +98,12 @@ def get_project_name(filepath): """ return os.path.splitext(os.path.basename(filepath))[0] +def get_filename(filepath): + """Get filename from path + eg. workspace/TestClass/src/TestClass.silecsdesign -> TestClass.silecsdesign + """ + _, filename = os.path.split(filepath) + return filename def get_project_dir(filepath): """Get project dir @@ -349,10 +363,86 @@ def silecs_diagnostic_tool(filepath): ##### Release parameter file ###### +def copy_param_file(fesa_fec_name, param_file_src, project_name): + """Copy file from param_file_src to the default, FEC specific FESA release directory (RELEASE_PARAM_DIR/fesa_fec_name/project_name) + and development directory (RELEASE_PARAM_DIR/fesa_fec_name/project_name-d) . + """ + fesa_fec_dst_folder = os.path.join(RELEASE_PARAM_DIR, fesa_fec_name, f"{project_name}") + fesa_fec_dst_folder_dev = fesa_fec_dst_folder + "-d" + fesa_fec_dst_folders = [fesa_fec_dst_folder_dev, fesa_fec_dst_folder] + + for fesa_fec_dst in fesa_fec_dst_folders: + if not os.path.isdir(fesa_fec_dst): + print(f"Generating folder-structures for FEC: {os.path.abspath(fesa_fec_dst)}") + os.makedirs(fesa_fec_dst) + print("Folder generated") + + param_file_name = get_filename(param_file_src) + fesa_fec_dst_file = os.path.join(fesa_fec_dst, param_file_name) + print(f"Installing parameter-file {param_file_name} to {fesa_fec_dst}.") + with open(fesa_fec_dst_file, 'w+'): + shutil.copyfile(src=param_file_src, dst=fesa_fec_dst_file) + + +def release(filepath): + """Copy generated silecs deploy parameter files to directory""" + filepath = os.path.abspath(filepath) + project_path = get_project_path(filepath) + project_name = get_project_name(filepath) + param_dir = os.path.join(project_path, "generated-silecs", "client") + extension = get_extension(filepath) + + if extension != SILECSDEPLOY: + print(f"Error: you need to provide {SILECSDEPLOY} file") + return False + + try: + silecs_deploy_document = minidom.parse(filepath) + controller_nodes = silecs_deploy_document.getElementsByTagName("Controller") + for controller in controller_nodes: + host_name = controller.getAttribute("host-name") + plc_nodes = controller.childNodes + + plc_element = None + for plc in plc_nodes: + if plc.nodeType == minidom.Node.ELEMENT_NODE: + plc_element = plc + break + if not plc_element: + raise Exception(f"No concrete plc defined for controller: {host_name}") + + device_nodes = plc_element.getElementsByTagName("Device") + fesa_fec_name = None + for device in device_nodes: + fesa_fec_name = device.getAttribute("fesa-fec-name") + device_label = device.getAttribute("silecs-device-label") + + if not fesa_fec_name: + print(f"Skipping controller: {host_name} Reason:") + print(f"For silecs-device {device_label} the attribute @fesa-fec-name is not define") + continue + + param_file_name = f"{host_name}.silecsparam" + param_file_path = os.path.abspath(os.path.join(param_dir, param_file_name)) + if not os.path.isfile(param_file_path): + print(f"Skipping controller: {host_name} Reason:") + print(f"No parameter file found for this controller. Did you run the code-generation ?") + continue + + copy_param_file(fesa_fec_name, param_file_path, project_name) + return True + + except Exception as e: + print(e) + return False def silecs_release(file_paths): - # TODO - See here for details: https://gitlab.com/al.schwinn/silecs-cli/-/issues/5 - print("Not implemented yet .. please copy the param file by hand for now") + for filepath in file_paths: + release_result = release(filepath) + if release_result: + print("Release successfull") + else: + print("Error during release. Check errors above.") ##### Migrate file to new silecs version ###### @@ -411,8 +501,9 @@ def _parse_arguments(): parser.add_argument( "-r", "--release", - metavar="file", - help="release parameter file fo FEC (TODO)" + nargs="+", + metavar="silecsdeploy", + help="release parameter file fo FEC for silecsdeploy file" ) parser.add_argument( diff --git a/silecs_cli/tests/examples/SilecsTestClass.silecsdesign b/silecs_cli/tests/examples/SilecsTestClass.silecsdesign deleted file mode 100644 index ab6dfe5..0000000 --- a/silecs_cli/tests/examples/SilecsTestClass.silecsdesign +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SILECS-Design silecs-version="2.3.0" created="08/22/2022" updated="08/22/2022" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../silecs-model/src/xml/DesignSchema.xsd"> - <Information> - <Owner user-login="localadmin_mnabywan"/> - <Editor user-login="localadmin_mnabywan"/> - </Information> - <SILECS-Class name="SilecsTestDesign" version="0.1.0" domain="OPERATIONAL" > - <Acquisition-Block name="MyBlock" generateFesaProperty="true"> - <Acquisition-Register name="myRegister" generateFesaValueItem="true"> - <scalar format="int32"/> - </Acquisition-Register> - </Acquisition-Block> - </SILECS-Class> -</SILECS-Design> \ No newline at end of file diff --git a/silecs_cli/tests/examples/SilecsTestClassDU.silecsdeploy b/silecs_cli/tests/examples/SilecsTestClassDU.silecsdeploy deleted file mode 100644 index 8e0d34d..0000000 --- a/silecs_cli/tests/examples/SilecsTestClassDU.silecsdeploy +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SILECS-Deploy - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - silecs-version="2.3.0" created="08/16/2022" updated="08/16/2022" - xsi:noNamespaceSchemaLocation="/common/usr/cscofe/silecs/2.3.0/silecs-model/xml/DeploySchema.xsd"> - <Information> - <Owner user-login="mnabywan" /> - <Editor user-login="mnabywan" /> - </Information> - <Deploy-Unit name="SilecsTestClassDU" version="0.1.0"></Deploy-Unit> - <SilecsDesign silecs-design-name="SilecsTestClass" - silecs-design-version="0.1.0" /> - <Controller host-name="tsts7001"> - <Siemens-PLC system="TIA-PORTAL" model="SIMATIC_S7-1500" - protocol="DEVICE_MODE" base-DB-number="1"> - <Device silecs-device-label="dev0" - silecs-design-ref="SilecsTestClass" fesa-device-name="mySilecsTest" - fesa-fec-name="asl751"></Device> - </Siemens-PLC> - </Controller> -</SILECS-Deploy> \ No newline at end of file diff --git a/silecs_cli/tests/examples/SilecsTestClassDU_invalid.silecsdeploy b/silecs_cli/tests/examples/SilecsTestClassDU_invalid.silecsdeploy index 185d2c1..0a2cc8f 100644 --- a/silecs_cli/tests/examples/SilecsTestClassDU_invalid.silecsdeploy +++ b/silecs_cli/tests/examples/SilecsTestClassDU_invalid.silecsdeploy @@ -16,6 +16,7 @@ <Device silecs-device-label="dev0" silecs-design-ref="SilecsTestClass" fesa-device-name="mySilecsTest" fesa-fec-name="asl751"></Device> - </Siemens-PLCerror> + </Siemens-PLC> + <unknown>test123</unknown> </Controller> </SILECS-Deploy> \ No newline at end of file diff --git a/silecs_cli/tests/examples/SilecsTestClass_2_DU.deploy b/silecs_cli/tests/examples/SilecsTestClass_2_DU.deploy deleted file mode 100644 index 8854ede..0000000 --- a/silecs_cli/tests/examples/SilecsTestClass_2_DU.deploy +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><deploy-unit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/opt/fesa/fesa-model-gsi/7.4.0/xml/deployment/deployment-gsi.xsd"> - <information> - <deploy-unit-name>SilecsTestClass2_DU</deploy-unit-name> - <deploy-unit-major-version>0</deploy-unit-major-version> - <deploy-unit-minor-version>1</deploy-unit-minor-version> - <deploy-unit-tiny-version>0</deploy-unit-tiny-version> - <description>Empty Template description</description> - <fesa-version>7.4.0</fesa-version> - </information> - <ownership> - <responsible name="Undefined"/> - <creator login="mnabywan"/> - </ownership> - <class> - <class-name>class-name</class-name> - <class-major-version>0</class-major-version> - <class-minor-version>1</class-minor-version> - <class-tiny-version>0</class-tiny-version> - <device-instance>required</device-instance> - </class> - <executable> - <server extension="_S"/> - </executable> -</deploy-unit> diff --git a/silecs_cli/tests/examples/SilecsTestClass.design b/silecs_cli/tests/testClasses/SilecsTestClass/src/SilecsTestClass.design similarity index 73% rename from silecs_cli/tests/examples/SilecsTestClass.design rename to silecs_cli/tests/testClasses/SilecsTestClass/src/SilecsTestClass.design index 533e85a..c752b4f 100644 --- a/silecs_cli/tests/examples/SilecsTestClass.design +++ b/silecs_cli/tests/testClasses/SilecsTestClass/src/SilecsTestClass.design @@ -16,24 +16,24 @@ <interface> <device-interface> <setting> - <GSI-Init-Property multiplexed="false" name="Init" visibility="operational" id="_220816101616_0"> + <GSI-Init-Property multiplexed="false" name="Init" visibility="operational" id="_220830102016_0"> <description>Control property, used to initialize the device with default values from the device instantiation file</description> <set-action partial-setting="true" transaction="true"> <server-action-ref server-action-name-ref="InitSetAction"/> </set-action> </GSI-Init-Property> - <GSI-Reset-Property multiplexed="false" name="Reset" visibility="operational" id="_220816101616_1"> + <GSI-Reset-Property multiplexed="false" name="Reset" visibility="operational" id="_220830102016_1"> <description>Control property, used to reset the device while keeping the persistent data.</description> <set-action partial-setting="true" transaction="true"> <server-action-ref server-action-name-ref="ResetSetAction"/> </set-action> </GSI-Reset-Property> - <GSI-Setting-Property multiplexed="false" name="Setting" visibility="operational" id="_220816101617_0"> + <GSI-Setting-Property multiplexed="false" name="Setting" visibility="operational" id="_220830102016_2"> <description>Used for setting hardware parameters for controlling the device.</description> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101620_2"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102018_0"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101620_3"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102018_1"> <array type="char"> <dim>32</dim> </array> @@ -45,12 +45,12 @@ <server-action-ref server-action-name-ref="SettingGetAction"/> </get-action> </GSI-Setting-Property> - <GSI-Setting-Property name="MySetting" visibility="development" multiplexed="false" id="_220816115050_0"><value-item name="DQ_Anlog00" direction="INOUT" id="_220817081951_0"><scalar type="int32_t"/><data-field-ref field-name-ref="DQ_Anlog00"/></value-item><value-item name="DQ_Bool07" direction="INOUT" id="_220817081951_1"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool07"/></value-item><value-item name="DQ_Bool06" direction="INOUT" id="_220817081951_2"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool06"/></value-item><value-item name="DQ_Bool05" direction="INOUT" id="_220817081952_0"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool05"/></value-item><value-item name="DQ_Bool04" direction="INOUT" id="_220817081952_1"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool04"/></value-item><value-item name="DQ_Bool03" direction="INOUT" id="_220817081952_2"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool03"/></value-item><value-item name="DQ_Bool02" direction="INOUT" id="_220817081952_3"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool02"/></value-item><value-item name="DQ_Bool01" direction="INOUT" id="_220817081952_4"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool01"/></value-item><value-item name="DQ_Bool00" direction="INOUT" id="_220817081953_0"><scalar type="int16_t"/><data-field-ref field-name-ref="DQ_Bool00"/></value-item><value-item name="mySettingRegister" direction="INOUT" id="_220816115051_1"><scalar type="int32_t"/><data-field-ref field-name-ref="mySettingRegister"/></value-item><update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816115051_2"><builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/></update-flag-item><cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816115052_0"><array type="char"><dim>32</dim></array></cycle-name-item><set-action><server-action-ref server-action-name-ref="SetMySetting"/></set-action><get-action><server-action-ref server-action-name-ref="GetMySetting"/></get-action></GSI-Setting-Property><GSI-Power-Property multiplexed="false" name="Power" visibility="operational" id="_220816101617_1"> + <GSI-Setting-Property name="MySetting" visibility="development" multiplexed="false" id="_220830102016_3"><value-item name="mySettingRegister" direction="INOUT" id="_220830102018_2"><scalar type="int32_t"/><data-field-ref field-name-ref="mySettingRegister"/></value-item><update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102018_3"><builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/></update-flag-item><cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102018_4"><array type="char"><dim>32</dim></array></cycle-name-item><set-action><server-action-ref server-action-name-ref="SetMySetting"/></set-action><get-action><server-action-ref server-action-name-ref="GetMySetting"/></get-action></GSI-Setting-Property><GSI-Power-Property multiplexed="false" name="Power" visibility="operational" id="_220830102016_4"> <description>Used to turn the power of a device on or off.</description> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101621_0"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102018_5"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101621_1"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102019_0"> <array type="char"> <dim>32</dim> </array> @@ -61,7 +61,7 @@ <get-action> <server-action-ref server-action-name-ref="PowerGetAction"/> </get-action> - <power-item direction="INOUT" name="power" id="_220816101621_2"> + <power-item direction="INOUT" name="power" id="_220830102019_1"> <custom-type-scalar data-type-name-ref="DEVICE_POWER"/> <data-field-ref field-name-ref="power"/> @@ -69,32 +69,32 @@ </GSI-Power-Property> </setting> <acquisition> - <GSI-Status-Property cycle-bound="false" name="Status" on-change="true" subscribable="true" visibility="operational" id="_220816101618_0"> + <GSI-Status-Property cycle-bound="false" name="Status" on-change="true" subscribable="true" visibility="operational" id="_220830102016_5"> <description>Used to display the (cycle independent) overall status of the device.</description> <description>Detailed status information may be additionally added to this property.</description> - <acq-stamp-item direction="OUT" name="acqStamp" id="_220816101622_0"> + <acq-stamp-item direction="OUT" name="acqStamp" id="_220830102019_2"> <scalar type="int64_t"/> </acq-stamp-item> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101622_1"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102019_3"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101622_2"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102019_4"> <array type="char"> <dim>32</dim> </array> </cycle-name-item> - <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220816101622_3"> + <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220830102020_0"> <scalar type="int64_t"/> </cycle-stamp-item> <get-action> <server-action-ref server-action-name-ref="StatusGetAction"/> </get-action> - <status-item direction="OUT" name="status" id="_220816101623_0"> + <status-item direction="OUT" name="status" id="_220830102020_1"> <custom-type-scalar data-type-name-ref="DEVICE_STATUS"/> <data-field-ref field-name-ref="status"/> </status-item> - <detailed-status-item direction="OUT" name="detailedStatus" id="_220816101623_1"> + <detailed-status-item direction="OUT" name="detailedStatus" id="_220830102021_0"> <description>Detailed status should consist of an array of boolean values considered as detailed status information as well as a corresponding string array containing keys to illustrate the meaning of the detailed status information.</description> <array type="bool"> @@ -102,7 +102,7 @@ corresponding string array containing keys to illustrate the meaning of the deta </array> <data-field-ref field-name-ref="detailedStatus"/> </detailed-status-item> - <detailed-status-labels-item direction="OUT" name="detailedStatus_labels" id="_220816101623_2"> + <detailed-status-labels-item direction="OUT" name="detailedStatus_labels" id="_220830102021_1"> <description>Labels of detailed status bits.</description> <array2D type="char"> <custom-constant-dim1 constant-name-ref="DETAILED_STATUS_SIZE"/> @@ -110,39 +110,39 @@ corresponding string array containing keys to illustrate the meaning of the deta </array2D> <data-field-ref field-name-ref="detailedStatus_labels"/> </detailed-status-labels-item> - <detailed-status-severity-item direction="OUT" name="detailedStatus_severity" id="_220816101624_0"> + <detailed-status-severity-item direction="OUT" name="detailedStatus_severity" id="_220830102021_2"> <description>Severities of the detailed status bits</description> <custom-type-array data-type-name-ref="DETAILED_STATUS_SEVERITY"> <custom-constant-dim constant-name-ref="DETAILED_STATUS_SIZE"/> </custom-type-array> <data-field-ref field-name-ref="detailedStatus_severity"/> </detailed-status-severity-item> - <powerState-item direction="OUT" name="powerState" id="_220816101624_1"> + <powerState-item direction="OUT" name="powerState" id="_220830102022_0"> <description>Power state of the device (ON, OFF)</description> <custom-type-scalar data-type-name-ref="DEVICE_POWER_STATE"/> <data-field-ref field-name-ref="powerState"/> </powerState-item> - <control-item direction="OUT" name="control" id="_220816101624_2"> + <control-item direction="OUT" name="control" id="_220830102022_1"> <custom-type-scalar data-type-name-ref="DEVICE_CONTROL"/> <data-field-ref field-name-ref="control"/> </control-item> - <interlock-item direction="OUT" name="interlock" id="_220816101624_3"> + <interlock-item direction="OUT" name="interlock" id="_220830102022_2"> <description>Interlock state of the device</description> <scalar type="bool"/> <data-field-ref field-name-ref="interlock"/> </interlock-item> - <opReady-item direction="OUT" name="opReady" id="_220816101625_0"> + <opReady-item direction="OUT" name="opReady" id="_220830102022_3"> <description>Contains the devices state regarding operation</description> <scalar type="bool"/> <data-field-ref field-name-ref="opReady"/> </opReady-item> - <modulesReady-item direction="OUT" name="modulesReady" id="_220816101625_1"> + <modulesReady-item direction="OUT" name="modulesReady" id="_220830102022_4"> <description>Contains the devices module state</description> <scalar type="bool"/> <data-field-ref field-name-ref="modulesReady"/> </modulesReady-item> - <error_collection-item direction="OUT" id="_220816101625_2"> + <error_collection-item direction="OUT" id="_220830102022_5"> <error_codes direction="OUT" name="error_codes"> <array type="int32_t"> <custom-constant-dim constant-name-ref="MAX_NUMBER_OF_ERROR_MESSAGES"/> @@ -168,32 +168,32 @@ corresponding string array containing keys to illustrate the meaning of the deta <error_collection-field-ref field-name-ref="error_collection"/> </error_collection-item> </GSI-Status-Property> - <GSI-ModuleStatus-Property cycle-bound="false" name="ModuleStatus" subscribable="true" visibility="operational" id="_220816101619_0"> + <GSI-ModuleStatus-Property cycle-bound="false" name="ModuleStatus" subscribable="true" visibility="operational" id="_220830102017_0"> <description>Gives detailed information on the state of 3rd party hardware and software components which are required to operate the device.</description> - <acq-stamp-item direction="OUT" name="acqStamp" id="_220816101625_3"> + <acq-stamp-item direction="OUT" name="acqStamp" id="_220830102023_0"> <scalar type="int64_t"/> </acq-stamp-item> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101626_0"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102023_1"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101626_1"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102023_2"> <array type="char"> <dim>32</dim> </array> </cycle-name-item> - <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220816101626_2"> + <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220830102023_3"> <scalar type="int64_t"/> </cycle-stamp-item> <get-action> <server-action-ref server-action-name-ref="ModuleStatusGetAction"/> </get-action> - <module-status-item direction="OUT" name="moduleStatus" id="_220816101627_0"> + <module-status-item direction="OUT" name="moduleStatus" id="_220830102023_4"> <custom-type-array data-type-name-ref="MODULE_STATUS"> <custom-constant-dim constant-name-ref="MODULE_STATUS_SIZE"/> </custom-type-array> <data-field-ref field-name-ref="moduleStatus"/> </module-status-item> - <module-status-labels-item direction="OUT" name="moduleStatus_labels" id="_220816101628_0"> + <module-status-labels-item direction="OUT" name="moduleStatus_labels" id="_220830102025_0"> <array2D type="char"> <custom-constant-dim1 constant-name-ref="MODULE_STATUS_SIZE"/> <custom-constant-dim2 constant-name-ref="MAX_MODULE_STATUS_LABEL_LENGTH"/> @@ -201,26 +201,26 @@ corresponding string array containing keys to illustrate the meaning of the deta <data-field-ref field-name-ref="moduleStatus_labels"/> </module-status-labels-item> </GSI-ModuleStatus-Property> - <GSI-Acquisition-Property cycle-bound="true" name="Acquisition" on-change="true" subscribable="true" visibility="operational" id="_220816101619_1"> + <GSI-Acquisition-Property cycle-bound="true" name="Acquisition" on-change="true" subscribable="true" visibility="operational" id="_220830102017_1"> <description>Used for returning acquisition data which is retrieved from the hardware.</description> - <acq-stamp-item direction="OUT" name="acqStamp" id="_220816101630_0"> + <acq-stamp-item direction="OUT" name="acqStamp" id="_220830102026_0"> <scalar type="int64_t"/> </acq-stamp-item> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101630_1"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102026_1"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101630_2"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102026_2"> <array type="char"> <dim>32</dim> </array> </cycle-name-item> - <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220816101631_0"> + <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220830102026_3"> <scalar type="int64_t"/> </cycle-stamp-item> <get-action> <server-action-ref server-action-name-ref="AcquisitionGetAction"/> </get-action> - <acquisition-context-item direction="OUT" id="_220816101631_1"> + <acquisition-context-item direction="OUT" id="_220830102027_0"> <processIndex direction="OUT" name="processIndex"> <scalar type="int32_t"/> </processIndex> @@ -254,36 +254,36 @@ corresponding string array containing keys to illustrate the meaning of the deta <acquisition-context-field-ref field-name-ref="acquisitionContext"/> </acquisition-context-item> </GSI-Acquisition-Property> - <GSI-Acquisition-Property name="MyBlock" visibility="development" subscribable="true" cycle-bound="false" on-change="true" id="_220816115051_0"><value-item name="DI_Anlog01" direction="OUT" id="_220817081953_1"><scalar type="int32_t"/><data-field-ref field-name-ref="DI_Anlog01"/></value-item><value-item name="DI_Anlog00" direction="OUT" id="_220817081953_2"><scalar type="int32_t"/><data-field-ref field-name-ref="DI_Anlog00"/></value-item><value-item name="DI_Bool07" direction="OUT" id="_220817081953_3"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool07"/></value-item><value-item name="DI_Bool06" direction="OUT" id="_220817081953_4"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool06"/></value-item><value-item name="DI_Bool05" direction="OUT" id="_220817081953_5"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool05"/></value-item><value-item name="DI_Bool04" direction="OUT" id="_220817081954_0"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool04"/></value-item><value-item name="DI_Bool03" direction="OUT" id="_220817081954_1"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool03"/></value-item><value-item name="DI_Bool02" direction="OUT" id="_220817081954_2"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool02"/></value-item><value-item name="DI_Bool01" direction="OUT" id="_220817081954_3"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool01"/></value-item><value-item name="DI_Bool00" direction="OUT" id="_220817081954_4"><scalar type="int16_t"/><data-field-ref field-name-ref="DI_Bool00"/></value-item><value-item name="myRegister" direction="OUT" id="_220816115052_1"><scalar type="int32_t"/><data-field-ref field-name-ref="myRegister"/></value-item><acq-stamp-item direction="OUT" name="acqStamp" id="_220816115052_2"><scalar type="int64_t"/></acq-stamp-item><update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816115052_3"><builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/></update-flag-item><cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816115053_0"><array type="char"><dim>32</dim></array></cycle-name-item><cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220816115053_1"><scalar type="int64_t"/></cycle-stamp-item><get-action><server-action-ref server-action-name-ref="GetMyBlock"/></get-action><acquisition-context-item direction="OUT" id="_220816115053_2"><processIndex direction="OUT" name="processIndex"><scalar type="int32_t"/></processIndex><sequenceIndex direction="OUT" name="sequenceIndex"><scalar type="int32_t"/></sequenceIndex><chainIndex direction="OUT" name="chainIndex"><scalar type="int32_t"/></chainIndex><eventNumber direction="OUT" name="eventNumber"><scalar type="int32_t"/></eventNumber><timingGroupID direction="OUT" name="timingGroupID"><scalar type="int32_t"/></timingGroupID><acquisitionStamp direction="OUT" name="acquisitionStamp"><scalar type="int64_t"/></acquisitionStamp><eventStamp direction="OUT" name="eventStamp"><scalar type="int64_t"/></eventStamp><processStartStamp direction="OUT" name="processStartStamp"><scalar type="int64_t"/></processStartStamp><sequenceStartStamp direction="OUT" name="sequenceStartStamp"><scalar type="int64_t"/></sequenceStartStamp><chainStartStamp direction="OUT" name="chainStartStamp"><scalar type="int64_t"/></chainStartStamp><acquisition-context-field-ref field-name-ref="acquisitionContext"/></acquisition-context-item></GSI-Acquisition-Property><GSI-Version-Property cycle-bound="false" name="Version" on-change="false" subscribable="false" visibility="operational" id="_220816101619_2"> + <GSI-Acquisition-Property name="MyBlock" visibility="development" subscribable="true" cycle-bound="false" on-change="true" id="_220830102017_2"><value-item name="myRegister" direction="OUT" id="_220830102027_1"><scalar type="int32_t"/><data-field-ref field-name-ref="myRegister"/></value-item><acq-stamp-item direction="OUT" name="acqStamp" id="_220830102028_0"><scalar type="int64_t"/></acq-stamp-item><update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102028_1"><builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/></update-flag-item><cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102029_0"><array type="char"><dim>32</dim></array></cycle-name-item><cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220830102029_1"><scalar type="int64_t"/></cycle-stamp-item><get-action><server-action-ref server-action-name-ref="GetMyBlock"/></get-action><acquisition-context-item direction="OUT" id="_220830102029_2"><processIndex direction="OUT" name="processIndex"><scalar type="int32_t"/></processIndex><sequenceIndex direction="OUT" name="sequenceIndex"><scalar type="int32_t"/></sequenceIndex><chainIndex direction="OUT" name="chainIndex"><scalar type="int32_t"/></chainIndex><eventNumber direction="OUT" name="eventNumber"><scalar type="int32_t"/></eventNumber><timingGroupID direction="OUT" name="timingGroupID"><scalar type="int32_t"/></timingGroupID><acquisitionStamp direction="OUT" name="acquisitionStamp"><scalar type="int64_t"/></acquisitionStamp><eventStamp direction="OUT" name="eventStamp"><scalar type="int64_t"/></eventStamp><processStartStamp direction="OUT" name="processStartStamp"><scalar type="int64_t"/></processStartStamp><sequenceStartStamp direction="OUT" name="sequenceStartStamp"><scalar type="int64_t"/></sequenceStartStamp><chainStartStamp direction="OUT" name="chainStartStamp"><scalar type="int64_t"/></chainStartStamp><acquisition-context-field-ref field-name-ref="acquisitionContext"/></acquisition-context-item></GSI-Acquisition-Property><GSI-Version-Property cycle-bound="false" name="Version" on-change="false" subscribable="false" visibility="operational" id="_220830102017_3"> <description>Returns the current software and hardware versions of a piece of equipment.</description> - <acq-stamp-item direction="OUT" name="acqStamp" id="_220816101631_2"> + <acq-stamp-item direction="OUT" name="acqStamp" id="_220830102030_0"> <scalar type="int64_t"/> </acq-stamp-item> - <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220816101631_3"> + <update-flag-item direction="OUT" name="updateFlags" optional="true" id="_220830102030_1"> <builtin-type-scalar data-type-name-ref="NOTIFICATION_UPDATE"/> </update-flag-item> - <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220816101631_4"> + <cycle-name-item direction="OUT" name="cycleName" optional="true" id="_220830102030_2"> <array type="char"> <dim>32</dim> </array> </cycle-name-item> - <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220816101631_5"> + <cycle-stamp-item direction="OUT" name="cycleStamp" optional="true" id="_220830102030_3"> <scalar type="int64_t"/> </cycle-stamp-item> <get-action> <server-action-ref server-action-name-ref="VersionGetAction"/> </get-action> - <version-item direction="OUT" name="classVersion" id="_220816101632_0"> + <version-item direction="OUT" name="classVersion" id="_220830102031_0"> <array type="char"> <custom-constant-dim constant-name-ref="MAX_VERSION_NAME_LENGTH"/> </array> </version-item> - <version-item direction="OUT" name="deployUnitVersion" id="_220816101632_1"> + <version-item direction="OUT" name="deployUnitVersion" id="_220830102031_1"> <array type="char"> <custom-constant-dim constant-name-ref="MAX_VERSION_NAME_LENGTH"/> </array> </version-item> - <version-item direction="OUT" name="fesaVersion" id="_220816101632_2"> + <version-item direction="OUT" name="fesaVersion" id="_220830102031_2"> <array type="char"> <custom-constant-dim constant-name-ref="MAX_VERSION_NAME_LENGTH"/> </array> @@ -293,39 +293,39 @@ corresponding string array containing keys to illustrate the meaning of the deta </device-interface> <global-interface> <setting> - <diagnostic-property multiplexed="false" name="DiagnosticSetting" visibility="expert" id="_220816101620_0"> + <diagnostic-property multiplexed="false" name="DiagnosticSetting" visibility="expert" id="_220830102017_4"> <description>Generic property which allows to diagnose any FESA classes</description> - <mode-item direction="INOUT" name="enableDiagMode" id="_220816101632_3"> + <mode-item direction="INOUT" name="enableDiagMode" id="_220830102031_3"> <scalar type="bool"/> </mode-item> - <host-item direction="INOUT" name="hostName" id="_220816101632_4"> + <host-item direction="INOUT" name="hostName" id="_220830102031_4"> <description>Host of the FESA class</description> <array type="char"> <dim>32</dim> </array> </host-item> - <port-item direction="INOUT" name="portNumber" id="_220816101632_5"> + <port-item direction="INOUT" name="portNumber" id="_220830102031_5"> <description>Port used by the FESA class</description> <scalar type="int32_t"/> </port-item> - <config-item direction="IN" name="requestConfig" id="_220816101632_6"> + <config-item direction="IN" name="requestConfig" id="_220830102031_6"> <scalar type="bool"/> </config-item> - <state-item direction="IN" name="requestState" id="_220816101633_0"> + <state-item direction="IN" name="requestState" id="_220830102032_0"> <scalar type="bool"/> </state-item> - <fwk-topic-item direction="INOUT" name="fwkTopic" id="_220816101633_1"> + <fwk-topic-item direction="INOUT" name="fwkTopic" id="_220830102032_1"> <builtin-type-scalar data-type-name-ref="DIAG_FWK_TOPIC"/> </fwk-topic-item> - <custom-topic-item direction="INOUT" name="customTopic" id="_220816101633_2"> + <custom-topic-item direction="INOUT" name="customTopic" id="_220830102032_2"> <custom-type-scalar data-type-name-ref="DIAG_TOPIC"/> </custom-topic-item> - <device-trace-item direction="INOUT" name="traceDevices" id="_220816101633_3"> + <device-trace-item direction="INOUT" name="traceDevices" id="_220830102032_3"> <array type="char"> <dim>320</dim> </array> </device-trace-item> - <bypass-action-item direction="INOUT" name="bypassActions" id="_220816101633_4"> + <bypass-action-item direction="INOUT" name="bypassActions" id="_220830102032_4"> <array type="char"> <dim>320</dim> </array> @@ -333,31 +333,31 @@ corresponding string array containing keys to illustrate the meaning of the deta </diagnostic-property> </setting> <acquisition> - <GSI-DeviceDescription-Property cycle-bound="false" name="DeviceDescription" on-change="false" subscribable="false" visibility="operational" id="_220816101620_1"> - <timing-info-item direction="OUT" name="deviceNameTimingReceiver" id="_220816101633_5"> + <GSI-DeviceDescription-Property cycle-bound="false" name="DeviceDescription" on-change="false" subscribable="false" visibility="operational" id="_220830102017_5"> + <timing-info-item direction="OUT" name="deviceNameTimingReceiver" id="_220830102032_5"> <array type="char"> <variable-dim/> </array> <data-field-ref field-name-ref="deviceNameTimingReceiver"/> </timing-info-item> - <property-info-item direction="OUT" name="propertyNames" id="_220816101633_6"> + <property-info-item direction="OUT" name="propertyNames" id="_220830102033_0"> <array2D type="char"> <variable-dim1/> <variable-dim2/> </array2D> </property-info-item> - <device-info-item direction="OUT" name="deviceNames" id="_220816101634_0"> + <device-info-item direction="OUT" name="deviceNames" id="_220830102033_1"> <array2D type="char"> <variable-dim1/> <variable-dim2/> </array2D> </device-info-item> - <global-device-info-item direction="OUT" name="globalDeviceName" id="_220816101634_1"> + <global-device-info-item direction="OUT" name="globalDeviceName" id="_220830102033_2"> <array type="char"> <variable-dim/> </array> </global-device-info-item> - <host-info-item direction="OUT" name="host" id="_220816101634_2"> + <host-info-item direction="OUT" name="host" id="_220830102033_3"> <array type="char"> <variable-dim/> </array> @@ -398,81 +398,81 @@ corresponding string array containing keys to illustrate the meaning of the deta </builtin-types> <custom-types> - <diag-custom-topic name="DIAG_TOPIC" id="_220816101644_0"> + <diag-custom-topic name="DIAG_TOPIC" id="_220830102046_1"> </diag-custom-topic> - <enum name="DEVICE_STATUS" id="_220816101644_1"> + <enum name="DEVICE_STATUS" id="_220830102047_0"> <!--Possible (mutually exclusive) values to describe the device status--> - <item access="RW" meaning="NONE" symbol="UNKNOWN" value="0" id="_220816101650_4"/> + <item access="RW" meaning="NONE" symbol="UNKNOWN" value="0" id="_220830102055_0"/> <!--The device status is unknown--> - <item access="RW" meaning="NONE" symbol="OK" value="1" id="_220816101651_0"/> + <item access="RW" meaning="NONE" symbol="OK" value="1" id="_220830102055_1"/> <!--The device is in fully operational state--> - <item access="RW" meaning="NONE" symbol="WARNING" value="2" id="_220816101651_1"/> + <item access="RW" meaning="NONE" symbol="WARNING" value="2" id="_220830102055_2"/> <!--The device is not fully operational; A device in WARNING state can still be used operationally, --> <!--but clients must be informed of a problem that might become worse. Details are explained in the errorMsg field.--> - <item access="RW" meaning="NONE" symbol="ERROR" value="3" id="_220816101651_2"/> + <item access="RW" meaning="NONE" symbol="ERROR" value="3" id="_220830102056_0"/> <!--The device is in a fault state. Details are explained in the errorMsg field--> </enum> - <enum name="DEVICE_POWER_STATE" id="_220816101645_0"> + <enum name="DEVICE_POWER_STATE" id="_220830102047_1"> <!--Possible (mutually exclusive) values to describe the power-state of the device.--> - <item access="RW" meaning="NONE" symbol="UNKNOWN" value="0" id="_220816101651_3"/> + <item access="RW" meaning="NONE" symbol="UNKNOWN" value="0" id="_220830102056_1"/> <!--The device mode is unknown--> - <item access="RW" meaning="ON" symbol="ON" value="1" id="_220816101652_0"/> + <item access="RW" meaning="ON" symbol="ON" value="1" id="_220830102057_0"/> <!--The device is in fully operational state--> - <item access="RW" meaning="NONE" symbol="OFF" value="2" id="_220816101652_1"/> + <item access="RW" meaning="NONE" symbol="OFF" value="2" id="_220830102057_1"/> <!--The device is turned off--> - <item access="RW" meaning="NONE" symbol="STANDBY" value="3" id="_220816101652_2"/> + <item access="RW" meaning="NONE" symbol="STANDBY" value="3" id="_220830102058_0"/> <!--The device is in a stand-by mode. This mode is a sort of “parking mode†in which the device can --> <!--stay for hours or even days. It is defined by the following characteristics:--> <!--It is safe, it does not wear out, it consumes little energy.--> <!--Furthermore, it takes a short time to go from STANDBY to ON mode--> - <item access="RW" meaning="NONE" symbol="POWER_DOWN" value="4" id="_220816101652_3"/> + <item access="RW" meaning="NONE" symbol="POWER_DOWN" value="4" id="_220830102058_1"/> <!--The device is shutting down. Note that some properties may not be accessible during this time.--> <!--After shutdown the device will be in the mode OFF--> - <item access="RW" meaning="NONE" symbol="POWER_UP" value="5" id="_220816101653_0"/> + <item access="RW" meaning="NONE" symbol="POWER_UP" value="5" id="_220830102058_2"/> <!--The device is starting up. Note that some properties may not be accessible during this time.--> <!--After (re-)starting the device probably will be in the mode ON--> </enum> - <enum name="DEVICE_POWER" id="_220816101645_1"> + <enum name="DEVICE_POWER" id="_220830102048_0"> <!--An enumeration Type used to control the operational mode of the device.--> <!--Its values are a subset of those in the DEVICE_POWER_STATE type--> - <item access="RW" meaning="ON" symbol="ON" value="1" id="_220816101653_1"/> + <item access="RW" meaning="ON" symbol="ON" value="1" id="_220830102059_0"/> <!--The device is in fully operational state--> - <item access="RW" meaning="OFF" symbol="OFF" value="2" id="_220816101653_2"/> + <item access="RW" meaning="OFF" symbol="OFF" value="2" id="_220830102059_1"/> <!--The device is turned off--> </enum> - <enum name="DEVICE_CONTROL" id="_220816101645_2"> + <enum name="DEVICE_CONTROL" id="_220830102048_1"> <!--Possible values to describe the control mode of a device--> <!--Currently two control modes (LOCAL, REMOTE) are defined--> - <item access="RW" meaning="NONE" symbol="REMOTE" value="0" id="_220816101653_3"/> + <item access="RW" meaning="NONE" symbol="REMOTE" value="0" id="_220830102100_0"/> <!--The device can be controlled normally through the control system--> - <item access="RW" meaning="NONE" symbol="LOCAL" value="1" id="_220816101653_4"/> + <item access="RW" meaning="NONE" symbol="LOCAL" value="1" id="_220830102100_1"/> <!--The device can be controlled locally. But it can be accessed in read-only mode via the control system--> </enum> - <enum name="TOL_CHECK_MODE" id="_220816101646_0"> + <enum name="TOL_CHECK_MODE" id="_220830102048_2"> <!--This constant defines possible modes to check whether a control value is inside the tolerance values.--> <!--Used to give information on how the tolerance fields are used to calculate the xxx_status information.--> - <item access="RO" symbol="ABS" value="0" id="_220816101653_5"/> + <item access="RO" symbol="ABS" value="0" id="_220830102101_0"/> <!--Use the absolute tolerance _tolAbs--> - <item access="RO" symbol="REL" value="1" id="_220816101653_6"/> + <item access="RO" symbol="REL" value="1" id="_220830102102_0"/> <!--Use the relative tolerance _tolRel--> </enum> - <bit-enum-32bits name="AQN_STATUS" id="_220816101646_1"> + <bit-enum-32bits name="AQN_STATUS" id="_220830102049_0"> <!--Possible values to describe the acquisition status of a field (in the _status suffix)--> <!--If this suffix is missing, it means that no additional status information is provided for the corresponding field--> <!--If all bits are 0, this means that the corresponding field is OK.--> @@ -511,117 +511,117 @@ corresponding string array containing keys to illustrate the meaning of the deta <!--into bit 16..32 you can put in anything you want--> </bit-enum-32bits> - <struct name="GSI_ERROR" id="_220816101646_2"> + <struct name="GSI_ERROR" id="_220830102049_1"> <!--This struct-item describes the structure of an GSI-error--> - <struct-item name="error_string" id="_220816101654_7"> + <struct-item name="error_string" id="_220830102106_1"> <!--This string holds the error-message--> <array type="char"> <custom-constant-dim constant-name-ref="MAX_ERROR_MESSAGE_LENGTH"/> </array> </struct-item> - <struct-item name="error_code" id="_220816101654_8"> + <struct-item name="error_code" id="_220830102106_2"> <!--The error code according to the defined error-message--> <scalar type="int32_t"/> </struct-item> <!--The timestamp when the error occured--> - <struct-item name="error_timestamp" id="_220816101655_0"> + <struct-item name="error_timestamp" id="_220830102107_0"> <scalar type="int64_t"/> </struct-item> <!--The cycle for which the error occured--> - <struct-item name="error_cycle_name" id="_220816101655_1"> + <struct-item name="error_cycle_name" id="_220830102107_1"> <array type="char"> <custom-constant-dim constant-name-ref="MAX_CYCLE_NAME_LENGTH"/> </array> </struct-item> </struct> - <struct name="GSI_ACQ_CONTEXT" id="_220816101646_3"> + <struct name="GSI_ACQ_CONTEXT" id="_220830102050_0"> <description>WhiteRabbit event specific acquisition information</description> - <struct-item name="processIndex" id="_220816101655_2"> + <struct-item name="processIndex" id="_220830102108_0"> <description>Used in order to index process-multiplexed data</description> <scalar type="int32_t"/> </struct-item> - <struct-item name="sequenceIndex" id="_220816101655_3"> + <struct-item name="sequenceIndex" id="_220830102108_1"> <description>Used in order to index sequence-multiplexed data</description> <scalar type="int32_t"/> </struct-item> - <struct-item name="chainIndex" id="_220816101655_4"> + <struct-item name="chainIndex" id="_220830102108_2"> <description>Refers to a specific beam production chain</description> <scalar type="int32_t"/> </struct-item> - <struct-item name="eventNumber" id="_220816101655_5"> + <struct-item name="eventNumber" id="_220830102109_0"> <description>The number of the event describes it's type</description> <scalar type="int32_t"/> </struct-item> - <struct-item name="timingGroupID" id="_220816101655_6"> + <struct-item name="timingGroupID" id="_220830102109_1"> <description>ID of the timing group for which the event is relevant</description> <scalar type="int32_t"/> </struct-item> - <struct-item name="acquisitionStamp" id="_220816101655_7"> + <struct-item name="acquisitionStamp" id="_220830102110_0"> <description>The acquisition stamp is used to indicate when a measurement was done</description> <scalar type="int64_t"/> </struct-item> - <struct-item name="eventStamp" id="_220816101655_8"> + <struct-item name="eventStamp" id="_220830102110_1"> <description>The event stamp is used to indicate when WhiteRabbit event was triggered on the Timing Receiver</description> <scalar type="int64_t"/> </struct-item> - <struct-item name="processStartStamp" id="_220816101656_0"> + <struct-item name="processStartStamp" id="_220830102111_0"> <description>The process start stamp indicates when the first event of the current process was triggered</description> <scalar type="int64_t"/> </struct-item> - <struct-item name="sequenceStartStamp" id="_220816101656_1"> + <struct-item name="sequenceStartStamp" id="_220830102111_1"> <description>The sequence start stamp indicates when the first event of the current sequence was triggered</description> <scalar type="int64_t"/> </struct-item> - <struct-item name="chainStartStamp" id="_220816101656_2"> + <struct-item name="chainStartStamp" id="_220830102111_2"> <description>The chain start stamp indicates when the first event of the current chain was triggered</description> <scalar type="int64_t"/> </struct-item> </struct> - <constant name="MAX_ERROR_MESSAGE_LENGTH" type="uint32_t" value="256" id="_220816101647_0"/> - <constant name="MAX_NUMBER_OF_ERROR_MESSAGES" type="uint32_t" value="16" id="_220816101647_1"/> - <constant name="MAX_CYCLE_NAME_LENGTH" type="uint32_t" value="256" id="_220816101647_2"/> - <constant name="MAX_VERSION_NAME_LENGTH" type="uint32_t" value="256" id="_220816101648_0"/> - <constant name="MAX_DETAILED_STATUS_LABEL_LENGTH" type="uint32_t" value="30" id="_220816101648_1"/> - <constant name="DETAILED_STATUS_SIZE" type="uint32_t" value="2" id="_220816101649_0"/> - <enum name="DETAILED_STATUS_SEVERITY" id="_220816101650_0"> - <item access="RO" symbol="INFO" value="0" id="_220816101653_7"/> - <item access="RO" symbol="WARNING_ON_FALSE" value="1" id="_220816101654_0"/> - <item access="RO" symbol="ERROR_ON_FALSE" value="2" id="_220816101654_1"/> + <constant name="MAX_ERROR_MESSAGE_LENGTH" type="uint32_t" value="256" id="_220830102050_1"/> + <constant name="MAX_NUMBER_OF_ERROR_MESSAGES" type="uint32_t" value="16" id="_220830102051_0"/> + <constant name="MAX_CYCLE_NAME_LENGTH" type="uint32_t" value="256" id="_220830102051_1"/> + <constant name="MAX_VERSION_NAME_LENGTH" type="uint32_t" value="256" id="_220830102051_2"/> + <constant name="MAX_DETAILED_STATUS_LABEL_LENGTH" type="uint32_t" value="30" id="_220830102052_0"/> + <constant name="DETAILED_STATUS_SIZE" type="uint32_t" value="2" id="_220830102052_1"/> + <enum name="DETAILED_STATUS_SEVERITY" id="_220830102053_0"> + <item access="RO" symbol="INFO" value="0" id="_220830102102_1"/> + <item access="RO" symbol="WARNING_ON_FALSE" value="1" id="_220830102103_0"/> + <item access="RO" symbol="ERROR_ON_FALSE" value="2" id="_220830102103_1"/> </enum> - <enum name="MODULE_STATUS" id="_220816101650_1"> + <enum name="MODULE_STATUS" id="_220830102053_1"> <!-- Mutually exclusive values to describe the status of a hardware / software module--> - <item access="RO" symbol="UNKNOWN" value="0" id="_220816101654_2"/> + <item access="RO" symbol="UNKNOWN" value="0" id="_220830102104_0"/> <!--The status of the module is not known--> - <item access="RO" symbol="OK" value="1" id="_220816101654_3"/> + <item access="RO" symbol="OK" value="1" id="_220830102104_1"/> <!--The module is in fully operational state--> - <item access="RO" symbol="WARNING" value="2" id="_220816101654_4"/> + <item access="RO" symbol="WARNING" value="2" id="_220830102105_0"/> <!--The module is not fully operational; A module in WARNING state may still be used operationally, --> <!--but clients must be informed of a problem that might become worse. --> - <item access="RO" symbol="ERROR" value="3" id="_220816101654_5"/> + <item access="RO" symbol="ERROR" value="3" id="_220830102105_1"/> <!--The module is in a fault state. The related device is not operational.--> - <item access="RO" symbol="NOT_AVAILABLE" value="4" id="_220816101654_6"/> + <item access="RO" symbol="NOT_AVAILABLE" value="4" id="_220830102106_0"/> <!--The module is missing. The related device is not operational.--> </enum> - <constant name="MAX_MODULE_STATUS_LABEL_LENGTH" type="uint32_t" value="30" id="_220816101650_2"/> - <constant name="MODULE_STATUS_SIZE" type="uint32_t" value="2" id="_220816101650_3"/> + <constant name="MAX_MODULE_STATUS_LABEL_LENGTH" type="uint32_t" value="30" id="_220830102054_0"/> + <constant name="MODULE_STATUS_SIZE" type="uint32_t" value="2" id="_220830102054_1"/> </custom-types> <data> <device-data> <configuration> - <field name="plcDeviceLabel" id="_220816115053_3"><description>Name of the related SILECS instance within the PLC mapping</description><array type="char"><dim>128</dim></array></field><field name="plcHostName" id="_220816115054_0"><description>Hostname of the PLC that contains the related SILECS class device</description><array type="char"><dim>128</dim></array></field><GSI-detailed-status-labels-field name="detailedStatus_labels" id="_220816101635_0"> + <field name="plcDeviceLabel" id="_220830102035_0"><description>Name of the related SILECS instance within the PLC mapping</description><array type="char"><dim>128</dim></array></field><field name="plcHostName" id="_220830102035_1"><description>Hostname of the PLC that contains the related SILECS class device</description><array type="char"><dim>128</dim></array></field><GSI-detailed-status-labels-field name="detailedStatus_labels" id="_220830102035_2"> <array2D type="char"> <custom-constant-dim1 constant-name-ref="DETAILED_STATUS_SIZE"/> <custom-constant-dim2 constant-name-ref="MAX_DETAILED_STATUS_LABEL_LENGTH"/> </array2D> <default>{myStatusLabel1,myStatusLabel2}</default> </GSI-detailed-status-labels-field> - <GSI-detailed-status-severity-field name="detailedStatus_severity" id="_220816101635_1"> + <GSI-detailed-status-severity-field name="detailedStatus_severity" id="_220830102035_3"> <custom-type-array data-type-name-ref="DETAILED_STATUS_SEVERITY"> <custom-constant-dim constant-name-ref="DETAILED_STATUS_SIZE"/> </custom-type-array> <default>{INFO,INFO}</default> </GSI-detailed-status-severity-field> - <GSI-module-status-labels-field name="moduleStatus_labels" id="_220816101635_2"> + <GSI-module-status-labels-field name="moduleStatus_labels" id="_220830102036_0"> <array2D type="char"> <custom-constant-dim1 constant-name-ref="MODULE_STATUS_SIZE"/> @@ -631,43 +631,43 @@ corresponding string array containing keys to illustrate the meaning of the deta </GSI-module-status-labels-field> </configuration> <setting> - <field name="DQ_Anlog00" multiplexed="false" persistent="true" id="_220817081955_0"><scalar type="int32_t"/></field><field name="DQ_Bool07" multiplexed="false" persistent="true" id="_220817081955_1"><scalar type="int16_t"/></field><field name="DQ_Bool06" multiplexed="false" persistent="true" id="_220817081955_2"><scalar type="int16_t"/></field><field name="DQ_Bool05" multiplexed="false" persistent="true" id="_220817081955_3"><scalar type="int16_t"/></field><field name="DQ_Bool04" multiplexed="false" persistent="true" id="_220817081955_4"><scalar type="int16_t"/></field><field name="DQ_Bool03" multiplexed="false" persistent="true" id="_220817081955_5"><scalar type="int16_t"/></field><field name="DQ_Bool02" multiplexed="false" persistent="true" id="_220817081955_6"><scalar type="int16_t"/></field><field name="DQ_Bool01" multiplexed="false" persistent="true" id="_220817081956_0"><scalar type="int16_t"/></field><field name="DQ_Bool00" multiplexed="false" persistent="true" id="_220817081956_1"><scalar type="int16_t"/></field><field name="mySettingRegister" multiplexed="false" persistent="true" id="_220816115054_1"><scalar type="int32_t"/></field><GSI-power-field multiplexed="false" name="power" persistent="false" id="_220816101635_3"> + <field name="mySettingRegister" multiplexed="false" persistent="true" id="_220830102036_1"><scalar type="int32_t"/></field><GSI-power-field multiplexed="false" name="power" persistent="false" id="_220830102036_2"> <custom-type-scalar data-type-name-ref="DEVICE_POWER"/> </GSI-power-field> </setting> <acquisition> - <field name="DI_Anlog01" cycle-bound="false" persistent="false" id="_220817081956_2"><scalar type="int32_t"/></field><field name="DI_Anlog00" cycle-bound="false" persistent="false" id="_220817081956_3"><scalar type="int32_t"/></field><field name="DI_Bool07" cycle-bound="false" persistent="false" id="_220817081956_4"><scalar type="int16_t"/></field><field name="DI_Bool06" cycle-bound="false" persistent="false" id="_220817081956_5"><scalar type="int16_t"/></field><field name="DI_Bool05" cycle-bound="false" persistent="false" id="_220817081956_6"><scalar type="int16_t"/></field><field name="DI_Bool04" cycle-bound="false" persistent="false" id="_220817081957_0"><scalar type="int16_t"/></field><field name="DI_Bool03" cycle-bound="false" persistent="false" id="_220817081957_1"><scalar type="int16_t"/></field><field name="DI_Bool02" cycle-bound="false" persistent="false" id="_220817081958_0"><scalar type="int16_t"/></field><field name="DI_Bool01" cycle-bound="false" persistent="false" id="_220817081958_1"><scalar type="int16_t"/></field><field name="DI_Bool00" cycle-bound="false" persistent="false" id="_220817081958_2"><scalar type="int16_t"/></field><field name="myRegister" cycle-bound="false" persistent="false" id="_220816115054_2"><scalar type="int32_t"/></field><GSI-control-field cycle-bound="false" name="control" id="_220816101635_4"> + <field name="myRegister" cycle-bound="false" persistent="false" id="_220830102037_0"><scalar type="int32_t"/></field><GSI-control-field cycle-bound="false" name="control" id="_220830102037_1"> <custom-type-scalar data-type-name-ref="DEVICE_CONTROL"/> </GSI-control-field> - <GSI-powerState-field cycle-bound="false" name="powerState" id="_220816101635_5"> + <GSI-powerState-field cycle-bound="false" name="powerState" id="_220830102039_0"> <custom-type-scalar data-type-name-ref="DEVICE_POWER_STATE"/> </GSI-powerState-field> - <GSI-status-field cycle-bound="false" name="status" id="_220816101636_0"> + <GSI-status-field cycle-bound="false" name="status" id="_220830102041_0"> <custom-type-scalar data-type-name-ref="DEVICE_STATUS"/> </GSI-status-field> - <GSI-interlock-field cycle-bound="false" name="interlock" id="_220816101637_0"> + <GSI-interlock-field cycle-bound="false" name="interlock" id="_220830102041_1"> <scalar type="bool"/> </GSI-interlock-field> - <GSI-opReady-field cycle-bound="false" name="opReady" id="_220816101638_0"> + <GSI-opReady-field cycle-bound="false" name="opReady" id="_220830102042_0"> <scalar type="bool"/> </GSI-opReady-field> - <GSI-modulesReady-field cycle-bound="false" name="modulesReady" id="_220816101640_0"> + <GSI-modulesReady-field cycle-bound="false" name="modulesReady" id="_220830102043_0"> <scalar type="bool"/> </GSI-modulesReady-field> - <GSI-detailed-status-field cycle-bound="false" name="detailedStatus" id="_220816101640_1"> + <GSI-detailed-status-field cycle-bound="false" name="detailedStatus" id="_220830102043_1"> <array type="bool"> <custom-constant-dim constant-name-ref="DETAILED_STATUS_SIZE"/> </array> </GSI-detailed-status-field> - <GSI-module-status-field cycle-bound="false" name="moduleStatus" id="_220816101640_2"> + <GSI-module-status-field cycle-bound="false" name="moduleStatus" id="_220830102044_0"> <custom-type-array data-type-name-ref="MODULE_STATUS"> <custom-constant-dim constant-name-ref="MODULE_STATUS_SIZE"/> </custom-type-array> </GSI-module-status-field> - <GSI-acquisition-context-field cycle-bound="true" name="acquisitionContext" id="_220816101641_0"> + <GSI-acquisition-context-field cycle-bound="true" name="acquisitionContext" id="_220830102044_1"> <custom-type-scalar data-type-name-ref="GSI_ACQ_CONTEXT"/> </GSI-acquisition-context-field> - <GSI-error_collection-field cycle-bound="false" name="error_collection" id="_220816101641_1"> + <GSI-error_collection-field cycle-bound="false" name="error_collection" id="_220830102045_0"> <custom-type-array data-type-name-ref="GSI_ERROR"> <custom-constant-dim constant-name-ref="MAX_NUMBER_OF_ERROR_MESSAGES"/> </custom-type-array> @@ -677,7 +677,7 @@ corresponding string array containing keys to illustrate the meaning of the deta <global-data> <configuration> <!-- The name of the timing receiver --> - <field name="plcClassVersion" id="_220816115054_3"><description>Version of the SILECS class that needs to be deployed in the controller</description><array type="char"><dim>5</dim></array><default>0.1.0</default></field><GSI-timing-receiver-name-field name="deviceNameTimingReceiver" id="_220816101643_0"> + <field name="plcClassVersion" id="_220830102045_1"><description>Version of the SILECS class that needs to be deployed in the controller</description><array type="char"><dim>5</dim></array><default>0.1.0</default></field><GSI-timing-receiver-name-field name="deviceNameTimingReceiver" id="_220830102046_0"> <array type="char"> <!-- The number of the timing receiver --> <variable-dim/> @@ -702,7 +702,7 @@ corresponding string array containing keys to illustrate the meaning of the deta <get-server-action name="GetMyBlock" implementation="custom"/><set-server-action name="SetMySetting" implementation="custom"/><get-server-action name="GetMySetting" implementation="custom"/></actions> <events> <logical-events> - <logical-event name="StatusUpdateEvent" type="timer" use="required" id="_220816101634_3"/> + <logical-event name="StatusUpdateEvent" type="timer" use="required" id="_220830102034_0"/> </logical-events> </events> <scheduling-units> diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/client/tsts7001.silecsparam b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/client/tsts7001.silecsparam new file mode 100644 index 0000000..887c352 --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/client/tsts7001.silecsparam @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<SILECS-Param silecs-version="2.3.0"> + <Mapping-Info> + <Owner user-login="mnabywan"/> + <Generation date="2022-08-30 11:14:17.910098"/> + <Deployment checksum="570584630"/> + </Mapping-Info> + <SILECS-Mapping plc-name="tsts7001" plc-brand="SIEMENS" plc-system="TIA-PORTAL" plc-model="SIMATIC_S7-1500" protocol="DEVICE_MODE" address="1" DI-address="-1" DO-address="-1" AI-address="-1" AO-address="-1" domain="" used-mem="TODO"> + <SILECS-Class name="SilecsHeader" version="1.0.0" address="1" DI-address="-1" DO-address="-1" AI-address="-1" AO-address="-1" used-mem="DB1..DB1/48 bytes" used-DI="0 byte" used-DO="0 byte" used-AI="0 byte" used-AO="0 byte"> + <Acquisition-Block name="hdrBlk" size="14" address="0" mem-size="48"> + <Acquisition-Register name="_version" size="1" address="0" mem-size="18"> + <string string-length="16" format="string"/> + </Acquisition-Register> + <Acquisition-Register name="_checksum" size="4" address="18" mem-size="4"> + <scalar format="uint32"/> + </Acquisition-Register> + <Acquisition-Register name="_user" size="1" address="22" mem-size="18"> + <string string-length="16" format="string"/> + </Acquisition-Register> + <Acquisition-Register name="_date" size="8" address="40" mem-size="8"> + <scalar format="dt"/> + </Acquisition-Register> + </Acquisition-Block> + <Instance label="SilecsHeader" address="1" DI-address="-1" DO-address="-1" AI-address="-1" AO-address="-1"/> + </SILECS-Class> + <SILECS-Class name="SilecsTestClass" version="0.1.0" address="2" DI-address="-1" DO-address="-1" AI-address="-1" AO-address="-1" used-mem="DB2..DB2/8 bytes" used-DI="0 byte" used-DO="0 byte" used-AI="0 byte" used-AO="0 byte"> + <Acquisition-Block name="MyBlock" size="4" address="0" mem-size="4"> + <Acquisition-Register name="myRegister" generateFesaValueItem="true" size="4" address="0" mem-size="4"> + <scalar format="int32"/> + </Acquisition-Register> + </Acquisition-Block> + <Setting-Block name="MySetting" size="4" address="4" mem-size="4"> + <Setting-Register name="mySettingRegister" generateFesaValueItem="true" size="4" address="0" mem-size="4"> + <scalar format="int32"/> + </Setting-Register> + </Setting-Block> + <Instance label="dev0" address="2" DI-address="-1" DO-address="-1" AI-address="-1" AO-address="-1"/> + </SILECS-Class> + </SILECS-Mapping> +</SILECS-Param> diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.scl b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.scl new file mode 100644 index 0000000..6b6ddf9 --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.scl @@ -0,0 +1,82 @@ + +(* --------------------------------------------------------------------- + * SilecsHeader/ v1.0.0 + * BLOCK Type definition + * --------------------------------------------------------------------- + *) +TYPE _SilecsHeader_hdrBlk +AUTHOR: mnabywan +FAMILY: SILECS +NAME: UDTB + STRUCT + _version: STRING[16] := 'SILECS_2.3.0'; + _checksum: DWORD := DW#16#22026e36; + _user: STRING[16] := 'mnabywan'; + _date: DT := DT#2022-8-30-11:14:18; + + END_STRUCT; +END_TYPE + + +(* --------------------------------------------------------------------- + * SilecsHeader/ v1.0.0 + * BLOCK instance definition + * --------------------------------------------------------------------- + *) +DATA_BLOCK SilecsHeader_SilecsHeader +{ S7_Optimized_Access := 'FALSE' } +AUTHOR: mnabywan +FAMILY: SILECS +NAME: DEV_MODE +STRUCT + hdrBlk: _SilecsHeader_hdrBlk; + +END_STRUCT; +BEGIN +END_DATA_BLOCK + + +(* --------------------------------------------------------------------- + * SilecsTestClass/ v0.1.0 + * BLOCK Type definition + * --------------------------------------------------------------------- + *) +TYPE _SilecsTestClass_MyBlock +AUTHOR: mnabywan +FAMILY: SILECS +NAME: UDTB + STRUCT + myRegister: DINT; + + END_STRUCT; +END_TYPE + +TYPE _SilecsTestClass_MySetting +AUTHOR: mnabywan +FAMILY: SILECS +NAME: UDTB + STRUCT + mySettingRegister: DINT; + + END_STRUCT; +END_TYPE + + +(* --------------------------------------------------------------------- + * SilecsTestClass/ v0.1.0 + * BLOCK instance definition + * --------------------------------------------------------------------- + *) +DATA_BLOCK SilecsTestClass_dev0 +{ S7_Optimized_Access := 'FALSE' } +AUTHOR: mnabywan +FAMILY: SILECS +NAME: DEV_MODE +STRUCT + MyBlock: _SilecsTestClass_MyBlock; + MySetting: _SilecsTestClass_MySetting; + +END_STRUCT; +BEGIN +END_DATA_BLOCK + diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.sdf b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.sdf new file mode 100644 index 0000000..b567ceb --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/controller/tsts7001.sdf @@ -0,0 +1,5 @@ +"_SilecsHeader_hdrBlk","UDT 1","UDT 1","[SilecsHeader/1.0.0] UDT symbol: _<class-name>_<block-name>" +"SilecsHeader_SilecsHeader","DB 1","DB 1","[SilecsHeader/1.0.0] DB symbol: <class-name>_<device-label | device-id>" +"_SilecsTestClass_MyBlock","UDT 2","UDT 2","[SilecsTestClass/0.1.0] UDT symbol: _<class-name>_<block-name>" +"_SilecsTestClass_MySetting","UDT 3","UDT 3","" +"SilecsTestClass_dev0","DB 2","DB 2","[SilecsTestClass/0.1.0] DB symbol: <class-name>_<device-label | device-id>" diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsHeader.h b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsHeader.h new file mode 100644 index 0000000..af86363 --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsHeader.h @@ -0,0 +1,38 @@ +/* Copyright CERN 2015 + * + * WARNING: This code is automatically generated from your SILECS deploy unit document. + * You should never modify the content of this file as it would break consistency. + * Furthermore, any changes will be overwritten in the next code generation. + * Any modification shall be done using the SILECS development environment + * and regenerating this source code. + */ + +#ifndef SILECSHEADER_H_ +#define SILECSHEADER_H_ + +#include <silecs-communication/wrapper/Block.h> +#include <silecs-communication/wrapper/DeployUnit.h> +#include <silecs-communication/wrapper/Design.h> +#include <silecs-communication/wrapper/Device.h> + +namespace SilecsHeader +{ + + +class Design : public SilecsWrapper::Design +{ +public: + + Design(SilecsWrapper::DeployUnit *deployUnit) : + SilecsWrapper::Design("SilecsHeader", "1.0.0", deployUnit) + { + } + + ~Design() + { + } +}; + +} /* namespace SilecsHeader */ + +#endif /* SILECSHEADER_H_ */ diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsTestClass.h b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsTestClass.h new file mode 100644 index 0000000..97d1f20 --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/SilecsTestClass.h @@ -0,0 +1,38 @@ +/* Copyright CERN 2015 + * + * WARNING: This code is automatically generated from your SILECS deploy unit document. + * You should never modify the content of this file as it would break consistency. + * Furthermore, any changes will be overwritten in the next code generation. + * Any modification shall be done using the SILECS development environment + * and regenerating this source code. + */ + +#ifndef SILECSTESTCLASS_H_ +#define SILECSTESTCLASS_H_ + +#include <silecs-communication/wrapper/Block.h> +#include <silecs-communication/wrapper/DeployUnit.h> +#include <silecs-communication/wrapper/Design.h> +#include <silecs-communication/wrapper/Device.h> + +namespace SilecsTestClass +{ + + +class Design : public SilecsWrapper::Design +{ +public: + + Design(SilecsWrapper::DeployUnit *deployUnit) : + SilecsWrapper::Design("SilecsTestClass", "0.1.0", deployUnit) + { + } + + ~Design() + { + } +}; + +} /* namespace SilecsTestClass */ + +#endif /* SILECSTESTCLASS_H_ */ diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/Tsts7001.h b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/Tsts7001.h new file mode 100644 index 0000000..320720a --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/generated-silecs/wrapper/Tsts7001.h @@ -0,0 +1,167 @@ +/* Copyright CERN 2015 + * + * WARNING: This code is automatically generated from your SILECS deploy unit document. + * You should never modify the content of this file as it would break consistency. + * Furthermore, any changes will be overwritten in the next code generation. + * Any modification shall be done using the SILECS development environment + * and regenerating this source code. + */ + +#ifndef SILECSTESTCLASS_DU_H_ +#define SILECSTESTCLASS_DU_H_ + +#include <silecs-communication/interface/equipment/SilecsCluster.h> +#include <silecs-communication/wrapper/DeployUnit.h> +#include <silecs-communication/wrapper/Design.h> + +#include "SilecsHeader.h" +#include "SilecsTestClass.h" + +namespace SilecsTestClass_DU +{ + +typedef SilecsWrapper::DeployConfig DeployConfig; +typedef SilecsWrapper::DesignConfig DesignConfig; + +class DeployUnit : public SilecsWrapper::DeployUnit +{ +public: + + /*! + * \brief Use this method to create/get the unique instance of the Deploy Unit. + * + * \param logTopics This parameter can be used to enable/disable log topics + * valid topics are ERROR[,INFO,DEBUG,SETUP,ALLOC,RECV,SEND,COMM,DATA,LOCK]. + * + * \param globalConfig This parameter can be used to pass different parameters to + * the library. I.e. enabling automatic connection. + */ + static DeployUnit* getInstance(const std::string& logTopics = "", + const SilecsWrapper::DeployConfig& globalConfig = SilecsWrapper::DeployConfig()) + { + if (_instance == NULL) + { + _instance = new DeployUnit(logTopics, globalConfig); + } + else + { + if (logTopics.empty() == false) + { + _instance->getService()->setLogTopics(logTopics); + } + } + return dynamic_cast<DeployUnit*>(_instance); + } + + /*! + * \brief Use this method to create/get the unique instance of the Deploy Unit. + * + * \param globalConfig This parameter can be used to pass different parameters to + * the library. I.e. enabling automatic connection. + */ + static DeployUnit* getInstance(const SilecsWrapper::DeployConfig& globalConfig) + { + return getInstance("", globalConfig); + } + + /*! + * \brief Return pointer to the deployed design SilecsHeader. + */ + SilecsHeader::Design* getSilecsHeader() + { + return _SilecsHeader; + } + + /*! + * \brief Return pointer to the deployed design SilecsTestClass. + */ + SilecsTestClass::Design* getSilecsTestClass() + { + return _SilecsTestClass; + } + +private: + + SilecsHeader::Design* _SilecsHeader; + SilecsTestClass::Design* _SilecsTestClass; + + DeployUnit(const std::string& logTopics, const SilecsWrapper::DeployConfig& globalConfig) : + SilecsWrapper::DeployUnit("SilecsTestClass_DU", "0.1.0", logTopics, globalConfig) + { + // Construct Design SilecsHeader + _SilecsHeader = new SilecsHeader::Design((SilecsWrapper::DeployUnit*) this); + + // Construct Design SilecsTestClass + _SilecsTestClass = new SilecsTestClass::Design((SilecsWrapper::DeployUnit*) this); + + } + + ~DeployUnit() + { + delete _SilecsHeader; + delete _SilecsTestClass; + } +}; + + +class Controller : public SilecsWrapper::Controller +{ +public: + Controller(SilecsWrapper::Design *design, const std::string parameterFile) : + SilecsWrapper::Controller("tsts7001", "", design, parameterFile) + { + _deviceMap.insert(std::pair<std::string, SilecsWrapper::Device*>("SilecsHeader", new SilecsWrapper::Device("SilecsHeader", this))); + _deviceMap.insert(std::pair<std::string, SilecsWrapper::Device*>("dev0", new SilecsWrapper::Device("dev0", this))); + } + + ~Controller() + { + map<std::string, SilecsWrapper::Device*>::iterator it; + for (it = _deviceMap.begin(); it != _deviceMap.end(); it++) + { + delete it->second; + } + } + + /*! + * \brief Return pointer to the requested device. + * \param label Device label. + */ + SilecsWrapper::Device* getDevice(const std::string& label) + { + if (_deviceMap.find(label) != _deviceMap.end()) + { + return _deviceMap[label]; + } + throw Silecs::SilecsException(__FILE__, __LINE__, Silecs::PARAM_UNKNOWN_DEVICE_NAME, label); + } + + std::map<std::string, SilecsWrapper::Device*>& getDeviceMap() + { + return _deviceMap; + } + + /*! + * \brief Get pointer to device SilecsHeader. + */ + SilecsWrapper::Device* getSilecsHeader() + { + return _deviceMap["SilecsHeader"]; + } + + /*! + * \brief Get pointer to device dev0. + */ + SilecsWrapper::Device* getDev0() + { + return _deviceMap["dev0"]; + } + +private: + std::map<std::string, SilecsWrapper::Device*> _deviceMap; +}; + + +} /* namespace SilecsTestClass_DU */ + +#endif /* SILECSTESTCLASS_DU_H_ */ diff --git a/silecs_cli/tests/examples/SilecsTestClassDU.deploy b/silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.deploy similarity index 63% rename from silecs_cli/tests/examples/SilecsTestClassDU.deploy rename to silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.deploy index e84dc8a..20d61dd 100644 --- a/silecs_cli/tests/examples/SilecsTestClassDU.deploy +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.deploy @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<deploy-unit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/opt/fesa/fesa-fwk/7.4.0/fesa-model-gsi/xml/deployment/deployment-gsi.xsd"> - <include><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="/home/bel/mnabywan/lnx/workspace-silecs-course/SilecsTestClass/generated/xml/SilecsTestClassSchedulingView.xml"/></include> +<deploy-unit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/opt/fesa/fesa-model-gsi/7.4.0/xml/deployment/deployment-gsi.xsd"><include><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="/home/bel/mnabywan/lnx/workspace-silecs-test/SilecsTestClass/generated/xml/SilecsTestClassSchedulingView.xml"/></include> <information> - <deploy-unit-name>SilecsTestClassDU</deploy-unit-name> + <deploy-unit-name>SilecsTestClass_DU</deploy-unit-name> <deploy-unit-major-version>0</deploy-unit-major-version> <deploy-unit-minor-version>1</deploy-unit-minor-version> <deploy-unit-tiny-version>0</deploy-unit-tiny-version> @@ -19,14 +18,12 @@ <class-minor-version>1</class-minor-version> <class-tiny-version>0</class-tiny-version> <device-instance>required</device-instance> - <path>/home/bel/mnabywan/lnx/workspace-silecs-course/SilecsTestClass</path> - </class> + <path>/home/bel/mnabywan/lnx/workspace-silecs-test/SilecsTestClass</path></class> <scheduler> - <concurrency-layer name="default" threading-policy="single" id="_220816150343_0"> - <scheduling-unit scheduling-unit-name-ref="SilecsTestClass::StatusUpdateSchedulingUnit"/> + <concurrency-layer name="default" threading-policy="single" id="_220830122259_0"> + <scheduling-unit scheduling-unit-name-ref="SilecsTestClass::StatusUpdateSchedulingUnit" /> </concurrency-layer> </scheduler> - <executable> - <mixed extension="_M"/> + <executable><mixed extension="_M" /> </executable> </deploy-unit> diff --git a/silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.silecsdeploy b/silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.silecsdeploy new file mode 100644 index 0000000..11fd5d9 --- /dev/null +++ b/silecs_cli/tests/testClasses/SilecsTestClass_DU/src/SilecsTestClass_DU.silecsdeploy @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<SILECS-Deploy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" silecs-version="2.3.0" created="08/30/2022" updated="08/30/2022" xsi:noNamespaceSchemaLocation="/common/usr/cscofe/silecs/2.3.0/silecs-model/xml/DeploySchema.xsd"> + <Information> + <Owner user-login="mnabywan"/> + <Editor user-login="mnabywan"/> + </Information> + <Deploy-Unit name="SilecsTestClass_DU" version="0.1.0"/> + <SilecsDesign silecs-design-name="SilecsTestClass" silecs-design-version="0.1.0"/> + <Controller host-name="tsts7001"> + <Siemens-PLC system="TIA-PORTAL" model="SIMATIC_S7-1500" protocol="DEVICE_MODE" base-DB-number="1"> + <Device silecs-device-label="dev0" silecs-design-ref="SilecsTestClass" fesa-device-name="testDeviceSilecs1" fesa-fec-name="SilecsTestClass"/> + </Siemens-PLC> + </Controller> +</SILECS-Deploy> diff --git a/silecs_cli/tests/test_silecs.py b/silecs_cli/tests/test_silecs.py index 2b0e6ff..49d02f0 100644 --- a/silecs_cli/tests/test_silecs.py +++ b/silecs_cli/tests/test_silecs.py @@ -1,20 +1,33 @@ import os import sys import unittest +import filecmp +import shutil +from mock import patch + + +RELEASE_PARAM_DIR_PATH = os.path.join("tests", "releaseParamDir") +os.environ["RELEASE_PARAM_DIR"] = RELEASE_PARAM_DIR_PATH sys.path.append('../') -from silecs_cli import silecs +import silecs -BASE_FOR_BACKUP = os.path.join("tests", "examples", "SilecsTestClass.design") -BACKUP = BASE_FOR_BACKUP + ".backup" -DESIGN_PATH = os.path.join("tests", "examples", "SilecsTestClass2.design") -DEPLOY_PATH = os.path.join("tests", "examples", "SilecsTestClass_2_DU.deploy") +DESIGN_PATH = os.path.join("tests", "testClasses", "SilecsTestClass", "src", "SilecsTestClass.design") +DEPLOY_PATH = os.path.join("tests", "testClasses", "SilecsTestClass_DU", "src", "SilecsTestClass_DU.deploy") +BACKUP = DESIGN_PATH + ".backup" SILECS_DESIGN_PATH = DESIGN_PATH.split(".")[0] + ".silecsdesign" SILECS_DEPLOY_PATH = DEPLOY_PATH.split(".")[0] + ".silecsdeploy" +RELEASE_PARAM_FILEPATH = os.path.join(RELEASE_PARAM_DIR_PATH, "SilecsTestClass", "SilecsTestClass_DU", "tsts7001.silecsparam") +RELEASE_PARAM_FILEPATH_DEV = os.path.join(RELEASE_PARAM_DIR_PATH, "SilecsTestClass", "SilecsTestClass_DU-d", "tsts7001.silecsparam") + +design_schema_path_mock = "../silecs-model/src/xml/DesignSchema.xsd" +deploy_schema_path_mock = "../silecs-model/src/xml/DeploySchema.xsd" +@patch('silecs.DESIGN_SHEMA_PATH', design_schema_path_mock) +@patch('silecs.DEPLOY_SHEMA_PATH', deploy_schema_path_mock) class SilecsTest(unittest.TestCase): """Class to test silecs.py script""" @classmethod @@ -26,8 +39,11 @@ class SilecsTest(unittest.TestCase): if os.path.isfile(SILECS_DESIGN_PATH): os.remove(SILECS_DESIGN_PATH) - if os.path.isfile(SILECS_DEPLOY_PATH): - os.remove(SILECS_DEPLOY_PATH) + if os.path.isfile(RELEASE_PARAM_FILEPATH): + shutil.rmtree(RELEASE_PARAM_DIR_PATH) + + if os.path.isfile(RELEASE_PARAM_FILEPATH_DEV): + shutil.rmtree(RELEASE_PARAM_DIR_PATH_DEV) def test_get_extension(self): """Test getting extension from file""" @@ -62,9 +78,9 @@ class SilecsTest(unittest.TestCase): def test_get_schema_path(self): """Test getting xml schema path for silecs design deploy files""" filenames_schema_paths = [("/home/test/example/test1.silecsdesign", - "../silecs-model/src/xml/DesignSchema.xsd"), + design_schema_path_mock), ("/home/test/example/test2.silecsdeploy", - "../silecs-model/src/xml/DeploySchema.xsd")] + deploy_schema_path_mock)] for filename, schema_path in filenames_schema_paths: with self.subTest(): self.assertEqual(silecs.get_schema_path(filename), schema_path) @@ -92,13 +108,12 @@ class SilecsTest(unittest.TestCase): def test_create_backup_file(self): """Test creating backup file""" - silecs.create_backup_file(BASE_FOR_BACKUP) + silecs.create_backup_file(DESIGN_PATH) self.assertNotEqual(os.stat(BACKUP).st_size, 0) def test_silecs_validate(self): """Test validating silecs design/deploy files""" - silecs_design_deploy_paths = [os.path.join("tests", "examples", "SilecsTestClass.silecsdesign"), \ - os.path.join("tests", "examples", "SilecsTestClassDU.silecsdeploy")] + silecs_design_deploy_paths = [SILECS_DESIGN_PATH, SILECS_DEPLOY_PATH] for path in silecs_design_deploy_paths: xsd_path = silecs.get_schema_path(path) self.assertEqual(silecs.validate(path, xsd_path), True) @@ -129,10 +144,6 @@ class SilecsTest(unittest.TestCase): path = os.path.abspath(DEPLOY_PATH) new_file_path = silecs.get_silecs_file_path_from_fesa(path) - silecs.create(new_file_path) - print(new_file_path) - self.assertEqual(os.path.exists(new_file_path), True) - self.assertNotEqual(os.stat(new_file_path).st_size, 0) try: silecs.create(new_file_path) @@ -140,6 +151,16 @@ class SilecsTest(unittest.TestCase): print(str(e)) self.assertIn("There is already a .silecsdeploy file available:", str(e)) + def test_release_param(self): + """Test release param file""" + + result = silecs.release(SILECS_DEPLOY_PATH) + + self.assertEqual(result, True) + self.assertEqual(os.path.isfile(RELEASE_PARAM_FILEPATH), True) + self.assertEqual(filecmp.cmp(RELEASE_PARAM_FILEPATH, + os.path.join("tests", "testClasses", "SilecsTestClass_DU", "generated-silecs", "client", "tsts7001.silecsparam")), + True) if __name__ == "_main__": unittest.main() -- GitLab