This post is more than 5 years old
53 Posts
0
320
August 15th, 2008 11:00
Question about calling rules in ASL
I have the following script to get a list of physically connected ports out of a SAM service and count how many belong to each service offering. No matter how I try to format my rule calls it doesn't work (syntax errors). Am I missing something? Can anyone provide some insight?
----
START {
..eol
} do {
connectionList = getInstances("Cable");
connectionList += getInstances("TrunkCable");
serviceArea = table();
foreach connection (connectionList) {
BUILDTABLE
}
foreach area (serviceArea) {
print(area."|".serviceArea[area]);
}
stop();
}
BUILDTABLE {
input=connection;
pre:len(5)
port1:rep(notany("<"}
host:rep(notany("/"))
..eol
} do {
hostObj = object(host);
groups = getInstances("ICF_GroupSelector");
foreach group (groups) {
groupObj = object(group);
if (groupObj->matches(hostObj)) {
MATCHEDGROUP
serviceArea[group] = serviceArea[group]+1;
serviceArea["total"] = serviceArea["total"]+1;
break;
}
}
}
MATCHEDGROUP {
input=group;
rem:len(7)
group:rep(char) eol
}
----
START {
..eol
} do {
connectionList = getInstances("Cable");
connectionList += getInstances("TrunkCable");
serviceArea = table();
foreach connection (connectionList) {
BUILDTABLE
}
foreach area (serviceArea) {
print(area."|".serviceArea[area]);
}
stop();
}
BUILDTABLE {
input=connection;
pre:len(5)
port1:rep(notany("<"}
host:rep(notany("/"))
..eol
} do {
hostObj = object(host);
groups = getInstances("ICF_GroupSelector");
foreach group (groups) {
groupObj = object(group);
if (groupObj->matches(hostObj)) {
MATCHEDGROUP
serviceArea[group] = serviceArea[group]+1;
serviceArea["total"] = serviceArea["total"]+1;
break;
}
}
}
MATCHEDGROUP {
input=group;
rem:len(7)
group:rep(char) eol
}
No Events found!
FredericMeunier_0588be
143 Posts
0
August 18th, 2008 12:00
this is the syntax of the RULES which does not work. Look at the ASL guide, section: "Passing arguments to functions". You should have something like:
...
foreach connection (connectionList) {
BUILDTABLE(connection);
}
...
BUILDTABLE(connection) {
input=connection;
pre:len(5)
...
HTH,
--Fred
=> APG v4.1 is now available with new out of the box reports for Smarts InCharge health
Frederic Meunier
Solutions Watch4Net Inc
APG & Smarts InCharge integration
http://www.watch4net.com