if ( sizeof( $devList ) > 0 ) {
			foreach ( $devList as $devRow ) {
				$downPanels = "";
				$outageStatus = __("Down");
				
				if ( (! $devRow->Reservation) && $devRow->PowerSupplyCount > 0 ) {	// No need to even process devices that aren't installed, yet or that have 0 power supplies
					// If there is not a circuit to the cabinet that is unaffected, no need to even check
					if ( $diversity ) {
						// If a circuit was entered with no panel ID, or a device has no connections documented, mark it as unknown
						// The only way to be sure a device will stay up is if we have a connection to an unaffected circuit,
						// or to a failsafe switch (ATS) connected to at least one unaffected circuit.
						$outageStatus = __("Down");
						
						$pwrConn->DeviceID = $devRow->DeviceID;
						$connList = $pwrConn->GetConnectionsByDevice();
						
						$devPDUList = array();
						$fsDiverse = false;
						
						if ( count( $connList ) == 0 ) {
							$outageStatus = __("Unknown");
						}

						foreach ( $connList as $connection ) {
							// If the connection is to a PDU that is NOT in the affected PDU list, and is not already in the diversity list, add it

							if ( ! in_array( $connection->PDUID, $pduArray ) ) {
								if ( ! in_array( $connection->PDUID, $devPDUList ) )
									array_push( $devPDUList, $connection->PDUID );
Esempio n. 2
0
 function GetDeviceDiversity()
 {
     global $dbh;
     $pc = new PowerConnection();
     $PDU = new PowerDistribution();
     // If this is a child (card slot) device, then only the parent will have power connections defined
     if ($this->ParentDevice > 0) {
         $tmpDev = new Device();
         $tmpDev->DeviceID = $this->ParentDevice;
         $sourceList = $tmpDev->GetDeviceDiversity();
     } else {
         $pc->DeviceID = $this->DeviceID;
         $pcList = $pc->GetConnectionsByDevice();
         $sourceList = array();
         $sourceCount = 0;
         foreach ($pcList as $pcRow) {
             $PDU->PDUID = $pcRow->PDUID;
             $powerSource = $PDU->GetSourceForPDU();
             if (!in_array($powerSource, $sourceList)) {
                 $sourceList[$sourceCount++] = $powerSource;
             }
         }
     }
     return $sourceList;
 }
Esempio n. 3
0
        $pwrConnection->PDUPosition = $_POST['con'];
        $pwrConnection->DeviceConnNumber = $_POST['power'];
        if (isset($_POST['e'])) {
            $pwrConnection->CreateConnection();
        } else {
            $pwrConnection->RemoveConnection();
        }
        echo 'ok';
    } else {
        $dev = new Device();
        $pwrConnection = new PowerConnection();
        $pdu = new PowerDistribution();
        $dev->DeviceID = $_POST['DeviceID'];
        $dev->GetDevice();
        $pwrConnection->DeviceID = $dev->ParentDevice > 0 ? $dev->ParentDevice : $dev->DeviceID;
        $pwrCords = $pwrConnection->GetConnectionsByDevice();
        print "<span>Server Name: {$dev->Label}</span><span># Power Supplies: {$dev->PowerSupplyCount}</span><div class=\"table border\">\n\t\t\t<div><div>" . __("Power Strip") . "</div><div>" . __("Plug #") . "</div><div>" . __("Power Supply") . "</div></div>";
        foreach ($pwrCords as $cord) {
            $pdu->PDUID = $cord->PDUID;
            $pdu->GetPDU();
            print "\t\t\t<div><div data=\"{$pdu->PDUID}\"><a href=\"power_pdu.php?pduid={$pdu->PDUID}\">{$pdu->Label}</a></div><div><a href=\"power_connection.php?pdu={$pdu->PDUID}&conn={$cord->PDUPosition}\">{$cord->PDUPosition}</a></div><div" . ($cord->DeviceConnNumber == $_POST['power'] ? ' class="bold"' : ' class="disabled"') . ">{$cord->DeviceConnNumber}</div></div>\n";
        }
        print "</div>";
    }
    exit;
}
if (isset($_POST['EndpointDeviceID'])) {
    $networkPatches = new SwitchConnection();
    $networkPatches->EndpointDeviceID = $_POST['EndpointDeviceID'];
    if (isset($_POST['SwitchDeviceID']) && isset($_POST['SwitchPortNumber'])) {
        $networkPatches->SwitchDeviceID = $_POST['SwitchDeviceID'];