Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
#! /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"
        

Пример #4
0
#!/usr/bin/env python
"""
Prints out the hen name, mac address and ip address
"""
import string, sys

sys.path.append("/usr/local/hen/lib")
from henManager import HenManager


# Load the topology information
manager = HenManager()

manager.initLogging()
topology = manager.getPhysical()
for d in topology.keys():
    # Get the name of the device
    physicalDevice = topology[d]
    name = physicalDevice.id
    # Get the management interface
    for i in physicalDevice.mngInterface.values():
        # Convert the mac address to a upper case string
        mac = string.upper(i.mac)
        # Convert the ip address to a upper case string
        ip = string.upper(i.ip)
        # Print everything
        print name + " " + mac + " " + ip

        # Get the experimental interfaces
    for i in physicalDevice.interfaces.values():
        mac = string.upper(i.mac)
Пример #5
0
#!/usr/bin/env python
"""
Prints out the hen name, mac address and ip address
"""
import string, sys

sys.path.append("/usr/local/hen/lib")
from henManager import HenManager

# Load the topology information
manager = HenManager()

manager.initLogging()
topology = manager.getPhysical()
for d in topology.keys():
    # Get the name of the device
    physicalDevice = topology[d]
    name = physicalDevice.id
    # Get the management interface
    for i in physicalDevice.mngInterface.values():
        # Convert the mac address to a upper case string
        mac = string.upper(i.mac)
        # Convert the ip address to a upper case string
        ip = string.upper(i.ip)
        # Print everything
        print name + " " + mac + " " + ip

    # Get the experimental interfaces
    for i in physicalDevice.interfaces.values():
        mac = string.upper(i.mac)
        if i.ip != None: