2

Hi I am trying to match routing instances with names other then VPLS-* basically any name that starts with V* but is not VPLS-*

I tried multiple different iterations of below but it seems to ignore all name that start with V*

set groups ALLOW_MARTIAN_192 routing-instances <"![VPLS-*], V*"> routing-options martians 192.0.0.0/24 orlonger allow

any help?

  • basically, I want to match all names that first character is V and anything afterwards but is not VPLS-* – Suchal Sep 10 at 17:22
2

I don't think this is possible within the confines of the Junos apply-group regex:

In order to use the ! operator to negate a match, you have to specify a character class in square brackets [], however putting a string like VPLS- into a character class, each character seems to be treated as a logical OR eg: V or P or L or S or -, which means anything containing a V as the first character will be matched and excluded.

Weirdly though this isn't entirely consistent - re-arranging the letters in VPLS gives different results eg: PVLS- doesn't match, but SLPV- does - I don't understand why:

groups {
    RI-DESCRIPTION {
        routing-instances {
            "<[!VPLS-*]*>" {
                description "This is from an apply-group";
            }
        }
    }
}

root# show routing-instances | display inheritance no-comments
DIFFERENT-VR {
    description "This is from an apply-group";
    instance-type virtual-router;
}
PVLS-2 {
    instance-type virtual-router;
}
RV-1 {
    description "This is from an apply-group";
    instance-type virtual-router;
}
SLPV-1 {
    description "This is from an apply-group";
    instance-type virtual-router;
}
VPLS-1 {
    instance-type vpls;
}
VPLS-2 {
    instance-type vpls;
}
VREF-2 {
    instance-type virtual-router;
}

One solution might be to use set routing-instance VPLS-xxx apply-groups-except ALLOW_MARTIAN_192 under each VPLS instance - unfortunately you'd have to do this manually, as you can't use apply-groups-except within a groups configuration matching on <VPLS-*>.

  • Can you try this one: ^(!VPLS-|!V)* ? – Andrey Prokhorov Sep 11 at 11:48
  • No luck @AndreyProkhorov - I don't think that's a valid regex for groups - it didn't apply that description to any of the routing-instances I have defined above – Benjamin Dale Sep 11 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.