-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arkadiusz Kaliwoda (akaliwod)
committed
Jun 14, 2024
0 parents
commit 43487b7
Showing
5,343 changed files
with
375,466 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
AUTHORS | ||
ChangeLog | ||
.mypy_cache | ||
*.pyc | ||
__pycache__ | ||
*~ | ||
.#* | ||
*.egg-info | ||
*.spec | ||
/dist | ||
/bdist | ||
/build | ||
/results | ||
/Notes.md | ||
/.eggs | ||
/.stestr | ||
/.tox | ||
/.coverage.* | ||
/.coverage | ||
*~ | ||
poetry.lock | ||
*.toml | ||
*.code-workspace |
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 @@ | ||
# iserver | ||
|
||
iserver is command line tool using REST API with various Cisco products. | ||
|
||
Important note: documentation is partial and it will be uploaded again once sensitive information is removed | ||
|
||
## Features | ||
|
||
Compute | ||
- [Intersight](./doc/intersight/README.md) | ||
- [IMC](./doc/imc/README.md) | ||
- [Redfish](./doc/redfish/README.md) | ||
- [UCSM](./doc/ucsm/README.md) | ||
|
||
Networking | ||
- [ACI](./doc/aci/README.md) | ||
- [Nexus](./doc/nexus/README.md) | ||
|
||
Virtualization | ||
- [OpenStack](./doc/osp/README.md) | ||
- [vCenter](./doc/vcenter/README.md) | ||
|
||
Containers | ||
- [Helm](./doc/helm/README.md) | ||
- [Kubernetes](./doc/k8s/README.md) | ||
- [OpenShift](./doc/ocp/README.md) | ||
|
||
Orchestration | ||
- [Network Services Orchestrator](./doc/nso/README.md) | ||
|
||
Security | ||
- [PSIRT](./doc/psirt/README.md) | ||
|
||
Other | ||
- [Webex Bot](./doc/bot/README.md) | ||
|
||
## Installation | ||
|
||
- iserver binary is compiled for Windows, Linux and MAC | ||
- download the latest release from the [Releases](https://wwwin-github.cisco.com/emear-telcocloud/iserver/releases/latest) page. | ||
- move binary somewhere that is on your path (e.g. /usr/local/bin) | ||
|
||
If binary is not available or you prefer using source code, clone the repository and run iserver using Python3 with [required](requirements) pip3 packages. | ||
|
||
## Requirements | ||
|
||
Features using Intersight API require [isctl](https://github.com/cgascoig/isctl) and OS installation requires isctl version >= 0.1.18. | ||
|
||
No requiremets for non-Intersight related features. |
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,43 @@ | ||
import sys | ||
|
||
from lib import output_helper | ||
from lib import settings_helper | ||
from lib import my_servers_helper | ||
from lib import my_server_helper | ||
from menu import main as menu_main | ||
|
||
|
||
def initialize(): | ||
my_output = output_helper.OutputHelper() | ||
|
||
settings_handler = settings_helper.Settings() | ||
if not settings_handler.initialize_settings(): | ||
my_output.error('Local settings initialization failure...') | ||
return False | ||
|
||
my_servers = my_servers_helper.MyServers() | ||
if not my_servers.initialize(): | ||
my_output.error('My servers settings initialization failure...') | ||
return False | ||
|
||
my_server = my_server_helper.MyServer() | ||
if not my_server.initialize(): | ||
my_output.error('My server settings initialization failure...') | ||
return False | ||
|
||
return True | ||
|
||
|
||
if __name__ == "__main__": | ||
if not initialize(): | ||
sys.exit(1) | ||
|
||
parameters = [] | ||
for item in sys.argv: | ||
if len(item.split(' ')) == 1: | ||
parameters.append(item) | ||
else: | ||
parameters.append('"%s"' % (item)) | ||
|
||
USER_INPUT = ' '.join(parameters) | ||
menu_main.run(USER_INPUT) |
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 @@ | ||
class ApplicationProfileApi(): | ||
def __init__(self): | ||
self.application_profile_mo = None | ||
|
||
def get_application_profile_mo(self): | ||
if self.application_profile_mo is not None: | ||
return self.application_profile_mo | ||
|
||
cache = self.get_object_cache( | ||
'fvAp' | ||
) | ||
if cache is not None: | ||
self.application_profile_mo = cache | ||
self.log.apic_mo( | ||
'fvAp', | ||
self.application_profile_mo | ||
) | ||
return self.application_profile_mo | ||
|
||
query = 'rsp-subtree=children&rsp-subtree-include=health,fault-count' | ||
managed_objects = self.get_class( | ||
'fvAp', | ||
query=query | ||
) | ||
if managed_objects is None: | ||
return None | ||
|
||
self.application_profile_mo = [] | ||
for managed_object in managed_objects['imdata']: | ||
attributes = managed_object['fvAp']['attributes'] | ||
attributes['healthInst'] = self.get_mo_child_attributes( | ||
'fvAp', | ||
managed_object, | ||
'healthInst' | ||
) | ||
attributes['faultCounts'] = self.get_mo_child_attributes( | ||
'fvAp', | ||
managed_object, | ||
'faultCounts' | ||
) | ||
self.application_profile_mo.append( | ||
attributes | ||
) | ||
|
||
self.log.apic_mo( | ||
'fvAp', | ||
self.application_profile_mo | ||
) | ||
|
||
self.set_object_cache( | ||
'fvAp', | ||
self.application_profile_mo | ||
) | ||
|
||
return self.application_profile_mo |
Empty file.
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,48 @@ | ||
class ApplicationProfileAuditApi(): | ||
def __init__(self): | ||
self.application_profile_audit_mo = None | ||
|
||
def get_application_profile_audit_mo(self): | ||
cache = self.get_object_cache( | ||
'fvAp.audit' | ||
) | ||
if cache is not None: | ||
self.application_profile_audit_mo = cache | ||
self.log.apic_mo( | ||
'fvAp.audit', | ||
self.application_profile_audit_mo | ||
) | ||
return self.application_profile_audit_mo | ||
|
||
query = 'rsp-subtree-include=audit-logs,no-scoped,subtree&order-by=aaaModLR.created|desc&page=0&page-size=%s' % (self.api_audit_limit) | ||
managed_objects = self.get_class( | ||
'fvAp', | ||
query=query, | ||
node_class=True | ||
) | ||
|
||
if managed_objects is None: | ||
self.log.error( | ||
'get_application_profile_audit_mo', | ||
'API failed' | ||
) | ||
return None | ||
|
||
self.application_profile_audit_mo = [] | ||
for managed_object in managed_objects['imdata']: | ||
attributes = managed_object['aaaModLR']['attributes'] | ||
self.application_profile_audit_mo.append( | ||
attributes | ||
) | ||
|
||
self.log.apic_mo( | ||
'fvAp.audit', | ||
self.application_profile_audit_mo | ||
) | ||
|
||
self.set_object_cache( | ||
'fvAp.audit', | ||
self.application_profile_audit_mo | ||
) | ||
|
||
return self.application_profile_audit_mo |
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,114 @@ | ||
import time | ||
from datetime import datetime | ||
|
||
from lib import filter_helper | ||
|
||
|
||
class ApplicationProfileAuditInfo(): | ||
def __init__(self): | ||
self.application_profile_audit = None | ||
|
||
def get_application_profile_audit_info(self, managed_object): | ||
info = {} | ||
info['__Output'] = {} | ||
for key in managed_object: | ||
info[key] = managed_object[key] | ||
|
||
info['tenantName'] = None | ||
info['apName'] = None | ||
info['epgName'] = None | ||
|
||
if 'uni/tn-' in info['affected']: | ||
# uni/tn-k8s/ap-k8s_ANP/epg-vk8s_1 | ||
info['tenantName'] = info['affected'].split('uni/tn-')[1].split('/')[0] | ||
|
||
if '/ap-' in info['affected']: | ||
info['apName'] = info['affected'].split('/ap-')[1].split('/')[0] | ||
|
||
if '/epg-' in info['affected']: | ||
info['epgName'] = info['affected'].split('/epg-')[1].split('/')[0] | ||
|
||
info['nameTenant'] = '--' | ||
if info['tenantName'] is not None and info['apName'] is not None: | ||
info['nameTenant'] = '%s/%s' % ( | ||
info['tenantName'], | ||
info['apName'] | ||
) | ||
|
||
info['descrT'] = filter_helper.get_string_chunks( | ||
filter_helper.sanitize_string( | ||
info['descr'] | ||
), | ||
80 | ||
) | ||
|
||
info['changeSetT'] = filter_helper.get_string_chunks( | ||
filter_helper.sanitize_string( | ||
info['changeSet'] | ||
), | ||
80 | ||
) | ||
|
||
info['dnT'] = filter_helper.get_string_chunks( | ||
info['dn'], | ||
40, | ||
separator='/' | ||
) | ||
|
||
# "2022-04-29T13:32:45.167+02:00" | ||
info['timestamp'] = int( | ||
time.mktime( | ||
datetime.strptime( | ||
info['created'], | ||
'%Y-%m-%dT%H:%M:%S.%f%z' | ||
).timetuple() | ||
) | ||
) | ||
|
||
info['severityT'] = self.system_fault_severity_name[info['severity']] | ||
info['__Output']['severityT'] = self.system_fault_severity_color[info['severity']] | ||
|
||
return info | ||
|
||
def get_application_profile_audit(self): | ||
if self.application_profile_audit is not None: | ||
return self.application_profile_audit | ||
|
||
managed_objects = self.get_application_profile_audit_mo() | ||
if managed_objects is None: | ||
return None | ||
|
||
self.application_profile_audit = [] | ||
for managed_object in managed_objects: | ||
audit_info = self.get_application_profile_audit_info( | ||
managed_object | ||
) | ||
self.application_profile_audit.append( | ||
audit_info | ||
) | ||
|
||
self.log.apic_mo( | ||
'fvAp.auditRecord.info', | ||
self.application_profile_audit | ||
) | ||
|
||
return self.application_profile_audit | ||
|
||
def get_application_profile_id_audit(self, tenant_name, ap_name, audit_filter=None): | ||
audits = [] | ||
|
||
all_audits = self.get_application_profile_audit() | ||
if all_audits is None: | ||
return audits | ||
|
||
for audit_info in all_audits: | ||
if audit_info['tenantName'] is not None and audit_info['apName'] is not None: | ||
if audit_info['tenantName'] == tenant_name and audit_info['apName'] == ap_name: | ||
if not self.match_system_fault(audit_info, audit_filter, exclude_cleared=False): | ||
continue | ||
|
||
audits.append( | ||
audit_info | ||
) | ||
|
||
return audits |
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,8 @@ | ||
from lib.aci.ap.audit.api import ApplicationProfileAuditApi | ||
from lib.aci.ap.audit.info import ApplicationProfileAuditInfo | ||
|
||
|
||
class ApplicationProfileAudit(ApplicationProfileAuditApi, ApplicationProfileAuditInfo): | ||
def __init__(self): | ||
ApplicationProfileAuditApi.__init__(self) | ||
ApplicationProfileAuditInfo.__init__(self) |
Empty file.
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,51 @@ | ||
class ApplicationProfileEventApi(): | ||
def __init__(self): | ||
self.application_profile_event_mo = None | ||
|
||
def get_application_profile_event_mo(self): | ||
if self.application_profile_event_mo is not None: | ||
return self.application_profile_event_mo | ||
|
||
cache = self.get_object_cache( | ||
'fvAp.eventLog' | ||
) | ||
if cache is not None: | ||
self.application_profile_event_mo = cache | ||
self.log.apic_mo( | ||
'fvAp.eventLog', | ||
self.application_profile_event_mo | ||
) | ||
return self.application_profile_event_mo | ||
|
||
query = 'rsp-subtree-include=event-logs,no-scoped,subtree&order-by=eventRecord.created|desc&page=0&page-size=%s' % (self.api_event_limit) | ||
managed_objects = self.get_class( | ||
'fvAp', | ||
query=query, | ||
node_class=True | ||
) | ||
|
||
if managed_objects is None: | ||
self.log.error( | ||
'get_application_profile_event_mo', | ||
'API failed' | ||
) | ||
return None | ||
|
||
self.application_profile_event_mo = [] | ||
for managed_object in managed_objects['imdata']: | ||
attributes = managed_object['eventRecord']['attributes'] | ||
self.application_profile_event_mo.append( | ||
attributes | ||
) | ||
|
||
self.log.apic_mo( | ||
'fvAp.eventLog', | ||
self.application_profile_event_mo | ||
) | ||
|
||
self.set_object_cache( | ||
'fvAp.eventLog', | ||
self.application_profile_event_mo | ||
) | ||
|
||
return self.application_profile_event_mo |
Oops, something went wrong.