system.opcua.addConnection
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​
| Type | Parameter | Description |
|---|---|---|
| String | name | Name to assign to the new connection. |
| String | description | Description assigned to the new OPC UA connection. |
| String | discoveryUrl | Endpoint URL to use for discovery services. |
| String | endpointUrl | Endpoint URL to use for session services. |
| String | securityPolicy | The name of the SecurityPolicy to use. See the Security Policy table below for possible values. |
| String | securityMode | The name of the MessageSecurityMode to use. See the Message Security Mode table below for possible values. |
| Dictionary[String, Any] | settings | A 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:
| Key | Data Type |
|---|---|
| ENABLED | Boolean |
| DISCOVERYURL | String |
| ENDPOINTURL | String |
| SECURITYPOLICY | String |
| SECURITYMODE | String |
| USERNAME | String |
| PASSWORD | String |
| HOSTOVERRIDE | String |
| CONNECTTIMEOUT | Integer |
| ACKNOWLEDGETIMEOUT | Integer |
| REQUESTTIMEOUT | Integer |
| SESSIONTIMEOUT | Integer |
| MAXPEROPERATION | Integer |
| MAXREFERENCESPERNODE | Integer |
| MAXPENDINGPUBLISHREQUESTS | Integer |
| MAXNOTIFICATIONSPERPUBLISH | Integer |
| MAXMESSAGESIZE | Integer |
| MAXARRAYLENGTH | Integer |
| MAXSTRINGLENGTH | Integer |
| TYPEDICTIONARYFRAGMENTSIZE | Integer |
| KEEPALIVEFAILURESALLOWED | Integer |
| KEEPALIVEINTERVAL | Integer |
| KEEPALIVETIMEOUT | Integer |
| BROWSEORIGIN | String |
| CERTIFICATEVALIDATIONENABLED | Boolean |
| KEYSTOREALIAS | String |
| KEYSTOREALIASPASSWORD | String |
| FAILOVERENABLED | Boolean |
| FAILOVERTHRESHOLD | Integer |
| FAILOVERDISCOVERYURL | String |
| FAILOVERENDPOINTURL | String |
| FAILOVERHOSTOVERRIDE | String |
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"
}
)