//processBgpEvent processes Bgp neighbor add/delete events func processBgpEvent(netPlugin *plugin.NetPlugin, opts cliOpts, hostID string, isDelete bool) error { var err error if opts.hostLabel != hostID { log.Errorf("Ignoring Bgp Event on this host") return err } netPlugin.Lock() defer func() { netPlugin.Unlock() }() operStr := "" if isDelete { err = netPlugin.DeleteBgp(hostID) operStr = "delete" } else { err = netPlugin.AddBgp(hostID) operStr = "create" } if err != nil { log.Errorf("Bgp operation %s failed. Error: %s", operStr, err) } else { log.Infof("Bgp operation %s succeeded", operStr) } return err }