Hi Robert,

Thank you for the reply.

We already tried that and it failed.
I did have a look at the code and the reason is that it is not just a 
Perl (regex) substitution, if that is what you meant.

Extracting content from inside the brackets is achieved in the 
"lib/perl/xCAT/Table.pm" file using the  'extract_bracketed' function.
I did not want to bother with Text::Balanced too much because our main 
goal is not at generalizing xCat's functionality, but to adapt to our 
needs to get it working with our hardware.

I managed to solve the brackets problem in the switch table - it is a 
specific fix.
I added the following in "lib/perl/xCAT/MacMap.pm":

return 1 if  $namepersnmp =~ /$namepercfg/

(inside of sub namesmatch()    (somewhere around lines 106-107)).

In the switch table, I've substituted the "escaped brackets" with a '.' 
(any character).
This was probably not strictly required because the escaped brackets 
would probably also work in this case.

Anyway, this works fine now. We are using a Nortel switch 5530 (Avaya) 
and that is why we had the switch output the SNMP data with brackets 
(with relation to the mac-port discovery process).

Thanks again,
Best regards,
Nuriel Shem-Tov
ClusterVision BV

On 19/03/14 16:20, Nuriel Shem-Tov wrote:
 > I would like to know how is it possible to escape round brackets in xCat
 > tables when using regex?
 >
 > For example, in the switch table we tried escaping the relevant brackets:
 > "compute","switch01","|node(\d+)|ifc($1+0) \(Slot: 1 Port: ($1+0)\)|",,,,
 > But it results in:  "ifc1 \(Slot: 1 Port: ($1+0)\)"
 >
 > And we wanted it to become: "ifc1 (Slot: 1 Port: 1)"
Will it not just work without the brackets escaped? I think it's just a
Perl substitution so the brackets don't have any special meaning in the
second part.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
xCAT-user mailing list
xCAT-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xcat-user

Reply via email to