Example #1
0
 def __init__(self):
     Super_dict.__init__(self)
     """
     MAC parse tool
     
     sh mac-add dyn
     vlan   mac address     type    learn     age              ports
     *  124  0021.5e97.7b34   dynamic  Yes         30   Te1/3
     
     2nd variation
     vlan   mac address     type    learn            ports
     *  112  0023.7d35.1470   dynamic  Yes   Po2
     
     3rd variation - 
     vlan   mac address     type        protocols               port
     201    000c.29e0.cd3e   dynamic ip,ipx,assigned,other GigabitEthernet2/9
     
     self.dict_db format is [mac][host_port_vlan][date]    
     (c) 2012, 2013 Intelligent Planet Ltd
     """
     
     self.verbose = 0
     self.space_size = 40
     self.load_file = 'c:/mac_load'
     self.dict_file = 'c:/mac_db'
     
     self.open_dict()
Example #2
0
 def __init__(self):
     Super_dict.__init__(self)
    
     """
     This class is designed to provide a fast, memory resident cli searchable contact database.
     
     Database fields are specified in the .csv load file in the top row, for example:
     #Name,Comment,Company,Department,Job Title,Business Street,Business City,Business State,
     Business Postal Code,Business Country,Business Fax,Business Phone,Business Phone 2,
     Home Phone,Mobile Phone,Pager,E-mail Display Name,E-mail 2 Address,Notes,Office Location
    
     self.dict_db format is [Name][user specified fields]
     
     Written by Peter Rogers
     (C) Intelligent Planet 2013
     """
    
     self.path = os.getcwd() + '\\'
    
     self.load_file = self.path + 'contacts.csv'
     
     self.prompt_text = 'Contact Search >>>'
     
     #load the dictionary into memory
     self.dict_db = {}
     self.load_csv(self.load_file)