PabloCastellano / libcnml

libcnml is a CNML parser library for Python
GNU General Public License v3.0
4 stars 5 forks source link

Many interfaces that are children of radios are not assigned correctly #13

Closed emmdim closed 8 years ago

emmdim commented 8 years ago

It seems that many of the interfaces that are not assigned correctly as children of radios. For example you can check the outcome of your tool and this CNML: https://guifi.net/es/guifi/cnml/40309/node So the interface 58373 should be a child of radio 0 according to the CNML, but libcnml presents it as a child of the device 32060 and not of the radio.

I guess it happens both with LXML(tested) and Minidom(not tested). I believe the problem is in the function loadXML (and correspodingly in the loadMinidom function). I changed this function locally to parse first the radios/interfaces/links and then the interfaces that are alone and then the services. This seems to work.

PabloCastellano commented 8 years ago

It should be fixed now. Can you test and confirm?

emmdim commented 8 years ago

Trying to test locally but issue #20 blocks me.

emmdim commented 8 years ago

So. according to this image concerning guifi CNML structure, which I think is correct, interfaces can either be children of a device or of a radio. I ran a local test comparing libcnmlv0.9.4, current libcnml and my version. This picture shows the outcome. Long story short, you versions of libcnml recognize the radio 5150 and 5150 both as children of the deivce and the radio while they should be only children of the radio. You get my point? I am not sure what would be the solution the way your code is structured currently but the idea, as I mention in the first post, would be to parse first the radios/interfaces/links and then the interfaces that are alone and then the services.

PabloCastellano commented 8 years ago

I think since a long time ago that this is a bug in the CNML generation function from drupal-guifi.

If an interface is already defined in a radio, then it shouldn't appear in the device. Don't you think?

PabloCastellano commented 8 years ago

In fact I reported it here: https://github.com/guifi/drupal-guifi/issues/11

emmdim commented 8 years ago

Hm. I didn't know. It seems you are correct. So then we just have to wait. Should we leave this thread open for a last when the drupal issue is resolved?

PabloCastellano commented 8 years ago

Yes. I'm closing it as it's not a bug in the library but in the format itself.