public synchronized void handleEdgeRemoveEvent(Edge edge) { Uuid tenantId = edge.getTenantId(); UserLogicalNetworkCache uln = this.ulnStore.get(tenantId); if (uln == null) { LOG.error("FABMGR: ERROR: handleEdgeRemoveEvent: uln is null"); return; } if (uln.isEdgeAlreadyCached(edge) == false) { LOG.error("FABMGR: ERROR: handleEdgeRemoveEvent: edge not in cache"); return; } uln.addRequestRemoveEdge(edge); /* * Notify worker thread to start work */ this.workerThreadLock.release(); }
public synchronized void handleEdgeCreateEvent(Edge edge) { Uuid tenantId = edge.getTenantId(); this.createUlnCacheIfNotExist(tenantId); UserLogicalNetworkCache uln = this.ulnStore.get(tenantId); if (uln == null) { LOG.error("FABMGR: ERROR: handleEdgeCreateEvent: uln is null"); return; } if (uln.isEdgeAlreadyCached(edge)) { LOG.error("FABMGR: ERROR: handleEdgeCreateEvent: edge already exist"); return; } uln.cacheEdge(edge); this.workerThreadLock.release(); }
return false; if (!Objects.equals(_tenantId, other.getTenantId())) { return false;
public synchronized void handleEdgeUpdateEvent(Edge edge) { Uuid tenantId = edge.getTenantId(); if (this.isUlnAlreadyInCache(tenantId) == false) { LOG.error("FABMGR: ERROR: handleEdgeUpdateEvent: this is update; ULN is supposed to be in cache: {}", tenantId.getValue()); return; } UserLogicalNetworkCache uln = this.ulnStore.get(tenantId); if (uln == null) { LOG.error("FABMGR: ERROR: handleEdgeUpdateEvent: uln is null"); return; } if (!uln.isEdgeAlreadyCached(edge)) { LOG.error("FABMGR: ERROR: handleEdgeUpdateEvent: edge should have been cached"); // fall through. Treat this case as create event } else { if (uln.isEdgeRendered(edge)) { LOG.error("FABMGR: ERROR: handleEdgeUpdateEvent: edge has already been rendered: {}", edge.getUuid().getValue()); return; } else { uln.removeEdgeFromCache(edge); } } /* * Now we can treat update event as a new create event. */ this.handleEdgeCreateEvent(edge); }
this._rightPortId = base.getRightPortId(); this._status = base.getStatus(); this._tenantId = base.getTenantId(); this._adminStateUp = base.isAdminStateUp(); if (base instanceof EdgeImpl) {
public static void submitEdgeToDs(Edge edge) { if (edge.getLeftPortId() == null || edge.getRightPortId() == null) { LOG.error("Trying to Subnit an edge Edge with less than two ports -- Ignored Request"); return; } Port lport = UlnDatastoreApi.readPortFromDs(edge.getTenantId(), edge.getLeftPortId()); if (lport != null && lport.getEdgeId() != null && !edge.getUuid().equals(lport.getEdgeId())) { LOG.error( "Trying to Submit Edge {} that references Port {}, but that Port already references Edge {}. Ignored Request.", edge.getUuid().getValue(), lport.getUuid().getValue(), lport.getEdgeId().getValue()); return; } Port rport = UlnDatastoreApi.readPortFromDs(edge.getTenantId(), edge.getRightPortId()); if (rport != null && rport.getEdgeId() != null && !edge.getUuid().equals(rport.getEdgeId())) { LOG.error( "Trying to Submit Edge {} that references Port {}, but that Port already references Edge {}. Ignored Request.", edge.getUuid().getValue(), rport.getUuid().getValue(), rport.getEdgeId().getValue()); return; } WriteTransaction t = UlnMapperDatastoreDependency.getDataProvider().newWriteOnlyTransaction(); t.put(logicalDatastoreType, UlnIidFactory.edgeIid(edge.getTenantId(), edge.getUuid()), edge, true); if (submitToDs(t)) { LOG.debug("Wrote logical edge {} to datastore.", edge.getUuid().getValue()); } else { LOG.error("Failed to write logical edge {} to datastore.", edge.getUuid().getValue()); } }