예제 #1
0
class XRoadTool:
    def __init__(self):
        self.x = XRoad()

    def addhost(self, macaddress, hostname=None):
        self.x.addhost(macaddress, hostname)
        print "Added host " + macaddress + " to XRoad Monitoring"
        return True

    def remhost(self, macaddress):
        self.x.remhost(macaddress)
        print "Removed host " + macaddress + " from XRoad Monitoring"

    def initialize(self):
        print "Initializing XRoad ... ",
        self.x.initdb()
        print "done"

    def listhosts(self):
        hosts = self.x.listhosts()
        if len(hosts) > 0:
            print "Hostname\t\tMAC Address"
            for h in hosts:
                print h[1] + "\t\t" + h[2]
        else:
            print "No hosts being monitored"
예제 #2
0
    def xr_addhost(self, macaddress, hostname, ipaddress, oid=None):

        xrd = XRoad()
        xrd.addhost(macaddress, hostname, ipaddress, oid)
        if oid is not None:
            xrd.markhost(str(oid), ipaddress)

        return True