UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Lieutenant
Lieutenant
578 views

pexpect child.before empty for commands executed after connect device

Jump to solution

I am  trying to write a script to login into NA proxy and from NA proxy connect to a cisco device using "connect" and get "show version" output. I am using Python Pexpect for this. But facing some issue in getting output from connected devices. 


Using Python pexpect. Steps I am following is 

1. Using pexpect connect to NA Proxy

2. Execute "Connect <device_ip>"

3. On connected device , execute "show version"

4. Get "show version" output to a variable, using "child.before"

Everything works fine except #4. I am getting nothing as show version output.

But If use same env and script to login/ssh directly  to device and execute the "show version" I get output to my variable child.before.
Also if using script, I login into NA Proxy and execute any local command (for ex : show task -id ) I see child.before output.

Only when script login to NA proxy and then connect to another device and execute command, command output or child.before is blank.

Can someone please help .

 

Thanks

Bobin

0 Likes
1 Solution

Accepted Solutions

Hello,

Please refer to the original thread :

 

https://community.softwaregrp.com/t5/Network-Automation-User/pexpect-child-before-empty-for-commands-executed-after-connect/td-p/1654981

 

Regards,

Melissa Carranza Mejias
Customer Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation. “

View solution in original post

0 Likes
1 Reply

Hello,

Please refer to the original thread :

 

https://community.softwaregrp.com/t5/Network-Automation-User/pexpect-child-before-empty-for-commands-executed-after-connect/td-p/1654981

 

Regards,

Melissa Carranza Mejias
Customer Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation. “

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.