31
31
def getDiscoveryState(self):
32
32
"""Get the discovery state from the region."""
33
client = self.clientService.getClient()
34
33
if self._recorded is None:
35
34
# Wait until the rack has refreshed.
39
GetDiscoveryState, system_id=client.localIdent)
40
d.addCallback(lambda args: args['interfaces'])
39
GetDiscoveryState, system_id=client.localIdent)
40
d.addCallback(lambda args: args['interfaces'])
43
d = self.clientService.getClientNow()
44
d.addCallback(getState)
43
47
def recordInterfaces(self, interfaces):
44
48
"""Record the interfaces information to the region."""
45
client = self.clientService.getClient()
46
# On first run perform a refresh
47
if self._recorded is None:
48
return client(RequestRackRefresh, system_id=client.localIdent)
51
UpdateInterfaces, system_id=client.localIdent,
52
interfaces=interfaces)
50
# On first run perform a refresh
51
if self._recorded is None:
52
return client(RequestRackRefresh, system_id=client.localIdent)
55
UpdateInterfaces, system_id=client.localIdent,
56
interfaces=interfaces)
58
d = self.clientService.getClientNow()
54
62
def reportNeighbours(self, neighbours):
55
63
"""Report neighbour information to the region."""
56
client = self.clientService.getClient()
64
d = self.clientService.getClientNow()
65
d.addCallback(lambda client: client(
58
66
ReportNeighbours, system_id=client.localIdent,
59
neighbours=neighbours)
67
neighbours=neighbours))
61
70
def reportMDNSEntries(self, mdns):
62
71
"""Report mDNS entries to the region."""
63
client = self.clientService.getClient()
65
ReportMDNSEntries, system_id=client.localIdent, mdns=mdns)
72
d = self.clientService.getClientNow()
73
d.addCleanup(lambda client: client(
74
ReportMDNSEntries, system_id=client.localIdent, mdns=mdns))