Skip to main content
Version: 8.1

system.opcua.addConnection

New in 8.1.8

This function is used in Python Scripting.

Description​

Adds a new OPC UA connection.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.opcua.addConnection(name, description, discoveryUrl, endpointUrl, securityPolicy, securityMode, settings)

Parameters​

TypeParameterDescription
StringnameName to assign to the new connection.
StringdescriptionDescription assigned to the new OPC UA connection.
StringdiscoveryUrlEndpoint URL to use for discovery services.
StringendpointUrlEndpoint URL to use for session services.
StringsecurityPolicyThe name of the SecurityPolicy to use. See the Security Policy table below for possible values.
StringsecurityModeThe name of the MessageSecurityMode to use. See the Message Security Mode table below for possible values.
Dictionary[String, Any]settingsA dictionary of additional settings to apply to the connection. See the Settings table for a table of possible keys.

Returns​

Nothing

Scope​

Gateway, Perspective Session

Security Policy​

Below is a listing of supported values for the securityPolicy argument:

  • None
  • Basic128Rsa15
  • Basic256
  • Basic256Sha256
  • Aes128_Sha256_RsaOaep
  • Aes256_Sha256_RsaPss

Message Security Mode​

Below is a listing of supported values for the messageSecurityMode argument:

  • None
  • Sign
  • SignAndEncrypt

Settings​

Below is a listing of supported values for the settings argument:

KeyData Type
ENABLEDBoolean
DISCOVERYURLString
ENDPOINTURLString
SECURITYPOLICYString
SECURITYMODEString
USERNAMEString
PASSWORDString
HOSTOVERRIDEString
CONNECTTIMEOUTInteger
ACKNOWLEDGETIMEOUTInteger
REQUESTTIMEOUTInteger
SESSIONTIMEOUTInteger
MAXPEROPERATIONInteger
MAXREFERENCESPERNODEInteger
MAXPENDINGPUBLISHREQUESTSInteger
MAXNOTIFICATIONSPERPUBLISHInteger
MAXMESSAGESIZEInteger
MAXARRAYLENGTHInteger
MAXSTRINGLENGTHInteger
TYPEDICTIONARYFRAGMENTSIZEInteger
KEEPALIVEFAILURESALLOWEDInteger
KEEPALIVEINTERVALInteger
KEEPALIVETIMEOUTInteger
BROWSEORIGINString
CERTIFICATEVALIDATIONENABLEDBoolean
KEYSTOREALIASString
KEYSTOREALIASPASSWORDString
FAILOVERENABLEDBoolean
FAILOVERTHRESHOLDInteger
FAILOVERDISCOVERYURLString
FAILOVERENDPOINTURLString
FAILOVERHOSTOVERRIDEString

Code Examples​

Example #1
# The following could be used to connect to Ignition's OPC UA server.
system.opcua.addConnection(
"test",
"test desc",
"opc.tcp://localhost:62541/discovery",
"opc.tcp://localhost:62541",
"Basic256Sha256",
"SignAndEncrypt",
{
"username":"opcuauser",
"password":"password"
}
)