Documentation ¶
Index ¶
- Constants
- Variables
- type AFKEnabledResponse
- type Device
- type GeneratedConfig
- type SafeRepository
- func (s *SafeRepository) GetAllDevicesConfigJSON() ([]byte, error)
- func (s *SafeRepository) GetAllDevicesIETFConfigJSON() ([]byte, error)
- func (s *SafeRepository) GetAllDevicesOpenConfigJSON() ([]byte, error)
- func (s *SafeRepository) GetDeviceConfigJSON(hostname string) ([]byte, error)
- func (s *SafeRepository) GetDeviceIETFConfigJSON(hostname string) ([]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 ErrBuidFailed = errors.New("build failed for this device")
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 ¶
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 ¶
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 ¶
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 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.