-
Notifications
You must be signed in to change notification settings - Fork 4
/
cisco-prefix.tt2
49 lines (46 loc) · 1.51 KB
/
cisco-prefix.tt2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
! lists !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[% FOREACH ip = conf.keys.sort %]
[% neigh = conf.$ip %]
[% FOREACH afi = [ 'ipv4', 'ipv6', 'ipv4m', 'ipv6m' ] %]
[% NEXT IF NOT neigh.$afi.import_as.size %]
no ip as-path access-list [% neigh.$afi.aslistnum +%]
[% aslist = neigh.$afi.import_as.nsort %]
[% IF aslist.size > 35 %]
[% WHILE aslist.size; l = aslist.splice(0, 35) %]
ip as-path access-list [% neigh.$afi.aslistnum %] permit _([% l.join('|') %])$
[% END %]
[% ELSE %]
ip as-path access-list [% neigh.$afi.aslistnum %] permit ^(_([% aslist.join('|') %]))+$
[% END %]
!
[% END %]
[% END %]
[% FOREACH ip = conf.keys.sort %]
[% neigh = conf.$ip %]
[% FOREACH afi = [ 'ipv4', 'ipv6', 'ipv4m', 'ipv6m' ] %]
[% IF afi == 'ipv6';
acltype = 'ipv6'; aclname = 'AS' _ neigh.as _ '-IN6';
ELSIF afi == 'ipv6m';
acltype = 'ipv6'; aclname = 'AS' _ neigh.as _ '-IN6M';
ELSIF afi == 'ipv4m';
acltype = 'ip'; aclname = 'AS' _ neigh.as _ '-INM';
ELSE;
acltype = 'ip'; aclname = 'AS' _ neigh.as _ '-IN';
END;
%]
[% NEXT IF NOT neigh.$afi.import_routes.size %]
no [% acltype %] prefix-list [% aclname +%]
[% FOREACH route = neigh.$afi.import_routes %]
[% acltype %] prefix-list [% aclname %] permit [% route.route2cisco +%]
[% END %]
!
[% IF neigh.customer %]
no [% acltype %] prefix-list [% aclname +%]-HR
[% FOREACH route = neigh.$afi.import_routes.hostroutes %]
[% acltype %] prefix-list [% aclname %]-HR permit [% route.route2cisco +%]
[% END %]
!
[% END %]
[% END %]
[% END %]
end