View Issue Details

IDProjectCategoryView StatusLast Update
1335RackTablesdefaultpublic2014-09-09 12:17
Reporterapromix007 Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionno change required 
Product Version0.20.8 
Summary1335: Error in contribs/local_portgenerator.php: Port type XXX is not found or not a port type
DescriptionHi ..

This Port Generator is not working with RT v.0.20.8, so I send the new fixed version.

Changelog:

* Compatibility with RT v.0.20.8, because DB-Model was changed (RactTables Changelog: update: move port outer interfaces from the dictionary)

* Port listing with InnerInterface ID (Example: 10-1588 QSFP+ => empty QSFP+)

* some HTML Tags bugfixed



The file with new version is attached.



Bye ..
Additional InformationPath (for quick view of changes):

--- local_portgenerator.php-orig 2014-09-05 14:06:59.148968633 +0200
+++ local_portgenerator.php 2014-09-08 12:16:31.825551268 +0200
@@ -136,6 +136,17 @@
 //------------------------------------
 //*** Added support for PortInnterInterface ***
 //
+//
+//Version 1.5
+//Revised by Marian Stetina
+//09-2014
+//------------------------------------
+//Changes:
+//------------------------------------
+//*** Compatibility with RT v.0.20.8, because DB-Model was changed (RactTables Changelog: update: move port outer interfaces from the dictionary)
+//*** Port listing with InnerInterface ID (Example: 10-1588 QSFP+ => empty QSFP+)
+//*** some HTML Tags bugfixed
+//
 
 $tab['object']['portgenerator'] = 'Port generator';
 $trigger['object']['portgenerator'] = 'localtrigger_PortGenerator';
@@ -296,10 +307,10 @@
               }
               if ($thisOrder[1]==1 || strpos($thisOrder[2],"%u")!==false) {
                if (preg_match ('/^([[:digit:]]+)-([[:digit:]]+)$/', $thisOrder[3], $matches))
- $oif_id = $matches[2];
+ $oif_id = $matches[2];
                else
                   $oif_id = $thisOrder[3];
- $q = "SELECT dict_value FROM Dictionary WHERE dict_key='$oif_id' AND chapter_id=2 ";
+ $q = "SELECT oif_name FROM PortOuterInterface WHERE id='$oif_id'";
                 $result = usePreparedSelectBlade ($q);
                 if ($result==NULL) { print_r($dbxlink->errorInfo()); die(); }
                 if ($row3 = $result->fetch (PDO::FETCH_NUM)) {
@@ -386,14 +397,15 @@
     //
     print "<center>";
     print $genText."

\n";
+ print "USAGE

";
     print "<list1>;<list2>;.... where <listx> is
";
     print "<start port #>|<port count, use %n for number of ports>|";
     print "<port name, use %u for number>|[<port innerinterface id>-]<port type id>[|<port label, use %u for number>]

";
- print "EXAMPLE

1|15|eth%u|24;

"; //an example of how to use port generator
- print "EXPLANATION

1 = starting number,
- 15 = number of generated ports,
- eth%u = will begin with starting number and create up to the number of generated ports,
- 24 = the dictionary value displayed on the chart below in bold

"; //explains example
+ print "EXAMPLE (for Force10 S4810)

0|48|%u|9-1084|TenGigabitEthernet0/%u;48|4|%u|10-1588|FortyGigE0/48;52|4|%u|10-1588|FortyGigE0/52;56|4|%u|10-1588|FortyGigE0/56;60|4|%u|10-1588|FortyGigE0/60;1|1|RS-232|29|Serial port;1|1|Ethernet|24|ManagementEthernet0/%u;1|2|AC%u|16

";
+ print "EXPLANATION (for AC-in ports)

1 = starting number,
+ 2 = number of generated ports,
+ AC%u = will begin with starting number and create up to the number of generated ports,
+ 16 = the value displayed on the chart below in bold (Notice: Default innerinterface ID is 1 /hardwired/, so the realy value is 1-16)

"; //explains example
     print "PLEASE NOTE

If you do not add the port that is selected (dictionary value) to the default list in the Ports Tab,
     you will get a foriegn key violation error.
     You must go to the Configuration area on the main page, go to Enable port types
@@ -404,7 +416,7 @@
     // On top of the table of ports avialabe instead of beneath it
        //
     printOpFormIntro ('updateportgenerator', array ('yId' => $searchIt));
- print "Autoport Configuration : <input type='text' size='60' name='yConfig' value='";
+ print "Autoport Configuration:

<input type='text' style='width:100%; font-size: 16px' name='yConfig' value='";
     if ($valueConfiguration) {
       print $valueConfiguration[0];
     }
@@ -419,30 +431,23 @@
     print "</form>\n";
     print "</center>
";
      
- print "<table border='2' rules=all>\n<tr>";
+ print "<table border='2' rules=all>\n<tr class=row_odd>";
     $isfirst = true;
     $i = 0;
     //
     // List all available port types with their dictionary key
     //
- $q = "SELECT dict_key, dict_value FROM Dictionary WHERE chapter_id=2 ORDER BY dict_value ";
+ $q = "SELECT IF(iif_id,CONCAT(i.id,'-',o.id),o.id) as ID , IF(iif_id,CONCAT(i.iif_name,' => ',o.oif_name),o.oif_name) as name FROM PortOuterInterface o left join PortInterfaceCompat c on o.id = c.oif_id left join PortInnerInterface i on c.iif_id = i.id order by i.id,o.id";
     $result = usePreparedSelectBlade ($q);//Changed for new configeration in versions after 0.17.x
     if ($result==NULL) { print_r($dbxlink->errorInfo()); die(); }
     while ($row4 = $result->fetch (PDO::FETCH_NUM)) {
- if (!$isfirst && $i%10==0) { //Change from %12 to %10 to render table evenly
- print "</td></tr>\n"; //Change to </td></tr> so that each dictionary entry is nestled in its own cell
+ if (!$isfirst && $i%10==0) {
+ print "</td></tr>\n<tr class=".( ($i%4==0) ? "row_odd" : "row_even" ).">";
       } else {
       $isfirst = false;
       }
- if ($i%10==0) {
- print "<td align='left'></td>";
- $i=0;
- }
- $length = strlen($row4[1]);
-
- $padded_row = str_pad($row4[1], 32, " ", STR_PAD_RIGHT);//Does not work yet, will make each cell the same size
- print "<td>{$row4[0]}:";//seperated values to make them easier to read
- print "{$padded_row}\n</td>";
+ print "<td>{$row4[0]}
";//seperated values to make them easier to read
+ print "{$row4[1]}\n</td>";
       $i++;
     }
     print "</td>\n";

TagsNo tags attached.

Activities

apromix007

apromix007

2014-09-08 12:43

reporter  

local_portgenerator.php (22,277 bytes)
adoom42

adoom42

2014-09-08 17:14

administrator   ~0002481

Items in the contribs repository are written and maintained by individuals, not necessarily the RackTables team. Please submit your patch to the original author.

Issue History

Date Modified Username Field Change
2014-09-08 12:43 apromix007 New Issue
2014-09-08 12:43 apromix007 File Added: local_portgenerator.php
2014-09-08 17:14 adoom42 Note Added: 0002481
2014-09-08 17:14 adoom42 Status new => closed
2014-09-08 17:14 adoom42 Resolution open => no change required
2014-09-08 17:14 adoom42 Additional Information Updated