go: re-do the entire thing
This is a mega-change, but attempting to split this up further is
probably not worth the effort.
Summary:
1. Bump up bazel, rules_go, and others.
2. Switch to new go target naming (bye bye go_default_library)
3. Move go deps to go.mod/go.sum, use make gazelle generate from that
4. Bump up Python deps a bit
And also whatever was required to actually get things to work - loads of
small useless changes.
Tested to work on NixOS and Ubuntu 20.04:
$ bazel build //...
$ bazel test //...
Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/dc/topo/graph/graph.go b/dc/topo/graph/graph.go
index 4d31f39..288d306 100644
--- a/dc/topo/graph/graph.go
+++ b/dc/topo/graph/graph.go
@@ -142,7 +142,7 @@
}
-func (g *Graph) FeedFromNetbox(ctx context.Context, nb *client.NetBox) error {
+func (g *Graph) FeedFromNetbox(ctx context.Context, nb *client.NetBoxAPI) error {
// Clear all connections first, because it's easier that way.
for _, machine := range g.Machines {
for _, port := range machine.Ports {
@@ -169,18 +169,18 @@
return fmt.Errorf("while querying information about %q: %v", machine.Name, err)
}
for _, connection := range res.Payload.Results {
- ia := connection.InterfaceA
- ib := connection.InterfaceB
+ ia := connection.Interfacea
+ ib := connection.Interfaceb
if ia == nil || ib == nil {
continue
}
// Find which way this thing actually connects.
- var thisSide, otherSide *models.PeerInterface
- if ia.Device.Name == machine.Name {
+ var thisSide, otherSide *models.NestedInterface
+ if ia.Device.Name != nil && *ia.Device.Name == machine.Name {
thisSide = ia
otherSide = ib
- } else if ib.Device.Name == machine.Name {
+ } else if ib.Device.Name != nil && *ib.Device.Name == machine.Name {
thisSide = ib
otherSide = ia
} else {
@@ -192,9 +192,9 @@
if !ok {
continue
}
- sw, ok := g.Switches[otherSide.Device.Name]
+ sw, ok := g.Switches[*otherSide.Device.Name]
if !ok {
- glog.Warningf("Machine %q port %q is managed but connected to unknown device %q", machine.Name, thisPort.Name, otherSide.Device.Name)
+ glog.Warningf("Machine %q port %q is managed but connected to unknown device %q", machine.Name, thisPort.Name, *otherSide.Device.Name)
continue
}
otherPort, ok := sw.Ports[*otherSide.Name]