public function index()
 {
     $mikrotik = new Nas();
     $routerMk = $mikrotik->getNasSession(Session::get('id'));
     $nas = $routerMk->identity;
     $ip = $routerMk->address;
     $user = $routerMk->user;
     $pass = $routerMk->password;
     $port = $routerMk->port;
     try {
         $util = new RouterOS\Util($client = new RouterOS\Client($ip, $user, $pass, $port));
     } catch (Exception $e) {
         die($e);
     }
     $recursos = $util->setMenu('/system resource');
     $this->free_mem = $recursos->get(NULL, 'free-memory');
     $this->free_hdd = $recursos->get(NULL, 'free-hdd-space');
     $this->cpu = $recursos->get(NULL, 'cpu-load');
     $salud = $util->setMenu('/system health');
     $this->therm = $salud->get(NULL, 'temperature');
     $this->activos = $util->setMenu('/ppp active');
 }
 public function listar()
 {
     $mikrotik = new Nas();
     $routerMk = $mikrotik->getNasSession(Session::get('id'));
     $nas = $routerMk->identity;
     $ip = $routerMk->address;
     $user = $routerMk->user;
     $pass = $routerMk->password;
     $port = $routerMk->port;
     try {
         $util = new RouterOS\Util($client = new RouterOS\Client($ip, $user, $pass, $port));
     } catch (Exception $e) {
         die($e);
     }
     $this->lista = $util->setMenu('/tool user-manager user');
 }
 public function testMove()
 {
     $this->util->setMenu('/queue/simple');
     $id = $this->util->add(array('name' => TEST_QUEUE_NAME));
     $result = $this->util->move($id, 0);
     $this->util->remove($id);
     $this->assertCount(1, $result);
     $idList = $this->util->add(array('name' => TEST_QUEUE_NAME), array('name' => TEST_QUEUE_NAME1));
     $result = $this->util->move($idList, 0);
     $this->util->remove($idList);
     $this->assertCount(1, $result);
     $id = $this->util->add(array('name' => TEST_QUEUE_NAME));
     $result = $this->util->move($id, '0,1');
     $this->util->remove($id);
     $this->assertCount(1, $result);
     $idList = $this->util->add(array('name' => TEST_QUEUE_NAME), array('name' => TEST_QUEUE_NAME1));
     $result = $this->util->move($idList, '0,1');
     $this->util->remove($idList);
     $this->assertCount(1, $result);
 }
Exemple #4
0
 public function testInvalidGetallAndCount()
 {
     $this->util->setMenu('/queue');
     $this->assertFalse($this->util->getAll());
     $this->assertCount(-1, $this->util);
 }