/** {@inheritDoc} */
  @Override
  public Requisition addInterfaceToNode(
      final String groupName, final String pathToNode, final String ipAddr) {
    m_writeLock.lock();
    try {
      final Requisition group = getProvisioningGroup(groupName);
      Assert.notNull(group, "Group should not be Null and is null groupName: " + groupName);
      final RequisitionNode node =
          PropertyUtils.getPathValue(group, pathToNode, RequisitionNode.class);
      Assert.notNull(node, "Node should not be Null and pathToNode: " + pathToNode);

      PrimaryType snmpPrimary = PrimaryType.PRIMARY;
      if (node.getInterfaceCount() > 0) {
        snmpPrimary = PrimaryType.SECONDARY;
      }

      // final int ifaceCount = node.getInterfaceCount();
      final RequisitionInterface iface = createInterface(ipAddr, snmpPrimary);
      node.putInterface(iface);
      // Assert.isTrue(node.getInterfaceCount() == (ifaceCount + 1), "Interface was not added
      // correctly");

      m_pendingForeignSourceRepository.save(group);
      m_pendingForeignSourceRepository.flush();
      return m_pendingForeignSourceRepository.getRequisition(groupName);
    } finally {
      m_writeLock.unlock();
    }
  }
 protected RequisitionNode createNode(final String id) {
   RequisitionNode node = new RequisitionNode();
   node.setForeignId(id);
   node.setNodeLabel("node " + id);
   RequisitionInterface iface = new RequisitionInterface();
   iface.setIpAddr("172.16.0." + id);
   node.putInterface(iface);
   return node;
 }
 void addOrReplaceInterface(final String foreignId, final RequisitionInterface iface) {
   final Requisition req = getActiveRequisition(true);
   if (req != null) {
     final RequisitionNode node = req.getNode(foreignId);
     if (node != null) {
       req.updateDateStamp();
       node.putInterface(iface);
       save(req);
     }
   }
 }