13:39:04 #startmeeting jquery_xpath_for_md_sal_intern 13:39:04 Meeting started Fri Aug 15 13:39:04 2014 UTC. The chair is devinavery. Information about MeetBot at http://ci.openstack.org/meetbot.html. 13:39:04 Useful Commands: #action #agreed #help #info #idea #link #topic #startvote. 13:39:04 The meeting name has been set to 'jquery_xpath_for_md_sal_intern' 13:39:14 #topic status 13:39:21 Morning /Evening 13:39:30 Sorry - slightly distracted this AM. 13:39:50 Also I only have 20 minutes more. So this is my focus for right now to make sure we can finish up in time. 13:40:13 #info Devin sent e-mail with suggested next high level steps. Copying here for quick reference 13:40:49 #info 1.Change the unit tests to use the correct syntax etc. For example as we discussed �.� returns a node which is converted to a string some how which we then compare to �toaster�. In this case we really want the name of the node returned by �.� and should adjust our xpath as such �name(.)�. 13:41:00 #info 2. Do the same thing with the other evaluations (except in those cases you are looking for text). 13:41:19 #info 3. Once those tests are passing, we then need to define a new yang file which has multiple nested levels in it. I suggest taking the toaster yang file and modifying it to add multiple nested levels such as inner containers and lists. (note: A better idea might be to define a yang file that we could get to match our XML that we tested with originally in our hardcoding world. Either way, we need to start testing n 13:41:19 ested levels and lists.) 13:41:33 #info Create new unit tests to test this new functionality. 13:41:48 #info Make the code more robust and try to more closely mimic dom output etc. For example, I think if you were to return a string when querying �.� you would get combined output of everything below it. 13:41:49 devinavery: your cut and paste drops text 13:42:26 regXboi: oh.. what was missed? part of #3 it looks like 13:42:27 Ok. 13:42:44 info 1 isn't too clear 13:43:11 Yeah - those were the quick notes I sent yesterday after talking with Neel. 13:43:20 You are right though, we should try and make it clearer. 13:43:46 Perhaps we can reiterate and expand on this in a new topic titled "next steps". 13:43:58 I just wanted to log what was sent in the e-mail first. 13:44:48 ok 13:44:56 i have made a temporary change let me test it and push it 13:45:08 not sure it works for all cases but will work for this case 13:45:18 hopefully 13:45:51 Ok. This is how I would suggest we move forward (I won't log it yet just incase there are different thoughts). 13:46:40 test running ... taking lots of time . :\ 13:46:42 1) Get the unit tests passing for the toaster either by fixing the Node code, or by changing the XPaths. Make sure the unit tests still pass regardless of if it is real XML or our specialized nodes 13:47:11 yeah 13:47:42 2) Expand our examples to multi-node, nested level. Toaster is basically a container with some children. WE want to start including nested containers AND LISTs. This will involve creating a mock yang file and then writing data into those mock nested containers and lists. 13:48:57 * regXboi wonders if #2 might be accelerated by using another already existing yang file 13:49:27 regXboi: if you know of one that isn't too complex, I would agree. 13:49:46 that's the gotcha - I'm not sure I do 13:51:59 Yeah. Unfortunetly the only ones I can think of are like opendaylight-inventory / topology which you need to bring augmentations in, which makes it REALLY complex. :) 13:52:46 #chair regXboi 13:52:46 Current chairs: devinavery regXboi 13:52:54 we can get a xml from l2 switch ? 13:53:29 the one we used to understand normal static xml with xpath.. 13:54:40 I can't remember what XML you are talking about, but keep in mind that we need to have the exact same data in the MD-SAL repository so we can verify that we are querying it correctly 13:55:24 can you lokk into jquery folder in current code 13:55:38 okay sorry.. 13:55:41 not that one 13:56:33 Guys - I am sorry - I have to run in just a minute to another meeting (won't be able to type). 13:56:56 If we can use an existing yang file / xml perfect - otherwise we will need to create a mock to allow us to test that scenario. 13:57:11 I'm not a big fan of mock (unfortunately) 13:57:21 because that adds in the complexity of getting the mock to work correctly 13:58:38 regXboi - that is part of the cost. The question is it cheaper then using /getting the real thing. 13:59:10 considering we are down to the last 7 days 13:59:16 I'm not sure if either can be done 14:00:15 I think we can create a mock quickly. Take the toaster yang, add a child container. Then modify the test code to create the child container. 14:00:40 I can provide some samples later if that is not clear. Unfortunetly I need to leave now. 14:00:47 hmm... ok that's the best idea I have 14:00:57 er I've heard 14:01:00 regXboi - I made you chair - would you mind ending the meeting once you and NEel are done? 14:01:06 I can do that 14:01:16 Thanks 14:01:29 where are we with #1? 14:05:11 hey ryan 14:05:45 but textcontent we defined was somehow wrong 14:05:46 the coreect node is passing 14:06:10 if that is corrected we can move to more complex yang/xml 14:06:22 looking at the tests now 14:06:35 ryan: the code is being updated in a minute 14:07:16 and for complex one can we use openflowplugin ... :\ 14:07:21 i guess 14:08:23 devinavery had a good idea - we just add another child to the toaster model 14:08:59 so... I'm bothered by the testToaster method 14:09:00 okay 14:09:41 acutally... let me first dig through the error stack I'm seeing 14:09:46 what is that you are bothered ryan 14:11:00 so, I'm concerned about the evaluate("toasterStatus", up) line 14:11:13 but I suspect that our problem is in the first evaluate, isn't it? 14:12:12 we are getting [] as output 14:12:17 which can only mean 14:12:29 I'm not seeing where we get [] 14:12:31 getTextContert() is returning null 14:14:19 we got a comparison error 14:14:44 n/m 14:14:50 I'm digging in 14:15:02 i just updated code 14:15:19 which gets cannot cast error 14:15:36 any views on that 14:15:55 nope, let me pull it and see 14:18:16 well 14:18:35 I don't get a cast error 14:19:01 I'm getting a system bundle shutdown error on the toaster-provider-impl 14:19:38 but I did see a result for name(.) of toaster 14:20:39 * regXboi wonders something 14:20:40 see the junit failure trace 14:20:47 I'm not running junit 14:21:15 that error comes on every test :\ 14:21:29 so i kind of left it 14:23:56 oh I see why 14:27:09 problem on my side 14:27:35 my controller code base is too old 14:30:55 and now waiting for things to rebuild 14:32:08 sorry got disconnected 14:32:14 any updates 14:33:31 problem is on my side - I'm needing to catch up with the tip of the tree 14:33:39 and that's forcing a rebuild for me 14:38:48 no... I've got a ton of errors in my eclipse now 14:38:55 so I'm unable to run the junit test 14:40:07 at least not right now 14:41:44 okay i'm trying diffrent things 14:41:59 I'm rebuilding now 14:42:18 http://pastebin.com/dFCY49aK 14:42:26 my error trace 14:45:16 so... have you tried building a hard coded absolute path 14:45:18 to the first child 14:45:27 sand evaluate that? 14:45:45 actually 14:46:15 yeah... instead of toasterModelNumber 14:46:29 let's try whatever the path is to that entry 14:46:38 iirc it should be //toasterModelNumber 14:51:45 okay 14:55:51 http://pastebin.com/TqHP4qcY 14:55:56 the fail trace now 14:59:04 well... that's something better 14:59:11 let's try this 14:59:17 name(//toasterModelNumber) 14:59:27 that might help us figure out what's going on 15:00:27 I suspect that might actually pass 15:02:07 yeah running the code 15:02:08 now 15:03:09 if it does that's at least something - but I don't know what 15:04:45 No it returned ToasterModelNumber instead 15:04:53 not what we are expecting 15:09:53 we are assigning null to getValue 15:11:08 hopefully i get it right this time 15:15:40 ok 15:15:55 devinavery regXboi should we be adding text nodes too for that too work ? 15:16:05 wondering ? 15:16:12 I'm not 100% sure 15:16:33 NEel_B: What did we do in our playground that we did a couple of weeks ago? 15:16:36 well now that's ... odd 15:16:38 I think you used text nodes there. 15:16:52 yeah 15:16:54 i used 15:16:57 I'm fighting with getting the Junit test to even initiallize 15:17:21 so now i have to insert text Nodes ... 15:17:31 so two things 15:17:42 has anybody else tried to run the test through maven? 15:17:50 there are some ugly things happening there 15:18:16 regXboi: running it now - will let you know 15:18:48 and #2 - when I try to run via JUnit on eclipse, I'm getting complaints about not having a dependency for 15:19:20 java.lang.RuntimeException: Could not resolve version. Do you have a dependency for org.opendaylight.yangtools/object-cache-api in your maven project? 15:19:27 I am seeing check style errors when running via command line 15:19:28 which I've never seen before 15:19:44 devinavery: oh yeah, I forgot - you'll need to replace tab with four spaces 15:19:57 to get past the check style 15:20:15 hmm. I was seeing dependency issues like that yesterday - its possible there is another yang tools bundle that needs to be pulled in 15:20:45 but... the maven build screams with this after the first evaluate: 15:21:18 Ok. I will try that in a few minutes. Wrapping up my meeting 15:21:20 10:21:03.654 [System Bundle Shutdown] ERROR o.o.c.c.m.i.d.DestroyedModule - Error while closing instance of ModuleIdentifier{factoryName='toaster-provider-impl', instanceName='toaster-provider-impl'} java.lang.IllegalStateException: Transaction factory was closed. No further operations allowed. 15:22:31 That error is happens unfortunately when you shutdown the test. It is expected and not an indication of a failure (generally). Its a result of not having "good" shutdown behavior 15:22:32 that error was there since i started using pax exam 15:22:54 yeah however tests are running fine so i neglected 15:26:59 I'm thinking - before we go Xpath crazy 15:27:39 should we actually interrogate the nodebuilderelement we get back and try and see what the XML looks like? 15:27:58 in other words, we have ... 15:28:03 but what is in the ... 15:28:29 I think that will give us a better idea of what's going on and how to fix things 15:31:58 Not a bad idea regXboi. There is likely code available that will pretty print XML given a w3c school node. 15:34:50 can some one summarize 15:37:07 regXboi was suggesting that we print our new nodes to see if we get XML output like we expect. Before we struggle too much with xpath. 15:37:32 That way we can understand a little better if we have all of the methods implemented that we might need, AND that we are returning the correct values from each of those. 15:38:02 I commented that there are likely classes out there that will take a Node interface and render the XML output. 15:38:07 so I think I see the problem 15:38:49 but let me double check :) 15:42:04 I just found an example that should allow us to print out our nodes: http://stackoverflow.com/questions/2325388/java-shortest-way-to-pretty-print-to-stdout-a-org-w3c-dom-document 15:42:28 In that link, if you replace "Document" with "Element" it should hopefully print out the XML for us 15:44:25 regXboi: I see the error about unresolved bundles now 15:44:58 ok... so this is interesting 15:45:12 This is the same problem I ran into yesterday. A change was pushed to master that added a dependency to the sal-binding-broker-impl, but our test wasn't updated to include the new bundle 15:45:13 when we assign the child node we have the value 15:45:18 BUT 15:45:39 when we later iterrogate, we lose the value 15:46:45 i don't get it ? 15:46:46 :\ 15:47:36 I don't 100% either, but I'm getting closer 15:47:58 GOT IT 15:48:03 the problem is in getNodeValue() 15:48:29 for example if I take the first element of the iterator like so: 15:48:37 firstChild=new NodeBuilderElement(child,this,iterator); 15:48:41 and then I do this: 15:48:51 System.out.println("test2:"+firstChild.node.getValue()+":"+firstChild.getNodeValue()); 15:49:05 here's what I see: 15:49:18 test2:up:null 15:50:12 and that's because in NodeBuilderElement I'm seeing this 15:50:19 @Override public String getNodeValue() { return null; } 15:51:46 now... to pull in getTextContent() 15:52:13 regXboi: that looks like that might be the issue. Because in our hardcoded example we did a few weeks ago, we had "getNodeValue" implemented in the NodeBuilderText class. 15:52:22 not quite 15:52:31 I need to play with getTextContent some more 15:53:51 because that may be returning null as well 15:54:55 regXboi: what did you do to resolve your errors to run the pax-exam test? 15:55:01 I didn't 15:55:14 I've been running through maven and playing games with println 15:55:20 ugly but it makes some progress 15:55:24 i tried changin it 15:55:47 to (String) node.getValue() 15:56:03 I strongly prefer node.getValue().toString(); 15:56:05 but still it returns an emplty string 16:00:17 devinavery: that printdoc needs the element of rootTestNode pulled back into a document 16:02:16 regXboi: Darn - I was hoping to avoid that if we at all could. What is it that makes you think we need to pull it into a document? 16:02:41 if you don't mind i will be back after having my dinner .. 16:02:51 when I tried to do printDocument(rootTestNode, ...) I got a nice fat mismatch error? 16:03:17 Ahh. Change the argument type to "Element" The compilation will go away - though there is still an error when you run it with our new nodes 16:03:23 yeah 16:03:38 I was headed there 16:05:09 regXboi: I am going to try the print statements on the hardcoded nodes we did a few weeks ago. To see if it works there 16:06:24 ok 16:07:29 oh 16:07:33 I wonder 16:07:43 I think we've got this all wrong 16:07:49 devinavery: 16:07:54 consider the following 16:08:03 how many children do we have of toaster? 16:08:11 3? or 7? 16:08:23 * regXboi thinks the answer is 7 16:10:20 * regXboi thinks the children of toaster are ... textNode, firstMDSALChildNode, textNode, secondMDSALChildNode, textNode, thirdMDSALChildNode, textNode 16:11:25 * regXboi thinks that we can't really build on the fly, we have to build it out when the first child is called for 16:12:25 I think for example the status "up" is a child of the "toasterStatus" node 16:12:44 you see my point though, correct? 16:12:47 16:13:14 I think we might still be able to build on the fly (I had to restart my eclipse because it freaked out). 16:13:17 Will try your change right now 16:13:30 if you can figure out that code, more power to you :) 16:14:47 I'm thinking I want to rewrite NodeBuilderElement pretty much completely 16:15:31 In the long run I believe we will need to clean it up a bit. :) 16:23:19 I got it working here. 16:23:20 Finally 16:23:34 (the printing) 16:24:19 http://pastebin.com/zf63LHtD 16:24:27 Add this class into your environment: http://pastebin.com/zf63LHtD 16:24:51 Then inside of NodeBuilderElement, in the getAttributes() method, return new NamedNodeMapImpl() 16:25:16 Then print it with this: printDocument(rootTestNode, System.out); 16:25:22 and do we get something sane? 16:25:22 You should now get this output: 16:25:31 16:25:31 16:25:32 16:25:32 16:25:32 16:25:54 Showing exactly what I think we are saying - there is no text content of those nodes, because we need to create a text node as the child of the toasterStatus node for example 16:30:14 yep 16:30:25 so that's the next step 16:30:38 is how to translate the leaf MDSAL into a child text node 16:31:31 devin avery - worse is that the child nodes aren't showing up as children of the parent node 16:31:36 oh n/m 16:31:38 I can't read :) 16:32:30 so... I'm thinking that if node is an instance of LeafNode 16:32:35 we need to change hasChildren to true 16:32:48 and then firstChild to a TextNode with the proper value 16:32:56 and nextsibling to null 16:32:59 got it! 16:33:01 and we are there? 16:33:04 16:33:04 Opendaylight 16:33:04 Model 1 - Binding Aware 16:33:04 up 16:33:04 16:33:13 regXboi: exactly. 16:33:14 and the trick is? 16:33:54 Ok. SO I did this: I pulled in the ThrowExceptionNode, ThrowExceptionText into our bundle 16:34:15 oh you didn't 16:34:34 (just temporarily... ;) 0 16:34:38 you didn't patch into the exception path 16:34:54 You know.. might be better for me to just bundle up my classes and send out. 16:35:04 The main change though is this 16:35:19 NodeBUilderELement - getFirstChild method 16:35:48 devinavery: yes bundle them up and send out 16:35:48 What I did there was I saw if the type IS a LeafNode, then create a "NodeBuilderText" node as the one and only child, which contains the node value. 16:35:57 we need to close down this meeting :) 16:36:13 agree. Lets close it down and I will send out the code in a bit (need some food) 16:36:16 If that is OK with you 16:36:22 works for me 16:36:31 because I think we've cracked the code 16:36:38 hello am back 16:36:44 #info regXboi, devinavery and Neel found the problem - we need to introduce text nodes 16:36:47 i gues you ppl were closing 16:37:04 #action devinavery to send out code bundle that provides for pretty print of XML from MD-SAL nodes 16:37:06 #action devinavery will send out the code he pulled in to make this work. 16:37:18 #action Neel_B to pull that into his code base and then check tests 16:37:27 okay 16:37:29 #info main trick is that we need text nodes to be children of leaf nodes. 16:37:29 #action regXboi to figure out why he can't run Junit tests 16:37:41 #action we meet on Monday to work the xpath side of things 16:37:53 (now that we have the XML structure working!) 16:38:04 anything else we are missing? 16:39:22 I don't think so (be since lunch). :) 16:39:34 ok... let's close this down 16:39:37 thanks all 16:39:51 #endmeeting