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

Config Template Load Fails on SRX1400 #172

Closed
supertylerc opened this issue Apr 24, 2014 · 13 comments
Closed

Config Template Load Fails on SRX1400 #172

supertylerc opened this issue Apr 24, 2014 · 13 comments
Assignees

Comments

@supertylerc
Copy link

SRX1400 running 12.1X44-D25.5 is failing to load a template that other devices (EX4200s running various 10.x and 11.x releases) load without issue. The session is opened without any problems. I can also send RPC calls, such as get_chassis_inventory, although they seem to have issues.

Error message:

>>> r.rtr.cu.load(template_path="user.conf", template_vars=uvars)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/utils/config.py", line 270, in load
    return self.rpc.load_config(rpc_contents, **rpc_xattrs)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/rpcmeta.py", line 76, in load_config
    return self._junos.execute(rpc)
  File "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py", line 308, in execute
    rsp = JXML.remove_namespaces(err.xml)
AttributeError: 'XMLSyntaxError' object has no attribute 'xml'
>>> inv = r.rtr.rpc.get_chassis_inventory()
>>> inv.find('chassis/description').text
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'text'
>>> inv.find('chassis/description').textinv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'textinv'
>>> inv
<Element multi-routing-engine-results at 0x7f35c802ba28>
>>> inv.text
'\n\n'
@supertylerc
Copy link
Author

This issue does not occur on an SRX550 running 12.1X44-D20.3:

python main.py
User Name: tyler
Full Name: Tyler Christiansen
Key Path (/Users/tchristiansen52/.ssh/id_rsa.pub)
10.0.0.1

[edit system]
+   login {
+       class ADMIN {
+           login-alarms;
+           permissions all;
+       }
+       user tyler {
+           full-name "Tyler Christiansen";
+           class ADMIN;
+           authentication {
+               ssh-rsa "ssh-rsa harbl"; ## SECRET-DATA
+           }
+       }
+   }

@shermdog shermdog self-assigned this Apr 25, 2014
@shermdog
Copy link
Contributor

Thanks for the report @tyler-c

I'll dig into this.

@supertylerc
Copy link
Author

Disregard the error with finding the chassis inventory description. It appears you need to be absolutely specific about the path and can't search through the tree without specifying parent nodes:

>>> rtr = Device('10.10.254.1', user='root', password='harbl')
>>> rtr.open()
Device(10.10.254.1)
>>> inv = rtr.rpc.get_chassis_inventory()
>>> inv.find('multi-routing-engine-item/chassis-inventory/chassis/description').text
'SRX 1400'
>>>

The config load is still failing, though.

@supertylerc
Copy link
Author

More testing:

When loading the same template to an SRX550, the commit is successful but the method throws an error:

rtr.cu.commit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/jnpr/junos/utils/config.py", line 72, in commit
    JXML.remove_namespaces( err.xml )
AttributeError: 'exceptions.AttributeError' object has no attribute 'xml'
>>>

However, the configuration was actually committed:

tyler@srx550-1> show configuration system login
class ADMIN {
    login-alarms;
    permissions all;
}
user tyler {
    full-name "Tyler Christiansen";
    uid 2001;
    class ADMIN;
    authentication {
        ssh-rsa "harbl"; ## SECRET-DATA
    }
}

{primary:node0}

This makes it a bit more difficult to catch the failure and perform appropriate action, since you can't do a simple rollback (to zero) and need to actually specify a revision to rollback to (1).

@jeremyschulman
Copy link
Contributor

@tyler-c - you write:

Disregard the error with finding the chassis inventory description. It appears you need to be absolutely specific about the path and can't search through the tree without specifying parent nodes

I actually thought the same given my background using XML with Ruby ;-) Try prefixing your XPath expression with "./" so "chassis/description" becomes "./chassis/description". This technique works for me so I do not need to be absolutely specific.

Hope this helps.

@jeremyschulman
Copy link
Contributor

@tyler-c - just a helpful bit:

>>> inv.find('multi-routing-engine-item/chassis-inventory/chassis/description').text

can be

>>> inv.findtext('multi-routing-engine-item/chassis-inventory/chassis/description')

@jeremyschulman
Copy link
Contributor

@tyler-c - regarding you exception around the cu.commit(), could you please add a try/except block and dump the error:

try:
   <your code>
except Exception as err:
   import pdb
   pdb.set_trace()

When the debugger (pdb) hits, you can just inspect the err variable and it will give you the XML response from Junos. This might show you what the cause it - please do include this in the next comment on this issue. Thank you!

@jeremyschulman
Copy link
Contributor

@tyler-c - I just submitted some code to master that has better Exception handling. Could you please retrieve that code and re-try your tests?

Alternatively, if you can allow me remote access to your device I could try to resolve this directly.

Thank you!

@supertylerc
Copy link
Author

Sorry for lack of testing--been a bit busy. I'll have to clone the repo and use that (currently using pip version). I'll try to get to it before the weekend.

Thanks.

@jeremyschulman
Copy link
Contributor

@tyler-c - Just checking in. Hope all is going well. Do you happen to have an update on this issue?

@jeremyschulman
Copy link
Contributor

@tyler-c - I'd like to close this issue if it is no longer persistent. Please advise, or I'll close in a few days. Thank you!

@jeremyschulman
Copy link
Contributor

will close this on 5/16 if no further activity reported.

@jeremyschulman
Copy link
Contributor

closing due to inactivity. can re-open at a later time.

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

No branches or pull requests

4 participants