Closed spidercensus closed 7 years ago
@spidercensus Hi Jason,
Which version of PyEZ are you using? I tested with 1.3.1 and latest github code. For both its working fine. Also on which junos you are running this?
Nitin,
I'm using PyEZ 1.3.1. I've discovered that I am able to run .cli('request support information') on other, smaller devices successfully. It may be because this is a production service provider router with such a long output for the RSI command that PyEZ is generating an exception. Is there a limit to the buffer length for a CLI command?
>>> d.cli('request support information', warning=False)
/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py:573: RuntimeWarning: An unknown exception occured - please report.
warnings.warn("An unknown exception occured - please report.", RuntimeWarning)
'invalid command: request support information'
>>> import jnpr.junos
>>> jnpr.junos.__version__
'1.3.1'
>>> d.facts
{'domain': 'REDACTED', 'RE1': {'status': 'OK', 'last_reboot_reason': 'Router rebooted after a normal shutdown.', 'model': 'RE-S-1800x4', 'up_time': '961 days, 14 hours, 35 minutes, 33 seconds', 'mastership_state': 'backup'}, 'ifd_style': 'CLASSIC', 'version_RE1': '11.4R7.5', 'version_RE0': '11.4R7.5', '2RE': True, 'serialnumber': 'JN122DA43AFA', 'fqdn': 'REDACTED', 'version_info': junos.version_info(major=(11, 4), type=R, minor=7, build=5), 'switch_style': 'BRIDGE_DOMAIN', 'version': '11.4R7.5', 'master': 'RE0', 'hostname': 'REDACTED', 'HOME': '/var/home/readonly', 'model': 'MX960', 'RE0': {'status': 'OK', 'last_reboot_reason': 'Router rebooted after a normal shutdown.', 'model': 'RE-S-1800x4', 'up_time': '961 days, 14 hours, 33 minutes, 20 seconds', 'mastership_state': 'master'}, 'vc_capable': False, 'personality': 'MX'}
I added a print statement for the exception at line 573 of device.py:
# Something unexpected happened - raise it up
except Exception as err:
print err.message
warnings.warn("An unknown exception occured - please report.", RuntimeWarning)
raise
I got the exception message : "error parsing attribute name, line 1054, column 26".
Let me see if I can get the text of the RSI output from the command line for analysis.
On closer inspection the problematic lines appear as part of RSI executing the command "show system boot-messages no-forwarding".
I can get PyEZ to throw the exception when requesting just this command from .cli()
The exception says the parser is choking on the following lines:
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x9ce3bd<SSE3,RSVD2,MON,DS_CPL,VMX,EST,TM2,<b9>,CX16,<b14>,<b15>,<b18>,<b19>,<b20>,<b23>>
AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
@spidercensus can you please execute "show system boot-messages | display xml | match Features2" on the problem device?
The output should show that <
and >
characters are escaped as <
and >
like this:
Features2=0x9ce3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,SSE4.2,POPCNT>
AMD Features2=0x1<LAHF>
If they are not escaped, that's a Junos bug and the cause of your problem.
...@...> show system boot-messages | display xml | match Features2
Features2=0x9ce3bd<SSE3,RSVD2,MON,DS_CPL,VMX,EST,TM2,<b9>,CX16,<b14>,<b15>,<b18>,<b19>,<b20>,<b23>>
AMD Features2=0x1<LAHF>
See, the problem isn't the XML output, though. It's the CLI output.
@spidercensus Jason, can you share the file config.xml, generated by "show system boot-messages | display xml | save config.xml" You can unicast to me or @stacywsmith
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/11.4R7/junos">
<output>
Copyright (c) 1996-2013, Juniper Networks, Inc.
All rights reserved.
Copyright (c) 1992-2006 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
JUNOS 11.4R7.5 #0: 2013-03-01 08:49:11 UTC
builder@evenath.juniper.net:/volume/build/junos/11.4/release/11.4R7.5/obj-amd64/bsd/kernels/JUNIPER64/kernel
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Xeon(R) CPU C5518 @ 1.73GHz (1729.11-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x106e4 Stepping = 4
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x9ce3bd<SSE3,RSVD2,MON,DS_CPL,VMX,EST,TM2,<b9>,CX16,<b14>,<b15>,<b18>,<b19>,<b20>,<b23>>
AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
AMD Features2=0x1<LAHF>
Cores per package: 8
Logical CPUs per core: 2
real memory = 17985175552 (17152 MB)
avail memory = 16609046528 (15839 MB)
Security policy loaded: JUNOS MAC/runasnonroot (mac_runasnonroot)
Security policy loaded: JUNOS MAC/pcap (mac_pcap)
Initializing M/T platform properties ..
cpu0 on motherboard
pcib0: <Host to PCI bridge> pcibus 0 on motherboard
pci0: <PCI bus> on pcib0
pcib1: <PCI-PCI bridge> mem 0xfb900000-0xfb90ffff irq 11 at device 3.0 on pci0
pci3: <PCI bus> on pcib1
em0: <Intel(R) PRO/1000 Network Connection Version - 3.2.18> port 0x4000-0x401f mem 0xfbd00000-0xfbd1ffff,0xfbd20000-0xfbd23fff irq 11 at device 0.0 on pci3
pcib2: <PCI-PCI bridge> irq 11 at device 4.0 on pci0
pci4: <PCI bus> on pcib2
em1: <Intel(R) PRO/1000 Network Connection Version - 3.2.18> port 0x3000-0x301f mem 0xfbc00000-0xfbc1ffff,0xfbc20000-0xfbc23fff irq 11 at device 0.0 on pci4
pcib3: <PCI-PCI bridge> irq 11 at device 5.0 on pci0
pci5: <PCI bus> on pcib3
em2: <Intel(R) PRO/1000 Network Connection Version - 3.2.18> port 0x2000-0x201f mem 0xfbb00000-0xfbb1ffff,0xfbb20000-0xfbb23fff irq 11 at device 0.0 on pci5
pcib4: <PCI-PCI bridge> irq 11 at device 6.0 on pci0
pci6: <PCI bus> on pcib4
pcib5: <PCI-PCI bridge> irq 11 at device 0.0 on pci6
pci7: <PCI bus> on pcib5
acb0: <Atlas Enhanced Control Subsystem> mem 0xfba10000-0xfba103ff irq 11 at device 13.0 on pci7
acb0: acb: softc at 0xffffff00010914c0, fpga regs at 0xffffff00fba10000
spi: zl30143 clock initialized to 19.44 MHz
pci7: <network> at device 14.0 (no driver attached)
pci0: <base peripheral> at device 8.0 (no driver attached)
pci0: <base peripheral> at device 8.1 (no driver attached)
pci0: <base peripheral> at device 8.2 (no driver attached)
pci0: <base peripheral> at device 8.3 (no driver attached)
pci0: <base peripheral> at device 9.0 (no driver attached)
pci0: <base peripheral> at device 10.0 (no driver attached)
pci0: <base peripheral> at device 10.1 (no driver attached)
pci0: <base peripheral> at device 10.2 (no driver attached)
pci0: <base peripheral> at device 10.3 (no driver attached)
pci0: <base peripheral> at device 10.4 (no driver attached)
pci0: <base peripheral> at device 10.5 (no driver attached)
pci0: <base peripheral> at device 10.6 (no driver attached)
pci0: <base peripheral> at device 10.7 (no driver attached)
pci0: <base peripheral, interrupt controller> at device 11.0 (no driver attached)
pci0: <base peripheral> at device 16.0 (no driver attached)
pci0: <base peripheral> at device 16.1 (no driver attached)
pci0: <base peripheral> at device 17.0 (no driver attached)
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfbe21000-0xfbe213ff irq 11 at device 29.0 on pci0
usb0: waiting for BIOS to give up control
usb0: EHCI version 1.0
usb0: <EHCI (generic) USB 2.0 controller> on ehci0
usb0: USB revision 2.0
uhub0: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub0: 1 port with 1 removable, self powered
uhub1: vendor 0x8087 product 0x0020, class 9/0, rev 2.00/0.00, addr 2
uhub1: single transaction translator
uhub1: 6 ports with 6 removable, self powered
pcib6: <PCI-PCI bridge> at device 30.0 on pci0
pci25: <PCI bus> on pcib6
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <GENERIC ATA controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x5090-0x509f,0x5080-0x508f irq 11 at device 31.2 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
ichsmb0: <Intel Ibexpeak (PCH) SMBus controller> port 0x5000-0x501f mem 0xfbe20000-0xfbe200ff irq 11 at device 31.3 on pci0
atapci1: <GENERIC ATA controller> port 0x5070-0x5077,0x5060-0x5063,0x5050-0x5057,0x5040-0x5043,0x5030-0x503f,0x5020-0x502f irq 11 at device 31.5 on pci0
ata2: <ATA channel 0> on atapci1
ata3: <ATA channel 1> on atapci1
orm0: <ISA Option ROMs> at iomem 0xc0000-0xc0fff,0xc1000-0xc1fff on isa0
sio0 at port 0x3f8-0x3ff irq 4 flags 0x90 on isa0
sio0: type 16550A, console
sio1 at port 0x3e8-0x3ef irq 5 on isa0
sio1: type 16550A
sio2 at port 0x2f8-0x2ff irq 3 on isa0
sio2: type 16550A
sio3 at port 0x2e8-0x2ef irq 7 on isa0
sio3: type 16550A
virtual chassis member-id = 255
virtual chassis mode = 0
Initializing product: 21 ..
Setting up M/T interface operations and attributes
bmeb: bmeb_lib_init done 0xffffff040fc7a000, addr 0xffffffff80bd1ca8
fxp0: bus=5, device=0, func=0, Ethernet address 00:a0:a5:7e:9b:f2
em1: bus=4, device=0, func=0, Ethernet address 02:00:01:00:00:04
em0: bus=3, device=0, func=0, Ethernet address 02:00:00:00:00:04
Timecounter "TSC" frequency 1729112384 Hz quality 800
ad1: Device does not support APM
ad1: 28496MB <StorFly - VSFA18PI032G-1A0 0605-1A0> at ata0-master UDMA33
ad0: Device does not support APM
ad0: 3998MB <Virtium - TuffDrive VCF300 101130> at ata0-slave UDMA33
Kernel thread "devrt_kernel_thread" (pid 40) exited prematurely.
Trying to mount root from ufs:/dev/ad0s1a
WARNING: / was not properly dismounted
</output>
<cli>
<banner>{master}</banner>
</cli>
</rpc-reply>
Hi @spidercensus Can you run the following RPC request from your router's CLI? (junoscript interactive netconf):
<?xml version="1.0" encoding="UTF-8"?><nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><nc:command format="xml">request support information</nc:command></nc:rpc>
For a better understanding of the exact output provided by the device.
Also, it would be useful if you'd display the type of the exception (inside the except Exception as err:
block). E.g.:
type, value, traceback = sys.exc_info()
and print all these values.
I suspect ncclient is unable process properly the XML returned by the device.
@spidercensus This should be fixed in latest code. Can you please confirm?
@spidercensus Closing this for now. If this is still an issue, please reopen. In that case, please manually execute the RPC as @mirceaulinic suggested and provide the output from the problem device.