cisco.dnac.interfaces_info 模块 – 接口信息的信息模块

注意

此模块是 cisco.dnac 集合(版本 6.25.0)的一部分。

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

要安装它,请使用:ansible-galaxy collection install cisco.dnac。您需要进一步的要求才能使用此模块,有关详细信息,请参阅 要求

要在 Playbook 中使用它,请指定:cisco.dnac.interfaces_info

cisco.dnac 6.15.0 中的新功能

概要

  • 此模块表示模块 interfaces_v1_info 的别名

注意

此模块具有相应的 action 插件

要求

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

  • dnacentersdk >= 2.4.9

  • python >= 3.5

参数

参数

注释

attribute

字符串

属性查询参数。可以在属性字段中提供以下属性列表:id、adminStatus、description、duplexConfig、duplexOper、interfaceIfIndex、interfaceType、ipv4Address、ipv6AddressLi st、isL3Interface、isWan、macAddress、mediaType、name、operStatus、peerStackMember、peerStackPort、 portChannelId、portMode、 portType、rxDiscards、rxError、rxRate、rxUtilization、speed、stackPortType、timestamp、txDis cards、txError、txRate、txUtilization、vlanId、networkDeviceId、networkDeviceIpAddress、networkDeviceMacAddress、sit eName、siteHierarchy、siteHierarchyId。如果属性列表的长度太长,请改用 “views” 参数。示例:attributes=name(请求单个属性)attributes=name,description,duplexOper(多个属性,以逗号分隔)。

dnac_debug

布尔值

用于启用调试的 Cisco DNA Center SDK 标志。

选项

  • false ← (默认)

  • true

dnac_host

字符串 / 必填

Cisco DNA Center 主机名。

dnac_password

字符串

用于身份验证的 Cisco DNA Center 密码。

dnac_port

整数

Cisco DNA Center 端口。

默认: 443

dnac_username

别名: user

字符串

用于身份验证的 Cisco DNA Center 用户名。

默认: "admin"

dnac_verify

布尔值

用于启用或禁用 SSL 证书验证的标志。

选项

  • false

  • true ← (默认)

dnac_version

字符串

通知 SDK 要使用的 Cisco DNA Center 版本。

默认: "2.3.7.6"

endTime

浮点数

EndTime 查询参数。API 查询与资源相关的数据集的时间。必须以毫秒为单位的 UNIX 纪元时间指定。值是包含的。

headers

字典

其他标头。

id

字符串

Id 路径参数。接口 UUID。

interfaceId

字符串

InterfaceId 查询参数。接口 UUID 列表。(例如,`6bef213c-19ca-4170-8375-b694e251101c`)示例:`interfaceId=6bef213c-19ca-4170-8375-b694e251101c`(单个接口 UUID)`interfaceId=6bef213c- 19ca-4170-8375-b694e251101c&32219612-819e-4b5e-a96b-cf22aca13dd9&2541e9a7-b80d-4955-8aa2-79b233318ba0`(多个接口 UUID,以 & 分隔符)。

interfaceName

字符串

InterfaceName 查询参数。接口名称列表(例如,`GigabitEthernet1/0/1`)。此字段支持基于通配符 (`*`) 字符的搜索。例如,`*1/0/1*` 或 `1/0/1*` 或 `*1/0/1`。示例:`interfaceNames=GigabitEthernet1/0/1`(单个接口名称)`interfaceNames=GigabitEthernet1/0/1&GigabitEthernet2/0/1&GigabitEthernet3/0/1`(多个接口名称,以 & 分隔符)。

limit

浮点数

Limit 查询参数。要返回的最大记录数。

networkDeviceId

字符串

NetworkDeviceId 查询参数。网络设备 UUID 列表。(例如,`6bef213c-19ca-4170-8375-b694e251101c`)示例:`networkDeviceId=6bef213c-19ca-4170-8375-b694e251101c`(请求单个 networkDeviceId)`networkDeviceId=6bef213c-19ca-4170-8375- b694e251101c&networkDeviceId=32219612-819e-4b5e-a96b-cf22aca13dd9&networkDeviceId=2541e9a7-b80d-4955-8aa2- 79b233318ba0`(多个 networkDeviceIds,以 & 分隔符)。

