@Test public void testWhenJustModificationOfProperties() { EditContainmentNode deviceEditNode = new EditContainmentNode(DEVICE_MANAGEMENT_QNAME, EditConfigOperations.MERGE); deviceEditNode.addLeafChangeNode(TYPE_QNAME, new GenericConfigAttribute(TYPE, NS, "TYPE1")); deviceEditNode.addLeafChangeNode(INTERFACE_VERSION_QNAME, new GenericConfigAttribute(INTERFACE_VERSION, NS, "1.0")); EditContext editContext = new EditContext(deviceEditNode, null, ERROR_ON_ROLLBACK, null); m_deviceConfigInterceptor.interceptEditConfig(m_modelNode, editContext); verifyZeroInteractions(m_adapterManager); }
@Override public void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext) throws EditConfigException { EditContainmentNode editNode = editContext.getEditNode(); if (editNode.getName().equals("device-management") && editNode.getNamespace().equals(NS) && isCreateOrMergeOrReplace(editNode.getEditOperation())) { DeviceAdapterId adapterId = getAdapterId(editNode); if (adapterId.getType() == null || adapterId.getInterfaceVersion() == null || adapterId.getModel() == null || adapterId.getVendor() == null) { return; } if (m_adapterManager.getDeviceAdapter(adapterId) == null) { NetconfRpcError error = NetconfRpcErrorUtil.getApplicationError(NetconfRpcErrorTag.INVALID_VALUE, "Invalid adapter details for device. " + adapterId + " not deployed"); throw new EditConfigException(error); } } }
DeviceConfigInterceptor implements ModelNodeInterceptor { @Override public void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext) throws EditConfigException { EditContainmentNode editNode = editContext.getEditNode(); if (editNode.getName().equals("device-management") && editNode.getNamespace().equals(NS) && isCreateOrMergeOrReplace(editNode.getEditOperation())) { DeviceAdapterId adapterId = getAdapterId(editNode); if (adapterId.getType() == null || adapterId.getInterfaceVersion() == null || adapterId.getModel() == null || adapterId.getVendor() == null) { return; } if (m_adapterManager.getDeviceAdapter(adapterId) == null) { NetconfRpcError error = NetconfRpcErrorUtil.getApplicationError(NetconfRpcErrorTag.INVALID_VALUE, "Invalid adapter details for device. " + adapterId + " not deployed"); throw new EditConfigException(error); } } } }
DeviceConfigInterceptor implements ModelNodeInterceptor { @Override public void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext) throws EditConfigException { EditContainmentNode editNode = editContext.getEditNode(); if (editNode.getName().equals("device-management") && editNode.getNamespace().equals(NS) && isCreateOrMergeOrReplace(editNode.getEditOperation())) { DeviceAdapterId adapterId = getAdapterId(editNode); if (adapterId.getType() == null || adapterId.getInterfaceVersion() == null || adapterId.getModel() == null || adapterId.getVendor() == null) { return; } if (m_adapterManager.getDeviceAdapter(adapterId) == null) { NetconfRpcError error = NetconfRpcErrorUtil.getApplicationError(NetconfRpcErrorTag.INVALID_VALUE, "Invalid adapter details for device. " + adapterId + " not deployed"); throw new EditConfigException(error); } } } DeviceConfigInterceptor(AdapterManager adapterManager); }
DeviceConfigInterceptor implements ModelNodeInterceptor { @Override public void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext) throws EditConfigException { EditContainmentNode editNode = editContext.getEditNode(); if (editNode.getName().equals("device-management") && editNode.getNamespace().equals(NS) && isCreateOrMergeOrReplace(editNode.getEditOperation())) { DeviceAdapterId adapterId = getAdapterId(editNode); if (adapterId.getType() == null || adapterId.getInterfaceVersion() == null || adapterId.getModel() == null || adapterId.getVendor() == null) { return; } if (m_adapterManager.getDeviceAdapter(adapterId) == null) { NetconfRpcError error = NetconfRpcErrorUtil.getApplicationError(NetconfRpcErrorTag.INVALID_VALUE, "Invalid adapter details for device. " + adapterId + " not deployed"); throw new EditConfigException(error); } } } DeviceConfigInterceptor(AdapterManager adapterManager); @Override void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext); }
DeviceConfigInterceptor implements ModelNodeInterceptor { @Override public void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext) throws EditConfigException { EditContainmentNode editNode = editContext.getEditNode(); if (editNode.getName().equals("device-management") && editNode.getNamespace().equals(NS) && isCreateOrMergeOrReplace(editNode.getEditOperation())) { DeviceAdapterId adapterId = getAdapterId(editNode); if (adapterId.getType() == null || adapterId.getInterfaceVersion() == null || adapterId.getModel() == null || adapterId.getVendor() == null) { return; } if (m_adapterManager.getDeviceAdapter(adapterId) == null) { NetconfRpcError error = NetconfRpcErrorUtil.getApplicationError(NetconfRpcErrorTag.INVALID_VALUE, "Invalid adapter details for device. " + adapterId + " not deployed"); throw new EditConfigException(error); } } } DeviceConfigInterceptor(AdapterManager adapterManager); @Override void interceptEditConfig(HelperDrivenModelNode modelNode, EditContext editContext);  }