You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by ld...@apache.org on 2020/05/07 23:43:19 UTC
[plc4x] 02/02: Sketch of Profinet DCP mspec.
This is an automated email from the ASF dual-hosted git repository.
ldywicki pushed a commit to branch feature/profinet
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit b69688a79192b33f04f9d1b62d8b729c268715a3
Author: Ćukasz Dywicki <lu...@code-house.org>
AuthorDate: Fri May 8 01:41:46 2020 +0200
Sketch of Profinet DCP mspec.
---
protocols/pom.xml | 1 +
protocols/profinet/pom.xml | 46 +++++
.../protocol/profinet/dcp/ProfinetDCPProtocol.java | 46 +++++
...e.plc4x.plugins.codegenerator.protocol.Protocol | 19 ++
.../protocols/profinet/profinet.dcp.mspec | 156 +++++++++++++++++
sandbox/pom.xml | 1 +
sandbox/test-java-profinet-driver/pom.xml | 158 +++++++++++++++++
.../apache/plc4x/java/profinet/dcp/DCPUtil.java | 48 ++++++
.../java/profinet/dcp/ProfinetDCPBlockTest.java | 33 ++++
.../java/profinet/dcp/ProfinetDCPFrameTest.java | 33 ++++
.../test/resources/testsuite/ProfinetDCPBlock.xml | 192 +++++++++++++++++++++
.../test/resources/testsuite/ProfinetDCPFrame.xml | 154 +++++++++++++++++
12 files changed, 887 insertions(+)
diff --git a/protocols/pom.xml b/protocols/pom.xml
index 94a96f2..0d957a7 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -43,6 +43,7 @@
<module>knxnetip</module>
<module>lldp</module>
<module>modbus</module>
+ <module>profinet</module>
<module>s7</module>
</modules>
diff --git a/protocols/profinet/pom.xml b/protocols/profinet/pom.xml
new file mode 100644
index 0000000..3c71c53
--- /dev/null
+++ b/protocols/profinet/pom.xml
@@ -0,0 +1,46 @@
+<?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.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4x-protocols-profinet</artifactId>
+
+ <name>Protocols: Profinet</name>
+ <description>
+ Base protocol specifications for the Profinet.
+ Currently only DCP - Discovery and Configuration Protocol
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-build-utils-protocol-base-mspec</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/protocols/profinet/src/main/java/org/apache/plc4x/protocol/profinet/dcp/ProfinetDCPProtocol.java b/protocols/profinet/src/main/java/org/apache/plc4x/protocol/profinet/dcp/ProfinetDCPProtocol.java
new file mode 100644
index 0000000..fc61e37
--- /dev/null
+++ b/protocols/profinet/src/main/java/org/apache/plc4x/protocol/profinet/dcp/ProfinetDCPProtocol.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.profinet.dcp;
+
+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.TypeDefinition;
+import org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException;
+
+import java.io.InputStream;
+import java.util.Map;
+
+public class ProfinetDCPProtocol implements Protocol {
+
+ @Override
+ public String getName() {
+ return "profinet.dcp";
+ }
+
+ @Override
+ public Map<String, TypeDefinition> getTypeDefinitions() throws GenerationException {
+ InputStream schemaInputStream = ProfinetDCPProtocol.class.getResourceAsStream("/protocols/profinet/profinet.dcp.mspec");
+ if(schemaInputStream == null) {
+ throw new GenerationException("Error loading message-format schema for protocol '" + getName() + "'");
+ }
+ return new MessageFormatParser().parse(schemaInputStream);
+ }
+
+}
diff --git a/protocols/profinet/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol b/protocols/profinet/src/main/resources/META-INF/services/org.apache.plc4x.plugins.codegenerator.protocol.Protocol
new file mode 100644
index 0000000..5a2c400
--- /dev/null
+++ b/protocols/profinet/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.profinet.dcp.ProfinetDCPProtocol
\ No newline at end of file
diff --git a/protocols/profinet/src/main/resources/protocols/profinet/profinet.dcp.mspec b/protocols/profinet/src/main/resources/protocols/profinet/profinet.dcp.mspec
new file mode 100644
index 0000000..298243a
--- /dev/null
+++ b/protocols/profinet/src/main/resources/protocols/profinet/profinet.dcp.mspec
@@ -0,0 +1,156 @@
+//
+// 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.
+//
+
+[type 'ProfinetFrame'
+ [enum FrameType 'frameType' ]
+ [simple ProfinetData 'frame' ['frameType']]
+]
+
+[discriminatedType 'ProfinetData' [FrameType 'frameType']
+ [typeSwitch 'frameType'
+ ['FrameType.IDENTIFY_MULTICAST_REQUEST' DcpIdentRequestPDU
+ [enum DCPServiceID 'serviceId' ]
+ [enum DCPServiceType 'serviceType' ]
+ [simple uint 32 'xid' ]
+ [simple uint 16 'responseDelay' ]
+ [simple uint 16 'dcpDataLength' ]
+ [array DCPBlock 'blocks' length 'dcpDataLength']
+ ]
+ ['FrameType.IDENTIFY_RESPONSE' DcpIdentResponsePDU
+ [enum DCPServiceID 'serviceId' ]
+ [enum DCPServiceType 'serviceType' ]
+ [simple uint 32 'xid' ]
+ [simple uint 16 'responseDelay' ]
+ [simple uint 16 'dcpDataLength' ]
+ [array DCPBlock 'blocks' length 'dcpDataLength']
+ ]
+ ]
+]
+
+[discriminatedType 'DCPBlock'
+ [enum DCPBlockOption 'blockType']
+ [typeSwitch 'blockType'
+ ['DCPBlockOption.IP' IP
+ [enum IpSubOption 'subOption']
+ [simple uint 16 'length' ]
+ [simple uint 16 'info' ]
+ [simple IPv4Address 'ipAddress' ]
+ [simple IPv4Address 'subnetMask' ]
+ [simple IPv4Address 'standardGateway']
+ ]
+ ['DCPBlockOption.DEVICE_PROPERTIES' DeviceProperties
+ [enum DevicePropertiesSubOption 'subOption' ]
+ [simple DCPDeviceProperties 'properties' ['subOption']]
+ ]
+ ['DCPBlockOption.ALL_SELECTOR' AllSelector
+ [const uint 8 'subOption' '0xFF' ]
+ [const uint 16 'length' '0x00' ]
+ ]
+ ]
+]
+
+[discriminatedType 'DCPDeviceProperties' [DevicePropertiesSubOption 'subOptionType']
+ [simple uint 16 'length' ]
+ [simple uint 16 'info' ]
+ [typeSwitch 'subOptionType'
+ ['DevicePropertiesSubOption.STATION_TYPE' StationType [uint 16 'length']
+ [simple Text 'vendorNameForDevice' ['length - 2']]
+ ]
+ ['DevicePropertiesSubOption.STATION_NAME' StationName [uint 16 'length']
+ [simple Text 'name' ['length - 2']]
+ ]
+ ['DevicePropertiesSubOption.DEVICE_ID' DeviceId
+ [simple uint 16 'vendorId' ]
+ [simple uint 16 'deviceId' ]
+ ]
+ ['DevicePropertiesSubOption.DEVICE_ROLE' DeviceRole
+ [simple uint 8 'role' ]
+ [reserved uint 8 '0x00' ]
+ ]
+ ['DevicePropertiesSubOption.DEVICE_OPTIONS' DeviceOptions
+ [enum DCPBlockOption 'blockType' ]
+ [enum DevicePropertiesSubOption 'subOption' ]
+ ]
+ ['DevicePropertiesSubOption.DEVICE_INSTANCE' DeviceInstance
+ [simple uint 8 'instanceLow' ]
+ [simple uint 8 'instanceHigh' ]
+ ]
+ ]
+ [padding uint 8 'pad' '0x00' '(length % 2) == 1']
+]
+
+
+[enum uint 8 'DCPBlockOption'
+ ['0x01' IP ]
+ ['0x02' DEVICE_PROPERTIES ]
+ ['0xFF' ALL_SELECTOR ]
+]
+
+[enum uint 8 'DevicePropertiesSubOption'
+ ['0x01' STATION_TYPE ]
+ ['0x02' STATION_NAME ]
+ ['0x03' DEVICE_ID ]
+ ['0x04' DEVICE_ROLE ]
+ ['0x05' DEVICE_OPTIONS ]
+ ['0x07' DEVICE_INSTANCE ]
+]
+
+[enum uint 8 'IpSubOption'
+ ['0x02' IP_PARAMETER ]
+]
+
+[enum uint 8 'DCPServiceID'
+ ['0x05' IDENTIFY]
+ ['0xFEFE' IDENTIFY_RESPONSE ]
+]
+
+[enum uint 8 'DCPServiceType'
+ ['0x00' REQUEST ]
+ ['0x01' RESPONSE_SUCCESS ]
+]
+
+[enum uint 16 'FrameType'
+ ['0xFEFE' IDENTIFY_MULTICAST_REQUEST]
+ ['0xFEFF' IDENTIFY_RESPONSE ]
+]
+
+[type 'MacAddress'
+ [simple uint 8 'octet1' ]
+ [simple uint 8 'octet2' ]
+ [simple uint 8 'octet3' ]
+ [simple uint 8 'octet4' ]
+ [simple uint 8 'octet5' ]
+ [simple uint 8 'octet6' ]
+]
+
+[type 'IPv4Address'
+ [simple uint 8 'octet1' ]
+ [simple uint 8 'octet2' ]
+ [simple uint 8 'octet3' ]
+ [simple uint 8 'octet4' ]
+]
+
+[type 'Text' [uint 16 'len']
+ // fixme _type.encoding doesn't work for readString call, it ends up with " sequence in generated Java
+ [manual string 'UTF-8' 'text'
+ 'STATIC_CALL("org.apache.plc4x.java.profinet.dcp.DCPUtil.readString", io, len)'
+ 'STATIC_CALL("org.apache.plc4x.java.profinet.dcp.DCPUtil.writeString", io, _value, _type.encoding)'
+ 'STATIC_CALL("org.apache.plc4x.java.profinet.dcp.DCPUtil.length", text)'
+ ]
+]
\ No newline at end of file
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index 1853bdb..de768ba 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -42,6 +42,7 @@
<module>test-java-bacnetip-driver</module>
<module>test-java-df1-driver</module>
<module>test-java-lldp-driver</module>
+ <module>test-java-profinet-driver</module>
<module>test-streampipes-plc4x-adapters</module>
<module>test-streampipes-plc4x-processors</module>
diff --git a/sandbox/test-java-profinet-driver/pom.xml b/sandbox/test-java-profinet-driver/pom.xml
new file mode 100644
index 0000000..ff10fcc
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/pom.xml
@@ -0,0 +1,158 @@
+<?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.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>test-java-profinet-driver</artifactId>
+
+ <name>Sandbox: Test Generated Profinet Driver</name>
+ <description>Basic implementation of Profinet driver, so far only Discovery and Configuration Protocol.</description>
+
+ <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>profinet.dcp</protocolName>
+ <languageName>java</languageName>
+ <outputFlavor>read-write</outputFlavor>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-transport-raw-socket</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-configuration2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.github.snksoft</groupId>
+ <artifactId>crc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-build-utils-language-java</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <!-- Scope is 'provided' as this way it's not shipped with the driver -->
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- <!– https://mvnrepository.com/artifact/org.rxtx/rxtx –>
+ <dependency>
+ <groupId>org.rxtx</groupId>
+ <artifactId>rxtx</artifactId>
+ <version>2.1.7</version>
+ </dependency>-->
+
+ <dependency>
+ <groupId>com.github.purejavacomm</groupId>
+ <artifactId>purejavacomm</artifactId>
+ <version>1.0.2.RELEASE</version>
+ </dependency>
+
+ <!-- Logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>1.7.25</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-protocols-profinet</artifactId>
+ <version>0.7.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>plc4j-utils-test-utils</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sandbox/test-java-profinet-driver/src/main/java/org/apache/plc4x/java/profinet/dcp/DCPUtil.java b/sandbox/test-java-profinet-driver/src/main/java/org/apache/plc4x/java/profinet/dcp/DCPUtil.java
new file mode 100644
index 0000000..bf9bd7c
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/src/main/java/org/apache/plc4x/java/profinet/dcp/DCPUtil.java
@@ -0,0 +1,48 @@
+/*
+ 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.java.profinet.dcp;
+
+import org.apache.plc4x.java.profinet.dcp.readwrite.Text;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
+
+/**
+
+ */
+public class DCPUtil {
+
+ public static String readString(ReadBuffer io, Integer len) {
+ return readString(io, len, "UTF-8");
+ }
+
+ public static String readString(ReadBuffer io, Integer len, String encoding) {
+ return io.readString(len * 8, encoding);
+ }
+
+ public static void writeString(WriteBuffer io, Text value, String encoding) throws ParseException {
+ io.writeString(value.getLengthInBits(), encoding, value.getText());
+ }
+
+ public static int length(String text) {
+ return text.length();
+ }
+
+}
diff --git a/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPBlockTest.java b/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPBlockTest.java
new file mode 100644
index 0000000..0ec97f1
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPBlockTest.java
@@ -0,0 +1,33 @@
+/*
+ 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.java.profinet.dcp;
+
+import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
+
+/**
+ * Test for profinet dcp blocks.
+ */
+public class ProfinetDCPBlockTest extends ParserSerializerTestsuiteRunner {
+
+ public ProfinetDCPBlockTest() {
+ super("/testsuite/ProfinetDCPBlock.xml");
+ }
+
+}
diff --git a/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPFrameTest.java b/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPFrameTest.java
new file mode 100644
index 0000000..426501d
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/src/test/java/org/apache/plc4x/java/profinet/dcp/ProfinetDCPFrameTest.java
@@ -0,0 +1,33 @@
+/*
+ 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.java.profinet.dcp;
+
+import org.apache.plc4x.test.parserserializer.ParserSerializerTestsuiteRunner;
+
+/**
+ * Test for profinet dcp blocks.
+ */
+public class ProfinetDCPFrameTest extends ParserSerializerTestsuiteRunner {
+
+ public ProfinetDCPFrameTest() {
+ super("/testsuite/ProfinetDCPFrame.xml");
+ }
+
+}
diff --git a/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPBlock.xml b/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPBlock.xml
new file mode 100644
index 0000000..faf3f95
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPBlock.xml
@@ -0,0 +1,192 @@
+<?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/parser-serializer-testsuite.xsd" bigEndian="true">
+
+ <name>Profinet DCP Block</name>
+
+ <testcase>
+ <name>Profinet: AllSelector</name>
+ <raw>ff0000</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>ALL_SELECTOR</blockType>
+ </parser-arguments>
+ <xml>
+ <AllSelector className="org.apache.plc4x.java.profinet.dcp.readwrite.AllSelector"/>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Device Options</name>
+ <raw>05000400000207</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>DEVICE_OPTIONS</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceOptions">
+ <length>4</length>
+ <info>0</info>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_INSTANCE</subOption>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Station Type</name>
+ <raw>010009000053372d31323030</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>STATION_TYPE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.StationType">
+ <length>9</length>
+ <info>0</info>
+ <vendorNameForDevice className="org.apache.plc4x.java.profinet.dcp.readwrite.Text">
+ <text>S7-1200</text>
+ </vendorNameForDevice>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Station Name</name>
+ <raw>02000c0000706c6378623164306564</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>STATION_NAME</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.StationName">
+ <length>12</length>
+ <info>0</info>
+ <name className="org.apache.plc4x.java.profinet.dcp.readwrite.Text">
+ <text>plcxb1d0ed</text>
+ </name>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Device ID</name>
+ <raw>0300060000002a010d</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>DEVICE_ID</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceId">
+ <length>6</length>
+ <info>0</info>
+ <vendorId>42</vendorId>
+ <deviceId>269</deviceId>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Device Role</name>
+ <raw>04000400000200</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>DEVICE_ROLE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceRole">
+ <length>4</length>
+ <info>0</info>
+ <role>2</role>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: Device Instance</name>
+ <raw>07000400000064</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ </parser-arguments>
+ <xml>
+ <DeviceProperties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <subOption>DEVICE_INSTANCE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceInstance">
+ <length>4</length>
+ <info>0</info>
+ <instanceLow>0</instanceLow>
+ <instanceHigh>100</instanceHigh>
+ </properties>
+ </DeviceProperties>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: IP/IP</name>
+ <raw>02000e0001c0a802f1ffffff00c0a80201</raw>
+ <root-type>DCPBlock</root-type>
+ <parser-arguments>
+ <blockType>IP</blockType>
+ </parser-arguments>
+ <xml>
+ <IP className="org.apache.plc4x.java.profinet.dcp.readwrite.IP">
+ <subOption>IP_PARAMETER</subOption>
+ <length>14</length>
+ <info>1</info>
+ <ipAddress className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>192</octet1>
+ <octet2>168</octet2>
+ <octet3>2</octet3>
+ <octet4>241</octet4>
+ </ipAddress>
+ <subnetMask className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>255</octet1>
+ <octet2>255</octet2>
+ <octet3>255</octet3>
+ <octet4>0</octet4>
+ </subnetMask>
+ <standardGateway className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>192</octet1>
+ <octet2>168</octet2>
+ <octet3>2</octet3>
+ <octet4>1</octet4>
+ </standardGateway>
+ </IP>
+ </xml>
+ </testcase>
+
+
+</test:testsuite>
\ No newline at end of file
diff --git a/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPFrame.xml b/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPFrame.xml
new file mode 100644
index 0000000..44ba2d8
--- /dev/null
+++ b/sandbox/test-java-profinet-driver/src/test/resources/testsuite/ProfinetDCPFrame.xml
@@ -0,0 +1,154 @@
+<?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/parser-serializer-testsuite.xsd" bigEndian="true">
+
+ <name>Profinet DCP Frame</name>
+
+ <testcase>
+ <name>Profinet: DCP Identify Multicast</name>
+ <raw>fefe05000501000f00800004ffff0000000000000000000000000000000000000000000000000000000000000000</raw>
+ <root-type>ProfinetFrame</root-type>
+ <xml>
+ <ProfinetFrame className="org.apache.plc4x.java.profinet.dcp.readwrite.ProfinetFrame">
+ <frameType>IDENTIFY_MULTICAST_REQUEST</frameType>
+ <frame className="org.apache.plc4x.java.profinet.dcp.readwrite.DcpIdentRequestPDU">
+ <serviceId>IDENTIFY</serviceId>
+ <serviceType>REQUEST</serviceType>
+ <xid>83951631</xid>
+ <responseDelay>128</responseDelay>
+ <dcpDataLength>4</dcpDataLength>
+ <blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.AllSelector">
+ <blockType>ALL_SELECTOR</blockType>
+ </blocks>
+ </blocks>
+ </frame>
+ </ProfinetFrame>
+ </xml>
+ </testcase>
+
+ <testcase>
+ <name>Profinet: DCP Identify Response</name>
+ <raw>feff05010501000f00000052020500040000020702010009000053372d31323030000202000c0000706c6378623164306564020300060000002a010d020400040000020002070004000000640102000e0001c0a802f1ffffff00c0a80201</raw>
+ <root-type>ProfinetFrame</root-type>
+ <xml>
+ <ProfinetFrame className="org.apache.plc4x.java.profinet.dcp.readwrite.ProfinetFrame">
+ <frameType>IDENTIFY_RESPONSE</frameType>
+ <frame className="org.apache.plc4x.java.profinet.dcp.readwrite.DcpIdentResponsePDU">
+ <serviceId>IDENTIFY</serviceId>
+ <serviceType>RESPONSE_SUCCESS</serviceType>
+ <xid>83951631</xid>
+ <responseDelay>0</responseDelay>
+ <dcpDataLength>82</dcpDataLength>
+ <blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_OPTIONS</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceOptions">
+ <length>4</length>
+ <info>0</info>
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_INSTANCE</subOption>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>STATION_TYPE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.StationType">
+ <length>9</length>
+ <info>0</info>
+ <vendorNameForDevice className="org.apache.plc4x.java.profinet.dcp.readwrite.Text">
+ <text>S7-1200</text>
+ </vendorNameForDevice>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>STATION_NAME</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.StationName">
+ <length>12</length>
+ <info>0</info>
+ <name className="org.apache.plc4x.java.profinet.dcp.readwrite.Text">
+ <text>plcxb1d0ed</text>
+ </name>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_ID</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceId">
+ <length>6</length>
+ <info>0</info>
+ <vendorId>42</vendorId>
+ <deviceId>269</deviceId>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_ROLE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceRole">
+ <length>4</length>
+ <info>0</info>
+ <role>2</role>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceProperties">
+ <blockType>DEVICE_PROPERTIES</blockType>
+ <subOption>DEVICE_INSTANCE</subOption>
+ <properties className="org.apache.plc4x.java.profinet.dcp.readwrite.DeviceInstance">
+ <length>4</length>
+ <info>0</info>
+ <instanceLow>0</instanceLow>
+ <instanceHigh>100</instanceHigh>
+ </properties>
+ </blocks>
+ <blocks className="org.apache.plc4x.java.profinet.dcp.readwrite.IP">
+ <blockType>IP</blockType>
+ <subOption>IP_PARAMETER</subOption>
+ <length>14</length>
+ <info>1</info>
+ <ipAddress className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>192</octet1>
+ <octet2>168</octet2>
+ <octet3>2</octet3>
+ <octet4>241</octet4>
+ </ipAddress>
+ <subnetMask className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>255</octet1>
+ <octet2>255</octet2>
+ <octet3>255</octet3>
+ <octet4>0</octet4>
+ </subnetMask>
+ <standardGateway className="org.apache.plc4x.java.profinet.dcp.readwrite.IPv4Address">
+ <octet1>192</octet1>
+ <octet2>168</octet2>
+ <octet3>2</octet3>
+ <octet4>1</octet4>
+ </standardGateway>
+ </blocks>
+ </blocks>
+ </frame>
+ </ProfinetFrame>
+ </xml>
+ </testcase>
+
+
+
+</test:testsuite>
\ No newline at end of file