community.network.opx_cps 模块 – 在运行 Openswitch (OPX) 的网络设备上执行 CPS 操作

注意

此模块是 community.network 集合(版本 5.1.0)的一部分。

如果您使用的是 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.network。您需要满足其他要求才能使用此模块,请参阅 要求 以了解详细信息。

要在 playbook 中使用它,请指定:community.network.opx_cps

注意

community.network 集合已被弃用,将从 Ansible 12 中删除。有关更多信息,请参阅讨论帖子

已弃用

在以下版本中移除:

版本 6.0.0

原因:

此集合及其中的所有内容均未维护且已弃用。

替代方案:

未知。

概要

别名:network.opx.opx_cps

要求

执行此模块的主机需要满足以下要求。

  • cps

  • cps_object

  • cps_utils

参数

参数

注释

attr_data

字符串

属性 Yang 路径及其对应的数据。

attr_type

字符串

属性 Yang 类型。

commit_event

布尔值

尝试强制将自动提交事件发送到指定的 yang 对象。

选择

  • false ←(默认)

  • true

db

布尔值

从/向数据库查询/写入指定的 yang 路径。

选择

  • false ←(默认)

  • true

module_name

字符串

要配置的 Yang 路径。

operation

字符串

要在对象上执行的操作。

选择

  • "delete"

  • "create" ←(默认)

  • "set"

  • "action"

  • "get"

qualifier

字符串

限定符提供了要检索或操作的对象数据的类型。

选择

  • "target" ←(默认)

  • "observed"

  • "proposed"

  • "realtime"

  • "registration"

  • "running"

  • "startup"

示例

- name: Create VLAN
  community.network.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"
- name: Get VLAN
  community.network.opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "if/interfaces/interface/name": "br230",
    }
    operation: "get"
- name: Modify some attributes in VLAN
  community.network.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"
- name: Delete VLAN
  community.network.opx_cps:
    module_name: "dell-base-if-cmn/if/interfaces/interface"
    attr_data: {
         "if/interfaces/interface/name": "br230",
    }
    operation: "delete"

返回值

通用返回值记录在这里,以下是此模块独有的字段

描述

commit_event

布尔值

表示是否设置了自动提交事件

返回: 当在模块选项中将 commit_event 设置为 True 时

示例: true

cps_curr_config

字典

返回 CPS Get 输出,即执行 set/delete 的 CPS 操作之前的运行配置

返回: 当 CPS 操作设置为 set、delete 时

示例: [{"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"}]

db

布尔值

表示是否执行了 CPS DB 事务

返回: 当在模块选项中将 db 设置为 True 时

示例: true

diff

字典

通过比较运行配置和输入属性,将实际推送的配置

返回: 当 CPS 操作设置为 set、delete 时

示例: {"cps/key_data": {"if/interfaces/interface/name": "br230"}, "dell-if/if/interfaces/interface/untagged-ports": ["e101-007-0"]}

response

列表 / 元素=字符串

来自 CPS 事务的输出。如果未完成 CPS set/create/delete 操作,则输出 CPS Get 操作的输出。

返回: 当成功执行 CPS 事务时。

示例: [{"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"}]

状态

  • 此模块将在 6.0.0 版本中移除。[已弃用]

  • 更多信息请参阅 已弃用

作者

  • Senthil Kumar Ganesan (@skg-net)