master
go 24 lines 653 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package l2topology
4
5 func deviceToTopologyActor(
6 dev Device,
7 source, layer, localDeviceID string,
8 ifaceSummary topologyDeviceInterfaceSummary,
9 reporterAliases []string,
10 ) Actor {
11 match := buildDeviceActorMatch(dev, reporterAliases)
12 attrs := buildDeviceActorAttributes(dev, localDeviceID, ifaceSummary, match)
13 tables := buildDeviceActorTables(ifaceSummary)
14
15 return Actor{
16 ActorType: resolveDeviceActorType(dev.Labels),
17 Layer: layer,
18 Source: source,
19 Match: match,
20 Attributes: pruneTopologyAttributes(attrs),
21 Labels: cloneStringMap(dev.Labels),
22 Tables: tables,
23 }
24 }