diff options
Diffstat (limited to 'routers/bird.php')
-rw-r--r-- | routers/bird.php | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/routers/bird.php b/routers/bird.php index 55f7ff9..16703c8 100644 --- a/routers/bird.php +++ b/routers/bird.php @@ -29,13 +29,9 @@ final class Bird extends Router { switch ($command) { case 'bgp': if (match_ipv4($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route for '.$parameters; - $commands[] = 'exit'; + $commands[] = 'birdc show route for '.$parameters; } else if (match_ipv6($parameters)) { - $commands[] = 'birdc6'; - $commands[] = 'show route for '.$parameters; - $commands[] = 'exit'; + $commands[] = 'birdc6 show route for '.$parameters; } else { throw new Exception('The parameter is not an IPv4/IPv6 address.'); } @@ -43,12 +39,8 @@ final class Bird extends Router { case 'as-path-regex': if (match_aspath_regex($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; - $commands[] = 'birdc6'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; + $commands[] = 'birdc show route where bgp_path ~ [= '.$parameters.' =]'; + $commands[] = 'birdc6 show route where bgp_path ~ [= '.$parameters.' =]'; } else { throw new Exception('The parameter is not an AS-Path regular expression like ".*XXXX YYYY.*".'); } @@ -56,12 +48,8 @@ final class Bird extends Router { case 'as': if (match_as($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; - $commands[] = 'birdc6'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; + $commands[] = 'birdc show route where bgp_path ~ [= '.$parameters.' =]'; + $commands[] = 'birdc6 show route where bgp_path ~ [= '.$parameters.' =]'; } else { throw new Exception('The parameter is not an AS number.'); } |