1. 08 Feb, 2021 1 commit
    • Julien Prigent's avatar
      [Session keepalive] Use subscription keepalive instead of renewing secure channel · ee844edb
      Julien Prigent authored
      When a session has a short session timeout, the secure_channel is
      renewed at 75% of it lifetime. While this is convenient to keep
      the session alives, this might be an overkill in some situations
      since the encryption involved behind the scene can be expensive,
      specifically on hardware with limited resources (i.e: OPC-UA
      server embedded on PLC module for example).
      
      What I suggested here is to have more control over the secure channel
      renewal and instead to rely on the subscription keepalive mechanism,
      thus, the client won't timeout when subscriptions are inactive.
      There's still the case when there's no subscription (client is
      connected but idling), in this situation the user has to set a
      secure_channel_timeout < session_timeout.
      
      Finally, the library ua-server doesn't respect the session_timeout
      sent by the client during session_creation. Probably worth to follow-up
      on this.
      
      Test with MaxKeepAliveCount == 22
      (session_timeout = 30; publish_interval = 1000)
      ```
      2021-02-07 16:23:00,147 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: CreateSubscriptionRequest(TypeId:i=787, RequestHeader:RequestHeader(AuthenticationToken:b=b'2\xd2\x82w\xad\x0f\x99\x9a %\xfaj\xb6\xb9\xaf\xa8\xe7\x13\xe6\xec\x15G\xf7G\x15\xbb\x82\x1d\xda\x17\xafh', Timestamp:2021-02-08 00:23:00.147523, RequestHandle:4, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:4000, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:CreateSubscriptionParameters(RequestedPublishingInterval:1000, RequestedLifetimeCount:10000, RequestedMaxKeepAliveCount:22, MaxNotificationsPerPublish:10000, PublishingEnabled:True, Priority:0))
      2021-02-07 16:23:00,170 - asyncua.client.ua_client.UaClient - DEBUG - publish []
      2021-02-07 16:23:00,170 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'2\xd2\x82w\xad\x0f\x99\x9a %\xfaj\xb6\xb9\xaf\xa8\xe7\x13\xe6\xec\x15G\xf7G\x15\xbb\x82\x1d\xda\x17\xafh', Timestamp:2021-02-08 00:23:00.170972, RequestHandle:6, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[]))
      21-02-08 00:23:00.939388))], DiagnosticInfos:[])]), Results:[], DiagnosticInfos:[])
      DataChangeNotification(<asyncua.common.subscription.SubscriptionItemData object at 0x7fdbf1444c10>, MonitoredItemNotification(ClientHandle:201, Value:DataValue(Value:Variant(val:300000,type:VariantType.Int32), StatusCode:StatusCode(Good), SourceTimestamp:2021-02-08 00:23:00.900000, ServerTimestamp:2021-02-08 00:23:00.939388)))
      
      2021-02-07 16:23:01,189 - asyncua.client.ua_client.UaClient - DEBUG - publish [SubscriptionAcknowledgement(SubscriptionId:75, SequenceNumber:1)]
      2021-02-07 16:23:01,189 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'2\xd2\x82w\xad\x0f\x99\x9a %\xfaj\xb6\xb9\xaf\xa8\xe7\x13\xe6\xec\x15G\xf7G\x15\xbb\x82\x1d\xda\x17\xafh', Timestamp:2021-02-08 00:23:01.189588, RequestHandle:7, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[SubscriptionAcknowledgement(SubscriptionId:75, SequenceNumber:1)]))
      2021-02-07 16:23:23,198 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:75, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:23:23.195861, NotificationData:[]), Results:[StatusCode(Good)], DiagnosticInfos:[])
      
      2021-02-07 16:23:45,175 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:75, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:23:45.172315, NotificationData:[]), Results:[], DiagnosticInfos:[])
      2021-02-07 16:23:45,175 - asyncua.client.ua_client.UaClient - DEBUG - publish []
      2021-02-07 16:23:45,175 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'2\xd2\x82w\xad\x0f\x99\x9a %\xfaj\xb6\xb9\xaf\xa8\xe7\x13\xe6\xec\x15G\xf7G\x15\xbb\x82\x1d\xda\x17\xafh', Timestamp:2021-02-08 00:23:45.175790, RequestHandle:9, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[]))
      2021-02-07 16:24:07,185 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:75, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:24:07.182767, NotificationData:[]), Results:[], DiagnosticInfos:[])
      ```
      
      Test with MaxKeepAliveCount == 0
      ```
      2021-02-07 16:25:40,994 - asyncua.client.ua_client.UaClient - DEBUG - create_subscription
      2021-02-07 16:25:40,994 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: CreateSubscriptionRequest(TypeId:i=787, RequestHeader:RequestHeader(AuthenticationToken:b=b'\x18*m\xa6E\xf3?\x9d\x86\xe2\xe9rgI\xa7\x073\xe90\xdb\x82\x82~F\x81\xe8\xb2T\xdb\xb0\xf8\xea', Timestamp:2021-02-08 00:25:40.994336, RequestHandle:4, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:4000, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:CreateSubscriptionParameters(RequestedPublishingInterval:1000, RequestedLifetimeCount:10000, RequestedMaxKeepAliveCount:0, MaxNotificationsPerPublish:10000, PublishingEnabled:True, Priority:0))
      2021-02-07 16:25:45,006 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:76, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:25:45.003386, NotificationData:[]), Results:[StatusCode(Good)], DiagnosticInfos:[])
      2021-02-07 16:25:45,007 - asyncua.client.ua_client.UaClient - DEBUG - publish []
      2021-02-07 16:25:45,007 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'\x18*m\xa6E\xf3?\x9d\x86\xe2\xe9rgI\xa7\x073\xe90\xdb\x82\x82~F\x81\xe8\xb2T\xdb\xb0\xf8\xea', Timestamp:2021-02-08 00:25:45.007090, RequestHandle:8, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[]))
      
      2021-02-07 16:25:42,023 - asyncua.client.ua_client.UaClient - DEBUG - publish [SubscriptionAcknowledgement(SubscriptionId:76, SequenceNumber:1)]
      2021-02-07 16:25:42,023 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'\x18*m\xa6E\xf3?\x9d\x86\xe2\xe9rgI\xa7\x073\xe90\xdb\x82\x82~F\x81\xe8\xb2T\xdb\xb0\xf8\xea', Timestamp:2021-02-08 00:25:42.023578, RequestHandle:7, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[SubscriptionAcknowledgement(SubscriptionId:76, SequenceNumber:1)]))
      
      2021-02-07 16:25:45,006 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:76, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:25:45.003386, NotificationData:[]), Results:[StatusCode(Good)], DiagnosticInfos:[])
      2021-02-07 16:25:45,007 - asyncua.client.ua_client.UaClient - DEBUG - publish []
      2021-02-07 16:25:45,007 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'\x18*m\xa6E\xf3?\x9d\x86\xe2\xe9rgI\xa7\x073\xe90\xdb\x82\x82~F\x81\xe8\xb2T\xdb\xb0\xf8\xea', Timestamp:2021-02-08 00:25:45.007090, RequestHandle:8, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[]))
      
      2021-02-07 16:25:48,016 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:76, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:25:48.013598, NotificationData:[]), Results:[], DiagnosticInfos:[])
      2021-02-07 16:25:48,016 - asyncua.client.ua_client.UaClient - DEBUG - publish []
      2021-02-07 16:25:48,017 - asyncua.client.ua_client.UASocketProtocol - DEBUG - Sending: PublishRequest(TypeId:i=826, RequestHeader:RequestHeader(AuthenticationToken:b=b'\x18*m\xa6E\xf3?\x9d\x86\xe2\xe9rgI\xa7\x073\xe90\xdb\x82\x82~F\x81\xe8\xb2T\xdb\xb0\xf8\xea', Timestamp:2021-02-08 00:25:48.017009, RequestHandle:9, ReturnDiagnostics:0, AuditEntryId:None, TimeoutHint:0, AdditionalHeader:ExtensionObject(TypeId:i=0, Encoding:0, None bytes)), Parameters:PublishParameters(SubscriptionAcknowledgements:[]))
      2021-02-07 16:25:51,016 - asyncua.common.subscription - INFO - Publish callback called with result: PublishResult(SubscriptionId:76, AvailableSequenceNumbers:[], MoreNotifications:False, NotificationMessage:NotificationMessage(SequenceNumber:2, PublishTime:2021-02-08 00:25:51.012809, NotificationData:[]), Results:[], DiagnosticInfos:[])
      ```
      ee844edb
  2. 04 Feb, 2021 2 commits
  3. 03 Feb, 2021 2 commits
    • Fabian Beitler's avatar
      Updated Schemas and standard_addresspaces to newest UA-Nodeset version (#425) · 0890551f
      Fabian Beitler authored
      * Updated Schemas and standard_addresspaces to newest UA-Nodeset version
      
      * Add Model Uri, Version and PublicationDate to autogenerated files
      Add missing namespaces in fill_namespace loop
      
      * Add break to stop iteration through xml file after finding model
      
      * Update to newest UA-Nodeset version (old one was still used!)
      
      * Generate Nodes on base of newest UA-Nodeset
      
      * Remove files from UA-Nodeset
      
      * Added more infos in header of event_object
      0890551f
    • Fabian Beitler's avatar
      Remove python version check · a916ba26
      Fabian Beitler authored
      Replace run method with asyncio.run, since it is standard in python3.7
      Add missing awaits in Coroutines
      Fix smaller Codestyle issues
      a916ba26
  4. 29 Jan, 2021 2 commits
  5. 28 Jan, 2021 3 commits
  6. 26 Jan, 2021 1 commit
  7. 25 Jan, 2021 3 commits
  8. 23 Jan, 2021 3 commits
    • Koseng's avatar
      Support variables with properties in events and extend file generators for... · 8ac0490b
      Koseng authored
      Support variables with properties in events and extend file generators for Alarms and Conditions (#415)
      
      * Complete client alarms and conditions example
      
      Complete client alarms and conditions example for usage with OPCFoundation UA-.NETStandard-Samples Quickstart AlarmConditionServer
      
      * Add variables to generated event filter and event object
      
      Event types can not only contain properties, but also variables. For example the ConditionType, which is the foundation of Alarms and Conditions, contains variables. Add the variables to the generated event filter and event object.
      
      * Changed schemas for Fix localtime field of events
      
      * changed schemas to autogenerate event_objects.py with conditions and alarms
      
      * expand the event model with variables which are able to have properties as children
      also supports custom events
      now we are able to generate alarms and conditions
      
      * Some refactoring and commenting in events and generate_model_event
      
      * Newly generated event_objects with Alarms and Conditions Types and Variables
      Co-authored-by: default avatarmar-ar <marco.arnold@hermle.de>
      Co-authored-by: default avataroroulet <oroulet@users.noreply.github.com>
      8ac0490b
    • oroulet's avatar
      Zu zu d invalid signature (#416) · 72fac9e5
      oroulet authored
      * [InvalidSignature] Fix race condition with secure channel renewal
      
      * [InvalidSignature] Clean code and add tests
      
      * [InvalidSignature] Consider expired SecureToken for up to 25% of its lifetime
      Co-authored-by: default avatarJulien Prigent <julienprigent@wanadoo.fr>
      72fac9e5
    • Fabian Beitler's avatar
      Update bug_report.md · 4fedec4c
      Fabian Beitler authored
      4fedec4c
  9. 21 Jan, 2021 1 commit
  10. 19 Jan, 2021 2 commits
  11. 18 Jan, 2021 5 commits
  12. 12 Jan, 2021 3 commits
  13. 11 Jan, 2021 8 commits
  14. 06 Jan, 2021 1 commit
  15. 05 Jan, 2021 1 commit
    • Fabian Beitler's avatar
      Change file-path structure · 005d35b4
      Fabian Beitler authored
      Rewrite if statement to easier readable code
      Replace Path expressions a better way?
      Add absolute to get absolute path to file (I hope)
      Remove one obsolete import pytest
      Refactor method name to better name
      Redo nested if statement a better way
      Remove forgotten garbage methods
      Replace os path with pathlib
      Small Codestyle fixes
      Add check if both or neither xml arg was passed -> not xor
      Fix wrong required model handling
      Differ between xmlstrin and file
      Add tests for requirement check
      Add two xml files for test purposes
      Replace ImportError with Exception
      Remove unused var
      List all missing requirements
      Check server models in seperate Coroutine
      Add method to check requirements while xmlimport
      Add namespaces Node to Shortcuts
      005d35b4
  16. 04 Jan, 2021 2 commits