def main(): # when an user specified output file name is neccessary # inputoutputfilenames = sys.argv[1:] # initialise the dhcpconfwriter class: it contains all the methods required to create the dhcp.conf file dcw = DHCPConfWriter() # set output to be a file, not the terminal #dcw.setOutputFile("dhcp.conf") # print the starting static section of the dhcp.conf file dcw.printstartingstaticblock() # initialise the hen wrapper class(?) manager = HenManager() # intialise the logger function(?) manager.initLogging() # retrieve existing hen node information into a dictionary object(?) topology = manager.getPhysical() # iterate through the dictionary object for each key(?) for d in topology.keys(): # for each iteration call dhcpconfreader method to extract values associated with the keys dcw.dhcpconfreader(topology, d) # for each iteration call printdynamicblock method to print the extracted key values in the format acceptable for the dhcp.conf file dcw.printdynamicblock() # print the ending static section of the dhcp.conf file dcw.printendingstaticblock()
def main(): # when an user specified output file name is neccessary # inputoutputfilenames = sys.argv[1:] # initialise the dhcpconfwriter class: it contains all the methods required to create the dhcp.conf file dcw=DHCPConfWriter() # set output to be a file, not the terminal #dcw.setOutputFile("dhcp.conf") # print the starting static section of the dhcp.conf file dcw.printstartingstaticblock() # initialise the hen wrapper class(?) manager = HenManager() # intialise the logger function(?) manager.initLogging() # retrieve existing hen node information into a dictionary object(?) topology = manager.getPhysical() # iterate through the dictionary object for each key(?) for d in topology.keys(): # for each iteration call dhcpconfreader method to extract values associated with the keys dcw.dhcpconfreader(topology,d) # for each iteration call printdynamicblock method to print the extracted key values in the format acceptable for the dhcp.conf file dcw.printdynamicblock() # print the ending static section of the dhcp.conf file dcw.printendingstaticblock()
#! /usr/bin/env python from henManager import HenManager from auxiliary.hen import Node, SwitchNode manager = HenManager() manager.initLogging() nodes = manager.getNodes("switch") for n in nodes.values(): s = n.getInstance() if s != None: print s.getSwitchUptime() else: print "Failure to get instance of object"