logging.basicConfig(level=logging.DEBUG) # Assign variables from settings file server = settings.server username = settings.username password = settings.password #roomID = settings.roomID botToken = settings.botToken botID = settings.botID # DNS address of the mongo DB with default port of 27017 mongoAddr = 'database:27017' # Invoke ISEAPI class giving the server IP, username and password ISEReq = ISEAPI(server, username, password) # Invoke Spark API giving the Room that will be used and the Spark Token for the Bot sparkCall = SparkAPI(botToken) # Check input to ensure it is a valid 48bit hexadecimal MAC address. Valid delimiters are : , . and - maccheck = re.compile('([0-9A-Fa-f]{2}[:.-]){5}([0-9A-Fa-f]{2})') oldCheck = re.compile('old') newCheck = re.compile('new') helpCheck = re.compile('help') # Create variable for the file which will be downloaded from Spark filename = None client = MongoClient(mongoAddr)
from ISEAPI import ISEAPI import re r = ISEAPI(server, username, password) maccheck = re.compile('^([0-9A-Fa-f]{2}[:.-]){5}([0-9A-Fa-f]{2})$') while True: oldmac = raw_input( "Please enter the MAC address of the device you would like to replace: " ) # oldmac = "00:50:56:AA:AA:6A" if maccheck.match(oldmac): oldmac = r.MacTransform(oldmac) root = r.GetAllEndpoints() deviceFound = False for resources in root: for resource in resources: a = resource.attrib if ((a['name']) == (oldmac)): deviceID = a['id'] deviceFound = True oldDeviceInfo = r.GetEndpointByID(deviceID) if deviceFound == False: print "\n"