cisco.dnac.network_device – Manage NetworkDevice objects of Devices

Note

This plugin is part of the cisco.dnac collection (version 2.0.7).

To install it use: ansible-galaxy collection install cisco.dnac.

To use it in a playbook, specify: cisco.dnac.network_device.

New in version 1.0.0: of cisco.dnac

Synopsis

  • Returns list of network devices based on filter criteria such as management IP address, mac address, hostname, location name and a wide variety of additional criteria. You can also use the asterisk in any value to conduct a wildcard search. For example, to find all hostnames beginning with myhost in the IP address range 192.25.18.n, issue the following request GET fqdnoripofdnacenterplatform/dna/intent/api/v1/network-device? hostname=myhost* & managementIpAddress=192.25.18.* For a complete list of parameter names that you can use for filtering this request, see the DNA Center API Reference documentation. Note If id parameter is provided, it will return the list of network-devices for the given ids and ignores the other request parameters.

  • Adds the device with given credential.

  • Sync the devices provided as input.

  • Deletes the network device for the given Id.

  • Returns the network device details for the given device ID.

  • Returns brief summary of device info such as hostname, management IP address for the given device Id.

  • Returns the list of network devices for the given pagination range.

  • Returns the count of network devices based on the filter criteria by management IP address, mac address, hostname and location name.

  • Returns the network device by specified IP address.

  • Returns the network device with given serial number.

Note

This module has a corresponding action plugin.

Requirements

The below requirements are needed on the host that executes this module.

  • dnacentersdk

Parameters

Parameter Choices/Defaults Comments
associated_wlc_ip
string
AssociatedWlcIp query parameter.
cliTransport
string / required
InventoryDeviceInfo's cliTransport.
collection_interval
string
CollectionInterval query parameter.
collection_status
string
CollectionStatus query parameter.
computeDevice
boolean
    Choices:
  • no
  • yes
InventoryDeviceInfo's computeDevice.
count
boolean
    Choices:
  • no
  • yes
If true gets the number of objects.
Required for state query.
enablePassword
string / required
InventoryDeviceInfo's enablePassword.
error_code
string
ErrorCode query parameter.
error_description
string
ErrorDescription query parameter.
extendedDiscoveryInfo
string
InventoryDeviceInfo's extendedDiscoveryInfo.
family
string
Family query parameter.
hostname
string
Hostname query parameter.
httpPassword
string
InventoryDeviceInfo's httpPassword.
httpPort
string
InventoryDeviceInfo's httpPort.
httpSecure
boolean
    Choices:
  • no
  • yes
InventoryDeviceInfo's httpSecure.
httpUserName
string
InventoryDeviceInfo's httpUserName.
id
string
Accepts comma separated id's and return list of network-devices for the given id's. If invalid or not- found id's are provided, null entry will be returned in the list.
Device ID.
Required for states query and delete.
ip_address
string
Device IP address.
Required for state query.
ipAddress
list / elements=string / required
InventoryDeviceInfo's ipAddress (list of strings).
is_force_delete
boolean
    Choices:
  • no
  • yes
