function renderRSPool($pool_id)
{
    $poolInfo = spotEntity('ipv4rspool', $pool_id);
    echo "<table border=0 class=objectview cellspacing=0 cellpadding=0>";
    if (strlen($poolInfo['name'])) {
        echo "<tr><td colspan=2 align=center><h1>{$poolInfo['name']}</h1></td></tr>";
    }
    echo "<tr><td class=pcleft>\n";
    $summary = array();
    $summary['Pool name'] = $poolInfo['name'];
    $summary['Real servers'] = $poolInfo['rscount'];
    $summary['VS instances'] = $poolInfo['refcnt'];
    $summary['tags'] = '';
    $summary['VS configuration'] = '<div class="dashed slbconf">' . htmlspecialchars($poolInfo['vsconfig']) . '</div>';
    $summary['RS configuration'] = '<div class="dashed slbconf">' . htmlspecialchars($poolInfo['rsconfig']) . '</div>';
    renderEntitySummary($poolInfo, 'Summary', $summary);
    callHook('portletRSPoolSrv', $pool_id);
    echo "</td><td class=pcright>\n";
    renderSLBTriplets2($poolInfo);
    renderSLBTriplets($poolInfo);
    echo "</td></tr><tr><td colspan=2>\n";
    renderFilesPortlet('ipv4rspool', $pool_id);
    echo "</td></tr></table>\n";
}
Example #2
0
function renderIPAddress($ip_bin)
{
    global $aat, $nextorder;
    $address = getIPAddress($ip_bin);
    echo "<table border=0 class=objectview cellspacing=0 cellpadding=0>";
    echo "<tr><td colspan=2 align=center><h1>{$address['ip']}</h1></td></tr>\n";
    echo "<tr><td class=pcleft>";
    $summary = array();
    if (strlen($address['name'])) {
        $summary['Name'] = $address['name'];
    }
    if (strlen($address['comment'])) {
        $summary['Comment'] = $address['comment'];
    }
    $summary['Reserved'] = $address['reserved'];
    $summary['Allocations'] = count($address['allocs']);
    if (isset($address['outpf'])) {
        $summary['Originated NAT connections'] = count($address['outpf']);
    }
    if (isset($address['inpf'])) {
        $summary['Arriving NAT connections'] = count($address['inpf']);
    }
    renderEntitySummary($address, 'summary', $summary);
    // render SLB portlet
    if (!empty($address['vslist']) or !empty($address['vsglist']) or !empty($address['rsplist'])) {
        startPortlet("");
        if (!empty($address['vsglist'])) {
            printf("<h2>virtual service groups (%d):</h2>", count($address['vsglist']));
            foreach ($address['vsglist'] as $vsg_id) {
                renderSLBEntityCell(spotEntity('ipvs', $vsg_id));
            }
        }
        if (!empty($address['vslist'])) {
            printf("<h2>virtual services (%d):</h2>", count($address['vslist']));
            foreach ($address['vslist'] as $vs_id) {
                renderSLBEntityCell(spotEntity('ipv4vs', $vs_id));
            }
        }
        if (!empty($address['rsplist'])) {
            printf("<h2>RS pools (%d):</h2>", count($address['rsplist']));
            foreach ($address['rsplist'] as $rsp_id) {
                renderSLBEntityCell(spotEntity('ipv4rspool', $rsp_id));
            }
        }
        finishPortlet();
    }
    echo "</td>\n";
    echo "<td class=pcright>";
    if (isset($address['class']) and !empty($address['allocs'])) {
        startPortlet('allocations');
        echo "<table class='widetable' cellpadding=5 cellspacing=0 border=0 align='center' width='100%'>\n";
        echo "<tr><th>object</th><th>OS interface</th><th>allocation type</th></tr>\n";
        // render all allocation records for this address the same way
        foreach ($address['allocs'] as $bond) {
            $tr_class = "{$address['class']} tdleft";
            if (isset($_REQUEST['hl_object_id']) and $_REQUEST['hl_object_id'] == $bond['object_id']) {
                $tr_class .= ' highlight';
            }
            echo "<tr class='{$tr_class}'>" . "<td>" . makeIPAllocLink($ip_bin, $bond) . "</td>" . "<td>{$bond['name']}</td>" . "<td><strong>" . $aat[$bond['type']] . "</strong></td>" . "</tr>\n";
        }
        echo "</table><br><br>";
        finishPortlet();
    }
    if (!empty($address['rsplist'])) {
        startPortlet("RS pools:");
        foreach ($address['rsplist'] as $rsp_id) {
            renderSLBEntityCell(spotEntity('ipv4rspool', $rsp_id));
            echo '<br>';
        }
        finishPortlet();
    }
    if (!empty($address['vsglist'])) {
        foreach ($address['vsglist'] as $vsg_id) {
            renderSLBTriplets2(spotEntity('ipvs', $vsg_id), FALSE, $ip_bin);
        }
    }
    if (!empty($address['vslist'])) {
        renderSLBTriplets($address);
    }
    foreach (array('outpf' => 'departing NAT rules', 'inpf' => 'arriving NAT rules') as $key => $title) {
        if (!empty($address[$key])) {
            startPortlet($title);
            echo "<table class='widetable' cellpadding=5 cellspacing=0 border=0 align='center' width='100%'>\n";
            echo "<tr><th>proto</th><th>from</th><th>to</th><th>comment</th></tr>\n";
            foreach ($address[$key] as $rule) {
                echo "<tr>";
                echo "<td>" . $rule['proto'] . "</td>";
                echo "<td>" . getRenderedIPPortPair($rule['localip'], $rule['localport']) . "</td>";
                echo "<td>" . getRenderedIPPortPair($rule['remoteip'], $rule['remoteport']) . "</td>";
                echo "<td>" . $rule['description'] . "</td></tr>";
                echo "</tr>";
            }
            echo "</table>";
            finishPortlet();
        }
    }
    echo "</td></tr>";
    echo "</table>\n";
}
function renderTripletForm($bypass_id)
{
    renderSLBTriplets2(spotEntity(etypeByPageno(), $bypass_id), TRUE);
}
function renderTripletForm($bypass_id)
{
    global $pageno, $etype_by_pageno;
    $cell = spotEntity($etype_by_pageno[$pageno], $bypass_id);
    renderSLBTriplets2($cell, TRUE);
}