Skip to content

Commit

Permalink
tryout copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
SchwarzM committed Apr 30, 2024
1 parent d30316b commit 954bcc5
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
8 changes: 8 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/

package main

import (
Expand Down
8 changes: 8 additions & 0 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/

package cmd

import (
Expand Down
8 changes: 8 additions & 0 deletions internal/controller/cluster.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/

package controller

import (
Expand Down
26 changes: 19 additions & 7 deletions internal/netbox/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/

package netbox

import (
Expand Down Expand Up @@ -34,32 +42,36 @@ func NewNetboxClient(url string, token string) (*NetboxClient, error) {
}, nil
}

func (n *NetboxClient) LookupVLANForDevice(device *models.Device) (int, error) {
func (n *NetboxClient) LookupVLANForDevice(device *models.Device) (int, string, error) {
lir := models.ListInterfacesRequest{
DeviceId: device.Id,
}
lir.Name = "LAG1"
resp, err := n.dcim.ListInterfaces(lir)
if err != nil {
return 0, err
return 0, "", err
}
if resp.Count == 0 {
return 0, fmt.Errorf("no interfaces found for device %s", device.Name)
return 0, "", fmt.Errorf("no interfaces found for device %s", device.Name)
}
if resp.Count > 1 {
return 0, fmt.Errorf("too many interfaces found for device %s", device.Name)
return 0, "", fmt.Errorf("too many interfaces found for device %s", device.Name)
}
interf := resp.Results[0]
for _, nestedVlan := range interf.TaggedVlans {
vlan, err := n.ipam.GetVlan(nestedVlan.Id)
if err != nil {
return 0, err
return 0, "", err
}
if vlan.Role.Slug == "cc-kubernetes-transit" {
return vlan.VId, nil
lipr := models.ListIpAddressesRequest{
InterfaceId: interf.Id,
}
res, err := n.ipam.ListIpAddresses(lipr)

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / Checks

res declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / Checks

err declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

res declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

err declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

res declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

err declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

res declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

err declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

res declared and not used

Check failure on line 70 in internal/netbox/client.go

View workflow job for this annotation

GitHub Actions / CodeQL

err declared and not used
return vlan.VId, "", nil
}
}
return 0, fmt.Errorf("no vlan found for device %s", device.Name)
return 0, "", fmt.Errorf("no vlan found for device %s", device.Name)
}

func (n *NetboxClient) LookupCluster(role string, name string) ([]models.Device, error) {
Expand Down
8 changes: 8 additions & 0 deletions internal/networkdata/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/

package networkdata

import "encoding/json"
Expand Down

0 comments on commit 954bcc5

Please sign in to comment.