diff options
author | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-20 15:41:15 +0200 |
---|---|---|
committer | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-20 15:41:15 +0200 |
commit | 9dcde5b501552b63314ca2b142ff2b849c4a023d (patch) | |
tree | 50d586c23b55ce66fe610704778be03460835f85 /routers/router.php | |
parent | 8bab0d8735603683ea7ba18a2248257368ece16f (diff) |
Basic support for BIRD based routers.
Diffstat (limited to 'routers/router.php')
-rw-r--r-- | routers/router.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/routers/router.php b/routers/router.php index 1c8441a..b47d2d3 100644 --- a/routers/router.php +++ b/routers/router.php @@ -20,6 +20,7 @@ */ require_once 'config.php'; +require_once 'bird.php'; require_once 'cisco.php'; require_once 'juniper.php'; require_once 'utils.php'; @@ -53,16 +54,13 @@ abstract class Router { foreach ($commands as $selected) { $data .= $auth->send_command($selected); - } - } catch (Exception $e) { - throw $e; - } finally { - $auth->disconnect(); - - foreach ($commands as $selected) { log_to_file('[client: '.$this->requester.'] '.$this->config['host']. '> '.$selected); } + + $auth->disconnect(); + } catch (Exception $e) { + throw $e; } return $data; @@ -73,7 +71,10 @@ abstract class Router { $router_config = $config['routers'][$id]; - switch ($router_config['type']) { + switch (strtolower($router_config['type'])) { + case 'bird': + return new Bird($router_config, $id, $requester); + case 'cisco': case 'ios': return new Cisco($router_config, $id, $requester); |