You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/08/27 08:33:49 UTC

[plc4x] branch develop updated (04c9bf2 -> b0fe038)

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git.


    from 04c9bf2  Merge branches 'develop' and 'merge-julian-branch' of https://gitbox.apache.org/repos/asf/plc4x into develop
     new a7eefd6  - Adjusted the code generation to the latest changes in the plc4x-maven-plugin
     new b0fe038  - First steps to implementing the Allen Bradley ETH protocol.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../freemarker/FreemarkerLanguageOutput.java       |   5 +-
 .../language/java/JavaLanguageTemplateHelper.java  |  10 +-
 .../templates/java/active-io-template.ftlh         |  10 +-
 .../templates/java/passive-io-template.ftlh        |  10 +-
 .../resources/templates/java/pojo-template.ftlh    |   4 +-
 .../protocol/test/ProtocolTestsuiteRunner.java     |   5 +
 protocols/{df1 => ab-eth}/pom.xml                  |   6 +-
 .../plc4x/protocol/abeth/ABETHProtocol.java}       |   8 +-
 ...e.plc4x.plugins.codegenerator.protocol.Protocol |   2 +-
 .../main/resources/protocols/abeth/ab-eth.mspec    |  85 +++++++++++
 protocols/pom.xml                                  |   3 +-
 sandbox/pom.xml                                    |   1 +
 .../pom.xml                                        |  45 +++---
 .../apache/plc4x/protocol/abeth/AbEthTest.java}    |   8 +-
 .../test/resources/testsuite/AbEthTestsuite.xml    | 163 +++++++++++++++++++++
 15 files changed, 315 insertions(+), 50 deletions(-)
 copy protocols/{df1 => ab-eth}/pom.xml (90%)
 copy protocols/{df1/src/main/java/org/apache/plc4x/protocol/df1/Df1Protocol.java => ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java} (87%)
 copy protocols/{df1 => ab-eth}/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol (94%)
 create mode 100644 protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec
 copy sandbox/{test-java-s7-driver => test-java-ab-eth-driver}/pom.xml (62%)
 copy sandbox/{test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/Df1Test.java => test-java-ab-eth-driver/src/test/java/org/apache/plc4x/protocol/abeth/AbEthTest.java} (83%)
 create mode 100644 sandbox/test-java-ab-eth-driver/src/test/resources/testsuite/AbEthTestsuite.xml


[plc4x] 01/02: - Adjusted the code generation to the latest changes in the plc4x-maven-plugin

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit a7eefd63fe7a285fc4c01d57be838c21f0ba667d
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Aug 27 10:32:43 2019 +0200

    - Adjusted the code generation to the latest changes in the plc4x-maven-plugin
---
 .../protocol/freemarker/FreemarkerLanguageOutput.java          |  5 +++--
 .../apache/plc4x/language/java/JavaLanguageTemplateHelper.java | 10 +++++++++-
 .../src/main/resources/templates/java/active-io-template.ftlh  | 10 +++++-----
 .../src/main/resources/templates/java/passive-io-template.ftlh | 10 +++++-----
 .../src/main/resources/templates/java/pojo-template.ftlh       |  4 ++--
 5 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
