mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-08-14 15:08:50 +02:00
commit
5c6a6077da
24 changed files with 77 additions and 59 deletions
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-04-bad-script.rsc"
|
# filename: ch10-04-bad-script.rsc
|
||||||
|
#
|
||||||
# A simple script to perform a series of tests on a
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-04-bad-script.rsc"
|
||||||
|
|
||||||
# function to log error message
|
# function to log error message
|
||||||
:global LogMessageFunc do={
|
:global LogMessageFunc do={
|
||||||
:global Filename;
|
:global Filename;
|
||||||
|
@ -18,7 +21,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $WebSiteName]!="str") or \
|
if (([:typeof $WebSiteName]!="str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
||||||
a valid string!");
|
a valid string!");
|
||||||
}
|
}
|
||||||
|
@ -47,7 +50,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $SiteName] != "str") or \
|
if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-05-error-check.rsc
|
# filename: ch10-05-error-check.rsc
|
||||||
:local WebSites { "badname1234.com"; "google.com"};
|
:local WebSites { "badname1234.com"; "google.com"};
|
||||||
|
|
||||||
:foreach SiteName in=$WebSites do={
|
:foreach SiteName in=$WebSites do={
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-06-error-check.rsc
|
# filename: ch10-06-error-check.rsc
|
||||||
:local WebSites { "badname1234.com"; "google.com"};
|
:local WebSites { "badname1234.com"; "google.com"};
|
||||||
:foreach SiteName in=$WebSites do={
|
:foreach SiteName in=$WebSites do={
|
||||||
:do {
|
:do {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-07-bad-script.rsc"
|
# filename: ch10-07-bad-script.rsc
|
||||||
# A script to perform a series of tests on a
|
#
|
||||||
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-07-bad-script.rsc"
|
||||||
|
|
||||||
# function to log error messages
|
# function to log error messages
|
||||||
:global LogMessageFunc do={
|
:global LogMessageFunc do={
|
||||||
:global Filename;
|
:global Filename;
|
||||||
|
@ -18,7 +21,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
:if (([:typeof $WebSiteName] != "str") or \
|
:if (([:typeof $WebSiteName] != "str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
||||||
a valid string!");
|
a valid string!");
|
||||||
|
|
||||||
|
@ -64,7 +67,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
:if (([:typeof $SiteName] != "str") or \
|
:if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
:return "*** test failed ***";
|
:return "*** test failed ***";
|
||||||
|
@ -77,7 +80,7 @@
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
||||||
$SiteName !");
|
$SiteName !");
|
||||||
:return { "duration"="*** test failed ***" }
|
:return { "*** test failed ***" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-08-bad-script.rsc"
|
# filename: ch10-08-bad-script.rsc
|
||||||
# A script to perform a series of tests on a
|
#
|
||||||
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-08-bad-script.rsc"
|
||||||
|
|
||||||
# set DEBUG to "true" for script debugging output,
|
# set DEBUG to "true" for script debugging output,
|
||||||
# "false" for normal operation
|
# "false" for normal operation
|
||||||
:global DEBUG false;
|
:global DEBUG false;
|
||||||
|
@ -34,7 +37,7 @@
|
||||||
$DebugFunc "Checking arg data type is correct";
|
$DebugFunc "Checking arg data type is correct";
|
||||||
|
|
||||||
:if (([:typeof $WebSiteName] != "str") or \
|
:if (([:typeof $WebSiteName] != "str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
:local ErrorMsg "DnsResolveFunc: arg value $WebSiteName \
|
:local ErrorMsg "DnsResolveFunc: arg value $WebSiteName \
|
||||||
not a valid string!";
|
not a valid string!";
|
||||||
$LogMessageFunc $ErrorMsg;
|
$LogMessageFunc $ErrorMsg;
|
||||||
|
@ -85,10 +88,10 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $SiteName] != "str") or \
|
if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
:return { "duration"="*** test failed ***" };
|
:return { "*** test failed ***" };
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -97,7 +100,7 @@
|
||||||
} on-error {
|
} on-error {
|
||||||
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
||||||
$SiteName !");
|
$SiteName !");
|
||||||
return { "duration"="*** test failed ***" };
|
return { "*** test failed ***" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-09-simple-pause.rsc
|
# filename: ch10-09-simple-pause.rsc
|
||||||
|
|
||||||
# A simple script that includes a 2 second pause
|
# A simple script that includes a 2 second pause
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-10-add-remove-vlans.rsc
|
# filename: ch10-10-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/fromon-error={
|
# a script to add and remove 50 VLANs to/fromon-error={
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-11-add-remove-vlans.rsc
|
# filename: ch10-11-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/from
|
# a script to add and remove 50 VLANs to/from
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-12-add-remove-vlans.rsc
|
# filename: ch10-12-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/from
|
# a script to add and remove 50 VLANs to/from
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-04-bad-script.rsc"
|
# filename: ch10-04-bad-script.rsc
|
||||||
|
#
|
||||||
# A simple script to perform a series of tests on a
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-04-bad-script.rsc"
|
||||||
|
|
||||||
# function to log error message
|
# function to log error message
|
||||||
:global LogMessageFunc do={
|
:global LogMessageFunc do={
|
||||||
:global Filename;
|
:global Filename;
|
||||||
|
@ -18,7 +21,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $WebSiteName]!="str") or \
|
if (([:typeof $WebSiteName]!="str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
||||||
a valid string!");
|
a valid string!");
|
||||||
}
|
}
|
||||||
|
@ -47,7 +50,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $SiteName] != "str") or \
|
if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-05-error-check.rsc
|
# filename: ch10-05-error-check.rsc
|
||||||
:local WebSites { "badname1234.com"; "google.com"};
|
:local WebSites { "badname1234.com"; "google.com"};
|
||||||
|
|
||||||
:foreach SiteName in=$WebSites do={
|
:foreach SiteName in=$WebSites do={
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-06-error-check.rsc
|
# filename: ch10-06-error-check.rsc
|
||||||
:local WebSites { "badname1234.com"; "google.com"};
|
:local WebSites { "badname1234.com"; "google.com"};
|
||||||
:foreach SiteName in=$WebSites do={
|
:foreach SiteName in=$WebSites do={
|
||||||
:do {
|
:do {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-07-bad-script.rsc"
|
# filename: ch10-07-bad-script.rsc
|
||||||
# A script to perform a series of tests on a
|
#
|
||||||
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-07-bad-script.rsc"
|
||||||
|
|
||||||
# function to log error messages
|
# function to log error messages
|
||||||
:global LogMessageFunc do={
|
:global LogMessageFunc do={
|
||||||
:global Filename;
|
:global Filename;
|
||||||
|
@ -18,7 +21,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
:if (([:typeof $WebSiteName] != "str") or \
|
:if (([:typeof $WebSiteName] != "str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
$LogMessageFunc ("DnsResolveFunc: arg value $WebSiteName not \
|
||||||
a valid string!");
|
a valid string!");
|
||||||
|
|
||||||
|
@ -64,7 +67,7 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
:if (([:typeof $SiteName] != "str") or \
|
:if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
:return "*** test failed ***";
|
:return "*** test failed ***";
|
||||||
|
@ -77,7 +80,7 @@
|
||||||
} on-error={
|
} on-error={
|
||||||
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
||||||
$SiteName !");
|
$SiteName !");
|
||||||
:return { "duration"="*** test failed ***" }
|
:return { "*** test failed ***" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
:global Filename "ch10-08-bad-script.rsc"
|
# filename: ch10-08-bad-script.rsc
|
||||||
# A script to perform a series of tests on a
|
#
|
||||||
|
# A simple script to perform a series of tests on a
|
||||||
# list of web sites.
|
# list of web sites.
|
||||||
|
|
||||||
|
:global Filename "ch10-08-bad-script.rsc"
|
||||||
|
|
||||||
# set DEBUG to "true" for script debugging output,
|
# set DEBUG to "true" for script debugging output,
|
||||||
# "false" for normal operation
|
# "false" for normal operation
|
||||||
:global DEBUG false;
|
:global DEBUG false;
|
||||||
|
@ -34,7 +37,7 @@
|
||||||
$DebugFunc "Checking arg data type is correct";
|
$DebugFunc "Checking arg data type is correct";
|
||||||
|
|
||||||
:if (([:typeof $WebSiteName] != "str") or \
|
:if (([:typeof $WebSiteName] != "str") or \
|
||||||
([:len value=$WebSiteName] < 6)) do={
|
([:len $WebSiteName] < 6)) do={
|
||||||
:local ErrorMsg "DnsResolveFunc: arg value $WebSiteName \
|
:local ErrorMsg "DnsResolveFunc: arg value $WebSiteName \
|
||||||
not a valid string!";
|
not a valid string!";
|
||||||
$LogMessageFunc $ErrorMsg;
|
$LogMessageFunc $ErrorMsg;
|
||||||
|
@ -85,10 +88,10 @@
|
||||||
|
|
||||||
# check arg type str of correct length passed
|
# check arg type str of correct length passed
|
||||||
if (([:typeof $SiteName] != "str") or \
|
if (([:typeof $SiteName] != "str") or \
|
||||||
([:len value=$SiteName] < 6)) do={
|
([:len $SiteName] < 6)) do={
|
||||||
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
$LogMessageFunc ("GetWebPageFunc: arg value $SiteName not a \
|
||||||
valid string!");
|
valid string!");
|
||||||
:return { "duration"="*** test failed ***" };
|
:return { "*** test failed ***" };
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -97,7 +100,7 @@
|
||||||
} on-error {
|
} on-error {
|
||||||
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
$LogMessageFunc ("GetWebPageFunc: unable to retrieve site: \
|
||||||
$SiteName !");
|
$SiteName !");
|
||||||
return { "duration"="*** test failed ***" };
|
return { "*** test failed ***" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-09-simple-pause.rsc
|
# filename: ch10-09-simple-pause.rsc
|
||||||
|
|
||||||
# A simple script that includes a 2 second pause
|
# A simple script that includes a 2 second pause
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-10-add-remove-vlans.rsc
|
# filename: ch10-10-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/from
|
# a script to add and remove 50 VLANs to/from
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-11-add-remove-vlans.rsc
|
# filename: ch10-11-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/from
|
# a script to add and remove 50 VLANs to/from
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ch10-12-add-remove-vlans.rsc
|
# filename: ch10-12-add-remove-vlans.rsc
|
||||||
|
|
||||||
# a script to add and remove 50 VLANs to/from
|
# a script to add and remove 50 VLANs to/from
|
||||||
# a Mikrotik router interface
|
# a Mikrotik router interface
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue