-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetevents.py
More file actions
733 lines (575 loc) · 25.2 KB
/
getevents.py
File metadata and controls
733 lines (575 loc) · 25.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#! /usr/bin/env python
"""
Get Prisma SDWAN Events
tkamath@paloaltonetworks.com
Version: 1.0.0b8
"""
import pandas as pd
import json
import os
import sys
import datetime
import yaml
import json
import netaddr
import ipaddress
import argparse
import codecs
import csv
import cloudgenix
import cloudgenix_idname
import math
# bar
from progressbar import Bar, ETA, Percentage, ProgressBar
# Global Vars
SDK_VERSION = cloudgenix.version
SCRIPT_NAME = 'CloudGenix: Get Events Script'
SCRIPT_VERSION = "1.0.0b8"
# Process tags
SITES = "sites"
ELEMENTS = "elements"
INTERFACES = "interfaces"
WANINTERFACES = "waninterfaces"
RANGE = "RANGE"
xlate_info = ["network_directinternet_down", "network_vpnlink_down",
"network_vpnss_unavailable", "network_vpnpeer_unreachable", "network_vpnss_mismatch",
"network_directprivate_down", "network_vpnpeer_unavailable", "network_vpnbfd_down"]
try:
from cloudgenix_settings import CLOUDGENIX_AUTH_TOKEN
except ImportError:
# will get caught below.
# Get AUTH_TOKEN/X_AUTH_TOKEN from env variable, if it exists. X_AUTH_TOKEN takes priority.
if "X_AUTH_TOKEN" in os.environ:
CLOUDGENIX_AUTH_TOKEN = os.environ.get('X_AUTH_TOKEN')
elif "AUTH_TOKEN" in os.environ:
CLOUDGENIX_AUTH_TOKEN = os.environ.get('AUTH_TOKEN')
else:
# not set
CLOUDGENIX_AUTH_TOKEN = None
try:
from cloudgenix_settings import CLOUDGENIX_USER, CLOUDGENIX_PASSWORD
except ImportError:
# will get caught below
CLOUDGENIX_USER = None
CLOUDGENIX_PASSWORD = None
def get_events(cgx_session, numhours, starttime, endtime, event_codes, sitelist):
global eventsdf
eventsdf = pd.DataFrame()
if numhours == RANGE:
start_time_iso = starttime.isoformat() + "Z"
end_time_iso = endtime.isoformat() + "Z"
else:
current_time = datetime.datetime.utcnow().replace(second=0, microsecond=0)
start_time = current_time - datetime.timedelta(hours= numhours)
start_time_iso = start_time.isoformat() + "Z"
end_time_iso = None
eventlist = []
#
# Get matching set of events.
#
events_query_payload = {
"limit":
{
"count": 100,
"sort_on": "time",
"sort_order": "descending"
},
"query": {
"code": event_codes,
"site": sitelist
},
"severity": [],
"start_time":start_time_iso,
"end_time":end_time_iso
}
more_events=True
while more_events:
print ("INFO: Getting {0} starting from {1} using query {2}".format(event_codes, start_time_iso, json.dumps(events_query_payload)))
resp = cgx_session.post.events_query(data=events_query_payload, api_version='v3.1')
if resp.cgx_status:
eventlist = resp.cgx_content.get("items", None)
dp = pd.DataFrame(eventlist)
if len(dp)>0:
seta = set(dp.id.unique())
if len(eventsdf) > 0:
setb = set(eventsdf.id.unique())
duplicates = list(seta & setb)
if duplicates:
print("\n\n!!!!! Duplicate event returned !!!!!")
print("{}\n\n".format(duplicates))
for id in duplicates:
print("Removing duplicate event {} from dp".format(id))
dp = dp[dp.id != id]
print("\n\n")
eventsdf = pd.concat([eventsdf,dp], ignore_index=True)
offset = resp.cgx_content['_offset']
print ("\tTotal events: {0}. Events Retrieved: {1}. Events Pending: {2}".format(resp.cgx_content['total_count'],resp.cgx_content['included_count'], (resp.cgx_content['total_count']-resp.cgx_content['included_count']) ))
if offset:
events_query_payload['_offset'] = offset
more_events = True
else:
more_events = False
else:
print ("ERR: Failed to get events: {}".format(resp.cgx_content))
print(cloudgenix.jd_detailed(resp))
more_events = False
return []
# Get Standing events:
standingevents_query_payload = {
"limit":
{
"count": 100,
"sort_on": "time",
"sort_order": "descending"
},
"query": {
"code": event_codes,
"site": sitelist
},
"severity": [],
"start_time": None,
"end_time": None
}
print("INFO: Getting standing alarms")
more_events = True
while more_events:
print ("INFO: Getting {0} starting from {1} using query {2}".format(event_codes, start_time_iso,
json.dumps(standingevents_query_payload)))
resp = cgx_session.post.events_query(data=standingevents_query_payload)
if resp.cgx_status:
eventlist = resp.cgx_content.get("items", None)
dp = pd.DataFrame(eventlist)
if len(dp) > 0:
seta = set(dp.id.unique())
if len(eventsdf) > 0:
setb = set(eventsdf.id.unique())
duplicates = list(seta & setb)
if duplicates:
print("\n\n!!!!! Duplicate event returned !!!!!")
print("{}".format(duplicates))
for id in duplicates:
print("Removing duplicate event {} from dp".format(id))
dp = dp[dp.id != id]
print("\n\n")
eventsdf = pd.concat([eventsdf, dp], ignore_index=True)
offset = resp.cgx_content['_offset']
print ("\tTotal events: {0}. Events Retrieved: {1}. Events Pending: {2}".format(
resp.cgx_content['total_count'], resp.cgx_content['included_count'],
(resp.cgx_content['total_count'] - resp.cgx_content['included_count'])))
if offset:
standingevents_query_payload['_offset'] = offset
more_events = True
else:
more_events = False
else:
print ("ERR: Failed to get events: {}".format(resp.cgx_content))
print(cloudgenix.jd_detailed(resp))
more_events = False
return []
print("DEBUG: Saving raw events")
rawfile = os.path.join('./', 'cgxdebug_rawevents.csv')
eventsdf.to_csv(rawfile,index=False)
return eventsdf
def createdicts(cgx_session):
global elem_id_name_dict
global site_id_name_dict
global site_name_id_dict
global eid_sid_dict
global intf_id_name_dict
global swi_id_name_dict
global userid_username_dict
global path_id_name_dict
elem_id_name_dict = {}
site_id_name_dict = {}
site_name_id_dict = {}
eid_sid_dict = {}
intf_id_name_dict = {}
swi_id_name_dict = {}
userid_username_dict = {}
path_id_name_dict = {}
idname = cloudgenix_idname.CloudGenixIDName(cgx_session)
print("INFO: Building Translation dicts")
print("\tSites..")
site_id_name_dict = idname.generate_sites_map()
site_name_id_dict = idname.generate_sites_map(key_val='name',value_val='id')
print("\tElements..")
elem_id_name_dict = idname.generate_elements_map()
eid_sid_dict = idname.generate_elements_map(key_val='id',value_val='site_id')
print("\tInterfaces..")
intf_id_name_dict = idname.generate_interfaces_map()
print("\tSite WAN Interfaces..")
swi_id_name_dict = idname.generate_waninterfaces_map()
print("\tOperators..")
resp = cgx_session.get.operators_t()
if resp.cgx_status:
userlist = resp.cgx_content.get("items", None)
for user in userlist:
username = "{} {} ({})".format(user['first_name'], user.get('last_name', None), user['email'])
userid_username_dict[user['id']] = username
else:
print("ERR: Could not query for operators")
print(cloudgenix.jd_detailed(resp))
print("\tSecure Fabric links")
for siteid in site_id_name_dict.keys():
resp = cgx_session.post.topology(data={"type": "basenet", "nodes": [siteid], "links_only": True})
if resp.cgx_status:
links = resp.cgx_content.get("links", None)
for path in links:
if path["type"] in ["anynet", "public-anynet", "private-anynet"]:
# anynet link, get relevant names
source_site_name = path.get("source_site_name")
target_site_name = path.get("target_site_name")
source_wan_network = path.get("source_wan_network")
target_wan_network = path.get("target_wan_network")
source_circuit_name = path.get("source_circuit_name")
target_circuit_name = path.get("target_circuit_name")
# circuit names may be blank. Normalize.
if not source_circuit_name:
source_circuit_name = "Circuit to {0}".format(source_wan_network)
if not target_circuit_name:
target_circuit_name = "Circuit to {0}".format(target_wan_network)
pathname = "{0} ('{1}' via '{2}') <-> ('{3}' via '{4}') {5}".format(
source_site_name,
source_wan_network,
source_circuit_name,
target_circuit_name,
target_wan_network,
target_site_name
)
elif path["type"] in ["vpn"]:
# vpn link, get relevant names
source_site_name = path.get("source_site_name")
target_site_name = path.get("target_site_name")
source_wan_network = path.get("source_wan_network")
target_wan_network = path.get("target_wan_network")
source_circuit_name = path.get("source_circuit_name")
target_circuit_name = path.get("target_circuit_name")
# circuit names may be blank. Normalize.
if not source_circuit_name:
source_circuit_name = "Circuit to {0}".format(source_wan_network)
if not target_circuit_name:
target_circuit_name = "Circuit to {0}".format(target_wan_network)
# for vpn, get element names.
source_node_id = path.get("source_node_id")
source_element_name = elem_id_name_dict[source_node_id]
target_node_id = path.get("target_node_id")
target_element_name = elem_id_name_dict[target_node_id]
pathname = "[{0}] : {1} ('{2}' via '{3}') <-> ('{4}' via '{5}') {6} [{7}]".format(
source_element_name,
source_site_name,
source_wan_network,
source_circuit_name,
target_circuit_name,
target_wan_network,
target_site_name,
target_element_name
)
elif path["type"] in ["priv-wan-stub", "internet-stub"]:
# Stub (direct) links.
target_site_name = site_id_name_dict[path.get("target_node_id", "")]
if not target_site_name:
target_site_name = "UNKNOWN"
target_circuit_name = path.get("target_circuit_name")
network = path.get("network")
if not target_circuit_name:
target_circuit_name = "Circuit to {0}".format(network)
if path["type"]== "priv-wan-stub":
dest_name = "Direct Private WAN"
elif path["type"] == "internet-stub":
dest_name = "Direct Internet"
else:
dest_name = "UNKNOWN"
pathname = "{0} ('{1}' via '{2}') <-> {3}".format(
target_site_name,
network,
target_circuit_name,
dest_name
)
else:
continue
path_id_name_dict[path['path_id']] = pathname
return
def get_info(alarminfo):
if alarminfo:
peerid = alarminfo.get("peer_site_id", None)
anynetid = alarminfo.get("al_id",None)
vpn_link_id = alarminfo.get("vpn_link_id",None)
info = None
if peerid:
if peerid in site_id_name_dict.keys():
peersite = site_id_name_dict[peerid]
info = "Peer Site: {}".format(peersite)
if anynetid:
if anynetid in path_id_name_dict.keys():
info = path_id_name_dict[anynetid]
else:
info = "Could not query anynet link {}".format(anynetid)
if vpn_link_id:
if vpn_link_id in path_id_name_dict.keys():
info = path_id_name_dict[vpn_link_id]
else:
info = "Could not query vpn link {}".format(vpn_link_id)
if "element_id" in alarminfo.keys():
elemid = alarminfo.get("element_id",None)
interfaceid = alarminfo.get("interface_id",None)
iname = None
if interfaceid in intf_id_name_dict.keys():
iname = intf_id_name_dict[interfaceid]
if iname:
info = "Element: {}\nInterface: {}".format(elem_id_name_dict[elemid], iname)
else:
info = "Element: {}".format(elem_id_name_dict[elemid])
else:
info = "n/a"
return info
def get_entity(entity_ref):
entitymap = {}
tmp = entity_ref.split('/')
octets = len(tmp)
i = 0
returnval = ""
while i < octets:
entitymap[tmp[i]] = tmp[i + 1]
i += 2
for item in [SITES, ELEMENTS, INTERFACES, WANINTERFACES]:
if item in entitymap.keys():
if item == SITES:
if entitymap[item] in site_id_name_dict.keys():
entityname = "Site: " + site_id_name_dict[entitymap[item]]
else:
entityname = "Site: Unassigned"
elif item == ELEMENTS:
if entitymap[item] in elem_id_name_dict.keys():
entityname = "Element: " + elem_id_name_dict[entitymap[item]]
else:
entityname = "Element: Unknown"
elif item == INTERFACES:
sid = entitymap[SITES]
eid = entitymap[ELEMENTS]
iid = entitymap[INTERFACES]
interface = None
if iid in intf_id_name_dict.keys():
interface = intf_id_name_dict[iid]
# else:
# resp = cgx_session.get.interfaces(site_id=sid, element_id=eid, interface_id=iid)
# interface = resp.cgx_content.get("name", None)
if interface:
entityname = "Interface: " + interface
else:
entityname = "Interface: Unknown"
elif item == WANINTERFACES:
sid = entitymap[SITES]
swiid = entitymap[WANINTERFACES]
swi = None
if swiid in swi_id_name_dict.keys():
swi = swi_id_name_dict[swiid]
# else:
# resp = cgx_session.get.waninterfaces(site_id=sid, waninterface_id=swiid)
# swi = resp.cgx_content.get("name", None)
if swi:
entityname = "WAN Interface: " + swi
else:
entityname = "WAN Interface: Unknown"
else:
continue
returnval += entityname + " "
else:
continue
return returnval
def gettime_ms(x):
if "." in x:
date = datetime.datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%fZ")
else:
date = datetime.datetime.strptime(x, "%Y-%m-%dT%H:%M:%SZ")
time_ms = date.replace(microsecond=0)
time_ms = time_ms.isoformat() + "Z"
return time_ms
def gettime_sms(x):
if "." in x:
date = datetime.datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%fZ")
else:
date = datetime.datetime.strptime(x, "%Y-%m-%dT%H:%M:%SZ")
time_sms = date.replace(second=0, microsecond=0)
time_sms = time_sms.isoformat() + "Z"
return time_sms
def getsitename(elemid):
site = "Unassigned"
if elemid in eid_sid_dict.keys():
sid = eid_sid_dict[elemid]
if sid == "1":
site = "Unassigned"
else:
site = site_id_name_dict[sid]
return site
def getelemname(elemid):
ename = elemid
if elemid in elem_id_name_dict.keys():
ename = elem_id_name_dict[elemid]
return ename
def getackinfo(acknowledgementinfo):
acknowledgement_info = "n/a"
if acknowledgementinfo:
if isinstance(acknowledgementinfo, float):
return "N/A"
if "acknowledged_by" in acknowledgementinfo.keys():
ackuserid = acknowledgementinfo.get("acknowledged_by", None)
acktime = acknowledgementinfo.get("acknowledgement_time", None)
if ackuserid in userid_username_dict.keys():
ackuser = userid_username_dict[ackuserid]
else:
ackuser = ackuserid
acknowledgement_info = "User:{} Time:{}".format(ackuser, acktime)
return acknowledgement_info
def go():
############################################################################
# Begin Script, parse arguments.
############################################################################
# Parse arguments
parser = argparse.ArgumentParser(description="{0}.".format(SCRIPT_NAME))
# Allow Controller modification and debug level sets.
controller_group = parser.add_argument_group('API', 'These options change how this program connects to the API.')
controller_group.add_argument("--controller", "-C",
help="Controller URI, ex. "
"C-Prod: https://api.elcapitan.cloudgenix.com",
default="https://api.elcapitan.cloudgenix.com")
login_group = parser.add_argument_group('Login', 'These options allow skipping of interactive login')
login_group.add_argument("--email", "-E", help="Use this email as User Name instead of prompting",
default=None)
login_group.add_argument("--pass", "-P", help="Use this Password instead of prompting",
default=None)
# Commandline for entering Event Filters
site_group = parser.add_argument_group('Filters for events', 'The following attributes will be used to query events')
site_group.add_argument("--eventcodes", "-EC", help="List event codes you want to query for", default=None)
site_group.add_argument("--sitename", "-S", help="Name of the Site you want events filtered for. For multiple sites, separate names by using a comma.", default=None)
site_group.add_argument("--hour", "-H", help="Number of hours from now you need the events queried for. Or use the keyword RANGE to provide a time range", default=3)
site_group.add_argument("--starttime", "-ST", help="Start time in format YYYY-MM-DDTHH:MM:SSZ", default=None)
site_group.add_argument("--endtime", "-ET", help="End time in format YYYY-MM-DDTHH:MM:SSZ", default=None)
args = vars(parser.parse_args())
############################################################################
# Check if YAML config files was provided via CLI
############################################################################
eventcodes = args['eventcodes']
numhours = args['hour']
sitename = args['sitename']
starttime = args['starttime']
endtime = args['endtime']
stime = None
etime = None
if eventcodes is None:
print("WARN: No event codes listed. All events will be returned.")
if numhours is None:
print("ERR: Invalid number of hours.")
sys.exit()
if numhours == RANGE:
if starttime is None or endtime is None:
print("ERR: For time range, please provide both starttime and endtime in format YYYY-MM-DDTHH:MM:SSZ")
sys.exit()
else:
if "." in starttime:
stime = datetime.datetime.strptime(starttime, "%Y-%m-%dT%H:%M:%S.%fZ")
else:
stime = datetime.datetime.strptime(starttime, "%Y-%m-%dT%H:%M:%SZ")
if "." in endtime:
etime = datetime.datetime.strptime(endtime, "%Y-%m-%dT%H:%M:%S.%fZ")
else:
etime = datetime.datetime.strptime(endtime, "%Y-%m-%dT%H:%M:%SZ")
else:
numhours = int(numhours)
if numhours <= 0:
print("ERR: Invalid number of hours.")
sys.exit()
if sitename is None:
print("INFO: No site filter configured. All events will be returned")
############################################################################
# Instantiate API & Login
############################################################################
cgx_session = cloudgenix.API(controller=args["controller"], ssl_verify=False)
print("{0} v{1} ({2})\n".format(SCRIPT_NAME, SDK_VERSION, cgx_session.controller))
# login logic. Use cmdline if set, use AUTH_TOKEN next, finally user/pass from config file, then prompt.
# figure out user
if args["email"]:
user_email = args["email"]
elif CLOUDGENIX_USER:
user_email = CLOUDGENIX_USER
else:
user_email = None
# figure out password
if args["pass"]:
user_password = args["pass"]
elif CLOUDGENIX_PASSWORD:
user_password = CLOUDGENIX_PASSWORD
else:
user_password = None
# check for token
if CLOUDGENIX_AUTH_TOKEN and not args["email"] and not args["pass"]:
cgx_session.interactive.use_token(CLOUDGENIX_AUTH_TOKEN)
if cgx_session.tenant_id is None:
print("AUTH_TOKEN login failure, please check token.")
sys.exit()
else:
while cgx_session.tenant_id is None:
cgx_session.interactive.login(user_email, user_password)
# clear after one failed login, force relogin.
if not cgx_session.tenant_id:
user_email = None
user_password = None
############################################################################
# Build Site translation dict
############################################################################
createdicts(cgx_session)
sitelist = []
if sitename is not None:
sitename = sitename.replace(", ",",")
sites = sitename.split(",")
for site in sites:
if site in site_name_id_dict.keys():
sitelist.append(site_name_id_dict[site])
continue
else:
print("ERR: Site {} does not exist on the tenant. Please re-enter site name(s)".format(site))
sys.exit()
############################################################################
# Get Events
############################################################################
event_codes = []
if eventcodes:
eventcodes = eventcodes.replace(" ","")
event_codes = eventcodes.split(",")
events = get_events(cgx_session, numhours, stime, etime, event_codes, sitelist)
if len(events) == 0:
print("WARN: No events retrieved")
print("Logging out")
cgx_session.get.logout()
sys.exit()
#events = events.fillna("n/a")
events['time_ms'] = events['time'].apply(gettime_ms)
events['time_sms'] = events['time'].apply(gettime_sms)
events['entity_ref_text'] = events['entity_ref'].apply(get_entity)
events['info_text'] = events['info'].apply(get_info)
events['site'] = events['element_id'].apply(getsitename)
events['element'] = events['element_id'].apply(getelemname)
events['acknowledgement_info'] = events['acknowledgement_info'].apply(getackinfo)
events = events.drop(columns=["_etag","_created_on_utc","_updated_on_utc"])
############################################################################
# Write to CSV
############################################################################
# get time now.
curtime_str = datetime.datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S')
# create file-system friendly tenant str.
tenant_str = "".join(x for x in cgx_session.tenant_name if x.isalnum()).lower()
# Set filenames
csvfile = os.path.join('./', '%s_events_%s.csv' %(tenant_str, curtime_str))
print("INFO: Writing events to file {}".format(csvfile))
events.to_csv(csvfile, index=False)
rawfile = os.path.join('./', 'cgxdebug_rawevents.csv')
if os.path.exists(rawfile):
print("DEBUG: Deleting raw events")
os.remove(rawfile)
############################################################################
# Logout and exit script
############################################################################
print("INFO: Logging out.")
cgx_session.get.logout()
return
if __name__ == "__main__":
go()