Sfoglia il codice sorgente

FD3-185 se genera la api y el comando para generar los archivos shapes
para levantar al geoserver.

Maximiliano Schvindt 7 anni fa
parent
commit
250f619285

+ 1 - 1
bin/symfony_requirements

@@ -1,7 +1,7 @@
 #!/usr/bin/env php
 <?php
 
-require_once dirname(__FILE__).'/./SymfonyRequirements.php';
+require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
 
 $lineSize = 70;
 $symfonyRequirements = new SymfonyRequirements();

+ 2 - 2
composer.lock

@@ -1584,7 +1584,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/GeoserverBundle.git",
-                "reference": "d0e5ae5191f80dce9af3eec156198cfef359dbd9"
+                "reference": "bc997a4054624f1228769c4a4f9911428424e097"
             },
             "type": "library",
             "autoload": {
@@ -1597,7 +1597,7 @@
                 "Flowdat 3",
                 "Geoserver"
             ],
-            "time": "2017-08-24 18:28:51"
+            "time": "2017-08-25 13:15:01"
         },
         {
             "name": "ik/statsd-bundle",

+ 1 - 0
src/StatsBundle/Command/GenerateCrontabCommand.php

@@ -95,6 +95,7 @@ class GenerateCrontabCommand extends ContainerAwareCommand
                 $commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$mark}:pon:octets {$params}";
                 
                 $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:onu --olt-device-id={$deviceId} --olt-server-id={$serverId}";
+                $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:onu:geo --olt-server-id={$serverId}";
                 
                 fwrite($handle, PHP_EOL."# OLT {$oltName} ({$deviceIp})".PHP_EOL);
                 

+ 20 - 1
src/StatsBundle/Command/StatsGeoOnuCommand.php

@@ -32,6 +32,11 @@ class StatsGeoOnuCommand extends BaseCommand
     {
         parent::execute($input, $output);
 
+        if(!$this->getContainer()->getParameter('geoserver_service')) {
+            $output->writeln(sprintf('<error>Geoserver Service false</error>',array()));
+            return;
+        }
+
         $oltServerId = (int) $input->getOption('olt-server-id');
 
         $now = date("d-m-Y H:i:s");
@@ -103,6 +108,7 @@ class StatsGeoOnuCommand extends BaseCommand
                     }
                 }
                 
+                $row['properties']["muestreo"] = date("d-m H:i");
                 $geo['features'][] = $row;
             }
 
@@ -128,7 +134,7 @@ class StatsGeoOnuCommand extends BaseCommand
                     chown($dir, "www-data");
                 }
                 
-                $file = fopen($dir."/"."{$file_name}.json", "a+");
+                $file = fopen($dir."/"."{$file_name}.json", "w+");
                 fwrite($file, $geoJson);
                 
                 
@@ -139,6 +145,19 @@ class StatsGeoOnuCommand extends BaseCommand
                     $geoserver = $this->getContainer()->get('geoserver.api');
                     $geoserver->createWorkspace($workspace);
                     $geoserver->updateShape($workspace);
+                    
+                    $rest = $geoserver->getUrlRest();
+                    $styles = array();
+                    foreach(array("onuRxPower","onuTxPower","onuStatus") as $k => $style) 
+                    {   
+                        $styles[] = "<style><name>{$style}</name><atom:link rel='alternate' href='{$rest}/styles/{$style}.xml' type='application/xml'/></style>";
+                    }
+                    
+                    $stylesXml = "<layer><styles class='linked-hash-set'>".implode("",$styles)."</styles></layer>";
+                    
+                    $rest = "layers/{$file_name}.xml";
+                    $geoserver->putData($rest, $stylesXml);
+                    
                 }
 
             }

+ 1 - 1
web/config.php

@@ -22,7 +22,7 @@ if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
     exit('This script is only accessible from localhost.');
 }
 
-require_once dirname(__FILE__).'/./SymfonyRequirements.php';
+require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
 
 $symfonyRequirements = new SymfonyRequirements();