I run my script using netmiko and ssh to juniper device. The script run commands to get device info such as hostname, model, etc. The output then is save onto dictionary.
print output result from code got too many space and output not properly save onto dictionary
This is the print output result from the code
Hostname: vcx.lab01
{master}
Model: t640
{master}
Junos: 15.1R7-S1
{master}
If you can see above, there is a a lot of space/gaps between first command output and second command output and each command will end with {master}.
Below is the output key-in cli direct from Juniper router
usr12@vcx.lab01> show version | match Hostname
Hostname: vcx.lab01
{master}
usr12@vcx.lab01> show version | match Model
Model: t640
{master}
usr12@vcx.lab01> show version | match Junos:
Junos: 15.1R7-S1
{master}
Even I'm getting the same space issues when run the same commands over the juniper router.
Thus when I save each of the output of juniper device to my dictionary it will save like below
Hostname,Model,Version^M
"
Hostname: vcx.lab01
{master}","
Model: t640
{master}","
Junos: 15.1R7-S1
{master}"^M
I would like the print output to be clean no space and no {master} like below
Hostname: vcx.lab01
Model: t640
Version: 15.1R7-S1
and I would like dictionary file as below
Hostname,Model,Version
vcx.lab01,t640,15.1R7-S1
I really need your help to advise me what can I do to overcome this issues, please help me. Thanks