ing
This commit is contained in:
parent
1251b9f423
commit
9869bac38b
|
@ -261,7 +261,7 @@ func (d *ofDiscoverer) hierarchyDiscover(s session.DiscoverySession) {
|
||||||
|
|
||||||
// post complexDiscover
|
// post complexDiscover
|
||||||
if nil != s.DiscoverPort() {
|
if nil != s.DiscoverPort() {
|
||||||
discoveredHosts := s.DiscoveredAllHosts()
|
discoveredHosts := s.DiscoveredAllHosts(true)
|
||||||
for _, h := range discoveredHosts {
|
for _, h := range discoveredHosts {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(h *omd.Host) {
|
go func(h *omd.Host) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ type DiscoverySession interface {
|
||||||
AddService(service *omd.Service) *omd.Service
|
AddService(service *omd.Service) *omd.Service
|
||||||
|
|
||||||
DiscoveredHost(address string) *omd.Host
|
DiscoveredHost(address string) *omd.Host
|
||||||
DiscoveredAllHosts() map[string]*omd.Host
|
DiscoveredAllHosts(includeMac bool) map[string]*omd.Host
|
||||||
DiscoveredPort(host *omd.Host, portNumber int) map[string]*omd.Port
|
DiscoveredPort(host *omd.Host, portNumber int) map[string]*omd.Port
|
||||||
DiscoveredAllPorts() map[*omd.Host]map[json.Number]map[string]*omd.Port
|
DiscoveredAllPorts() map[*omd.Host]map[json.Number]map[string]*omd.Port
|
||||||
DiscoveredService(port *omd.Port, name string) map[string]*omd.Service
|
DiscoveredService(port *omd.Port, name string) map[string]*omd.Service
|
||||||
|
@ -61,6 +61,7 @@ type ofDiscoverySession struct {
|
||||||
discoveryDelegator chan<- interface{}
|
discoveryDelegator chan<- interface{}
|
||||||
|
|
||||||
hosts map[string]*omd.Host
|
hosts map[string]*omd.Host
|
||||||
|
includeMachosts map[string]*omd.Host
|
||||||
ports map[*omd.Host]map[json.Number]map[string]*omd.Port
|
ports map[*omd.Host]map[json.Number]map[string]*omd.Port
|
||||||
services map[*omd.Port]map[string]map[string]*omd.Service
|
services map[*omd.Port]map[string]map[string]*omd.Service
|
||||||
}
|
}
|
||||||
|
@ -75,6 +76,7 @@ func (ds *ofDiscoverySession) init(request types.DiscoveryRequest) {
|
||||||
ds.discoverService = nil
|
ds.discoverService = nil
|
||||||
|
|
||||||
ds.hosts = make(map[string]*omd.Host)
|
ds.hosts = make(map[string]*omd.Host)
|
||||||
|
ds.includeMachosts = make(map[string]*omd.Host)
|
||||||
ds.ports = make(map[*omd.Host]map[json.Number]map[string]*omd.Port)
|
ds.ports = make(map[*omd.Host]map[json.Number]map[string]*omd.Port)
|
||||||
ds.services = make(map[*omd.Port]map[string]map[string]*omd.Service)
|
ds.services = make(map[*omd.Port]map[string]map[string]*omd.Service)
|
||||||
}
|
}
|
||||||
|
@ -260,7 +262,10 @@ func (ds *ofDiscoverySession) DiscoveredHost(address string) *omd.Host {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *ofDiscoverySession) DiscoveredAllHosts() map[string]*omd.Host {
|
func (ds *ofDiscoverySession) DiscoveredAllHosts(includeMac bool) map[string]*omd.Host {
|
||||||
|
if includeMac {
|
||||||
|
return ds.includeMachosts
|
||||||
|
}
|
||||||
return ds.hosts
|
return ds.hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,6 +325,9 @@ func (ds *ofDiscoverySession) findHost(host *omd.Host, add bool) (h *omd.Host, m
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ds.hosts[host.Address] = host
|
ds.hosts[host.Address] = host
|
||||||
|
if "" != host.Mac {
|
||||||
|
ds.includeMachosts[host.Address] = host
|
||||||
|
}
|
||||||
h = host
|
h = host
|
||||||
modified = true
|
modified = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user