Questions tagged [pyez]
Junos PyEZ is a Python library to remotely manage/automate Junos devices via SSH/Telnet/Serial connections.
34
questions
0
votes
0
answers
20
views
PyEZ Adding Command Option, "invoke-on other-routing-engine," to RPC get_system_storage
I'm attempting to acquire the "show system storage" output for both routing engines on my MX960 from the PyEZ function, dev.rpc.get_system_storage, but I don't see how to add the command ...
1
vote
1
answer
197
views
Using textFSM to parse multiple show commands
I'm trying to use textFSM to compile some Juniper "show" command outputs and get specific fields from them and finally printing collected info in one run.
This is my code:
import textfsm
...
0
votes
1
answer
150
views
Juniper PyEZ ephemeral database send RPC
I want to send some "raw" RPC commands
For example;
<rpc>
<open-configuration>
<ephemeral-instance>eph1</ephemeral-instance>
</open-configuration>
</rpc>
]...
2
votes
0
answers
186
views
JunOS pyEz - Using 'serial' mode with Device class throws exceptions
I have been trying to use JunOS pyEZ to provision SRX which needs serial connection for initial configuration. Using the below mentioned code throws I/O exception:
from jnpr.junos import Device
from ...
2
votes
1
answer
443
views
PyEZ: RPC: Get route info for specific grandchild element
I want to get wia RPC info like this:
> show route output interface ae40.4181 | display xml rpc
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.4R2/junos">
<rpc>
&...
0
votes
1
answer
184
views
JSNAPY: Is there a way to test on xpath node attributes
I am trying to determine how to test on the node attributes that junos occasionally uses. In this particular case, I want to find all BGP sessions that are down between 20w and 1y. The seconds value ...
0
votes
2
answers
183
views
Using PyEZ on EX4300
Does PyEZ work with an EX4300 switch?
Looking https://www.juniper.net/documentation/en_US/junos/topics/concept/rest-api-overview.html under the Platform and Release Support link, it appears that EX ...
0
votes
1
answer
131
views
How to extract BGP configuration of specific group?
How to extract junos mx bgp configuration of specific group using pyez configuration tables?
i have tried using the following table/view:
BGPConfigTable:
get: groups/protocols/bgp/group/neighbor
...
0
votes
2
answers
2k
views
Unable to make a PyEZ connection: ConnectUnknownHostError
I am trying to use juniper_junos_facts from the Ansible Junos module to query some VM's that I provisioned using Vagrant. However I am getting the following error.
fatal: [r1]: FAILED! => {"...
0
votes
1
answer
451
views
How to verify outputs of line code in a python function
I have test a function below and how can I verify the output of specific line in the function below.
def data():
dev = Device(host="1.1.1.1", user="test", password="test123", port=22,
...
1
vote
2
answers
2k
views
Beginner Python Script to ssh into remote network device and run multiple commands
Please pardon me as I am a very new to any programming language. I have around 25 network devices combination of cisco, juniper, linux etc which i need to remotely access and run some basic cli ...
0
votes
3
answers
3k
views
Is there a way to convert juniper "json" or "xml" config to "set" or "show" config?
We use juniper hardware with junos version 15. In this version we can export our config as "json" or "xml" which we want to use to edit it with our automation tooling.
Importing however is only ...
1
vote
0
answers
145
views
Getting Conditional Data Using PyEZ Tables
I'm trying to create a custom table/view for Junos interfaces. Yes, I know it already exists as a built-in/default table but this is a learning exercise that I plan to expand on later.
The problem is ...
-1
votes
1
answer
61
views
xml print element values with python
I am testing pyez with rpc calls to get a mac-table, so far i am able to pull the data but when i print this data doesn´t show me the values it shows me only memory addresses.
below my code:
dev = ...
0
votes
2
answers
868
views
How do I get the mac-address table of a Juniper router using PyEZ? It throws an error when running
I have created a simple python script to get the vpls mac table from a rouer using an RPC command. Hower it throws an error when running. Does anybody know what I am doing wrong?
root@ubuntu:~# cat ...
0
votes
2
answers
284
views
Junos Device CLI command giving wrong output when executed from python
When i try to execute Device.cli(....) command from python it gives me wrong output. What could be the issue?
For example, if i execute below command on directly on Juniper Device CLI, it gives the ...
1
vote
1
answer
362
views
juniper_junos_software installs software but task fails due to "No handlers.."
Im trying to install 12.3X48-D70 on an SRX550 using the juniper_junos_software module, and while it successfully installs and reboots the device the task returns as failed because of a "No handlers" ...
0
votes
2
answers
964
views
Load Configuration File with Juniper PyEZ
I am trying to load override a config stored on the juniper device (vSRX) with PyEZ. The code looks like this
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
dev = Device(...
-2
votes
1
answer
249
views
fatal: [cor-001]: FAILED! => {"changed": false, "msg": "junos-eznc (aka PyEZ) >= 2.1.7 is required for this module. However, junos-eznc does not a
I am getting this error when trying to run my playbook even though I have already installed pyEZ.
Can anyone please help me to fix it?
MCBOOK:~ user2018$ ansible-playbook simpletest.yml
[...
0
votes
1
answer
302
views
get_bgp_summary_information RPC and using logical-systems
Hi I am trying to use PyEZ to to create an automation script.
My goal is save response from bgp summary with logical system in a variable
This one works:
bgpinfo= cor1.rpc....
1
vote
1
answer
800
views
How to install Juniper.junos ansible-galaxy in mac?
I tried to install the latest version of Juniper.junos on my Mac :
sudo ansible-galaxy install Juniper.junos
-downloading role 'junos', owned by Juniper
-downloading role from https://github....
0
votes
1
answer
406
views
pyEZ : how to get junos default groups
I am working on a project to automate junos firewall policy creation workflow. I found pyEZ as the most viable option for my case.
Although I am able to retrieve the complete configuration from the ...
1
vote
1
answer
772
views
Ansible 2.3 Core module junos_config - Failed "unable to open shell"
With Ansible 2.3 for the Core modules junos_config we get error "unable to open shell".
My playbook
25 tasks:
26 - name: Build configuration
27 template: src={{ ...
1
vote
2
answers
540
views
JUNOS PYEZ: Over write the Base config of a Device in SET command
I am writing the below code to push the base config to my device.
But it is merging the lines and not over writing.
Merging is still keeping the not required lines of Base config which is a problem ...
1
vote
1
answer
1k
views
PYEZ - Display set | Match command
I have been trying to run the below commands through below program but they are fetching the whole of config file and not the result of match command . Is match function not supported through PYEZ?
...
0
votes
1
answer
130
views
PyEZ - Cron Job to connect to 8 routers and save the running config to 8 local files at a specific time stamp
I am a starter to PyEZ. Can I write a cron job in PyEZ which will connect to 8 routers and fetch the running Config on device and save to 8 different files at a particular timestamp. Could you help me ...
0
votes
2
answers
599
views
Is is possible to add/edit prefix list and policy statement using pyez
Is it possible to edit the prefix list and policy statements through pyez in juniper router.
Device details
junos version : 15.1f5, Device : juniper mx240
And i am using pyez on top of netconf to ...
0
votes
1
answer
1k
views
How to use Junos PyEZ configuration table to extract all interface units?
I was trying to use PyEZ InterfaceTable to extract interface configuration. My problem is that I can only see one unit per interface while there are actually more than one configured on some ...
0
votes
2
answers
628
views
How to make Junos PyEZ work via console port?
I am trying to make Junos PyEZ work via console port (telnet to a Cisco AS2511-RJ terminal server, which is connected to Juniper SRX-240 console port).
The test script is
dev = Device(host='X.X.X.X'...
4
votes
2
answers
2k
views
Executing vty commands in Juniper routers using PyEZ
I have a requirement where, a python script running in a Juniper router shell needs to execute some commands in vty console of the FPC. I cannot use vty c because it may not work properly in all ...
-1
votes
1
answer
1k
views
PyEZ: jnpr.junos.exception.ConnectRefusedError: ConnectRefusedError(xx.xxx.xxx.xxx)
PyEZ Device connection returns ConnectRefusedError.
>>> dev = Device(host='xx.xxx.xx.xx', user='xxxx',password='xxxx')
>>> dev.open()
Traceback (most recent call last):
File "<...
1
vote
2
answers
1k
views
PyEZ: 'EntryPoint' object has no attribute 'resolve'
PyEZ user are facing issue with respect to subject line error
from jnpr.junos import Device
>>> dev = Device(host='xxx',user='xxxx',passwd='xxx')
>>> dev.open()
No handlers could be ...
0
votes
2
answers
838
views
Python - change password for user in JunOS
I need assistance with this project and issues im having.
I am able to make changes to this juniper router with no issues.. The issue comes in when I need to change the password for a user.
Per the ...
3
votes
2
answers
1k
views
Junos PyEZ Entering Passwords from Python
Hi I am currently learning PyEZ to configure JunOS devices from Python. But I am stuck at a certain problem. I want to be able to create new users through Python but I can't figure out how to enter ...