private OnmsNode getNode(int nodeId) { final OnmsNode onmsNode = nodeDao.get(nodeId); if (onmsNode == null) { throw new ProvisioningAdapterException("Node with id " + nodeId + " not found in database"); } return onmsNode; }
private void updateGroupConfiguration(String group) { Iterator<Integer> ite = m_onmsNodeRancidNodeMap.keySet().iterator(); while (ite.hasNext()) { Integer nodeId = ite.next(); RancidNode rnode = m_onmsNodeRancidNodeMap.get(nodeId); if (group.equals(rnode.getGroup())) { boolean stateUp = rnode.isStateUp(); rnode.setStateUp(false); try { updateConfiguration(nodeId.intValue(), rnode, m_cp, true); } catch (ProvisioningAdapterException pae) { LOG.error("updateGroupConfiguration: group: " + group + "failed set down for rancid node: " + rnode.getDeviceName() + "Reason: " + pae.getMessage()); } rnode.setStateUp(stateUp); } } }
/** {@inheritDoc} */ @Override public void processPendingOperationForNode(final AdapterOperation op) throws ProvisioningAdapterException { LOG.info("processPendingOperationForNode: Handling Operation: {}", op); if (op.getType() == AdapterOperationType.ADD || op.getType() == AdapterOperationType.UPDATE) { throw new ProvisioningAdapterException(new UnsupportedOperationException("This operation: "+op+", is currently not supported.")); } else if (op.getType() == AdapterOperationType.DELETE) { throw new ProvisioningAdapterException(new UnsupportedOperationException("This operation: "+op+", is currently not supported.")); } else if (op.getType() == AdapterOperationType.CONFIG_CHANGE) { throw new ProvisioningAdapterException(new UnsupportedOperationException("This operation: "+op+", is currently not supported.")); } else { LOG.warn("unknown operation: {}", op.getType()); } } }
private void updateGroupConfiguration(String group) { Iterator<Integer> ite = m_onmsNodeRancidNodeMap.keySet().iterator(); while (ite.hasNext()) { Integer nodeId = ite.next(); RancidNode rnode = m_onmsNodeRancidNodeMap.get(nodeId); if (group.equals(rnode.getGroup())) { boolean stateUp = rnode.isStateUp(); rnode.setStateUp(false); try { updateConfiguration(nodeId.intValue(), rnode, m_cp, true); } catch (ProvisioningAdapterException pae) { LOG.error("updateGroupConfiguration: group: " + group + "failed set down for rancid node: " + rnode.getDeviceName() + "Reason: " + pae.getMessage()); } rnode.setStateUp(stateUp); } } }
private void sendAndThrow(int nodeId, Throwable e) { String message = e.getLocalizedMessage() == null ? "" : ": " + e.getLocalizedMessage(); Event event = buildEvent( EventConstants.PROVISIONING_ADAPTER_FAILED, nodeId ).addParam( "reason", MESSAGE_PREFIX + e.getClass().getName() + message ).getEvent(); m_eventForwarder.sendNow(event); throw new ProvisioningAdapterException(MESSAGE_PREFIX, e); }
@Override public void run() { try { if (isNodeReady(this)) { m_operationQueue.dequeueOperationForNode(m_nodeId, this); // Synchronize here so that we can signal any interested classes that this // operation is being executed synchronized(this) { try { processPendingOperationForNode(this); } catch (ProvisioningAdapterException e) { LOG.warn("Exception thrown during adapter queuing, rescheduling: {}", e.getMessage(), e); //reschedule if the adapter throws a provisioning adapter exception schedule(getExecutorService(), true); } finally { this.notifyAll(); } } } else { schedule(getExecutorService(), false); } } catch (Throwable e) { LOG.error("Unexpected exception during node operation: {}", e.getMessage(), e); } } }
private void sendAndThrow(int nodeId, Throwable e) { LOG.debug("sendAndThrow: error working on nodeid: {}", nodeId); LOG.debug("sendAndThrow: Exception: {}", e.getMessage()); Event event = buildEvent(EventConstants.PROVISIONING_ADAPTER_FAILED, nodeId).addParam("reason", MESSAGE_PREFIX+e.getLocalizedMessage()).getEvent(); m_eventForwarder.sendNow(event); throw new ProvisioningAdapterException(MESSAGE_PREFIX, e); }
private void sendAndThrow(int nodeId, Throwable e) { LOG.debug("sendAndThrow: error working on nodeid: {}", nodeId); LOG.debug("sendAndThrow: Exception: {}", e.getMessage()); Event event = buildEvent(EventConstants.PROVISIONING_ADAPTER_FAILED, nodeId).addParam("reason", MESSAGE_PREFIX+e.getLocalizedMessage()).getEvent(); m_eventForwarder.sendNow(event); throw new ProvisioningAdapterException(MESSAGE_PREFIX, e); }
private void sendAndThrow(final Throwable e) { final Event event = buildEvent(EventConstants.PROVISIONING_ADAPTER_FAILED).addParam("reason", MESSAGE_PREFIX+e.getLocalizedMessage()).getEvent(); m_eventForwarder.sendNow(event); LOG.error(e.getMessage()); throw new ProvisioningAdapterException(MESSAGE_PREFIX, e); }
private void sendAndThrow(int nodeId, Exception e) { Event event = buildEvent(EventConstants.PROVISIONING_ADAPTER_FAILED, nodeId).addParam("reason", MESSAGE_PREFIX+e.getLocalizedMessage()).getEvent(); m_eventForwarder.sendNow(event); throw new ProvisioningAdapterException(MESSAGE_PREFIX, e); }
} catch (final Exception e) { LOG.error("syncMaps: Caught exception synchronizing maps", e); throw new ProvisioningAdapterException("syncMaps exception",e);
if (m_onmsNodeRancidNodeMap.containsValue(rNode)) { LOG.error("doAdd: Error Duplicate node: {}", node); ProvisioningAdapterException e = new ProvisioningAdapterException("Duplicate node has been added: "+node); sendAndThrow(nodeId, e); return;
if (m_onmsNodeRancidNodeMap.containsValue(rNode)) { LOG.error("doAdd: Error Duplicate node: {}", node); ProvisioningAdapterException e = new ProvisioningAdapterException("Duplicate node has been added: "+node); sendAndThrow(nodeId, e); return;
final OnmsNode node = m_nodeDao.get(nodeId); if (node == null) { throw new ProvisioningAdapterException("Failed to return node for given nodeId: " + nodeId); throw new ProvisioningAdapterException("Can't find the SNMP Primary IP address for nodeId: " + nodeId);