-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Network Device indicator create incident buttons with tests
CreateCustomizedNetopsIncidentButton script introduced to be able to create Device Upgrade and Upgrade Assurance incidents in Network Device page with assurance test configuration.
- Loading branch information
1 parent
3585261
commit d53311f
Showing
5 changed files
with
160 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ices/Scripts/CreateCustomizedNetopsIncidentButton/CreateCustomizedNetopsIncidentButton.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import demistomock as demisto # noqa: F401 | ||
from CommonServerPython import * # noqa: F401 | ||
|
||
|
||
|
||
""" | ||
This script is executed whenever an associated button in the Network Device indicator layout is pressed. | ||
""" | ||
|
||
|
||
def main(): | ||
args = demisto.args() | ||
indicator = args.get("indicator") | ||
target = str(indicator["value"]) | ||
# Target for Panorama Device will be IP, not serial. | ||
if indicator.get("indicator_type") == "Panorama Device": | ||
target = str(indicator.get("CustomFields").get("panoramahostname")) | ||
if not target: | ||
target = str(indicator.get("CustomFields").get("ipaddress")) | ||
|
||
incident_type = args.get("incident_type") | ||
readiness_checklist = args.get("readiness_checklist") | ||
min_content_version = args.get("min_content_version") | ||
arp_entry_exists = args.get("arp_entry_exists") | ||
session_exists = args.get("session_exists") | ||
ipsec_tunnel = args.get("ipsec_tunnel") | ||
dp_mp_clock_diff = args.get("dp_mp_clock_diff") | ||
|
||
# Get pan-os instance name | ||
panos = str(indicator.get("CustomFields").get('panoramainstance')) | ||
|
||
res = demisto.executeCommand("createNewIncident", { | ||
"name": f"{target} - {incident_type}", | ||
"type": incident_type, | ||
"panosnetworkoperationstarget": target, | ||
"panosnetworkoperationspanoramainstance": panos, | ||
"readinesschecklist": readiness_checklist, | ||
"minimumcontentversion": min_content_version, | ||
"checkarpentryexists": arp_entry_exists, | ||
"checksessionexists": session_exists, | ||
"ipsectunnel": ipsec_tunnel, | ||
"dpmpclockdiff": dp_mp_clock_diff | ||
}) | ||
|
||
created_incident = res[0] | ||
id = created_incident.get("EntryContext", dict()).get("CreatedIncidentID") | ||
|
||
demisto.executeCommand("associateIndicatorToIncident", {"incidentId": id, "value": indicator["value"]}) | ||
|
||
|
||
''' ENTRY POINT ''' | ||
|
||
|
||
if __name__ in ('__main__', '__builtin__', 'builtins'): | ||
main() |
49 changes: 49 additions & 0 deletions
49
...ces/Scripts/CreateCustomizedNetopsIncidentButton/CreateCustomizedNetopsIncidentButton.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
args: | ||
- description: incident type | ||
isArray: true | ||
name: incident_type | ||
required: true | ||
- auto: PREDEFINED | ||
description: The list of checks to run. Checks with inputs are skipped if relevant check is not selected in the checklist. | ||
isArray: true | ||
name: readiness_checklist | ||
predefined: | ||
- panorama | ||
- ntp_sync | ||
- ha | ||
- candidate_config | ||
- expired_licenses | ||
- active_support | ||
- content_version | ||
- session_exist | ||
- arp | ||
- ipsec_tunnel | ||
- dp_mp_clock_diff | ||
- description: The minimum content version to test against. Checks for latest content version if not provided. | ||
name: min_content_version | ||
- description: Checks if the given IP is in the ARP table before starting upgrade. | ||
name: arp_entry_exists | ||
- description: Check for the presence of a specific session in the session table before upgrade starts (source_ip/destination_ip/port). | ||
name: session_exists | ||
- description: IPsec tunnel name to check if it's in active state. | ||
name: ipsec_tunnel | ||
- description: Max. clock difference in seconds between data plane and management plane. | ||
name: dp_mp_clock_diff | ||
comment: Indicator layout button to create customized panos netops incidents. | ||
commonfields: | ||
id: 'CreateCustomizedNetopsIncidentButton' | ||
version: -1 | ||
dockerimage: demisto/python3:3.11.10.113941 | ||
enabled: true | ||
engineinfo: {} | ||
mainengineinfo: {} | ||
name: CreateCustomizedNetopsIncidentButton | ||
pswd: "" | ||
runas: DBotWeakRole | ||
runonce: false | ||
script: '' | ||
scripttarget: 0 | ||
subtype: python3 | ||
tags: | ||
- indicator-action-button | ||
type: python |
Empty file.