networkDeviceIpAddress

字符串

NetworkDeviceIpAddress 查询参数。网络设备管理 IP 地址列表。(例如,`121.1.1.10`)。此字段支持基于通配符 (`*`) 字符的搜索。例如,`*1.1*` 或 `1.1*` 或 `*1.1`。示例:`networkDeviceIpAddress=121.1.1.10` `networkDeviceIpAddress=121.1.1.10&networkDeviceIpAddress=172.20.1.10&networkDeviceIpAddress=10.10.20.10`(多个网络设备 IP 地址,以 & 分隔符)。

networkDeviceMacAddress

字符串

NetworkDeviceMacAddress 查询参数。网络设备 MAC 地址列表。(例如 `64 f6 9d 07 9a 00`)此字段支持基于通配符 (`*`) 字符的搜索。例如 `*AB AB AB*` 或 `AB AB AB*` 或 `*AB AB AB`。示例:`networkDeviceMacAddress=64 f6 9d 07 9a 00` `networkDeviceMacAddress=64 f6 9d 07 9a 00&networkDeviceMacAddress=70 56 9d 07 ac 77`(多个网络设备 MAC 地址,用 & 分隔)。

offset

浮点数

Offset 查询参数。指定 API 返回的所有记录内的起始点。它是一个基于 1 的偏移量。起始值为 1。

order

字符串

Order 查询参数。字段的排序顺序,升序或降序。

siteHierarchy

字符串

SiteHierarchy 查询参数。站点树的完整层次结构细分,从全局站点名称开始,到特定站点名称结束。根站点命名为“Global”(例如 `Global/AreaName/BuildingName/FloorName`)。此字段支持通配符星号 (`*`) 字符搜索。例如:`*/San*`, `*/San`, `/San*`。示例:`?siteHierarchy=Global/AreaName/BuildingName/FloorName`(请求单个 siteHierarchy)`?siteHierarchy=Global/AreaName/BuildingName/FloorName&siteHierarchy=Global /AreaName2/BuildingName2/FloorName2`(请求多个 siteHierarchies)。

siteHierarchyId

字符串

SiteHierarchyId 查询参数。站点树的完整层次结构细分,以 ID 形式表示,从全局站点 UUID 开始,到特定站点 UUID 结束。(例如 `globalUuid/areaUuid/buildingUuid/floorUuid`)。此字段支持通配符星号 (`*`) 字符搜索。例如:`*uuid*`, `*uuid`, `uuid*`。示例:`?siteHierarchyId=globalUuid/areaUuid/buildingUuid/floorUuid`(请求单个 siteHierarchyId)`?siteHiera rchyId=globalUuid/areaUuid/buildingUuid/floorUuid&siteHierarchyId=globalUuid/areaUuid2/buildingUuid2/floorUu id2`(请求多个 siteHierarchyIds)。

siteId

字符串

SiteId 查询参数。站点的 UUID。(例如 `flooruuid`)。示例:`?siteId=id1`(请求单个 ID)`?siteId=id1&siteId=id2&siteId=id3`(请求多个 ID)。

sortBy

字符串

SortBy 查询参数。响应中用于排序的字段。

startTime

浮点数

StartTime 查询参数。API 查询与资源相关的数据集的开始时间。必须以 UNIX 纪元时间毫秒为单位指定。值是包含的。如果未提供 `startTime`,API 将默认为当前时间。

validate_response_schema

布尔值

Cisco DNA Center SDK 的标志,用于启用针对 JSON 模式验证请求主体。

选项

  • false

  • true ← (默认)

view

字符串

