Please help to parse ALCATEL 7x50 SRx interface description

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
levi
Posts: 41
Joined: Wed Oct 24, 2007 1:08 am
Location: Yerevan, Armenia
Contact:

Please help to parse ALCATEL 7x50 SRx interface description

Post by levi »

Hi,

I have a few ALCATEL 7750 routers and i am able to successfully graph all ports/interfaces/services i need. But i wanted to add port descriptions to the graphs from the router itself.
The problem is that the router output of description field is as follows (from verbose query):

Code: Select all

+ Found item [ifDescr='1/1/1, 10/100/Gig Ethernet TX, MSRV01-1-2/41'] index: 35684352 [from value]
where:
1/1/1 - is port/interface number
10/100/Gig Ethernet TX - is port/interface type
and the last MSRV01-1-2/41 is actual description i gave in router

As i understood the output is comma separated and same logic applies to all interfaces/ports
Is there a way to parse the output and discard values from first two columns/commas and use the values from third column as a description?

Thanks in advance.
Best Regards.
nikliepins
Posts: 6
Joined: Fri Mar 08, 2013 5:54 pm

Re: Please help to parse ALCATEL 7x50 SRx interface descript

Post by nikliepins »

Hi,

Solution in python =

assume that variable "s" includes 1 line of the configuration
third_column = s.split(",")[2].split("'")[0].strip()

Please verify the format before, as if the line is in the wrong format it will crash.

Hope that helps,
Nik
alopezdu
Posts: 8
Joined: Tue Mar 26, 2013 2:15 pm

Re: Please help to parse ALCATEL 7x50 SRx interface descript

Post by alopezdu »

Exactly the same problem...

I'm trying to parse it with regexp on the xml file too... but not results yet!
Now i have long titles, with some stuid information ( 10/100/Gig Ethernet TX )

good luck!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests