Description

This article describes the issue of the NOT (!) operator not working in the as-path Regular Expression (regex).

Symptoms

As per the documentation, the NOT ( ! ) logical operator can be used with the as-path regular expression.

For example, when it is attempted to block the routes, which do not originate from a particular AS (for example: 65000), all the others use the ! operator. As per documentation, the as-path exp should be:

> as-path cus-1 "!(.* 65000)"
Applying this to a policy:
t erm 1 {
     from as-path cus-1;
     then {
         reject;
     }
}

This will not work.

Solution

 

This is a documentation mistake and as of now Junos does not support the NOT operator in the as-path regular expression. The only way to achieve this is to create a policy that matches the 65000 AS, accept them in term 1, and reject all other in term 2.