def __init__(self, args):
     self.args = args
     self.noPrintAttributes = ["fsmFlags"]
     self.URL = urlFunctions(self.args)
     return
Beispiel #2
0
    default=0,
    required=False,
    help='Enables verbose messaging for debug purposes (optional)')
args = argsParse.parse_args()

if (args.verbose >= 1):
    print('{0}Server:      {1}\033[0m'.format(green, args.serverName))
    print('{0}User:        {1}\033[0m'.format(green, args.adminName))
    print('{0}directory:   {1}\033[0m'.format(green, args.directory))
    print('{0}verbose:     {1}\033[0m'.format(green, args.verbose))

#Create objects for class handling
timeFunctions = timeFunctions()
ucsF = ucsFunctions(
    args)  # We pass args to init to ensure we can identify verbose
URL = urlFunctions(args)

fileTime = timeFunctions.getCurrentTime()
#File Name
path = '{0}/{1}-MemoryErrors.log'.format(args.directory, fileTime)
if (args.verbose >= 1):
    print("{0}File Path:   {1}\033[0m".format(green, path))

# URL used for access to UCS. UCS uses a single URL for everything until RedFish matures.
url = 'https://{0}/nuova'.format(args.serverName)
if (args.verbose >= 1):
    print("{0}URL:         {1}\033[0m".format(green, url))

# This line is used for authentication. We only print it if verbose level is 3 or higher
data = '<aaaLogin inName="{0}" inPassword="******" />'.format(
    args.adminName, getpass.getpass())
               https://developer.cisco.com/docs/licenses

All use of the material herein must be in accordance with the terms of
the License. All rights not expressly granted by the License are
reserved. Unless required by applicable law or agreed to separately in
writing, software distributed under the License is distributed on an "AS
IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.'''

import json
import re
import csv
from common import urlFunctions

URL = urlFunctions()


class endPointFunctions:
    def __init__(self, filePath, writeCsv, debug=False):
        self.filePath = filePath
        self.writeCsv = writeCsv
        self.debug = debug
        if writeCsv == True:
            self.csvFileObj = open(filePath, 'w')
            self.csvWriter = csv.writer(self.csvFileObj,
                                        delimiter=',',
                                        quotechar='"')

        return
Beispiel #4
0
    default='',
    help=
    'Enter Password for APIC access. If none provided, you will be prompted')
argsParse.add_argument('-d',
                       action='store',
                       dest='directory',
                       default='./',
                       help='Directory to write csv report to')
argsParse.add_argument('-debug',
                       action='store_true',
                       dest='debug',
                       default=False,
                       help='Advanced Output')
args = argsParse.parse_args()

URL = urlFunctions(debug=args.debug)

#Argument Validation for IP and MAC
processIP, ipList = validation().validateIP(args.ips)
processMAC, macList = validation().validateMAC(args.mac)

if args.writeCsv == True:
    #Default settings for output file name.
    if f'{args.directory}'[-1] == '/':
        directory = f"{args.directory}"
    else:
        directory = f"{args.directory}/"
    if args.debug == True:
        print(f"Directory:\t{directory}")
    fileSuffix = '-EndPoint-Report.csv'
    fileName = '{0}{1}{2}'.format(directory, time.getCurrentTime(), fileSuffix)