Generic CDP Blocks

These are the possible options for the configuration fields of the CDP In, CDP Out, and CDP Out Queue generic CDP blocks.

The block types CDP In, CDP Out, and CDP Out Queue are classified as generic CDP blocks because they directly transfer the information in their configuration to the CDP library. In these blocks, the protocol translator adds minimal functionality on top of the CDP library and directly calls the relevant CDP procedures with the parameters collected from the configuration block.

For details on protocol specific documentation, refer to specific protocol adapter documentation.

The following table shows the possible options for the configuration fields of these blocks. The sections after the below table go into more detail about each field.

Field Type Required Default CDP In CDP Out CDP Out Queue
transport_addr String yes yes yes yes
node_ref String yes yes yes yes
method String yes yes yes yes
interval Integer yes if method is ‘get‘ yes
log_level String ‘off‘ yes yes yes
log_name String <block_name> yes yes yes
options Object yes yes yes
directory String yes yes
max_cache_size Integer 90 yes
max_cache_size_units String ‘%‘ yes

transport_addr

The transport_addr field determines the protocol and location of the endpoint the block will communicate with.

The prefix to the URI (for example, the "mqtt-tcp" in mqtt-tcp://localhost:1883 determines what protocol to use:

Protocol Possible Prefixes
EGD 'egd'
EGD Read Only 'egd-ro'
Modbus 'modbus-tcp', 'modbus-rtu', 'modbus-ascii', 'modbus-rtu-tcp', 'modbus-ascii-tcp'
MQTT 'mqtt-tcp'
OPC-UA 'opc-tcp'
OSI-PI 'osipi-http', 'osipi-https'
Predix Time Series 'pxts', 'pxtss'

node_ref

The node_ref field means a slightly different thing for each protocol but is essentially the specific node that is to be communicated with in the protocol specified by the transport_addr. For MQTT, this means the topic to publish to or subscribe from.

Note: This field is unused for the Timeseries CDP library, but is still a required field for the protocol translator to work properly.

method

The method field determines the method of the communication (synch/asynch, send/receive). This field’s possible values are dependent on both the block type and protocol used, for example, some protocols support only the publish/subscribe or get/set type of communication.

Block Type Possible Method Values
cdpin 'get', 'sub'
cdpout 'set', 'pub'
cdpoutqueue 'set', 'pub'

interval

The interval field is only relevant (and required) if the block is of type cdpin and the method field is get. This determines the interval (in milliseconds) at which the block will poll its endpoint for data.

For example, if this is set to 1000, the block will attempt to get data every second.

log_level

The log_level field determines which level of logs to output. If the field is not set to one of the following values, the block will not log anything.

Possible Values
'debug', 'info', 'warn', 'err', 'critical'

log_name

The log_name field defines a name to identify the block’s logs. This is typically prepended to the log output. If unset, it defaults to the block name.

options

The options field is a JSON object whose contents are specific to the protocol specified in the transport_addr field.

This is not considered a required field, but some protocols may require it to function properly. For example, if the Time Series protocol ('pxtss') is specified in the transport_addr field and the options field does not contain the token_file and predix_zone_id, the block will be unable to connect to the Time Series endpoint.

directory

The directory field is only used in the CDP Out Queue block. This field determines the directory where the block’s store-and-forward files (a disk-backed queue of data to be sent) will be created and updated. If the directory does not exist, it will be created, but if its parent directory does not exist, an error will be thrown.

Important: Be careful about the directory you specify here. If the path in this field is the same as the path in the config of another block within the same Docker application, there will be a conflict between the two blocks’ disk-backed queue (store-and-forward) files.

For example, if you have an OPC-UA Adapter container and a Cloud Gateway container both within the same Docker application, they will both receive the same /data mount directory. If /data is specified as the directory field for a block in both the OPC-UA and Cloud Gateway configuration files, they will both fail to maintain their own disk-backed queue files.

max_cache_size

The max_cache_size field determines the maximum amount of disk space allowed for this block to use for one of its disk-backed queues (store-and-forward file).

If left unset, this field’s value will default to 90 and the max_cache_size_units field will default to %.

Important: Due to the way these files are managed, the block may consume up to 2 times the size of max_cache_size on disk. For example, a 100MB queue may consume up to 200MB of actual disk space.

max_cache_size_units

The max_cache_size_units field determines the units to use for the max_cache_size field.

This field’s default value is %.

Value Meaning
'%' Percentage of available disk space
'B' Bytes
'KB' Kilobytes
'MB' Megabytes
'GB' Gigabytes

CDP In

Type
'cdpin'

This block is used to receive data from any transport on the CDP. Its configuration fields are as follows:

Field Type Required Default
transport_addr String yes
node_ref String yes
method String yes
interval Integer yes if method is ‘get‘
log_level String ‘off‘
log_name String <block_name>
options Object

For more specific information on these fields, see the high level description of generic CDP blocks above.

Example CDP In Block:

"example_cdpin_mqtt_source_block": {
    "type": "cdpin",
    "config": {
        "transport_addr": "mqtt-tcp://predix-edge-broker",
        "node_ref": "predix_historian",
        "method": "sub",
        "log_name": "mqtt_source_block",
        "log_level": "err"
    }
}

CDP Out

Type
'cdpout'

This block is used to send data to any transport on the CDP. Its configuration fields are as follows:

Field Type Required Default
transport_addr String yes
node_ref String yes
method String yes
log_level String ‘off‘
log_name String <block_name>
options Object

For more specific information on these fields see the high level description of generic CDP blocks above.

Example CDP Out Block:

"example_cdpout_mqtt_sink_block": {
    "type": "cdpout",
    "config": {
        "transport_addr": "mqtt-tcp://predix-edge-broker",
        "node_ref": "data/pressure",
        "method": "pub",
        "log_name": "mqtt_sink",
        "log_level": "err",
        "options": {
            "qos": 1
        }
    }
}

CDP Out Queue

Type
'cdpoutqueue'

This block is used to send data to any transport on the CDP. It is identical to the CDP Out block above, except that this block will also queue messages on a disk-backed queue (store-and-forward) if it is unable to deliver them. Its configuration fields are as follows:

Field Type Required Default
transport_addr String yes
node_ref String yes
method String yes
log_level String ‘off‘
log_name String <block_name>
options Object
directory String yes
max_cache_size Integer 90
max_cache_size_units String ‘%‘

Example CDP Out Queue Block:

"example_cdpoutqueue_timeseries_sink_block": {
    "type": "cdpoutqueue",
    "config": {
        "transport_addr": "pxtss://timeseries-instance.run.aws-usw02-pr.ice.predix.io/v1/stream/messages",
        "node_ref": "doesn't_matter_for_timeseries",
        "method": "set",
        "log_name": "timeseries_sink",
        "log_level": "err",
        "directory": "/data/container_name/timeseries_sink/dbq/",
        "max_cache_size": 100,
        "max_cache_size_units": "MB",
        "options": {
            "token_file": "/edge-agent/access_token",
            "predix_zone_id": "01234567-8987-6543-2101-234567898765",
            "proxy_url": "https://proxy.proxy.proxy.com:8080"
        }
    }
}
If these blocks are used to communicate to an MQTT broker (and ‘mqtt-tcp’ is specified in the ‘transport_addr’ field), the “options” field can contain the following optional sub-fields:
  • ‘qos’: This field can be set to the desired “quality of service” for any MQTT message transfers. This field’s value can be 0, 1, or 2. These values correspond to “at most once”, “at least once”, and “exactly once” message delivery respectively.
  • ‘clientid’: This field can be set to the desired client ID for the block’s connection to the MQTT broker. The client ID helps the MQTT broker to identify the block. NOTE: If either the ‘client_id’ is not set, or the ‘qos’ is 0, the MQTT “clean_session” flag will be set when connecting to the broker. Otherwise, the broker will persist this block’s connection information and subscriptions.
  • ‘username’: This field can be set if the MQTT broker being connected to requires username/password authentication.
  • ‘password’: This field can be set if the MQTT broker being connected to requires username/password authentication.