View 查询参数。正在请求的特定摘要视图。这是一个可选参数,可以传递它以获取一个或多个与特定视图关联的字段。默认视图是 `configuration`。 ### 每个视图提供响应数据 1. **configuration** id,adminStatus,description,duplexConfig,duplexOper, interfaceIfIndex,interfaceType,ipv4Address,ipv6AddressList,isL3Interface,isWan,macAddress,mediaType,name,ope rStatus, portChannelId,portMode, portType,speed,timestamp,vlanId,networkDeviceId,networkDeviceIpAddress,netw orkDeviceMacAddress,siteName,siteHierarchy,siteHierarchyId 2. **statistics** id,name,rxDiscards,rxError,rxRa te,rxUtilization,txDiscards,txError,txRate,txUtilization,networkDeviceId,networkDeviceIpAddress,networkDevic eMacAddress,siteName,siteHierarchy,siteHierarchyId 3. **stackPort** id,name,peerStackMember,peerStackPort,st ackPortType,networkDeviceId,networkDeviceIpAddress,networkDeviceMacAddress,siteName,siteHierarchy,siteHierar chyId 默认视图是 configuration。如果需要访问其他视图,只需在查询参数中包含视图名称即可。示例:view=configuration(请求单个视图)view=configuration&view=statistic&stackPort(请求多个视图)。

备注

注意

  • 使用的 SDK 方法是:devices.Devices.get_the_interface_data_for_the_given_interface_idinstance_uuid_along_with_the_statistics_data_v1, devices.Devices.gets_interfaces_along_with_statistics_data_from_all_network_devices_v1,

  • 使用的路径是:get /dna/data/api/v1/interfaces, get /dna/data/api/v1/interfaces/{id},

  • 应该注意的是,此模块是 interfaces_v1_info 的别名

  • 支持 check_mode

  • 该插件在控制节点上运行,不使用任何 Ansible 连接插件,而是使用 Cisco DNAC SDK 中的嵌入式连接管理器

  • 以 dnac_ 开头的参数由 Cisco DNAC Python SDK 用于建立连接

另请参阅

另请参阅

Cisco DNA Center 文档,了解设备 GetTheInterfaceDataForTheGivenInterfaceIdinstanceUuidAlongWithTheStatisticsDataV1

GetTheInterfaceDataForTheGivenInterfaceIdinstanceUuidAlongWithTheStatisticsDataV1 API 的完整参考。

Cisco DNA Center 文档,了解设备 GetsInterfacesAlongWithStatisticsDataFromAllNetworkDevicesV1

GetsInterfacesAlongWithStatisticsDataFromAllNetworkDevicesV1 API 的完整参考。

示例

- name: Get all Interfaces Info
  cisco.dnac.interfaces_info:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    headers: "{{my_headers | from_json}}"
    startTime: 0
    endTime: 0
    limit: 0
    offset: 0
    sortBy: string
    order: string
    siteHierarchy: string
    siteHierarchyId: string
    siteId: string
    view: string
    attribute: string
    networkDeviceId: string
    networkDeviceIpAddress: string
    networkDeviceMacAddress: string
    interfaceId: string
    interfaceName: string
  register: result

- name: Get Interfaces Info by id
  cisco.dnac.interfaces_info:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    headers: "{{my_headers | from_json}}"
    startTime: 0
    endTime: 0
    view: string
    attribute: string
    id: string
  register: result

返回值

常见的返回值记录在此处,以下是此模块特有的字段

描述

dnac_response

字典

一个字典或列表,其中包含 Cisco DNAC Python SDK 返回的响应

返回:始终

示例: {"response": {"adminStatus": "string", "description": "string", "duplexConfig": "string", "duplexOper": "string", "id": "string", "interfaceIfIndex": 0, "interfaceType": "string", "ipv4Address": "string", "ipv6AddressList": ["string"], "isL3Interface": true, "isWan": true, "macAddr": "string", "mediaType": "string", "name": "string", "networkDeviceId": "string", "networkDeviceIpAddress": "string", "networkDeviceMacAddress": "string", "operStatus": "string", "peerStackMember": 0, "peerStackPort": "string", "portChannelId": "string", "portMode": "string", "portType": "string", "rxDiscards": 0, "rxError": 0, "rxRate": 0, "rxUtilization": 0, "siteHierarchy": "string", "siteHierarchyId": "string", "siteName": "string", "speed": "string", "stackPortType": "string", "timestamp": 0, "txDiscards": 0, "txError": 0, "txRate": 0, "txUtilization": 0, "vlanId": "string"}, "version": "string"}

作者

  • Rafael Campos (@racampos)