import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ModuleElementDefinition;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ModuleElementResolved;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.Services;
+import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.Services.ServiceInstance;
import org.opendaylight.controller.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation;
import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfigXmlParser.EditConfigExecution;
import org.opendaylight.controller.netconf.confignetconfconnector.osgi.YangStoreContext;
for (Map.Entry<String, Services.ServiceInstance> refNameToServiceEntry : refNameToInstance.entrySet()) {
ObjectName on = refNameToServiceEntry.getValue().getObjectName(ta.getTransactionName());
try {
- ObjectName saved = ta.saveServiceReference(qnameOfService, refNameToServiceEntry.getKey(), on);
- LOG.debug("Saving service {} with on {} under name {} with service on {}", qnameOfService,
- on, refNameToServiceEntry.getKey(), saved);
+ if (ServiceInstance.EMPTY_SERVICE_INSTANCE == refNameToServiceEntry.getValue()) {
+ ta.removeServiceReference(qnameOfService, refNameToServiceEntry.getKey());
+ LOG.debug("Removing service {} with name {}", qnameOfService, refNameToServiceEntry.getKey());
+ } else {
+ ObjectName saved = ta.saveServiceReference(qnameOfService, refNameToServiceEntry.getKey(), on);
+ LOG.debug("Saving service {} with on {} under name {} with service on {}", qnameOfService,
+ on, refNameToServiceEntry.getKey(), saved);
+ }
} catch (InstanceNotFoundException e) {
- throw new NetconfDocumentedException(String.format("Unable to save ref name " + refNameToServiceEntry.getKey() + " for instance " + on, e),
+ throw new NetconfDocumentedException(String.format("Unable to edit ref name " + refNameToServiceEntry.getKey() + " for instance " + on, e),
ErrorType.application,
ErrorTag.operation_failed,
ErrorSeverity.error);