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 2022/08/01 07:44:09 UTC

[plc4x] branch develop updated (0b69b86bd -> 9e877da9b)

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 0b69b86bd chore(ads): Worked on continuing to implement the discovery and route-management parts.
     new 1253f3725 chore(plc4j): Undid the code-"improvement" IntelliJ suggested ;-)
     new 9e877da9b chore(ads): Finished the auto-discovery feature for ADS (At least the protocol-side)

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:
 .../migration/MessageValidatorAndMigrator.java     |   3 +-
 .../resources/protocols/ads/ads-discovery.mspec    |   2 +-
 .../protocols/ads/AdsDiscoverySerializerTest.xml   | 103 +++++++++++++++++++++
 3 files changed, 106 insertions(+), 2 deletions(-)


[plc4x] 01/02: chore(plc4j): Undid the code-"improvement" IntelliJ suggested ;-)

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 1253f37257ad0ee3700b54b76f753682b1a1e0ab
Author: christoferdutz <ch...@c-ware.de>
AuthorDate: Mon Aug 1 09:43:19 2022 +0200

    chore(plc4j): Undid the code-"improvement" IntelliJ suggested ;-)
---
 .../org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java
index 53a1a784b..963fdb535 100644
--- a/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java
+++ b/plc4j/utils/test-utils/src/main/java/org/apache/plc4x/test/migration/MessageValidatorAndMigrator.java
@@ -140,7 +140,8 @@ public class MessageValidatorAndMigrator {
 
                     String content;
                     try {
-                        content = Files.readString(path, charset);
+                        // REMARK: In know IntelliJ tells us this is "optimizable", don't do it as it will break the build.
+                        content = new String(Files.readAllBytes(path), charset);
                         // Make sure this also works on Windows
                         // (Mainly when using git to check out Windows style and commit in Unix style)
                         content = content.replaceAll("\r\n", "\n");


[plc4x] 02/02: chore(ads): Finished the auto-discovery feature for ADS (At least the protocol-side)

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 9e877da9bc745e4996ee4960f58bcbc06e3b5d5a
Author: christoferdutz <ch...@c-ware.de>
AuthorDate: Mon Aug 1 09:44:01 2022 +0200

    chore(ads): Finished the auto-discovery feature for ADS (At least the protocol-side)
---
 .../resources/protocols/ads/ads-discovery.mspec    |   2 +-
 .../protocols/ads/AdsDiscoverySerializerTest.xml   | 103 +++++++++++++++++++++
 2 files changed, 104 insertions(+), 1 deletion(-)

diff --git a/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec b/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
index da21e16ed..ef362e375 100644
--- a/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
+++ b/protocols/ads/src/main/resources/protocols/ads/ads-discovery.mspec
@@ -18,7 +18,7 @@
  */
 
 [type AdsDiscoveryConstants
-    [const          uint 16     adsDiscoveryUdpDefaultPort 58899]
+    [const          uint 16     adsDiscoveryUdpDefaultPort 48899]
 ]
 
 ////////////////////////////////////////////////////////////////
diff --git a/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml b/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml
index 36c0ae666..a12f2c3f2 100644
--- a/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml
+++ b/protocols/ads/src/test/resources/protocols/ads/AdsDiscoverySerializerTest.xml
@@ -128,6 +128,109 @@
     </xml>
   </testcase>
 
+  <testcase>
+    <name>ADS Discovery Request from 192.168.23.209.1.1</name>
+    <raw>036614710000000001000000c0a817d10101102700000000</raw>
+    <root-type>AdsDiscovery</root-type>
+    <xml>
+      <AdsDiscovery>
+        <header dataType="uint" bitLength="32">1897162243</header>
+        <requestId dataType="uint" bitLength="32">0</requestId>
+        <operation>
+          <Operation dataType="uint" bitLength="32" stringRepresentation="DISCOVERY_REQUEST">1</Operation>
+        </operation>
+        <amsNetId>
+          <AmsNetId>
+            <octet1 dataType="uint" bitLength="8">192</octet1>
+            <octet2 dataType="uint" bitLength="8">168</octet2>
+            <octet3 dataType="uint" bitLength="8">23</octet3>
+            <octet4 dataType="uint" bitLength="8">209</octet4>
+            <octet5 dataType="uint" bitLength="8">1</octet5>
+            <octet6 dataType="uint" bitLength="8">1</octet6>
+          </AmsNetId>
+        </amsNetId>
+        <portNumber>
+          <AdsPortNumbers dataType="uint" bitLength="16" stringRepresentation="SYSTEM_SERVICE">10000</AdsPortNumbers>
+        </portNumber>
+        <numBlocks dataType="uint" bitLength="32">0</numBlocks>
+        <blocks isList="true">
+        </blocks>
+      </AdsDiscovery>
+    </xml>
+  </testcase>
+
+  <testcase>
+    <name>ADS Discovery Response from 192.168.23.20.1.1</name>
+    <raw>036614710000000001000080c0a81714010110270400000005000700424b5f4950430004001401140100000600000001000000b11d000002000000530065007200760069006300650020005000610063006b0020003100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 [...]
+    <root-type>AdsDiscovery</root-type>
+    <xml>
+      <AdsDiscovery>
+        <header dataType="uint" bitLength="32">1897162243</header>
+        <requestId dataType="uint" bitLength="32">0</requestId>
+        <operation>
+          <Operation dataType="uint" bitLength="32" stringRepresentation="DISCOVERY_RESPONSE">2147483649</Operation>
+        </operation>
+        <amsNetId>
+          <AmsNetId>
+            <octet1 dataType="uint" bitLength="8">192</octet1>
+            <octet2 dataType="uint" bitLength="8">168</octet2>
+            <octet3 dataType="uint" bitLength="8">23</octet3>
+            <octet4 dataType="uint" bitLength="8">20</octet4>
+            <octet5 dataType="uint" bitLength="8">1</octet5>
+            <octet6 dataType="uint" bitLength="8">1</octet6>
+          </AmsNetId>
+        </amsNetId>
+        <portNumber>
+          <AdsPortNumbers dataType="uint" bitLength="16" stringRepresentation="SYSTEM_SERVICE">10000</AdsPortNumbers>
+        </portNumber>
+        <numBlocks dataType="uint" bitLength="32">4</numBlocks>
+        <blocks isList="true">
+          <AdsDiscoveryBlock>
+            <blockType>
+              <AdsDiscoveryBlockType dataType="uint" bitLength="16" stringRepresentation="HOST_NAME">5</AdsDiscoveryBlockType>
+            </blockType>
+            <AdsDiscoveryBlockHostName>
+              <hostName>
+                <AmsString>
+                  <len dataType="uint" bitLength="16">7</len>
+                  <text dataType="string" bitLength="48" encoding="UTF-8">BK_IPC</text>
+                  <reserved dataType="uint" bitLength="8">0</reserved>
+                </AmsString>
+              </hostName>
+            </AdsDiscoveryBlockHostName>
+          </AdsDiscoveryBlock>
+          <AdsDiscoveryBlock>
+            <blockType>
+              <AdsDiscoveryBlockType dataType="uint" bitLength="16" stringRepresentation="OS_DATA">4</AdsDiscoveryBlockType>
+            </blockType>
+            <AdsDiscoveryBlockOsData>
+              <osDataLen dataType="uint" bitLength="16">276</osDataLen>
+              <osData dataType="byte" bitLength="2208">0x140100000600000001000000b11d000002000000530065007200760069006300650020005000610063006b0020003100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 [...]
+            </AdsDiscoveryBlockOsData>
+          </AdsDiscoveryBlock>
+          <AdsDiscoveryBlock>
+            <blockType>
+              <AdsDiscoveryBlockType dataType="uint" bitLength="16" stringRepresentation="VERSION">3</AdsDiscoveryBlockType>
+            </blockType>
+            <AdsDiscoveryBlockVersion>
+              <versionDataLen dataType="uint" bitLength="16">4</versionDataLen>
+              <versionData dataType="byte" bitLength="32">0x0301b80f</versionData>
+            </AdsDiscoveryBlockVersion>
+          </AdsDiscoveryBlock>
+          <AdsDiscoveryBlock>
+            <blockType>
+              <AdsDiscoveryBlockType dataType="uint" bitLength="16" stringRepresentation="FINGERPRINT">18</AdsDiscoveryBlockType>
+            </blockType>
+            <AdsDiscoveryBlockFingerprint>
+              <dataLen dataType="uint" bitLength="16">65</dataLen>
+              <data dataType="byte" bitLength="520">0x3365383565393165353864346663613166643663636133323332336338613561326665306334323132343532343833303662373638353034323665353532623100</data>
+            </AdsDiscoveryBlockFingerprint>
+          </AdsDiscoveryBlock>
+        </blocks>
+      </AdsDiscovery>
+    </xml>
+  </testcase>
+
   <testcase>
     <name>ADS Add Route Request from 10.10.10.10.1.1 via 10.10.10.10 with user='username' and pwd='password'</name>
     <raw>0366147100000000060000000a0a0a0a01011027050000000c000c0031302e31302e31302e313000070006000a0a0a0a01010d000900757365726e616d65000200090070617373776f72640005000c0031302e31302e31302e313000</raw>