| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright (c) 2021, Cisco Systems |
| 5 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
module: organizations_devices_packet_capture_captures |
| 9 |
short_description: Resource module for organizations _devices _packet _capture _captures |
| 10 |
description: |
| 11 |
- Manage operations create and delete of the resource organizations _devices _packet |
| 12 |
_capture _captures. |
| 13 |
- > |
| 14 |
Perform a packet capture on a device and store in Meraki Cloud. Only a single |
| 15 |
switch may be chosen per request, while multiple access points are allowed at |
| 16 |
once. |
| 17 |
- Delete a single packet capture from cloud using captureId. |
| 18 |
version_added: '1.0.0' |
| 19 |
extends_documentation_fragment: |
| 20 |
- cisco.meraki.module |
| 21 |
author: Francisco Munoz (@fmunoz) |
| 22 |
options: |
| 23 |
advanced: |
| 24 |
description: Advanced filters for IOSXE devices (supported for Campus Gateway |
| 25 |
devices only). |
| 26 |
suboptions: |
| 27 |
bufferFiles: |
| 28 |
description: Number of buffer files for circular buffer capture (1-5 for Campus |
| 29 |
Gateway devices). |
| 30 |
type: int |
| 31 |
captureType: |
| 32 |
description: Type of capture. Possible values linear (default), circular. |
| 33 |
type: str |
| 34 |
controlPlaneDirection: |
| 35 |
description: Direction for control plane capture. |
| 36 |
type: str |
| 37 |
innerFilterMacs: |
| 38 |
description: Inner MAC address filter for tunneled traffic (up to 5 MAC addresses |
| 39 |
for Campus Gateway devices). |
| 40 |
elements: str |
| 41 |
type: list |
| 42 |
maxFilesize: |
| 43 |
description: Maximum file size in megabytes (MB). Range 1-100 MB when bufferFiles=1, |
| 44 |
1-500 MB when bufferFiles=2-5. |
| 45 |
type: int |
| 46 |
packetsPerSecond: |
| 47 |
description: Packets per second limit for Campus Gateway devices (1-1000000). |
| 48 |
type: int |
| 49 |
physicalInterfaceDirection: |
| 50 |
description: Direction for physical interface capture. |
| 51 |
type: str |
| 52 |
type: dict |
| 53 |
captureId: |
| 54 |
description: CaptureId path parameter. Capture ID. |
| 55 |
type: str |
| 56 |
destination: |
| 57 |
description: Destination of packet capture file. Possible values upload_to_cloud. |
| 58 |
type: str |
| 59 |
duration: |
| 60 |
description: Duration in seconds of packet capture. |
| 61 |
type: int |
| 62 |
filterExpression: |
| 63 |
description: Filter expression for packet capture. |
| 64 |
type: str |
| 65 |
interface: |
| 66 |
description: Interface of the device. |
| 67 |
type: str |
| 68 |
name: |
| 69 |
description: Name of packet capture file. |
| 70 |
type: str |
| 71 |
notes: |
| 72 |
description: Reason for taking the packet capture. |
| 73 |
type: str |
| 74 |
organizationId: |
| 75 |
description: OrganizationId path parameter. Organization ID. |
| 76 |
type: str |
| 77 |
outputType: |
| 78 |
description: Output type of packet capture file. Possible values text, pcap, cloudshark, |
| 79 |
or upload_to_cloud. |
| 80 |
type: str |
| 81 |
ports: |
| 82 |
description: Ports of packet capture file, comma-separated. |
| 83 |
type: str |
| 84 |
serials: |
| 85 |
description: The serial(s) of the device(s). |
| 86 |
elements: str |
| 87 |
type: list |
| 88 |
requirements: |
| 89 |
- meraki >= 2.4.9 |
| 90 |
- python >= 3.5 |
| 91 |
seealso: |
| 92 |
- name: Cisco Meraki documentation for organizations createOrganizationDevicesPacketCaptureCapture |
| 93 |
description: Complete reference of the createOrganizationDevicesPacketCaptureCapture |
| 94 |
API. |
| 95 |
link: https://developer.cisco.com/meraki/api-v1/#!create-organization-devices-packet-capture-capture |
| 96 |
- name: Cisco Meraki documentation for organizations deleteOrganizationDevicesPacketCaptureCapture |
| 97 |
description: Complete reference of the deleteOrganizationDevicesPacketCaptureCapture |
| 98 |
API. |
| 99 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-packet-capture-capture |
| 100 |
notes: |
| 101 |
- SDK Method used are |
| 102 |
organizations.Organizations.create_organization_devices_packet_capture_capture, |
| 103 |
organizations.Organizations.delete_organization_devices_packet_capture_capture, |
| 104 |
- Paths used are |
| 105 |
post /organizations/{organizationId}/devices/packetCapture/captures, |
| 106 |
delete /organizations/{organizationId}/devices/packetCapture/captures/{captureId}, |
| 107 |
""" |
| 108 |
|
| 109 |
EXAMPLES = r""" |
| 110 |
- name: Create |
| 111 |
cisco.meraki.organizations_devices_packet_capture_captures: |
| 112 |
meraki_api_key: "{{ meraki_api_key }}" |
| 113 |
meraki_base_url: "{{ meraki_base_url }}" |
| 114 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 115 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 116 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 117 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 118 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 119 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 120 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 121 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 122 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 123 |
meraki_output_log: "{{ meraki_output_log }}" |
| 124 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 125 |
meraki_log_path: "{{ meraki_log_path }}" |
| 126 |
meraki_print_console: "{{ meraki_print_console }}" |
| 127 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 128 |
meraki_simulate: "{{ meraki_simulate }}" |
| 129 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 130 |
meraki_caller: "{{ meraki_caller }}" |
| 131 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 132 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 133 |
state: present |
| 134 |
advanced: |
| 135 |
bufferFiles: 5 |
| 136 |
captureType: circular |
| 137 |
controlPlaneDirection: both |
| 138 |
innerFilterMacs: |
| 139 |
- aa:bb:cc:dd:ee:ff |
| 140 |
- 11:22:33:44:55:66 |
| 141 |
maxFilesize: 10 |
| 142 |
packetsPerSecond: 10000 |
| 143 |
physicalInterfaceDirection: both |
| 144 |
destination: upload_to_cloud |
| 145 |
duration: 3 |
| 146 |
filterExpression: host 10.1.27.253 |
| 147 |
interface: wireless |
| 148 |
name: Capture no. 3 |
| 149 |
notes: Debugging connectivity issue... |
| 150 |
organizationId: string |
| 151 |
outputType: upload_to_cloud |
| 152 |
ports: 1, 3 |
| 153 |
serials: |
| 154 |
- Q234-ABCD-5678 |
| 155 |
- name: Delete by id |
| 156 |
cisco.meraki.organizations_devices_packet_capture_captures: |
| 157 |
meraki_api_key: "{{ meraki_api_key }}" |
| 158 |
meraki_base_url: "{{ meraki_base_url }}" |
| 159 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 160 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 161 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 162 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 163 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 164 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 165 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 166 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 167 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 168 |
meraki_output_log: "{{ meraki_output_log }}" |
| 169 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 170 |
meraki_log_path: "{{ meraki_log_path }}" |
| 171 |
meraki_print_console: "{{ meraki_print_console }}" |
| 172 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 173 |
meraki_simulate: "{{ meraki_simulate }}" |
| 174 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 175 |
meraki_caller: "{{ meraki_caller }}" |
| 176 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 177 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 178 |
state: absent |
| 179 |
captureId: string |
| 180 |
organizationId: string |
| 181 |
""" |
| 182 |
RETURN = r""" |
| 183 |
meraki_response: |
| 184 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 185 |
returned: always |
| 186 |
type: dict |
| 187 |
sample: > |
| 188 |
{ |
| 189 |
"captureId": "string", |
| 190 |
"network": { |
| 191 |
"id": "string", |
| 192 |
"name": "string" |
| 193 |
}, |
| 194 |
"devices": [ |
| 195 |
{} |
| 196 |
], |
| 197 |
"device": { |
| 198 |
"name": "string", |
| 199 |
"serial": "string" |
| 200 |
}, |
| 201 |
"admin": { |
| 202 |
"id": "string", |
| 203 |
"name": "string" |
| 204 |
}, |
| 205 |
"client": { |
| 206 |
"id": "string", |
| 207 |
"mac": "string" |
| 208 |
}, |
| 209 |
"details": [ |
| 210 |
{ |
| 211 |
"name": "string", |
| 212 |
"value": "string", |
| 213 |
"productType": "string" |
| 214 |
} |
| 215 |
], |
| 216 |
"name": "string", |
| 217 |
"startTs": "string", |
| 218 |
"ports": "string", |
| 219 |
"status": "string", |
| 220 |
"errorMessage": "string", |
| 221 |
"destination": "string", |
| 222 |
"process": "string", |
| 223 |
"file": { |
| 224 |
"size": 0 |
| 225 |
}, |
| 226 |
"duration": 0, |
| 227 |
"filterExpression": "string", |
| 228 |
"counts": { |
| 229 |
"packets": { |
| 230 |
"total": 0 |
| 231 |
} |
| 232 |
}, |
| 233 |
"interface": "string" |
| 234 |
} |
| 235 |
""" |