| 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_schedules |
| 9 |
short_description: Resource module for organizations _devices _packet _capture _schedules |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource organizations _devices |
| 12 |
_packet _capture _schedules. |
| 13 |
- Create a schedule for packet capture. |
| 14 |
- Delete schedule from cloud. |
| 15 |
- Update a schedule for packet capture. |
| 16 |
version_added: '1.0.0' |
| 17 |
extends_documentation_fragment: |
| 18 |
- cisco.meraki.module |
| 19 |
author: Francisco Munoz (@fmunoz) |
| 20 |
options: |
| 21 |
devices: |
| 22 |
description: Device details. |
| 23 |
elements: dict |
| 24 |
suboptions: |
| 25 |
interface: |
| 26 |
description: Interface to capture. |
| 27 |
type: str |
| 28 |
serial: |
| 29 |
description: Serial of the devices to schedule packet capture. |
| 30 |
type: str |
| 31 |
switchports: |
| 32 |
description: Switchports to capture. |
| 33 |
type: str |
| 34 |
type: list |
| 35 |
duration: |
| 36 |
description: Duration of the capture in seconds. |
| 37 |
type: int |
| 38 |
enabled: |
| 39 |
description: Enable or disable the schedule. |
| 40 |
type: bool |
| 41 |
filterExpression: |
| 42 |
description: Filter expression for the capture. |
| 43 |
type: str |
| 44 |
name: |
| 45 |
description: Name of the packet capture file. |
| 46 |
type: str |
| 47 |
notes: |
| 48 |
description: Reason for capture. |
| 49 |
type: str |
| 50 |
organizationId: |
| 51 |
description: OrganizationId path parameter. Organization ID. |
| 52 |
type: str |
| 53 |
schedule: |
| 54 |
description: Schedule details. |
| 55 |
suboptions: |
| 56 |
endTs: |
| 57 |
description: End date and time of the recurring schedule entry. |
| 58 |
type: str |
| 59 |
frequency: |
| 60 |
description: Frequency of the recurring schedule entry (hour, week, month, |
| 61 |
day, minute). |
| 62 |
type: str |
| 63 |
name: |
| 64 |
description: Name of the schedule. |
| 65 |
type: str |
| 66 |
recurrence: |
| 67 |
description: Cardinality of the schedule frequency, ex. 1 = every day, 2 = |
| 68 |
every other day (when frequency = day). |
| 69 |
type: int |
| 70 |
startTs: |
| 71 |
description: Start date and time of the recurring schedule entry. |
| 72 |
type: str |
| 73 |
weekdays: |
| 74 |
description: Weekdays for the schedule Sunday, Monday, Tuesday, Wednesday, |
| 75 |
Thursday, Friday, Saturday. |
| 76 |
elements: str |
| 77 |
type: list |
| 78 |
type: dict |
| 79 |
scheduleId: |
| 80 |
description: ScheduleId path parameter. Schedule ID. |
| 81 |
type: str |
| 82 |
requirements: |
| 83 |
- meraki >= 2.4.9 |
| 84 |
- python >= 3.5 |
| 85 |
seealso: |
| 86 |
- name: Cisco Meraki documentation for organizations createOrganizationDevicesPacketCaptureSchedule |
| 87 |
description: Complete reference of the createOrganizationDevicesPacketCaptureSchedule |
| 88 |
API. |
| 89 |
link: https://developer.cisco.com/meraki/api-v1/#!create-organization-devices-packet-capture-schedule |
| 90 |
- name: Cisco Meraki documentation for organizations deleteOrganizationDevicesPacketCaptureSchedule |
| 91 |
description: Complete reference of the deleteOrganizationDevicesPacketCaptureSchedule |
| 92 |
API. |
| 93 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-packet-capture-schedule |
| 94 |
- name: Cisco Meraki documentation for organizations updateOrganizationDevicesPacketCaptureSchedule |
| 95 |
description: Complete reference of the updateOrganizationDevicesPacketCaptureSchedule |
| 96 |
API. |
| 97 |
link: https://developer.cisco.com/meraki/api-v1/#!update-organization-devices-packet-capture-schedule |
| 98 |
notes: |
| 99 |
- SDK Method used are |
| 100 |
organizations.Organizations.create_organization_devices_packet_capture_schedule, |
| 101 |
organizations.Organizations.delete_organization_devices_packet_capture_schedule, |
| 102 |
organizations.Organizations.update_organization_devices_packet_capture_schedule, |
| 103 |
- Paths used are |
| 104 |
post /organizations/{organizationId}/devices/packetCapture/schedules, |
| 105 |
delete /organizations/{organizationId}/devices/packetCapture/schedules/{scheduleId}, |
| 106 |
put /organizations/{organizationId}/devices/packetCapture/schedules/{scheduleId}, |
| 107 |
""" |
| 108 |
|
| 109 |
EXAMPLES = r""" |
| 110 |
- name: Create |
| 111 |
cisco.meraki.organizations_devices_packet_capture_schedules: |
| 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 |
devices: |
| 135 |
- interface: TenGigabitEthernet0/0/0 |
| 136 |
serial: Q234-ABCD-5678 |
| 137 |
switchports: 1, 2 |
| 138 |
duration: 60 |
| 139 |
enabled: true |
| 140 |
filterExpression: (icmp) |
| 141 |
name: daily_capture_for_debugging |
| 142 |
notes: Debugging persistent issue on device |
| 143 |
organizationId: string |
| 144 |
schedule: |
| 145 |
endTs: '2021-01-01T14:00:00Z' |
| 146 |
frequency: daily |
| 147 |
name: Daily at 1pm |
| 148 |
recurrence: 1 |
| 149 |
startTs: '2021-01-01T13:00:00Z' |
| 150 |
weekdays: |
| 151 |
- Monday |
| 152 |
- Wednesday |
| 153 |
- Friday |
| 154 |
- name: Update by id |
| 155 |
cisco.meraki.organizations_devices_packet_capture_schedules: |
| 156 |
meraki_api_key: "{{ meraki_api_key }}" |
| 157 |
meraki_base_url: "{{ meraki_base_url }}" |
| 158 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 159 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 160 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 161 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 162 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 163 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 164 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 165 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 166 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 167 |
meraki_output_log: "{{ meraki_output_log }}" |
| 168 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 169 |
meraki_log_path: "{{ meraki_log_path }}" |
| 170 |
meraki_print_console: "{{ meraki_print_console }}" |
| 171 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 172 |
meraki_simulate: "{{ meraki_simulate }}" |
| 173 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 174 |
meraki_caller: "{{ meraki_caller }}" |
| 175 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 176 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 177 |
state: present |
| 178 |
devices: |
| 179 |
- interface: TenGigabitEthernet0/0/0 |
| 180 |
serial: Q234-ABCD-5678 |
| 181 |
switchports: 1, 2 |
| 182 |
duration: 60 |
| 183 |
enabled: true |
| 184 |
filterExpression: (icmp) |
| 185 |
name: daily_capture_for_debugging |
| 186 |
notes: Debugging persistent issue on device |
| 187 |
organizationId: string |
| 188 |
schedule: |
| 189 |
endTs: '2021-01-01T14:00:00Z' |
| 190 |
frequency: daily |
| 191 |
name: Daily at 1pm |
| 192 |
recurrence: 1 |
| 193 |
startTs: '2021-01-01T13:00:00Z' |
| 194 |
weekdays: |
| 195 |
- Monday |
| 196 |
- Wednesday |
| 197 |
- Friday |
| 198 |
scheduleId: string |
| 199 |
- name: Delete by id |
| 200 |
cisco.meraki.organizations_devices_packet_capture_schedules: |
| 201 |
meraki_api_key: "{{ meraki_api_key }}" |
| 202 |
meraki_base_url: "{{ meraki_base_url }}" |
| 203 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 204 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 205 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 206 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 207 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 208 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 209 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 210 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 211 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 212 |
meraki_output_log: "{{ meraki_output_log }}" |
| 213 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 214 |
meraki_log_path: "{{ meraki_log_path }}" |
| 215 |
meraki_print_console: "{{ meraki_print_console }}" |
| 216 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 217 |
meraki_simulate: "{{ meraki_simulate }}" |
| 218 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 219 |
meraki_caller: "{{ meraki_caller }}" |
| 220 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 221 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 222 |
state: absent |
| 223 |
organizationId: string |
| 224 |
scheduleId: string |
| 225 |
""" |
| 226 |
RETURN = r""" |
| 227 |
meraki_response: |
| 228 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 229 |
returned: always |
| 230 |
type: dict |
| 231 |
sample: > |
| 232 |
{ |
| 233 |
"scheduleId": "string", |
| 234 |
"devices": [ |
| 235 |
{ |
| 236 |
"device": { |
| 237 |
"serial": "string", |
| 238 |
"switchports": "string", |
| 239 |
"interface": "string" |
| 240 |
} |
| 241 |
} |
| 242 |
], |
| 243 |
"name": "string", |
| 244 |
"admin": { |
| 245 |
"id": "string", |
| 246 |
"name": "string" |
| 247 |
}, |
| 248 |
"notes": "string", |
| 249 |
"duration": 0, |
| 250 |
"filterExpression": "string", |
| 251 |
"createdAt": "string", |
| 252 |
"updatedAt": "string", |
| 253 |
"captureCount": 0, |
| 254 |
"lastCaptureId": "string", |
| 255 |
"enabled": true, |
| 256 |
"priority": 0, |
| 257 |
"schedule": { |
| 258 |
"name": "string", |
| 259 |
"startTs": "string", |
| 260 |
"endTs": "string", |
| 261 |
"frequency": "string", |
| 262 |
"weekdays": [ |
| 263 |
"string" |
| 264 |
], |
| 265 |
"recurrence": 0, |
| 266 |
"nextCaptureTs": "string" |
| 267 |
}, |
| 268 |
"warnings": [ |
| 269 |
"string" |
| 270 |
] |
| 271 |
} |
| 272 |
""" |