Add prefixes to type attribute in generated xml from netconf 89/2989/4
authorMaros Marsalek <mmarsale@cisco.com>
Thu, 21 Nov 2013 16:50:31 +0000 (17:50 +0100)
committerMaros Marsalek <mmarsale@cisco.com>
Fri, 22 Nov 2013 10:57:42 +0000 (11:57 +0100)
Add support for parsing prefixed type attributes from incomming xml to netconf

Prefixed type attribute conforms to config api defined in yang

Change-Id: I4516ddb97d3fcfaab50f3402edb4a6e1bd6505cf
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
29 files changed:
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntry.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectMapper.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/ObjectNameAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/ObjectNameAttributeWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Config.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ModuleConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Services.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/ServiceTrackerTest.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_none.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_differentNamespaceTO.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_sameAttrDifferentNamespaces.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_sameAttrDifferentNamespacesList.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/namespaces/editConfig_typeNameConfigAttributeMatching.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised1.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised2.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised3.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised4.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised5.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised6.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised7.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/unrecognised/editConfig_unrecognised8.xml

index fdc573f..70a4edd 100644 (file)
@@ -7,21 +7,8 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.lang.String.format;
-import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.createConfigQName;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Sets;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
@@ -50,8 +37,20 @@ import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Sets;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static java.lang.String.format;
+import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.createConfigQName;
 
 /**
  * Represents part of yang model that describes a module.
@@ -129,13 +128,13 @@ public class ModuleMXBeanEntry extends AbstractEntry {
     private final String nullableDescription, packageName, javaNamePrefix,
             namespace;
 
-    private final Map<String /* java fully qualified name */, String/* identity local name */> providedServices;
+    private final Map<String, QName> providedServices;
 
     private Collection<RuntimeBeanEntry> runtimeBeans;
 
     public ModuleMXBeanEntry(IdentitySchemaNode id,
             Map<String, AttributeIfc> yangToAttributes, String packageName,
-            Map<String, String> providedServices2, String javaNamePrefix,
+            Map<String, QName> providedServices2, String javaNamePrefix,
             String namespace, Collection<RuntimeBeanEntry> runtimeBeans) {
         this.globallyUniqueName = id.getQName().getLocalName();
         this.yangToAttributes = yangToAttributes;
@@ -184,7 +183,7 @@ public class ModuleMXBeanEntry extends AbstractEntry {
      * @return services implemented by this module. Keys are fully qualified java names of generated
      * ServiceInterface classes, values are identity local names.
      */
-    public Map<String, String> getProvidedServices() {
+    public Map<String, QName> getProvidedServices() {
         return providedServices;
     }
 
@@ -317,7 +316,7 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                     checkState(moduleIdentity != null, "Cannot find identity "
                             + moduleLocalNameFromXPath
                             + " matching augmentation " + augmentation);
-                    Map<String, String> providedServices = findProvidedServices(
+                    Map<String, QName> providedServices = findProvidedServices(
                             moduleIdentity, currentModule, qNamesToSIEs,
                             schemaContext);
 
@@ -497,11 +496,11 @@ public class ModuleMXBeanEntry extends AbstractEntry {
         return yangToAttributes;
     }
 
-    private static Map<String, String> findProvidedServices(
+    private static Map<String, QName> findProvidedServices(
             IdentitySchemaNode moduleIdentity, Module currentModule,
             Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
             SchemaContext schemaContext) {
-        Map<String, String> result = new HashMap<>();
+        Map<String, QName> result = new HashMap<>();
         for (UnknownSchemaNode unknownNode : moduleIdentity
                 .getUnknownSchemaNodes()) {
             if (ConfigConstants.PROVIDED_SERVICE_EXTENSION_QNAME
@@ -510,8 +509,7 @@ public class ModuleMXBeanEntry extends AbstractEntry {
                         .getNodeParameter();
                 ServiceInterfaceEntry sie = findSIE(prefixAndIdentityLocalName,
                         currentModule, qNamesToSIEs, schemaContext);
-                result.put(sie.getFullyQualifiedName(), sie.getQName()
-                        .getLocalName());
+                result.put(sie.getFullyQualifiedName(), sie.getQName());
             }
         }
         return result;
index bdb9391..59dc11f 100644 (file)
@@ -15,9 +15,12 @@ import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
 
 import java.util.List;
+import java.util.Map;
 
 public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReadingStrategy<AttributeIfc> {
 
+    private static final Object PREFIX_SEPARATOR = ":";
+
     public ObjectNameAttributeReadingStrategy(DependencyAttribute attributeIfc) {
         super(attributeIfc);
     }
@@ -35,11 +38,28 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading
 
     private ObjectNameAttributeMappingStrategy.MappedDependency resolve(XmlElement firstChild) {
         XmlElement typeElement = firstChild.getOnlyChildElementWithSameNamespace(XmlNetconfConstants.TYPE_KEY);
-        String serviceName = typeElement.getTextContent();
+        Map.Entry<String, String> prefixNamespace = typeElement.findNamespaceOfTextContent();
+
+        String serviceName = checkPrefixAndExtractServiceName(typeElement, prefixNamespace);
+
         XmlElement nameElement = firstChild.getOnlyChildElementWithSameNamespace(XmlNetconfConstants.NAME_KEY);
         String dependencyName = nameElement.getTextContent();
 
-        return new ObjectNameAttributeMappingStrategy.MappedDependency(serviceName, dependencyName);
+        return new ObjectNameAttributeMappingStrategy.MappedDependency(prefixNamespace.getValue(), serviceName,
+                dependencyName);
+    }
+
+    public static String checkPrefixAndExtractServiceName(XmlElement typeElement, Map.Entry<String, String> prefixNamespace) {
+        String serviceName = typeElement.getTextContent();
+
+        Preconditions.checkState(prefixNamespace.equals("") == false, "Service %s value not prefixed with namespace",
+                XmlNetconfConstants.TYPE_KEY);
+        String prefix = prefixNamespace.getKey() + PREFIX_SEPARATOR;
+        Preconditions.checkState(serviceName.startsWith(prefix),
+                "Service %s not correctly prefixed, expected %s, but was %s", XmlNetconfConstants.TYPE_KEY, prefix,
+                serviceName);
+        serviceName = serviceName.substring(prefix.length());
+        return serviceName;
     }
 
 }
index d63e61c..3e63b92 100644 (file)
@@ -74,8 +74,9 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
     protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseDependencyAttribute(
             DependencyAttribute attributeIfc) {
         String serviceName = attributeIfc.getDependency().getSie().getQName().getLocalName();
+        String namespace = attributeIfc.getDependency().getSie().getQName().getNamespace().toString();
         return new ObjectNameAttributeMappingStrategy((SimpleType<?>) attributeIfc.getOpenType(), dependencyTracker,
-                serviceName);
+                serviceName, namespace);
     }
 
     @Override
index 1febf02..f4d88c7 100644 (file)
@@ -21,11 +21,13 @@ public class ObjectNameAttributeMappingStrategy extends
 
     private final Services tracker;
     private final String serviceName;
+    private final String namespace;
 
-    public ObjectNameAttributeMappingStrategy(SimpleType<?> openType, Services dependencyTracker, String serviceName) {
+    public ObjectNameAttributeMappingStrategy(SimpleType<?> openType, Services dependencyTracker, String serviceName, String namespace) {
         super(openType);
         this.tracker = dependencyTracker;
         this.serviceName = serviceName;
+        this.namespace = namespace;
     }
 
     @Override
@@ -40,17 +42,18 @@ public class ObjectNameAttributeMappingStrategy extends
         Util.checkType(value, ObjectName.class);
 
         ObjectName on = (ObjectName) value;
-        String refName = tracker.addServiceEntry(serviceName, on);
+        String refName = tracker.addServiceEntry(namespace, serviceName, on);
 
-        return Optional.of(new MappedDependency(serviceName, refName));
+        return Optional.of(new MappedDependency(namespace, serviceName, refName));
     }
 
     public static class MappedDependency {
-        private final String serviceName, refName;
+        private final String namespace, serviceName, refName;
 
-        public MappedDependency(String serviceName, String refName) {
+        public MappedDependency(String namespace, String serviceName, String refName) {
             this.serviceName = serviceName;
             this.refName = refName;
+            this.namespace = namespace;
         }
 
         public String getServiceName() {
@@ -61,10 +64,15 @@ public class ObjectNameAttributeMappingStrategy extends
             return refName;
         }
 
+        public String getNamespace() {
+            return namespace;
+        }
+
         @Override
         public String toString() {
             final StringBuffer sb = new StringBuffer("MappedDependency{");
-            sb.append("serviceName='").append(serviceName).append('\'');
+            sb.append("namespace='").append(namespace).append('\'');
+            sb.append(", serviceName='").append(serviceName).append('\'');
             sb.append(", refName='").append(refName).append('\'');
             sb.append('}');
             return sb.toString();
index af6e3db..c6f306b 100644 (file)
@@ -40,13 +40,11 @@ public class ObjectNameAttributeResolvingStrategy extends AbstractAttributeResol
 
         ObjectNameAttributeMappingStrategy.MappedDependency mappedDep = (ObjectNameAttributeMappingStrategy.MappedDependency) value;
         String serviceName = mappedDep.getServiceName();
-        if (serviceName.contains(":")) {
-            // hack for yuma
-            serviceName = serviceName.substring(serviceName.indexOf(":") + 1);
-        }
         String refName = mappedDep.getRefName();
-        logger.trace("Getting service instance by service name {} and ref name {}", serviceName, refName);
-        ServiceInstance byRefName = serviceTracker.getByServiceAndRefName(serviceName, refName);
+        String namespace = mappedDep.getNamespace();
+        logger.trace("Getting service instance by service name {} : {} and ref name {}", namespace, serviceName, refName);
+
+        ServiceInstance byRefName = serviceTracker.getByServiceAndRefName(namespace, serviceName, refName);
         ObjectName on = ObjectNameUtil.createReadOnlyModuleON(byRefName.getModuleName(), byRefName.getInstanceName());
         logger.debug("Attribute {} : {} parsed to type {}", attrName, value, getOpenType());
         return Optional.of(on);
index b88b672..8563b78 100644 (file)
@@ -37,8 +37,11 @@ public class ObjectNameAttributeWritingStrategy implements AttributeWritingStrat
 
         String moduleName = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getServiceName();
         String refName = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getRefName();
+        String namespaceForType = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getNamespace();
 
-        final Element typeElement = XmlUtil.createTextElement(document, XmlNetconfConstants.TYPE_KEY, moduleName);
+        Element typeElement = XmlUtil.createPrefixedTextElement(document, XmlNetconfConstants.TYPE_KEY, XmlNetconfConstants.PREFIX,
+                moduleName);
+        XmlUtil.addPrefixedNamespaceAttr(typeElement, XmlNetconfConstants.PREFIX, namespaceForType);
         innerNode.appendChild(typeElement);
 
         final Element nameElement = XmlUtil.createTextElement(document, XmlNetconfConstants.NAME_KEY, refName);
index 115fc2c..2242101 100644 (file)
@@ -87,10 +87,10 @@ public class Config {
     }
 
     private void addServices(Services serviceTracker, Collection<ObjectName> instances,
-            Collection<String> providedServices) {
+            Map<String, String> providedServices) {
         for (ObjectName instanceOn : instances) {
-            for (String serviceName : providedServices) {
-                serviceTracker.addServiceEntry(serviceName, instanceOn);
+            for (Entry<String, String> serviceName : providedServices.entrySet()) {
+                serviceTracker.addServiceEntry(serviceName.getKey(), serviceName.getValue(), instanceOn);
             }
         }
     }
@@ -149,6 +149,7 @@ public class Config {
         return root;
     }
 
+    // TODO remove commented modules from output
     private void addEmptyModulesCommented(Document document, Element root, String moduleNamespace,
             Entry<String, Collection<ObjectName>> moduleMappingEntry) {
         Element emptyModule = document.createElement(XmlNetconfConstants.MODULE_KEY);
@@ -224,7 +225,7 @@ public class Config {
         Optional<XmlElement> servicesElement = xml.getOnlyChildElementOptionally(XmlNetconfConstants.SERVICES_KEY,
                 XmlNetconfConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG);
 
-        Map<String, Map<String, String>> mappedServices;
+        Map<String, Map<String, Map<String, String>>> mappedServices;
         if (servicesElement.isPresent()) {
             mappedServices = Services.fromXml(servicesElement.get());
             recognisedChildren.add(servicesElement.get());
@@ -242,8 +243,9 @@ public class Config {
 
             checkState(moduleConfig != null, "Cannot find ModuleConfig with name " + factoryName + " in " + moduleNamesToConfigs);
             // Set<String> services = ;
-            for (String serviceName : moduleConfig.getProvidedServices()) {
-                services.addServiceEntry(serviceName, existingON);
+            for (Entry<String, String> serviceName : moduleConfig.getProvidedServices().entrySet()) {
+
+                services.addServiceEntry(serviceName.getKey(), serviceName.getValue(), existingON);
             }
         }
 
index 991a563..064cd9f 100644 (file)
@@ -8,34 +8,52 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.config;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
 import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
 import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditStrategyType;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import javax.management.ObjectName;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 public class ModuleConfig {
 
     private final String moduleName;
     private final InstanceConfig instanceConfig;
-    private final Collection<String> providedServices;
+    // TODO 2 services from same namespace ?
+    private final Map<String, String> providedServices;
 
-    public ModuleConfig(String moduleName, InstanceConfig mbeanMapping, Collection<String> providedServices) {
+    public ModuleConfig(String moduleName, InstanceConfig mbeanMapping, Collection<QName> providedServices) {
         this.moduleName = moduleName;
         this.instanceConfig = mbeanMapping;
-        this.providedServices = providedServices;
+        this.providedServices = mapServices(providedServices);
+    }
+
+    private Map<String, String> mapServices(Collection<QName> providedServices) {
+        HashMap<String, String> mapped = Maps.newHashMap();
+
+        for (QName providedService : providedServices) {
+            String key = providedService.getNamespace().toString();
+            Preconditions.checkState(mapped.containsKey(key) == false);
+            mapped.put(key, providedService.getLocalName());
+        }
+
+        return  mapped;
     }
 
     public InstanceConfig getMbeanMapping() {
         return instanceConfig;
     }
 
-    public Collection<String> getProvidedServices() {
+    public Map<String, String> getProvidedServices() {
         return providedServices;
     }
 
@@ -64,7 +82,7 @@ public class ModuleConfig {
 
     private String getPrefix(String namespace) {
         // if(namespace.contains(":")==false)
-        return "prefix";
+        return XmlNetconfConstants.PREFIX;
         // return namespace.substring(namespace.lastIndexOf(':') + 1,
         // namespace.length());
 
index 883dde7..e4fa6f5 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml.ObjectNameAttributeReadingStrategy;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
@@ -42,27 +43,33 @@ public final class Services {
     private long suffix = 1;
 
     private final Map<ServiceInstance, String> instanceToRef = Maps.newHashMap();
-    private final Map<String/* ServiceName */, Map<String/* refName */, ServiceInstance>> serviceNameToRefNameToInstance = Maps
+    private final Map<String /*Namespace*/, Map<String/* ServiceName */, Map<String/* refName */, ServiceInstance>>> namespaceToServiceNameToRefNameToInstance = Maps
             .newHashMap();
 
-    public String addServiceEntry(String serviceName, ObjectName on) {
+    public String addServiceEntry(String namespace, String serviceName, ObjectName on) {
 
         String moduleName = on.getKeyProperty("moduleFactoryName");
         String instanceName = on.getKeyProperty("instanceName");
 
-        String refName = addServiceEntry(serviceName, moduleName, instanceName);
+        String refName = addServiceEntry(namespace, serviceName, moduleName, instanceName);
         logger.trace("Added service entry to tracker. Service name {}, ref name {}, module name {}, instance name {}",
                 serviceName, refName, moduleName, instanceName);
         return refName;
     }
 
     @VisibleForTesting
-    public String addServiceEntry(String serviceName, String moduleName, String instanceName) {
+    public String addServiceEntry(String namespace, String serviceName, String moduleName, String instanceName) {
         ServiceInstance serviceInstance = new ServiceInstance(moduleName, instanceName);
         serviceInstance.setServiceName(serviceName);
 
         String refName = instanceToRef.get(serviceInstance);
 
+        Map<String, Map<String, ServiceInstance>> serviceNameToRefNameToInstance = namespaceToServiceNameToRefNameToInstance.get(namespace);
+        if (serviceNameToRefNameToInstance == null) {
+            serviceNameToRefNameToInstance = Maps.newHashMap();
+            namespaceToServiceNameToRefNameToInstance.put(namespace, serviceNameToRefNameToInstance);
+        }
+
         Map<String, ServiceInstance> refNameToInstance = serviceNameToRefNameToInstance.get(serviceName);
         if (refNameToInstance == null) {
             refNameToInstance = Maps.newHashMap();
@@ -101,7 +108,11 @@ public final class Services {
         return refNamesAsSet;
     }
 
-    public ServiceInstance getByServiceAndRefName(String serviceName, String refName) {
+    public ServiceInstance getByServiceAndRefName(String namespace, String serviceName, String refName) {
+        Map<String, Map<String, ServiceInstance>> serviceNameToRefNameToInstance = namespaceToServiceNameToRefNameToInstance.get(namespace);
+        Preconditions.checkArgument(serviceNameToRefNameToInstance != null, "No serviceInstances mapped to " + namespace + " , "
+                + serviceNameToRefNameToInstance.keySet());
+
         Map<String, ServiceInstance> refNameToInstance = serviceNameToRefNameToInstance.get(serviceName);
         Preconditions.checkArgument(refNameToInstance != null, "No serviceInstances mapped to " + serviceName + " , "
                 + serviceNameToRefNameToInstance.keySet());
@@ -114,20 +125,28 @@ public final class Services {
 
     // TODO hide getMappedServices, call it explicitly in toXml
 
-    public Map<String, Map<String, String>> getMappedServices() {
-        Map<String, Map<String, String>> retVal = Maps.newHashMap();
+    public Map<String, Map<String, Map<String, String>>> getMappedServices() {
+        Map<String, Map<String, Map<String, String>>> retVal = Maps.newHashMap();
+
+        for (String namespace : namespaceToServiceNameToRefNameToInstance.keySet()) {
 
-        for (String serviceName : serviceNameToRefNameToInstance.keySet()) {
+            Map<String, Map<String, ServiceInstance>> serviceNameToRefNameToInstance = namespaceToServiceNameToRefNameToInstance
+                    .get(namespace);
+            Map<String, Map<String, String>> innerRetVal = Maps.newHashMap();
 
-            Map<String, String> innerRetVal = Maps.transformValues(serviceNameToRefNameToInstance.get(serviceName),
-                    new Function<ServiceInstance, String>() {
-                        @Nullable
-                        @Override
-                        public String apply(@Nullable ServiceInstance serviceInstance) {
-                            return serviceInstance.toString();
-                        }
-                    });
-            retVal.put(serviceName, innerRetVal);
+            for (String serviceName : serviceNameToRefNameToInstance.keySet()) {
+
+                Map<String, String> innerInnerRetVal = Maps.transformValues(
+                        serviceNameToRefNameToInstance.get(serviceName), new Function<ServiceInstance, String>() {
+                            @Nullable
+                            @Override
+                            public String apply(@Nullable ServiceInstance serviceInstance) {
+                                return serviceInstance.toString();
+                            }
+                        });
+                innerRetVal.put(serviceName, innerInnerRetVal);
+            }
+            retVal.put(namespace, innerRetVal);
         }
 
         return retVal;
@@ -135,35 +154,45 @@ public final class Services {
 
     // TODO hide resolveServices, call it explicitly in fromXml
 
-    public static Services resolveServices(Map<String, Map<String, String>> mappedServices) {
+    public static Services resolveServices(Map<String, Map<String, Map<String, String>>> mappedServices) {
         Services tracker = new Services();
 
-        for (Entry<String, Map<String, String>> serviceEntry : mappedServices.entrySet()) {
+        for (Entry<String, Map<String, Map<String, String>>> namespaceEntry : mappedServices.entrySet()) {
+            String namespace = namespaceEntry.getKey();
 
-            String serviceName = serviceEntry.getKey();
-            for (Entry<String, String> refEntry : serviceEntry.getValue().entrySet()) {
+            for (Entry<String, Map<String, String>> serviceEntry : namespaceEntry.getValue().entrySet()) {
 
-                Map<String, ServiceInstance> refNameToInstance = tracker.serviceNameToRefNameToInstance
-                        .get(serviceName);
-                if (refNameToInstance == null) {
-                    refNameToInstance = Maps.newHashMap();
-                    tracker.serviceNameToRefNameToInstance.put(serviceName, refNameToInstance);
-                }
+                String serviceName = serviceEntry.getKey();
+                for (Entry<String, String> refEntry : serviceEntry.getValue().entrySet()) {
 
-                String refName = refEntry.getKey();
-                Preconditions.checkState(false == refNameToInstance.containsKey(refName),
-                        "Duplicate reference name to service " + refName + " under service " + serviceName);
-                ServiceInstance serviceInstance = ServiceInstance.fromString(refEntry.getValue());
-                refNameToInstance.put(refName, serviceInstance);
+                    Map<String, Map<String, ServiceInstance>> namespaceToServices = tracker.namespaceToServiceNameToRefNameToInstance.get(namespace);
+                    if (namespaceToServices == null) {
+                        namespaceToServices = Maps.newHashMap();
+                        tracker.namespaceToServiceNameToRefNameToInstance.put(namespace, namespaceToServices);
+                    }
+
+                    Map<String, ServiceInstance> refNameToInstance = namespaceToServices
+                            .get(serviceName);
+                    if (refNameToInstance == null) {
+                        refNameToInstance = Maps.newHashMap();
+                        namespaceToServices.put(serviceName, refNameToInstance);
+                    }
 
-                tracker.instanceToRef.put(serviceInstance, refEntry.getKey());
+                    String refName = refEntry.getKey();
+                    Preconditions.checkState(false == refNameToInstance.containsKey(refName),
+                            "Duplicate reference name to service " + refName + " under service " + serviceName);
+                    ServiceInstance serviceInstance = ServiceInstance.fromString(refEntry.getValue());
+                    refNameToInstance.put(refName, serviceInstance);
+
+                    tracker.instanceToRef.put(serviceInstance, refEntry.getKey());
+                }
             }
         }
         return tracker;
     }
 
-    public static Map<String, Map<String, String>> fromXml(XmlElement xml) {
-        Map<String, Map<String, String>> retVal = Maps.newHashMap();
+    public static Map<String, Map<String, Map<String, String>>> fromXml(XmlElement xml) {
+        Map<String, Map<String, Map<String, String>>> retVal = Maps.newHashMap();
 
         List<XmlElement> services = xml.getChildElements(SERVICE_KEY);
         xml.checkUnrecognisedElements(services);
@@ -171,10 +200,20 @@ public final class Services {
         for (XmlElement service : services) {
 
             XmlElement typeElement = service.getOnlyChildElement(TYPE_KEY);
-            String serviceName = typeElement.getTextContent();
+            Entry<String, String> prefixNamespace = typeElement.findNamespaceOfTextContent();
+
+            Preconditions.checkState(prefixNamespace.getKey()!=null && prefixNamespace.getKey().equals("") == false, "Type attribute was not prefixed");
+
+            Map<String, Map<String, String>> namespaceToServices = retVal.get(prefixNamespace.getValue());
+            if(namespaceToServices == null) {
+                namespaceToServices = Maps.newHashMap();
+                retVal.put(prefixNamespace.getValue(), namespaceToServices);
+            }
+
+            String serviceName =  ObjectNameAttributeReadingStrategy.checkPrefixAndExtractServiceName(typeElement, prefixNamespace);
 
             Map<String, String> innerMap = Maps.newHashMap();
-            retVal.put(serviceName, innerMap);
+            namespaceToServices.put(serviceName, innerMap);
 
             List<XmlElement> instances = service.getChildElements(XmlNetconfConstants.INSTANCE_KEY);
             service.checkUnrecognisedElements(instances, typeElement);
@@ -205,29 +244,34 @@ public final class Services {
         }
     }
 
-    public Element toXml(Map<String, Map<String, String>> mappedServices, Document document) {
+    public Element toXml(Map<String, Map<String, Map<String, String>>> mappedServices, Document document) {
         Element root = document.createElement(XmlNetconfConstants.SERVICES_KEY);
         XmlUtil.addNamespaceAttr(root, XmlNetconfConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG);
 
-        for (Entry<String, Map<String, String>> serviceEntry : mappedServices.entrySet()) {
-            Element serviceElement = document.createElement(SERVICE_KEY);
-            root.appendChild(serviceElement);
+        for (String namespace : mappedServices.keySet()) {
+
+            for (Entry<String, Map<String, String>> serviceEntry : mappedServices.get(namespace).entrySet()) {
+                Element serviceElement = document.createElement(SERVICE_KEY);
+                root.appendChild(serviceElement);
 
-            Element typeElement = XmlUtil.createTextElement(document, TYPE_KEY, serviceEntry.getKey());
-            serviceElement.appendChild(typeElement);
+                Element typeElement = XmlUtil.createPrefixedTextElement(document, TYPE_KEY, XmlNetconfConstants.PREFIX,
+                        serviceEntry.getKey());
+                XmlUtil.addPrefixedNamespaceAttr(typeElement, XmlNetconfConstants.PREFIX, namespace);
+                serviceElement.appendChild(typeElement);
 
-            for (Entry<String, String> instanceEntry : serviceEntry.getValue().entrySet()) {
-                Element instanceElement = document.createElement(XmlNetconfConstants.INSTANCE_KEY);
-                serviceElement.appendChild(instanceElement);
+                for (Entry<String, String> instanceEntry : serviceEntry.getValue().entrySet()) {
+                    Element instanceElement = document.createElement(XmlNetconfConstants.INSTANCE_KEY);
+                    serviceElement.appendChild(instanceElement);
 
-                Element nameElement = XmlUtil.createTextElement(document, NAME_KEY, instanceEntry.getKey());
-                instanceElement.appendChild(nameElement);
+                    Element nameElement = XmlUtil.createTextElement(document, NAME_KEY, instanceEntry.getKey());
+                    instanceElement.appendChild(nameElement);
 
-                Element providerElement = XmlUtil.createTextElement(document, PROVIDER_KEY, instanceEntry.getValue());
-                instanceElement.appendChild(providerElement);
+                    Element providerElement = XmlUtil.createTextElement(document, PROVIDER_KEY, instanceEntry.getValue());
+                    instanceElement.appendChild(providerElement);
+                }
             }
-        }
 
+        }
         return root;
     }
 
index 362f023..101af48 100644 (file)
@@ -151,6 +151,7 @@ public class EditConfig extends AbstractConfigNetconfOperation {
             Map<String/* Namespace from yang file */,
                     Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> mBeanEntries) {
         Map<String, Map<String, ModuleConfig>> factories = transform(configRegistryClient, mBeanEntries);
+
         return new Config(factories);
     }
 
index 9b8c150..79b3e26 100644 (file)
@@ -80,6 +80,7 @@ public class GetConfig extends AbstractConfigNetconfOperation {
         Element dataElement = document.createElement(XmlNetconfConstants.DATA_KEY);
         final Set<ObjectName> instances = Datastore.getInstanceQueryStrategy(source, this.transactionProvider)
                 .queryInstances(configRegistryClient);
+
         final Config configMapping = new Config(transform(configRegistryClient,
                 yangStoreSnapshot.getModuleMXBeanEntryMap()));
         dataElement = configMapping.toXml(instances, this.maybeNamespace, document, dataElement);
index d404a96..de0ecdb 100644 (file)
@@ -143,6 +143,7 @@ public class NetconfMappingTest extends AbstractConfigTest {
         edit("netconfMessages/editConfig.xml");
         checkBinaryLeafEdited(getConfigCandidate());
 
+
         // default-operation:none, should not affect binary leaf
         edit("netconfMessages/editConfig_none.xml");
         checkBinaryLeafEdited(getConfigCandidate());
@@ -150,7 +151,6 @@ public class NetconfMappingTest extends AbstractConfigTest {
         // check after edit
         commit();
         Element response = getConfigRunning();
-        // System.out.println(Xml.toString(response));
 
         checkBinaryLeafEdited(response);
         checkTypeConfigAttribute(response);
index e07f9ce..425ecf6 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
+* Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*/
 
 package org.opendaylight.controller.netconf.confignetconfconnector;
 
@@ -31,41 +31,41 @@ public class ServiceTrackerTest {
     @Test
     public void testOneInstanceMultipleServices() {
         Services services = new Services();
-        services.addServiceEntry("s1", "module", "instance");
+        services.addServiceEntry("nm", "s1", "module", "instance");
         assertEquals(1, services.getMappedServices().size());
 
-        services.addServiceEntry("s2", "module", "instance");
+        services.addServiceEntry("nm2", "s2", "module", "instance");
         assertEquals(2, services.getMappedServices().size());
     }
 
     @Test
     public void testMultipleInstancesOneName() throws Exception {
         Services services = new Services();
-        services.addServiceEntry("s1", "module", "instance");
+        services.addServiceEntry("nm", "s1", "module", "instance");
         assertEquals(1, services.getMappedServices().size());
 
-        services.addServiceEntry("s1", "module2", "instance");
+        services.addServiceEntry("nm", "s1", "module2", "instance");
         assertEquals(1, services.getMappedServices().size());
-        assertEquals(2, services.getMappedServices().get("s1").size());
-        assertTrue(services.getMappedServices().get("s1").containsKey("ref_instance"));
-        assertTrue(services.getMappedServices().get("s1").containsKey("ref_instance_1"));
+        assertEquals(2, services.getMappedServices().get("nm").get("s1").size());
+        assertTrue(services.getMappedServices().get("nm").get("s1").containsKey("ref_instance"));
+        assertTrue(services.getMappedServices().get("nm").get("s1").containsKey("ref_instance_1"));
     }
 
     @Test
     public void testMultipleInstancesOneName2() throws Exception {
         Services services = new Services();
-        services.addServiceEntry("s1", "module", "instance_1");
-
-        services.addServiceEntry("s2", "module2", "instance");
-        services.addServiceEntry("s2", "module3", "instance");
-        services.addServiceEntry("s1", "module3", "instance");
-
-        assertEquals(2, services.getMappedServices().get("s1").size());
-        assertEquals(2, services.getMappedServices().get("s2").size());
-        assertTrue(services.getMappedServices().get("s1").containsKey("ref_instance_2"));
-        assertTrue(services.getMappedServices().get("s1").containsKey("ref_instance_1"));
-        assertTrue(services.getMappedServices().get("s2").containsKey("ref_instance"));
-        assertTrue(services.getMappedServices().get("s2").containsKey("ref_instance_2"));
+        services.addServiceEntry("nm", "s1", "module", "instance_1");
+
+        services.addServiceEntry("nm2", "s2", "module2", "instance");
+        services.addServiceEntry("nm2", "s2", "module3", "instance");
+        services.addServiceEntry("nm", "s1", "module3", "instance");
+
+        assertEquals(2, services.getMappedServices().get("nm").get("s1").size());
+        assertEquals(2, services.getMappedServices().get("nm2").get("s2").size());
+        assertTrue(services.getMappedServices().get("nm").get("s1").containsKey("ref_instance_2"));
+        assertTrue(services.getMappedServices().get("nm").get("s1").containsKey("ref_instance_1"));
+        assertTrue(services.getMappedServices().get("nm2").get("s2").containsKey("ref_instance"));
+        assertTrue(services.getMappedServices().get("nm2").get("s2").containsKey("ref_instance_2"));
     }
 
 }
index c37b4ab..212214c 100644 (file)
@@ -326,7 +326,7 @@ public class XmlElement {
             prefix = "";
         }
         if (namespaces.containsKey(prefix) == false) {
-            throw new IllegalArgumentException("Cannot find namespace for " + element + ". Prefix from content is "
+            throw new IllegalArgumentException("Cannot find namespace for " + XmlUtil.toString(element) + ". Prefix from content is "
                     + prefix + ". Found namespaces " + namespaces);
         }
         return Maps.immutableEntry(prefix, namespaces.get(prefix));
index 2a900e0..7fb293f 100644 (file)
@@ -33,6 +33,8 @@ public class XmlNetconfConstants {
     public static final String NAME_KEY = "name";
     public static final String NOTIFICATION_ELEMENT_NAME = "notification";
 
+    public static final String PREFIX = "prefix";
+
     //
     //
     public static final String RFC4741_TARGET_NAMESPACE = "urn:ietf:params:xml:ns:netconf:base:1.0";
index 904c0a6..0611dce 100644 (file)
@@ -75,7 +75,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -86,7 +86,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -94,7 +94,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 42021c5..c825536 100644 (file)
@@ -69,7 +69,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
             </modules>
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index efa4690..82c218d 100644 (file)
@@ -75,7 +75,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -86,7 +86,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -94,7 +94,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 3dbb297..7c19b9f 100644 (file)
@@ -76,7 +76,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -87,7 +87,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -95,7 +95,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 504ccff..84ae575 100644 (file)
@@ -75,7 +75,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -86,7 +86,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -94,7 +94,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 8398fdb..2d9e9ed 100644 (file)
@@ -74,7 +74,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -85,7 +85,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -93,7 +93,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 6b267c5..e675e86 100644 (file)
@@ -23,7 +23,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 8ca7ee7..9407dd0 100644 (file)
@@ -24,7 +24,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index d3705cc..233ad23 100644 (file)
@@ -25,7 +25,7 @@
                 <unknownAttribute>error</unknownAttribute>
                 l
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index a485574..4593887 100644 (file)
@@ -24,7 +24,7 @@
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 l
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <unknownAttribute>error</unknownAttribute>
 
                     <instance>
index 654a183..81c4137 100644 (file)
@@ -24,7 +24,7 @@
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 l
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
 
                     <instance>
                         <name>ref_dep</name>
index fc43a77..528d5b0 100644 (file)
@@ -23,7 +23,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index 1bea536..a1e304b 100644 (file)
@@ -75,7 +75,7 @@
                         <core-size>44</core-size>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -86,7 +86,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -94,7 +94,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']
index d0afb27..812882a 100644 (file)
@@ -75,7 +75,7 @@
                         <unknownAttribute>error</unknownAttribute>
                     </peers>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -86,7 +86,7 @@
                     </type>
                     <name>test2</name>
                     <testing-dep>
-                        <type>testing</type>
+                        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                         <name>ref_dep</name>
                     </testing-dep>
                 </module>
@@ -94,7 +94,7 @@
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <service>
-                    <type>testing</type>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:test">prefix:testing</type>
                     <instance>
                         <name>ref_dep</name>
                         <provider>/config/modules/module[name='impl-dep']/instance[name='dep']