The SCE IPAddressRange class as a main method that you can call to display the range:
java -cp $BINDIR/../generic_unix/TME/TEC/zce.jar com.tivoli.zce.predicates.zce.IPAddressRange "192.168.12.128/25"
192.168.12.128/25 min: 3232238720 max: 3232238847
As you can see, the values are not real useful.
Here is a simple Java class to output the address range in more readable format.
import java.io.PrintStream;
import com.tivoli.zce.predicates.zce.IPAddressRange;
public class TestIPAddressRange
{
private static IPAddressRange _iprange;
protected static String toString(long ip)
{
String result="";
long m;
m = 255L << 24;
for(int i=0;i<4;i++)
{
long x = (ip & m) >> 8 * (3 - i);
if(i>0) result += ".";
result += x;
m >>= 8;
}
return result;
}
public static void main(String[] args)
{
if(args.length == 1)
_iprange = new IPAddressRange(args[0], args[0]);
else
_iprange = new IPAddressRange(args[0], args[1]);
System.out.println(_iprange.toString() +
" min: " + toString(_iprange.minval) +
" max: " + toString(_iprange.maxval));
}
}
javac -classpath $BINDIR/../generic_unix/TME/TEC/zce.jar TestIPAddressRange.java
java -cp $BINDIR/../generic_unix/TME/TEC/zce.jar:. TestIPAddressRange "192.168.12.128/25"
192.168.12.128/25 min: 192.168.12.128 max: 192.168.12.255
Thursday, March 6, 2008
Testing IP Address Ranges in SCE Rules
If you need use an IP address range in your SCE rules there is a way to test that the value you specify.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment