summaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/bird.php26
-rw-r--r--routers/cisco.php26
-rw-r--r--routers/juniper.php24
-rw-r--r--routers/quagga.php24
-rw-r--r--routers/router.php6
5 files changed, 53 insertions, 53 deletions
diff --git a/routers/bird.php b/routers/bird.php
index bc0a851..9fa2d15 100644
--- a/routers/bird.php
+++ b/routers/bird.php
@@ -91,7 +91,7 @@ final class Bird extends Router {
return $traceroute;
}
- protected function build_commands($command, $parameters) {
+ protected function build_commands($command, $parameter) {
$commands = array();
$birdc = 'birdc';
@@ -99,32 +99,32 @@ final class Bird extends Router {
switch ($command) {
case 'bgp':
- if (match_ipv4($parameters, false)) {
- $commands[] = $birdc.' \'show route for '.$parameters.'\'';
- } else if (match_ipv6($parameters, false)) {
- $commands[] = $birdc6.' \'show route for '.$parameters.'\'';
+ if (match_ipv4($parameter, false)) {
+ $commands[] = $birdc.' \'show route for '.$parameter.'\'';
+ } else if (match_ipv6($parameter, false)) {
+ $commands[] = $birdc6.' \'show route for '.$parameter.'\'';
} else {
throw new Exception('The parameter is not an IPv4/IPv6 address.');
}
break;
case 'as-path-regex':
- if (match_aspath_regex($parameters)) {
+ if (match_aspath_regex($parameter)) {
$commands[] = $birdc.' \'show route where bgp_path ~ [= '.
- $parameters.' =]\'';
+ $parameter.' =]\'';
$commands[] = $birdc6.' \'show route where bgp_path ~ [= '.
- $parameters.' =]\'';
+ $parameter.' =]\'';
} else {
throw new Exception('The parameter is not an AS-Path regular expression.');
}
break;
case 'as':
- if (match_as($parameters)) {
+ if (match_as($parameter)) {
$commands[] = $birdc.' \'show route where bgp_path ~ [= '.
- $parameters.' =]\'';
+ $parameter.' =]\'';
$commands[] = $birdc6.' \'show route where bgp_path ~ [= '.
- $parameters.' =]\'';
+ $parameter.' =]\'';
} else {
throw new Exception('The parameter is not an AS number.');
}
@@ -132,7 +132,7 @@ final class Bird extends Router {
case 'ping':
try {
- $commands[] = $this->build_ping($parameters);
+ $commands[] = $this->build_ping($parameter);
} catch (Exception $e) {
throw $e;
}
@@ -140,7 +140,7 @@ final class Bird extends Router {
case 'traceroute':
try {
- $commands[] = $this->build_traceroute($parameters);
+ $commands[] = $this->build_traceroute($parameter);
} catch (Exception $e) {
throw $e;
}
diff --git a/routers/cisco.php b/routers/cisco.php
index 4d94a62..7444136 100644
--- a/routers/cisco.php
+++ b/routers/cisco.php
@@ -73,33 +73,33 @@ final class Cisco extends Router {
return $traceroute;
}
- protected function build_commands($command, $parameters) {
+ protected function build_commands($command, $parameter) {
$commands = array();
switch ($command) {
case 'bgp':
- if (match_ipv4($parameters, false)) {
- $commands[] = 'show bgp ipv4 unicast '.$parameters;
- } else if (match_ipv6($parameters, false)) {
- $commands[] = 'show bgp ipv6 unicast '.$parameters;
+ if (match_ipv4($parameter, false)) {
+ $commands[] = 'show bgp ipv4 unicast '.$parameter;
+ } else if (match_ipv6($parameter, false)) {
+ $commands[] = 'show bgp ipv6 unicast '.$parameter;
} else {
throw new Exception('The parameter is not an IPv4/IPv6 address.');
}
break;
case 'as-path-regex':
- if (match_aspath_regex($parameters)) {
- $commands[] = 'show bgp ipv4 unicast quote-regexp "'.$parameters.'"';
- $commands[] = 'show bgp ipv6 unicast quote-regexp "'.$parameters.'"';
+ if (match_aspath_regex($parameter)) {
+ $commands[] = 'show bgp ipv4 unicast quote-regexp "'.$parameter.'"';
+ $commands[] = 'show bgp ipv6 unicast quote-regexp "'.$parameter.'"';
} else {
throw new Exception('The parameter is not an AS-Path regular expression.');
}
break;
case 'as':
- if (match_as($parameters)) {
- $commands[] = 'show bgp ipv4 unicast quote-regexp "^'.$parameters.'_"';
- $commands[] = 'show bgp ipv6 unicast quote-regexp "^'.$parameters.'_"';
+ if (match_as($parameter)) {
+ $commands[] = 'show bgp ipv4 unicast quote-regexp "^'.$parameter.'_"';
+ $commands[] = 'show bgp ipv6 unicast quote-regexp "^'.$parameter.'_"';
} else {
throw new Exception('The parameter is not an AS number.');
}
@@ -107,7 +107,7 @@ final class Cisco extends Router {
case 'ping':
try {
- $commands[] = $this->build_ping($parameters);
+ $commands[] = $this->build_ping($parameter);
} catch (Exception $e) {
throw $e;
}
@@ -115,7 +115,7 @@ final class Cisco extends Router {
case 'traceroute':
try {
- $commands[] = $this->build_traceroute($parameters);
+ $commands[] = $this->build_traceroute($parameter);
} catch (Exception $e) {
throw $e;
}
diff --git a/routers/juniper.php b/routers/juniper.php
index 88ea182..a5b4d2d 100644
--- a/routers/juniper.php
+++ b/routers/juniper.php
@@ -58,16 +58,16 @@ final class Juniper extends Router {
return $traceroute;
}
- protected function build_commands($command, $parameters) {
+ protected function build_commands($command, $parameter) {
$commands = array();
switch ($command) {
case 'bgp':
- if (match_ipv4($parameters, false)) {
- $commands[] = 'show route '.$parameters.
+ if (match_ipv4($parameter, false)) {
+ $commands[] = 'show route '.$parameter.
' protocol bgp table inet.0 active-path';
} else if (match_ipv6($parameters, false)) {
- $commands[] = 'show route '.$parameters.
+ $commands[] = 'show route '.$parameter.
' protocol bgp table inet6.0 active-path';
} else {
throw new Exception('The parameter is not an IPv4/IPv6 address.');
@@ -75,10 +75,10 @@ final class Juniper extends Router {
break;
case 'as-path-regex':
- if (match_aspath_regex($parameters)) {
- $commands[] = 'show route aspath-regex "'.$parameters.
+ if (match_aspath_regex($parameter)) {
+ $commands[] = 'show route aspath-regex "'.$parameter.
'" protocol bgp table inet.0';
- $commands[] = 'show route aspath-regex "'.$parameters.
+ $commands[] = 'show route aspath-regex "'.$parameter.
'" protocol bgp table inet6.0';
} else {
throw new Exception('The parameter is not an AS-Path regular expression.');
@@ -86,10 +86,10 @@ final class Juniper extends Router {
break;
case 'as':
- if (match_as($parameters)) {
- $commands[] = 'show route aspath-regex "^'.$parameters.
+ if (match_as($parameter)) {
+ $commands[] = 'show route aspath-regex "^'.$parameter.
' .*" protocol bgp table inet.0';
- $commands[] = 'show route aspath-regex "^'.$parameters.
+ $commands[] = 'show route aspath-regex "^'.$parameter.
' .*" protocol bgp table inet6.0';
} else {
throw new Exception('The parameter is not an AS number.');
@@ -98,7 +98,7 @@ final class Juniper extends Router {
case 'ping':
try {
- $commands[] = $this->build_ping($parameters);
+ $commands[] = $this->build_ping($parameter);
} catch (Exception $e) {
throw $e;
}
@@ -106,7 +106,7 @@ final class Juniper extends Router {
case 'traceroute':
try {
- $commands[] = $this->build_traceroute($parameters);
+ $commands[] = $this->build_traceroute($parameter);
} catch (Exception $e) {
throw $e;
}
diff --git a/routers/quagga.php b/routers/quagga.php
index 16f5d9c..1c88c33 100644
--- a/routers/quagga.php
+++ b/routers/quagga.php
@@ -91,35 +91,35 @@ final class Quagga extends Router {
return $traceroute;
}
- protected function build_commands($command, $parameters) {
+ protected function build_commands($command, $parameter) {
$commands = array();
$vtysh = 'vtysh -c "';
switch ($command) {
case 'bgp':
- if (match_ipv4($parameters, false)) {
- $commands[] = $vtysh.'show bgp ipv4 unicast '.$parameters.'"';
+ if (match_ipv4($parameter, false)) {
+ $commands[] = $vtysh.'show bgp ipv4 unicast '.$parameter.'"';
} else if (match_ipv6($parameters, false)) {
- $commands[] = $vtysh.'show bgp ipv6 unicast '.$parameters.'"';
+ $commands[] = $vtysh.'show bgp ipv6 unicast '.$parameter.'"';
} else {
throw new Exception('The parameter is not an IPv4/IPv6 address.');
}
break;
case 'as-path-regex':
- if (match_aspath_regex($parameters)) {
- $commands[] = $vtysh.'show ip bgp regexp '.$parameters.'"';
- $commands[] = $vtysh.'show ipv6 bgp regexp '.$parameters.'"';
+ if (match_aspath_regex($parameter)) {
+ $commands[] = $vtysh.'show ip bgp regexp '.$parameter.'"';
+ $commands[] = $vtysh.'show ipv6 bgp regexp '.$parameter.'"';
} else {
throw new Exception('The parameter is not an AS-Path regular expression.');
}
break;
case 'as':
- if (match_as($parameters)) {
- $commands[] = $vtysh.'show ip bgp regexp ^'.$parameters.'_'.'"';
- $commands[] = $vtysh.'show ipv6 bgp regexp ^'.$parameters.'_'.'"';
+ if (match_as($parameter)) {
+ $commands[] = $vtysh.'show ip bgp regexp ^'.$parameter.'_'.'"';
+ $commands[] = $vtysh.'show ipv6 bgp regexp ^'.$parameter.'_'.'"';
} else {
throw new Exception('The parameter is not an AS number.');
}
@@ -127,7 +127,7 @@ final class Quagga extends Router {
case 'ping':
try {
- $commands[] = $this->build_ping($parameters);
+ $commands[] = $this->build_ping($parameter);
} catch (Exception $e) {
throw $e;
}
@@ -135,7 +135,7 @@ final class Quagga extends Router {
case 'traceroute':
try {
- $commands[] = $this->build_traceroute($parameters);
+ $commands[] = $this->build_traceroute($parameter);
} catch (Exception $e) {
throw $e;
}
diff --git a/routers/router.php b/routers/router.php
index 6753f94..984de2d 100644
--- a/routers/router.php
+++ b/routers/router.php
@@ -110,11 +110,11 @@ abstract class Router {
protected abstract function build_traceroute($destination);
- protected abstract function build_commands($command, $parameters);
+ protected abstract function build_commands($command, $parameter);
- public function send_command($command, $parameters) {
+ public function send_command($command, $parameter) {
try {
- $commands = $this->build_commands($command, $parameters);
+ $commands = $this->build_commands($command, $parameter);
} catch (Exception $e) {
throw $e;
}