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/01/22 12:47:48 UTC

[incubator-plc4x] branch develop updated (572a7f4 -> 0d51987)

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/incubator-plc4x.git.


    from 572a7f4  - Introduced some "enum"-like construct for the message- and parameter-types.
     new 7e49754  - Fixed some problems in the cotp dfdl schema - Implemented a lot of COTP tests
     new 0d51987  - Disabled the timeout in order to find out if this was killing our jobs.

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:
 Jenkinsfile                                        |   4 +-
 .../apache/plc4x/protocols/cotp-protocol.dfdl.xsd  |   6 +-
 .../org/apache/plc4x/protocols/cotp-protocol.tdml  | 448 ++++++++++++++++++++-
 3 files changed, 453 insertions(+), 5 deletions(-)


[incubator-plc4x] 02/02: - Disabled the timeout in order to find out if this was killing our jobs.

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/incubator-plc4x.git

commit 0d51987c65d12757952b6a85767f201ba1c29370
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Jan 22 13:47:43 2019 +0100

    - Disabled the timeout in order to find out if this was killing our jobs.
---
 Jenkinsfile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 4ab36a9..c3b76ce 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -46,7 +46,9 @@ pipeline {
     }
 
     options {
-        timeout(time: 1, unit: 'HOURS')
+        // Kill this job after one hour.
+        // TODO: Disabled for finding out if this is what's randomly killing jobs ...
+        //timeout(time: 1, unit: 'HOURS')
         // When we have test-fails e.g. we don't need to run the remaining steps
         skipStagesAfterUnstable()
         buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '3'))


[incubator-plc4x] 01/02: - Fixed some problems in the cotp dfdl schema - Implemented a lot of COTP tests

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/incubator-plc4x.git

commit 7e49754ffd6f3e098d70de61cbeb735c4a499a30
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Jan 22 13:46:47 2019 +0100

    - Fixed some problems in the cotp dfdl schema
    - Implemented a lot of COTP tests
---
 .../apache/plc4x/protocols/cotp-protocol.dfdl.xsd  |   6 +-
 .../org/apache/plc4x/protocols/cotp-protocol.tdml  | 448 ++++++++++++++++++++-
 2 files changed, 450 insertions(+), 4 deletions(-)

diff --git a/protocols/src/main/dfdl/org/apache/plc4x/protocols/cotp-protocol.dfdl.xsd b/protocols/src/main/dfdl/org/apache/plc4x/protocols/cotp-protocol.dfdl.xsd
index 7227117..afe7a5e 100644
--- a/protocols/src/main/dfdl/org/apache/plc4x/protocols/cotp-protocol.dfdl.xsd
+++ b/protocols/src/main/dfdl/org/apache/plc4x/protocols/cotp-protocol.dfdl.xsd
@@ -207,8 +207,8 @@
                 <xs:element name="destinationReference" type="cotp:short"/>
                 <xs:element name="rejectCause" type="cotp:byte"/>
                 <xs:element ref="cotp:parameters" minOccurs="0"
-                            dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" dfdl:length="{../../headerLength - 3}"
-                            dfdl:occursCountKind="expression" dfdl:occursCount="{if(../../headerLength gt 3) then 1 else 0}"/>
+                            dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" dfdl:length="{../../headerLength - 4}"
+                            dfdl:occursCountKind="expression" dfdl:occursCount="{if(../../headerLength gt 4) then 1 else 0}"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
@@ -274,7 +274,7 @@
     <xs:element name="CotpParameterChecksum">
         <xs:complexType>
             <xs:sequence>
-                <xs:element name="tsapId" type="cotp:byte"/>
+                <xs:element name="checksum" type="cotp:byte"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
diff --git a/protocols/src/test/resources/org/apache/plc4x/protocols/cotp-protocol.tdml b/protocols/src/test/resources/org/apache/plc4x/protocols/cotp-protocol.tdml
index 486bcb6..9da61c8 100644
--- a/protocols/src/test/resources/org/apache/plc4x/protocols/cotp-protocol.tdml
+++ b/protocols/src/test/resources/org/apache/plc4x/protocols/cotp-protocol.tdml
@@ -39,7 +39,427 @@
         <xs:element name="cotpMessage" type="cotp:CotpMessageType"/>
     </tdml:defineSchema>
 
