2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig;
12 import javax.management.InstanceNotFoundException;
13 import javax.management.ObjectName;
14 import org.opendaylight.controller.config.util.ConfigTransactionClient;
15 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
16 import org.opendaylight.controller.netconf.confignetconfconnector.exception.NetconfConfigHandlingException;
17 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml.AttributeConfigElement;
18 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ServiceRegistryWrapper;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class DeleteEditConfigStrategy extends AbstractEditConfigStrategy {
24 private static final Logger LOG = LoggerFactory.getLogger(DeleteEditConfigStrategy.class);
28 void handleMissingInstance(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta,
29 String module, String instance, ServiceRegistryWrapper services) throws NetconfConfigHandlingException {
30 throw new NetconfConfigHandlingException(String.format("Unable to delete %s : %s , ServiceInstance not found", module ,instance),
31 NetconfDocumentedException.ErrorType.application,
32 NetconfDocumentedException.ErrorTag.operation_failed,
33 NetconfDocumentedException.ErrorSeverity.error);
37 void executeStrategy(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta, ObjectName on, ServiceRegistryWrapper services) throws NetconfConfigHandlingException {
40 LOG.debug("ServiceInstance {} deleted successfully", on);
41 } catch (InstanceNotFoundException e) {
42 throw new NetconfConfigHandlingException(
43 String.format("Unable to delete %s because of exception %s" + on, e.getMessage()),
44 NetconfDocumentedException.ErrorType.application,
45 NetconfDocumentedException.ErrorTag.operation_failed,
46 NetconfDocumentedException.ErrorSeverity.error);