Commit Graph
1395 Commits
Author SHA1 Message Date
Zigby cbe886dcb0 Enable client support for multiple sessions on a single channel (#1659)
* Client API changes to support multiple sessions on a single channel
* Tested against freeopcua:python:server and ProSys simulation server
2022-04-01 14:27:32 +02:00
Martin Regen 0085597be2 Bump version to 369 (#1767)
Prep master for next milestone
2022-04-01 13:28:05 +02:00
Martin Regen eda38cb6c2 XmlSerializer in .NET 6 Omits Line Breaks by Default (#1760)
* fix xml output in .NET 6
* unify the way xml writer settings are generated and used, add validation tests
1.4.368.52-preview
2022-03-31 20:13:49 +02:00
Martin Regen cc09a561d1 Update Nuget license information (#1764)
The OPC Foundation Technical Control Board on March 30th decided on the following changes with regard to the license information in the published Nuget packages:

•	Replace the “Redistributables” license for OPC UA Nuget packages with the Dual License.
•	Change the dual license in the source files so that “members” are replaced with “corporate members”. (see #1763)

Effectively, 
- Nuget packages from libraries provided as samples which only build from source code which is covered by a MIT license, are the directly tagged with the MIT license.
- Nuget packages which build from source code where the headers imply the dual license applies, are tagged with the Dual License  'LICENSE.txt' found in the repository root.
2022-03-31 15:42:51 +02:00
Martin RegenandSuciu Mircea Adrian 3a378e8644 Fix dual license headers (#1763)
Headers incorrectly state that the RCL applies to members, however the OPC Source Deliverables license states RCL is applicable only to corporate members. 

The OPC Foundation Technical Control Board on March 30th decided on the following changes with regard of the license headers:

• Change the dual license in the source files so that “members” are replaced with “corporate members”. 

Co-authored-by: Suciu Mircea Adrian <Mircea-Adrian.Suciu@softing.com>
2022-03-31 13:14:17 +02:00
Martin Regen 8ddda78aff Fix for Usertokenpolicy Anonymous, security policy default should be None (#1756)
- Only an issue if the configuration does not specify the security policy uri for anonymous token
- If the config does not specify the security policy, for anonymous user token the security profile Basic256Sha256 was chosen. 
- This setting requires for the client to trust the server certificate if it tries to connect with security None, may cause IOP issues when no security is chosen and encryption is required for the anonymous user token.
2022-03-30 09:20:13 +02:00
Martin Regen 8d0eb40206 Update README.md and templates (#1749)
- fix a few badges
- add new template for issues and PR
2022-03-29 14:23:55 +02:00
Tim Jöhnk 6f9f70cd4b Expose actual network client connected states in IUaPubSubConnections (#1725)
* Expose actual network client connected states in IUaPubSubConnections
2022-03-29 12:20:17 +03:00
Martin Regen 1263881a7f Adapt logging abstractions version to target framework (#1751)
* fix the nuget versions

* revert targetframework

* avoid build warning
2022-03-28 14:01:42 +03:00
dependabot[bot] 0c707a4294 Bump NUnit from 3.13.2 to 3.13.3 (#1741)
Bumps [NUnit](https://github.com/nunit/nunit) from 3.13.2 to 3.13.3.
- [Release notes](https://github.com/nunit/nunit/releases)
- [Changelog](https://github.com/nunit/nunit/blob/v3.13.3/CHANGES.md)
- [Commits](https://github.com/nunit/nunit/compare/v3.13.2...v3.13.3)

---
updated-dependencies:
- dependency-name: NUnit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-28 08:30:15 +02:00
KUNYUAN XIAO 0a838e0319 Fix session recreate TransferSubscriptions bug. (#1746)
* Fixed session recreate TransferSubscriptions bug.

1. When session is recreated and there is no subscription is needed to transfer, it will throw Exception - BadNothingToDo. After adding check the subscriptions count, it won't try to subscribe non-existing subscriptions.

2. When session is recreated and there are subscriptions are needed to transer, it transferred wrong subscriptions. It should transfer old subscriptions in old session, but current code transfer new subscriptions in new session to new session - which will always throw Exception - "A subscription can not be transferred due to missing transfer Id"

* Log update and TransferSubscriptions update.

fixes #1733 and #1734
2022-03-28 08:29:38 +02:00
Suciu Mircea Adrian 244234cdf0 Changes for testing and fixing git bug #1694 (#1747)
* Changes for testing and fixing git bug 1694

* Removed the duplicate server address differing by port number
2022-03-25 10:32:48 +02:00
Martin Regen 24931cfea0 fix SByte vs Byte collection (#1740) 2022-03-22 08:29:31 +02:00
Martin Regen 5c8cea2990 Offload .NET 6 tests and code coverage to github actions (#1730)
* add buildandtest.yml with test and coverage build
2022-03-18 15:36:40 +01:00
Suciu Mircea Adrian 32752e3c33 Merge pull request #1731 from AlinMoldovean/diagnostics/CurrentSubscriptionCount_fix
Fix for ServerDiagnostics.CurrentSubscriptionCount decrement at CloseSession
2022-03-16 15:50:44 +02:00
Alin Moldovean 41346dab50 fix CurrentSubscriptionCount at CloseSession() with active subscriptions 2022-03-15 15:29:57 +02:00
Martin Regen cfc68eeb10 Use .NET analyzers instead of Roslynator, fix warnings, no bug fixes (#1729)
-use latests analyzers in .NET instead of Roslynator.
-fix warnings and formatting, no bug fixes!
2022-03-14 16:39:09 +01:00
Suciu Mircea Adrian f39c11d593 Merge pull request #1727 from OPCFoundation/dependabot/nuget/Moq-4.17.2
Bump Moq from 4.16.1 to 4.17.2
2022-03-10 10:56:48 +02:00
dependabot[bot] 2a74b44627 Bump Microsoft.Extensions.Logging.Abstractions from 6.0.0 to 6.0.1 (#1728)
Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: Microsoft.Extensions.Logging.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-09 19:40:18 +01:00
dependabot[bot] edd0513779 Bump Moq from 4.16.1 to 4.17.2
Bumps [Moq](https://github.com/moq/moq4) from 4.16.1 to 4.17.2.
- [Release notes](https://github.com/moq/moq4/releases)
- [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md)
- [Commits](https://github.com/moq/moq4/compare/v4.16.1...v4.17.2)

---
updated-dependencies:
- dependency-name: Moq
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 10:02:01 +00:00
Suciu Mircea Adrian 3558dd5ac9 Fixed missing TimeFlowsBackward checks and invalid status code on HistoryRead (#1720)
Fixed missing TimeFlowsBackward checks and invalid status code on HistoryRead
2022-02-28 08:38:09 +01:00
dependabot[bot] 7a3c379114 Bump Serilog.Expressions from 3.2.1 to 3.3.0 (#1714)
Bumps [Serilog.Expressions](https://github.com/serilog/serilog-expressions) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/serilog/serilog-expressions/releases)
- [Commits](https://github.com/serilog/serilog-expressions/commits/v3.3.0)

---
updated-dependencies:
- dependency-name: Serilog.Expressions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-24 15:52:40 +01:00
ThomasNehring 3dc1d4beba Update BuiltInTests.cs with special case compare Null NodeId (#1609)
A  new unit test which will currently fail, due to incorrect treatment of node ids with numeric identifier 0 in the namespace with index 0. ( "NodeId nodeId = new NodeId (0,0)." ).

Of course such a node id is invalid. It seems to be present, however, in some PLCs under certain situations. We encountered such node ids in the context of a customer ticket. The node ids were read into instance of type "DataValue" using the read service call. The evaluation of the read result then failed due to comparisons like the ones in the unit test.

fixes #1610
2022-02-18 16:53:50 +01:00
dependabot[bot] 6223685ae1 Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.1.0 (#1712)
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.0.0 to 17.1.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Commits](https://github.com/microsoft/vstest/compare/v17.0.0...v17.1.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-18 08:32:15 +01:00
Martin Regen efd04655a6 Bug fix for server registration issue (#1713)
-always use a clone of the configuration and replace cert validator when registration is active.
-fixes #1711
2022-02-18 08:30:40 +01:00
Martin Regen a991505a9a Decorate new Transfer methods with OnMonitoredItemsTransferred (#1710)
-Unify the implementation with the other monitored items methods in sample node managers
-fix typos/warnings
2022-02-16 09:33:53 +01:00
Martin Regen fd453f53e8 Add release tags to containers (#1706)
add a release tag, 1.x, 1.x.x tags when in a release build
2022-02-16 09:33:11 +01:00
dependabot[bot] 8cbe6143a9 Bump NUnit.Console from 3.14.0 to 3.15.0 (#1707)
Bumps [NUnit.Console](https://github.com/nunit/nunit-console) from 3.14.0 to 3.15.0.
- [Release notes](https://github.com/nunit/nunit-console/releases)
- [Changelog](https://github.com/nunit/nunit-console/blob/main/CHANGES.txt)
- [Commits](https://github.com/nunit/nunit-console/compare/3.14.0...3.15.0)

---
updated-dependencies:
- dependency-name: NUnit.Console
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-15 20:26:22 +01:00
Martin Regen 7d9be41cf5 Doc updates and fixes for .368 preview, ref server improvements (#1695)
- Doc, docs, docs updates for new 368 support
- fix a missing null pointer check when ConditionRefresh is run
- Ref server: move NodeManager factory API to StandardServer, decoupling the NodeManager implementation from Ref server
- Ref server: add shadow mode flag, to allow to map a docker configuration in a mapped folder.
- Ref server: sample batch files how to run Github CR and local docker images
- Improve some misleading 'delete application certificate' log messages.
1.4.368.27-preview
2022-02-11 09:19:40 +01:00
dependabot[bot]andMartin Regen a7b561158b Bump System.Io.Pipelines from 6.0.1 to 6.0.2 (#1703)
* Bump System.Io.Pipelines from 6.0.1 to 6.0.2
* Fix the fast PR build

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Regen <mregen@microsoft.com>
2022-02-10 19:01:41 +01:00
dependabot[bot]andMartin Regen 5b3adf7323 Bump coverlet.collector from 3.1.0 to 3.1.2, add fast path for local PR (#1701)
* Bump coverlet.collector from 3.1.0 to 3.1.2
* Add fast path for PR in this repo. Forks still use the long path.

Co-authored-by: Martin Regen <mregen@microsoft.com>
2022-02-08 13:29:11 +01:00
Martin Regen 5d9234eebe Handle subscription transfer special cases + tests (#1700)
- Fixed issue: After transfer, available sequence numbers were not properly ack/republished.
- Fixed issue: After transfer, race condition could delete subscription before transfer finished.
- Fixed issue: After reload of a subscription, duplicate client handles may have been used.
- Add tests which emulate the disconnection of a client/server, then transfers
- Add subscription variable to select if missing publish requests are just acknoledged (default) or republished after transfer completes. Set `Subscription.RepublishAfterTransfer` to `true`.
- Improve test framework to allow for testing against external servers using a .runsettings file
- improve publish request logging, by moving calls into `CoreClientUtils.EventLog`
- disable available sequence numbers check, it causes false negatives when many subscriptions are active
2022-02-07 17:37:01 +01:00
Martin Regenandmrsuciu 8c1a659ecf Reference Server updates running CTT (#1689)
- Provide the CTT configuration used for 1.4.9.398: Added tests with arrays except Variant
- Match the Reference server config for CTT run (Console Server was used, others tbd)
- add a few cases in ref server node manager to enable skipped tests
- preset random generators to create deterministic node data 
CTT fixes:
- Trigger: fix a regression introduced with the TransferSubscription support, Trigger stopped working, revert change to remove LinkedList in MonitoredItems
- return BadDataEncodingUnsupported creating MonitoredItems
- ensure that MonitoredItem node data reported as required by CTT after initial reading, transfer and SetMonitoring

note: not yet 100% passy, a few uncritical failing tests are still under investigation

Co-authored-by: mrsuciu <Mircea-Adrian.Suciu@softing.com>
2022-01-31 13:32:58 +01:00
Suciu Mircea Adrian 5025648cbc GetEndpoints: Eliminate duplicate endpoints when Configured base addresses differ by port only (#1687)
- use case: specify the same endpoint protocol with two ports. The returned array  contains too many entries, because now the policyId in the UserTokenpolicies was fixed and no more duplicates were detected.
2022-01-29 14:47:05 +01:00
430ff70de7 Implement Transfersubscription service (#1649)
- Implement client and server side of Transfersubscription service calls.
- New Transcription service has been tested with CTT 1.04.9.398
- Unit tests for native service calls and client SDK
- Client implements multiple ways to transfer sessions:
  - Client saves subscriptions to xml stream, restarts, loads subscriptions from stream and transfers on server.
  - Client creates a new sessions and transfers into new session, while the old session is still active.
  - Client closes old session with `DeleteSubscriptionsOnClose = false`, creates new session and transfers subscriptions to new session.
  - `SessionReconnectHandler` tries to transfer subscription before recreating the subscriptions.
- breaking change: INodeManager got a new TransferMonitoredItems method

Co-authored-by: Alexander Koepke <alexander.koepke@microsoft.com>
Co-authored-by: Peter Bryntesson <pbrynt@microsoft.com>
2022-01-28 13:21:20 +01:00
Martin Regen 079148f3ab ctt fixes (#1685)
* remove the SetDurableSubscription method, to skip the test cases
* DeleteSubscription returns BadSubscriptionIdInvalid
* MethodState return also BadTooManyArguments
* return AttributeIdInvalid for null attributes (fix UA Expert display)
* fix ToString of Variant array of ByteString
* fix Variant decoding 1-dim array of bytestring
2022-01-27 09:46:32 +02:00
dependabot[bot] 8d3e393fd9 Bump NUnit3TestAdapter from 4.2.0 to 4.2.1 (#1681)
Bumps [NUnit3TestAdapter](https://github.com/nunit/nunit3-vs-adapter) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/nunit/nunit3-vs-adapter/releases)
- [Commits](https://github.com/nunit/nunit3-vs-adapter/compare/V4.2.0...V4.2.1)

---
updated-dependencies:
- dependency-name: NUnit3TestAdapter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-25 07:48:11 +01:00
Archie Miller 5d33c16188 Implement a common method for creating branches (#1603)
Implement a mechanism to create Alarm Branches, store them, allow AddComment, Acknowledge, and Confirm them.

Updates the Retain flag automatically.
Cleans up branches on Ack/Confirm

Allows servers to retrieve branches to clear them all if necessary.
2022-01-25 07:46:21 +01:00
5cbffcfe77 Support async ICertificateStore CRL interface methods (#1666)
- integrate 'LoadPrivateKey' in the interface to allow to implement cert stores which require a passcode to load/store certificates
Change of behavior:
- Introduce a 'NoPrivateKeys' flag to reduce the risk of leaking a private key to a unsecure store.
  - CertificateStoreIdentifier opens 'NoPrivateKey' stores
  - CertificateTrustList opens 'NoPrivateKey' stores
  - CertificateIdentifier opens store with private keys for application or GDS authority certificates
- CertificateTrustList reuses a store if it is not disposed. A user can just close the store to keep the list of certificates in memory.
- DirectoryStore `Load` does not read private keys anymore, only file names for delete. Reading all private keys caused false errors, e.g. here: #1670 

Co-authored-by: mheege-abb <marcus.heege@de.abb.com>
Co-authored-by: mheege-abb <85437567+mheege-abb@users.noreply.github.com>
2022-01-25 07:16:28 +01:00
Martin Regen 3fe949559d Retry to load private key of a new certificate on import error. (#1676)
- In windows container this non deterministic error can occur:
`[WindowsCryptographicException] The specified network password is not correct.`
even if the private key was saved with empty password.
- Fix: After a delayed retry the private key can be loaded successfully.
- fixes #1670 
- see also https://github.com/OPCFoundation/UA-.NETStandard/commit/ae9ecac2be6b2f9ed6c639eb60205896c27791e0 for 367 milestone
2022-01-24 17:05:34 +01:00
Martin Regen 2c9699bc5e Fix the AuthorityKeyIdentifier Issuer for Bouncy Castle CertificateBuilder. (#1677)
- The missing fix in https://github.com/OPCFoundation/UA-.NETStandard/commit/6747b471920ce165b59411d37c227e08d49dd047 for the bouncy castle certificate builder which was used in .NET Core 2.1 (eol) and .NET 4.6.2, unnoticed in the tests because windows only uses the keyId to validate the chain.
- AuthorityKeyIdentifier in the SubCA contains the SubjectName of the Issuer instead of the IssuerName. Also an application certificate that is signed by a SubCA would contain the false information.
- The false information has no effect on Windows and macOS, however on linux OpenSSL tests all fields and a chain cannot be fully validated.
2022-01-24 17:04:28 +01:00
Suciu Mircea Adrian 33ae73654c Improve initalization of BaseVariableState (#1672) 2022-01-20 06:50:48 +02:00
Suciu Mircea Adrian 213f37e28b Set the default value of the StatusCode on BaseVariableState to BadWaitingForInitialData. (#1668)
* Removed assigning a default value to any variable value in the AddReverseReferences method.
Set the default value of the StatusCode on BaseVariableState to BadWaitingForInitialData.

* Allow initalization from variable states with status code BadWaitingForInitialData
2022-01-19 09:25:27 +02:00
dependabot[bot] 33fab0d1d7 Bump NUnit.Console from 3.13.1 to 3.14.0 (#1667)
Bumps [NUnit.Console](https://github.com/nunit/nunit-console) from 3.13.1 to 3.14.0.
- [Release notes](https://github.com/nunit/nunit-console/releases)
- [Changelog](https://github.com/nunit/nunit-console/blob/master/CHANGES.txt)
- [Commits](https://github.com/nunit/nunit-console/compare/3.13.1...3.14.0)

---
updated-dependencies:
- dependency-name: NUnit.Console
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-17 15:15:16 +01:00
mheege-abb 61e204f1d9 Add support for custom certificate stores (#1420)
The current SDK supports only Windows and Directory certificate stores. For security reasons, it can be necessary to use custom certificate stores. 
* Add support for custom certificate stores
* Certificate Store Type UnitTests
* Start cleanup of ICertificateStore interface in the CRL section (Co-authored-by: Martin Regen <mregen@microsoft.com>)
2022-01-17 15:13:59 +01:00
ThomasNehring dd6f4a4c8d Updates for getIssuer(s) in the Certificate Validator class (#1632)
- Adapted getIssuer and getIssuers so that all findings get aggregated for later processing in the validation methods.
- Ensured that other methods calling getIssuer(s) will experience unchanged behavior
- Adapted unit tests
2022-01-14 16:11:31 +01:00
Martin Regen 6747b47192 Fix Authority Key Identifier in SubCA and cert validator return codes. (#1665)
- AuthorityKeyIdentifier in the SubCA contains the SubjectName of the Issuer instead of the IssuerName. Also an application certificate that is signed by a SubCA would contain the false information.
- The false information has no effect on Windows and macOS, however on linux OpenSSL tests all fields and a chain cannot be fully validated.
- For CTT tests a few error codes were return false codes because ServiceResult replaces the error code with the InnerException error.
- Do not allow to ignore PartialChain validation error, it may have different root cause then the error returned by GetIssuer.
2022-01-14 11:17:03 +01:00
Suciu Mircea Adrian 15f1fcb57f The UserToken PolicyId is made unique per server instance. (#1663)
* The UserToken PolicyId is made unique per server instance as in the specification.
2022-01-14 11:37:12 +02:00
Martin Regen fa6099b7ee Support semantic logging (#1648)
- For EventSource and legacy logger refactor logging to support the built in LogValueFormatter, which provides the format strings suitable for `string.Format`.
- **Breaking change**: For `TraceEvent` this is a breaking change, because there is no implementation yet to support to provide the reformatted format string. With this implementation if a logging framework is used which supports the semantic logging, there is no issue. With frameworks which do not understand semantic logging strings(e.g. log4net) it is a breaking change, string.format will throw exceptions --> move to ILogger hook using `SetLogger`. 
- **Warning**: When Microsoft.Extensions.Logger based loggers are used, format strings must follow this convention:
i) All variable entries must follow order and count up, e.g. "{0} -- {1}" etc., no mix of "{2}--{0}"
ii) in the same way the args must follow this strict ordering. 
- Format strings will be changed by future PR to include the semantic values.
2022-01-12 14:51:22 +01:00
Hermo Terblanche b41fb36020 Added support for recursive complex data type (#1656)
The Opc.Ua.Client.ComplexTypes package does not support recursive structs, i.e. a struct with a field that has the same data type as the struct.
An example of a recursive struct data type may look as follows:

PersonStructDataType
-  Name <String>
-  Age <Int32>
-  Children <PersonStructDataType[ ]>  (ValueRank == 1)
2022-01-11 14:20:12 +01:00