In this project, we worked on converting IP ranges to CIDR notations and checking if one list of CIDR notations is a subset of another list. We started by analyzing the IP range 80.80.80.10 - 80.80.80.40 and arrived at the following CIDR notations:
[ "80.80.80.10/31", "80.80.80.12/30", "80.80.80.16/28", "80.80.80.32/29", "80.80.80.40/32" ]
We then expanded our analysis to include the IP range 80.80.80.60 - 80.80.80.90 and arrived at the following additional CIDR notations:
[ "80.80.80.60/30", "80.80.80.64/28", "80.80.80.80/29", "80.80.80.88/31", "80.80.80.90/32" ]
We combined all the CIDR notations into a single array for easy reference:
[ "80.80.80.10/31", "80.80.80.12/30", "80.80.80.16/28", "80.80.80.32/29", "80.80.80.40/32", "80.80.80.60/30", "80.80.80.64/28", "80.80.80.80/29", "80.80.80.88/31", "80.80.80.90/32" ]
We also wrote a JavaScript function to check if one list of CIDR notations is a subset of another list:
function isSubsetOfCIDRs(cidrList, subsetList) { // Function code goes here }
We made sure the function was compatible with the ServiceNow San Diego version and provided an example of how to use it in ServiceNow.