IsForceDelete query parameter.
license_name
string
License.name query parameter.
license_status
string
License.status query parameter.
license_type
string
License.type query parameter.
location
string
Location query parameter.
location_name
string
LocationName query parameter.
mac_address
string
MacAddress query parameter.
management_ip_address
string
ManagementIpAddress query parameter.
merakiOrgId
list / elements=string
InventoryDeviceInfo's merakiOrgId (list of strings).
module_equpimenttype
string
Module+equpimenttype query parameter.
module_name
string
Module+name query parameter.
module_operationstatecode
string
Module+operationstatecode query parameter.
module_partnumber
string
Module+partnumber query parameter.
module_servicestate
string
Module+servicestate query parameter.
module_vendorequipmenttype
string
Module+vendorequipmenttype query parameter.
netconfPort
string
InventoryDeviceInfo's netconfPort.
not_synced_for_minutes
string
NotSyncedForMinutes query parameter.
password
string / required
InventoryDeviceInfo's password.
platform_id
string
PlatformId query parameter.
reachability_status
string
ReachabilityStatus query parameter.
records_to_return
integer
Number of records to return.
Required for state query.
role
string
Role query parameter.
serial_number
string
SerialNumber query parameter.
Device serial number.
Required for state query.
serialNumber
string
InventoryDeviceInfo's serialNumber.
series
string
Series query parameter.
snmpAuthPassphrase
string / required
InventoryDeviceInfo's snmpAuthPassphrase.
snmpAuthProtocol
string / required
InventoryDeviceInfo's snmpAuthProtocol.
snmpMode
string / required
InventoryDeviceInfo's snmpMode.
snmpPrivPassphrase
string / required
InventoryDeviceInfo's snmpPrivPassphrase.
snmpPrivProtocol
string / required
InventoryDeviceInfo's snmpPrivProtocol.
snmpRetry
integer / required
InventoryDeviceInfo's snmpRetry.
snmpROCommunity
string / required
InventoryDeviceInfo's snmpROCommunity.
snmpRWCommunity
string / required
InventoryDeviceInfo's snmpRWCommunity.
snmpTimeout
integer / required
InventoryDeviceInfo's snmpTimeout.
snmpUserName
string / required
InventoryDeviceInfo's snmpUserName.
snmpVersion
string
InventoryDeviceInfo's snmpVersion.
software_type
string
SoftwareType query parameter.
software_version
string
SoftwareVersion query parameter.
start_index
integer
Start index.
Required for state query.
summary
boolean
    Choices:
  • no
  • yes
If true gets the summary.
Required for state query.
type
string
Type query parameter.
InventoryDeviceInfo's type.
up_time
string
UpTime query parameter.
updateMgmtIPaddressList
list / elements=dictionary
InventoryDeviceInfo's updateMgmtIPaddressList (list of objects).
existMgmtIpAddress
string
It is the network device's existMgmtIpAddress.
newMgmtIpAddress
string
It is the network device's newMgmtIpAddress.
userName
string / required
InventoryDeviceInfo's userName.

See Also

See also

cisco.dnac.plugins.module_utils.definitions.network_device

The official documentation on the cisco.dnac.plugins.module_utils.definitions.network_device module.

NetworkDevice reference

Complete reference of the NetworkDevice object model.

NetworkDevice reference

SDK reference.

Examples

- name: get_device_list
  cisco.dnac.network_device:
    state: query  # required
    associated_wlc_ip: SomeValue  # string
    collection_interval: SomeValue  # string
    collection_status: SomeValue  # string
    error_code: SomeValue  # string
    error_description: SomeValue  # string
    family: SomeValue  # string
    hostname: SomeValue  # string
    id: SomeValue  # string
    license_name: SomeValue  # string
    license_status: SomeValue  # string
    license_type: SomeValue  # string
    location: SomeValue  # string
    location_name: SomeValue  # string
    mac_address: SomeValue  # string
    management_ip_address: SomeValue  # string
    module_equpimenttype: SomeValue  # string
    module_name: SomeValue  # string
    module_operationstatecode: SomeValue  # string
    module_partnumber: SomeValue  # string
    module_servicestate: SomeValue  # string
    module_vendorequipmenttype: SomeValue  # string
    not_synced_for_minutes: SomeValue  # string
    platform_id: SomeValue  # string
    reachability_status: SomeValue  # string
    role: SomeValue  # string
    serial_number: SomeValue  # string
    series: SomeValue  # string
    software_type: SomeValue  # string
    software_version: SomeValue  # string
    type: SomeValue  # string
    up_time: SomeValue  # string
  register: nm_get_device_list

