13:39:04 <devinavery> #startmeeting jquery_xpath_for_md_sal_intern
13:39:04 <odl_meetbot> 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 <odl_meetbot> Useful Commands: #action #agreed #help #info #idea #link #topic #startvote.
13:39:04 <odl_meetbot> The meeting name has been set to 'jquery_xpath_for_md_sal_intern'
13:39:14 <devinavery> #topic status
13:39:21 <devinavery> Morning /Evening
13:39:30 <devinavery> Sorry - slightly distracted this AM.
13:39:50 <devinavery> 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 <devinavery> #info Devin sent e-mail with suggested next high level steps. Copying here for quick reference
13:40:49 <devinavery> #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 <devinavery> #info 2. Do the same thing with the other evaluations (except in those cases you are looking for text).
13:41:19 <devinavery> #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 <devinavery> ested levels and lists.)
13:41:33 <devinavery> #info Create new unit tests to test this new functionality.
13:41:48 <devinavery> #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 <regXboi> devinavery: your cut and paste drops text
13:42:26 <devinavery> regXboi: oh.. what was missed? part of #3 it looks like
13:42:27 <devinavery> Ok.
13:42:44 <regXboi> info 1 isn't too clear
13:43:11 <devinavery> Yeah - those were the quick notes I sent yesterday after talking with Neel.
13:43:20 <devinavery> You are right though, we should try and make it clearer.
13:43:46 <devinavery> Perhaps we can reiterate and expand on this in a new topic titled "next steps".
13:43:58 <devinavery> I just wanted to log what was sent in the e-mail first.
13:44:48 <regXboi> ok
13:44:56 <Neel_B> i have made a temporary change let me test it and push it
13:45:08 <Neel_B> not sure it works for all cases but will work for this case
13:45:18 <Neel_B> hopefully
13:45:51 <devinavery> 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 <Neel_B> test running ... taking lots of time . :\
13:46:42 <devinavery> 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 <Neel_B> yeah
13:47:42 <devinavery> 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 <devinavery> regXboi: if you know of one that isn't too complex, I would agree.
13:49:46 <regXboi> that's the gotcha - I'm not sure I do
13:51:59 <devinavery> 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 <devinavery> #chair regXboi
13:52:46 <odl_meetbot> Current chairs: devinavery regXboi
13:52:54 <Neel_B> we can get a xml from l2 switch ?
13:53:29 <Neel_B> the one we used to understand normal static xml with xpath..
13:54:40 <devinavery> 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 <Neel_B> can you lokk into jquery folder in current code
13:55:38 <Neel_B> okay sorry..
13:55:41 <Neel_B> not that one
13:56:33 <devinavery> Guys - I am sorry - I have to run in just a minute to another meeting (won't be able to type).
13:56:56 <devinavery> 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 <regXboi> I'm not a big fan of mock (unfortunately)
13:57:21 <regXboi> because that adds in the complexity of getting the mock to work correctly
13:58:38 <devinavery> regXboi - that is part of the cost. The question is it cheaper then using /getting the real thing.
13:59:10 <regXboi> considering we are down to the last 7 days
13:59:16 <regXboi> I'm not sure if either can be done
14:00:15 <devinavery> 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 <devinavery> I can provide some samples later if that is not clear. Unfortunetly I need to leave now.
14:00:47 <regXboi> hmm... ok that's the best idea I have
14:00:57 <regXboi> er I've heard
14:01:00 <devinavery> regXboi - I made you chair - would you mind ending the meeting once you and NEel are done?
14:01:06 <regXboi> I can do that
14:01:16 <devinavery> Thanks
14:01:29 <regXboi> where are we with #1?
14:05:11 <Neel_B> hey ryan
14:05:45 <Neel_B> but textcontent we defined was somehow wrong
14:05:46 <Neel_B> the coreect node is passing
14:06:10 <Neel_B> if that is corrected we can move to more complex yang/xml
14:06:22 <regXboi> looking at the tests now
14:06:35 <Neel_B> ryan: the code is being updated in a minute
14:07:16 <Neel_B> and for complex one can we use openflowplugin ... :\
14:07:21 <Neel_B> i guess
14:08:23 <regXboi> devinavery had a good idea - we just add another child to the toaster model
14:08:59 <regXboi> so... I'm bothered by the testToaster method
14:09:00 <Neel_B> okay
14:09:41 <regXboi> acutally... let me first dig through the error stack I'm seeing
14:09:46 <Neel_B> what is that you are bothered ryan
14:11:00 <regXboi> so, I'm concerned about the evaluate("toasterStatus", up) line
14:11:13 <regXboi> but I suspect that our problem is in the first evaluate, isn't it?
14:12:12 <Neel_B> we are getting [] as output
14:12:17 <Neel_B> which can only mean
14:12:29 <regXboi> I'm not seeing where we get []
14:12:31 <Neel_B> getTextContert() is returning null
14:14:19 <Neel_B> we got a comparison error
14:14:44 <regXboi> n/m
14:14:50 <regXboi> I'm digging in
14:15:02 <Neel_B> i just updated code
14:15:19 <Neel_B> which gets cannot cast error
14:15:36 <Neel_B> any views on that
14:15:55 <regXboi> nope, let me pull it and see
14:18:16 <regXboi> well
14:18:35 <regXboi> I don't get a cast error
14:19:01 <regXboi> I'm getting a system bundle shutdown error on the toaster-provider-impl
14:19:38 <regXboi> but I did see a result for name(.) of toaster
14:20:39 * regXboi wonders something
14:20:40 <Neel_B> see the junit failure trace
14:20:47 <regXboi> I'm not running junit
14:21:15 <Neel_B> that error comes on every test :\
14:21:29 <Neel_B> so i kind of left it
14:23:56 <regXboi> oh I see why
14:27:09 <regXboi> problem on my side
14:27:35 <regXboi> my controller code base is too old
14:30:55 <regXboi> and now waiting for things to rebuild
14:32:08 <Neel_B> sorry got disconnected
14:32:14 <Neel_B> any updates
14:33:31 <regXboi> problem is on my side - I'm needing to catch up with the tip of the tree
14:33:39 <regXboi> and that's forcing a rebuild for me
14:38:48 <regXboi> no... I've got a ton of errors in my eclipse now
14:38:55 <regXboi> so I'm unable to run the junit test
14:40:07 <regXboi> at least not right now
14:41:44 <Neel_B> okay i'm trying diffrent things
14:41:59 <regXboi> I'm rebuilding now
14:42:18 <Neel_B> http://pastebin.com/dFCY49aK
14:42:26 <Neel_B> my error trace
14:45:16 <regXboi> so... have you tried building a hard coded absolute path
14:45:18 <regXboi> to the first child
14:45:27 <regXboi> sand evaluate that?
14:45:45 <regXboi> actually
14:46:15 <regXboi> yeah... instead of toasterModelNumber
14:46:29 <regXboi> let's try whatever the path is to that entry
14:46:38 <regXboi> iirc it should be //toasterModelNumber
14:51:45 <Neel_B> okay
14:55:51 <Neel_B> http://pastebin.com/TqHP4qcY
14:55:56 <Neel_B> the fail trace now
14:59:04 <regXboi> well... that's something better
14:59:11 <regXboi> let's try this
14:59:17 <regXboi> name(//toasterModelNumber)
14:59:27 <regXboi> that might help us figure out what's going on
15:00:27 <regXboi> I suspect that might actually pass
15:02:07 <Neel_B> yeah running the code
15:02:08 <Neel_B> now
15:03:09 <regXboi> if it does that's at least something - but I don't know what
15:04:45 <Neel_B> No it returned ToasterModelNumber instead
15:04:53 <Neel_B> not what we are expecting
15:09:53 <Neel_B> we are assigning null to getValue
15:11:08 <Neel_B> hopefully i get it right this time
15:15:40 <regXboi> ok
15:15:55 <Neel_B> devinavery regXboi  should we be adding text nodes too for that too work ?
15:16:05 <Neel_B> wondering ?
15:16:12 <regXboi> I'm not 100% sure
15:16:33 <devinavery> NEel_B: What did we do in our playground that we did a couple of weeks ago?
15:16:36 <regXboi> well now that's ... odd
15:16:38 <devinavery> I think you used text nodes there.
15:16:52 <Neel_B> yeah
15:16:54 <Neel_B> i used
15:16:57 <regXboi> I'm fighting with getting the Junit test to even initiallize
15:17:21 <Neel_B> so now i have to insert text Nodes ...
15:17:31 <regXboi> so two things
15:17:42 <regXboi> has anybody else tried to run the test through maven?
15:17:50 <regXboi> there are some ugly things happening there
15:18:16 <devinavery> regXboi: running it now - will let you know
15:18:48 <regXboi> and #2 - when I try to run via JUnit on eclipse, I'm getting complaints about not having a dependency for
15:19:20 <regXboi> 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 <devinavery> I am seeing check style errors when running via command line
15:19:28 <regXboi> which I've never seen before
15:19:44 <regXboi> devinavery: oh yeah, I forgot - you'll need to replace tab with four spaces
15:19:57 <regXboi> to get past the check style
15:20:15 <devinavery> 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 <regXboi> but... the maven build screams with this after the first evaluate:
15:21:18 <devinavery> Ok. I will try that in a few minutes. Wrapping up my meeting
15:21:20 <regXboi> 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 <devinavery> 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 <Neel_B> that error was there since i started using pax exam
15:22:54 <Neel_B> yeah however tests are running fine so i neglected
15:26:59 <regXboi> I'm thinking - before we go Xpath crazy
15:27:39 <regXboi> should we actually interrogate the nodebuilderelement we get back and try and see what the XML looks like?
15:27:58 <regXboi> in other words, we have <toaster>...</toaster>
15:28:03 <regXboi> but what is in the ...
15:28:29 <regXboi> I think that will give us a better idea of what's going on and how to fix things
15:31:58 <devinavery> Not a bad idea regXboi. There is likely code available that will pretty print XML given a w3c school node.
15:34:50 <Neel_B> can some one summarize
15:37:07 <devinavery> 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 <devinavery> 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 <devinavery> I commented that there are likely classes out there that will take a Node interface and render the XML output.
15:38:07 <regXboi> so I think I see the problem
15:38:49 <regXboi> but let me double check :)
15:42:04 <devinavery> 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 <devinavery> In that link, if you replace "Document" with "Element" it should hopefully print out the XML for us
15:44:25 <devinavery> regXboi: I see the error about unresolved bundles now
15:44:58 <regXboi> ok... so this is interesting
15:45:12 <devinavery> 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 <regXboi> when we assign the child node we have the value
15:45:18 <regXboi> BUT
15:45:39 <regXboi> when we later iterrogate, we lose the value
15:46:45 <Neel_B> i don't get it ?
15:46:46 <Neel_B> :\
15:47:36 <regXboi> I don't 100% either, but I'm getting closer
15:47:58 <regXboi> GOT IT
15:48:03 <regXboi> the problem is in getNodeValue()
15:48:29 <regXboi> for example if I take the first element of the iterator like so:
15:48:37 <regXboi> firstChild=new NodeBuilderElement(child,this,iterator);
15:48:41 <regXboi> and then I do this:
15:48:51 <regXboi> System.out.println("test2:"+firstChild.node.getValue()+":"+firstChild.getNodeValue());
15:49:05 <regXboi> here's what I see:
15:49:18 <regXboi> test2:up:null
15:50:12 <regXboi> and that's because in NodeBuilderElement I'm seeing this
15:50:19 <regXboi> @Override     public String getNodeValue()     {         return null;     }
15:51:46 <regXboi> now... to pull in getTextContent()
15:52:13 <devinavery> 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 <regXboi> not quite
15:52:31 <regXboi> I need to play with getTextContent some more
15:53:51 <regXboi> because that may be returning null as well
15:54:55 <devinavery> regXboi: what did you do to resolve your errors to run the pax-exam test?
15:55:01 <regXboi> I didn't
15:55:14 <regXboi> I've been running through maven and playing games with println
15:55:20 <regXboi> ugly but it makes some progress
15:55:24 <Neel_B> i tried changin it
15:55:47 <Neel_B> to (String) node.getValue()
15:56:03 <regXboi> I strongly prefer node.getValue().toString();
15:56:05 <Neel_B> but still it returns an emplty string
16:00:17 <regXboi> devinavery: that printdoc needs the element of rootTestNode pulled back into a document
16:02:16 <devinavery> 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 <Neel_B> if you don't mind i will be back after having my dinner ..
16:02:51 <regXboi> when I tried to do printDocument(rootTestNode, ...) I got a nice fat mismatch error?
16:03:17 <devinavery> 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 <regXboi> yeah
16:03:38 <regXboi> I was headed there
16:05:09 <devinavery> 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 <regXboi> ok
16:07:29 <regXboi> oh
16:07:33 <regXboi> I wonder
16:07:43 <regXboi> I think we've got this all wrong
16:07:49 <regXboi> devinavery:
16:07:54 <regXboi> consider the following
16:08:03 <regXboi> how many children do we have of toaster?
16:08:11 <regXboi> 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 <devinavery> I think for example the status "up" is a child of the "toasterStatus" node
16:12:44 <regXboi> you see my point though, correct?
16:12:47 <devinavery> <toaster><toasterStatus><text with value ="up"></toasterStatus></toaster>
16:13:14 <devinavery> 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 <devinavery> Will try your change right now
16:13:30 <regXboi> if you can figure out that code, more power to you :)
16:14:47 <regXboi> I'm thinking I want to rewrite NodeBuilderElement pretty much completely
16:15:31 <devinavery> In the long run I believe we will need to clean it up a bit. :)
16:23:19 <devinavery> I got it working here.
16:23:20 <devinavery> Finally
16:23:34 <devinavery> (the printing)
16:24:19 <devinavery> http://pastebin.com/zf63LHtD
16:24:27 <devinavery> Add this class into your environment: http://pastebin.com/zf63LHtD
16:24:51 <devinavery> Then inside of NodeBuilderElement, in the getAttributes() method, return new NamedNodeMapImpl()
16:25:16 <devinavery> Then print it with this: printDocument(rootTestNode, System.out);
16:25:22 <regXboi> and do we get something sane?
16:25:22 <devinavery> You should now get this output:
16:25:31 <devinavery> <?xml version="1.0" encoding="UTF-8"?><toaster>
16:25:31 <devinavery> <toasterManufacturer/>
16:25:32 <devinavery> <toasterModelNumber/>
16:25:32 <devinavery> <toasterStatus/>
16:25:32 <devinavery> </toaster>
16:25:54 <devinavery> 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 <regXboi> yep
16:30:25 <regXboi> so that's the next step
16:30:38 <regXboi> is how to translate the leaf MDSAL into a child text node
16:31:31 <regXboi> devin avery - worse is that the child nodes aren't showing up as children of the parent node
16:31:36 <regXboi> oh n/m
16:31:38 <regXboi> I can't read :)
16:32:30 <regXboi> so... I'm thinking that if node is an instance of LeafNode
16:32:35 <regXboi> we need to change hasChildren to true
16:32:48 <regXboi> and then firstChild to a TextNode with the proper value
16:32:56 <regXboi> and nextsibling to null
16:32:59 <devinavery> got it!
16:33:01 <regXboi> and we are there?
16:33:04 <devinavery> <?xml version="1.0" encoding="UTF-8"?><toaster>
16:33:04 <devinavery> <toasterManufacturer>Opendaylight</toasterManufacturer>
16:33:04 <devinavery> <toasterModelNumber>Model 1 - Binding Aware</toasterModelNumber>
16:33:04 <devinavery> <toasterStatus>up</toasterStatus>
16:33:04 <devinavery> </toaster>
16:33:13 <devinavery> regXboi: exactly.
16:33:14 <regXboi> and the trick is?
16:33:54 <devinavery> Ok. SO I did this: I pulled in the ThrowExceptionNode, ThrowExceptionText into our bundle
16:34:15 <regXboi> oh you didn't
16:34:34 <devinavery> (just temporarily... ;) 0
16:34:38 <regXboi> you didn't patch into the exception path
16:34:54 <devinavery> You know.. might be better for me to just bundle up my classes and send out.
16:35:04 <devinavery> The main change though is this
16:35:19 <devinavery> NodeBUilderELement - getFirstChild method
16:35:48 <regXboi> devinavery: yes bundle them up and send out
16:35:48 <devinavery> 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 <regXboi> we need to close down this meeting :)
16:36:13 <devinavery> agree. Lets close it down and I will send out the code in a bit (need some food)
16:36:16 <devinavery> If that is OK with you
16:36:22 <regXboi> works for me
16:36:31 <regXboi> because I think we've cracked the code
16:36:38 <Neel_B> hello am back
16:36:44 <devinavery> #info regXboi, devinavery and Neel found the problem - we need to introduce text nodes
16:36:47 <Neel_B> i gues you ppl were closing
16:37:04 <regXboi> #action devinavery to send out code bundle that provides for pretty print of XML from MD-SAL nodes
16:37:06 <devinavery> #action devinavery will send out the code he pulled in to make this work.
16:37:18 <regXboi> #action Neel_B to pull that into his code base and then check tests
16:37:27 <Neel_B> okay
16:37:29 <devinavery> #info main trick is that we need text nodes to be children of leaf nodes.
16:37:29 <regXboi> #action regXboi to figure out why he can't run Junit tests
16:37:41 <regXboi> #action we meet on Monday to work the xpath side of things
16:37:53 <regXboi> (now that we have the XML structure working!)
16:38:04 <regXboi> anything else we are missing?
16:39:22 <devinavery> I don't think so (be since lunch). :)
16:39:34 <regXboi> ok... let's close this down
16:39:37 <regXboi> thanks all
16:39:51 <regXboi> #endmeeting