community.cip.generic_message (1.0.1) — module

Craft and send a custom "generic" CIP message

Authors: Aaron Neustedter (@aaron97neu)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.cip:==1.0.1


Add to requirements.yml

  collections:
    - name: community.cip
      version: 1.0.1

Description

A thin abstraction of the pycomm3 generic_message() API call. Connection related arguments are handled by ansible. This is intended for experienced developers needing functionality not already covered by the industrial.logix plugin. The functionality of this module is similar to crafting a TCP packet by hand. Typically, this call uses many builtin constants provided by the pycomm3 package, but in this case raw hex or dec values must be used. The lookup tables used by pycomm3 can be found in the following directory: https://github.com/ottowayi/pycomm3/tree/master/pycomm3/cip

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get MAC address of EN2T device
  industrial.logix.generic_message:
    service: 0x0E
    class_code: 0xF6
    instance: 1
    attribute: 3
    data_type:
      elementary_type: USINT
      array_len: 6
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Find the IP Setting configuration type. 0b_0000 = 'static', 0b_0001 = 'BOOTP' 0b_0010 = 'DHCP'
  industrial.logix.generic_message:
    service: 0x0E
    class_code: 0xf5
    instance: 1
    attribute: 3
    data_type:
      elementary_type: INT
      array_len: -1
    name: 'IP_config'

Inputs

    
name:
    default: generic
    description:
    - return Tag.Tag value, arbitrary but can be for tracking returned Tags
    required: false
    type: str

service:
    description:
    - service code for the request (single byte)
    required: true
    type: str

instance:
    description:
    - ID for an instance of the class. If set to 0, request class attributes
    required: true
    type: str

attribute:
    default: ''
    description:
    - attribute ID for the service/class/instance
    required: false
    type: str

data_type:
    default: {}
    description:
    - dict containing description of the expected return data type
    required: false
    suboptions:
      array_len:
        default: 1
        description:
        - If the data type if an array, the length of the array. Values less than 2 denote
          datatype is not an array
        required: false
        type: int
      elementary_type:
        description:
        - 'elementary data type, choices described here: https://docs.pycomm3.dev/en/latest/api_reference/data_types.html#pycomm3.cip.data_types.DataTypes'
        required: true
        type: str
    type: dict

class_code:
    description:
    - request object class ID
    required: true
    type: str

request_data:
    default: ''
    description:
    - any additional data required for the request
    required: false
    type: str