Link IoT Edge provides an official driver to access OPC UA devices. You can use the IoT Platform console to deploy OPC UA drivers to gateways. You can download the OPC UA driver code from the console and modify the code based on your business requirements.
The OPC UA driver is only supported on the Professional Edition of Link IoT Edge (LE Pro).
This topic provides an example of how to use the OPC UA driver. The procedure is described as follows.
Step 1: Assign a driver
- Log on to the IoT Platform console. In the left-side navigation pane, choose View in the Actions column.. On the page that appears, find an existing edge instance, and click
- On the Instance Details page, click the Devices & Drivers tab, and click the
+icon on the right side of All Drivers.
- In the Assign Driver dialog box, select Official Drivers, find the OPC UA driver, and then click Assign. Click Complete.
Step 2: Configure the driver
- On the Devices & Drivers tab, click the OPC UA driver that has been assigned to the edge instance, and click Driver Configurations next to Devices.
- In the dialog box that appears, click Add Channel.
- Set parameters as prompted, and then click OK.
Parameter Description Channel Name The channel name must be unique under a gateway. The name must be 1 to 30 characters in length and can contain letters, digits, and underscores (_). Channel Address The OPC UA server address, for example,
Security Policy The encryption algorithm. Three options are available: None, Basic128Rsa15, and Basic256. Security Mode The signature type. Three options are available: None, Sign, and SignAndEncrypt. Username Optional. Password Optional. Timeout Period for Method Calls Unit: seconds.
- Optional. On the right side of Devices, click Container Configurations. On the page that appears, configure the container settings for the driver. After
you complete the configuration, click Save.
Note You can specify Container Configurations only when the Instance Type parameter is set to Pro Edition.
Table 1. Parameters Parameter Description Host Mode Specifies whether to isolate the container network from the host network. The valid values are described as follows:
- Yes: This value indicates that the container network is the same as the host network.
- No: This value indicates that the container network is isolated from the host network. If you select this option, you must configure the Network Port Mapping settings.
Network Port Mapping The mappings between host network ports and container network ports. This parameter is available only when Host Mode is set to No. The network where the function runs is isolated from the host network. You can map the listening port of the function in the container to a host network port. This allows client programs on various hosts to access the services that are provided by the function. You can specify a maximum of 10 entries.
For example, the
fc-http-serverfunction runs in a host container, and provides services by using socket port 80. The client programs on other hosts cannot access the
fc-http-serverfunction by accessing port 80 on the current host. To enable the client programs on other hosts to access the
fc-http-serverfunction, you must map the network port (port 80) in the container where the function runs to a host network port, such as port 8080. Then, the client programs on other hosts can access the
IP address:port 8080in the host network, and use the services provided by the
Specifies whether to enable the privilege mode. Root users of containers can access host services only as general users. If you want to change the system time or run the mount command in containers, you must be granted the required root permissions. In this scenario, you must enable the privilege mode for the containers.Note If you enable the privilege mode, applications and programs in the containers are granted the host root permissions, and all the host devices are mapped to the containers. Therefore, you do not need to configure the Device Mapping settings.
Device Mapping The device mappings. This parameter is available only when you select No for Privilege Mode. The network where the device management system resides is isolated from the host network. To enable a function to access a host device such as a serial interface, you must map the device to the container where the function runs. You can specify a maximum of 10 entries. Volume Mapping The volume mappings. The network where the file system resides is isolated from the host network. To enable a function to access a host file, you must map the file to the container where the function runs. You can specify a maximum of 10 entries.
Step 3: Assign a sub-device
- In the Devices section, click Assign Sub-device. In the Modbus driver settings, assign a device to the edge instance.
You can assign an existing OPC UA device or create a new OPC UA device by following the steps.Note To assign an existing OPC UA device, the product to which the device belongs must be a gateway sub-device and uses the OPC UA protocol for communications. For more information, see Create a product.
- On the Assign Sub-device page that appears on the right side of the console, click Add Sub-device.
- In the Add Device dialog box, click Create Product to create a product to which the Modbus device belongs.
- In the Create Product dialog box, specify the required parameters, and click OK.
Table 2. Parameter descriptions Parameter Description Product Name The name of the product. The product name must be unique for the current account. The product name must be 4 to 30 characters in length, and can contain letters, digits, underscores (_), hyphens (-), at signs (@), and parentheses (). Gateway Connection Protocol Select OPC UA. Authentication Mode The authentication method. Select an authentication method that is suitable for your device. For more information, see Authenticate devices. Product Description The description of the product. This parameter is optional.
- Return to the Add Device dialog box to add an OPC UA device.
- In the Assign Sub-device dialog box to assign the new OPC UA device to the edge instance.
- In the Actions column, click Device Configurations. In the dialog box that appears, you can assign the sub-device to a gateway and the
OPC UA driver by selecting the corresponding channel.
Table 3. Parameter descriptions Parameter Description Associated Channel Select the channel added in Step 2: Configure the driver. Node path The absolute path of the device in the OPC UA Server. The path starts from the Objects folder to the device node.
Step 4: Deploy the edge instance
In the upper-right corner of the Instance Details page, click Deploy to deploy the edge instance.