Example #1
0
func (r *Monitor) OnDeviceDown(finder network.Finder, device *network.Device) error {
	go func() {
		subject := "Cherry: device is down!"
		body := fmt.Sprintf("DPID: %v", device.ID())
		if err := r.sendAlarm(subject, body); err != nil {
			r.log.Err(fmt.Sprintf("Monitor: failed to send an alarm email: %v", err))
		}
	}()

	return r.BaseProcessor.OnDeviceDown(finder, device)
}
Example #2
0
func (r *ProxyARP) OnDeviceDown(finder network.Finder, device *network.Device) error {
	dpid, err := strconv.ParseUint(device.ID(), 10, 64)
	if err != nil {
		r.log.Err(fmt.Sprintf("ProxyARP: invalid switch DPID: %v", device.ID()))
		return r.BaseProcessor.OnDeviceDown(finder, device)
	}
	vips, err := r.db.ToggleDeviceVIP(dpid)
	if err != nil {
		r.log.Err(fmt.Sprintf("ProxyARP: failed to toggle VIP hosts: %v", err))
		return r.BaseProcessor.OnDeviceDown(finder, device)
	}
	r.broadcastARPAnnouncement(finder, vips)

	return r.BaseProcessor.OnDeviceDown(finder, device)
}