Yii 1.1: routeros

Mikrotik Router OS
4 followers

Mikrotik Router OS

Requirements :

  • Yii 1.1.xx
  • PHP 5.0.XX
  • Mikrotik 3.XX , 4.XX

Documentation :

For more complete documentation : http://doc.vthink.web.id/yii/index.html

For Update Impormation

http://vthink.web.id/index.php/content/categories/21

Download :

Download extension MikroTik RouterOS Mikrotik_OS.tar.bz2 and extract in to /protected/extensions: http://www.yiiframework.com/extension/routeros/files/Mikrotik_OS.tar.bz2

Config example:

configuration file located in protected/config/main.php

'params'=>array(        
    'email'    => 'vthinkteam@gmail.com',
    'Mikrotik' => array(
                    'address'  => '192.168.88.1',
                    'port'     => '8728',
                    'username' => 'admin',
                    'password' => 'admin',
    ),
),
  • address: Hostname or IP Address of your Mikrotik RouterOS
  • port: Port of your Mikrotik RouterOS Service API
  • username: Username of your Mikrotik RouterOS
  • password: Password of your Mikrotik RouterOS

Autoloading model and component classes

'import'=>array(
    'application.models.*',
    'application.components.*',
    'application.extensions.routeros.*',
)

Quickstart :

The following classes exist in the MikroTik RouterOS

  • Interface Class
  • IP Class
  • PPP Class
  • System Class
  • File Class
  • And for third party development

Interface Class

This Extensions has a Interface Class that can access other class for specific interact with Mikrotik RouterOS Interface. The other classes are Interface Bonding, Interface EOIP, Interface Ethernet, Interface IPIP, Interface PPPOE Client, Interface PPPOE Server, Interface VLAN, and Interface VRRP. Each class can be invoked through the interface classes with method in Mikrotik Api main classes.

Mrs::interfaces();
  • Interface Bonding
  • Interface Bridge
  • Interface EOIP
  • Interface Ethernet
  • Interface IPIP
  • Interface L2TP Client
  • Interface L2TP Server
  • Interface PPP Client
  • Interface PPP Server
  • Interface PPPOE Client
  • Interface PPPOE Server
  • Interface PPTP Client
  • Interface PPTP Server
  • Interface VLAN
  • Interface VRRP

IP Class

This Extension has a Interface Class that can access other class for specific interact with Mikrotik RouterOS Interface. The other classes are IP Accounting, IP Address, IP ARP, IP DHCP-Client, IP DHCP-Relay, IP DHCP-Server, IP DNS, IP Firewall, IP Hotspot, IP Pool, IP Route, and IP Service. Each class can be invoked through the interface classes with method in mikrotik_api main classes.

Mrs::ip();
  • IP Accounting
  • IP Address
  • IP ARP
  • IP DHCP-Client
  • IP DHCP-Relay
  • IP DHCP-Server
  • IP DNS
  • IP Firewall
  • IP Hotspot
  • IP Pool
  • IP Proxy
  • IP Route
  • IP Service

PPP Class

This Extension has a Interface Class that can access other class for specific interact with Mikrotik RouterOS Interface. The other classes are ppp aaa, ppp active, ppp profile, and ppp secret. Each class can be invoked through the interface classes with method in mikrotik_api main classes.

Mrs::ppp();
  • PPP AAA
  • PPP Active
  • PPP Profile
  • PPP Secret

System Class

This Extension has a Interface Class that can access other class for specific interact with Mikrotik RouterOS Interface. The other classes are ppp aaa, ppp active, ppp profile, and ppp secret. Each class can be invoked through the interface classes with method in mikrotik_api main classes.

Mrs::system();

File Class

This Extensions has a File Class that can interact with Mikrotik RouterOS File.

Mrs::file();

For development

we provide for the development of one class, for third party development.

Mrs::talker();

EX Code :

public function getAll(){
        $talk = Mrs::talker();
//      $talk->setDebug(TRUE);
        $sentence = new SentenceUtil();
        $sentence->fromCommand("/ip/address/getall");
        $talk->send($sentence);
        $rs = $talk->getResult();
        while ($rs->next()){
            echo $rs->getResult("interface")."\t|\t";
            echo $rs->getResult("address")."\t|\t";
            echo $rs->getResult("network")."\t|\t";
            echo $rs->getResult("broadcast")."\t|\t";
            echo "<br>";
        }
    }

The output will be like this

ether1  | 172.100.10.10/24 | 172.100.10.0 | 172.100.10.255 |    
ether2  | 172.110.0.100/24 | 172.110.0.0  | 172.110.0.255  |    
ether3  | 172.30.0.100/24  | 172.30.0.0   | 172.30.0.255   |    
ether4  | 192.168.88.1/24  | 192.168.88.0 | 192.168.88.255 |    
ether5  | 192.168.10.1/24  | 192.168.10.0 | 192.168.10.255 |

Total 5 comments

#15377 report it
melengo at 2013/11/03 07:55am
YiiRouterOS Documentation

Download From this link YiiRouterOS Documentation but still in the documentation codigniter. the difference is only in writing ($ this->) into (Mrs ::)

#11348 report it
Dips at 2013/01/08 02:03am
snmp

How to add snmp community string with this extension???

#7832 report it
melengo at 2012/04/21 07:33am
YII Yes It is..............!!!
public function getAll(){
        $talk = Mrs::talker();
//      $talk->setDebug(TRUE);
        $sentence = new SentenceUtil();
        $sentence->fromCommand("/ip/address/getall");
        $talk->send($sentence);
        $rs = $talk->getResult();
        while ($rs->next()){
            echo $rs->getResult("interface")."\t|\t";
            echo $rs->getResult("address")."\t|\t";
            echo $rs->getResult("network")."\t|\t";
            echo $rs->getResult("broadcast")."\t|\t";
            echo "<br>";
        }
    }
#6287 report it
at 2011/12/25 08:23am
Mikrotik Router OS

yes you can use this extension. to interact with Mikrotik RouterOS. if there are bugs in this class. please provide suggestions for development. development concept taken from site mikrotik itself. and heppy coding.

#6286 report it
jacmoe at 2011/12/25 07:46am
For those who haven't a clue what it is..

http://en.wikipedia.org/wiki/MikroTik MikroTik produces wireless routers which carries a Linux based OS called RouterOS. You can talk to a router like that using this Yii extension. That's basically it. :)

Leave a comment

Please to leave your comment.

Create extension