device

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AFKEnabledTag = "afk-enabled"

Variables

View Source
var ErrBuidFailed = errors.New("build failed for this device")
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type AFKEnabledResponse added in v0.0.4

type AFKEnabledResponse struct {
	AFKEnabled bool `json:"afk_enabled"`
}

type Device

type Device struct {
	Dcim            *dcim.NetworkDevice
	Config          *GeneratedConfig
	BGPGlobalConfig *bgp.BGPGlobal
	SNMP            *snmp.SNMP
	Sessions        []*bgp.Session
	PeerGroups      []*bgp.PeerGroup
	PrefixLists     []*routingpolicy.PrefixList
	CommunityLists  []*routingpolicy.CommunityList
	RoutePolicies   []*routingpolicy.RoutePolicy
	AFKEnabled      bool
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(dcimInfo *dcim.NetworkDevice, devicesData *repository.AssetsPerDevice) (*Device, error)

NewDevice creates and populates a device with precomputed Ingestor's data.

func (*Device) Generateconfigs

func (d *Device) Generateconfigs() error

Generateconfigs generate the Config (openconfig & ietf) data for the current device. The CMDB data must have been precomputed before running this method.

func (*Device) GetCompactIETFJSON

func (d *Device) GetCompactIETFJSON() ([]byte, error)

GetCompactIETFJSON returns IETF result in not indented JSON format. GetCompactIETFJSON JSON is already indented by Ygot - currently there is no option to not indent the JSON.

func (*Device) GetCompactOpenconfigJSON

func (d *Device) GetCompactOpenconfigJSON() ([]byte, error)

GetCompactOpenconfigJSON returns OpenConfig result in not indented JSON format. Generated JSON is already indented by Ygot - currently there is no option to not indent the JSON.

type GeneratedConfig

type GeneratedConfig struct {
	IETF           *ietf.Device
	JSONIETF       string
	Openconfig     *openconfig.Device
	JSONOpenConfig string
}

type SafeRepository

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

func NewSafeRepository

func NewSafeRepository() SafeRepository

func (*SafeRepository) GetAllDevicesConfigJSON

func (s *SafeRepository) GetAllDevicesConfigJSON() ([]byte, error)

GetAllDevicesConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and openconfig JSON as value. Example: '{"hostname":{"network-instances":{...}}'.

func (*SafeRepository) GetAllDevicesIETFConfigJSON

func (s *SafeRepository) GetAllDevicesIETFConfigJSON() ([]byte, error)

GetAllDevicesIETFConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and openconfig JSON as value. Example: '{"hostname":{"network-instances":{...}}'.

func (*SafeRepository) GetAllDevicesOpenConfigJSON

func (s *SafeRepository) GetAllDevicesOpenConfigJSON() ([]byte, error)

GetAllDevicesOpenConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and openconfig JSON as value. Example: '{"hostname":{"network-instances":{...}}'.

func (*SafeRepository) GetDeviceConfigJSON

func (s *SafeRepository) GetDeviceConfigJSON(hostname string) ([]byte, error)

GetDeviceConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and ietf JSON as value.

func (*SafeRepository) GetDeviceIETFConfigJSON

func (s *SafeRepository) GetDeviceIETFConfigJSON(hostname string) ([]byte, error)

GetDeviceIETFConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and ietf JSON as value.

func (*SafeRepository) GetDeviceOpenConfigJSON

func (s *SafeRepository) GetDeviceOpenConfigJSON(hostname string) ([]byte, error)

GetDeviceOpenConfigJSON copy configuration for all devices to w. Compact and wrap configuration in JSON dict with hostname as key and openconfig JSON as value Example: '{"hostname":{"network-instances":{...}}'.

func (*SafeRepository) IsAFKEnabledJSON

func (s *SafeRepository) IsAFKEnabledJSON(hostname string) ([]byte, error)

IsAFKEnabledJSON checks if one device is AFK enabled.

func (*SafeRepository) ListAFKEnabledDevicesJSON

func (s *SafeRepository) ListAFKEnabledDevicesJSON() ([]byte, error)

ListAFKEnabledDevicesJSON returns all AFK enabled devices.

func (*SafeRepository) Set

func (s *SafeRepository) Set(devices map[string]*Device)

Set new device configuration in the repository. This method is concurrent-safe.

Jump to

Keyboard shortcuts

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