r3738 getRunningCDPStatus(): sayonara
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 4 Jun 2010 22:57:55 +0000 (22:57 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 4 Jun 2010 22:57:55 +0000 (22:57 +0000)
renderLiveCDP(): rename to renderDiscoveredNeighbors() and make it protocol-agnostic
importCDPData(): rename to importDPData()
navigation: add Live LLDP draft tab

inc/gateways.php
inc/interface.php
inc/navigation.php
inc/ophandlers.php

index af1f01c7dca84ec597cb8e8310487e758903c7c3..190ba02574e150e34a4be348830a54873a863827 100644 (file)
@@ -305,11 +305,6 @@ function getRunning8021QConfig ($object_id)
        return $ret;
 }
 
-function getRunningCDPStatus ($object_id)
-{
-       return gwRetrieveDeviceConfig ($object_id, 'getcdpstatus');
-}
-
 function setDevice8021QConfig ($object_id, $pseudocode)
 {
        if ('' == $breed = detectDeviceBreed ($object_id))
index b6cbef374e51b0a907293c324c5b12437635dc97..5b89622831004efe859ba241670ab1ee12b4591b 100644 (file)
@@ -7710,9 +7710,23 @@ function renderDeployQueue ($dqcode)
        echo '</table>';
 }
 
-function renderLiveCDP ($object_id)
+function renderDiscoveredNeighbors ($object_id)
 {
-       $CDP_status = sortPortList (getRunningCDPStatus ($object_id));
+       global $tabno;
+       $opcode_by_tabno = array ('livecdp' => 'getcdpstatus', 'livelldp' => 'getlldpstatus');
+       try
+       {
+               $neighbors = gwRetrieveDeviceConfig ($object_id, $opcode_by_tabno[$tabno]);
+       }
+       catch (Exception $e)
+       {
+               if ($e->getCode() == E_GW_FAILURE)
+               {
+                       showWarning ($e->getMessage(), __FUNCTION__);
+                       return;
+               }
+               throw $e;
+       }
        $mydevice = spotEntity ('object', $object_id);
        amplifyCell ($mydevice);
        // reindex by port name
@@ -7721,11 +7735,11 @@ function renderLiveCDP ($object_id)
                if (mb_strlen ($port['name']))
                        $myports[$port['name']][] = $port;
        unset ($mydevice);
-       printOpFormIntro ('importCDPData');
+       printOpFormIntro ('importDPData');
        echo '<br><table cellspacing=0 cellpadding=5 align=center class=widetable>';
        echo '<tr><th colspan=2>local port</th><th>remote device</th><th colspan=2>remote port</th><th>&nbsp;</th></tr>';
        $inputno = 0;
-       foreach ($CDP_status as $local_port => $remote)
+       foreach ($neighbors as $local_port => $remote)
        {
                if
                (
index c5ae570c14a15d741383766f1814ee971514b92d..f15d501b1e532fbfadfdffa9281a729ed3990eb0 100644 (file)
@@ -91,6 +91,7 @@ $tab['object']['ipv4'] = 'IPv4';
 $tab['object']['nat4'] = 'NATv4';
 $tab['object']['livevlans'] = 'Live VLANs';
 $tab['object']['livecdp'] = 'Live CDP';
+$tab['object']['livelldp'] = '[Live LLDP]';
 $tab['object']['snmpportfinder'] = 'SNMP sync';
 $tab['object']['editrspvs'] = 'RS pools';
 $tab['object']['lvsconfig'] = 'keepalived.conf';
@@ -107,7 +108,8 @@ $tabhandler['object']['ports'] = 'renderPortsForObject';
 $tabhandler['object']['ipv4'] = 'renderIPv4ForObject';
 $tabhandler['object']['nat4'] = 'renderNATv4ForObject';
 $tabhandler['object']['livevlans'] = 'renderVLANMembership';
-$tabhandler['object']['livecdp'] = 'renderLiveCDP';
+$tabhandler['object']['livecdp'] = 'renderDiscoveredNeighbors';
+$tabhandler['object']['livelldp'] = 'renderDiscoveredNeighbors';
 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
@@ -122,6 +124,7 @@ $trigger['object']['ipv4'] = 'trigger_ipv4';
 $trigger['object']['nat4'] = 'trigger_natv4';
 $trigger['object']['livevlans'] = 'trigger_livevlans';
 $trigger['object']['livecdp'] = 'trigger_LiveCDP';
+$trigger['object']['livelldp'] = 'trigger_LiveCDP';
 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
 $trigger['object']['editrspvs'] = 'trigger_isloadbalancer';
 $trigger['object']['lvsconfig'] = 'trigger_isloadbalancer';
@@ -148,7 +151,8 @@ $ophandler['object']['nat4']['addNATv4Rule'] = 'addPortForwarding';
 $ophandler['object']['nat4']['delNATv4Rule'] = 'delPortForwarding';
 $ophandler['object']['nat4']['updNATv4Rule'] = 'updPortForwarding';
 $ophandler['object']['livevlans']['setPortVLAN'] = 'setPortVLAN';
-$ophandler['object']['livecdp']['importCDPData'] = 'importCDPData';
+$ophandler['object']['livecdp']['importDPData'] = 'importDPData';
+$ophandler['object']['livelldp']['importDPData'] = 'importDPData';
 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
 $ophandler['object']['tags']['saveTags'] = 'saveEntityTags';
 $ophandler['object']['files']['addFile'] = 'addFileToEntity';
index f86982c8c3f5d3dc17295087aa5243cf15a83782..6d53d424e8e5842c44a537b6dbd6c994c3c3a7ab 100644 (file)
@@ -2608,8 +2608,8 @@ function updVSTRule()
        return buildRedirectURL (__FUNCTION__, $result ? 'OK' : 'ERR');
 }
 
-$msgcode['importCDPData']['OK'] = 44;
-function importCDPData()
+$msgcode['importDPData']['OK'] = 44;
+function importDPData()
 {
        global $sic;
        assertUIntArg ('nports');