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 fdc573f9757b1acb2c32162c9f1be757916a3e58..70a4edde41b70aa82852482fb24455ef0fee264d 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 bdb9391e2b5a26ac7191eac76448c422a2f0ad11..59dc11f0b81fc78b2ee6405a5d323541cc04e1d3 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 d63e61cea8658e4b5135300c35473337ca08c1fa..3e63b928848d617a2b9fbd29278a1eb5e7f7e88d 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 1febf02a2dc971b7d7fd884d2e62ff1ff57600ac..f4d88c7c8e371e0bbc8fd8614c76b79bc69a7a50 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 af6e3db8e9406827868cfe214ee498bc2ac0c08c..c6f306b3605cdc83652efd36e53cca6bb9b9f446 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 b88b6722c82d5fac9cd4423c32c42d30b543477a..8563b781e3403ba1e45c1bd06f15d2c1c536a51e 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 115fc2ccb6dc6f75c4a40cc15e95d2e6cc63a56a..2242101f5b12ab1cbdf940576dc6a60d530a7c25 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 991a5637e1c3f549fb6609888abc8bfbae50e5bb..064cd9fe6f332cb01124c7243a3e25430b8be6a9 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 883dde7564a8785b6145ccec544390478bb9ffe5..e4fa6f504b7b86799c1276875c2471a5719f5892 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 362f0232836482626afbd0b53e8069dc531de3e8..101af48a8934f82c6daeee71b46d93a517605f5c 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 9b8c1503c739ac4ba02e74b1b9ef55d5efea6551..79b3e26aec7b22bf188b67c3b13d39cfb7569f05 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 d404a964686596c0428a63d9f060219f4d44e3af..de0ecdbf1e2a448a82c001462b3dd9db46f2aba1 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 e07f9ce3e18db86d3ab184313df6b0c0c5090f2c..425ecf6d02628962de3b8268d21b119c72370bf2 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 c37b4abc6215906f1a1a98f5b088e63633f81e16..212214cd2ab516e8f7c8e1226b63bb16d886e927 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 2a900e052bcf9ba378c5e7a39c1de8f8bfd0dbbf..7fb293f054e40aff5e3d840488a4b3b9047e8110 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 904c0a6322727b45acb11af647c7b181cf4c0bc8..0611dceb3a90472de2323ff81a4efdad3c85d9a9 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 42021c59a303ee17672129bbd9741e5213b511b2..c825536b7b320e511d0ad3e96335cf692dd6258b 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 efa4690f6f976ee69f11dcee69c36a39feea941a..82c218dd73620a3c4d5f45b6330a8ce74daef8f0 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 3dbb297c297ba54f3af7e9872a868b22afc93580..7c19b9f7b3b9005fda4f339704ad6f887dcc82a8 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 504ccff78fd4d647910e0d9285f9d4b483ecb66d..84ae57555952c30f8bfa8500841405958743d69d 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 8398fdb58821d876e3f41375727642b91906b772..2d9e9edb2c4a00d92fe77b5a444052f112427c48 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 6b267c57a33129110521c7712b7589614d7fc5a9..e675e86d07324d591073014da7c2b6cf72df23ba 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 8ca7ee724a2449734e677354f44ea9d453bf97b1..9407dd0c7539d7269e19ed2d96ded86b1d9d4d41 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 d3705cc3c43e58d1e51d0b5b28afad031a230ba2..233ad23286fa12d4d003400c945d2001215ac7fe 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 a4855749690da217163fd31c9fc3568638b0c530..4593887f49ccae613b92666cbef245d54e2249c1 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 654a183359d5ed6b5ecc86211ca52bf9def6dbbb..81c4137d4e88c8a0b8414d7d2396a746d02c9c48 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 fc43a77406f9f8d5ca9db81cb5882dd8b775f1d3..528d5b06fcc63f0e7f3a50427687a0056881633b 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 1bea53693472c426bb2518178a8ca22169e1fae0..a1e304b374686390c17eb5a4360aad631f41a166 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 d0afb276aafa113f8af8e3ad1c6d885dd52ba984..812882a2a97da77bed74c9ec8e4421874ee6969d 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']