Documentation
¶
Index ¶
- Constants
- Variables
- type Device
- type GeneratedConfig
- type SafeRepository
- func (s *SafeRepository) GetAllDevicesOpenConfigJSON() ([]byte, error)
- func (s *SafeRepository) GetDeviceOpenConfigJSON(hostname string) ([]byte, error)
- func (s *SafeRepository) IsAFKEnabledJSON(hostname string) ([]byte, error)
- func (s *SafeRepository) ListAFKEnabledDevicesJSON() ([]byte, error)
- func (s *SafeRepository) Set(devices map[string]*Device)
Constants ¶
const AFKEnabledTag = "afk-enabled"
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
Dcim *dcim.NetworkDevice
Config *GeneratedConfig
BGPGlobalConfig *bgp.BGPGlobal
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) GenerateOpenconfig ¶
GenerateOpenconfig generate the OpenConfig data for the current device. The CMDB data must have been precomputed before running this method.
func (*Device) GetCompactJSON ¶
GetCompactJSON 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 {
Openconfig *openconfig.Device
JSON string
}
type SafeRepository ¶
type SafeRepository struct {
// contains filtered or unexported fields
}
func NewSafeRepository ¶
func NewSafeRepository() SafeRepository
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) 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.