[arin-tech-discuss] Developing Reg-RWS discovery requirements (was Re: Listing all reassignments?)

Aaron Hughes aaronh at bind.com
Tue Nov 29 13:30:03 EST 2011


On Tue, Nov 29, 2011 at 06:23:58PM +0000, Andy Newton wrote:
> Thomas,
> 
> My response is inline.
> 
> On Nov 23, 2011, at 1:49 PM, Thomas St.Pierre wrote:
> 
> > 1) For a given IP, (usually the network address of the subnet I'm about to reassign) find out what the parent NET HANDLE is. This is required for the net payload to do the reassign. (From my understanding of the documentation anyways)
> 
> Because many registrants SWiP network blocks to themselves, this isn't as straightforward as one would hope. The logic may need to be "find the parent NET HANDLE for the most specific (or least specific) of my networks". I guess most specific is the proper logic, but I could easily be wrong about that. Another option to help solve that problem might be to return ALL the net handles for each network registered by a registrant given an IP. Because it is possible for a single API Key to have an authorization over multiple organizations, that query would also need to include an ORG Handle.

Something like this works just fine, however, if you have DESWIPPED make sure you set a 600 second timer for the whois database to update before you SWIP again otherwise you will match the block that no longer exists while waiting for whois to update.

Cheers,
Aaron
[snip]

  // GET PARENT NETWORK
  // Perform the transaction via cURL
  $ch = curl_init();
  $url = ARIN_WHOIS_URL . "/ip/" . $params['net_block']['address'];
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_TIMEOUT, 4);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_HTTPHEADER, 0);
  if (!$debug) curl_setopt($ch, CURLOPT_MUTE, 1);

  $retval = curl_exec($ch);
  if ($debug) echo $retval;

  $info = curl_getinfo($ch);

  $response = "";
  if ($retval == false) {
    $res = "Failure:Get Parent Network:Could not connect. <br />";
    $response .= $res;
  }
  else if ($info['http_code'] != 200) {
    $res = "Failure:Get Parent Network:Return code is " . (int)($info['http_code']) . "<br />";
    $response .= $res;
  }
  else {
    $res = "Success";
    $response .= $res;
    $response .= $retval;
  }

  curl_close($ch);


> 
> > 2) For a given IP, find what the existing NET HANDLE and customer handle are. Useful for updating existing objects.
> 
> Would the intent be to use this in a batch operation, such as a nightly syncing process, or more for updating objects on the fly? And if it is more of a batch mode, how do you decide which IP address to use?
> 
> This has been helpful.
> 
> Andy Newton
> -- 
> arin-tech-discuss mailing list
> arin-tech-discuss at arin.net
> http://lists.arin.net/mailman/listinfo/arin-tech-discuss

-- 

Aaron Hughes 
aaronh at bind.com
+1-831-824-4161
Key fingerprint = AD 67 37 60 7D 73 C5 B7 33 18 3F 36 C3 1C C6 B8
http://www.bind.com/



More information about the arin-tech-discuss mailing list