community.general.opx_cps (0.1.1) — module

CPS operations on networking device running Openswitch (OPX)

Authors: Senthil Kumar Ganesan (@skg-net)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Executes the given operation on the YANG object, using CPS API in the networking device running OpenSwitch (OPX). It uses the YANG models provided in https://github.com/open-switch/opx-base-model.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create VLAN
  opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "base-if-vlan/if/interfaces/interface/id": 230,
         "if/interfaces/interface/name": "br230",
         "if/interfaces/interface/type": "ianaift:l2vlan"
    }
    operation: "create"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get VLAN
  opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "if/interfaces/interface/name": "br230",
    }
    operation: "get"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Modify some attributes in VLAN
  opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "cps/key_data":
            { "if/interfaces/interface/name": "br230" },
         "dell-if/if/interfaces/interface/untagged-ports": ["e101-008-0"],
    }
    operation: "set"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete VLAN
  opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "if/interfaces/interface/name": "br230",
    }
    operation: "delete"

Inputs

    
db:
    default: 'no'
    description:
    - Queries/Writes the specified yang path from/to the db.
    type: bool

attr_data:
    description:
    - Attribute Yang path and their corresponding data.

attr_type:
    description:
    - Attribute Yang type.

operation:
    choices:
    - delete
    - create
    - set
    - action
    - get
    default: create
    description:
    - Operation to be performed on the object.

qualifier:
    choices:
    - target
    - observed
    - proposed
    - realtime
    - registration
    - running
    - startup
    default: target
    description:
    - A qualifier provides the type of object data to retrieve or act on.

module_name:
    description:
    - Yang path to be configured.

commit_event:
    default: 'no'
    description:
    - Attempts to force the auto-commit event to the specified yang object.
    type: bool

Outputs

commit_event:
  description: Denotes if auto-commit event is set
  returned: when commit_event is set to True in module options
  sample: true
  type: bool
cps_curr_config:
  description: Returns the CPS Get output i.e. the running configuration before CPS
    operation of set/delete is performed
  returned: when CPS operations set, delete
  sample:
  - data:
      base-if-vlan/if/interfaces/interface/id: 230
      cps/key_data:
        if/interfaces/interface/name: br230
      dell-base-if-cmn/if/interfaces/interface/if-index: 44
      dell-if/if/interfaces/interface/learning-mode: 1
      dell-if/if/interfaces/interface/mtu: 1532
      dell-if/if/interfaces/interface/phys-address: ''
      dell-if/if/interfaces/interface/vlan-type: 1
      if/interfaces/interface/enabled: 0
      if/interfaces/interface/type: ianaift:l2vlan
    key: target/dell-base-if-cmn/if/interfaces/interface
  type: dict
db:
  description: Denotes if CPS DB transaction was performed
  returned: when db is set to True in module options
  sample: true
  type: bool
diff:
  description: The actual configuration that will be pushed comparing the running
    configuration and input attributes
  returned: when CPS operations set, delete
  sample:
    cps/key_data:
      if/interfaces/interface/name: br230
    dell-if/if/interfaces/interface/untagged-ports:
    - e101-007-0
  type: dict
response:
  description: Output from the CPS transaction. Output of CPS Get operation if CPS
    set/create/delete not done.
  returned: when a CPS transaction is successfully performed.
  sample:
  - data:
      base-if-vlan/if/interfaces/interface/id: 230
      cps/object-group/return-code: 0
      dell-base-if-cmn/if/interfaces/interface/if-index: 46
      if/interfaces/interface/name: br230
      if/interfaces/interface/type: ianaift:l2vlan
    key: target/dell-base-if-cmn/if/interfaces/interface
  type: list