Permalink
Browse files

BGP Large Communities Support

  • Loading branch information...
barryo committed Jun 8, 2017
1 parent c4fc8e3 commit f04725673911e51cf0b86fbc6a70c221322b5afc
Showing with 52 additions and 3 deletions.
  1. +10 −1 app/Bird/Parser/Routes.php
  2. +14 −0 data/bird-lab/ipv4/rs.conf
  3. +11 −1 resources/views/lg/route.blade.php
  4. +16 −0 resources/views/lg/routes.blade.php
  5. +1 −1 version.php
View
@@ -13,7 +13,6 @@ public function __contrust( $data ) {
}
public function parse() {
$routes = [];
$r = [];
$matches = [];
@@ -104,6 +103,16 @@ public function parse() {
}
}
}
else if( preg_match( "/^\s+BGP.large_community:\s+(.+)\s*$/", $line, $matches ) ) {
// BGP.large_community: (999, 1, 111)
// BGP.large_community: (999, 1, 111) (999, 156, 111) (999, 157, 111)
$m = substr( trim( $matches[1] ), 1, -1 );
foreach( explode( ') (', $m ) as $community ) {
if( preg_match( "/^(\d+),\s*(\d+),\s*(\d+)/", trim( $community ), $matches ) ) {
$r['bgp']['large_communities'][] = [ intval( $matches[1] ), intval( $matches[2] ), intval( $matches[3] ) ];
}
}
}
}
// catche the last one:
View
@@ -31,6 +31,20 @@ protocol bgp R111x1 from PEERS {
source address 192.0.2.100;
neighbor 192.0.2.111 as 111;
table t_R111x1;
import filter {
if ! ( net ~ 172.19.1.0/24 ) then {
bgp_community.add((999,111));
bgp_large_community.add((999,1,111));
}
if ( net ~ 172.17.1.0/24 ) then {
bgp_large_community.add((999,156,111));
bgp_large_community.add((999,157,111));
}
accept;
};
}
### AS222 - Member1
@@ -98,7 +98,17 @@
<td><strong>BGP :: Communities</strong></td>
<td>
@foreach( $r->bgp->communities as $c )
({{implode(',',$c)}})
({{implode(', ',$c)}})
@endforeach
</td>
</tr>
@endif
@if (isset( $r->bgp->large_communities ))
<tr>
<td><strong>BGP :: Large Communities</strong></td>
<td>
@foreach( $r->bgp->large_communities as $c )
({{implode(', ',$c)}})
@endforeach
</td>
</tr>
@@ -13,6 +13,7 @@
<th>Next Hop</th>
<th></th>
<th>Metric</th>
<th>Communities?</th>
<th>AS Path</th>
<th></th>
</tr>
@@ -39,6 +40,21 @@
@endif
</td>
<td>{{$r->metric}}</td>
<td>
<span class="badge">
@if( isset( $r->bgp->communities ) )
{{ count( $r->bgp->communities ) }}
@else
0
@endif
</span>
@if( isset( $r->bgp->large_communities ) )
<span class="badge">LC:
{{ count( $r->bgp->large_communities ) }}
</span>
@endif
</td>
<td>
@if( isset($r->bgp->as_path) )
{{implode(' ', $r->bgp->as_path)}}
View
@@ -1,3 +1,3 @@
<?php
$_ENV['BIRDSEYE_API_VERSION'] = '1.0.5';
$_ENV['BIRDSEYE_API_VERSION'] = '1.1.0';

0 comments on commit f047256

Please sign in to comment.