More parser fixes and testing
This commit is contained in:
parent
b5eb058f25
commit
c44c02294b
|
|
@ -17,9 +17,13 @@ public class Example6 extends Example {
|
|||
}
|
||||
|
||||
private void test() throws MikrotikApiException, InterruptedException {
|
||||
// con.execute("/interface/gre/add remote-address=1.2.3.4 name=gre1 keepalive=10 comment='test comment'");
|
||||
System.out.println("Creating interface gre1");
|
||||
con.execute("/interface/gre/add remote-address=1.2.3.4 name=gre1 keepalive=10 comment=\"test comment\"");
|
||||
System.out.println("Adding firewall rule for interface gre1");
|
||||
con.execute("/ip/firewall/filter/add action=drop chain=forward in-interface=gre1 protocol=udp dst-port=78,80");//,80,32");
|
||||
System.out.println("Waiting 10 seconds");
|
||||
Thread.sleep(10000); // 10 seconds for the user to look on the router to see the interface with /interface gre print
|
||||
System.out.println("Changing IP for interface gre1");
|
||||
con.execute("/interface/gre/set remote-address=172.16.1.1 .id=gre1");
|
||||
// now look again and the IP has changed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@ import me.legrange.mikrotik.impl.Scanner.Token;
|
|||
*/
|
||||
class Parser {
|
||||
|
||||
public static void main(String...args) throws Exception {
|
||||
/* System.out.println(parse("/system/reboot"));
|
||||
System.out.println(parse("/interface/print where type=ether"));
|
||||
System.out.println(parse("/interface/wireless/monitor .id=wlan1"));
|
||||
System.out.println(parse("/ip/firewall/filter/add action=drop chain=forward in-interface=gre1 protocol=udp dst-port=78,80"));
|
||||
System.out.println(parse("/file/print detail where name=conf.rsc"));
|
||||
System.out.println(parse("/ip/firewall/filter/add action=drop chain=forward in-interface=aps_hs protocol=udp dst-port=78,80,32")); */
|
||||
System.out.println(parse("/interface/gre/set .id=gre1 comment=\"test coment\""));
|
||||
}
|
||||
/** parse the given bit of text into a Command object */
|
||||
static Command parse(String text) throws ParseException {
|
||||
Parser parser = new Parser(text);
|
||||
|
|
|
|||
Loading…
Reference in New Issue