I want to feed a list of ~5K IP addresses into forward and track the IP down to whatever info is available (device interface, standby address, device interface neighbor, host).
I have two functions that build the lists of records that I need to join by ip address.FromCSV
(~5K records) and allKnownIps
(~200-300K records)
What is the most efficient / elegant way to join essentially join these tables?
I tried to build the smaller list first and then build the known IP list only if there is a match and then ran a nested loop
csvListIPs = (foreach ip in FromCSV select ip.ipAddr);// List of ~5K IPs
allknownIpList = (foreach knownIp in allKnownIps where knownIp.ipAddr in csvListIPs select ip);//Filter for only known IPs in CSVlist
foreach knownIp in allknownIpList
foreach csvIP in FromCSV
where knownIp.ipAddr == csvIP.ipaddr
select{
};
So I have two questions:
- Is there a more elegant way to do this?
- 5K IP's trying to match against the 250K Potential IP's (I have normalized everything so that it's ipv4 addresses in string format without a prefix) only returns about 60 matches. Upon spot checking I am not finding any IP's that forward actually knows that is being missed here, so I suspect that the input (I don't know yet where the IP's come from) is just IPs that forward doesn't know about, but is there anything obvious I am missing here?