Wed, Jul 18, 2012 at 05:03:32PM CEST, rpazdera(a)redhat.com wrote:
From: Radek Pazdera <rpazdera(a)redhat.com>
This patch series introduces new parser implementation to LNST.
The decision to write a new implementation of XML parsing was made
in regards to some recent problems, that was caused by incompatibility
of the XML templates and the original parser principle.
The issues includes:
* Inabillity to resolve aliases and template functions
outside of command_sequence
* Aliases have global area of effect - they can be accessed
even before they were actually defined
* Includes are resolved before expanding templates, so you
cannot use <tag source="{$alias}" />
The new implementation addresses all these problems and on top of that
brings some new features.
Here are listed some of the changes:
* Aliases and template functions can be resolved immediately
after the tag that defines them is finished
<netdevice phys_id="1" name="eth0"
hwaddr="12:34:56:78:9A:BC" />
<netdevice phys_id="2" name="{devname(1,1)}" />
^^^^^^^^^^^^
devname of the previous device |
can be safely used here --------'
* Effect of aliases is now limited only within the parent tag
in which they we're defined
<t1>
<define>
<alias name="file" value="abcd.xml" />
</define>
<netconfig source="{$file}" />
</t1>
<netconfig source="{$file}" />
^^^^^
'-- This will be undefined
* Recipe eval is gone (I removed it, as we discussed earlier)
* I enhanced the error reporting of parsing errors which is
now done in the following format:
XmlProcessingError:easy_recipe.xml:12: Alias tag must have
the 'name' attribute
The exact location of the error is reported. That includes
filename and a line number.
I tried to keep the design of the parser as similar to the original
one as possible. It is split into several RecipeParser classes. Each
subclass is responsible for parsing different part of the recipe.
I also tried to reuse as much of the other code as possible (for
instance the error checking algorithms for command sequences and
netconfigs).
I tested the implementation on several recipes and double-checked for
errors with pylint. Everything seems to work ok, hopefully there won't
be any regressions. But it's a pretty big patch so I might have forgotten
something :-(. Let me know if you encounter any problems.
Radek Pazdera (7):
XmlPreprocessor: Changing to XmlTemplates
Common: Adding XmlProcessing module
nettestctl.py: all_dump and eval actions removed
netconfig.py: Adapting to the new parser
NetTestParse: New parser implementation
NetTest: Adding support for the new parser
NetConfig: Adding support for the new parser
Common/XmlPreprocessor.py | 232 ---------------
Common/XmlProcessing.py | 351 +++++++++++++++++++++++
Common/XmlTemplates.py | 275 ++++++++++++++++++
NetConfig/NetConfig.py | 34 +--
NetConfig/NetConfigDevNames.py | 43 ++--
NetConfig/NetConfigParse.py | 199 -------------
NetTest/NetTestController.py | 277 ++++++++++--------
NetTest/NetTestParse.py | 614 +++++++++++++++++++++++++---------------
NetTest/NetTestSlave.py | 35 ++-
netconfig.py | 107 ++++++--
nettestctl.py | 9 +-
11 files changed, 1307 insertions(+), 869 deletions(-)
delete mode 100644 Common/XmlPreprocessor.py
create mode 100644 Common/XmlProcessing.py
create mode 100644 Common/XmlTemplates.py
delete mode 100644 NetConfig/NetConfigParse.py
--
1.7.7.6
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/lnst-developers
All applied. Nice work! Thanks!
Jirka