payload

package
v0.0.0-...-234771b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package payload implement processing of Cisco SD-WAN api responses

Index

Constants

View Source
const DeviceUserTagResourcePrefix = "dd.internal.resource:ndm_device_user_tags"

DeviceUserTagResourcePrefix contains the REDAPL table to store device user tags

Variables

View Source
var TimeNow = time.Now

TimeNow useful for mocking

Functions

func GetDevicesMetadata

func GetDevicesMetadata(namespace string, devices []client.Device) []devicemetadata.DeviceMetadata

GetDevicesMetadata process devices API payloads to build metadata

func GetDevicesStatus

func GetDevicesStatus(devices []client.Device) map[string]float64

GetDevicesStatus process devices API payloads to get status

func GetDevicesTags

func GetDevicesTags(namespace string, devices []client.Device) map[string][]string

GetDevicesTags process devices API payloads to build device tags

func GetDevicesUptime

func GetDevicesUptime(devices []client.Device) map[string]float64

GetDevicesUptime process devices API payloads to compute uptimes

func GetIPAddressesMetadata

func GetIPAddressesMetadata(namespace string, interfaces []CiscoInterface) []devicemetadata.IPAddressMetadata

GetIPAddressesMetadata process interfaces API payloads to build IP addresses metadata

func GetInterfacesMetadata

func GetInterfacesMetadata(namespace string, interfaces []CiscoInterface) ([]devicemetadata.InterfaceMetadata, map[string]CiscoInterface)

GetInterfacesMetadata process interfaces API payloads to build interfaces metadata and tags

Types

type CEdgeInterface

type CEdgeInterface struct {
	client.CEdgeInterfaceState
}

CEdgeInterface is an implementation of CiscoInterface for cEdge devices

func (*CEdgeInterface) AdminStatus

func (itf *CEdgeInterface) AdminStatus() devicemetadata.IfAdminStatus

AdminStatus returns the interface admin status

func (*CEdgeInterface) GetSpeedMbps

func (itf *CEdgeInterface) GetSpeedMbps() float64

GetSpeedMbps returns the interface speed

func (*CEdgeInterface) ID

func (itf *CEdgeInterface) ID() string

ID returns an unique interface ID

func (*CEdgeInterface) IPV4AddressMetadata

func (itf *CEdgeInterface) IPV4AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)

IPV4AddressMetadata returns the metadata for this interface's IPV4 addresses

func (*CEdgeInterface) IPV6AddressMetadata

func (itf *CEdgeInterface) IPV6AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)

IPV6AddressMetadata returns the metadata for this interface's IPV6 addresses

func (*CEdgeInterface) Index

func (itf *CEdgeInterface) Index() (int32, error)

Index returns the interface index

func (*CEdgeInterface) Metadata

func (itf *CEdgeInterface) Metadata(namespace string) (devicemetadata.InterfaceMetadata, error)

Metadata returns the interface metadata

func (*CEdgeInterface) OperStatus

func (itf *CEdgeInterface) OperStatus() devicemetadata.IfOperStatus

OperStatus returns the interface oper status

type CiscoInterface

type CiscoInterface interface {
	// ID returns an unique interface ID
	ID() string
	// Index returns the interface index
	Index() (int32, error)
	// GetSpeedMbps returns the interface speed in megabits per second
	GetSpeedMbps() float64
	// OperStatus returns the interface oper status
	OperStatus() devicemetadata.IfOperStatus
	// AdminStatus returns the interface admin status
	AdminStatus() devicemetadata.IfAdminStatus
	// Metadata returns the interface metadata
	Metadata(namespace string) (devicemetadata.InterfaceMetadata, error)
	// IPV4AddressMetadata returns the metadata for this interface's IPV4 addresses
	IPV4AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)
	// IPV6AddressMetadata returns the metadata for this interface's IPV6 addresses
	IPV6AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)
}

CiscoInterface is an interface to abstract the underlying network interface object (vEdge vs cEdge)

func ConvertInterfaces

func ConvertInterfaces(vEdgeInterfaces []client.InterfaceState, cEdgeInterfaces []client.CEdgeInterfaceState) []CiscoInterface

ConvertInterfaces converts API responses to an abstracted interface

type VEdgeInterface

type VEdgeInterface struct {
	client.InterfaceState
}

VEdgeInterface is an implementation of CiscoInterface for vEdge devices

func (*VEdgeInterface) AdminStatus

func (itf *VEdgeInterface) AdminStatus() devicemetadata.IfAdminStatus

AdminStatus returns the interface admin

func (*VEdgeInterface) GetSpeedMbps

func (itf *VEdgeInterface) GetSpeedMbps() float64

GetSpeedMbps returns the interface speed

func (*VEdgeInterface) ID

func (itf *VEdgeInterface) ID() string

ID returns an unique interface ID

func (*VEdgeInterface) IPV4AddressMetadata

func (itf *VEdgeInterface) IPV4AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)

IPV4AddressMetadata returns the metadata for this interface's IPV4 addresses

func (*VEdgeInterface) IPV6AddressMetadata

func (itf *VEdgeInterface) IPV6AddressMetadata(namespace string) (*devicemetadata.IPAddressMetadata, error)

IPV6AddressMetadata returns the metadata for this interface's IPV6 addresses

func (*VEdgeInterface) Index

func (itf *VEdgeInterface) Index() (int32, error)

Index returns the interface index

func (*VEdgeInterface) Metadata

func (itf *VEdgeInterface) Metadata(namespace string) (devicemetadata.InterfaceMetadata, error)

Metadata returns the interface metadata

func (*VEdgeInterface) OperStatus

func (itf *VEdgeInterface) OperStatus() devicemetadata.IfOperStatus

OperStatus returns the interface oper status

Jump to

Keyboard shortcuts

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