From: Victor Cappuccio (vcappuccio@gmail.com)
Date: Thu Oct 23 2008 - 14:06:33 ARST
Hobbs, while I do not know how to help you to find a solution for your new
requirement, my understanding on your first post was that you where to use
a regular expression that matches AS Prepeding, it was stated like: "Suppose
I wanted to find all routes that have the same AS number in a row 8 or more
times...is this possible using regexp?"
for me that indicates that you are searching for all routes that are sourced
in any AS Directly neighbor "Your" As, and possibly doing AS Prepeding (that
means for me a multiplication of directly connected AS Number), now putting
the 2 previos fact in a solution then the regular expression to use is
^([0-9]+)(_\1)*$
R6(config)#do show ip bgp | b Net
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 172.22.83.1 0 4321 4321 4321
?
*> 3.3.3.3/32 172.22.83.1 0 0 4321 400 400
400 400 400 ?
*> 33.33.0.0/16 172.22.83.1 0 0 4321 100 100
100 100 100 ?
R6(config)#do show ip bgp regex ^([0-9]+)(_\1)*$| b Net
BGP table version is 87, local router ID is 172.217.43.6
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 172.22.83.1 0 4321 4321 4321
?
the expression in the first parenthesis, matches any AS Number, the
parenthesis stores the value of the matched ASNumber, and this value is
called by the second part of the regular expression, in the Variable "\1" is
like where you store the result and clearly you repeat this value zero or
more atoms, and the $ matches the end of the string.
now as from the regular expression you state, in the pair of brackets "["
and "]" you express CHARACTERS in a list of matches, a simple example would
be [1234] they would match ONE single character, "1", OR , "2" or "3", or
"4", you can just put an imaginary or in between the numbers in the string.
Good luck on that RegExp you are looking for
Thanks,
Victor.-
On Thu, Oct 23, 2008 at 4:35 PM, Hobbs <deadheadblues@gmail.com> wrote:
> Well so far I haven't really found what I find was the "optimum" solution,
> I don't even know if there is one. Even if it does display the AS_paths with
> 8 of the same AS, thats ALL I want. I don't want anything with 2 or 3 or 4
> of that AS...know what I mean? I also don't want paths with 8 AS made up of
> different numbers. That's what I have been getting so far.
>
> What I need is a plus sign + on steroids.
>
> Victor, your command is interesting it's just not giving me any
> output...example:
>
> route-server>show ip bgp regexp ^([13332]+)(_\1)*$
>
> route-server>
>
> Could you explain what the \1 does ? I can't find any info on this
>
> Nick, question marks wont work because they also match 0 instances...but I
> will try with plus signs instead, maybe you have something there...
>
> Thanks again everyone...maybe it would be easier to break it down like
> this:
>
> Find all AS paths with a double occurrence of any number, example
>
> 500 500 100 200 300 ?
> 100 200 300 400 400 ?
>
> But the regexp would have to take in account ALL possible numbers not just
> 400 or 500.
>
> Then the regexp could be easily modified to look for 3 occurrences, then 4,
> then 5, etc
>
>
>
>
> On Wed, Oct 22, 2008 at 10:30 PM, Nick Matthews <matthn@gmail.com> wrote:
>
>> I had actually thought about this before. I think you can do it with the
>> ? operator.
>>
>> _(700)?(700)?(700)?(700)?
>>
>> May even be able to try nesting them for larger amounts, haven't tested:
>>
>> _(( (700)? (700)? ) ?)?
>>
>> I believe this would allow up to 8 times. If you can nest the ? then you
>> can use powers to very quickly reach certain numbers. Unless you want some
>> silly number like 37.
>>
>>
>>
>>
>> Nick
>>
>>
>> On Wed, Oct 22, 2008 at 11:05 PM, Joseph Brunner <joe@affirmedsystems.com
>> > wrote:
>>
>>> So Victor are you studying for the Perl Certified Expert Programmer LOL
>>>
>>> You little PCEP
>>>
>>> LOL
>>>
>>> Thanks for the code snippet!
>>>
>>> -----Original Message-----
>>> From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
>>> Victor Cappuccio
>>> Sent: Wednesday, October 22, 2008 5:48 PM
>>> To: deadheadblues@gmail.com
>>> Cc: GS CCIE-Lab
>>> Subject: Re: BGP regexp - how to find x number or more occurrences of an
>>> AS
>>> in the AS path
>>>
>>> hi, maybe something like
>>> ^([0-9]+)(_\1)*$
>>> also could help ??
>>>
>>>
>>> R1(config-router)#do show ip bgp reg ^([0-9]+)(_\1)*$
>>> BGP table version is 3, local router ID is 172.22.81.1
>>> Status codes: s suppressed, d damped, h history, * valid, > best, i -
>>> internal,
>>> r RIB-failure, S Stale
>>> Origin codes: i - IGP, e - EGP, ? - incomplete
>>>
>>> Network Next Hop Metric LocPrf Weight Path
>>> *> 2.2.2.0/24 172.22.142.2 0 0 2 2 2 2 2 2
>>> 2 2
>>> 2 ?
>>> R1(config-router)#do show ip bgp reg ^(2+)(_\1)*$
>>> BGP table version is 3, local router ID is 172.22.81.1
>>> Status codes: s suppressed, d damped, h history, * valid, > best, i -
>>> internal,
>>> r RIB-failure, S Stale
>>> Origin codes: i - IGP, e - EGP, ? - incomplete
>>>
>>> Network Next Hop Metric LocPrf Weight Path
>>> *> 2.2.2.0/24 172.22.142.2 0 0 2 2 2 2 2 2
>>> 2 2
>>> 2 ?
>>> R1(config-router)#
>>> Diapositiva 12
>>> thanks,
>>>
>>>
>>> On Wed, Oct 22, 2008 at 7:50 PM, Marko Milivojevic
>>> <markom@markom.info>wrote:
>>>
>>> > > Suppose I wanted to find all routes that have the same AS number in a
>>> > > row 8
>>> > > or more times...is this possible using regexp?
>>> >
>>> > I don't think that IOS regex engine supports "match N occurences"
>>> > syntax that more advanced regex engines (like the one in Perl, for
>>> > example) do. If if did support it, it would look something like:
>>> >
>>> > _(12345){8,}
>>> >
>>> > If you want to match 8 times or more, where 8 is fixed, you could do
>>> > something like (oh, ugly):
>>> >
>>> > _12345_12345_12345_12345_12345_12345_12345_12345_(12345)*
>>> >
>>> > --
>>> > Marko
>>> > CCIE #18427 (SP)
>>> > My network blog: http://cisco.markom.info/
>>> >
>>> >
>>> > Blogs and organic groups at http://www.ccie.net
>>> >
>>> > _______________________________________________________________________
>>> > Subscription information may be found at:
>>> > http://www.groupstudy.com/list/CCIELab.html
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>>
>>>
>>> --
>>> Victor Cappuccio
>>> CCIE R/S# 20657
>>> CCSI# 30452
>>> www.anetworkerblog.com
>>>
>>>
>>> Blogs and organic groups at http://www.ccie.net
>>>
>>> _______________________________________________________________________
>>> Subscription information may be found at:
>>> http://www.groupstudy.com/list/CCIELab.html
>>>
>>>
>>> Blogs and organic groups at http://www.ccie.net
>>>
>>> _______________________________________________________________________
>>> Subscription information may be found at:
>>> http://www.groupstudy.com/list/CCIELab.html
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
-- Victor Cappuccio CCIE R/S# 20657 CCSI# 30452 www.anetworkerblog.comBlogs and organic groups at http://www.ccie.net
This archive was generated by hypermail 2.1.4 : Sat Nov 01 2008 - 15:35:22 ARST