nb_pusher

package
v0.0.0-...-1e40bc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTERFACE_SPEED_MAX int64 = 2147483647
	INTERFACE_MTU_MIN   int64 = 1
)

Variables

View Source
var DeviceStatusMap = map[string]string{
	"alive": "active",
	"dead":  "offline",
}
View Source
var INTERFACE_OBJ_TYPE string = "dcim.interface"
View Source
var InterfaceStateMap = map[string]bool{
	"up":   true,
	"down": false,
}

Functions

This section is empty.

Types

type NetboxDevice

type NetboxDevice struct {
	Site     *NetboxSite       `json:"site"`
	Role     *NetboxObject     `json:"device_role"`
	Type     *NetboxDeviceType `json:"device_type"`
	Platform *NetboxPlatform   `json:"platform"`
	Name     string            `json:"name"`
	Slug     string            `json:"slug"`
	Status   string            `json:"status"`
	Serial   string            `json:"serial"`
}

type NetboxDeviceType

type NetboxDeviceType struct {
	Mfr   *NetboxObject `json:"manufacturers"`
	Model string        `json:"model"`
	Slug  string        `json:"slug"`
}

type NetboxInterface

type NetboxInterface struct {
	DeviceID   int64  `json:"device_id"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	Speed      int64  `json:"speed"`
	Mtu        int64  `json:"mtu"`
	MacAddress string `json:"mac_address"`
	State      string `json:"state"`
}

type NetboxInventory

type NetboxInventory struct {
	DeviceID int64         `json:"device_id"`
	Name     string        `json:"name"`
	Mfr      *NetboxObject `json:"manufacturers"`
	AssetTag string        `json:"asset_tag"`
	PartId   string        `json:"part_id"`
	Descr    string        `json:"description"`
	Serial   string        `json:"serial"`
}

type NetboxIpAddress

type NetboxIpAddress struct {
	Address     string `json:"address"`
	AsgdObjType string `json:"assigned_object_type"`
	AsgdObjID   int64  `json:"assigned_object_id"`
}

type NetboxObject

type NetboxObject struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type NetboxPlatform

type NetboxPlatform struct {
	Mfr  *NetboxObject `json:"manufacturers"`
	Name string        `json:"name"`
	Slug string        `json:"slug"`
}

type NetboxPrimaryIpChecker

type NetboxPrimaryIpChecker struct {
	IpInfo struct {
		DeviceAddresses []string `json:"device_id"`
		DeviceId        []int64
	}
}

type NetboxPusher

type NetboxPusher struct {
	// contains filtered or unexported fields
}

func (*NetboxPusher) CreateDevice

func (nb *NetboxPusher) CreateDevice(j []byte) (int64, error)

func (*NetboxPusher) CreateInterface

func (nb *NetboxPusher) CreateInterface(j []byte) (int64, error)

func (*NetboxPusher) CreateInterfaceIpAddress

func (nb *NetboxPusher) CreateInterfaceIpAddress(j []byte, ipChecker NetboxPrimaryIpChecker) (int64, error)

func (*NetboxPusher) CreateInventory

func (nb *NetboxPusher) CreateInventory(j []byte) (int64, error)

func (*NetboxPusher) PrimaryIpCheck

func (nb *NetboxPusher) PrimaryIpCheck(IfcIpAddress string, IfcIpId int64, ipChecker NetboxPrimaryIpChecker) (int64, error)

func (*NetboxPusher) Start

func (nb *NetboxPusher) Start() error

func (*NetboxPusher) Stop

func (nb *NetboxPusher) Stop() error

func (*NetboxPusher) UpdateDevice

func (nb *NetboxPusher) UpdateDevice(ifcIpId, deviceId int64, ipVersion string) (int64, error)

type NetboxSite

type NetboxSite struct {
	Name   string `json:"name"`
	Slug   string `json:"slug"`
	Status string `json:"status"`
}

type Pusher

type Pusher interface {
	Start() error
	Stop() error
	CreateDevice([]byte) (int64, error)
	UpdateDevice(int64, int64, string) (int64, error)
	CreateInterface([]byte) (int64, error)
	CreateInterfaceIpAddress([]byte, NetboxPrimaryIpChecker) (int64, error)
	CreateInventory([]byte) (int64, error)
	PrimaryIpCheck(string, int64, NetboxPrimaryIpChecker) (int64, error)
}

func New

func New(ctx context.Context, logger *zap.Logger, config *config.Config) Pusher

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL