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

tests.py failed. #10

Closed
dikshie opened this issue Apr 5, 2014 · 9 comments
Closed

tests.py failed. #10

dikshie opened this issue Apr 5, 2014 · 9 comments

Comments

@dikshie
Copy link

dikshie commented Apr 5, 2014

Traceback (most recent call last):
File "tests.py", line 289, in <module>
runTest(testULGAction(routerid=0,commandid=0,sessionid=None,maxtimes=10,interval=5,**{}))
File "tests.py", line 86, in testULGAction
if(re.compile("refresh",re.M).search(u.renderULGResult(sessionid=sessionid))):
File "/usr/home/dikshie/public_html/ulg/ulg.py", line 618, in renderULGResult
result_text = session.getDecoratedResult(self.decorator_helper,session.getRange(),session.isFinished())
File "/usr/home/dikshie/public_html/ulg/ulg.py", line 167, in getDecoratedResult
dr = self.getCommand().decorateResult(self,decorator_helper)
File "/usr/home/dikshie/public_html/ulg/ulgcisco.py", line 427, in decorateResult
table.append(self._decorateTableLine(l,decorator_helper,session.getRouter()))
File "/usr/home/dikshie/public_html/ulg/ulgcisco.py", line 402, in _decorateTableLine
raise Exception("Can not parse line: "+line)
Exception: Can not parse line: 2001:D30:101:1::11

@tmshlvck
Copy link
Owner

tmshlvck commented Apr 5, 2014

Hello!

Could you please:

  1. post/send me your config.py (without passwords)
  2. uncomment line #908 in ulgcisco.py (= s.logfile = open('/tmp/ulgcisco.log', 'w'), re-run tests and look at end of the generated logfile and send me the important portion (without passwords that might be contained in the log as well).
  3. tell me what router / IOS version do you have.

Cheers,
Tomas

@dikshie
Copy link
Author

dikshie commented Apr 6, 2014

routers = [CiscoRouter(host='202.249.25.1', user='YyYyYy', password='XxXxXx', asn=4717)]

cat /var/tmp/ulgcisco.log
YyYyYy@sfc-gate.ai3.net's password: XxXxXx

sfc-c7200-gate.ai3.net#terminal length 0
terminal length 0
terminal width 0
sfc-c7200-gate.ai3.net#terminal width 0
show bgp ipv4 unicast summary
sfc-c7200-gate.ai3.net#show bgp ipv4 unicast summary
BGP router identifier 202.249.24.115, local AS number 4717
BGP table version is 12610172, main routing table version 12610172
68394 network entries using 8822826 bytes of memory
164964 path entries using 8578128 bytes of memory
29976/10402 BGP path/bestpath attribute entries using 3717024 bytes of memory
12288 BGP AS-PATH entries using 375962 bytes of memory
1135 BGP community entries using 62240 bytes of memory
14 BGP extended community entries using 436 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
3141 BGP filter-list cache entries using 37692 bytes of memory
BGP using 21594308 total bytes of memory
27901 received paths for inbound soft reconfiguration
BGP activity 2403473/2329339 prefixes, 9040108/8863755 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:D30:101:1::11
4 4717 0 0 0 0 0 never Active
202.249.24.4 4 4717 0 0 0 0 0 never Active
202.249.24.36 4 4717 0 0 0 0 0 never Active
202.249.24.37 4 4717 0 0 0 0 0 never Active
202.249.24.38 4 4717 0 0 0 0 0 never Active
202.249.24.42 4 4717 0 0 0 0 0 never Active
202.249.24.46 4 4717 176145 3586675 12610172 0 0 2d18h 3
202.249.24.47 4 4717 2057559 3590934 12610172 0 0 17w6d 54447
202.249.25.27 4 4717 0 0 0 0 0 never Active
202.249.26.114 4 2500 2096033 180899 12610171 0 0 1w2d 54812
202.249.26.116 4 2500 0 0 0 0 0 never Idle (Admin)
203.181.248.242 4 7660 1551299 355691 12610171 0 0 1w2d 13899
203.181.248.243 4 7660 1666932 361823 12610171 0 0 1w2d 13898
sfc-c7200-gate.ai3.net#logout
logout

Cisco IOS Software, 7200 Software (C7200-ADVIPSERVICESK9-M), Version 12.4(9)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 30-Aug-06 20:48 by prod_rel_team

ROM: System Bootstrap, Version 12.2(8r)B, RELEASE SOFTWARE (fc1)
BOOTLDR: 7200 Software (C7200-KBOOT-M), Version 12.2(4)BW, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)

sfc-c7200-gate.ai3.net uptime is 17 weeks, 6 days, 14 hours, 45 minutes
System returned to ROM by power-on
System restarted at 18:55:34 JST Sun Dec 1 2013
System image file is "disk2:/c7200-advipservicesk9-mz.124-9.T1.bin"

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Cisco 7206VXR (NPE-G1) processor (revision A) with 983040K/65536K bytes of memory.
Processor board ID 30927064
SB-1 CPU at 700MHz, Implementation 1025, Rev 0.2, 512KB L2 Cache
6 slot VXR midplane, Version 2.7

thanks!

@dikshie
Copy link
Author

dikshie commented Apr 6, 2014

i put also on pastebin: http://pastebin.com/LygXmmQY
you can see the first line of table: 2001:D30:101:1::11 contains long space then on next line continues with its version, AS, etc.

@tmshlvck
Copy link
Owner

tmshlvck commented Apr 9, 2014

Oh yes, now I got it. I'll try to fix the problem today... It seems that in your case as a hotfix it would be sufficient to just ignore the unrecognized line with the IPv6 address. But in the general case it is possible to announce IPv4 prefixes over IPv6 BGP session (running in IPv4 address family config). Right? So I have to anticipate both IPv4 and IPv6 addresses in the neighbor table for both address families...

tmshlvck added a commit that referenced this issue Apr 17, 2014
Fix Cisco parsing of show bgp ipv4/6 unicast sum when the opposite address
family peer is used. I.e. this:

sfc-c7200-gate.ai3.net#show bgp ipv4 unicast summary
<cut>
BGP activity 2403473/2329339 prefixes, 9040108/8863755 paths, scan interval 60 secs

Neighbor      V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:D30:101:1::11
              4 4717 0     0       0      0   0    never   Active
202.249.24.4  4 4717 0     0       0      0   0    never   Active
202.249.24.36 4 4717 0     0       0      0   0    never   Active

Fixing issue #10 .
@tmshlvck
Copy link
Owner

Finally fixed. Can you please re-test?

@dikshie
Copy link
Author

dikshie commented Apr 17, 2014

OK: Test running command 0 on router 0 with parameters:[]
OK: Test running command 4 on router 0 with parameters:['91.210.16.1']
OK: Test render ULG CGI index
OK(1/2): Test ULG run action passed with sessionid=70c0f66bd4e82cf959b2ca142174a7e7
Test ULG result is not complete. Waiting another 5 seconds.

The above is a description of an error in a Python program, formatted
for a Web browser because the 'cgitb' module was enabled. In case you
are not reading this in a Web browser, here is the original traceback:

Traceback (most recent call last):
File "tests.py", line 289, in <module>
runTest(testULGAction(routerid=0,commandid=0,sessionid=None,maxtimes=10,interval=5,**{}))
File "tests.py", line 86, in testULGAction
if(re.compile("refresh",re.M).search(u.renderULGResult(sessionid=sessionid))):
File "/usr/home/dikshie/public_html/ulg/ulg.py", line 618, in renderULGResult
result_text = session.getDecoratedResult(self.decorator_helper,session.getRange(),session.isFinished())
File "/usr/home/dikshie/public_html/ulg/ulg.py", line 167, in getDecoratedResult
dr = self.getCommand().decorateResult(self,decorator_helper)
File "/usr/home/dikshie/public_html/ulg/ulgcisco.py", line 428, in decorateResult
table.append(self._decorateTableLine(l,decorator_helper,session.getRouter()))
File "/usr/home/dikshie/public_html/ulg/ulgcisco.py", line 403, in _decorateTableLine
raise Exception("Can not parse line: "+line)
Exception: Can not parse line: 2001:D30:101:1::11

hmm strange. it's still cant parse.

@tmshlvck
Copy link
Owner

Yes, it seems there was another problem with line breaks. Could you please re-test with the latest patch fa12f97 ?

@dikshie
Copy link
Author

dikshie commented Apr 18, 2014

looks good!

OK: Test running command 0 on router 0 with parameters:[]
OK: Test running command 4 on router 0 with parameters:['91.210.16.1']
OK: Test render ULG CGI index
OK(1/2): Test ULG run action passed with sessionid=aead4ca97d7547cc68b9588867dbf065
Test ULG result is not complete. Waiting another 5 seconds.
OK(2/2): Test ULG result is complete.
OK: Test sessions.
OK: Test lock.
OK: Logging test. Check logfile for message: Test message no. 1.
OK: Test running rescan.
OK: Test persistent storage.
DEBUG: Cisco parser input: [' > 62.109.128.0/19 0.0.0.0 0 32768 i', ' *> 91.199.207.0/24 217.31.48.86 1024 0 44672 i', ' *> 91.224.58.0/23 217.31.48.70 100 1024 0 50833 i', ' *> 93.170.16.0/21 217.31.48.70 100 1024 0 50833 i', ' *> 188.227.128.0/19 0.0.0.0 0 32768 i', ' *> 217.31.48.0/20 0.0.0.0 0 32768 i']
DEBUG: Cisco parser output: [['
>', '62.109.128.0/19', '0.0.0.0', '0', '', '32768', 'i'], ['>', '91.199.207.0/24', '217.31.48.86', '', '1024', '0', '44672 i'], ['>', '91.224.58.0/23', '217.31.48.70', '100', '1024', '0', '50833 i'], ['>', '93.170.16.0/21', '217.31.48.70', '100', '1024', '0', '50833 i'], ['>', '188.227.128.0/19', '0.0.0.0', '0', '', '32768', 'i'], ['>', '217.31.48.0/20', '0.0.0.0', '0', '', '32768', 'i']]
OK: Test Cisco parser.
DEBUG: Cisco parser input: [' * 195.226.217.0 62.109.128.9 0 51278 i']
DEBUG: Cisco parser output: [['
', '195.226.217.0', '62.109.128.9', '', '', '0', '51278 i']]
OK: Test Cisco parser.
DEBUG: Cisco parser input: [' > 2001:67C:278::/48', ' 2001:1AB0:7E1F:1:230:48FF:FE8C:A192', ' 1024 0 51278 i', ' *> 2001:1AB0::/32 :: 0 32768 i', ' *> 2A01:8C00::/32 :: 0 32768 i']
DEBUG: Cisco parser output: [['
>', '2001:67C:278::/48', '2001:1AB0:7E1F:1:230:48FF:FE8C:A192', '', '1024', '0', '51278 i'], ['>', '2001:1AB0::/32', '::', '0', '', '32768', 'i'], ['>', '2A01:8C00::/32', '::', '0', '', '32768', 'i']]
OK: Test Cisco parser.

***** Results *****
Tests pased: 12/12
Tests failed: 0/12
Failed numbers: []


@tmshlvck
Copy link
Owner

Thanks... Just closing old issue.

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

No branches or pull requests

2 participants