index 6b69f20..7ae87a7 100644
--- a/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
+++ b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java
@@ -41,7 +41,7 @@ public abstract class FreemarkerLanguageOutput implements LanguageOutput {
     private static final Logger LOGGER = LoggerFactory.getLogger(FreemarkerLanguageOutput.class);
 
     @Override
-    public void generate(File outputDir, String packageName, Map<String, ComplexTypeDefinition> types)
+    public void generate(File outputDir, String languageName, String protocolName, Map<String, ComplexTypeDefinition> types)
         throws GenerationException {
 
         try {
@@ -60,7 +60,8 @@ public abstract class FreemarkerLanguageOutput implements LanguageOutput {
 
                 // Prepare a new generation context
                 Map<String, Object> typeContext = new HashMap<>();
-                typeContext.put("packageName", packageName);
+                typeContext.put("languageName", languageName);
+                typeContext.put("protocolName", protocolName);
                 typeContext.put("typeName", typeEntry.getKey());
                 typeContext.put("type", typeEntry.getValue());
                 typeContext.put("helper", getHelper(types));
diff --git a/build-utils/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java b/build-utils/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java
index 5f4685f..3dca032 100644
--- a/build-utils/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java
+++ b/build-utils/language-java/src/main/java/org/apache/plc4x/language/java/JavaLanguageTemplateHelper.java
@@ -46,6 +46,14 @@ public class JavaLanguageTemplateHelper implements FreemarkerLanguageTemplateHel
         this.types = types;
     }
 
+    public String languagePackageName(String languageName) {
+        return String.join("", languageName.split("\\-"));
+    }
+
+    public String protocolPackageName(String protocolName) {
+        return String.join("", protocolName.split("\\-"));
+    }
+
     public String getLanguageTypeNameForField(TypedField field) {
         boolean optional = field instanceof OptionalField;
         return getLanguageTypeNameForField(!optional, field);
@@ -294,7 +302,7 @@ public class JavaLanguageTemplateHelper implements FreemarkerLanguageTemplateHel
                     return "writeUnsignedInt(" + simpleTypeReference.getSize() + ", ((Number) " + fieldName + ").intValue())";
                 }
                 if (simpleTypeReference.getSize() <= 32) {
-                    return "writeUnsignedLong(" + simpleTypeReference.getSize() + ", ((Number) " + fieldName + ").longValue()";
+                    return "writeUnsignedLong(" + simpleTypeReference.getSize() + ", ((Number) " + fieldName + ").longValue())";
                 }
                 return "writeUnsignedBigInteger" + simpleTypeReference.getSize() + ", (BigInteger) " + fieldName + ")";
             }
diff --git a/build-utils/language-java/src/main/resources/templates/java/active-io-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/active-io-template.ftlh
index 50cafe8..3c0a8a1 100644
--- a/build-utils/language-java/src/main/resources/templates/java/active-io-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/active-io-template.ftlh
@@ -16,7 +16,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-${packageName?replace(".", "/")}/io/${typeName}IO.java
+org/apache/plc4x/${helper.languagePackageName(languageName)}/${helper.protocolPackageName(protocolName)}/io/${typeName}IO.java
 /*
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -36,10 +36,10 @@ ${packageName?replace(".", "/")}/io/${typeName}IO.java
   under the License.
 */
 
-package ${packageName}.io;
+package org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.io;
 
-import ${packageName}.*;
-<#if helper.getComplexTypes(type)?has_content>import ${packageName}.io.*;</#if>
+import org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.*;
+<#if helper.getComplexTypes(type)?has_content>import org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.io.*;</#if>
 import org.apache.plc4x.java.utils.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -226,7 +226,7 @@ public class ${typeName}IO implements MessageIO<${typeName}<#if helper.isDiscrim
     <#case "optional">
 
         // Optional Field (${field.name}) (Can be skipped, if a given expression evaluates to false)
-        ${helper.getLanguageTypeNameForField(field)} ${field.name} = ${helper.getNullValueForType(field.type)};
+        ${helper.getLanguageTypeNameForField(field)} ${field.name} = null;
         if(${helper.toDeserializationExpression(field.conditionExpression, type.parserArguments)?no_esc}) {
             ${field.name} = <#if helper.isSimpleType(field.type)>io.${helper.getReadBufferReadMethodCall(field.type)}<#else>${field.type.name?uncap_first}IO.parse(io);</#if>;
         }
diff --git a/build-utils/language-java/src/main/resources/templates/java/passive-io-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/passive-io-template.ftlh
index 92f63de..2807bb6 100644
--- a/build-utils/language-java/src/main/resources/templates/java/passive-io-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/passive-io-template.ftlh
@@ -16,7 +16,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-${packageName?replace(".", "/")}/io/${typeName}IO.java
+org/apache/plc4x/${helper.languagePackageName(languageName)}/${helper.protocolPackageName(protocolName)}/io/${typeName}IO.java
 /*
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -36,10 +36,10 @@ ${packageName?replace(".", "/")}/io/${typeName}IO.java
   under the License.
 */
 
-package ${packageName}.io;
+package org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.io;
 
-import ${packageName}.*;
-<#if helper.getComplexTypes(type)?has_content>import ${packageName}.io.*;</#if>
+import org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.*;
+<#if helper.getComplexTypes(type)?has_content>import org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)}.io.*;</#if>
 import org.apache.plc4x.java.utils.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -226,7 +226,7 @@ public class ${typeName}IO implements MessageInput<${typeName}<#if helper.isDisc
     <#case "optional">
 
         // Optional Field (${field.name}) (Can be skipped, if a given expression evaluates to false)
-        ${helper.getLanguageTypeNameForField(field)} ${field.name} = ${helper.getNullValueForType(field.type)};
+        ${helper.getLanguageTypeNameForField(field)} ${field.name} = null;
         if(${helper.toDeserializationExpression(field.conditionExpression, type.parserArguments)?no_esc}) {
             ${field.name} = <#if helper.isSimpleType(field.type)>io.${helper.getReadBufferReadMethodCall(field.type)}<#else>${field.type.name?uncap_first}IO.parse(io);</#if>;
         }
diff --git a/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
index 628e4ce..27d52d5 100644
--- a/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
@@ -16,7 +16,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-${packageName?replace(".", "/")}/${typeName}.java
+org/apache/plc4x/${helper.languagePackageName(languageName)}/${helper.protocolPackageName(protocolName)}/${typeName}.java
 /*
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -36,7 +36,7 @@ ${packageName?replace(".", "/")}/${typeName}.java
   under the License.
 */
 
-package ${packageName};
+package org.apache.plc4x.${helper.languagePackageName(languageName)}.${helper.protocolPackageName(protocolName)};
 
 import com.fasterxml.jackson.annotation.*;
 import org.apache.plc4x.java.utils.Message;


[plc4x] 02/02: - First steps to implementing the Allen Bradley ETH protocol.

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit b0fe0380cd8139a79b610f6e2123536ee1de15e0
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Aug 27 10:33:41 2019 +0200

    - First steps to implementing the Allen Bradley ETH protocol.
---
 .../protocol/test/ProtocolTestsuiteRunner.java     |   5 +
 protocols/ab-eth/pom.xml                           |  43 ++++++
 .../apache/plc4x/protocol/abeth/ABETHProtocol.java |  46 ++++++
 ...e.plc4x.plugins.codegenerator.protocol.Protocol |  19 +++
 .../main/resources/protocols/abeth/ab-eth.mspec    |  85 +++++++++++
 protocols/pom.xml                                  |   3 +-
 sandbox/pom.xml                                    |   1 +
 sandbox/test-java-ab-eth-driver/pom.xml            |  92 ++++++++++++
 .../org/apache/plc4x/protocol/abeth/AbEthTest.java |  30 ++++
 .../test/resources/testsuite/AbEthTestsuite.xml    | 163 +++++++++++++++++++++
 10 files changed, 486 insertions(+), 1 deletion(-)

diff --git a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
index 50dbc41..7e1f299 100644
--- a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
+++ b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
@@ -109,11 +109,16 @@ public class ProtocolTestsuiteRunner {
             String xmlString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(msg);
             Diff diff = DiffBuilder.compare(referenceXml).withTest(xmlString).ignoreWhitespace().build();
             if(diff.hasDifferences()) {
+                System.out.println(xmlString);
                 throw new ProtocolTestsuiteException("Differences were found after parsing.\n" + diff.toString());
             }
             WriteBuffer writeBuffer = new WriteBuffer(((SizeAware) msg).getLengthInBytes(), testSuite.isLittleEndian());
             messageIO.serialize(writeBuffer, msg);
             byte[] data = writeBuffer.getData();
+            if(testcase.getRaw().length != data.length) {
+                LOGGER.info("Expected a byte array with a length of " + testcase.getRaw().length +
+                    " but got one with " + data.length);
+            }
             if(!Arrays.equals(testcase.getRaw(), data)) {
                 int i;
                 for(i = 0; i < data.length; i++) {
diff --git a/protocols/ab-eth/pom.xml b/protocols/ab-eth/pom.xml
new file mode 100644
index 0000000..deafab0
--- /dev/null
+++ b/protocols/ab-eth/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.plc4x</groupId>
+    <artifactId>plc4x-protocols</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>plc4x-protocols-ab-eth</artifactId>
+
+  <name>Protocols: AB-ETH</name>
+  <description>Base protocol specifications for the AB ETH protocol</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-build-utils-protocol-base-mspec</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/protocols/ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java b/protocols/ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java
new file mode 100644
index 0000000..5f72f06
--- /dev/null
+++ b/protocols/ab-eth/src/main/java/org/apache/plc4x/protocol/abeth/ABETHProtocol.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.plc4x.protocol.abeth;
+
+import org.apache.plc4x.plugins.codegenerator.language.mspec.parser.MessageFormatParser;
+import org.apache.plc4x.plugins.codegenerator.protocol.Protocol;
+import org.apache.plc4x.plugins.codegenerator.types.definitions.ComplexTypeDefinition;
+import org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException;
+
+import java.io.InputStream;
+import java.util.Map;
+
+public class ABETHProtocol implements Protocol {
+
+    @Override
+    public String getName() {
+        return "ab-eth";
+    }
+
+    @Override
+    public Map<String, ComplexTypeDefinition> getTypeDefinitions() throws GenerationException {
+        InputStream schemaInputStream = ABETHProtocol.class.getResourceAsStream("/protocols/abeth/ab-eth.mspec");
+        if(schemaInputStream == null) {
+            throw new GenerationException("Error loading message-format schema for protocol '" + getName() + "'");
+        }
+        return new MessageFormatParser().parse(schemaInputStream);
+    }
+
+}
diff --git a/protocols/ab-eth/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/ab-eth/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
new file mode 100644
index 0000000..6f20f62
--- /dev/null
+++ b/protocols/ab-eth/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.plc4x.protocol.abeth.ABETHProtocol
\ No newline at end of file
diff --git a/protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec b/protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec
new file mode 100644
index 0000000..a279bdb
--- /dev/null
+++ b/protocols/ab-eth/src/main/resources/protocols/abeth/ab-eth.mspec
@@ -0,0 +1,85 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+[discriminatedType 'CIPEncapsulationPacket'
+    [discriminator uint 16 'commandType']
+    [implicit      uint 16 'len' 'lengthInBytes - 28']
+    [simple        uint 32 'sessionHandle']
+    [simple        uint 32 'status']
+    [array         uint 8  'senderContext' count '8']
+    [simple        uint 32 'options']
+    [reserved      uint 32 '0x00000000']
+    [typeSwitch 'commandType'
+        ['0x0101' CIPEncapsulationConnectionRequest
+        ]
+        ['0x0201' CIPEncapsulationConnectionResponse
+        ]
+        ['0x0107' CIPEncapsulationReadRequest
+            [simple   DF1RequestMessage  'request']
+        ]
+        ['0x0207' CIPEncapsulationReadResponse [uint 16 'len']
+            [simple   DF1ResponseMessage 'response' ['len']]
+        ]
+    ]
+]
+
+[discriminatedType 'DF1RequestMessage'
+    [simple        uint 8  'destinationAddress']
+    [simple        uint 8  'sourceAddress']
+    [reserved      uint 16 '0x0000']
+    [discriminator uint 8  'commandCode']
+    [simple        uint 8  'status']
+    [simple        uint 16 'transactionCounter']
+    [typeSwitch 'commandCode'
+        ['0x0F' DF1CommandRequestMessage
+            [simple DF1RequestCommand 'command']
+        ]
+    ]
+]
+
+[discriminatedType 'DF1ResponseMessage' [uint 16 'payloadLength']
+    [reserved      uint 8  '0x00']
+    [simple        uint 8  'destinationAddress']
+    [simple        uint 8  'sourceAddress']
+    [reserved      uint 8  '0x00']
+    [discriminator uint 8  'commandCode']
+    [simple        uint 8  'status']
+    [simple        uint 16 'transactionCounter']
+    [typeSwitch 'commandCode'
+        ['0x4F' DF1CommandResponseMessageProtectedTypedLogicalRead [uint 8 'status']
+            [array    uint 8 'data' length 'payloadLength - 8']
+            [optional uint 8 'extendedStatus' 'status != 0']
+        ]
+    ]
+]
+
+[discriminatedType 'DF1RequestCommand'
+    [discriminator    uint 8 'functionCode']
+    [typeSwitch 'functionCode'
+        ['0xA2' DF1RequestProtectedTypedLogicalRead
+            [simple uint 8 'byteSize']
+            [simple uint 8 'fileNumber']
+            [simple uint 8 'fileType']
+            [simple uint 8 'elementNumber']
+            [simple uint 8 'subElementNumber']
+        ]
+    ]
+]
+
+
diff --git a/protocols/pom.xml b/protocols/pom.xml
index 8f59a67..1022cea 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -190,9 +190,10 @@
   </build>
 
   <modules>
+    <module>ab-eth</module>
+    <module>df1</module>
     <module>knxnetip</module>
     <module>s7</module>
-    <module>df1</module>
   </modules>
 
   <profiles>
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index f4f5422..b3dc0ab 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -36,6 +36,7 @@
 
   <modules>
     <module>code-gen</module>
+    <module>test-java-ab-eth-driver</module>
     <module>test-java-knxnetip-driver</module>
     <module>test-java-s7-driver</module>
     <module>test-java-passive-s7-driver</module>
diff --git a/sandbox/test-java-ab-eth-driver/pom.xml b/sandbox/test-java-ab-eth-driver/pom.xml
new file mode 100644
index 0000000..136aeae
--- /dev/null
+++ b/sandbox/test-java-ab-eth-driver/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.plc4x.sandbox</groupId>
+    <artifactId>plc4x-sandbox</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>test-java-ab-eth-driver</artifactId>
+
+  <name>Sandbox: Test Generated AB-ETH Driver</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.plc4x.plugins</groupId>
+        <artifactId>plc4x-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>generate-driver</goal>
+            </goals>
+            <configuration>
+              <protocolName>ab-eth</protocolName>
+              <languageName>java</languageName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-utils-driver-base-java</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-utils-protocol-test-utils</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-build-utils-language-java</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <!-- Scope is 'provided' as this way it's not shipped with the driver -->
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4x-protocols-ab-eth</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <!-- Scope is 'provided' as this way it's not shipped with the driver -->
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/sandbox/test-java-ab-eth-driver/src/test/java/org/apache/plc4x/protocol/abeth/AbEthTest.java b/sandbox/test-java-ab-eth-driver/src/test/java/org/apache/plc4x/protocol/abeth/AbEthTest.java
new file mode 100644
index 0000000..39b275f
--- /dev/null
+++ b/sandbox/test-java-ab-eth-driver/src/test/java/org/apache/plc4x/protocol/abeth/AbEthTest.java
@@ -0,0 +1,30 @@
+/*
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+*/
+
+package org.apache.plc4x.protocol.abeth;
+
+import org.apache.plc4x.protocol.test.ProtocolTestsuiteRunner;
+
+public class AbEthTest extends ProtocolTestsuiteRunner {
+
+    public AbEthTest() {
+        super("/testsuite/AbEthTestsuite.xml");
+    }
+
+}
diff --git a/sandbox/test-java-ab-eth-driver/src/test/resources/testsuite/AbEthTestsuite.xml b/sandbox/test-java-ab-eth-driver/src/test/resources/testsuite/AbEthTestsuite.xml
new file mode 100644
index 0000000..b9b13f7
--- /dev/null
+++ b/sandbox/test-java-ab-eth-driver/src/test/resources/testsuite/AbEthTestsuite.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+<test:testsuite xmlns:test="https://plc4x.apache.org/schemas/testsuite.xsd"
+                bigEndian="false">
+
+  <name>Allen-Bradley ETH</name>
+
+  <testcase>
+    <name>Connection Request</name>
+    <raw>01010000000000000000000000040005000000000000000000000000</raw>
+    <root-type>CIPEncapsulationPacket</root-type>
+    <xml>
+      <CIPEncapsulationConnectionRequest className="org.apache.plc4x.java.abeth.CIPEncapsulationConnectionRequest">
+        <sessionHandle>0</sessionHandle>
+        <status>0</status>
+        <senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>4</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>5</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+        </senderContext>
+        <options>0</options>
+      </CIPEncapsulationConnectionRequest>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Connection Response</name>
+    <raw>02010000000003320000000000040005000000000000000000000000</raw>
+    <root-type>CIPEncapsulationPacket</root-type>
+    <xml>
+      <CIPEncapsulationConnectionResponse className="org.apache.plc4x.java.abeth.CIPEncapsulationConnectionResponse">
+        <sessionHandle>818</sessionHandle>
+        <status>0</status>
+        <senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>4</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>5</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+        </senderContext>
+        <options>0</options>
+      </CIPEncapsulationConnectionResponse>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Protected Typed Logical Read Request</name>
+    <raw>0107000e000003320000000040000000000000000000000000000000080500000f000401a21800640000</raw>
+    <root-type>CIPEncapsulationPacket</root-type>
+    <xml>
+      <CIPEncapsulationReadRequest className="org.apache.plc4x.java.abeth.CIPEncapsulationReadRequest">
+        <sessionHandle>818</sessionHandle>
+        <status>0</status>
+        <senderContext>
+          <senderContext>64</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+        </senderContext>
+        <options>0</options>
+        <request className="org.apache.plc4x.java.abeth.DF1CommandRequestMessage">
+          <destinationAddress>8</destinationAddress>
+          <sourceAddress>5</sourceAddress>
+          <status>0</status>
+          <transactionCounter>1025</transactionCounter>
+          <command className="org.apache.plc4x.java.abeth.DF1RequestProtectedTypedLogicalRead">
+            <byteSize>24</byteSize>
+            <fileNumber>0</fileNumber>
+            <fileType>100</fileType>
+            <elementNumber>0</elementNumber>
+            <subElementNumber>0</subElementNumber>
+          </command>
+        </request>
+      </CIPEncapsulationReadRequest>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>Protected Typed Logical Read Response</name>
+    <raw>02070020000003320000000040000000000000000000000000000000000508004f000401910101000900040405001f02010003000404050000024000</raw>
+    <root-type>CIPEncapsulationPacket</root-type>
+    <xml>
+      <CIPEncapsulationReadResponse className="org.apache.plc4x.java.abeth.CIPEncapsulationReadResponse">
+        <sessionHandle>818</sessionHandle>
+        <status>0</status>
+        <senderContext>
+          <senderContext>64</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+          <senderContext>0</senderContext>
+        </senderContext>
+        <options>0</options>
+        <response className="org.apache.plc4x.java.abeth.DF1CommandResponseMessageProtectedTypedLogicalRead">
+          <destinationAddress>5</destinationAddress>
+          <sourceAddress>8</sourceAddress>
+          <status>0</status>
+          <transactionCounter>1025</transactionCounter>
+          <data>
+            <data>145</data>
+            <data>1</data>
+            <data>1</data>
+            <data>0</data>
+            <data>9</data>
+            <data>0</data>
+            <data>4</data>
+            <data>4</data>
+            <data>5</data>
+            <data>0</data>
+            <data>31</data>
+            <data>2</data>
+            <data>1</data>
+            <data>0</data>
+            <data>3</data>
+            <data>0</data>
+            <data>4</data>
+            <data>4</data>
+            <data>5</data>
+            <data>0</data>
+            <data>0</data>
+            <data>2</data>
+            <data>64</data>
+            <data>0</data>
+          </data>
+          <extendedStatus/>
+        </response>
+      </CIPEncapsulationReadResponse>
+    </xml>
+  </testcase>
+
+</test:testsuite>
\ No newline at end of file