func processNetEvent(netPlugin *plugin.NetPlugin, nwCfg *mastercfg.CfgNetworkState, isDelete bool) (err error) { // take a lock to ensure we are programming one event at a time. // Also network create events need to be processed before endpoint creates // and reverse shall happen for deletes. That order is ensured by netmaster, // so we don't need to worry about that here netPlugin.Lock() defer func() { netPlugin.Unlock() }() operStr := "" if isDelete { err = netPlugin.DeleteNetwork(nwCfg.ID, nwCfg.NwType, nwCfg.PktTagType, nwCfg.PktTag, nwCfg.ExtPktTag, nwCfg.Gateway, nwCfg.Tenant) operStr = "delete" } else { err = netPlugin.CreateNetwork(nwCfg.ID) operStr = "create" } if err != nil { log.Errorf("Network operation %s failed. Error: %s", operStr, err) } else { log.Infof("Network operation %s succeeded", operStr) } return }