- name: add_device
  cisco.dnac.network_device:
    state: create  # required
    cliTransport: SomeValue  # string, required
    enablePassword: SomeValue  # string, required
    ipAddress:  # required
    - SomeValue  # string
    password: SomeValue  # string, required
    snmpAuthPassphrase: SomeValue  # string, required
    snmpAuthProtocol: SomeValue  # string, required
    snmpMode: SomeValue  # string, required
    snmpPrivPassphrase: SomeValue  # string, required
    snmpPrivProtocol: SomeValue  # string, required
    snmpROCommunity: SomeValue  # string, required
    snmpRWCommunity: SomeValue  # string, required
    snmpRetry: 1  #  integer, required
    snmpTimeout: 1  #  integer, required
    snmpUserName: SomeValue  # string, required
    userName: SomeValue  # string, required
    computeDevice: True  # boolean
    extendedDiscoveryInfo: SomeValue  # string
    httpPassword: SomeValue  # string
    httpPort: SomeValue  # string
    httpSecure: True  # boolean
    httpUserName: SomeValue  # string
    merakiOrgId:
    - SomeValue  # string
    netconfPort: SomeValue  # string
    serialNumber: SomeValue  # string
    snmpVersion: SomeValue  # string
    type: # valid values are 'COMPUTE_DEVICE',
      # 'MERAKI_DASHBOARD',
      # 'NETWORK_DEVICE',
      # 'NODATACHANGE'.
      SomeValue  # string
    updateMgmtIPaddressList:
    - existMgmtIpAddress: SomeValue  # string
      newMgmtIpAddress: SomeValue  # string

- name: sync_devices
  cisco.dnac.network_device:
    state: update  # required
    cliTransport: SomeValue  # string, required
    enablePassword: SomeValue  # string, required
    ipAddress:  # required
    - SomeValue  # string
    password: SomeValue  # string, required
    snmpAuthPassphrase: SomeValue  # string, required
    snmpAuthProtocol: SomeValue  # string, required
    snmpMode: SomeValue  # string, required
    snmpPrivPassphrase: SomeValue  # string, required
    snmpPrivProtocol: SomeValue  # string, required
    snmpROCommunity: SomeValue  # string, required
    snmpRWCommunity: SomeValue  # string, required
    snmpRetry: 1  #  integer, required
    snmpTimeout: 1  #  integer, required
    snmpUserName: SomeValue  # string, required
    userName: SomeValue  # string, required
    computeDevice: True  # boolean
    extendedDiscoveryInfo: SomeValue  # string
    httpPassword: SomeValue  # string
    httpPort: SomeValue  # string
    httpSecure: True  # boolean
    httpUserName: SomeValue  # string
    merakiOrgId:
    - SomeValue  # string
    netconfPort: SomeValue  # string
    serialNumber: SomeValue  # string
    snmpVersion: SomeValue  # string
    type: # valid values are 'COMPUTE_DEVICE',
      # 'MERAKI_DASHBOARD',
      # 'NETWORK_DEVICE',
      # 'NODATACHANGE'.
      SomeValue  # string
    updateMgmtIPaddressList:
    - existMgmtIpAddress: SomeValue  # string
      newMgmtIpAddress: SomeValue  # string

- name: delete_device_by_id
  cisco.dnac.network_device:
    state: delete  # required
    id: SomeValue  # string, required
    is_force_delete: True  # boolean

- name: get_device_by_id
  cisco.dnac.network_device:
    state: query  # required
    id: SomeValue  # string, required
  register: nm_get_device_by_id

- name: get_device_summary
  cisco.dnac.network_device:
    state: query  # required
    id: SomeValue  # string, required
    summary: True  # boolean, required
  register: nm_get_device_summary

- name: get_network_device_by_pagination_range
  cisco.dnac.network_device:
    state: query  # required
    records_to_return: 1  #  integer, required
    start_index: 1  #  integer, required
  register: nm_get_network_device_by_pagination_range

- name: get_device_count
  cisco.dnac.network_device:
    state: query  # required
    count: True  # boolean, required
  register: nm_get_device_count

- name: get_network_device_by_ip
  cisco.dnac.network_device:
    state: query  # required
    ip_address: SomeValue  # string, required
  register: nm_get_network_device_by_ip

- name: get_device_by_serial_number
  cisco.dnac.network_device:
    state: query  # required
    serial_number: SomeValue  # string, required
  register: nm_get_device_by_serial_number

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
dnac_response
dictionary
always
A dictionary with the response returned by the DNA Center Python SDK

Sample:
{'response': 29, 'version': '1.0'}
missing_params
list / elements=string
when the function request schema is not satisfied
Provided arguments do not comply with the schema of the DNA Center Python SDK function

sdk_function
string
always
The DNA Center SDK function used to execute the task

Sample:
devices.add_device


Authors

  • Rafael Campos (@racampos)