$this->last_contact = $node['last_contact'];
$this->site_id = $node['site_id'];
$this->pcu_ids = $node['pcu_ids'];
- $this->nn = $api->GetNodeNetworks($node['nodenetwork_ids']);
+ $this->nn = $api->GetInterfaces($node['interface_ids']);
foreach ($this->nn as $nnet)
{
if ( $nnet['is_primary'] == true )
function lastContact() {
return $this->timeaway($this->last_contact);
}
+ function stale() {
+ $now = time();
+ $STALE_LENGTH = 60*60; /* TODO: set by some policy */
+ if ( $this->last_contact + $STALE_LENGTH > $now ) {
+ return False;
+ } else {
+ return True;
+ }
+ }
function timeaway($val) {
if ( $val != NULL ) {
$ret = timeDiff(intval($val));