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;
11 import com.google.common.collect.HashMultimap;
12 import com.google.common.collect.Multimap;
13 import org.opendaylight.controller.config.util.ConfigTransactionClient;
14 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
15 import org.opendaylight.controller.netconf.confignetconfconnector.exception.NetconfConfigHandlingException;
16 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml.AttributeConfigElement;
17 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ServiceRegistryWrapper;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 import javax.management.InstanceNotFoundException;
22 import javax.management.ObjectName;
25 public class DeleteEditConfigStrategy extends AbstractEditConfigStrategy {
27 private static final Logger logger = LoggerFactory.getLogger(DeleteEditConfigStrategy.class);
29 private final Multimap<String, String> providedServices;
31 public DeleteEditConfigStrategy() {
32 this.providedServices = HashMultimap.create();
35 public DeleteEditConfigStrategy(Multimap<String, String> providedServices) {
36 this.providedServices = providedServices;
40 void handleMissingInstance(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta,
41 String module, String instance, ServiceRegistryWrapper services) throws NetconfConfigHandlingException {
42 throw new NetconfConfigHandlingException(String.format("Unable to delete %s : %s , ServiceInstance not found", module ,instance),
43 NetconfDocumentedException.ErrorType.application,
44 NetconfDocumentedException.ErrorTag.operation_failed,
45 NetconfDocumentedException.ErrorSeverity.error);
49 void executeStrategy(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta, ObjectName on, ServiceRegistryWrapper services) throws NetconfConfigHandlingException {
52 logger.debug("ServiceInstance {} deleted successfully", on);
53 } catch (InstanceNotFoundException e) {
54 throw new NetconfConfigHandlingException(
55 String.format("Unable to delete %s because of exception %s" + on, e.getMessage()),
56 NetconfDocumentedException.ErrorType.application,
57 NetconfDocumentedException.ErrorTag.operation_failed,
58 NetconfDocumentedException.ErrorSeverity.error);