@Override public void onSuccess(final Void result) { LOG.trace("Successfully delete [{}]", id.toString()); }
@Override public void onFailure(final Throwable t) { LOG.error( String.format("Failed to delete [%s]", id.toString()), t); } });
public boolean equals(Object obj) { if (null == obj) { return false; } if (getClass() != obj.getClass()) { return false; } FlowInfoKey flowInfoKey = (FlowInfoKey) obj; if (null == flowInfoKey.nodeIID || null == flowInfoKey.match || !(this.nodeIID.toString().equals(flowInfoKey.nodeIID.toString())) || !(this.match.toString().equals(flowInfoKey.match.toString())) ) { return false; } return true; }
private void nodeRemoved(final InstanceIdentifier<?> key) { Preconditions.checkNotNull(key); LOG.info("Netconf event source [{}] is removing...", key.toString()); NetconfEventSourceRegistration nesr = registrationMap.remove(key); if (nesr != null) { nesr.close(); } }
@Override public void createStaleMarkEntity(InstanceIdentifier<Flow> identifier, Flow del, InstanceIdentifier<FlowCapableNode> nodeIdent) { LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent.toString(), del.toString()); StaleFlow staleFlow = makeStaleFlow(identifier, del, nodeIdent); persistStaleFlow(staleFlow, nodeIdent); }
private void nodeCreated(final InstanceIdentifier<?> key, final Node node) { Preconditions.checkNotNull(key); if (!validateNode(node)) { LOG.warn("NodeCreated event : Node [{}] is null or not valid.", key.toString()); return; } LOG.info("Netconf event source [{}] is creating...", key.toString()); NetconfEventSourceRegistration nesr = NetconfEventSourceRegistration.create(key, node, this); if (nesr != null) { NetconfEventSourceRegistration nesrOld = registrationMap.put(key, nesr); if (nesrOld != null) { nesrOld.close(); } } }
private void nodeUpdated(final InstanceIdentifier<?> key, final Node node) { Preconditions.checkNotNull(key); if (!validateNode(node)) { LOG.warn("NodeUpdated event : Node [{}] is null or not valid.", key.toString()); return; } LOG.info("Netconf event source [{}] is updating...", key.toString()); NetconfEventSourceRegistration nesr = registrationMap.get(key); if (nesr != null) { nesr.updateStatus(); } else { nodeCreated(key, node); } }
@Override public void createStaleMarkEntity(InstanceIdentifier<Meter> identifier, Meter del, InstanceIdentifier<FlowCapableNode> nodeIdent) { LOG.debug("Creating Stale-Mark entry for the switch {} for meter {} ", nodeIdent.toString(), del.toString()); StaleMeter staleMeter = makeStaleMeter(identifier, del, nodeIdent); persistStaleMeter(staleMeter, nodeIdent); }
@Override public void createStaleMarkEntity(InstanceIdentifier<Group> identifier, Group del, InstanceIdentifier<FlowCapableNode> nodeIdent) { LOG.debug("Creating Stale-Mark entry for the switch {} for Group {} ", nodeIdent.toString(), del.toString()); StaleGroup staleGroup = makeStaleGroup(identifier, del, nodeIdent); persistStaleGroup(staleGroup, nodeIdent); }
static <T extends DataObject> void update(DataBroker broker, final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path, final T data) { ActionableResource actResource = new ActionableResourceImpl(path.toString()); actResource.setAction(ActionableResource.UPDATE); actResource.setInstanceIdentifier(path); actResource.setInstance(data); bgpResourcesBufferQ.add(actResource); }
public static <T extends DataObject> void write(DataBroker broker, final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path, final T data) { ActionableResource actResource = new ActionableResourceImpl(path.toString()); actResource.setAction(ActionableResource.CREATE); actResource.setInstanceIdentifier(path); actResource.setInstance(data); bgpResourcesBufferQ.add(actResource); }
static <T extends DataObject> void delete(DataBroker broker, final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path) { ActionableResource actResource = new ActionableResourceImpl(path.toString()); actResource.setAction(ActionableResource.DELETE); actResource.setInstanceIdentifier(path); actResource.setInstance(null); bgpResourcesBufferQ.add(actResource); }
public void notifyNode(final InstanceIdentifier<?> nodeId) { LOG.debug("Notify node: {}", nodeId); try { final RpcResult<JoinTopicOutput> rpcResultJoinTopic = sourceService.joinTopic(getJoinTopicInputArgument(nodeId)).get(); if(rpcResultJoinTopic.isSuccessful() == false){ for(final RpcError err : rpcResultJoinTopic.getErrors()){ LOG.error("Can not join topic: [{}] on node: [{}]. Error: {}",getTopicId().getValue(),nodeId.toString(),err.toString()); } } else { joinedEventSources.add(nodeId); } } catch (final Exception e) { LOG.error("Could not invoke join topic for node {}", nodeId); } }
public void notifyNode(final InstanceIdentifier<?> nodeId) { LOG.debug("Notify node: {}", nodeId); try { final RpcResult<JoinTopicOutput> rpcResultJoinTopic = sourceService.joinTopic(getJoinTopicInputArgument(nodeId)).get(); if (!rpcResultJoinTopic.isSuccessful()) { for (final RpcError err : rpcResultJoinTopic.getErrors()) { LOG.error("Can not join topic: [{}] on node: [{}]. Error: {}", getTopicId().getValue(), nodeId.toString(), err.toString()); } } else { joinedEventSources.add(nodeId); } } catch (InterruptedException | ExecutionException e) { LOG.error("Could not invoke join topic for node {}", nodeId); } }
public boolean isBridgeOnOvsdbNode(Node ovsdbNode, String bridgeName) { boolean found = false; OvsdbNodeAugmentation ovsdbNodeAugmentation = extractNodeAugmentation(ovsdbNode); if (ovsdbNodeAugmentation != null) { List<ManagedNodeEntry> managedNodes = ovsdbNodeAugmentation.getManagedNodeEntry(); if (managedNodes != null) { for (ManagedNodeEntry managedNode : managedNodes) { InstanceIdentifier<?> bridgeIid = managedNode.getBridgeRef().getValue(); if (bridgeIid.toString().contains(bridgeName)) { found = true; break; } } } } return found; }
public boolean isBridgeOnOvsdbNode(Node ovsdbNode, String bridgeName) { boolean found = false; OvsdbNodeAugmentation ovsdbNodeAugmentation = extractNodeAugmentation(ovsdbNode); if (ovsdbNodeAugmentation != null) { List<ManagedNodeEntry> managedNodes = ovsdbNodeAugmentation.getManagedNodeEntry(); if (managedNodes != null) { for (ManagedNodeEntry managedNode : managedNodes) { InstanceIdentifier<?> bridgeIid = managedNode.getBridgeRef().getValue(); if (bridgeIid.toString().contains(bridgeName)) { found = true; break; } } } } return found; }
@Override protected void add(InstanceIdentifier<Interface> identifier, final Interface intrf) { if (intrf.getType() != null && intrf.getType().equals(Tunnel.class)) { if (intrf.getOperStatus().equals(Interface.OperStatus.Up)) { final String interfaceName = intrf.getName(); ElanClusterUtils.runOnlyInLeaderNode(entityOwnershipService, () -> { LOG.debug("running external tunnel update job for interface {} added", interfaceName); try { handleExternalTunnelUpdate(interfaceName, intrf); } catch (ElanException e) { LOG.error("Failed to add Interface: " + identifier.toString()); } }); } } }
private void flowNodeConnected(InstanceIdentifier<FlowCapableNode> connectedNode, boolean force) { if (force || !provider.isNodeActive(connectedNode)) { provider.registrateNewNode(connectedNode); if(!provider.isNodeOwner(connectedNode)) { return; } if (provider.getConfiguration().isStaleMarkingEnabled()) { LOG.info("Stale-Marking is ENABLED and proceeding with deletion of stale-marked entities on switch {}", connectedNode.toString()); reconciliationPreProcess(connectedNode); } ReconciliationTask reconciliationTask = new ReconciliationTask(connectedNode); executor.execute(reconciliationTask); } }
public void removeFlow(MacAddress srcMac, MacAddress dstMac, NodeConnectorRef dstNodeConnectorRef) { LOG.info("Removing Flow from " + dstNodeConnectorRef.toString()); TableKey flowTableKey = new TableKey(flowTableId); InstanceIdentifier<Flow> flowPath = buildFlowPath(createMacMatch(srcMac, dstMac), dstNodeConnectorRef, flowTableKey); LOG.info("Removed flow path: " + flowPath.toString()); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowPath); try { writeTransaction.submit().checkedGet(); } catch (TransactionCommitFailedException e) { LOG.error("Transaction failed: {}", e.toString()); } LOG.info("Transaction succeeded"); this.flowInfo.remove(new FlowInfoKey(InstanceIdentifierUtils.generateNodeInstanceIdentifier(dstNodeConnectorRef), createMacMatch(srcMac, dstMac))); }
public void removeFlow(Ipv4Address srcIp, Ipv4Address dstIp, NodeConnectorRef dstNodeConnectorRef) { LOG.info("Removing Flow from " + dstNodeConnectorRef.toString()); TableKey flowTableKey = new TableKey(flowTableId); InstanceIdentifier<Flow> flowPath = buildFlowPath(createIpv4Match(srcIp, dstIp), dstNodeConnectorRef, flowTableKey); LOG.info("Removed flow path: " + flowPath.toString()); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowPath); try { writeTransaction.submit().checkedGet(); } catch (TransactionCommitFailedException e) { LOG.error("Transaction failed: {}", e.toString()); } LOG.info("Transaction succeeded"); this.flowInfo.remove(new FlowInfoKey(InstanceIdentifierUtils.generateNodeInstanceIdentifier(dstNodeConnectorRef), createIpv4Match(srcIp, dstIp))); }