summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--execute.php6
-rw-r--r--index.php8
-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
7 files changed, 60 insertions, 60 deletions
diff --git a/execute.php b/execute.php
index a1da942..6a20778 100644
--- a/execute.php
+++ b/execute.php
@@ -44,16 +44,16 @@ if (isset($_POST['doc']) && !empty($_POST['doc'])) {
if (isset($_POST['query']) && !empty($_POST['query']) &&
isset($_POST['routers']) && !empty($_POST['routers']) &&
- isset($_POST['parameters']) && !empty($_POST['parameters'])) {
+ isset($_POST['parameter']) && !empty($_POST['parameter'])) {
$query = trim($_POST['query']);
$hostname = trim($_POST['routers']);
- $parameters = trim($_POST['parameters']);
+ $parameter = trim($_POST['parameter']);
// Do the processing
$router = Router::instance($hostname, $requester);
try {
- $output = $router->send_command($query, $parameters);
+ $output = $router->send_command($query, $parameter);
} catch (Exception $e) {
$error = $e->getMessage();
}
diff --git a/index.php b/index.php
index fcbcc1a..eb82931 100644
--- a/index.php
+++ b/index.php
@@ -71,11 +71,11 @@ final class LookingGlass {
print('</div>');
}
- private function render_parameters() {
+ private function render_parameter() {
print('<div class="form-group">');
print('<label for="input-param">Parameter</label>');
print('<div class="input-group">');
- print('<input class="form-control" name="parameters" id="input-param" autofocus />');
+ print('<input class="form-control" name="parameter" id="input-param" autofocus />');
print('<div class="input-group-btn">');
print('<button type="button" class="btn btn-info" data-toggle="modal" data-target="#help">');
print('<span class="glyphicon glyphicon-question-sign"></span> Help');
@@ -131,8 +131,8 @@ final class LookingGlass {
$this->render_commands();
break;
- case 'parameters':
- $this->render_parameters();
+ case 'parameter':
+ $this->render_parameter();
break;
case 'buttons':
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;
}