Skip to content
Permalink
Browse files

Add Arista reference in documentation

  • Loading branch information
respawner committed Nov 25, 2019
1 parent 6f2428e commit 0888ef8242ab120fd980f08e1e0f743409d9caca
Showing with 100 additions and 106 deletions.
  1. +3 −2 README.md
  2. +4 −3 docs/configuration.md
  3. +93 −101 routers/arista.php
@@ -22,16 +22,17 @@ For now this looking glass is quite simple. Here you have some features:

* Interface using Javascript and AJAX calls (needs a decent browser)
* Support the following router types:
* Juniper
* Arista
* BIRD
* Cisco (IOS and IOS-XR)
* Extreme/Brocade NetIron
* FRRouting
* Juniper
* Mikrotik/RouterOS
* Nokia
* OpenBGPd
* Quagga
* Vyatta/VyOS/EdgeOS
* FRRouting
* Support of Telnet and SSH connection to routers using password
authentication and SSH keys
* Configurable list of routers
@@ -125,14 +125,15 @@ interact with it.
```php
$config['routers']['router1']['type'] = 'juniper';
```
The router type can be Juniper, Cisco (IOS or IOS-XR), Extreme (NetIron), Quagga,
BIRD, OpenBGPd, Vyatta/VyOS/EdgeOS, or FRRouting. You can take a look at the specific
documentation for your router.
The router type can be Juniper, Cisco (IOS or IOS-XR), Arista,
Extreme (NetIron), Quagga, BIRD, OpenBGPd, Vyatta/VyOS/EdgeOS, or FRRouting.
You can take a look at the specific documentation for your router.
Possible values are:

* juniper **or** junos
* cisco **or** ios
* ios-xr **or** iosxr
* arista
* mikrotik **or** routeros
* nokia
* extreme_netiron
@@ -19,122 +19,114 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'router.php';
require_once 'includes/command_builder.php';
require_once 'includes/utils.php';
final class Arista extends Router
{
protected function build_bgp($parameter): array
{
$cmd = new CommandBuilder();
$cmd->add('show');
if (match_ipv6($parameter, false)) {
$cmd->add('ipv6 bgp', $parameter);
}
if (match_ipv4($parameter, false)) {
$cmd->add('ip bgp', $parameter);
}
if ($this->config['bgp_detail']) {
$cmd->add('detail');
}
return array($cmd);
require_once('router.php');
require_once('includes/command_builder.php');
require_once('includes/utils.php');
final class Arista extends Router {
protected function build_bgp($parameter): array {
$cmd = new CommandBuilder();
$cmd->add('show');
if (match_ipv6($parameter, false)) {
$cmd->add('ipv6 bgp', $parameter);
}
if (match_ipv4($parameter, false)) {
$cmd->add('ip bgp', $parameter);
}
if ($this->config['bgp_detail']) {
$cmd->add('detail');
}
return array($cmd);
}
protected function build_aspath_regexp($parameter): array {
$commands = array();
$cmd = new CommandBuilder();
$cmd->add('show');
if (!$this->config['disable_ipv6']) {
$cmd6 = clone $cmd;
$cmd6->add('ipv6 bgp regex', $parameter);
$commands[] = $cmd6;
}
protected function build_aspath_regexp($parameter): array
{
//$parameter = quote($parameter);
$commands = array();
$cmd = new CommandBuilder();
$cmd->add('show');
if (!$this->config['disable_ipv6']) {
$cmd6 = clone $cmd;
$cmd6->add('ipv6 bgp regex', $parameter);
$commands[] = $cmd6;
}
if (!$this->config['disable_ipv4']) {
$cmd4 = clone $cmd;
$cmd4->add('ip bgp regex', $parameter);
$commands[] = $cmd4;
}
return $commands;
if (!$this->config['disable_ipv4']) {
$cmd4 = clone $cmd;
$cmd4->add('ip bgp regex', $parameter);
$commands[] = $cmd4;
}
protected function build_as($parameter): array
{
$parameter = '^' . $parameter . '_';
return $commands;
}
return $this->build_aspath_regexp($parameter);
protected function build_as($parameter): array {
$parameter = '^' . $parameter . '_';
return $this->build_aspath_regexp($parameter);
}
protected function build_ping($parameter): array {
if (!is_valid_destination($parameter)) {
throw new Exception('The parameter is not an IP address or a hostname.');
}
protected function build_ping($parameter): array
{
if (!is_valid_destination($parameter)) {
throw new Exception('The parameter is not an IP address or a hostname.');
}
$cmd = new CommandBuilder();
$cmd->add('ping');
$cmd = new CommandBuilder();
$cmd->add('ping');
if (!$this->config['disable_ipv6']) {
$commands[] = (clone $cmd)->add('ipv6', $parameter);
}
if (!$this->config['disable_ipv6']) {
$commands[] = (clone $cmd)->add('ipv6', $parameter);
}
if (!$this->config['disable_ipv4']) {
$commands[] = (clone $cmd)->add('ip', $parameter);
}
if (!$this->config['disable_ipv4']) {
$commands[] = (clone $cmd)->add('ip', $parameter);
}
if ($this->has_source_interface_id()) {
$cmd->add('source', $this->get_source_interface_id());
}
if ($this->has_source_interface_id()) {
$cmd->add('source', $this->get_source_interface_id());
}
$cmd->add('repeat 10');
$cmd->add('repeat 10');
return array($cmd);
}
return array($cmd);
protected function build_traceroute($parameter): array {
if (!is_valid_destination($parameter)) {
throw new Exception('The parameter is not an IP address or a hostname.');
}
protected function build_traceroute($parameter): array
{
if (!is_valid_destination($parameter)) {
throw new Exception('The parameter is not an IP address or a hostname.');
}
$cmd = new CommandBuilder();
$cmd->add('traceroute');
if (match_ipv6($parameter) || match_ipv4($parameter) ||
!$this->has_source_interface_id()) {
$cmd->add($parameter);
} else {
// Resolve the hostname and go for right IP version
$hostname = $parameter;
$parameter = hostname_to_ip_address($hostname);
if (!$parameter) {
throw new Exception('No record found for ' . $hostname);
}
if (match_ipv6($parameter)) {
$cmd->add('ipv6', $hostname ?? $parameter);
}
if (match_ipv4($parameter)) {
$cmd->add('ip', $hostname ?? $parameter);
}
}
// Make sure to use the right source interface
if ($this->has_source_interface_id() && !match_ipv6($parameter)) {
$cmd->add('source', $this->get_source_interface_id());
}
return array($cmd);
$cmd = new CommandBuilder();
$cmd->add('traceroute');
if (match_ipv6($parameter) || match_ipv4($parameter) ||
!$this->has_source_interface_id()) {
$cmd->add($parameter);
} else {
// Resolve the hostname and go for right IP version
$hostname = $parameter;
$parameter = hostname_to_ip_address($hostname);
if (!$parameter) {
throw new Exception('No record found for ' . $hostname);
}
if (match_ipv6($parameter)) {
$cmd->add('ipv6', $hostname ?? $parameter);
}
if (match_ipv4($parameter)) {
$cmd->add('ip', $hostname ?? $parameter);
}
}
// Make sure to use the right source interface
if ($this->has_source_interface_id() && !match_ipv6($parameter)) {
$cmd->add('source', $this->get_source_interface_id());
}
return array($cmd);
}
}
// End of Arista.php
// End of arista.php

0 comments on commit 0888ef8

Please sign in to comment.
You can’t perform that action at this time.