Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junos XML Attributes are not parsed #18

Closed
jorgeNeutrona opened this issue Nov 16, 2017 · 2 comments
Closed

Junos XML Attributes are not parsed #18

jorgeNeutrona opened this issue Nov 16, 2017 · 2 comments

Comments

@jorgeNeutrona
Copy link

Part of XML RPC:

                  <family>
                       <inet>
                          <filter>
                             <input inactive="inactive"> --> not parsed in OrderedDict
                                <filter-name>re-protection</filter-name>
                             </input>
                          </filter>
                          <address>

XMLCDATANode(xml_attrs=OrderedDict()

The OrderedDict is empty

pprint(root['node']['result']['rpc-reply']['data']['configuration']['interfaces']['interface']['unit'][
1]['family']['inet']['filter'].get_xml_attrs())

output: OrderedDict()

@stacywsmith
Copy link
Contributor

In your partial XML output, the XML attribute is on the <input> element, not the <filter> element.

user@h0:~$ python
Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> xml = """
...         <family>
...                        <inet>
...                           <filter>
...                              <input inactive="inactive"> --> not parsed in OrderedDict
...                                 <filter-name>re-protection</filter-name>
...                              </input>
...                           </filter>
...                           <address>
... </address>
... </inet>
... </family>
... """
>>> import jxmlease
>>> root = jxmlease.parse(xml)
>>> root['family']['inet']['filter']['input'].get_xml_attrs()
OrderedDict([(u'inactive', u'inactive')])
>>> 

@jorgeNeutrona
Copy link
Author

Thanks! Worked FIne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants