fix config file for mdsal-trace and filtering mechanism 60/56860/4
authorJosh <jhershbe@redhat.com>
Thu, 11 May 2017 13:43:07 +0000 (16:43 +0300)
committerMichael Vorburger <vorburger@redhat.com>
Fri, 12 May 2017 12:35:28 +0000 (12:35 +0000)
Initially missed this but this patch fixes the initial config
xml file. Also, this code contains a fix for an issue with
filtering paths that CODEC could not handle and were reconstructed.

Change-Id: I34da4ce9e78c075439b0047407c75aa0b86feb16
Signed-off-by: Josh <jhershbe@redhat.com>
opendaylight/md-sal/mdsal-trace/api/pom.xml
opendaylight/md-sal/mdsal-trace/api/src/main/resources/initial/mdsaltrace_config.xml [new file with mode: 0644]
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingBroker.java
opendaylight/md-sal/mdsal-trace/features/features-mdsal-trace/src/main/features/features.xml

index ea1f7bb..79ecc8d 100644 (file)
@@ -48,6 +48,28 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
           </configuration>
         </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/initial/mdsaltrace_config.xml</file>
+                  <type>xml</type>
+                  <classifier>config</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/opendaylight/md-sal/mdsal-trace/api/src/main/resources/initial/mdsaltrace_config.xml b/opendaylight/md-sal/mdsal-trace/api/src/main/resources/initial/mdsaltrace_config.xml
new file mode 100644 (file)
index 0000000..8e17c8b
--- /dev/null
@@ -0,0 +1,5 @@
+<config xmlns="urn:opendaylight:params:xml:ns:yang:mdsaltrace">
+    <!-- <registration-watches>/neutron-router-dpns/router-dpn-list</registration-watches> -->
+    <!-- <registration-watches>/tunnels_state/state-tunnel-list</registration-watches> -->
+    <!-- <write-watches> /NetworkTopology/Topology</write-watches> -->
+</config>
index c971ec3..a30d3e0 100644 (file)
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
  *    <classifier>features</classifier>
  *    <type>xml</type>
  *    <scope>runtime</scope>
- *    <version>0.1.5-SNAPSHOT</version>
+ *    <version>0.1.6-SNAPSHOT</version>
  *  </dependency>
  * }
  * </pre>
@@ -117,7 +117,17 @@ public class TracingBroker implements TracingDOMDataBroker {
         }
 
         private boolean isParent(String parent, String child) {
-            return child.startsWith(parent);
+            int parentOffset = 0;
+            if (parent.length() > 0 && parent.charAt(0) == '<') {
+                parentOffset = parent.indexOf('>') + 1;
+            }
+
+            int childOffset = 0;
+            if (child.length() > 0 && child.charAt(0) == '<') {
+                childOffset = child.indexOf('>') + 1;
+            }
+
+            return child.startsWith(parent.substring(parentOffset), childOffset);
         }
 
         public boolean subtreesOverlap(YangInstanceIdentifier iid, LogicalDatastoreType store,
@@ -127,7 +137,6 @@ public class TracingBroker implements TracingDOMDataBroker {
             }
 
             String otherIidString = toIidCompString(iid);
-
             switch (scope) {
                 case BASE:
                     return isParent(iidString, otherIidString);
@@ -178,6 +187,7 @@ public class TracingBroker implements TracingDOMDataBroker {
      * @param store Which LogicalDataStore? or null for both
      */
     public void watchRegistrations(String iidString, LogicalDatastoreType store) {
+        LOG.info("Watching registrations to {} in {}", iidString, store);
         registrationWatches.add(new Watch(iidString, store));
     }
 
@@ -187,6 +197,7 @@ public class TracingBroker implements TracingDOMDataBroker {
      * @param store Which LogicalDataStore? or null for both
      */
     public void watchWrites(String iidString, LogicalDatastoreType store) {
+        LOG.info("Watching writes to {} in {}", iidString, store);
         Watch watch = new Watch(iidString, store);
         writeWatches.add(watch);
     }
@@ -243,7 +254,7 @@ public class TracingBroker implements TracingDOMDataBroker {
     }
 
     private void reconstructIidPathString(YangInstanceIdentifier yiid, StringBuilder sb) {
-        sb.append("RECONSTRUCTED: ");
+        sb.append("<RECONSTRUCTED FROM: \"").append(yiid.toString()).append("\">");
         for (YangInstanceIdentifier.PathArgument pathArg : yiid.getPathArguments()) {
             if (pathArg instanceof YangInstanceIdentifier.AugmentationIdentifier) {
                 sb.append('/').append("AUGMENTATION");
@@ -251,7 +262,6 @@ public class TracingBroker implements TracingDOMDataBroker {
             }
             sb.append('/').append(pathArg.getNodeType().getLocalName());
         }
-        sb.append(" ->->-> [[[ ").append(yiid.toString()).append(" ]]]");
     }
 
     String getStackSummary() {
index ac91121..3eb6d7b 100644 (file)
@@ -19,5 +19,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <bundle>mvn:org.opendaylight.controller/mdsal-trace-api/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.controller/mdsal-trace-dom-impl/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.controller/mdsal-trace-binding-impl/{{VERSION}}</bundle>
+    <configfile finalname="etc/opendaylight/datastore/initial/config/mdsaltrace_config.xml">mvn:org.opendaylight.controller/mdsal-trace-api/{{VERSION}}/xml/config</configfile>
   </feature>
 </features>

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.