예제 #1
0
 /**
  * The Construct
  */
 public function __construct($ipaddress, $cidr, $gateway_setting = 'top')
 {
     $this->ipaddress = $ipaddress;
     $this->cidr = $cidr;
     $this->gateway_setting = $gateway_setting;
     $this->net_addr = IP\NetworkAddress::factory($this->ipaddress, $this->cidr);
     $dhcp = DhcpOption::first();
     $this->default_lease_time = $dhcp->default_lease_time;
     $this->max_lease_time = $dhcp->max_lease_time;
     $this->dns_1 = $dhcp->dns_1;
     $this->dns_2 = $dhcp->dns_2;
     $this->dns_3 = $dhcp->dns_3;
     $this->dns_4 = $dhcp->dns_4;
 }
예제 #2
0
 /**
  * The Construct
  */
 public function __construct($ipaddress, $cidr)
 {
     $this->ipaddress = $ipaddress;
     $this->cidr = $cidr;
     $this->net_addr = IP\NetworkAddress::factory($this->ipaddress, $this->cidr);
 }
예제 #3
0
 /**
  * Retrieve all defined subnets from Sonar
  */
 private function getExistingSubnets()
 {
     $supernetIDs = [];
     $subnetArray = [];
     $page = 1;
     $supernets = $this->client->get($this->uri . "/api/v1/network/ipam/supernets?limit=100&page={$page}", ['headers' => ['Content-Type' => 'application/json; charset=UTF8', 'timeout' => 30], 'auth' => [$this->username, $this->password]]);
     $supernets = json_decode($supernets->getBody()->getContents());
     while ($page <= $supernets->paginator->total_pages) {
         foreach ($supernets->data as $individualSupernet) {
             array_push($supernetIDs, $individualSupernet->id);
         }
         $page++;
         $supernets = $this->client->get($this->uri . "/api/v1/network/ipam/supernets?limit=100&page={$page}", ['headers' => ['Content-Type' => 'application/json; charset=UTF8', 'timeout' => 30], 'auth' => [$this->username, $this->password]]);
         $supernets = json_decode($supernets->getBody()->getContents());
     }
     foreach ($supernetIDs as $supernetID) {
         $page = 1;
         $subnets = $this->client->get($this->uri . "/api/v1/network/ipam/supernets/{$supernetID}/subnets?limit=100&page={$page}", ['headers' => ['Content-Type' => 'application/json; charset=UTF8', 'timeout' => 30], 'auth' => [$this->username, $this->password]]);
         $subnets = json_decode($subnets->getBody()->getContents());
         while ($page <= $subnets->paginator->total_pages) {
             foreach ($subnets->data as $individualSubnet) {
                 $lethSupernet = NetworkAddress::factory($individualSubnet->subnet);
                 array_push($subnetArray, ['id' => $individualSubnet->id, 'name' => $individualSubnet->name, 'object' => $lethSupernet, 'subnet' => $individualSubnet->subnet, 'supernet_id' => $supernetID]);
             }
             $page++;
             $subnets = $this->client->get($this->uri . "/api/v1/network/ipam/supernets/{$supernetID}/subnets?limit=100&page={$page}", ['headers' => ['Content-Type' => 'application/json; charset=UTF8', 'timeout' => 30], 'auth' => [$this->username, $this->password]]);
             $subnets = json_decode($subnets->getBody()->getContents());
         }
     }
     $this->subnets = $subnetArray;
 }