r4335 JunOS 802.1q function now supports live portconfig feature
authorAlexey Andriyanov <alan@al-an.info>
Mon, 14 Mar 2011 15:50:56 +0000 (15:50 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Mon, 14 Mar 2011 15:50:56 +0000 (15:50 +0000)
jun10Read8021QConfig: portconfig is now stored in ['config'] key of result

wwwroot/css/pi.css
wwwroot/inc/deviceconfig.php

index 57f73dab9a5174bf24c28028298fc8d84ebf4849..5a973c90792946bcb9d8c6eb3668a134f2758034 100644 (file)
@@ -594,6 +594,7 @@ a.toggleTreeMode {
        background-color: #FFFFFF;
        padding: 5px;
        font-family: monospace;
+       white-space: pre;
 }
 
 /*header line in port conf popup div*/
index 131662aa1e838f7447b56d61c91959d00fdc3d23..a91d4ea4beef9442b1f94643068ca5f4d62b9263 100644 (file)
@@ -1347,6 +1347,7 @@ function jun10Read8021QConfig ($input)
        while (count ($lines))
        {
                $line = array_shift ($lines);
+               $line_class = 'line-other';
                if (preg_match ('/# END OF CONFIG|^(interface-range )?(\S+)\s+{$/', $line, $m)) // line starts with interface name
                { // found interface section opening, or end-of-file
                        if (isset ($current['name']) and $current['is_ethernet'])
@@ -1383,7 +1384,9 @@ function jun10Read8021QConfig ($input)
                                        'mode' => NULL,
                                        'allowed' => NULL,
                                        'native' => NULL,
+                                       'config' => array(),
                                );
+                               $line_class = 'line-header';
                                $current['indent'] = NULL;
                        }
                }
@@ -1398,6 +1401,7 @@ function jun10Read8021QConfig ($input)
                        $current['indent'] = NULL;
                elseif ($current['is_ethernet'] and isset ($current['indent']))
                {
+                       $line_class = 'line-8021q';
                        if (preg_match ('/^\s+port-mode (trunk|access);/', $line, $m))
                                $current['config']['mode'] = $m[1];
                        elseif (preg_match ('/^\s+native-vlan-id (\d+);/', $line, $m))
@@ -1422,7 +1426,11 @@ function jun10Read8021QConfig ($input)
                                }
                                $current['config']['allowed'] = array_unique ($members);
                        }
+                       else
+                               $line_class = 'line-other';
                }
+               if (is_array ($current['config']))
+                       $current['config']['config'][] = array ('type' => $line_class, 'line' => $line);
        }
        
        return $ret;