-    <tdml:parserTestCase name="minimalCotpMessage"
+    <!--
+
+        Tests for the basic TPDU types (no parameters)
+
+    -->
+
+    <tdml:parserTestCase name="typeConnectionRequest"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Connection Request TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">06E00001000200</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>6</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeConnectionResponse"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Connection Response TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">06D00001000200</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>6</headerLength>
+                    <type>208</type>
+                    <CotpTpduConnectionResponse>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                    </CotpTpduConnectionResponse>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeDisconnectionRequest"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Disconnection Request TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">06800001000200</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>6</headerLength>
+                    <type>128</type>
+                    <CotpTpduDisconnectRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <disconnectReason>0</disconnectReason>
+                    </CotpTpduDisconnectRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeDisconnectionResponse"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Disconnection Response TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">05C000010002</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>5</headerLength>
+                    <type>192</type>
+                    <CotpTpduDisconnectResponse>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                    </CotpTpduDisconnectResponse>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeError"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Error TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">0470000102</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>4</headerLength>
+                    <type>112</type>
+                    <CotpTpduError>
+                        <destinationReference>1</destinationReference>
+                        <rejectCause>2</rejectCause>
+                    </CotpTpduError>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeData"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Data TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">02F002</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>2</headerLength>
+                    <type>240</type>
+                    <CotpTpduData>
+                        <endOfTransmission>0</endOfTransmission>
+                        <tpduRef>2</tpduRef>
+                    </CotpTpduData>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="typeDataEndOfTransmission"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Minimal valid COTP Data (End Of Transmission) TPDU">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">02F082</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>2</headerLength>
+                    <type>240</type>
+                    <CotpTpduData>
+                        <endOfTransmission>1</endOfTransmission>
+                        <tpduRef>2</tpduRef>
+                    </CotpTpduData>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <!--
+
+        Tests for the parameter types.
+
+    -->
+
+    <tdml:parserTestCase name="parameterTpduSize"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="parameterTpduSize">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">09E00001000200C00109</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>9</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>192</type>
+                                <parameterLength>1</parameterLength>
+                                <CotpParameterTpduSize>
+                                    <tpduSize>9</tpduSize>
+                                </CotpParameterTpduSize>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="parameterCallingTsap"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="parameterCallingTsap">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">0AE00001000200C1020009</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>10</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>193</type>
+                                <parameterLength>2</parameterLength>
+                                <CotpParameterCallingTsap>
+                                    <tsapId>9</tsapId>
+                                </CotpParameterCallingTsap>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="parameterCalledTsap"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="parameterCalledTsap">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">0AE00001000200C2020009</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>10</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>194</type>
+                                <parameterLength>2</parameterLength>
+                                <CotpParameterCalledTsap>
+                                    <tsapId>9</tsapId>
+                                </CotpParameterCalledTsap>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="parameterChecksum"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="parameterChecksum">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">09E00001000200C30109</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>9</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>195</type>
+                                <parameterLength>1</parameterLength>
+                                <CotpParameterChecksum>
+                                    <checksum>9</checksum>
+                                </CotpParameterChecksum>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="parameterDisconnectAdditionalInformation"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="parameterDisconnectAdditionalInformation">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">0EE00001000200E006010203040506</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>14</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>224</type>
+                                <parameterLength>6</parameterLength>
+                                <CotpParameterDisconnectAdditionalInformation>
+                                    <data>010203040506</data>
+                                </CotpParameterDisconnectAdditionalInformation>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <!--
+
+        Tests for typical packets used in PLC4X
+
+    -->
+
+    <tdml:parserTestCase name="scenarioConnectionRequest"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="COTP Connection request used for initiating an S7 protocol connection.">
+        <!-- Define the input -->
+        <tdml:document>
+            <tdml:documentPart type="byte">11E00001000200C1020100C2020102c0010a</tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>17</headerLength>
+                    <type>224</type>
+                    <CotpTpduConnectionRequest>
+                        <destinationReference>1</destinationReference>
+                        <sourceReference>2</sourceReference>
+                        <protocolClass>0</protocolClass>
+                        <parameters>
+                            <parameter>
+                                <type>193</type>
+                                <parameterLength>2</parameterLength>
+                                <CotpParameterCallingTsap>
+                                    <tsapId>256</tsapId>
+                                </CotpParameterCallingTsap>
+                            </parameter>
+                            <parameter>
+                                <type>194</type>
+                                <parameterLength>2</parameterLength>
+                                <CotpParameterCalledTsap>
+                                    <tsapId>258</tsapId>
+                                </CotpParameterCalledTsap>
+                            </parameter>
+                            <parameter>
+                                <type>192</type>
+                                <parameterLength>1</parameterLength>
+                                <CotpParameterTpduSize>
+                                    <tpduSize>10</tpduSize>
+                                </CotpParameterTpduSize>
+                            </parameter>
+                        </parameters>
+                    </CotpTpduConnectionRequest>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
+    <tdml:parserTestCase name="scenarioConnectionResponse"
                          root="cotpMessage"
                          model="cotpSchema"
                          description="Minimal valid COTP Message">
@@ -88,6 +508,32 @@
         </tdml:infoset>
     </tdml:parserTestCase>
 
+    <tdml:parserTestCase name="scenarioDataTpdu"
+                         root="cotpMessage"
+                         model="cotpSchema"
+                         description="Typical Data TPDU used for transferring S7 packets.">
+        <!-- Define the input -->
+        <tdml:document>
+            <!-- TODO: Comment in the S7 payload as soon as the schema is fixed -->
+            <tdml:documentPart type="byte">02F080<!--320700000300000800080001120411440100ff09000401320004--></tdml:documentPart>
+        </tdml:document>
+
+        <!-- Define the expected output -->
+        <tdml:infoset>
+            <tdml:dfdlInfoset>
+                <test:cotpMessage>
+                    <headerLength>2</headerLength>
+                    <type>240</type>
+                    <CotpTpduData>
+                        <endOfTransmission>1</endOfTransmission>
+                        <tpduRef>0</tpduRef>
+                    </CotpTpduData>
+                    <userData/>
+                </test:cotpMessage>
+            </tdml:dfdlInfoset>
+        </tdml:infoset>
+    </tdml:parserTestCase>
+
 </testSuite>