Commit bc4627011b83085019cd5490b70893e1ec0cf85a

Authored by Fellipe
0 parents
Exists in master and in 2 other branches 3,1, 3.1

first commit

Showing 102 changed files with 10227 additions and 0 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 102 files displayed.

CocarBundle.php 0 → 100755
  1 +++ a/CocarBundle.php
... ... @@ -0,0 +1,9 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle;
  4 +
  5 +use Symfony\Component\HttpKernel\Bundle\Bundle;
  6 +
  7 +class CocarBundle extends Bundle
  8 +{
  9 +}
... ...
Command/CronCommand.php 0 → 100755
  1 +++ a/Command/CronCommand.php
... ... @@ -0,0 +1,130 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Command;
  4 +
  5 +use Symfony\Component\Console\Command\Command;
  6 +use Symfony\Component\Console\Input\InputArgument;
  7 +use Symfony\Component\Console\Input\InputInterface;
  8 +use Symfony\Component\Console\Input\InputOption;
  9 +use Symfony\Component\Console\Output\OutputInterface;
  10 +
  11 +class CronCommand extends Command
  12 +{
  13 + /**
  14 + *
  15 + * @var type object
  16 + */
  17 + private $em;
  18 +
  19 + protected function configure()
  20 + {
  21 + $this
  22 + ->setName('perform:task')
  23 + ->setDescription('Run scheduled tasks')
  24 + ->addOption(
  25 + 'monitor',
  26 + null,
  27 + InputOption::VALUE_NONE
  28 + )
  29 + ->addOption(
  30 + 'status',
  31 + null,
  32 + InputOption::VALUE_NONE
  33 + )
  34 + ->addOption(
  35 + 'reliability',
  36 + null,
  37 + InputOption::VALUE_NONE
  38 + )
  39 + ->addOption(
  40 + 'rrdlog',
  41 + null,
  42 + InputOption::VALUE_NONE
  43 + )
  44 + ->addOption(
  45 + 'dailyperform',
  46 + null,
  47 + InputOption::VALUE_NONE
  48 + )
  49 + ->addOption(
  50 + 'generatealarm',
  51 + null,
  52 + InputOption::VALUE_NONE
  53 + )
  54 + ->addOption(
  55 + 'endalarm',
  56 + null,
  57 + InputOption::VALUE_NONE
  58 + )
  59 + ->addOption(
  60 + 'graphdailyperform',
  61 + null,
  62 + InputOption::VALUE_NONE
  63 + );
  64 + }
  65 +
  66 + protected function execute(InputInterface $input, OutputInterface $output)
  67 + {
  68 + $this->em = $this->getApplication()->getKernel()->getContainer()->get('doctrine')->getManager();
  69 +
  70 + if ($input->getOption('monitor')) {
  71 + $return = $this->performTask('monitor');
  72 + }
  73 + elseif($input->getOption('status')) {
  74 + $return = $this->performTask('status');
  75 + }
  76 + elseif($input->getOption('reliability')) {
  77 + $return = $this->performTask('reliability');
  78 + }
  79 + elseif($input->getOption('rrdlog')) {
  80 + $return = $this->performTask('rrdlog');
  81 + }
  82 + elseif($input->getOption('dailyperform')) {
  83 + $return = $this->performTask('dailyperform');
  84 + }
  85 + elseif($input->getOption('generatealarm')) {
  86 + $return = $this->performTask('generatealarm');
  87 + }
  88 + elseif($input->getOption('endalarm')) {
  89 + $return = $this->performTask('endalarm');
  90 + }
  91 + elseif($input->getOption('graphdailyperform')) {
  92 + $return = $this->performTask('graphdailyperform');
  93 + }
  94 +
  95 + $output->writeln($return);
  96 + }
  97 +
  98 + private function performTask($task)
  99 + {
  100 + try
  101 + {
  102 + $r = file_get_contents($this->getApplication()->getKernel()->getContainer()->get('router')
  103 + ->generate("cocar_$task", array(), true));
  104 +
  105 + echo $r;die;
  106 +
  107 + if($task == 'monitor')
  108 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/monitor");
  109 + elseif($task == 'status')
  110 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/status");
  111 + elseif($task == 'reliability')
  112 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/reliability");
  113 + elseif($task == 'rrdlog')
  114 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/rrdlog");
  115 + elseif($task == 'dailyperform')
  116 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/dailyperform");
  117 + elseif($task == 'generatealarm')
  118 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/generatealarm");
  119 + elseif($task == 'endalarm')
  120 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/endalarm");
  121 + elseif($task == 'graphdailyperform')
  122 + file_get_contents("http://localhost/projeto-cocar/web/app_dev.php/cocar/graphdailyperform");
  123 + }
  124 + catch(Exception $e)
  125 + {
  126 + return "An unexpected: $task";
  127 + }
  128 + return "Task executed: $task";
  129 + }
  130 +}
0 131 \ No newline at end of file
... ...
Controller/AlarmController.php 0 → 100755
  1 +++ a/Controller/AlarmController.php
... ... @@ -0,0 +1,159 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +class AlarmController extends Controller
  12 +{
  13 + private $dir;
  14 +
  15 + /**
  16 + * @Route("/generatealarm", name="cocar_generatealarm")
  17 + * @Template()
  18 + */
  19 + public function generateAlarmAction()
  20 + {
  21 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  22 +
  23 + $em = $this->getDoctrine()->getManager();
  24 +
  25 + $circuits = $em->createQuery(
  26 + "SELECT c FROM CocarBundle:Circuits c
  27 + WHERE c.generateAlarm = :alarm
  28 + AND c.manages <> :manage
  29 + AND c.status = 'UP'"
  30 + )
  31 + ->setParameter('alarm', true)
  32 + ->setParameter('manage', 'Entidades Externas')
  33 + ->getResult();
  34 +
  35 + foreach($circuits as $cir)
  36 + {
  37 + $media_in = 0;
  38 + $media_out = 0;
  39 + $qtd = 0;
  40 +
  41 + $rrd = $cir->getId() . ".rrd";
  42 +
  43 + if(file_exists($this->dir . $rrd))
  44 + {
  45 + $fim = (date('U')) - 60;
  46 + $inicio = $fim - 720;
  47 + $com = "rrdtool fetch $this->dir$rrd AVERAGE --start $inicio --end $fim | sed -e \"s/ds[01]//g\" |
  48 + sed \"s/nan/0/g\" | tr \":\" \" \" | tr -s \" \" | sed -e \"s/ \$//\" | grep -v \"^\$\" |tail -10";
  49 +
  50 + $linhas = explode("\n", shell_exec($com));
  51 +
  52 + for ($i=0; $i < count($linhas) - 1; $i++)
  53 + {
  54 + $campos = explode(" ", $linhas[$i]);
  55 + $data = strftime("%Y-%m-%d %H:%M:%S",$campos[0]);
  56 + $vol_in = $this->calc($campos[1]);
  57 + $vol_out = $this->calc($campos[2]);
  58 +
  59 + if ($data != "1970-01-01 00:00:00" && $data != "1969-12-31 21:00:00")
  60 + {
  61 + $media_in += $vol_in;
  62 + $media_out += $vol_out;
  63 + $qtd++;
  64 + }
  65 + }
  66 +
  67 + $history = strtoupper($cir->getHistory());
  68 + $hist_novo = "N";
  69 +
  70 + if ($qtd != 0)
  71 + {
  72 + # INICIO DO TRATAMENTO COMO CIRCUITO
  73 + $media_in = round(($media_in * 0.008)/$qtd, 1);
  74 + $media_out = round(($media_out * 0.008)/$qtd, 1);
  75 +
  76 + if (strtolower($cir->getTypeInterface()) == "circuito" && (!preg_match("/ETH/i", $cir->getSerialBackbone())))
  77 + {
  78 + $cir_in = round(($cir->getCirIn() * 1.2), 1);
  79 + $cir_out = round(($cir->getCirOut() * 1.2), 1);
  80 +
  81 + if ($media_in > $cir_in || $media_out > $cir_out)
  82 + {
  83 + if($history != "A1" && $history != "A2")
  84 + $hist_novo = "A1";
  85 + elseif($history == "A1" || $history == "A2")
  86 + $hist_novo = "A2";
  87 + }
  88 + elseif($media_out == 0.0 || $media_in == 0.0 )
  89 + {
  90 + if($history != "Z1" && $history != "Z2" )
  91 + $hist_novo = "Z1";
  92 + elseif($history == "Z1" || $history == "Z2")
  93 + $hist_novo = "Z2";
  94 + }
  95 + }
  96 + else
  97 + {
  98 + # INICIO DO TRATAMENTO COMO CONCENTRADORA
  99 + $porta = round(($cir->getSpeed() * 0.85), 1);
  100 +
  101 + if ($media_in > $porta || $media_out > $porta)
  102 + {
  103 + if ($history != "A1" && $history != "A2")
  104 + $hist_novo = "A1";
  105 + elseif($history == "A1" || $history == "A2")
  106 + $hist_novo = "A2";
  107 + }
  108 + elseif ($media_out == 0.0 || $media_in == 0.0 )
  109 + {
  110 + if($history != "Z1" && $history != "Z2")
  111 + $hist_novo = "Z1";
  112 + elseif($history == "Z1" || $history == "Z2")
  113 + $hist_novo = "Z2";
  114 + }
  115 + }
  116 + }
  117 + else
  118 + {
  119 + $arq = strftime("%d-%m-%Y", $fim);
  120 + $fp = fopen($this->dir."logs/".$arq.".log", 'a');
  121 + $info = "Arquivo RRD: $rrd";
  122 + }
  123 +
  124 + $cir->setHistory($hist_novo);
  125 +
  126 + $em->persist($cir);
  127 + $em->flush();
  128 + }
  129 + }
  130 +
  131 + return new Response();
  132 + }
  133 +
  134 + /**
  135 + * @Route("/endalarm", name="cocar_endalarm")
  136 + * @Template()
  137 + */
  138 + public function endAlarmAction()
  139 + {
  140 + $em = $this->getDoctrine()->getManager();
  141 +
  142 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  143 +
  144 + foreach ($circuits as $cir) {
  145 + $cir->setHistory('N');
  146 +
  147 + $em->persist($cir);
  148 + $em->flush();
  149 + }
  150 + return new Response();
  151 + }
  152 +
  153 + public function calc($value)
  154 + {
  155 + $value = strtr($value, ",", ".");
  156 + settype ($value, 'double');
  157 + return round($value,1);
  158 + }
  159 +}
0 160 \ No newline at end of file
... ...
Controller/CircuitsController.php 0 → 100755
  1 +++ a/Controller/CircuitsController.php
... ... @@ -0,0 +1,213 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Component\HttpFoundation\Request;
  6 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  10 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  11 +
  12 +use GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits;
  13 +use GerenciadorRedes\Bundle\CocarBundle\Form\CircuitsType;
  14 +
  15 +/**
  16 + * Circuits controller.
  17 + *
  18 + * @Route("/circuits")
  19 + */
  20 +class CircuitsController extends Controller
  21 +{
  22 +
  23 + /**
  24 + * Lists all Circuits entities.
  25 + *
  26 + * @Route("/", name="circuits")
  27 + * @Method("GET")
  28 + * @Template()
  29 + */
  30 + public function indexAction()
  31 + {
  32 + $em = $this->getDoctrine()->getManager();
  33 +
  34 + $entity = new Circuits();
  35 +
  36 + $entities = $em->getRepository('GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits')->findAll();
  37 +
  38 + return array(
  39 + 'entities' => $entities,
  40 + );
  41 + }
  42 + /**
  43 + * Creates a new Circuits entity.
  44 + *
  45 + * @Route("/", name="circuits_create")
  46 + * @Method("POST")
  47 + * @Template("CocarBundle:Circuits:new.html.twig")
  48 + */
  49 + public function createAction(Request $request)
  50 + {
  51 + $entity = new Circuits();
  52 + $form = $this->createForm(new CircuitsType(), $entity);
  53 + $form->submit($request);
  54 +
  55 + if ($form->isValid()) {
  56 + $em = $this->getDoctrine()->getManager();
  57 + $em->persist($entity);
  58 + $em->flush();
  59 +
  60 + return $this->redirect($this->generateUrl('circuits_show', array('id' => $entity->getId())));
  61 + }
  62 +
  63 + return array(
  64 + 'entity' => $entity,
  65 + 'form' => $form->createView(),
  66 + );
  67 + }
  68 +
  69 + /**
  70 + * Displays a form to create a new Circuits entity.
  71 + *
  72 + * @Route("/new", name="circuits_new")
  73 + * @Method("GET")
  74 + * @Template()
  75 + */
  76 + public function newAction()
  77 + {
  78 + $entity = new Circuits();
  79 + $form = $this->createForm(new CircuitsType(), $entity);
  80 +
  81 + return array(
  82 + 'entity' => $entity,
  83 + 'form' => $form->createView(),
  84 + );
  85 + }
  86 +
  87 + /**
  88 + * Finds and displays a Circuits entity.
  89 + *
  90 + * @Route("/{id}", name="circuits_show")
  91 + * @Method("GET")
  92 + * @Template()
  93 + */
  94 + public function showAction($id)
  95 + {
  96 + $em = $this->getDoctrine()->getManager();
  97 +
  98 + $entity = $em->getRepository('CocarBundle:Circuits')->find($id);
  99 +
  100 + if (!$entity) {
  101 + throw $this->createNotFoundException('Unable to find Circuits entity.');
  102 + }
  103 +
  104 + $deleteForm = $this->createDeleteForm($id);
  105 +
  106 + return array(
  107 + 'entity' => $entity,
  108 + 'delete_form' => $deleteForm->createView(),
  109 + );
  110 + }
  111 +
  112 + /**
  113 + * Displays a form to edit an existing Circuits entity.
  114 + *
  115 + * @Route("/{id}/edit", name="circuits_edit")
  116 + * @Method("GET")
  117 + * @Template()
  118 + */
  119 + public function editAction($id)
  120 + {
  121 + $em = $this->getDoctrine()->getManager();
  122 +
  123 + $entity = $em->getRepository('CocarBundle:Circuits')->find($id);
  124 +
  125 + if (!$entity) {
  126 + throw $this->createNotFoundException('Unable to find Circuits entity.');
  127 + }
  128 +
  129 + $editForm = $this->createForm(new CircuitsType(), $entity);
  130 + $deleteForm = $this->createDeleteForm($id);
  131 +
  132 + return array(
  133 + 'entity' => $entity,
  134 + 'edit_form' => $editForm->createView(),
  135 + 'delete_form' => $deleteForm->createView(),
  136 + );
  137 + }
  138 +
  139 + /**
  140 + * Edits an existing Circuits entity.
  141 + *
  142 + * @Route("/{id}", name="circuits_update")
  143 + * @Method("PUT")
  144 + * @Template("CocarBundle:Circuits:edit.html.twig")
  145 + */
  146 + public function updateAction(Request $request, $id)
  147 + {
  148 + $em = $this->getDoctrine()->getManager();
  149 +
  150 + $entity = $em->getRepository('CocarBundle:Circuits')->find($id);
  151 +
  152 + if (!$entity) {
  153 + throw $this->createNotFoundException('Unable to find Circuits entity.');
  154 + }
  155 +
  156 + $deleteForm = $this->createDeleteForm($id);
  157 + $editForm = $this->createForm(new CircuitsType(), $entity);
  158 + $editForm->submit($request);
  159 +
  160 + if ($editForm->isValid()) {
  161 + $em->persist($entity);
  162 + $em->flush();
  163 +
  164 + return $this->redirect($this->generateUrl('circuits_edit', array('id' => $id)));
  165 + }
  166 +
  167 + return array(
  168 + 'entity' => $entity,
  169 + 'edit_form' => $editForm->createView(),
  170 + 'delete_form' => $deleteForm->createView(),
  171 + );
  172 + }
  173 + /**
  174 + * Deletes a Circuits entity.
  175 + *
  176 + * @Route("/{id}", name="circuits_delete")
  177 + * @Method("DELETE")
  178 + */
  179 + public function deleteAction(Request $request, $id)
  180 + {
  181 + $form = $this->createDeleteForm($id);
  182 + $form->submit($request);
  183 +
  184 + if ($form->isValid()) {
  185 + $em = $this->getDoctrine()->getManager();
  186 + $entity = $em->getRepository('CocarBundle:Circuits')->find($id);
  187 +
  188 + if (!$entity) {
  189 + throw $this->createNotFoundException('Unable to find Circuits entity.');
  190 + }
  191 +
  192 + $em->remove($entity);
  193 + $em->flush();
  194 + }
  195 +
  196 + return $this->redirect($this->generateUrl('circuits'));
  197 + }
  198 +
  199 + /**
  200 + * Creates a form to delete a Circuits entity by id.
  201 + *
  202 + * @param mixed $id The entity id
  203 + *
  204 + * @return \Symfony\Component\Form\Form The form
  205 + */
  206 + private function createDeleteForm($id)
  207 + {
  208 + return $this->createFormBuilder(array('id' => $id))
  209 + ->add('id', 'hidden')
  210 + ->getForm()
  211 + ;
  212 + }
  213 +}
... ...
Controller/DailyPerformController.php 0 → 100755
  1 +++ a/Controller/DailyPerformController.php
... ... @@ -0,0 +1,404 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Entity\DailyPerformance;
  12 +
  13 +class DailyPerformController extends Controller
  14 +{
  15 + /**
  16 + * @Route("/dailyperform", name="cocar_dailyperform")
  17 + * @Template()
  18 + */
  19 + public function dailyPerformanceAction()
  20 + {
  21 + set_time_limit(0);
  22 +
  23 + $em = $this->getDoctrine()->getManager();
  24 +
  25 + #puxar o id do circuito
  26 + $circuits = $em->createQuery(
  27 + "SELECT c FROM CocarBundle:Circuits c
  28 + WHERE c.operStatus = 'UP'"
  29 + )->getResult();
  30 +
  31 + foreach($circuits as $cir)
  32 + {
  33 + $perform = new DailyPerformance();
  34 +
  35 + $speed = $cir->getSpeed();
  36 + $codInterface = $cir->getId();
  37 + $cirIn = $cir->getCirIn();
  38 + $cirOut = $cir->getCirOut();
  39 +
  40 + if ($cirIn == 0)
  41 + {
  42 + $cirIn = $speed * 0.85;
  43 + $cirOut = $speed * 0.85;
  44 + }
  45 +
  46 + $arq = strtr($codInterface, ".", "_");
  47 +
  48 + $day = strftime('%Y-%m-%d', (date('U')-86400));
  49 + $startDate = $day . " 07:00:00";
  50 + $endDate = $day . " 19:00:00";
  51 +
  52 + $sum = $em->createQuery(
  53 + "SELECT SUM(r.volumeIn) as vin, SUM(r.volumeOut) as vout FROM CocarBundle:Rrd r
  54 + WHERE (r.datetime >= :start AND r.datetime <= :end)
  55 + AND(r.codeInterface = :code)"
  56 + )
  57 + ->setParameter('start', $day . " 00:00:00")
  58 + ->setParameter('end', $day . " 23:59:00")
  59 + ->setParameter('code', $codInterface)
  60 + ->getOneOrNullResult();
  61 +
  62 + if(!empty($sum))
  63 + {
  64 + $volIn = $sum['vin'] * 60;
  65 + $volOut = $sum['vout'] * 60;
  66 +
  67 + # CALCULA HMM IN: HORA, MEDIA, PICO, CRITICIDADE
  68 + $hmmIn =
  69 + $this->HMM(array(
  70 + 'code' => $codInterface,
  71 + 'field' => "volumeIn",
  72 + 'hStart' => 0,
  73 + 'hEnd' => 23,
  74 + 'cir' => $cirIn,
  75 + 'day' => $day
  76 + ));
  77 + if(isset($hmmIn[0]))
  78 + $hourHMMIn = $hmmIn[0] . ":" . $hmmIn[1] . ":00";
  79 +
  80 + # CALCULA HMM OUT: HORA, MEDIA, PICO, CRITICIDADE
  81 + $hmmOut =
  82 + $this->HMM(array(
  83 + 'code' => $codInterface,
  84 + 'field' => "volumeOut",
  85 + 'hStart' => 0,
  86 + 'hEnd' => 23,
  87 + 'cir' => $cirOut,
  88 + 'day' => $day
  89 + ));
  90 +
  91 + if(isset($hmmOut[0]))
  92 + $hourHMMOut = $hmmOut[0] . ":" . $hmmOut[1] . ":00";
  93 +
  94 + # CALCULA HMM IN NO PERIODO : HORA, MEDIA, PICO, CRITICIDADE
  95 + $hmmInPer =
  96 + $this->HMM(array(
  97 + 'code' => $codInterface,
  98 + 'field' => "volumeIn",
  99 + 'hStart' => 7,
  100 + 'hEnd' => 18,
  101 + 'cir' => $cirIn,
  102 + 'day' => $day
  103 + ));
  104 + if(isset($hmmInPer[0]))
  105 + $hourHMMInPer = $hmmInPer[0] . ":" . $hmmInPer[1] . ":00";
  106 +
  107 + # CALCULA HMM OUT NO PERIODO: HORA, MEDIA, PICO, CRITICIDADE
  108 + $hmmOutPer =
  109 + $this->HMM(array(
  110 + 'code' => $codInterface,
  111 + 'field' => "volumeOut",
  112 + 'hStart' => 7,
  113 + 'hEnd' => 18,
  114 + 'cir' => $cirOut,
  115 + 'day' => $day
  116 + ));
  117 + if(isset($hmmOutPer[0]))
  118 + $hourHMMOutPer = $hmmOutPer[0] . ":" . $hmmOutPer[1] . ":00";
  119 +
  120 + # CALCULA PERIODO IN: HORA, MEDIA, PICO, CRITICIDADE
  121 + for($i=1;$i<=4;$i++)
  122 + {
  123 + $peak =
  124 + $this->periodMax(array(
  125 + 'code' => $codInterface,
  126 + 'field' => ($i%2 == 0) ? "volumeIn" : "volumeOut",
  127 + 'startDate' => $startDate,
  128 + 'endDate' => $endDate,
  129 + 'cir' => ($i%2 == 0) ? $cirIn : $cirOut
  130 + ));
  131 +
  132 + $media =
  133 + $this->periodSum(array(
  134 + 'code' => $codInterface,
  135 + 'field' => ($i%2 == 0) ? "volumeIn" : "volumeOut",
  136 + 'startDate' => $startDate,
  137 + 'endDate' => $endDate,
  138 + 'cir' => ($i%2 == 0) ? $cirIn : $cirOut
  139 + ));
  140 +
  141 + $criticality =
  142 + $this->periodField(array(
  143 + 'code' => $codInterface,
  144 + 'field' => ($i%2 == 0) ? "volumeIn" : "volumeOut",
  145 + 'startDate' => $startDate,
  146 + 'endDate' => $endDate,
  147 + 'cir' => ($i%2 == 0) ? $cirIn : $cirOut
  148 + ));
  149 +
  150 + if($i%2 == 0)
  151 + {
  152 + $perform->set719PeakIn($peak);
  153 + $perform->set719MediaIn($media);
  154 + $perform->set719CriticalityIn($criticality);
  155 + }
  156 + else
  157 + {
  158 + $perform->set719PeakOut($peak);
  159 + $perform->set719MediaOut($media);
  160 + $perform->set719CriticalityOut($criticality);
  161 + }
  162 + }
  163 +
  164 + $recommendedCircuitIn =
  165 + $this->recommendedCircuit(array(
  166 + 'code' => $codInterface,
  167 + 'field' => "volumeIn",
  168 + 'startDate' => $startDate,
  169 + 'endDate' => $endDate
  170 + ));
  171 +
  172 + $recommendedCircuitOut =
  173 + $this->recommendedCircuit(array(
  174 + 'code' => $codInterface,
  175 + 'field' => "volumeOut",
  176 + 'startDate' => $startDate,
  177 + 'endDate' => $endDate
  178 + ));
  179 +
  180 + $perform->setCodeInterface($codInterface);
  181 + $perform->setDay(new \DateTime($day));
  182 + $perform->setCirIn($cirIn);
  183 + $perform->setCirOut($cirOut);
  184 + $perform->setCirInRec($recommendedCircuitIn);
  185 + $perform->setCirOutRec($recommendedCircuitOut);
  186 + $perform->setVolumeIn($volIn);
  187 + $perform->setVolumeOut($volOut);
  188 + $perform->setLossInHour(new \DateTime('00:00:00'));
  189 + $perform->setLossOutHour(new \DateTime('00:00:00'));
  190 + $perform->setHmmHourIn(isset($hourHMMIn) ? new \DateTime($hourHMMIn) : new \DateTime('00:00:00'));
  191 + $perform->setHmmHourOut(isset($hourHMMOut) ? new \DateTime($hourHMMOut) : new \DateTime('00:00:00'));
  192 + $perform->setHmmPeakIn(isset($hmmIn[3]) ? $hmmIn[3] : 0);
  193 + $perform->setHmmPeakOut(isset($hmmOut[3]) ? $hmmOut[3] : 0);
  194 + $perform->setHmmMediaIn(isset($hmmIn[2]) ? $hmmIn[2] : 0);
  195 + $perform->setHmmMediaOut(isset($hmmOut[2]) ? $hmmOut[2] : 0);
  196 + $perform->setHmmCriticalityIn(isset($hmmIn[4]) ? $hmmIn[4] : 0);
  197 + $perform->setHmmCriticalityOut(isset($hmmOut[4]) ? $hmmOut[4] : 0);
  198 + $perform->setHmmHourInPer(isset($hourHMMInPer) ? new \DateTime($hourHMMInPer) : new \DateTime('00:00:00'));
  199 + $perform->setHmmHourOutPer(isset($hourHMMOutPer) ? new \DateTime($hourHMMOutPer) : new \DateTime('00:00:00'));
  200 + $perform->setHmmPeakInPer(isset($hmmInPer[3]) ? $hmmInPer[3] : 0);
  201 + $perform->setHmmPeakOutPer(isset($hmmOutPer[3]) ? $hmmOutPer[3] : 0);
  202 + $perform->setHmmMediaInPer(isset($hmmInPer[2]) ? $hmmInPer[2] : 0);
  203 + $perform->setHmmMediaOutPer(isset($hmmOutPer[2]) ? $hmmOutPer[2] : 0);
  204 + $perform->setHmmCriticalityInPer(isset($hmmInPer[4]) ? $hmmInPer[4] : 0);
  205 + $perform->setHmmCriticalityOutPer(isset($hmmOutPer[4]) ? $hmmOutPer[4] : 0);
  206 +
  207 + $em->persist($perform);
  208 + $em->flush();
  209 + }
  210 + }
  211 + return new Response();
  212 + }
  213 +
  214 + public function HMM ($params = array())
  215 + {
  216 + if(!empty($params))
  217 + {
  218 + $bytesHMM = 0;
  219 +
  220 + for ($h=$params['hStart'];$h<=$params['hEnd'];$h++)
  221 + {
  222 + for ($m=0;$m<60;$m++)
  223 + {
  224 + $hour = $params['day']." ".$h.":".$m.":00";
  225 + $hHMM = $h + 1;
  226 + $hHMM = ($hHMM == 24) ? 23 : $hHMM;
  227 + $hour60min = $params['day']." ".$hHMM.":".$m.":00";
  228 +
  229 + $sum = $this->getDoctrine()->getManager()->createQuery("SELECT SUM(r.volumeIn) as volumeIn, SUM (r.volumeOut) as volumeOut FROM CocarBundle:Rrd r
  230 + WHERE (r.datetime >= :start)
  231 + AND(r.datetime <= :end)
  232 + AND(r.codeInterface = :code)"
  233 + )
  234 + ->setParameter('start', $hour)
  235 + ->setParameter('end', $hour60min)
  236 + ->setParameter('code', $params['code'])
  237 + ->getOneOrNullResult();
  238 +
  239 + if ($sum[$params['field']] > $bytesHMM)
  240 + {
  241 + $vectorHMM[0] = $h;
  242 + $vectorHMM[1] = $m;
  243 + $vectorHMM[2] = (8/60000) * $sum[$params['field']];
  244 + }
  245 + }
  246 + }
  247 +
  248 + if(isset($vectorHMM))
  249 + {
  250 + $hour = $params['day']." ".$vectorHMM[0].":".$vectorHMM[1].":00";
  251 + $hHMM = $vectorHMM[0] + 1;
  252 + $hour60min = $params['day']." ".$hHMM.":".$vectorHMM[1].":00";
  253 +
  254 + $max = $this->periodMax(
  255 + array(
  256 + 'field' => $params['field'],
  257 + 'startDate' => $hour,
  258 + 'endDate' => $hour60min,
  259 + 'code' => $params['code']
  260 + ));
  261 +
  262 + if(!empty($max))
  263 + {
  264 + $vectorHMM[3] = (8/1000) * $max;
  265 +
  266 + $field = $this->getDoctrine()->getManager()->createQuery("SELECT COUNT(r.volumeIn) as volumeIn, COUNT(r.volumeOut) as volumeOut FROM CocarBundle:Rrd r
  267 + WHERE (r.datetime >= :start)
  268 + AND(r.datetime < :end)
  269 + AND(r.codeInterface = :code)
  270 + AND(:field > :cir)"
  271 + )
  272 + ->setParameter('start', $max['startDate'])
  273 + ->setParameter('end', $max['endDate'])
  274 + ->setParameter('code', $params['code'])
  275 + ->setParameter('field', $params['field'])
  276 + ->setParameter('cir', $params['cir']*(1000/8))
  277 + ->getOneOrNullResult();
  278 +
  279 + if(!empty($field))
  280 + $vectorHMM[4] = (100/60) * $field[$params['field']];
  281 + }
  282 + return $vectorHMM;
  283 + }
  284 + }
  285 + return array();
  286 + }
  287 +
  288 + public function periodMax($params = array())
  289 + {
  290 + if(!empty($params))
  291 + {
  292 + $max = $this->getDoctrine()->getManager()->createQuery("SELECT MAX(r.volumeIn) as volumeIn, MAX(r.volumeOut) as volumeOut FROM CocarBundle:Rrd r
  293 + WHERE (r.datetime >= :start)
  294 + AND(r.datetime < :end)
  295 + AND(r.codeInterface = :code)"
  296 + )
  297 + ->setParameter('start', $params['startDate'])
  298 + ->setParameter('end', $params['endDate'])
  299 + ->setParameter('code', $params['code'])
  300 + ->getOneOrNullResult();
  301 +
  302 + return (!empty($max)) ? (8/1000) * $max[$params['field']] : null;
  303 +
  304 + }
  305 + return null;
  306 + }
  307 +
  308 + public function periodSum($params = array())
  309 + {
  310 + if(!empty($params))
  311 + {
  312 + $sum = $this->getDoctrine()->getManager()->createQuery("SELECT SUM(r.volumeIn) as volumeIn, SUM (r.volumeOut) as volumeOut FROM CocarBundle:Rrd r
  313 + WHERE (r.datetime >= :start)
  314 + AND(r.datetime < :end)
  315 + AND(r.codeInterface = :code)"
  316 + )
  317 + ->setParameter('start', $params['startDate'])
  318 + ->setParameter('end', $params['endDate'])
  319 + ->setParameter('code', $params['code'])
  320 + ->getOneOrNullResult();
  321 +
  322 + return (!empty($sum)) ? (8/720000) * $sum[$params['field']] : null;
  323 + }
  324 + return null;
  325 + }
  326 +
  327 + public function periodField($params = array())
  328 + {
  329 + if(!empty($params))
  330 + {
  331 + $field = $this->getDoctrine()->getManager()->createQuery("SELECT COUNT(r.volumeIn) as volumeIn, COUNT(r.volumeOut) as volumeOut FROM CocarBundle:Rrd r
  332 + WHERE (r.datetime >= :start)
  333 + AND(r.datetime < :end)
  334 + AND(r.codeInterface = :code)
  335 + AND(:field > :cir)"
  336 + )
  337 + ->setParameter('start', $params['startDate'])
  338 + ->setParameter('end', $params['endDate'])
  339 + ->setParameter('code', $params['code'])
  340 + ->setParameter('field', $params['field'])
  341 + ->setParameter('cir', $params['cir']*(1000/8))
  342 + ->getOneOrNullResult();
  343 +
  344 + return (!empty($field)) ? (100/720) * $field[$params['field']] : null;
  345 + }
  346 + return null;
  347 + }
  348 +
  349 + public function recommendedCircuit($params = array())
  350 + {
  351 + if(!empty($params))
  352 + {
  353 + $recommendCir = array(
  354 + 16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, 288, 320, 352, 384,
  355 + 448, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920
  356 + );
  357 +
  358 + $field = $this->getDoctrine()->getManager()->createQuery("SELECT r.volumeIn as volumeIn, r.volumeOut as volumeOut FROM CocarBundle:Rrd r
  359 + WHERE (r.datetime >= :start AND r.datetime < :end)
  360 + AND(r.codeInterface = :code)"
  361 + )
  362 + ->setParameter('start', $params['startDate'])
  363 + ->setParameter('end', $params['endDate'])
  364 + ->setParameter('code', $params['code'])
  365 + ->getResult();
  366 + $samples = 0;
  367 +
  368 + $cRec = array();
  369 +
  370 + foreach($field as $f)
  371 + {
  372 + $samples++;
  373 + $f[$params['field']] *= (8/1000);
  374 + $cir = round($f[$params['field']], 0);
  375 +
  376 + $start = 0;
  377 + $end = count($recommendCir) -1;
  378 + $middle = ($start + $end)/2;
  379 +
  380 + while (isset($recommendCir[$middle]) && $start != $end && $cir != $recommendCir[$middle])
  381 + {
  382 + if ($cir > $recommendCir[$middle])
  383 + $start = $middle + 1;
  384 + else
  385 + $end = $middle;
  386 +
  387 + $middle = ($start + $end)/2;
  388 + }
  389 +
  390 + $cRec[$middle] = isset($cRec[$middle]) ? $cRec[$middle] += 1 : 1;
  391 + }
  392 +
  393 + $j = -1;
  394 + $x = 0;
  395 + while ($x < (0.95 * $samples) && isset($cRec[$j]))
  396 + {
  397 + $j++;
  398 + $x += $cRec[$j];
  399 + }
  400 +
  401 + return (isset($recommendCir[$j])) ? $recommendCir[$j] : 0;
  402 + }
  403 + }
  404 +}
0 405 \ No newline at end of file
... ...
Controller/DefaultController.php 0 → 100755
  1 +++ a/Controller/DefaultController.php
... ... @@ -0,0 +1,180 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Request;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  11 +
  12 +class DefaultController extends Controller
  13 +{
  14 + /**
  15 + * @Route("/index", name="cocar_index")
  16 + * @Template()
  17 + */
  18 + public function indexAction()
  19 + {
  20 + return array();
  21 + }
  22 +
  23 + /**
  24 + * @Route("/", name="cocar_map")
  25 + * @Template()
  26 + */
  27 + public function mapAction(Request $request)
  28 + {
  29 + $em = $this->getDoctrine()->getManager();
  30 +
  31 + $search = false;
  32 +
  33 + if($request->isMethod('POST'))
  34 + {
  35 + $circuit = $request->request->get('circuit');
  36 +
  37 + $searchResult = $em->createQuery(
  38 + "SELECT c.description, c.id, e.identifier FROM CocarBundle:Circuits c
  39 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  40 + WHERE c.description LIKE :description"
  41 + )
  42 + ->setParameter('description', "%$circuit%")
  43 + ->getResult();
  44 +
  45 + $search = true;
  46 + }
  47 +
  48 + $highTraffic = $em->createQuery(
  49 + "SELECT c.id, c.codeInterface, c.description, e.description entity FROM CocarBundle:Circuits c
  50 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  51 + WHERE c.history LIKE :history
  52 + AND c.manages <> :manage
  53 + AND c.operStatus = :status"
  54 + )
  55 + ->setParameter('history', '%A%')
  56 + ->setParameter('manage', 'Entidades Externas')
  57 + ->setParameter('status', 'UP')
  58 + ->getResult();
  59 +
  60 + $withoutTraffic = $em->createQuery(
  61 + "SELECT c.id, c.codeInterface, c.description, e.description entity FROM CocarBundle:Circuits c
  62 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  63 + WHERE c.history LIKE :history
  64 + AND c.manages <> :manage
  65 + AND c.operStatus = :status"
  66 + )
  67 + ->setParameter('history', '%Z%')
  68 + ->setParameter('manage', 'Entidades Externas')
  69 + ->setParameter('status', 'UP')
  70 + ->getResult();
  71 +
  72 + $reliability = $em->createQuery(
  73 + "SELECT c.id, c.codeInterface, c.description, e.description entity FROM CocarBundle:Circuits c
  74 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  75 + WHERE (c.manages <> :manage1
  76 + AND c.manages <> :manage2)
  77 + AND c.operStatus = :status"
  78 + )
  79 + ->setParameter('manage1', 'Entidades Externas')
  80 + ->setParameter('manage2', 'Firewall')
  81 + ->setParameter('status', 'UP')
  82 + ->getResult();
  83 +
  84 + $total = $em->createQuery(
  85 + "SELECT count(c.id) total FROM CocarBundle:Circuits c
  86 + WHERE c.manages <> :manage
  87 + AND c.operStatus = :status"
  88 + )
  89 + ->setParameter('manage', 'Entidades Externas')
  90 + ->setParameter('status', 'UP')
  91 + ->getSingleResult();
  92 +
  93 + return array(
  94 + 'reliability' => $reliability,
  95 + 'high_traffic' => $highTraffic,
  96 + 'without_traffic' => $withoutTraffic,
  97 + 'total' => $total['total'],
  98 + 'search_result' => isset($searchResult) ? $searchResult : null,
  99 + 'search' => $search
  100 + );
  101 + }
  102 +
  103 + /**
  104 + * @Route("/totalizer", name="cocar_totalizer")
  105 + * @Template()
  106 + */
  107 + public function totalizerAction()
  108 + {
  109 + $em = $this->getDoctrine()->getManager();
  110 +
  111 + $entitys = $em->getRepository('CocarBundle:Entity')->findAll();
  112 +
  113 + foreach ($entitys as $entity)
  114 + {
  115 + $highTraffic = $em->createQuery(
  116 + "SELECT COUNT(c.id) total FROM CocarBundle:Circuits c
  117 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  118 + WHERE c.history LIKE :history
  119 + AND c.manages <> :manage
  120 + AND c.operStatus = :status
  121 + AND e.id = :id"
  122 + )
  123 + ->setParameter('history', '%A%')
  124 + ->setParameter('manage', 'Entidades Externas')
  125 + ->setParameter('status', 'UP')
  126 + ->setParameter('id', $entity->getId())
  127 + ->getSingleResult();
  128 +
  129 + $withoutTraffic = $em->createQuery(
  130 + "SELECT COUNT(c.id) total FROM CocarBundle:Circuits c
  131 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  132 + WHERE c.history LIKE :history
  133 + AND c.manages <> :manage
  134 + AND c.operStatus = :status
  135 + AND e.id = :id"
  136 + )
  137 + ->setParameter('history', '%Z%')
  138 + ->setParameter('manage', 'Entidades Externas')
  139 + ->setParameter('status', 'UP')
  140 + ->setParameter('id', $entity->getId())
  141 + ->getSingleResult();
  142 +
  143 + $reliability = $em->createQuery(
  144 + "SELECT COUNT(c.id) total FROM CocarBundle:Circuits c
  145 + LEFT JOIN CocarBundle:Entity e WITH c.entity = e.id
  146 + WHERE (c.manages <> :manage1
  147 + AND c.manages <> :manage2)
  148 + AND c.operStatus = :status
  149 + AND e.id = :id"
  150 + )
  151 + ->setParameter('manage1', 'Entidades Externas')
  152 + ->setParameter('manage2', 'Firewall')
  153 + ->setParameter('status', 'UP')
  154 + ->setParameter('id', $entity->getId())
  155 + ->getSingleResult();
  156 +
  157 + $total = $em->createQuery(
  158 + "SELECT count(c.id) total FROM CocarBundle:Circuits c
  159 + WHERE c.manages <> :manage
  160 + AND c.operStatus = :status
  161 + AND c.entity = :entity"
  162 + )
  163 + ->setParameter('manage', 'Entidades Externas')
  164 + ->setParameter('status', 'UP')
  165 + ->setParameter('entity', $entity->getId())
  166 + ->getSingleResult();
  167 +
  168 + $circuits[$entity->getId()] = array(
  169 + 'high' => $highTraffic['total'],
  170 + 'without' => $withoutTraffic['total'],
  171 + 'rly' => $reliability['total'],
  172 + 'description' => $entity->getDescription(),
  173 + 'totalCirc' => $highTraffic['total'] + $withoutTraffic['total'] + $reliability['total'],
  174 + 'total' => isset($total['total']) ? $total['total'] : 0
  175 + );
  176 + }
  177 +
  178 + return array('circuits' => $circuits);
  179 + }
  180 +}
... ...
Controller/EntityController.php 0 → 100755
  1 +++ a/Controller/EntityController.php
... ... @@ -0,0 +1,210 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Component\HttpFoundation\Request;
  6 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  7 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Entity\Entity;
  12 +use GerenciadorRedes\Bundle\CocarBundle\Form\EntityType;
  13 +
  14 +/**
  15 + * Entity controller.
  16 + *
  17 + * @Route("/entity")
  18 + */
  19 +class EntityController extends Controller
  20 +{
  21 +
  22 + /**
  23 + * Lists all Entity entities.
  24 + *
  25 + * @Route("/", name="entity")
  26 + * @Method("GET")
  27 + * @Template()
  28 + */
  29 + public function indexAction()
  30 + {
  31 + $em = $this->getDoctrine()->getManager();
  32 +
  33 + $entities = $em->getRepository('CocarBundle:Entity')->findAll();
  34 +
  35 + return array(
  36 + 'entities' => $entities,
  37 + );
  38 + }
  39 + /**
  40 + * Creates a new Entity entity.
  41 + *
  42 + * @Route("/", name="entity_create")
  43 + * @Method("POST")
  44 + * @Template("CocarBundle:Entity:new.html.twig")
  45 + */
  46 + public function createAction(Request $request)
  47 + {
  48 + $entity = new Entity();
  49 + $form = $this->createForm(new EntityType(), $entity);
  50 + $form->submit($request);
  51 +
  52 + if ($form->isValid()) {
  53 + $em = $this->getDoctrine()->getManager();
  54 + $em->persist($entity);
  55 + $em->flush();
  56 +
  57 + return $this->redirect($this->generateUrl('entity_show', array('id' => $entity->getId())));
  58 + }
  59 +
  60 + return array(
  61 + 'entity' => $entity,
  62 + 'form' => $form->createView(),
  63 + );
  64 + }
  65 +
  66 + /**
  67 + * Displays a form to create a new Entity entity.
  68 + *
  69 + * @Route("/new", name="entity_new")
  70 + * @Method("GET")
  71 + * @Template()
  72 + */
  73 + public function newAction()
  74 + {
  75 + $entity = new Entity();
  76 + $form = $this->createForm(new EntityType(), $entity);
  77 +
  78 + return array(
  79 + 'entity' => $entity,
  80 + 'form' => $form->createView(),
  81 + );
  82 + }
  83 +
  84 + /**
  85 + * Finds and displays a Entity entity.
  86 + *
  87 + * @Route("/{id}", name="entity_show")
  88 + * @Method("GET")
  89 + * @Template()
  90 + */
  91 + public function showAction($id)
  92 + {
  93 + $em = $this->getDoctrine()->getManager();
  94 +
  95 + $entity = $em->getRepository('CocarBundle:Entity')->find($id);
  96 +
  97 + if (!$entity) {
  98 + throw $this->createNotFoundException('Unable to find Entity entity.');
  99 + }
  100 +
  101 + $deleteForm = $this->createDeleteForm($id);
  102 +
  103 + return array(
  104 + 'entity' => $entity,
  105 + 'delete_form' => $deleteForm->createView(),
  106 + );
  107 + }
  108 +
  109 + /**
  110 + * Displays a form to edit an existing Entity entity.
  111 + *
  112 + * @Route("/{id}/edit", name="entity_edit")
  113 + * @Method("GET")
  114 + * @Template()
  115 + */
  116 + public function editAction($id)
  117 + {
  118 + $em = $this->getDoctrine()->getManager();
  119 +
  120 + $entity = $em->getRepository('CocarBundle:Entity')->find($id);
  121 +
  122 + if (!$entity) {
  123 + throw $this->createNotFoundException('Unable to find Entity entity.');
  124 + }
  125 +
  126 + $editForm = $this->createForm(new EntityType(), $entity);
  127 + $deleteForm = $this->createDeleteForm($id);
  128 +
  129 + return array(
  130 + 'entity' => $entity,
  131 + 'edit_form' => $editForm->createView(),
  132 + 'delete_form' => $deleteForm->createView(),
  133 + );
  134 + }
  135 +
  136 + /**
  137 + * Edits an existing Entity entity.
  138 + *
  139 + * @Route("/{id}", name="entity_update")
  140 + * @Method("PUT")
  141 + * @Template("CocarBundle:Entity:edit.html.twig")
  142 + */
  143 + public function updateAction(Request $request, $id)
  144 + {
  145 + $em = $this->getDoctrine()->getManager();
  146 +
  147 + $entity = $em->getRepository('CocarBundle:Entity')->find($id);
  148 +
  149 + if (!$entity) {
  150 + throw $this->createNotFoundException('Unable to find Entity entity.');
  151 + }
  152 +
  153 + $deleteForm = $this->createDeleteForm($id);
  154 + $editForm = $this->createForm(new EntityType(), $entity);
  155 + $editForm->submit($request);
  156 +
  157 + if ($editForm->isValid()) {
  158 + $em->persist($entity);
  159 + $em->flush();
  160 +
  161 + return $this->redirect($this->generateUrl('entity_edit', array('id' => $id)));
  162 + }
  163 +
  164 + return array(
  165 + 'entity' => $entity,
  166 + 'edit_form' => $editForm->createView(),
  167 + 'delete_form' => $deleteForm->createView(),
  168 + );
  169 + }
  170 + /**
  171 + * Deletes a Entity entity.
  172 + *
  173 + * @Route("/{id}", name="entity_delete")
  174 + * @Method("DELETE")
  175 + */
  176 + public function deleteAction(Request $request, $id)
  177 + {
  178 + $form = $this->createDeleteForm($id);
  179 + $form->submit($request);
  180 +
  181 + if ($form->isValid()) {
  182 + $em = $this->getDoctrine()->getManager();
  183 + $entity = $em->getRepository('CocarBundle:Entity')->find($id);
  184 +
  185 + if (!$entity) {
  186 + throw $this->createNotFoundException('Unable to find Entity entity.');
  187 + }
  188 +
  189 + $em->remove($entity);
  190 + $em->flush();
  191 + }
  192 +
  193 + return $this->redirect($this->generateUrl('entity'));
  194 + }
  195 +
  196 + /**
  197 + * Creates a form to delete a Entity entity by id.
  198 + *
  199 + * @param mixed $id The entity id
  200 + *
  201 + * @return \Symfony\Component\Form\Form The form
  202 + */
  203 + private function createDeleteForm($id)
  204 + {
  205 + return $this->createFormBuilder(array('id' => $id))
  206 + ->add('id', 'hidden')
  207 + ->getForm()
  208 + ;
  209 + }
  210 +}
... ...
Controller/GraphController.php 0 → 100755
  1 +++ a/Controller/GraphController.php
... ... @@ -0,0 +1,1001 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +use Symfony\Component\HttpFoundation\Request;
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  9 +
  10 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  11 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  12 +
  13 +use JpGraph;
  14 +
  15 +class GraphController extends Controller
  16 +{
  17 + private $dir;
  18 +
  19 + /**
  20 + * @Route("/graph/{id}", name="cocar_graph")
  21 + * @Method("GET")
  22 + * @Template()
  23 + */
  24 + public function graphAction(Request $request, $id)
  25 + {
  26 + $em = $this->getDoctrine()->getManager();
  27 +
  28 + $circuit = $em->getRepository('CocarBundle:Circuits')->find($id);
  29 +
  30 + $form = $this->graphForm();
  31 +
  32 + return array('circuit' => $circuit, 'form' => $form->createView());
  33 + }
  34 +
  35 + /**
  36 + * @Route("/graphshow/{id}", name="cocar_graphshow")
  37 + * @Method("GET")
  38 + */
  39 + public function graphShowAction(Request $request, $id)
  40 + {
  41 + $form = $this->graphForm();
  42 + $form->submit($request);
  43 +
  44 + if ($form->isValid())
  45 + {
  46 + $em = $this->getDoctrine()->getManager();
  47 +
  48 + $data = $form->getData();
  49 +
  50 + switch($data['choice'])
  51 + {
  52 + case 0:
  53 + $img[] = $this->graphTraffic($id, $data['period']);
  54 + $img[] = $this->graphConcentrator($id, $data['period']);
  55 + $img[] = $this->graphReliability($id, $data['period']);
  56 + break;
  57 + case 1:
  58 + $img[] = $this->graphTraffic($id, $data['period']);
  59 + break;
  60 + case 2:
  61 + $img[] = $this->graphConcentrator($id, $data['period']);
  62 + break;
  63 + case 3:
  64 + $img[] = $this->graphReliability($id, $data['period']);
  65 + break;
  66 + case 4:
  67 + $img = $this->graphMachine($id, $data['period']);
  68 + break;
  69 + default:
  70 + $img[] = $this->graphTraffic($id, $data['period']);
  71 + }
  72 +
  73 + $paginator = $this->get('knp_paginator');
  74 + $img = $paginator->paginate($img, $this->get('request')->query->get('page', 1), 5);
  75 +
  76 + $circuit = $em->getRepository('CocarBundle:Circuits')->find($id);
  77 +
  78 + return $this->render('CocarBundle:Graph:graph.html.twig',
  79 + array('id' => $id, 'form' => $form->createView(), 'circuit' => $circuit, 'img' => $img));
  80 + }
  81 +
  82 + return $this->redirect($this->generateUrl('entity'), array('id' => $id));
  83 + }
  84 +
  85 + /**
  86 + * @param mixed $id the circuit id
  87 + *
  88 + * @return \Symfony\Component\Form\Form the form
  89 + */
  90 + private function graphForm()
  91 + {
  92 + return $this->createFormBuilder()
  93 + ->add('choice', 'choice', array(
  94 + 'choices' => array(
  95 + 0 => 'Todos',
  96 + 1 => 'Tráfego',
  97 + 2 => 'Concentradora',
  98 + 3 => 'Confiabilidade',
  99 + 4 => 'Maquinas',
  100 + ),
  101 + 'multiple' => false,
  102 + 'expanded' => true,
  103 + 'required' => true,
  104 + ))
  105 + ->add('period', 'choice', array(
  106 + 'choices' => array(
  107 + '6hours' => '6 horas',
  108 + '8hours' => '8 horas',
  109 + '1day' => '1 dia',
  110 + '40hours' => '40 horas',
  111 + '160hours' => '1 semana',
  112 + '720hours' => '1 mês',
  113 + '4months' => '4 meses',
  114 + '1year' => '1 ano'
  115 + ),
  116 + 'required' => true,
  117 + ))
  118 + ->add('send', 'submit', array('label' => 'Enviar' ))
  119 + ->getForm();
  120 + }
  121 +
  122 + /**
  123 + * Retorna gráfico do tráfego
  124 + */
  125 + private function graphTraffic($id, $period = '6hours')
  126 + {
  127 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  128 +
  129 + $em = $this->getDoctrine()->getManager();
  130 +
  131 + $circuits = $em->getRepository('CocarBundle:Circuits')->find($id);
  132 +
  133 + $codInterface = $circuits->getCodeInterface();
  134 + $typeInterface = $circuits->getTypeInterface();
  135 + $cirIn = $circuits->getCirIn();
  136 + $cirOut = $circuits->getCirOut();
  137 + $serial = $circuits->getSerialBackbone();
  138 + $name = $circuits->getCodeInterface();
  139 + $arq = $circuits->getId() . ".rrd";
  140 +
  141 + if(!$this->rrdExists($arq)){
  142 + return new Response("<H1>Erro: A Unidade: <FONT COLOR='red'>" . $name . "</FONT> não esta sendo monitorada.</H1>");
  143 + }
  144 +
  145 + $cir = ($cirIn >= $cirOut) ? $cirIn : $cirOut;
  146 +
  147 + $cirBits = ($cir * 1000);
  148 +
  149 + $img = $codInterface . "_concentradora_" . $period . "_" . time() . ".png";
  150 + $scales = $this->scales(1, $period);
  151 +
  152 + $args = array(
  153 + 'img' => $img,
  154 + 'period' => $period,
  155 + 'scales' => $scales,
  156 + 'name' => $name,
  157 + 'arq' => $arq,
  158 + 'dir' => $this->dir,
  159 + 'typeInterface' => $typeInterface,
  160 + 'serial' => $serial,
  161 + 'cir' => $cir,
  162 + 'cirBits' => $cirBits,
  163 + );
  164 +
  165 + shell_exec($this->getRrdToolGraphCommand($args, true));
  166 +
  167 + return $img;
  168 + }
  169 +
  170 + /**
  171 + * Retorna gráfico da concentradora
  172 + */
  173 + private function graphConcentrator($id, $period = '6hours')
  174 + {
  175 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  176 +
  177 + $em = $this->getDoctrine()->getManager();
  178 +
  179 + $circuits = $em->getRepository('CocarBundle:Circuits')->find($id);
  180 +
  181 + $codInterface = $circuits->getCodeInterface();
  182 + $typeInterface = $circuits->getTypeInterface();
  183 + $cirIn = $circuits->getCirIn();
  184 + $cirOut = $circuits->getCirOut();
  185 + $serial = $circuits->getSerialBackbone();
  186 + $name = "Concentradora: " . $serial;
  187 + $arq = $circuits->getId() . ".rrd";
  188 +
  189 + if(!$this->rrdExists($arq))
  190 + {
  191 + return new Response("<H1>Erro: A Unidade: <FONT COLOR='red'>" . $name . "</FONT> não esta sendo monitorada.</H1>");
  192 + }
  193 +
  194 + $cir = ($cirIn >= $cirOut) ? $cirIn : $cirOut;
  195 +
  196 + $cirBits = ($cir * 1000);
  197 +
  198 + $img = $codInterface . "_" . $period . "_" . time() . ".png";
  199 + $scales = $this->scales(1, $period);
  200 +
  201 + $args = array(
  202 + 'img' => $img,
  203 + 'period' => $period,
  204 + 'scales' => $scales,
  205 + 'name' => $name,
  206 + 'arq' => $arq,
  207 + 'dir' => $this->dir,
  208 + 'typeInterface' => $typeInterface,
  209 + 'serial' => $serial,
  210 + 'cir' => $cir,
  211 + 'cirBits' => $cirBits,
  212 + );
  213 +
  214 + shell_exec($this->getRrdToolGraphCommand($args));
  215 +
  216 + return $img;
  217 + }
  218 +
  219 + /**
  220 + * Retorna gráfico de confiabilidade
  221 + */
  222 + private function graphReliability($id, $period = '6hours')
  223 + {
  224 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/rly/";
  225 +
  226 + $em = $this->getDoctrine()->getManager();
  227 +
  228 + $circuits = $em->getRepository('CocarBundle:Circuits')->find($id);
  229 +
  230 + $scales = $this->scales(2, $period);
  231 +
  232 + $codInterface = $circuits->getCodeInterface();
  233 + $typeInterface = $circuits->getTypeInterface();
  234 + $cirIn = $circuits->getCirIn();
  235 + $cirOut = $circuits->getCirOut();
  236 + $serial = $circuits->getSerialBackbone();
  237 +
  238 + $arq = $codInterface . "_rly.rrd";
  239 +
  240 + if(!$this->rrdExists($arq))
  241 + {
  242 + return new Response("<H1>Erro: A Unidade: <FONT COLOR='red'>" . $name . "</FONT> não esta sendo monitorada.</H1>");
  243 + }
  244 +
  245 + if(!preg_match("/Eth/i", $serial))
  246 + {
  247 + $img = $codInterface . "_" . $period . "_rly_" . time() . ".png";
  248 +
  249 + if($typeInterface == "circuito"){
  250 + $name = "Ponta - " . $serial . " - " . $scales['scale'] . " (" . $scales['media'] . ")";
  251 + }else{
  252 + $name = "Concentradora - " . $codInterface . " - " . $circuits->getSerialRouterTip() . " - " .
  253 + $scales['scale'] . " (" . $scales['media'] . ")";
  254 + }
  255 +
  256 + $args = array(
  257 + 'img' => $img,
  258 + 'period' => $period,
  259 + 'scales' => $scales,
  260 + 'name' => $name,
  261 + 'arq' => $arq,
  262 + 'dir' => $this->dir,
  263 + 'typeInterface' => $typeInterface,
  264 + 'serial' => $serial,
  265 + );
  266 +
  267 + shell_exec($this->getRlyToolGraphCommand($args));
  268 +
  269 + return $img;
  270 + }
  271 + }
  272 +
  273 + public function rrdExists($arq)
  274 + {
  275 + return (!file_exists($this->dir . $arq)) ? false : true;
  276 + }
  277 +
  278 + public function scales($type = 1, $period = '6hours')
  279 + {
  280 + if($type == 1)
  281 + {
  282 + switch (strtolower($period))
  283 + {
  284 + case '6hours': $scale = "6 Horas"; $step=60; $media="1 min"; break;
  285 + case '8hours': $scale = "8 Horas"; $step=60; $media="1 min"; break;
  286 + case '1day': $scale = "1 Dia"; $step=300; $media="5 min"; break;
  287 + case '40hours': $scale = "40 Horas"; $step=300; $media="5 min"; break;
  288 + case '160hours': $scale = "1 Semana"; $step=1200; $media="20 min"; break;
  289 + case '720hours': $scale = "1 Mes"; $step=5400; $media="90 min"; break;
  290 + case '4months': $scale = "4 Meses"; $step=21600; $media="360 min"; break;
  291 + case '1year': $scale = "1 Ano"; $step=86400; $media="1440 min"; break;
  292 + default: $scale = $period; $media="desconhecido";
  293 + }
  294 + }
  295 + elseif($type == 2)
  296 + {
  297 + switch (strtolower($period))
  298 + {
  299 + case '6hours': $scale = "6 Horas"; $step=600; $media="10 min"; break;
  300 + case '8hours': $scale = "8 Horas"; $step=600; $media="10 min"; break;
  301 + case '1day': $scale = "1 Dia"; $step=600; $media="10 min"; break;
  302 + case '40hours': $scale = "40 Horas"; $step=600; $media="10 min"; break;
  303 + case '160hours': $scale = "1 Semana"; $step=1200; $media="20 min"; break;
  304 + case '720hours': $scale = "1 Mes"; $step=5400; $media="90 min"; break;
  305 + case '4months': $scale = "4 Meses"; $step=21600; $media="360 min"; break;
  306 + case '1year': $scale = "1 Ano"; $step=86400; $media="1440 min"; break;
  307 + default: $scale = $period; $media="desconhecido";
  308 + }
  309 + }
  310 + return array('scale' => $scale, 'step' => $step, 'media' => $media);
  311 + }
  312 +
  313 + /**
  314 + * @Route("/graphdailyperform", name="cocar_graphdailyperform")
  315 + */
  316 + public function graphDailyPerfomAction()
  317 + {
  318 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  319 +
  320 + $em = $this->getDoctrine()->getManager();
  321 +
  322 + $hoje = date('Y-m-d');
  323 + $dia_fim = strtotime($hoje) - 86400;
  324 + $dia_ini = $dia_fim - 2592000;
  325 + $dia_ini = date('Y-m-d',$dia_ini);
  326 + $dia_fim = date('Y-m-d',$dia_fim);
  327 +
  328 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  329 +
  330 + foreach ($circuits as $cir)
  331 + {
  332 + $entityId = $cir->getEntity();
  333 + $tech = $cir->getTechnology();
  334 +
  335 + $fields = $em->createQuery(
  336 + "SELECT d.cirIn, d.cirOut, d.day FROM CocarBundle:DailyPerformance d
  337 + WHERE (d.day >= :start
  338 + AND d.day <= :end)
  339 + AND d.codeInterface = :code"
  340 + )
  341 + ->setParameter('start', $dia_ini)
  342 + ->setParameter('end', $dia_fim)
  343 + ->setParameter('code', $cir->getId())
  344 + ->getResult();
  345 +
  346 + $i = 0;
  347 +
  348 + if($fields)
  349 + {
  350 + foreach ($fields as $field)
  351 + {
  352 + if($field['day']->format('d') >= 1)
  353 + {
  354 + if (($tech != "ETH") && ($field['cirOut'] < 2000))
  355 + {
  356 + $ydata3[$i] = $field['cirIn']; //linhas com o cir
  357 + $ydata4[$i] = $field['cirOut'];
  358 + }
  359 + else
  360 + {
  361 + $ydata3[$i] = 0; //linhas com o cir
  362 + $ydata4[$i] = 0;
  363 + }
  364 + $i++;
  365 + }
  366 + }
  367 +
  368 + $this->createGraph(array("volume_in","volume_out","MBytes",1000,"volume","Volume - Ultimos 30 dias"),
  369 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  370 + $this->createGraph(array("cir_in_rec","cir_out_rec","kbps",1,"cir_rec","Taxa = 95% amostras - 30 dias"),
  371 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  372 +
  373 + $this->createGraph2(array("cir_out_rec","7_19_media_out","7_19_pico_out","kbps",1,"out_m95M","SAIDA APS (Ultimos 30 dias) - Media/Taxa95%/Max"),
  374 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  375 +
  376 + $this->createGraph2(array("cir_in_rec","7_19_media_in","7_19_pico_in","kbps",1,"in_m95M", "ENTRADA APS (Ultimos 30 dias) - Media/Taxa95%/Max"),
  377 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  378 +
  379 + $this->createGraphHMM(array("hmm_hour_in", "hmm_hour_out", "HMM"),
  380 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  381 + $this->createGraphHMM(array("hmm_hour_in_per", "hmm_hour_out_per", "HMMper"),
  382 + array($ydata3, $ydata4, $dia_fim, $dia_ini, $cir->getId(), $fields));
  383 + }
  384 + }
  385 +
  386 + return new Response();
  387 + }
  388 +
  389 + /**
  390 + * @Route("/graphmonthlyperform", name="cocar_graph_monthlyperform")
  391 + */
  392 + public function graphMonthlyPerfomAction()
  393 + {
  394 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  395 +
  396 + $em = $this->getDoctrine()->getManager();
  397 +
  398 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  399 +
  400 + $mes_atual = date('Y-m-01');
  401 + $mes_ini = mktime (0, 0, 0, date("m")-7, date("d"), date("Y"));
  402 + $mes_ini = date('Y-m-01', $mes_ini);
  403 +
  404 + foreach ($circuits as $cir)
  405 + {
  406 + $this->createGraphMonthly(array("volume_in","volume_out","GBytes",1,"volume","Volume Mensal"),
  407 + array($cir->getId(), $mes_atual, $mes_ini));
  408 + $this->createGraphMonthly(array("cir_in_rec","cir_out_rec","kbps",1,"cir_rec","Taxa = 95% amostras Mensal"),
  409 + array($cir->getId(), $mes_atual, $mes_ini));
  410 + }
  411 +
  412 + return new Response();
  413 + }
  414 +
  415 + public function createGraph($params = array(), $params2 = array())
  416 + {
  417 + $em = $this->getDoctrine()->getManager();
  418 +
  419 + list($param1, $param2, $y_eixo, $k, $nome, $tipo) = $params;
  420 + list($ydata3, $ydata4, $dia_fim, $dia_ini, $code, $circuit) = $params2;
  421 +
  422 + $fields = $em->createQuery(
  423 + "SELECT d.volumeIn, d.volumeOut, d.cirInRec, d.cirOutRec, d.day FROM CocarBundle:DailyPerformance d
  424 + WHERE (d.day >= :start
  425 + AND d.day <= :end)
  426 + AND d.codeInterface = :code"
  427 + )
  428 + ->setParameter('start', $dia_ini)
  429 + ->setParameter('end', $dia_fim)
  430 + ->setParameter('code', $code)
  431 + ->getResult();
  432 +
  433 + foreach ($fields as $f)
  434 + {
  435 + $p1 = ($param1 == 'volume_in') ? $f['volumeIn'] : $f['cirInRec'];
  436 + $p2 = ($param2 == 'volume_out') ? $f['volumeOut'] : $f['cirOutRec'];
  437 +
  438 + $data1y[] = $p1/$k;
  439 + $data2y[] = $p2/$k;
  440 +
  441 + $a[] = $f['day']->format('d/m');
  442 + }
  443 +
  444 + if(isset($data1y))
  445 + {
  446 + // Create the graph. These two calls are always required
  447 + $graph = new \Graph(580, 280, "auto");
  448 + $graph->SetScale("textlin");
  449 + $graph->img->SetMargin(60, 10, 5, 60);
  450 +
  451 + // Create the bar plots
  452 + $b1plot = new \BarPlot($data1y);
  453 + $b1plot->SetFillColor("green:0.8");
  454 + $b1plot->SetWeight(0);
  455 +
  456 + $b2plot = new \BarPlot($data2y);
  457 + $b2plot->SetFillColor("blue");
  458 + $b2plot->SetWeight(0);
  459 +
  460 + $graph->title->Set("$tipo");
  461 + $graph->yaxis->title->Set($y_eixo);
  462 +
  463 + $graph->title->SetFont(FF_FONT1, FS_BOLD);
  464 + $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
  465 + $graph->xaxis->SetTickLabels($a);
  466 + $graph->xaxis->SetLabelAngle(90);
  467 +
  468 + if ($tipo == "Taxa = 95% amostras - 30 dias"){
  469 + //acrescenta linhas de cir
  470 + $lineplot3 = new \LinePlot($ydata3);
  471 + $lineplot4 = new \LinePlot($ydata4);
  472 +
  473 + $graph->Add($lineplot4);
  474 + $graph->Add($lineplot3);
  475 +
  476 + $lineplot3->SetColor("green:0.8");
  477 + $lineplot3->SetWeight(1);
  478 +
  479 + $lineplot4->SetColor("blue");
  480 + $lineplot4->SetWeight(1);
  481 + }
  482 +
  483 + // Set the legends for the plots
  484 + $b1plot->SetLegend("APS>");
  485 + $b2plot->SetLegend(">APS");
  486 +
  487 + // Adjust the legend position
  488 + $graph->legend->SetLayout(LEGEND_HOR);
  489 + $graph->legend->Pos(0.02, 0.07, "right", "center");
  490 + $graph->legend->SetFrameWeight(0);
  491 + $graph->legend->SetShadow(0);
  492 +
  493 + // Create the grouped bar plot
  494 + $gbplot = new \GroupBarPlot(array($b1plot,$b2plot));
  495 +
  496 + // ...and add it to the graPH
  497 + $graph->Add($gbplot);
  498 +
  499 + //Display the graph
  500 + $graph->SetFrame(false);
  501 +
  502 + $nome_graf = $this->dir."graficos/daily/".$code."_".$nome.".png";
  503 + $graph->Stroke($nome_graf);
  504 + }
  505 + }
  506 +
  507 + public function createGraph2($params = array(), $params2 = array())
  508 + {
  509 + $em = $this->getDoctrine()->getManager();
  510 +
  511 + list($param1, $param2, $param3, $y_eixo, $k, $nome, $tipo) = $params;
  512 + list($ydata3, $ydata4, $dia_fim, $dia_ini, $code, $circuit) = $params2;
  513 +
  514 + $fields = $em->createQuery(
  515 + "SELECT d._719MediaOut, d._719MediaIn, d._719PeakOut, d._719PeakIn,
  516 + d.cirInRec, d.cirOutRec, d.day FROM CocarBundle:DailyPerformance d
  517 + WHERE (d.day >= :start
  518 + AND d.day <= :end)
  519 + AND d.codeInterface = :code"
  520 + )
  521 + ->setParameter('start', $dia_ini)
  522 + ->setParameter('end', $dia_fim)
  523 + ->setParameter('code', $code)
  524 + ->getResult();
  525 +
  526 + $i = 0;
  527 + foreach ($fields as $f)
  528 + {
  529 + $p1 = ($param1 == 'cir_out_rec') ? $f['cirOutRec'] : $f['cirInRec'];
  530 + $p2 = ($param2 == '7_19_media_out') ? $f['_719MediaOut'] : $f['_719MediaIn'];
  531 + $p3 = ($param3 == '7_19_pico_out') ? $f['_719PeakOut'] : $f['_719PeakIn'];
  532 +
  533 + $ydata = ($param1 == 'cir_out_rec') ? $ydata4[$i] : $ydata3[$i];
  534 + $datay[] = $ydata/20 + $p1/$k;
  535 + $datay[] = $p1/$k;
  536 + $datay[] = $p2/$k;
  537 + $datay[] = $p3/$k;
  538 +
  539 + $a[] = $f['day']->format('d/m');
  540 + $i++;
  541 + }
  542 +
  543 + // Create the graph. These two calls are always required
  544 + $graph = new \Graph(580, 280, "auto");
  545 + $graph->SetScale("textlin");
  546 + $graph->img->SetMargin(60, 10, 5, 60);
  547 +
  548 + // Create the bar plots
  549 + $b1plot = new \StockPlot($datay);
  550 +
  551 + $b1plot->SetWidth(9);
  552 +
  553 + $graph->title->Set("$tipo");
  554 + $graph->yaxis->title->Set($y_eixo);
  555 +
  556 + $graph->title->SetFont(FF_FONT1, FS_BOLD);
  557 + $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
  558 + $graph->xaxis->SetTickLabels($a);
  559 + $graph->xaxis->SetLabelAngle(90);
  560 +
  561 + //acrescenta linhas de cir
  562 + $lineplot3 = new \LinePlot($ydata3);
  563 + $lineplot4 = new \LinePlot($ydata4);
  564 +
  565 + $lineplot3->SetColor("red");
  566 + $lineplot3->SetWeight(1);
  567 +
  568 + $lineplot4->SetColor("red");
  569 + $lineplot4->SetWeight(1);
  570 +
  571 + if ($tipo == "ENTRADA APS (últimos 30 dias) - Média/Taxa95%/Máx") {
  572 + $graph->Add($lineplot4);
  573 + }else{
  574 + $graph->Add($lineplot3);
  575 + }
  576 +
  577 + $b1plot->SetWeight(2);
  578 + $b1plot->SetColor('blue','blue','orange','red');
  579 +
  580 + // ...and add it to the graPH
  581 + $graph->Add($b1plot);
  582 +
  583 + //Display the graph
  584 + $graph->SetFrame(false);
  585 +
  586 + $nome_graf = $this->dir."graficos/daily/".$code."_".$nome.".png";
  587 + $graph->Stroke($nome_graf);
  588 + }
  589 +
  590 + public function createGraphHMM($params = array(), $params2 = array())
  591 + {
  592 + $em = $this->getDoctrine()->getManager();
  593 +
  594 + list($param1, $param2, $nome) = $params;
  595 + list($ydata3, $ydata4, $dia_fim, $dia_ini, $code, $circuit) = $params2;
  596 +
  597 + $fields = $em->createQuery(
  598 + "SELECT d.hmmHourIn, d.hmmHourOut, d.hmmHourInPer, d.hmmHourOutPer, d.day FROM CocarBundle:DailyPerformance d
  599 + WHERE (d.day >= :start
  600 + AND d.day <= :end)
  601 + AND d.codeInterface = :code"
  602 + )
  603 + ->setParameter('start', $dia_ini)
  604 + ->setParameter('end', $dia_fim)
  605 + ->setParameter('code', $code)
  606 + ->getResult();
  607 +
  608 + foreach ($fields as $f)
  609 + {
  610 + $p1 = ($param1 == 'hmm_hour_in') ? $f['hmmHourIn'] : $f['hmmHourOut'];
  611 + $p2 = ($param2 == 'hmm_hour_in_per') ? $f['hmmHourInPer'] : $f['hmmHourOutPer'];
  612 +
  613 + $ydata[] = $p1->format('H');
  614 + $ydata2[] = $p2->format('H');
  615 + $a[] = $f['day']->format('d/m');
  616 + }
  617 +
  618 + // Create the graph. These two calls are always required
  619 + $graph = new \Graph(580, 280, "auto");
  620 + $graph->SetScale("textlin");
  621 + $graph->img->SetMargin(60, 10, 5, 60);
  622 +
  623 + $lineplot = new \LinePlot($ydata);
  624 + $lineplot2 = new \LinePlot($ydata2);
  625 +
  626 + // Adiciona a linha ao grafico
  627 + $graph->Add($lineplot);
  628 + $graph->Add($lineplot2);
  629 +
  630 + $graph->title->SetFont(FF_FONT1, FS_BOLD);
  631 + $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
  632 + $graph->yaxis->title->Set("hora");
  633 + $graph->xaxis->SetTickLabels($a);
  634 + $graph->xaxis->SetLabelAngle(90);
  635 +
  636 + $lineplot->SetColor("green:0.8");
  637 + $lineplot->SetWeight(1);
  638 + $lineplot->mark->SetType(MARK_SQUARE);
  639 +
  640 + $lineplot2->SetColor("blue");
  641 + $lineplot2->SetWeight(1);
  642 + $lineplot2->mark->SetType(MARK_SQUARE);
  643 + $lineplot->mark->SetFillColor("green");
  644 +
  645 + $graph->title->Set("Horario inicial da HMM");
  646 +
  647 + // Set the legends for the plots
  648 + $lineplot->SetLegend("->APS");
  649 + $lineplot2->SetLegend("APS->");
  650 +
  651 + // Adjust the legend position
  652 + $graph->legend->SetLayout(LEGEND_HOR);
  653 + $graph->legend->Pos(0.02,0.06,"right","center");
  654 + $graph->legend->SetFrameWeight(0);
  655 + $graph->legend->SetShadow(0);
  656 +
  657 + //grava figura
  658 + $graph->SetFrame(false);
  659 + $nome_graf = $this->dir."graficos/daily/".$code."_".$nome.".png";
  660 + $graph->Stroke($nome_graf);
  661 + }
  662 +
  663 + public function createGraphMonthly($params = array(), $params2 = array())
  664 + {
  665 + $em = $this->getDoctrine()->getManager();
  666 +
  667 + list($param1, $param2, $y_eixo, $k, $nome, $tipo) = $params;
  668 + list($code, $mes_atual, $mes_ini) = $params2;
  669 +
  670 + $fields = $em->createQuery(
  671 + "SELECT d.volumeIn, d.volumeOut, d.cirIn, d.cirOut, d.cirInRec, d.cirOutRec, d.date FROM CocarBundle:MonthlyPerformance d
  672 + WHERE (d.codeInterface = :code
  673 + AND d.date < :currentMonth AND d.date > :startDate) ORDER BY d.date ASC"
  674 + )
  675 + ->setParameter('code', $code)
  676 + ->setParameter('currentMonth', $mes_atual)
  677 + ->setParameter('startDate', $mes_ini)
  678 + ->getResult();
  679 +
  680 + foreach ($fields as $f)
  681 + {
  682 + $p1 = ($param1 == 'volume_in') ? $f['volumeIn'] : $f['cirInRec'];
  683 + $p2 = ($param2 == 'volume_out') ? $f['volumeOut'] : $f['cirOutRec'];
  684 +
  685 + $data1y[] = $p1/$k;
  686 + $data2y[] = $p2/$k;
  687 +
  688 + $ydata3[] = $f['cirIn'];
  689 + $ydata4[] = $f['cirOut'];
  690 +
  691 + $a[] = $f['date']->format('m/Y');
  692 + }
  693 +
  694 + if(isset($data1y))
  695 + {
  696 + // Create the graph. These two calls are always required
  697 + $graph = new \Graph(580, 280, "auto");
  698 + $graph->SetScale("textlin");
  699 + $graph->img->SetMargin(60, 10, 5, 60);
  700 +
  701 + // Create the bar plots
  702 + $b1plot = new \BarPlot($data1y);
  703 + $b1plot->SetFillColor("green:0.8");
  704 + $b1plot->SetWeight(0);
  705 +
  706 + $b2plot = new \BarPlot($data2y);
  707 + $b2plot->SetFillColor("blue");
  708 + $b2plot->SetWeight(0);
  709 +
  710 + $graph->title->Set("$tipo");
  711 + $graph->yaxis->title->Set($y_eixo);
  712 +
  713 + $graph->title->SetFont(FF_FONT1, FS_BOLD);
  714 + $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
  715 + $graph->xaxis->SetTickLabels($a);
  716 + $graph->xaxis->SetLabelAngle(90);
  717 +
  718 + // Set the legends for the plots
  719 + $b1plot->SetLegend("APS>");
  720 + $b2plot->SetLegend(">APS");
  721 +
  722 + // Adjust the legend position
  723 + $graph->legend->SetLayout(LEGEND_HOR);
  724 + $graph->legend->Pos(0.01,0.1,"right","center");
  725 + $graph->legend->SetFrameWeight(0);
  726 + $graph->legend->SetShadow(0);
  727 +
  728 + // Create the grouped bar plot
  729 + $gbplot = new \GroupBarPlot(array($b1plot,$b2plot));
  730 +
  731 + // ...and add it to the graPH
  732 + $graph->Add($gbplot);
  733 +
  734 + if ($tipo == "CIR Mensal recomendado"){
  735 + //apanha o cir in e cir out
  736 + $lineplot3 = new \LinePlot($ydata3);
  737 + $lineplot4 = new \LinePlot($ydata4);
  738 + $graph->Add($lineplot4);
  739 + $graph->Add($lineplot3);
  740 + $lineplot3->SetColor("green:0.8");
  741 + $lineplot3->SetWeight(1);
  742 + $lineplot4->SetColor("blue");
  743 + $lineplot4->SetWeight(1);
  744 + }
  745 +
  746 + //Display the graph
  747 + $graph->SetFrame(false);
  748 +
  749 + $nome_graf = $this->dir."graficos/monthly/".$code."_".$nome.".png";
  750 + $graph->Stroke($nome_graf);
  751 + }
  752 + }
  753 +
  754 + public function getRrdToolGraphCommand($args = array(), $hrule = false)
  755 + {
  756 + extract($args, EXTR_PREFIX_SAME, "wddx");
  757 +
  758 + $com = "rrdtool graph $this->dir" . "graficos/" . $img .
  759 + " --start -". $period . " --end now --step ". $scales['step'] .
  760 + " --title='" . $name . " - " . $scales['scale'] . " (" . $scales['media'] . ")' ".
  761 + "--vertical-label 'Trafego em Bits/s' " .
  762 + "--width 480 --height 162 " .
  763 + "DEF:in=" . $this->dir . $arq . ":ds0:AVERAGE " .
  764 + "DEF:out=" . $this->dir . $arq . ":ds1:AVERAGE " .
  765 + "CDEF:bitIn=in,8,* " .
  766 + "CDEF:bitOut=out,8,* " .
  767 + "COMMENT:' ' ";
  768 +
  769 + if($hrule)
  770 + {
  771 + if($typeInterface == "circuito" && !preg_match("/ETH/i", $serial))
  772 + {
  773 + $com .= "HRULE:$cirBits#FF0000:'CIR = $cir ' " .
  774 + "COMMENT:'\\n' " .
  775 + "COMMENT:' ' ";
  776 + }
  777 + }
  778 +
  779 + $com .= "COMMENT:' ' ".
  780 + "AREA:bitIn#00CC00:'Entrada ' " .
  781 + "LINE1:bitOut#0000FF:'Saida ' " .
  782 + "COMMENT:'\\n' ".
  783 + "COMMENT:' ' ".
  784 + "GPRINT:bitIn:MAX:'Maximo\\:%14.1lf %sbit/s' ".
  785 + "GPRINT:bitOut:MAX:'%11.1lf %sbit/s' ".
  786 + "COMMENT:'\\n' ".
  787 + "COMMENT:' ' ".
  788 + "GPRINT:bitIn:AVERAGE:'Media\\:%15.1lf %sbit/s' ".
  789 + "GPRINT:bitOut:AVERAGE:'%11.1lf %sbit/s' ".
  790 + "COMMENT:'\\n' ".
  791 + "COMMENT:' ' ".
  792 + "GPRINT:bitIn:LAST:'Ultima\\:%14.1lf %sbit/s' " .
  793 + "GPRINT:bitOut:LAST:'%11.1lf %sbit/s' ";
  794 +
  795 + return $com;
  796 + }
  797 +
  798 + private function getRlyToolGraphCommand($args = array())
  799 + {
  800 + extract($args, EXTR_PREFIX_SAME, "wddx");
  801 +
  802 + $com = "rrdtool graph $this->dir" . "../graficos/". $img .
  803 + " --start -". $period . " --end now --step ". $scales['step'] .
  804 + " --title='" . $name . "' ".
  805 + "--vertical-label 'Confiabilidade' -w 480 -h 162 " .
  806 + "DEF:myrly=" . $this->dir . $arq . ":rly:AVERAGE " .
  807 + "CDEF:valor=myrly " .
  808 + "CDEF:ideal=valor,255,EQ,valor,0,IF " .
  809 + "CDEF:baixo=valor,255,EQ,0,valor,IF " .
  810 + "HRULE:255#0000FF:'Valor Ideal = 255 ' " .
  811 + "AREA:ideal#80FF80:'Normal ' " .
  812 + "AREA:baixo#FE3C36:'Critico\\c' " .
  813 + "COMMENT:'\\n' ".
  814 + "COMMENT:' ' ".
  815 + "GPRINT:valor:MIN:'Valor Minimo = %10.0lf' " .
  816 + "COMMENT:'\\n' ".
  817 + "COMMENT:' ' ".
  818 + "GPRINT:valor:LAST:'Ultimo Valor = %10.0lf' ";
  819 +
  820 + return $com;
  821 + }
  822 +
  823 + /**
  824 + * @Route("/report/{id}", name="cocar_report")
  825 + * @Template()
  826 + */
  827 + public function reportAction($id)
  828 + {
  829 + $em = $this->getDoctrine()->getManager();
  830 +
  831 + $circuit = $em->getRepository('CocarBundle:Circuits')->findByEntity($id);
  832 +
  833 + $form = $this->reportForm($id);
  834 +
  835 + return array('circuit' => $circuit, 'form' => $form->createView());
  836 + }
  837 +
  838 + /**
  839 + * @Route("/reportshow", name="cocar_reportshow")
  840 + * @Method("POST")
  841 + */
  842 + public function reportShowAction(Request $request)
  843 + {
  844 + $form = $this->reportForm($request->request->get('entity'));
  845 + $form->submit($request);
  846 +
  847 + if ($form->isValid())
  848 + {
  849 + $em = $this->getDoctrine()->getManager();
  850 +
  851 + $data = $form->getData();
  852 +
  853 + $circuit = $em->getRepository('CocarBundle:Circuits')->findByEntity($data['entity']);
  854 +
  855 + switch ($data['type']) {
  856 + case 'taxa':
  857 + $name = $request->request->get('circuit') . "_cir_rec.png";
  858 + $img[] = "monthly/" . $name;
  859 + $img[] = "daily/" . $name;
  860 + $type = "Taxa = 95% amostras";
  861 + break;
  862 + case 'volume':
  863 + $name = $request->request->get('circuit') . "_volume.png";
  864 + $img[] = "monthly/" . $name;
  865 + $img[] = "daily/" . $name;
  866 + $type = "Volume";
  867 + break;
  868 + case 'hmm_day':
  869 + $name = $request->request->get('circuit') . "_HMM.png";
  870 + $img[] = "daily/" . $name;
  871 + $type = "HMM do dia";
  872 + break;
  873 + case 'hmm_per':
  874 + $name = $request->request->get('circuit') . "_HMMper.png";
  875 + $img[] = "daily/" . $name;
  876 + $type = "HMM do período";
  877 + break;
  878 + case 'med_in':
  879 + $name = $request->request->get('circuit') . "_in_m95M.png";
  880 + $img[] = "daily/" . $name;
  881 + $type = "Med 95% Max - Entrada";
  882 + break;
  883 + case 'med_out':
  884 + $name = $request->request->get('circuit') . "_out_m95M.png";
  885 + $img[] = "daily/" . $name;
  886 + $type = "Med 95% Max - Saida";
  887 + break;
  888 +
  889 + default:
  890 + $img[] = array();
  891 + break;
  892 + }
  893 + }
  894 +
  895 + return $this->render('CocarBundle:Graph:report.html.twig',
  896 + array('form' => $form->createView(), 'circuit' => $circuit,
  897 + 'img' => $img, 'type' => $type, 'id' => $request->request->get('circuit')));
  898 + }
  899 +
  900 + /**
  901 + * @param mixed $id the circuit id
  902 + *
  903 + * @return \Symfony\Component\Form\Form the form
  904 + */
  905 + private function reportForm($id)
  906 + {
  907 + return $this->createFormBuilder()
  908 + ->add('type', 'choice', array(
  909 + 'choices' => array(
  910 + 'taxa' => 'Taxa = 95% amostras',
  911 + 'volume' => 'Volume',
  912 + 'hmm_day' => 'HMM do dia',
  913 + 'hmm_per' => 'HMM do período',
  914 + 'med_in' => 'Med 95% Max - Entrada',
  915 + 'med_out' => 'Med 95% Max - Saida',
  916 + ),
  917 + 'required' => true,
  918 + ))
  919 + ->add('entity', 'hidden', array(
  920 + 'data' => $id
  921 + ))
  922 + ->add('send', 'submit', array('label' => 'Enviar' ))
  923 + ->getForm();
  924 + }
  925 +
  926 + /**
  927 + * Retorna gráfico do tráfego das máquinas
  928 + */
  929 + private function graphMachine($id, $period = '6hours')
  930 + {
  931 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/machine/" . $id . "/";
  932 +
  933 + if(is_dir($this->dir))
  934 + {
  935 + if(!is_dir($this->dir . "graficos/"))
  936 + mkdir($this->dir . "graficos/");
  937 +
  938 + $em = $this->getDoctrine()->getManager();
  939 +
  940 + $circuits = $em->getRepository('CocarBundle:Circuits')->find($id);
  941 +
  942 + $machines = $em->createQuery(
  943 + "SELECT DISTINCT m.macAddress, m.ip FROM CocarBundle:Machine m
  944 + WHERE m.gateway = :gateway
  945 + GROUP BY m.macAddress, m.ip, m.id"
  946 + )
  947 + ->setParameter('gateway', $id)
  948 + ->getResult();
  949 +
  950 + $img = array();
  951 +
  952 + foreach ($machines as $machine)
  953 + {
  954 + $typeInterface = $circuits->getTypeInterface();
  955 + $cirIn = $circuits->getCirIn();
  956 + $cirOut = $circuits->getCirOut();
  957 + $serial = $circuits->getSerialBackbone();
  958 +
  959 + $ip = $machine['ip'];
  960 + $mcAddr = $machine['macAddress'];
  961 +
  962 + $name = $circuits->getCodeInterface() . " ($ip) - $mcAddr";
  963 + $arq = str_replace(":", "", $mcAddr . ".rrd");
  964 +
  965 + if(!$this->rrdExists($arq)){
  966 + return new Response("<H1>Erro: A Unidade: <FONT COLOR='red'>" . $name . "</FONT> não esta sendo monitorada.</H1>");
  967 + }
  968 +
  969 + $cir = ($cirIn >= $cirOut) ? $cirIn : $cirOut;
  970 +
  971 + $cirBits = ($cir * 1000);
  972 +
  973 + $image = str_replace(":", "", $mcAddr) . "_concentradora_" . $period . "_" . time() . ".png";
  974 + $scales = $this->scales(1, $period);
  975 +
  976 + $args = array(
  977 + 'img' => $image,
  978 + 'period' => $period,
  979 + 'scales' => $scales,
  980 + 'name' => $name,
  981 + 'arq' => $arq,
  982 + 'dir' => $this->dir,
  983 + 'typeInterface' => $typeInterface,
  984 + 'serial' => $serial,
  985 + 'cir' => $cir,
  986 + 'cirBits' => $cirBits,
  987 + );
  988 +
  989 + shell_exec($this->getRrdToolGraphCommand($args, true));
  990 +
  991 + $img[] = "../machine/$id/graficos/$image";
  992 + }
  993 +
  994 + return $img;
  995 + }
  996 + else
  997 + {
  998 + return new Response("<H1>Não existem máquinas cadastradas para esse circuito!</H1>");
  999 + }
  1000 + }
  1001 +}
0 1002 \ No newline at end of file
... ...
Controller/MonitorController.php 0 → 100755
  1 +++ a/Controller/MonitorController.php
... ... @@ -0,0 +1,96 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +class MonitorController extends Controller
  12 +{
  13 + private $dir;
  14 +
  15 + /**
  16 + * @Route("/monitor", name="cocar_monitor")
  17 + * @Template()
  18 + */
  19 + public function monitorAction()
  20 + {
  21 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  22 +
  23 + $em = $this->getDoctrine()->getManager();
  24 +
  25 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  26 +
  27 + foreach($circuits as $cir)
  28 + {
  29 + try
  30 + {
  31 + $id = $cir->getId();
  32 + $community = $cir->getCommunitySnmpBackbone();
  33 + $host = $cir->getIpBackbone();
  34 + $codInterface = $cir->getCodeInterface();
  35 + $numInterface = $cir->getNumSnmpInterface();
  36 +
  37 + $com = "snmpget -Ov -t 1 -r 1 -c $community -v 1 $host .1.3.6.1.2.1.2.2.1.10.$numInterface .1.3.6.1.2.1.2.2.1.16.$numInterface";
  38 +
  39 + if($outPut = shell_exec($com))
  40 + {
  41 + list($in, $out) = explode("\n", shell_exec($com));
  42 +
  43 + $inOctets = $this->snmp($in);
  44 + $outOctets = $this->snmp($out);
  45 +
  46 + if($inOctets || $outOctets)
  47 + {
  48 + $arqRrd = $this->dir . $id . '.rrd';
  49 +
  50 + if (!file_exists($arqRrd))
  51 + $this->createRrd($arqRrd);
  52 + $this->updateRrd($arqRrd, $inOctets , $outOctets);
  53 + }
  54 + }
  55 + }
  56 + catch(Exception $e)
  57 + {
  58 + return new Response($e->getMessage());
  59 + }
  60 + }
  61 + return new Response();
  62 + }
  63 +
  64 + public function createRrd($arqRrd)
  65 + {
  66 + $create = "rrdtool create $arqRrd --step 60 " .
  67 + "DS:ds0:COUNTER:120:0:125000000 " .
  68 + "DS:ds1:COUNTER:120:0:125000000 " .
  69 + "RRA:AVERAGE:0.5:1:4320 " .
  70 + "RRA:AVERAGE:0.5:5:2016 " .
  71 + "RRA:AVERAGE:0.5:20:2232 " .
  72 + "RRA:AVERAGE:0.5:90:2976 " .
  73 + "RRA:AVERAGE:0.5:360:1460 " .
  74 + "RRA:AVERAGE:0.5:1440:730 " .
  75 + "RRA:MAX:0.5:1:4320 " .
  76 + "RRA:MAX:0.5:5:2016 " .
  77 + "RRA:MAX:0.5:20:2232 " .
  78 + "RRA:MAX:0.5:90:2976 " .
  79 + "RRA:MAX:0.5:360:1460 " .
  80 + "RRA:MAX:0.5:1440:730";
  81 + shell_exec($create);
  82 + }
  83 +
  84 + public function snmp($resp)
  85 + {
  86 + $resp = strstr($resp, ':');
  87 + $resp = str_replace(":", "", $resp);
  88 + return (trim($resp));
  89 + }
  90 +
  91 + public function updateRrd($arqRrd, $in, $out, $date = null)
  92 + {
  93 + $date = empty($date) ? date('U') : $date;
  94 + shell_exec("rrdtool update $arqRrd $date:$in:$out");
  95 + }
  96 +}
0 97 \ No newline at end of file
... ...
Controller/MonthlyPerformController.php 0 → 100755
  1 +++ a/Controller/MonthlyPerformController.php
... ... @@ -0,0 +1,166 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Entity\MonthlyPerformance;
  12 +
  13 +class MonthlyPerformController extends Controller
  14 +{
  15 + /**
  16 + * @Route("/monthlyperform", name="cocar_monthlyperform")
  17 + * @Template()
  18 + */
  19 + public function monthlyPerformanceAction()
  20 + {
  21 + $em = $this->getDoctrine()->getManager();
  22 +
  23 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  24 +
  25 + foreach($circuits as $cir)
  26 + {
  27 + for ($mes=1;$mes<=12;$mes++)
  28 + {
  29 + //Período a ser gerado na tabela
  30 + $uso_20_50_in = 0;
  31 + $uso_50_85_in = 0;
  32 + $uso_m_85_in = 0;
  33 + $uso_20_50_out = 0;
  34 + $uso_50_85_out = 0;
  35 + $uso_m_85_out = 0;
  36 + $ocorrencias = 0;
  37 + $volume_mensal_out = 0;
  38 + $volume_mensal_in = 0;
  39 +
  40 + unset($c_out_rec);
  41 + unset($c_in_rec);
  42 +
  43 + $ano = date('Y');
  44 + $mes = ($mes < 10) ? "0".$mes : $mes;
  45 + $mes_ano = $ano."-".$mes."-01";
  46 + $ldia = date("t", mktime(0,0,0,$mes,'01',$ano));
  47 +
  48 + $daily = $em->createQuery(
  49 + "SELECT d FROM CocarBundle:DailyPerformance d
  50 + WHERE d.codeInterface = :code
  51 + AND (d.day >= :startDate AND d.day <= :endDate)"
  52 + )
  53 + ->setParameter('code', $cir->getId())
  54 + ->setParameter('startDate', $mes_ano." 00:00:00")
  55 + ->setParameter('endDate', $ano."-".$mes."-".$ldia." 23:59:59")
  56 + ->getResult();
  57 +
  58 + foreach($daily as $d)
  59 + {
  60 + //volume mensal
  61 + $volume_mensal_out += $d->getVolumeOut();
  62 + $volume_mensal_in += $d->getVolumeIn();
  63 +
  64 + //cir mensal recomendado - separa valores
  65 + if(isset($c_out_rec[$d->getCirOutRec()]))
  66 + {
  67 + $c_out_rec[$d->getCirOutRec()]++;
  68 + $c_in_rec[$d->getCirInRec()]++;
  69 + }
  70 + else
  71 + {
  72 + $c_out_rec[$d->getCirOutRec()] = 1;
  73 + $c_in_rec[$d->getCirInRec()] = 1;
  74 + }
  75 +
  76 + $c_out = $d->getCirOut();
  77 + $c_in = $d->getCirIn();
  78 +
  79 + //criticidade mensal - separa valores
  80 + $ocorrencias++;
  81 +
  82 + $criticidade_out = $d->get719CriticalityOut();
  83 + $criticidade_in = $d->get719CriticalityIn();
  84 +
  85 + if (($criticidade_out >= 20) && ($criticidade_out < 50))
  86 + {
  87 + $uso_20_50_out++;
  88 + }elseif(($criticidade_out >= 50) && ($criticidade_out < 85))
  89 + {
  90 + $uso_50_85_out++;
  91 + }elseif ($criticidade_out >= 85)
  92 + {
  93 + $uso_m_85_out++;
  94 + }
  95 + if(($criticidade_in >= 20) && ($criticidade_in < 50))
  96 + {
  97 + $uso_20_50_in++;
  98 + }elseif (($criticidade_in >= 50) && ($criticidade_in < 85))
  99 + {
  100 + $uso_50_85_in++;
  101 + }elseif ($criticidade_in >= 85)
  102 + {
  103 + $uso_m_85_in++;
  104 + }
  105 +
  106 + //criticidade mensal - em %
  107 + $uso_20_50_in = 100 * $uso_20_50_in/$ocorrencias;
  108 + $uso_50_85_in = 100 * $uso_50_85_in/$ocorrencias;
  109 + $uso_m_85_in = 100 * $uso_m_85_in/$ocorrencias;
  110 + $uso_20_50_out = 100 * $uso_20_50_out/$ocorrencias;
  111 + $uso_50_85_out = 100 * $uso_50_85_out/$ocorrencias;
  112 + $uso_m_85_out = 100 * $uso_m_85_out/$ocorrencias;
  113 + }
  114 +
  115 + if(isset($c_in_rec))
  116 + {
  117 + //cir mensal recomendado - apanha valor
  118 + krsort($c_in_rec);
  119 + $cir_in_rec_m = key($c_in_rec);
  120 + if ($c_in_rec[$cir_in_rec_m] < 2)
  121 + {
  122 + next($c_in_rec);
  123 + $cir_in_rec_m = key($c_in_rec);
  124 + }
  125 + }
  126 +
  127 + if(isset($c_out_rec))
  128 + {
  129 + krsort($c_out_rec);
  130 + $cir_out_rec_m = key($c_out_rec);
  131 + if ($c_out_rec[$cir_out_rec_m] < 2)
  132 + {
  133 + next ($c_out_rec);
  134 + $cir_out_rec_m = key ($c_out_rec);
  135 + }
  136 + }
  137 +
  138 + //volume mensal em Gigabytes
  139 + $volume_mensal_out /= 1000000;
  140 + $volume_mensal_in /= 1000000;
  141 +
  142 + $mPerform = new MonthlyPerformance();
  143 +
  144 + $mPerform->setDate(new \DateTime($mes_ano));
  145 + $mPerform->setCodeInterface($cir->getId());
  146 + $mPerform->setUse2050In(isset($uso_20_50_in) ? $uso_20_50_in : 0);
  147 + $mPerform->setUse2050Out(isset($uso_20_50_out) ? $uso_20_50_out : 0);
  148 + $mPerform->setUse5085In(isset($uso_50_85_in) ? $uso_50_85_in : 0);
  149 + $mPerform->setUse5085Out(isset($uso_50_85_out) ? $uso_50_85_out : 0);
  150 + $mPerform->setUseM85In(isset($uso_m_85_in) ? $uso_m_85_in : 0);
  151 + $mPerform->setUseM85Out(isset($uso_m_85_out) ? $uso_m_85_out : 0);
  152 + $mPerform->setVolumeIn(isset($volume_mensal_in) ? $volume_mensal_in : 0);
  153 + $mPerform->setVolumeOut(isset($volume_mensal_out) ? $volume_mensal_out : 0);
  154 + $mPerform->setCirIn(isset($c_in) ? $c_in : 0);
  155 + $mPerform->setCirOut(isset($c_out) ? $c_out : 0);
  156 + $mPerform->setCirInRec(isset($cir_in_rec_m) ? $cir_in_rec_m : 0);
  157 + $mPerform->setCirOutRec(isset($cir_out_rec_m) ? $cir_out_rec_m : 0);
  158 +
  159 + $em->persist($mPerform);
  160 + $em->flush();
  161 + }
  162 + }
  163 +
  164 + return new Response();
  165 + }
  166 +}
0 167 \ No newline at end of file
... ...
Controller/ReliabilityController.php 0 → 100755
  1 +++ a/Controller/ReliabilityController.php
... ... @@ -0,0 +1,85 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Entity\Reliability;
  12 +
  13 +class ReliabilityController extends Controller
  14 +{
  15 + private $dir;
  16 +
  17 + /**
  18 + * @Route("/reliability", name="cocar_reliability")
  19 + * @Template()
  20 + */
  21 + public function reabilityAction()
  22 + {
  23 + $reliability = new Reliability();
  24 +
  25 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/rly/";
  26 +
  27 + $em = $this->getDoctrine()->getManager();
  28 +
  29 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  30 +
  31 + foreach($circuits as $cir)
  32 + {
  33 + $codInterface = $cir->getCodeInterface();
  34 + $hostTip = $cir->getIpSerialRouterTip();
  35 + $communityTip = $cir->getCommunitySnmpRouterTip();
  36 + $snmpPortTip = $cir->getSnmpPortTip();
  37 +
  38 + $com = "snmpget -Ov -t 1 -r 1 -c $communityTip -v 1 $hostTip .1.3.6.1.4.1.9.2.2.1.1.22.$snmpPortTip 2> /dev/null";
  39 +
  40 + $rly = $this->get('cocar_monitor')->snmp(shell_exec($com));
  41 +
  42 + $rly = (!$rly) ? 0 : $rly;
  43 +
  44 + $date = ((int)(date('U')/600))*600;
  45 +
  46 + $reliability->setCodeInterface($codInterface);
  47 + $reliability->setDate($date);
  48 + $reliability->setRly($rly);
  49 +
  50 + $em->persist($reliability);
  51 + $em->flush();
  52 +
  53 + $arqRrd = $this->dir . $codInterface . "_rly.rrd";
  54 +
  55 + if (!file_exists($arqRrd))
  56 + $this->createRrdRly($arqRrd);
  57 +
  58 + $this->updateRrdRly($arqRrd, $date, $rly);
  59 + }
  60 + return new Response();
  61 + }
  62 +
  63 + public function createRrdRly($arqRrd)
  64 + {
  65 + $com = "rrdtool create " . $arqRrd . " --step 600 " .
  66 + "DS:rly:GAUGE:1200:0:256 " .
  67 + "RRA:AVERAGE:0.5:1:480 " .
  68 + "RRA:AVERAGE:0.5:2:510 " .
  69 + "RRA:AVERAGE:0.5:9:500 " .
  70 + "RRA:AVERAGE:0.5:36:500 " .
  71 + "RRA:AVERAGE:0.5:144:370 " .
  72 + "RRA:MIN:0.5:1:480 " .
  73 + "RRA:MIN:0.5:2:510 " .
  74 + "RRA:MIN:0.5:9:500 " .
  75 + "RRA:MIN:0.5:36:500 " .
  76 + "RRA:MIN:0.5:144:370";
  77 +
  78 + shell_exec($com);
  79 + }
  80 +
  81 + public function updateRrdRly($arqRrd, $date, $rly)
  82 + {
  83 + shell_exec("rrdtool update $arqRrd $date:$rly");
  84 + }
  85 +}
0 86 \ No newline at end of file
... ...
Controller/RestController.php 0 → 100755
  1 +++ a/Controller/RestController.php
... ... @@ -0,0 +1,124 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use FOS\RestBundle\Controller\Annotations as Rest;
  9 +
  10 +use JMS\Serializer\SerializationContext;
  11 +
  12 +class RestController extends Controller
  13 +{
  14 +
  15 + /**
  16 + * GET Route annotation.
  17 + * @Rest\Post("/snmp")
  18 + */
  19 + public function postSnmpAction()
  20 + {
  21 + $em = $this->getDoctrine()->getManager();
  22 + $dir = $this->get('kernel')->getRootDir() . "/../web/rrd/machine/";
  23 +
  24 + foreach ($_FILES as $file)
  25 + {
  26 + try
  27 + {
  28 + $machine = new \Cocar\CocarBundle\Entity\Machine;
  29 +
  30 + $file = new \Symfony\Component\HttpFoundation\File\UploadedFile(
  31 + $file['tmp_name'],
  32 + $file['name'],
  33 + $file['type'],
  34 + $file['size'],
  35 + $file['error']);
  36 +
  37 + $machine->setFile($file);
  38 + $machine->preUpload();
  39 + $machine->upload();
  40 +
  41 + $content = simplexml_load_file($machine->getAbsolutePath());
  42 +
  43 + if(isset($content->machine["gateway"]) && isset($content->machine->macaddress))
  44 + {
  45 + $circuit = $em->getRepository('CocarBundle:Circuits')->findByIpBackbone($content->machine["gateway"]);
  46 +
  47 + foreach ($circuit as $c)
  48 + {
  49 + $id = $c->getId();
  50 + $circuit = $em->getRepository('CocarBundle:Circuits')->find($id);
  51 + }
  52 +
  53 + $machine->setGateway($circuit);
  54 + $machine->setIp($content->machine->ip);
  55 + $machine->setMacAddress($content->machine->macaddress);
  56 +
  57 + $em->persist($machine);
  58 + $em->flush();
  59 +
  60 + $dir .= $id . "/";
  61 +
  62 + if(!is_dir($dir))
  63 + mkdir($dir);
  64 +
  65 + $file = $dir . str_replace(":", "", $content->machine->macaddress) . '.rrd';
  66 +
  67 + if (!file_exists($file))
  68 + $this->get('cocar_monitor')->createRrd($file);
  69 +
  70 + foreach ($content->snmp->period as $value)
  71 + {
  72 + $this->get('cocar_monitor')->updateRrd($file, $value->in,
  73 + $value->out, $value['date']);
  74 + }
  75 +
  76 + } else {
  77 + return new Response("Error in XML format");
  78 + }
  79 +
  80 + } catch(\Exception $e) {
  81 + return new Response ($e->getMessage());
  82 + return new Response($this->get('jms_serializer')->serialize(array('result' => 'error'), 'json'));
  83 + }
  84 + }
  85 +
  86 + return new Response($this->get('jms_serializer')->serialize(array('result' => 'success'), 'json'));
  87 + }
  88 +
  89 + /**
  90 + * GET Route annotation.
  91 + * @Rest\Get("/snmp/{slug}")
  92 + */
  93 + public function getSnmpAction($slug)
  94 + {
  95 + $entity = array('campo' => 'conteudo', 'campo2' => array('campo3' => 'conteudo2'));
  96 +
  97 + $context = new SerializationContext();
  98 +
  99 + $serializer = $this->get('jms_serializer');
  100 +
  101 + $response = new Response($serializer->serialize($entity, 'json', $context));
  102 + $response->headers->set('Content-Type', 'application/json');
  103 +
  104 + return $response;
  105 + }
  106 +
  107 + /**
  108 + * GET Route annotation.
  109 + * @Rest\Put("/snmp/{slug}")
  110 + */
  111 + public function putSnmpAction($slug)
  112 + {
  113 +
  114 + }
  115 +
  116 + /**
  117 + * GET Route annotation.
  118 + * @Rest\Delete("/snmp/{slug}")
  119 + */
  120 + public function deleteSnmpAction($slug)
  121 + {
  122 +
  123 + }
  124 +}
0 125 \ No newline at end of file
... ...
Controller/RrdLogController.php 0 → 100755
  1 +++ a/Controller/RrdLogController.php
... ... @@ -0,0 +1,81 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Entity\Rrd;
  12 +
  13 +class RrdLogController extends Controller
  14 +{
  15 + private $dir;
  16 +
  17 + /**
  18 + * @Route("/rrdlog", name="cocar_rrdlog")
  19 + * @Template()
  20 + */
  21 + public function rrdLogAction()
  22 + {
  23 + set_time_limit(0);
  24 +
  25 + $this->dir = $this->get('kernel')->getRootDir() . "/../web/rrd/";
  26 +
  27 + $em = $this->getDoctrine()->getManager();
  28 +
  29 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  30 +
  31 + foreach($circuits as $cir)
  32 + {
  33 + $rrd = $cir->getId() . ".rrd";
  34 + $arq = $this->dir . $rrd;
  35 +
  36 + if(file_exists($arq))
  37 + {
  38 + $end = (date('U')) - 120;
  39 + $start = $end - 86400;
  40 +
  41 + $com = "rrdtool fetch $arq AVERAGE --start $start --end $end | sed -e \"s/ds[01]//g\" |
  42 + sed \"s/nan/0/g\" | tr \":\" \" \" | tr -s \" \" | sed -e \"s/ \$//\" | grep -v \"^\$\"";
  43 +
  44 + $lines = explode("\n", shell_exec($com));
  45 +
  46 + $codInt = strtr($cir->getId(), ".", "_");
  47 +
  48 + for ($i=0; $i < count($lines); $i++)
  49 + {
  50 + $fields = explode(" ", $lines[$i]);
  51 + $date = new \DateTime();
  52 + $date->setTimestamp(intval($fields[0]));
  53 + $volIn = $this->calc(isset($fields[1]) ? $fields[1] : 0);
  54 + $volOut = $this->calc(isset($fields[2]) ? $fields[2] : 0);
  55 +
  56 + if ($date->format('Y-m-d H:i:s') != "1970-01-01 00:00:00" && $date->format('Y-m-d H:i:s') != "1969-12-31 21:00:00")
  57 + {
  58 + $rrdLog = new Rrd();
  59 +
  60 + $rrdLog->setDatetime($date);
  61 + $rrdLog->setCodeInterface($codInt);
  62 + $rrdLog->setVolumeIn($volIn);
  63 + $rrdLog->setVolumeOut($volOut);
  64 +
  65 + $em->persist($rrdLog);
  66 + }
  67 + $em->flush();
  68 + }
  69 + }
  70 + }
  71 + return new Response();
  72 + }
  73 +
  74 + public function calc($value)
  75 + {
  76 + $value = strtr($value, ",", ".");
  77 + settype ($value, "double");
  78 + return round($value, 1);
  79 + }
  80 +
  81 +}
... ...
Controller/SnmpController.php 0 → 100755
  1 +++ a/Controller/SnmpController.php
... ... @@ -0,0 +1,855 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +###############################
  12 +### MELHORAR ESTE CÓDIGO!!! ###
  13 +###############################
  14 +
  15 +class SnmpController extends Controller
  16 +{
  17 + private $host;
  18 + private $community;
  19 + private $sysUpTime;
  20 + private $sysName;
  21 + private $version;
  22 + private $codeInterface;
  23 +
  24 + /**
  25 + * Construct
  26 + */
  27 + public function __construct($host, $community, $codeInterface)
  28 + {
  29 + $this->host = $host;
  30 + $this->community = $community;
  31 + $this->codeInterface = $codeInterface;
  32 + }
  33 +
  34 + public function fcSnmpWalk($oId, $t = 1, $r = 1)
  35 + {
  36 + /*
  37 + Nao permite SNMP BULK.
  38 + Retorna Resposta, apenas, para a primeira OID solicitada
  39 + */
  40 +
  41 + $com = "snmpwalk -Ov -t " . $t . " -r " . $r . " -c " . $this->community . " -v 1 " . $this->host . " " . $oId;
  42 + $arrayInfo = explode("\n", shell_exec($com));
  43 +
  44 + $arrayInfo = $this->formatSnmp($arrayInfo);
  45 +
  46 + return $arrayInfo;
  47 + }
  48 +
  49 + public function fcSnmpGet($oIds, $t=1, $r=1)
  50 + {
  51 + $com = "snmpget -Ov -t " . $t . " -r " . $r . " -c " . $this->community . " -v 1 " . $this->host . " " . $oIds;
  52 + $arrayInfo = explode("\n", shell_exec($com));
  53 +
  54 + return (!empty($arrayInfo[0])) ? $this->formatSnmp($arrayInfo) : null;
  55 + }
  56 +
  57 +
  58 + public function formatSnmp($array)
  59 + {
  60 + for($i=0;$i<count($array);$i++)
  61 + {
  62 + if($array[$i] != NULL)
  63 + {
  64 + if(preg_match('/:/i',$array[$i]))
  65 + {
  66 + $newArray[$i] = substr(strstr($array[$i], ':'),1);
  67 + $newArray[$i] = str_replace("\"", '', trim($newArray[$i]));
  68 + }
  69 + else
  70 + $newArray[$i] = str_replace("\"", '', trim($array[$i]));
  71 + }
  72 + }
  73 + return (isset($newArray)) ? (count($newArray)>1) ? $newArray : $newArray[0] : null;
  74 + }
  75 +
  76 + public function sysUpTime()
  77 + {
  78 + $this->sysUpTime = $this->fcSnmpGet(".1.3.6.1.2.1.1.3.0");
  79 +
  80 + return ($this->sysUpTime == NULL) ? 0 : 1;
  81 + }
  82 +
  83 +
  84 + public function server()
  85 + {
  86 + $aux = shell_exec('ifconfig | head -2| tail -1');
  87 + $aux = substr(strstr($aux, ':'),2);
  88 + $server = explode(" " , $aux);
  89 + return $server[0];
  90 + }
  91 +
  92 + public function hostName()
  93 + {
  94 + $name = $this->fcSnmpGet(".1.3.6.1.2.1.1.5.0");
  95 +
  96 + if($name == NULL)
  97 + $this->problems();
  98 +
  99 + $this->sysName = $name;
  100 + }
  101 +
  102 + public function problems()
  103 + {
  104 + echo "<BR><BR>
  105 + <DIV ALIGN='center'><H2>PROBLEMAS!!!&nbsp;&nbsp;&nbsp;<FONT COLOR='#0000FF'>" .
  106 + $this->host .
  107 + "</FONT></DIV></H2>
  108 + <HR WIDTH='600' COLOR='#333399'>
  109 + <PRE>
  110 + <FONT FACE='Verdana' SIZE='3'>
  111 +
  112 + &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;Verifique se o equipamento possui <B>'Hostname'</B>.
  113 +
  114 + &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;Verifique se equipamento est&aacute; ligado. Usando comando <B>ping</B>.
  115 +
  116 + &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;Verifique se o <B>IP</B> e/ou <B>Community</B> esta(&atilde;o) correto(s).
  117 + </FONT>
  118 + </PRE>
  119 + ";
  120 + exit;
  121 + }
  122 +
  123 + public function printHost()
  124 + {
  125 + $chassis = $this->chassis();
  126 + echo "<h2>" . $this->host . "</h2> (Modelo: $chassis)<HR WIDTH='100%' COLOR='#006C36'>";
  127 + }
  128 +
  129 + public function chassis()
  130 + {
  131 + $ChassisTypes[0] = "Desconhecido";
  132 + $ChassisTypes[2] = "multibus";
  133 + $ChassisTypes[3] = "agsplus";
  134 + $ChassisTypes[4] = "igs";
  135 + $ChassisTypes[5] = "c2000";
  136 + $ChassisTypes[6] = "c3000";
  137 + $ChassisTypes[7] = "c4000";
  138 + $ChassisTypes[8] = "c7000";
  139 + $ChassisTypes[9] = "cs500";
  140 + $ChassisTypes[10] = "c7010";
  141 + $ChassisTypes[11] = "c2500";
  142 + $ChassisTypes[12] = "c4500";
  143 + $ChassisTypes[13] = "c2102";
  144 + $ChassisTypes[14] = "c2202";
  145 + $ChassisTypes[15] = "c2501";
  146 + $ChassisTypes[16] = "c2502";
  147 + $ChassisTypes[17] = "c2503";
  148 + $ChassisTypes[18] = "c2504";
  149 + $ChassisTypes[19] = "c2505";
  150 + $ChassisTypes[20] = "c2506";
  151 + $ChassisTypes[21] = "c2507";
  152 + $ChassisTypes[22] = "c2508";
  153 + $ChassisTypes[23] = "c2509";
  154 + $ChassisTypes[24] = "c2510";
  155 + $ChassisTypes[25] = "c2511";
  156 + $ChassisTypes[26] = "c2512";
  157 + $ChassisTypes[27] = "c2513";
  158 + $ChassisTypes[28] = "c2514";
  159 + $ChassisTypes[29] = "c2515";
  160 + $ChassisTypes[30] = "c3101";
  161 + $ChassisTypes[31] = "c3102";
  162 + $ChassisTypes[32] = "c3103";
  163 + $ChassisTypes[33] = "c3104";
  164 + $ChassisTypes[34] = "c3202";
  165 + $ChassisTypes[35] = "c3204";
  166 + $ChassisTypes[36] = "accessProRC";
  167 + $ChassisTypes[37] = "accessProEC";
  168 + $ChassisTypes[38] = "c1000";
  169 + $ChassisTypes[39] = "c1003";
  170 + $ChassisTypes[40] = "c1004";
  171 + $ChassisTypes[41] = "c2516";
  172 + $ChassisTypes[42] = "c7507";
  173 + $ChassisTypes[43] = "c7513";
  174 + $ChassisTypes[44] = "c7506";
  175 + $ChassisTypes[45] = "c7505";
  176 + $ChassisTypes[46] = "c1005";
  177 + $ChassisTypes[47] = "c4700";
  178 + $ChassisTypes[48] = "c2517";
  179 + $ChassisTypes[49] = "c2518";
  180 + $ChassisTypes[50] = "c2519";
  181 + $ChassisTypes[51] = "c2520";
  182 + $ChassisTypes[52] = "c2521";
  183 + $ChassisTypes[53] = "c2522";
  184 + $ChassisTypes[54] = "c2523";
  185 + $ChassisTypes[55] = "c2524";
  186 + $ChassisTypes[56] = "c2525";
  187 + $ChassisTypes[57] = "c4700S";
  188 + $ChassisTypes[58] = "c7206";
  189 + $ChassisTypes[59] = "c3640";
  190 + $ChassisTypes[60] = "as5200";
  191 + $ChassisTypes[61] = "c1601";
  192 + $ChassisTypes[62] = "c1602";
  193 + $ChassisTypes[63] = "c1603";
  194 + $ChassisTypes[64] = "c1604";
  195 + $ChassisTypes[65] = "c7204";
  196 + $ChassisTypes[66] = "c3620";
  197 + $ChassisTypes[68] = "wsx3011";
  198 + $ChassisTypes[72] = "c1503";
  199 + $ChassisTypes[73] = "as5300";
  200 + $ChassisTypes[74] = "as2509RJ";
  201 + $ChassisTypes[75] = "as2511RJ";
  202 + $ChassisTypes[77] = "c2501FRADFX";
  203 + $ChassisTypes[78] = "c2501LANFRADFX";
  204 + $ChassisTypes[79] = "c2502LANFRADFX";
  205 + $ChassisTypes[80] = "wsx5302";
  206 + $ChassisTypes[82] = "c12012";
  207 + $ChassisTypes[84] = "c12004";
  208 + $ChassisTypes[87] = "c2600";
  209 + $ChassisTypes[165] = "c7606";
  210 + $ChassisTypes[278] = "c7606";
  211 +
  212 + $chassis = $this->fcSnmpWalk(".1.3.6.1.4.1.9.3.6.1.0");
  213 +
  214 + if(isset($ChassisTypes[$chassis]))
  215 + {
  216 + return ($ChassisTypes[$chassis] == NULL) ? $ChassisTypes[0] : $ChassisTypes[$chassis];
  217 + }
  218 +
  219 + return $ChassisTypes[0];
  220 + }
  221 +
  222 + public function general()
  223 + {
  224 + $oids = array
  225 + (
  226 + "sysUptime" => ".1.3.6.1.2.1.1.3.0",
  227 + "whyReload" => ".1.3.6.1.4.1.9.2.1.2.0",
  228 + "version" => ".1.3.6.1.2.1.1.1.0",
  229 + "location" => ".1.3.6.1.2.1.1.6.0",
  230 + "contact" => ".1.3.6.1.2.1.1.4.0",
  231 + "avgBusy1" => ".1.3.6.1.4.1.9.2.1.57.0",
  232 + "avgBusy5" => ".1.3.6.1.4.1.9.2.1.58.0",
  233 + "sysConfigName" => ".1.3.6.1.4.1.9.2.1.73.0",
  234 + "tsLines" => ".1.3.6.1.4.1.9.2.9.1.0",
  235 + "cmSystemInstalledModem" => ".1.3.6.1.4.1.9.9.47.1.1.1.0",
  236 + "cmSystemModemsInUse" => ".1.3.6.1.4.1.9.9.47.1.1.6.0",
  237 + "cmSystemModemsDead" => ".1.3.6.1.4.1.9.9.47.1.1.10.0",
  238 + "Memory" => ".1.3.6.1.4.1.9.3.6.6.0",
  239 + "Services" => ".1.3.6.1.2.1.1.7.0"
  240 + );
  241 +
  242 + $MIBs = $oids['sysUptime'] . " " .
  243 + $oids['whyReload'] . " " .
  244 + $oids['location'] . " " .
  245 + $oids['contact'] . " " .
  246 + $oids['Memory'] . " " .
  247 + $oids['avgBusy1'] . " " .
  248 + $oids['avgBusy5'] . " " .
  249 + $oids['tsLines'] . " " .
  250 + $oids['Services'] . " " .
  251 + $oids['sysConfigName'] . " " .
  252 + $oids['cmSystemInstalledModem'];
  253 +
  254 + $result = $this->fcSnmpGet($MIBs);
  255 +
  256 + $sysName = $this->sysName;
  257 + $services = $this->sysSrv((isset($result[8])) ? $result[8] : "");
  258 + $memory = isset($result[4]) ? $result[4] : 0;
  259 + $memory /= (1024*1024); # TRANSFORMA PARA Mb
  260 +
  261 + $this->version = $this->sysVersion($oids["version"]);
  262 + $this->sysUpTime = $this->upTime($result[0]);
  263 +
  264 + echo $services;
  265 +
  266 + $this->y = 0;
  267 +
  268 + echo "
  269 + <br>
  270 + <TABLE border=0 CLASS='tabela' CELLPADDING='2' ALIGN='center'>
  271 + <TR><TH CLASS='thfont' COLSPAN='2'>Informa&ccedil;&otilde;es Gerais</TH></TR>
  272 + ";
  273 +
  274 + echo $this->printGeneralInfo("UpTime", $this->sysUpTime . "(motivo: $result[1])");
  275 + echo $this->printGeneralInfo("Nome do Equipamento", "$sysName");
  276 + echo $this->printGeneralInfo("Services", "$services");
  277 +
  278 + if ($result[2] != NULL)
  279 + echo $this->printGeneralInfo("Localiza&ccedil;&atilde;o", $result[2]);
  280 +
  281 + if ($result[2] != NULL)
  282 + echo $this->printGeneralInfo("Contato", $result[2]);
  283 +
  284 + echo $this->printGeneralInfo("Mem&oacute;ria Mb", "$memory");
  285 + echo $this->printGeneralInfo("Vers&atilde;o", $this->version);
  286 + echo $this->printGeneralInfo("1/5 min CPU util", ""); //$avgBusy1/$avgBusy5 %
  287 + echo $this->printGeneralInfo("Imagem Carregada", ""); //$sysCfgName
  288 + echo $this->printGeneralInfo("Terminal lines", ""); //$tsLines
  289 +/*
  290 + if ($sysModem > 0)
  291 + {
  292 +
  293 + $MIBs = $oids['cmSystemModemsInUse'] . " " .
  294 + $oids['cmSystemModemsDead'];
  295 +
  296 + list($modemsInUse, $modemsDead) = $this->fcSnmpGet($MIBs);
  297 +
  298 + $this->printGeneralInfo("Digital modems", "$sysModem");
  299 + $this->printGeneralInfo("In use modems", "$modemsInUse");
  300 + $this->printGeneralInfo("Modems Dead", "$modemsDead");
  301 + }
  302 +*/
  303 + echo "</table>";
  304 + }
  305 +
  306 + public function sysSrv($sv)
  307 + {
  308 + if ($sv & 1) {$srv = "Repeater"; }
  309 + if ($sv & 2) {$srv = "$srv Bridge"; }
  310 + if ($sv & 4) {$srv = "$srv Router"; }
  311 + if ($sv & 8) {$srv = "$srv Gateway"; }
  312 + if ($sv & 16) {$srv = "$srv Session"; }
  313 + if ($sv & 32) {$srv = "$srv Terminal"; }
  314 + if ($sv & 64) {$srv = "$srv Application"; }
  315 + if (!$sv) {$srv = "serviço SNMP não suportado"; }
  316 + return $srv;
  317 + }
  318 +
  319 + public function sysVersion($version)
  320 + {
  321 + $arrayVersion = $this->fcSnmpGet($version);
  322 +
  323 + for($i=0; $i<count($arrayVersion); $i++)
  324 + {
  325 + if(preg_match("/Version/i", $arrayVersion[$i]))
  326 + {
  327 + $aux = explode(",", stristr($arrayVersion[$i], "Version "));
  328 + return $aux[0];
  329 + }
  330 + }
  331 + }
  332 +
  333 + public function upTime($sysUpTime)
  334 + {
  335 +
  336 + $sysUpTime = substr($sysUpTime, 1);
  337 + $aux = explode(")",$sysUpTime);
  338 + $sysUpTime = substr($aux[0], 0, -2);
  339 +
  340 + $this->UpTimeTickts = $sysUpTime;
  341 +
  342 + $day = bcdiv($sysUpTime, 86400);
  343 + $sysUpTime = bcmod($sysUpTime, 86400);
  344 + $hour = bcdiv($sysUpTime, 3600);
  345 + $sysUpTime = bcmod($sysUpTime, 3600);
  346 + $minute = bcdiv($sysUpTime, 60);
  347 + $sec = bcmod($sysUpTime, 60);
  348 +
  349 + $daystr = ($day == 1) ? "Dia" : "Dias";
  350 + $hourstr = ($hour == 1) ? "hora" : "horas";
  351 + $minutestr = ($minute == 1) ? "minuto" : "minutos";
  352 + $secstr = ($sec == 1) ? "segundo" : "segundos";
  353 +
  354 + return "$day $daystr $hour $hourstr $minute $minutestr e $sec $secstr";
  355 + }
  356 +
  357 + public function printGeneralInfo($th, $info)
  358 + {
  359 + $classe = $this->oddCouple();
  360 + return "<TR><TD Class='$classe' ><B>$th</B></TD><TD Class='$classe'>$info</TD></TR>";
  361 + }
  362 +
  363 + public function oddCouple()
  364 + {
  365 + $classe = ((bcmod($this->y, 2)) == 0 ) ? "par" : "impar";
  366 + $this->y++;
  367 +
  368 + return $classe;
  369 + }
  370 +
  371 + public function hardware()
  372 + {
  373 + $oids = array(
  374 + "cards" => ".1.3.6.1.4.1.9.3.6.11.1.3",
  375 + "ctype" => ".1.3.6.1.4.1.9.3.6.11.1.2",
  376 + "slotnum" => ".1.3.6.1.4.1.9.3.6.11.1.7",
  377 + "cardSlots" => ".1.3.6.1.4.1.9.3.6.12.0"
  378 + );
  379 +
  380 + $CardTypes[1] = "desconhecido";
  381 + $CardTypes[2] = "csc1";
  382 + $CardTypes[3] = "csc2";
  383 + $CardTypes[4] = "csc3";
  384 + $CardTypes[5] = "csc4";
  385 + $CardTypes[6] = "rp";
  386 + $CardTypes[7] = "cpu-igs";
  387 + $CardTypes[8] = "cpu-2500";
  388 + $CardTypes[9] = "cpu-3000";
  389 + $CardTypes[10] = "cpu-3100";
  390 + $CardTypes[11] = "cpu-accessPro";
  391 + $CardTypes[12] = "cpu-4000";
  392 + $CardTypes[13] = "cpu-4000m";
  393 + $CardTypes[14] = "cpu-4500";
  394 + $CardTypes[15] = "rsp1";
  395 + $CardTypes[16] = "rsp2";
  396 + $CardTypes[17] = "cpu-4500m";
  397 + $CardTypes[18] = "cpu-1003";
  398 + $CardTypes[19] = "cpu-4700";
  399 + $CardTypes[20] = "csc-m";
  400 + $CardTypes[21] = "csc-mt";
  401 + $CardTypes[22] = "csc-mc";
  402 + $CardTypes[23] = "csc-mcplus";
  403 + $CardTypes[24] = "csc-envm";
  404 + $CardTypes[25] = "chassisInterface";
  405 + $CardTypes[26] = "cpu-4700S";
  406 + $CardTypes[27] = "cpu-7200-npe100";
  407 + $CardTypes[28] = "rsp7000";
  408 + $CardTypes[29] = "chassisInterface7000";
  409 + $CardTypes[30] = "rsp4";
  410 + $CardTypes[31] = "cpu-3600";
  411 + $CardTypes[32] = "cpu-as5200";
  412 + $CardTypes[33] = "c7200-io1fe";
  413 + $CardTypes[34] = "cpu-4700m";
  414 + $CardTypes[35] = "cpu-1600";
  415 + $CardTypes[36] = "c7200-io";
  416 + $CardTypes[37] = "cpu-1503";
  417 + $CardTypes[38] = "cpu-1502";
  418 + $CardTypes[39] = "cpu-as5300";
  419 + $CardTypes[40] = "csc-16";
  420 + $CardTypes[41] = "csc-p";
  421 + $CardTypes[50] = "csc-a";
  422 + $CardTypes[51] = "csc-e1";
  423 + $CardTypes[52] = "csc-e2";
  424 + $CardTypes[53] = "csc-y";
  425 + $CardTypes[54] = "csc-s";
  426 + $CardTypes[55] = "csc-t";
  427 + $CardTypes[80] = "csc-r";
  428 + $CardTypes[81] = "csc-r16";
  429 + $CardTypes[82] = "csc-r16m";
  430 + $CardTypes[83] = "csc-1r";
  431 + $CardTypes[84] = "csc-2r";
  432 + $CardTypes[56] = "sci4s";
  433 + $CardTypes[57] = "sci2s2t";
  434 + $CardTypes[58] = "sci4t";
  435 + $CardTypes[59] = "mci1t";
  436 + $CardTypes[60] = "mci2t";
  437 + $CardTypes[61] = "mci1s";
  438 + $CardTypes[62] = "mci1s1t";
  439 + $CardTypes[63] = "mci2s";
  440 + $CardTypes[64] = "mci1e";
  441 + $CardTypes[65] = "mci1e1t";
  442 + $CardTypes[66] = "mci1e2t";
  443 + $CardTypes[67] = "mci1e1s";
  444 + $CardTypes[68] = "mci1e1s1t";
  445 + $CardTypes[69] = "mci1e2s";
  446 + $CardTypes[70] = "mci2e";
  447 + $CardTypes[71] = "mci2e1t";
  448 + $CardTypes[72] = "mci2e2t";
  449 + $CardTypes[73] = "mci2e1s";
  450 + $CardTypes[74] = "mci2e1s1t";
  451 + $CardTypes[75] = "mci2e2s";
  452 + $CardTypes[100] = "csc-cctl1";
  453 + $CardTypes[101] = "csc-cctl2";
  454 + $CardTypes[110] = "csc-mec2";
  455 + $CardTypes[111] = "csc-mec4";
  456 + $CardTypes[112] = "csc-mec6";
  457 + $CardTypes[113] = "csc-fci";
  458 + $CardTypes[114] = "csc-fcit";
  459 + $CardTypes[115] = "csc-hsci";
  460 + $CardTypes[116] = "csc-ctr";
  461 + $CardTypes[121] = "cpu-7200-npe150";
  462 + $CardTypes[122] = "cpu-7200-npe200";
  463 + $CardTypes[123] = "cpu-wsx5302";
  464 + $CardTypes[124] = "gsr-rp";
  465 + $CardTypes[126] = "cpu-3810";
  466 + $CardTypes[150] = "sp";
  467 + $CardTypes[151] = "eip";
  468 + $CardTypes[152] = "fip";
  469 + $CardTypes[153] = "hip";
  470 + $CardTypes[154] = "sip";
  471 + $CardTypes[155] = "trip";
  472 + $CardTypes[156] = "fsip";
  473 + $CardTypes[157] = "aip";
  474 + $CardTypes[158] = "mip";
  475 + $CardTypes[159] = "ssp";
  476 + $CardTypes[160] = "cip";
  477 + $CardTypes[161] = "srs-fip";
  478 + $CardTypes[162] = "srs-trip";
  479 + $CardTypes[163] = "feip";
  480 + $CardTypes[164] = "vip";
  481 + $CardTypes[165] = "vip2";
  482 + $CardTypes[166] = "ssip";
  483 + $CardTypes[167] = "smip";
  484 + $CardTypes[168] = "posip";
  485 + $CardTypes[169] = "feip-tx";
  486 + $CardTypes[170] = "feip-fx";
  487 + $CardTypes[178] = "cbrt1";
  488 + $CardTypes[179] = "cbr120e1";
  489 + $CardTypes[180] = "cbr75e";
  490 + $CardTypes[181] = "vip2-50";
  491 + $CardTypes[182] = "feip2";
  492 + $CardTypes[183] = "acip";
  493 + $CardTypes[200] = "npm-4000-fddi-sas";
  494 + $CardTypes[201] = "npm-4000-fddi-das";
  495 + $CardTypes[202] = "npm-4000-1e";
  496 + $CardTypes[203] = "npm-4000-1r";
  497 + $CardTypes[204] = "npm-4000-2s";
  498 + $CardTypes[205] = "npm-4000-2e1";
  499 + $CardTypes[206] = "npm-4000-2e";
  500 + $CardTypes[207] = "npm-4000-2r1";
  501 + $CardTypes[208] = "npm-4000-2r";
  502 + $CardTypes[209] = "npm-4000-4t";
  503 + $CardTypes[210] = "npm-4000-4b";
  504 + $CardTypes[211] = "npm-4000-8b";
  505 + $CardTypes[212] = "npm-4000-ct1";
  506 + $CardTypes[213] = "npm-4000-ce1";
  507 + $CardTypes[214] = "npm-4000-1a";
  508 + $CardTypes[215] = "npm-4000-6e";
  509 + $CardTypes[217] = "npm-4000-1fe";
  510 + $CardTypes[218] = "npm-4000-1hssi";
  511 + $CardTypes[230] = "pa-1fe";
  512 + $CardTypes[231] = "pa-8e";
  513 + $CardTypes[232] = "pa-4e";
  514 + $CardTypes[233] = "pa-5e";
  515 + $CardTypes[234] = "pa-4t";
  516 + $CardTypes[235] = "pa-4r";
  517 + $CardTypes[236] = "pa-fddi";
  518 + $CardTypes[237] = "sa-encryption";
  519 + $CardTypes[238] = "pa-ah1t";
  520 + $CardTypes[239] = "pa-ah2t";
  521 + $CardTypes[241] = "pa-a8t-v35";
  522 + $CardTypes[242] = "pa-1fe-tx-isl";
  523 + $CardTypes[243] = "pa-1fe-fx-isl";
  524 + $CardTypes[244] = "pa-1fe-tx-nisl";
  525 + $CardTypes[245] = "sa-compression";
  526 + $CardTypes[246] = "pa-atm-lite-1";
  527 + $CardTypes[247] = "pa-ct3";
  528 + $CardTypes[248] = "pa-oc3sm-mux-cbrt1";
  529 + $CardTypes[249] = "pa-oc3sm-mux-cbr120e1";
  530 + $CardTypes[254] = "pa-ds3-mux-cbrt1";
  531 + $CardTypes[255] = "pa-e3-mux-cbr120e1";
  532 + $CardTypes[257] = "pa-8b-st";
  533 + $CardTypes[258] = "pa-4b-u";
  534 + $CardTypes[259] = "pa-fddi-fd";
  535 + $CardTypes[260] = "pm-cpm-1e2w";
  536 + $CardTypes[261] = "pm-cpm-2e2w";
  537 + $CardTypes[262] = "pm-cpm-1e1r2w";
  538 + $CardTypes[263] = "pm-ct1-csu";
  539 + $CardTypes[264] = "pm-2ct1-csu";
  540 + $CardTypes[265] = "pm-ct1-dsx1";
  541 + $CardTypes[266] = "pm-2ct1-dsx1";
  542 + $CardTypes[267] = "pm-ce1-balanced";
  543 + $CardTypes[268] = "pm-2ce1-balanced";
  544 + $CardTypes[269] = "pm-ce1-unbalanced";
  545 + $CardTypes[270] = "pm-2ce1-unbalanced";
  546 + $CardTypes[271] = "pm-4b-u";
  547 + $CardTypes[272] = "pm-4b-st";
  548 + $CardTypes[273] = "pm-8b-u";
  549 + $CardTypes[274] = "pm-8b-st";
  550 + $CardTypes[275] = "pm-4as";
  551 + $CardTypes[276] = "pm-8as";
  552 + $CardTypes[277] = "pm-4e";
  553 + $CardTypes[278] = "pm-1e";
  554 + $CardTypes[280] = "pm-m4t";
  555 + $CardTypes[281] = "pm-16a";
  556 + $CardTypes[282] = "pm-32a";
  557 + $CardTypes[283] = "pm-c3600-1fe-tx";
  558 + $CardTypes[284] = "pm-c3600-compression";
  559 + $CardTypes[285] = "pm-dmodem";
  560 + $CardTypes[288] = "pm-c3600-1fe-fx";
  561 + $CardTypes[288] = "pm-c3600-1fe-fx";
  562 + $CardTypes[290] = "as5200-carrier";
  563 + $CardTypes[291] = "as5200-2ct1";
  564 + $CardTypes[292] = "as5200-2ce1";
  565 + $CardTypes[310] = "pm-as5xxx-12m";
  566 + $CardTypes[330] = "wm-c2500-5in1";
  567 + $CardTypes[331] = "wm-c2500-t1-csudsu";
  568 + $CardTypes[332] = "wm-c2500-sw56-2wire-csudsu";
  569 + $CardTypes[333] = "wm-c2500-sw56-4wire-csudsu";
  570 + $CardTypes[334] = "wm-c2500-bri";
  571 + $CardTypes[335] = "wm-c2500-bri-nt1";
  572 + $CardTypes[360] = "wic-serial-1t";
  573 + $CardTypes[364] = "wic-s-t-3420";
  574 + $CardTypes[365] = "wic-s-t-2186";
  575 + $CardTypes[366] = "wic-u-3420";
  576 + $CardTypes[367] = "wic-u-2091";
  577 + $CardTypes[368] = "wic-u-2091-2081";
  578 + $CardTypes[400] = "pa-jt2";
  579 + $CardTypes[401] = "pa-posdw";
  580 + $CardTypes[402] = "pa-4me1-bal";
  581 + $CardTypes[414] = "pa-a8t-x21";
  582 + $CardTypes[415] = "pa-a8t-rs232";
  583 + $CardTypes[416] = "pa-4me1-unbal";
  584 + $CardTypes[417] = "pa-4r-fdx";
  585 + $CardTypes[424] = ",pa-1fe-fx-nisl";
  586 + $CardTypes[435] = ",mc3810-dcm";
  587 + $CardTypes[436] = ",mc3810-mfm-e1balanced-bri";
  588 + $CardTypes[437] = ",mc3810-mfm-e1unbalanced-bri";
  589 + $CardTypes[438] = ",mc3810-mfm-e1-unbalanced";
  590 + $CardTypes[439] = ",mc3810-mfm-dsx1-bri";
  591 + $CardTypes[440] = ",mc3810-mfm-dsx1-csu";
  592 + $CardTypes[441] = ",mc3810-vcm";
  593 + $CardTypes[442] = ",mc3810-avm";
  594 + $CardTypes[443] = ",mc3810-avm-fxs";
  595 + $CardTypes[444] = ",mc3810-avm-fxo";
  596 + $CardTypes[445] = ",mc3810-avm-em";
  597 + $CardTypes[445] = ",mc3810-avm-em";
  598 + $CardTypes[480] = ",as5300-4ct1";
  599 + $CardTypes[481] = ",as5300-4ce1";
  600 + $CardTypes[482] = ",as5300-carrier";
  601 + $CardTypes[500] = ",vic-em";
  602 + $CardTypes[501] = "vic-fxo";
  603 + $CardTypes[502] = "vic-fxs";
  604 + $CardTypes[503] = "vpm-2v";
  605 + $CardTypes[504] = "vpm-4v";
  606 + $CardTypes[530] = ",pos-qoc3-mm";
  607 + $CardTypes[531] = ",pos-qoc3-sm";
  608 + $CardTypes[532] = ",pos-oc12-mm";
  609 + $CardTypes[533] = ",pos-oc12-sm";
  610 + $CardTypes[534] = ",atm-oc12-mm";
  611 + $CardTypes[535] = ",atm-oc12-sm";
  612 + $CardTypes[536] = ",pos-oc48-mm-l";
  613 + $CardTypes[537] = ",pos-oc48-sm-l";
  614 + $CardTypes[538] = ",gsr-sfc";
  615 + $CardTypes[539] = ",gsr-csc";
  616 + $CardTypes[540] = ",gsr-csc4";
  617 + $CardTypes[541] = ",gsr-csc8";
  618 + $CardTypes[542] = ",gsr-sfc8";
  619 + $CardTypes[545] = ",gsr-oc12chds3-mm";
  620 + $CardTypes[546] = ",gsr-oc12chds3-sm";
  621 + $CardTypes[546] = ",gsr-oc12chds3-sm";
  622 + $CardTypes[546] = ",gsr-oc12chds3-sm";
  623 + $CardTypes[605] = ",pm-atm25";
  624 +
  625 + $cards = $this->fcSnmpWalk($oids['cards']);
  626 + $ctype = $this->fcSnmpWalk($oids['ctype']);
  627 + $slotnum = $this->fcSnmpWalk($oids['slotnum']);
  628 + $cardSlots = $this->fcSnmpGet($oids['cardSlots']) -1 ;
  629 +
  630 + $this->y = 0;
  631 +
  632 + if(count($cards) > 1)
  633 + {
  634 + echo "<BR>
  635 + <TABLE border=0 CLASS='tabela' CELLPADDING='3' ALIGN='center'>
  636 + <TR><TH CLASS='thfont' COLSPAN='3'>Informa&ccedil;&otilde;es de Hardware</TH></TR>
  637 + <TR BGCOLOR='#CDEDCF'><TD Class='topo' ALIGN='center'><B>Descri&ccedil;&atilde;o</B></TD><TD Class='topo' ALIGN='center'><B>Tipo</B></TD><TD Class='topo' ALIGN='center'><B>Slot</B></TD></TR>
  638 + ";
  639 +
  640 + for ($x = 0; $x<count($cards); $x++)
  641 + {
  642 + $CdTypes = ($CardTypes[$ctype[$x]]== NULL) ? $CardTypes[1] : $CardTypes[$ctype[$x]];
  643 +
  644 + $this->printInfoHardware($cards[$x], $CdTypes, $slotnum[$x]);
  645 + }
  646 + echo "<TR>
  647 + <TD COLSPAN='2' Class='base' BGCOLOR='#FFFFCC' ALIGN='center'>
  648 + <B>N&uacute;mero mais elevado de Slot</B>
  649 + </TD><td Class='base' BGCOLOR='#FFFFCC' ALIGN='center'>
  650 + <B>$cardSlots</B>
  651 + </TD>
  652 + </TR>
  653 + </TABLE>";
  654 + }
  655 + }
  656 +
  657 + public function printInfoHardware($cards, $CdTypes, $slotnum)
  658 + {
  659 + $classe = $this->oddCouple();
  660 + echo "
  661 + <TR>
  662 + <TD CLASS='$classe'>$cards</TD>
  663 + <TD CLASS='$classe'>$CdTypes</TD>
  664 + <TD CLASS='$classe' ALIGN='center'>$slotnum</TD>
  665 + </TR>
  666 + ";
  667 + }
  668 +
  669 + public function memoryFlash()
  670 + {
  671 + if (!preg_match("/[1-11]\./i", $this->version))
  672 + {
  673 + $oids = array
  674 + (
  675 + "flashSupported" => ".1.3.6.1.4.1.9.9.10.1.1.1.0",
  676 + "flashSize" => ".1.3.6.1.4.1.9.9.10.1.1.2.1.2",
  677 + "flashFileName" => ".1.3.6.1.4.1.9.9.10.1.1.4.2.1.1.5",
  678 + "flashDeviceDescr" => ".1.3.6.1.4.1.9.9.10.1.1.2.1.8",
  679 + "flashFreeSpace" => ".1.3.6.1.4.1.9.9.10.1.1.4.1.1.5"
  680 + );
  681 + }
  682 +
  683 + echo
  684 + "<BR>
  685 + <TABLE border=0 CLASS='tabela' CELLPADDING='2' ALIGN='center' WIDTH='500'>
  686 + <TR>
  687 + <TH CLASS='thfont' COLSPAN='4'>&Iacute;ndices de Mem&oacute;ria Flash</TH>
  688 + </TR>
  689 + <TR BGCOLOR='#CDEDCF'>
  690 + <TD Class='topo' ALIGN='center'><B>Filename</B></TD>
  691 + <TD Class='topo' ALIGN='center'><B>Dispositivo</B></TD>
  692 + <TD Class='topo' ALIGN='center'><B>Size (MB)</B></TD>
  693 + <TD Class='topo' ALIGN='center'><B>Free (MB)</B></TD>
  694 + </TR>";
  695 +
  696 + $flashSupported = $this->fcSnmpGet($oids{'flashSupported'});
  697 + $flashSize = $this->fcSnmpWalk($oids{'flashSize'});
  698 +
  699 + for ($x = 0; $x< count($flashSize); $x++)
  700 + {
  701 + $flashSize[$x] = round( ($flashSize[$x]/(1024*1024)), 1);
  702 +
  703 + if($flashSize[$x])
  704 + {
  705 + $MIBs = $oids{'flashFileName'} . '.' . ($x + 1) . ".1.1 " .
  706 + $oids{'flashDeviceDescr'} . '.' . ($x + 1) . " " .
  707 + $oids{'flashFreeSpace'} . '.' . ($x + 1) . ".1 ";
  708 +
  709 + list($flashFileName, $flashDeviceDescr, $flashFreeSpace) = $this->fcSnmpGet($MIBs);
  710 +
  711 + $flashFreeSpace = round(($flashFreeSpace/(1024*1024)), 1);
  712 +
  713 + $this->printInfoFlash($flashFileName, $flashDeviceDescr, $flashSize[$x], $flashFreeSpace);
  714 + }
  715 + }
  716 +
  717 + echo "</table>";
  718 + }
  719 +
  720 + public function printInfoFlash($flashFileName, $flashDeviceDescr, $flashSize, $flashFreeSpace)
  721 + {
  722 + $classe = $this->oddCouple();
  723 +
  724 + echo "<TR>
  725 + <TD CLASS='$classe'> $flashFileName</TD>
  726 + <TD CLASS='$classe'>$flashDeviceDescr</TD>
  727 + <TD CLASS='$classe'>$flashSize</TD>
  728 + <TD CLASS='$classe'>$flashFreeSpace</TD>
  729 + </TR>";
  730 + }
  731 +
  732 + public function interfaces()
  733 + {
  734 + $oids = array
  735 + (
  736 + "sysUptime" => ".1.3.6.1.2.1.1.3.0",
  737 + "IfIndex" => ".1.3.6.1.2.1.2.2.1.1",
  738 + "IfDescr" => ".1.3.6.1.2.1.2.2.1.2",
  739 + "Description" => ".1.3.6.1.2.1.31.1.1.1.18",
  740 + "Ip" => ".1.3.6.1.2.1.4.20.1.1",
  741 + "IpPorder" => ".1.3.6.1.2.1.4.20.1.2",
  742 + "IfAdminStatus" => ".1.3.6.1.2.1.2.2.1.7",
  743 + "IfOperStatus" => ".1.3.6.1.2.1.2.2.1.8",
  744 + "LastChange" => ".1.3.6.1.2.1.2.2.1.9",
  745 + "ifMac" => ".1.3.6.1.2.1.2.2.1.6"
  746 + );
  747 +
  748 + echo
  749 + " <BR>
  750 + <TABLE border=1 width='97%' CLASS='tabela' CELLPADDING='2'>
  751 + <TR><TH COLSPAN='8' CLASS='thfont'>Informa&ccedil;&otilde;es das Interfaces</TH></TR>
  752 + <TR><TH CLASS='topo' ROWSPAN='2'>N&ordm;<BR>Interface</TH><TH CLASS='topo' ROWSPAN='2'>Tipo de <BR>Interface</TH><TH CLASS='topo' ROWSPAN='2'>Descri&ccedil;&atilde;o da Interface</TH><TH CLASS='topo' COLSPAN='2'>Status</TH><TH CLASS='topo' ROWSPAN='2'>Endere&ccedil;o<br>Ip</TH><TH CLASS='topo' ROWSPAN='2'>Endere&ccedil;o<br>MAC</TH><TH CLASS='topo' ROWSPAN='2'>Last Change</TH></TR>
  753 + <TR><TH CLASS='topo'>Adm</TH><TH CLASS='topo'>Opr</TH></TR>
  754 + ";
  755 +
  756 + $this->y=0;
  757 +
  758 + echo $this->sysUpTime;
  759 +
  760 + $ArrayIndex = $this->fcSnmpWalk($oids{'IfIndex'});
  761 + $IP = $this->fcSnmpWalk($oids{'Ip'});
  762 + $IpPorder = $this->fcSnmpWalk($oids{'IpPorder'});
  763 +
  764 +
  765 + if(count($IP) == count($IpPorder))
  766 + {
  767 + for ($i=0; $i < count($ArrayIndex); $i++)
  768 + {
  769 + for ($x=0; $x<count($IP); $x++)
  770 + {
  771 + $indice = $ArrayIndex[$i];
  772 +
  773 + if ($ArrayIndex[$i] == $IpPorder[$x])
  774 + $IPs[$indice] = $IP[$x];
  775 + }
  776 + }
  777 + }
  778 +
  779 + for ($i=0; $i< count($ArrayIndex); $i++)
  780 + {
  781 + $index = $ArrayIndex[$i];
  782 +
  783 + $MIBs = $oids{'IfDescr'} . ".$index " .
  784 + $oids{'IfAdminStatus'} . ".$index " .
  785 + $oids{'IfOperStatus'} . ".$index " .
  786 + $oids{'ifMac'} . ".$index " .
  787 + $oids{'LastChange'} . ".$index " .
  788 + $oids{'Description'} . ".$index ";
  789 +
  790 + list($IfDescr, $IfAdminStatus, $IfOperStatus,
  791 + $ifMac, $LastChange, $Description) = $this->fcSnmpGet($MIBs);
  792 +
  793 + $IfAdminStatus = $this->status($IfAdminStatus);
  794 + $IfOperStatus = $this->status($IfOperStatus);
  795 + $ifMac = $this->ifMacAddress($ifMac);
  796 + $LastChange = $this->lastChange($LastChange);
  797 +
  798 + $classe = $this->oddCouple();
  799 +
  800 + $ip = isset($IPs[$index]) ? $IPs[$index] : null;
  801 +
  802 + echo "<TR ALIGN='center'>
  803 + <TD ALIGN='center' CLASS='$classe'>$index</TD>
  804 + <TD CLASS='$classe'>$IfDescr</TD>
  805 + <TD CLASS='$classe'>$Description</TD>
  806 + <TD CLASS='$classe'>$IfAdminStatus</TD>
  807 + <TD CLASS='$classe'>$IfOperStatus</TD>
  808 + <TD CLASS='$classe'>$ip</TD>
  809 + <TD CLASS='$classe'>$ifMac</TD>
  810 + <TD CLASS='$classe'>$LastChange</TD>
  811 + </TR>";
  812 + }
  813 + echo "</TABLE>";
  814 + }
  815 +
  816 + public function status($status)
  817 + {
  818 + return (preg_match("/UP/i", $status)) ? "UP" : "DOWN";
  819 + }
  820 +
  821 + public function ifMacAddress($Mac)
  822 + {
  823 + $ifMac = '&nbsp;';
  824 +
  825 + $partes = explode(":", strtoupper($Mac));
  826 +
  827 + for($i=0; $i<count($partes); $i++)
  828 + {
  829 + if ($partes[$i]=='0')
  830 + $partes[$i]="00";
  831 +
  832 + $ifMac .= " " . $partes[$i];
  833 + }
  834 +
  835 + return $ifMac;
  836 + }
  837 +
  838 + public function lastChange($LsCh)
  839 + {
  840 + $LsCh = substr($LsCh, 1);
  841 + $aux = explode(")",$LsCh);
  842 + $LsCh = substr($aux[0], 0, -2);
  843 +
  844 + $x = $this->UpTimeTickts - $LsCh;
  845 +
  846 + $day = bcdiv($x, 86400);
  847 + $x = bcmod($x, 86400);
  848 + $hour = bcdiv($x, 3600);
  849 + $x = bcmod($x, 3600);
  850 + $minute = bcdiv($x, 60);
  851 + $sec = bcmod($x, 60);
  852 +
  853 + return "<B>$day</B>d <B>$hour</B>h <B>$minute</B>m e <B>$sec</B>s";
  854 + }
  855 +}
0 856 \ No newline at end of file
... ...
Controller/SnmpWebController.php 0 → 100755
  1 +++ a/Controller/SnmpWebController.php
... ... @@ -0,0 +1,73 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +use Symfony\Component\HttpFoundation\Request;
  8 +
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  10 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  11 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  12 +
  13 +use GerenciadorRedes\Bundle\CocarBundle\Controller\SnmpController;
  14 +
  15 +class SnmpWebController extends Controller
  16 +{
  17 + /**
  18 + * @Route("/infosnmp", name="cocar_infosnmp")
  19 + * @Method("POST")
  20 + * @Template()
  21 + */
  22 + public function snmpInfoAction(Request $request)
  23 + {
  24 + $form = $this->snmpForm();
  25 + $form->submit($request);
  26 +
  27 + if ($form->isValid())
  28 + {
  29 + $data = $form->getData();
  30 +
  31 + $snmp = new SnmpController(
  32 + $data['host'],
  33 + $data['community'],
  34 + null
  35 + );
  36 +
  37 + $snmp->hostName();
  38 +
  39 + $snmp->printHost();
  40 + $snmp->general();
  41 + $snmp->hardware();
  42 + $snmp->memoryFlash();
  43 + $snmp->interfaces();
  44 + }
  45 +
  46 + return new Response();
  47 + }
  48 +
  49 + /**
  50 + * @Route("/snmpweb", name="cocar_snmpweb")
  51 + * @Template()
  52 + */
  53 + public function snmpAction()
  54 + {
  55 + $form = $this->snmpForm();
  56 +
  57 + return array('form' => $form->createView());
  58 + }
  59 +
  60 + /**
  61 + * @param mixed $id the circuit id
  62 + *
  63 + * @return \Symfony\Component\Form\Form the form
  64 + */
  65 + private function snmpForm()
  66 + {
  67 + return $this->createFormBuilder()
  68 + ->add('host', 'text')
  69 + ->add('community', 'text')
  70 + ->add('send', 'submit', array('label' => 'Enviar' ))
  71 + ->getForm();
  72 + }
  73 +}
0 74 \ No newline at end of file
... ...
Controller/StatusController.php 0 → 100755
  1 +++ a/Controller/StatusController.php
... ... @@ -0,0 +1,82 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\Response;
  7 +
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10 +
  11 +use GerenciadorRedes\Bundle\CocarBundle\Controller\SnmpController;
  12 +
  13 +class StatusController extends Controller
  14 +{
  15 + /**
  16 + * @Route("/status", name="cocar_status")
  17 + * @Template()
  18 + */
  19 + public function statusAction()
  20 + {
  21 + $oids = array(
  22 + "index" => ".1.3.6.1.2.1.2.2.1.1",
  23 + "descr" => ".1.3.6.1.2.1.2.2.1.2",
  24 + "adminStatus" => ".1.3.6.1.2.1.2.2.1.7",
  25 + "operStatus" => ".1.3.6.1.2.1.2.2.1.8"
  26 + );
  27 +
  28 + #verificar o campo geraAlarme='S' na tabela tb_circuits
  29 +
  30 + $em = $this->getDoctrine()->getManager();
  31 +
  32 + $circuits = $em->getRepository('CocarBundle:Circuits')->findAll();
  33 +
  34 + foreach($circuits as $cir)
  35 + {
  36 + $obj = new SnmpController(
  37 + $cir->getIpBackbone(),
  38 + $cir->getCommunitySnmpBackbone(),
  39 + $cir->getCodeInterface()
  40 + );
  41 +
  42 + if($obj->sysUpTime())
  43 + {
  44 + $numInterface = $cir->getNumSnmpinterface();
  45 +
  46 + $MensageIBs = $oids{'descr'} . ".$numInterface " .
  47 + $oids{'adminStatus'} . ".$numInterface " .
  48 + $oids{'operStatus'} . ".$numInterface ";
  49 +
  50 + list($ifDescr, $ifAdminStatus, $ifOperStatus) = $obj->fcSnmpGet($MensageIBs);
  51 +
  52 + $ifDescr = str_replace("-aal5 layer", "", $ifDescr);
  53 + $ifDescr = str_replace("atm subif", "", $ifDescr);
  54 +
  55 + if($cir->getSerialBackbone() == $ifDescr)
  56 + {
  57 + $cir->setAdminStatus($this->status($ifAdminStatus));
  58 + $cir->setOperStatus($this->status($ifOperStatus));
  59 +
  60 + $em->persist($cir);
  61 + $em->flush();
  62 + }
  63 + }
  64 + else
  65 + {
  66 + $cir->setAdminStatus($this->status('INAT'));
  67 + $cir->setOperStatus($this->status('INAT'));
  68 +
  69 + $em->persist($cir);
  70 + $em->flush();
  71 + }
  72 + }
  73 +
  74 + return new Response();
  75 + }
  76 +
  77 + public function status($status)
  78 + {
  79 + return preg_match("/1/i", $status) ? "UP" :
  80 + (preg_match("/2/i", $status) ? "DOWN" : "INAT");
  81 + }
  82 +}
0 83 \ No newline at end of file
... ...
DependencyInjection/CocarExtension.php 0 → 100755
  1 +++ a/DependencyInjection/CocarExtension.php
... ... @@ -0,0 +1,28 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\DependencyInjection;
  4 +
  5 +use Symfony\Component\DependencyInjection\ContainerBuilder;
  6 +use Symfony\Component\Config\FileLocator;
  7 +use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  8 +use Symfony\Component\DependencyInjection\Loader;
  9 +
  10 +/**
  11 + * This is the class that loads and manages your bundle configuration
  12 + *
  13 + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
  14 + */
  15 +class CocarExtension extends Extension
  16 +{
  17 + /**
  18 + * {@inheritDoc}
  19 + */
  20 + public function load(array $configs, ContainerBuilder $container)
  21 + {
  22 + $configuration = new Configuration();
  23 + $config = $this->processConfiguration($configuration, $configs);
  24 +
  25 + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
  26 + $loader->load('services.yml');
  27 + }
  28 +}
... ...
DependencyInjection/Configuration.php 0 → 100755
  1 +++ a/DependencyInjection/Configuration.php
... ... @@ -0,0 +1,29 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\DependencyInjection;
  4 +
  5 +use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  6 +use Symfony\Component\Config\Definition\ConfigurationInterface;
  7 +
  8 +/**
  9 + * This is the class that validates and merges configuration from your app/config files
  10 + *
  11 + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
  12 + */
  13 +class Configuration implements ConfigurationInterface
  14 +{
  15 + /**
  16 + * {@inheritDoc}
  17 + */
  18 + public function getConfigTreeBuilder()
  19 + {
  20 + $treeBuilder = new TreeBuilder();
  21 + $rootNode = $treeBuilder->root('cocar');
  22 +
  23 + // Here you should define the parameters that are allowed to
  24 + // configure your bundle. See the documentation linked above for
  25 + // more information on that topic.
  26 +
  27 + return $treeBuilder;
  28 + }
  29 +}
... ...
Entity/Circuits.php 0 → 100755
  1 +++ a/Entity/Circuits.php
... ... @@ -0,0 +1,830 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +use Doctrine\Common\Collections\ArrayCollection;
  7 +
  8 +/**
  9 + * Circuits
  10 + *
  11 + * @ORM\Table(name="tb_circuits")
  12 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\CustomCircuitsRepository")
  13 + */
  14 +class Circuits
  15 +{
  16 + /**
  17 + * @var integer
  18 + *
  19 + * @ORM\Column(name="id", type="integer")
  20 + * @ORM\Id
  21 + * @ORM\GeneratedValue(strategy="AUTO")
  22 + */
  23 + private $id;
  24 +
  25 + /**
  26 + * @ORM\ManyToOne(targetEntity="Entity", inversedBy="circuits")
  27 + * @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  28 + */
  29 + protected $entity;
  30 +
  31 + /**
  32 + * @ORM\OneToMany(targetEntity="Machine", mappedBy="gateway", cascade={"persist"})
  33 + */
  34 + protected $machine;
  35 +
  36 + /**
  37 + * @var string
  38 + *
  39 + * @ORM\Column(name="code_interface", type="string", length=255)
  40 + */
  41 + private $codeInterface;
  42 +
  43 + /**
  44 + * @var string
  45 + *
  46 + * @ORM\Column(name="admin_status", type="string", length=5, nullable=true)
  47 + */
  48 + private $adminStatus = 'UP';
  49 +
  50 + /**
  51 + * @var string
  52 + *
  53 + * @ORM\Column(name="oper_status", type="string", length=5, nullable=true)
  54 + */
  55 + private $operStatus = 'UP';
  56 +
  57 + /**
  58 + * @var string
  59 + *
  60 + * @ORM\Column(name="status", type="string", length=5, nullable=true)
  61 + */
  62 + private $status = 'UP';
  63 +
  64 + /**
  65 + * @var string
  66 + *
  67 + * @ORM\Column(name="generate_alarm", type="boolean", length=5, nullable=true)
  68 + */
  69 + private $generateAlarm = true;
  70 +
  71 + /**
  72 + * @var string
  73 + *
  74 + * @ORM\Column(name="description", type="string", length=255)
  75 + */
  76 + private $description;
  77 +
  78 + /**
  79 + * @var string
  80 + *
  81 + * @ORM\Column(name="manages", type="string", length=255)
  82 + */
  83 + private $manages;
  84 +
  85 + /**
  86 + * @var string $reliability
  87 + *
  88 + * @ORM\Column(name="reliability", type="string", nullable=true)
  89 + */
  90 + private $reliability = '255';
  91 +
  92 + /**
  93 + * @var string
  94 + *
  95 + * @ORM\Column(name="ip_backbone", type="string", length=255)
  96 + */
  97 + private $ipBackbone;
  98 +
  99 + /**
  100 + * @var string
  101 + *
  102 + * @ORM\Column(name="community_snmp_backbone", type="string", length=255)
  103 + */
  104 + private $communitySnmpBackbone;
  105 +
  106 + /**
  107 + * @var string
  108 + *
  109 + * @ORM\Column(name="serial_backbone", type="string", length=255)
  110 + */
  111 + private $serialBackbone;
  112 +
  113 + /**
  114 + * @var string
  115 + *
  116 + * @ORM\Column(name="technology", type="string", length=255)
  117 + */
  118 + private $technology;
  119 +
  120 + /**
  121 + * @var string
  122 + *
  123 + * @ORM\Column(name="type_interface", type="string", length=255)
  124 + */
  125 + private $typeInterface;
  126 +
  127 + /**
  128 + * @var string
  129 + *
  130 + * @ORM\Column(name="num_snmp_interface", type="string", length=255)
  131 + */
  132 + private $numSnmpInterface;
  133 +
  134 + /**
  135 + * @var string
  136 + *
  137 + * @ORM\Column(name="ip_serial_interface", type="string", length=255)
  138 + */
  139 + private $ipSerialInterface;
  140 +
  141 + /**
  142 + * @var string
  143 + *
  144 + * @ORM\Column(name="register_circuit", type="string", length=255)
  145 + */
  146 + private $registerCircuit;
  147 +
  148 + /**
  149 + * @var string
  150 + *
  151 + * @ORM\Column(name="speed", type="string", length=255)
  152 + */
  153 + private $speed;
  154 +
  155 + /**
  156 + * @var string
  157 + *
  158 + * @ORM\Column(name="cir_in", type="string", length=255)
  159 + */
  160 + private $cirIn;
  161 +
  162 + /**
  163 + * @var string
  164 + *
  165 + * @ORM\Column(name="cir_out", type="string", length=255)
  166 + */
  167 + private $cirOut;
  168 +
  169 + /**
  170 + * @var string
  171 + *
  172 + * @ORM\Column(name="serial_router_tip", type="string", length=255)
  173 + */
  174 + private $serialRouterTip;
  175 +
  176 + /**
  177 + * @var string
  178 + *
  179 + * @ORM\Column(name="snmp_port_tip", type="string", length=255)
  180 + */
  181 + private $snmpPortTip;
  182 +
  183 + /**
  184 + * @var string
  185 + *
  186 + * @ORM\Column(name="community_snmp_router_tip", type="string", length=255)
  187 + */
  188 + private $communitySnmpRouterTip;
  189 +
  190 + /**
  191 + * @var string
  192 + *
  193 + * @ORM\Column(name="ip_serial_router_tip", type="string", length=255)
  194 + */
  195 + private $ipSerialRouterTip;
  196 +
  197 + /**
  198 + * @var string
  199 + *
  200 + * @ORM\Column(name="history", type="string", length=255)
  201 + */
  202 + private $history = 'N';
  203 +
  204 + /**
  205 + * Construct
  206 + */
  207 + public function __construct()
  208 + {
  209 + $this->machine = new ArrayCollection();
  210 + }
  211 +
  212 + /**
  213 + * Get id
  214 + *
  215 + * @return integer
  216 + */
  217 + public function getId()
  218 + {
  219 + return $this->id;
  220 + }
  221 +
  222 + /**
  223 + * Set codeInterface
  224 + *
  225 + * @param string $codeInterface
  226 + * @return Circuits
  227 + */
  228 + public function setCodeInterface($codeInterface)
  229 + {
  230 + $this->codeInterface = $codeInterface;
  231 +
  232 + return $this;
  233 + }
  234 +
  235 + /**
  236 + * Get codeInterface
  237 + *
  238 + * @return string
  239 + */
  240 + public function getCodeInterface()
  241 + {
  242 + return $this->codeInterface;
  243 + }
  244 +
  245 + /**
  246 + * Set description
  247 + *
  248 + * @param string $description
  249 + * @return Circuits
  250 + */
  251 + public function setDescription($description)
  252 + {
  253 + $this->description = $description;
  254 +
  255 + return $this;
  256 + }
  257 +
  258 + /**
  259 + * Get description
  260 + *
  261 + * @return string
  262 + */
  263 + public function getDescription()
  264 + {
  265 + return $this->description;
  266 + }
  267 +
  268 + /**
  269 + * Set manages
  270 + *
  271 + * @param string $manages
  272 + * @return Circuits
  273 + */
  274 + public function setManages($manages)
  275 + {
  276 + $this->manages = $manages;
  277 +
  278 + return $this;
  279 + }
  280 +
  281 + /**
  282 + * Get manages
  283 + *
  284 + * @return string
  285 + */
  286 + public function getManages()
  287 + {
  288 + return $this->manages;
  289 + }
  290 +
  291 + /**
  292 + * Set ipBackbone
  293 + *
  294 + * @param string $ipBackbone
  295 + * @return Circuits
  296 + */
  297 + public function setIpBackbone($ipBackbone)
  298 + {
  299 + $this->ipBackbone = $ipBackbone;
  300 +
  301 + return $this;
  302 + }
  303 +
  304 + /**
  305 + * Get ipBackbone
  306 + *
  307 + * @return string
  308 + */
  309 + public function getIpBackbone()
  310 + {
  311 + return $this->ipBackbone;
  312 + }
  313 +
  314 + /**
  315 + * Set communitySnmpBackbone
  316 + *
  317 + * @param string $communitySnmpBackbone
  318 + * @return Circuits
  319 + */
  320 + public function setCommunitySnmpBackbone($communitySnmpBackbone)
  321 + {
  322 + $this->communitySnmpBackbone = $communitySnmpBackbone;
  323 +
  324 + return $this;
  325 + }
  326 +
  327 + /**
  328 + * Get communitySnmpBackbone
  329 + *
  330 + * @return string
  331 + */
  332 + public function getCommunitySnmpBackbone()
  333 + {
  334 + return $this->communitySnmpBackbone;
  335 + }
  336 +
  337 + /**
  338 + * Set serialBackbone
  339 + *
  340 + * @param string $serialBackbone
  341 + * @return Circuits
  342 + */
  343 + public function setSerialBackbone($serialBackbone)
  344 + {
  345 + $this->serialBackbone = $serialBackbone;
  346 +
  347 + return $this;
  348 + }
  349 +
  350 + /**
  351 + * Get serialBackbone
  352 + *
  353 + * @return string
  354 + */
  355 + public function getSerialBackbone()
  356 + {
  357 + return $this->serialBackbone;
  358 + }
  359 +
  360 + /**
  361 + * Set technology
  362 + *
  363 + * @param string $technology
  364 + * @return Circuits
  365 + */
  366 + public function setTechnology($technology)
  367 + {
  368 + $this->technology = $technology;
  369 +
  370 + return $this;
  371 + }
  372 +
  373 + /**
  374 + * Get technology
  375 + *
  376 + * @return string
  377 + */
  378 + public function getTechnology()
  379 + {
  380 + return $this->technology;
  381 + }
  382 +
  383 + /**
  384 + * Set typeInterface
  385 + *
  386 + * @param string $typeInterface
  387 + * @return Circuits
  388 + */
  389 + public function setTypeInterface($typeInterface)
  390 + {
  391 + $this->typeInterface = $typeInterface;
  392 +
  393 + return $this;
  394 + }
  395 +
  396 + /**
  397 + * Get typeInterface
  398 + *
  399 + * @return string
  400 + */
  401 + public function getTypeInterface()
  402 + {
  403 + return $this->typeInterface;
  404 + }
  405 +
  406 + /**
  407 + * Set numSnmpInterface
  408 + *
  409 + * @param string $numSnmpInterface
  410 + * @return Circuits
  411 + */
  412 + public function setNumSnmpInterface($numSnmpInterface)
  413 + {
  414 + $this->numSnmpInterface = $numSnmpInterface;
  415 +
  416 + return $this;
  417 + }
  418 +
  419 + /**
  420 + * Get numSnmpInterface
  421 + *
  422 + * @return string
  423 + */
  424 + public function getNumSnmpInterface()
  425 + {
  426 + return $this->numSnmpInterface;
  427 + }
  428 +
  429 + /**
  430 + * Set ipSerialInterface
  431 + *
  432 + * @param string $ipSerialInterface
  433 + * @return Circuits
  434 + */
  435 + public function setIpSerialInterface($ipSerialInterface)
  436 + {
  437 + $this->ipSerialInterface = $ipSerialInterface;
  438 +
  439 + return $this;
  440 + }
  441 +
  442 + /**
  443 + * Get ipSerialInterface
  444 + *
  445 + * @return string
  446 + */
  447 + public function getIpSerialInterface()
  448 + {
  449 + return $this->ipSerialInterface;
  450 + }
  451 +
  452 + /**
  453 + * Set registerCircuit
  454 + *
  455 + * @param string $registerCircuit
  456 + * @return Circuits
  457 + */
  458 + public function setRegisterCircuit($registerCircuit)
  459 + {
  460 + $this->registerCircuit = $registerCircuit;
  461 +
  462 + return $this;
  463 + }
  464 +
  465 + /**
  466 + * Get registerCircuit
  467 + *
  468 + * @return string
  469 + */
  470 + public function getRegisterCircuit()
  471 + {
  472 + return $this->registerCircuit;
  473 + }
  474 +
  475 + /**
  476 + * Set speed
  477 + *
  478 + * @param string $speed
  479 + * @return Circuits
  480 + */
  481 + public function setSpeed($speed)
  482 + {
  483 + $this->speed = $speed;
  484 +
  485 + return $this;
  486 + }
  487 +
  488 + /**
  489 + * Get speed
  490 + *
  491 + * @return string
  492 + */
  493 + public function getSpeed()
  494 + {
  495 + return $this->speed;
  496 + }
  497 +
  498 + /**
  499 + * Set cirIn
  500 + *
  501 + * @param string $cirIn
  502 + * @return Circuits
  503 + */
  504 + public function setCirIn($cirIn)
  505 + {
  506 + $this->cirIn = $cirIn;
  507 +
  508 + return $this;
  509 + }
  510 +
  511 + /**
  512 + * Get cirIn
  513 + *
  514 + * @return string
  515 + */
  516 + public function getCirIn()
  517 + {
  518 + return $this->cirIn;
  519 + }
  520 +
  521 + /**
  522 + * Set cirOut
  523 + *
  524 + * @param string $cirOut
  525 + * @return Circuits
  526 + */
  527 + public function setCirOut($cirOut)
  528 + {
  529 + $this->cirOut = $cirOut;
  530 +
  531 + return $this;
  532 + }
  533 +
  534 + /**
  535 + * Get cirOut
  536 + *
  537 + * @return string
  538 + */
  539 + public function getCirOut()
  540 + {
  541 + return $this->cirOut;
  542 + }
  543 +
  544 + /**
  545 + * Set serialRouterTip
  546 + *
  547 + * @param string $serialRouterTip
  548 + * @return Circuits
  549 + */
  550 + public function setSerialRouterTip($serialRouterTip)
  551 + {
  552 + $this->serialRouterTip = $serialRouterTip;
  553 +
  554 + return $this;
  555 + }
  556 +
  557 + /**
  558 + * Get serialRouterTip
  559 + *
  560 + * @return string
  561 + */
  562 + public function getSerialRouterTip()
  563 + {
  564 + return $this->serialRouterTip;
  565 + }
  566 +
  567 + /**
  568 + * Set snmpPortTip
  569 + *
  570 + * @param string $snmpPortTip
  571 + * @return Circuits
  572 + */
  573 + public function setSnmpPortTip($snmpPortTip)
  574 + {
  575 + $this->snmpPortTip = $snmpPortTip;
  576 +
  577 + return $this;
  578 + }
  579 +
  580 + /**
  581 + * Get snmpPortTip
  582 + *
  583 + * @return string
  584 + */
  585 + public function getSnmpPortTip()
  586 + {
  587 + return $this->snmpPortTip;
  588 + }
  589 +
  590 + /**
  591 + * Set communitySnmpRouterTip
  592 + *
  593 + * @param string $communitySnmpRouterTip
  594 + * @return Circuits
  595 + */
  596 + public function setCommunitySnmpRouterTip($communitySnmpRouterTip)
  597 + {
  598 + $this->communitySnmpRouterTip = $communitySnmpRouterTip;
  599 +
  600 + return $this;
  601 + }
  602 +
  603 + /**
  604 + * Get communitySnmpRouterTip
  605 + *
  606 + * @return string
  607 + */
  608 + public function getCommunitySnmpRouterTip()
  609 + {
  610 + return $this->communitySnmpRouterTip;
  611 + }
  612 +
  613 + /**
  614 + * Set ipSerialRouterTip
  615 + *
  616 + * @param string $ipSerialRouterTip
  617 + * @return Circuits
  618 + */
  619 + public function setIpSerialRouterTip($ipSerialRouterTip)
  620 + {
  621 + $this->ipSerialRouterTip = $ipSerialRouterTip;
  622 +
  623 + return $this;
  624 + }
  625 +
  626 + /**
  627 + * Get ipSerialRouterTip
  628 + *
  629 + * @return string
  630 + */
  631 + public function getIpSerialRouterTip()
  632 + {
  633 + return $this->ipSerialRouterTip;
  634 + }
  635 +
  636 + /**
  637 + * Set entity
  638 + *
  639 + * @param \Cocar\CocarBundle\Entity\Entity $entity
  640 + * @return Circuits
  641 + */
  642 + public function setEntity(\GerenciadorRedes\Bundle\CocarBundle\Entity\Entity $entity = null)
  643 + {
  644 + $this->entity = $entity;
  645 +
  646 + return $this;
  647 + }
  648 +
  649 + /**
  650 + * Get entity
  651 + *
  652 + * @return \Cocar\CocarBundle\Entity\Entity
  653 + */
  654 + public function getEntity()
  655 + {
  656 + return $this->entity;
  657 + }
  658 +
  659 + /**
  660 + * Set adminStatus
  661 + *
  662 + * @param string $adminStatus
  663 + * @return Circuits
  664 + */
  665 + public function setAdminStatus($adminStatus)
  666 + {
  667 + $this->adminStatus = $adminStatus;
  668 +
  669 + return $this;
  670 + }
  671 +
  672 + /**
  673 + * Get adminStatus
  674 + *
  675 + * @return string
  676 + */
  677 + public function getAdminStatus()
  678 + {
  679 + return $this->adminStatus;
  680 + }
  681 +
  682 + /**
  683 + * Set operStatus
  684 + *
  685 + * @param string $operStatus
  686 + * @return Circuits
  687 + */
  688 + public function setOperStatus($operStatus)
  689 + {
  690 + $this->operStatus = $operStatus;
  691 +
  692 + return $this;
  693 + }
  694 +
  695 + /**
  696 + * Get operStatus
  697 + *
  698 + * @return string
  699 + */
  700 + public function getOperStatus()
  701 + {
  702 + return $this->operStatus;
  703 + }
  704 +
  705 + /**
  706 + * Set status
  707 + *
  708 + * @param string $status
  709 + * @return Circuits
  710 + */
  711 + public function setStatus($status)
  712 + {
  713 + $this->status = $status;
  714 +
  715 + return $this;
  716 + }
  717 +
  718 + /**
  719 + * Get status
  720 + *
  721 + * @return string
  722 + */
  723 + public function getStatus()
  724 + {
  725 + return $this->status;
  726 + }
  727 +
  728 + /**
  729 + * Set generateAlarm
  730 + *
  731 + * @param boolean $generateAlarm
  732 + * @return Circuits
  733 + */
  734 + public function setGenerateAlarm($generateAlarm)
  735 + {
  736 + $this->generateAlarm = $generateAlarm;
  737 +
  738 + return $this;
  739 + }
  740 +
  741 + /**
  742 + * Get generateAlarm
  743 + *
  744 + * @return boolean
  745 + */
  746 + public function getGenerateAlarm()
  747 + {
  748 + return $this->generateAlarm;
  749 + }
  750 +
  751 + /**
  752 + * Set reliability
  753 + *
  754 + * @param string $reliability
  755 + * @return Circuits
  756 + */
  757 + public function setReliability($reliability)
  758 + {
  759 + $this->reliability = $reliability;
  760 +
  761 + return $this;
  762 + }
  763 +
  764 + /**
  765 + * Get reliability
  766 + *
  767 + * @return string
  768 + */
  769 + public function getReliability()
  770 + {
  771 + return $this->reliability;
  772 + }
  773 +
  774 + /**
  775 + * Set history
  776 + *
  777 + * @param string $history
  778 + * @return Circuits
  779 + */
  780 + public function setHistory($history)
  781 + {
  782 + $this->history = $history;
  783 +
  784 + return $this;
  785 + }
  786 +
  787 + /**
  788 + * Get history
  789 + *
  790 + * @return string
  791 + */
  792 + public function getHistory()
  793 + {
  794 + return $this->history;
  795 + }
  796 +
  797 +
  798 + /**
  799 + * Add circuits
  800 + *
  801 + * @param \Cocar\CocarBundle\Entity\Machine $machine
  802 + * @return Entity
  803 + */
  804 + public function addMachine(\GerenciadorRedes\Bundle\CocarBundle\Entity\Machine $machine)
  805 + {
  806 + $this->machine[] = $machine;
  807 +
  808 + return $this;
  809 + }
  810 +
  811 + /**
  812 + * Remove machine
  813 + *
  814 + * @param \Cocar\CocarBundle\Entity\Circuits $machine
  815 + */
  816 + public function removeMachine(\GerenciadorRedes\Bundle\CocarBundle\Entity\Machine $machine)
  817 + {
  818 + $this->machine->removeElement($machine);
  819 + }
  820 +
  821 + /**
  822 + * Get machine
  823 + *
  824 + * @return \Doctrine\Common\Collections\Collection
  825 + */
  826 + public function getMachine()
  827 + {
  828 + return $this->machine;
  829 + }
  830 +}
0 831 \ No newline at end of file
... ...
Entity/CustomCircuitsRepository.php 0 → 100755
  1 +++ a/Entity/CustomCircuitsRepository.php
... ... @@ -0,0 +1,31 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * CircuitsRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class CustomCircuitsRepository extends EntityRepository
  14 +{
  15 + public function findCircuitsBy($codeInterface, $ipBackbone)
  16 + {
  17 + return $this->getEntityManager()
  18 + ->createQuery(
  19 + "SELECT c FROM CocarBundle:Circuits c
  20 + WHERE c.codeInterface = :cod
  21 + AND c.ipBackbone = :ip
  22 + AND c.status = :status
  23 + AND c.generateAlarm = :alarm"
  24 + )
  25 + ->setParameter('cod', $codeInterface)
  26 + ->setParameter('ip', $ipBackbone)
  27 + ->setParameter('status', 'UP')
  28 + ->setParameter('alarm', true)
  29 + ->getResult();
  30 + }
  31 +}
0 32 \ No newline at end of file
... ...
Entity/CustomEntityRepository.php 0 → 100755
  1 +++ a/Entity/CustomEntityRepository.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * EntityRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class CustomEntityRepository extends EntityRepository
  14 +{
  15 +}
... ...
Entity/DailyPerformance.php 0 → 100755
  1 +++ a/Entity/DailyPerformance.php
... ... @@ -0,0 +1,1354 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +/**
  8 + * Performance
  9 + *
  10 + * @ORM\Table(name="tb_daily_performance")
  11 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\DailyPerformanceRepository")
  12 + */
  13 +class DailyPerformance
  14 +{
  15 + /**
  16 + * @var integer
  17 + *
  18 + * @ORM\Column(name="id", type="integer")
  19 + * @ORM\Id
  20 + * @ORM\GeneratedValue(strategy="AUTO")
  21 + */
  22 + private $id;
  23 +
  24 + /**
  25 + * @var integer
  26 + *
  27 + * @ORM\Column(name="code_interface", type="integer")
  28 + */
  29 + private $codeInterface;
  30 +
  31 + /**
  32 + * @var \DateTime
  33 + *
  34 + * @ORM\Column(name="day", type="datetime")
  35 + */
  36 + private $day;
  37 +
  38 + /**
  39 + * @var integer
  40 + *
  41 + * @ORM\Column(name="cir_in", type="integer")
  42 + */
  43 + private $cirIn = 0;
  44 +
  45 + /**
  46 + * @var integer
  47 + *
  48 + * @ORM\Column(name="cir_out", type="integer")
  49 + */
  50 + private $cirOut = 0;
  51 +
  52 + /**
  53 + * @var integer
  54 + *
  55 + * @ORM\Column(name="cir_in_rec", type="integer")
  56 + */
  57 + private $cirInRec = 0;
  58 +
  59 + /**
  60 + * @var integer
  61 + *
  62 + * @ORM\Column(name="cir_out_rec", type="integer")
  63 + */
  64 + private $cirOutRec = 0;
  65 +
  66 + /**
  67 + * @var integer
  68 + *
  69 + * @ORM\Column(name="volume_in", type="bigint")
  70 + */
  71 + private $volumeIn = 0;
  72 +
  73 + /**
  74 + * @var integer
  75 + *
  76 + * @ORM\Column(name="volume_out", type="bigint")
  77 + */
  78 + private $volumeOut = 0;
  79 +
  80 + /**
  81 + * @var float
  82 + *
  83 + * @ORM\Column(name="delay_120_160", type="float")
  84 + */
  85 + private $delay120160 = 0;
  86 +
  87 + /**
  88 + * @var float
  89 + *
  90 + * @ORM\Column(name="delay_m_160", type="float")
  91 + */
  92 + private $delayM160 = 0;
  93 +
  94 + /**
  95 + * @var \DateTime
  96 + *
  97 + * @ORM\Column(name="loss_in_hour", type="time")
  98 + */
  99 + private $lossInHour;
  100 +
  101 + /**
  102 + * @var float
  103 + *
  104 + * @ORM\Column(name="loss_in_peak", type="float")
  105 + */
  106 + private $lossInPeak = 0;
  107 +
  108 + /**
  109 + * @var \DateTime
  110 + *
  111 + * @ORM\Column(name="loss_out_hour", type="time")
  112 + */
  113 + private $lossOutHour;
  114 +
  115 + /**
  116 + * @var float
  117 + *
  118 + * @ORM\Column(name="loss_out_peak", type="float")
  119 + */
  120 + private $lossOutPeak = 0;
  121 +
  122 + /**
  123 + * @var float
  124 + *
  125 + * @ORM\Column(name="loss_out_3_6", type="float")
  126 + */
  127 + private $lossOut36 = 0;
  128 +
  129 + /**
  130 + * @var float
  131 + *
  132 + * @ORM\Column(name="loss_in_3_6", type="float")
  133 + */
  134 + private $lossInt36 = 0;
  135 +
  136 + /**
  137 + * @var float
  138 + *
  139 + * @ORM\Column(name="loss_out_m_6", type="float")
  140 + */
  141 + private $lossOutM6 = 0;
  142 +
  143 + /**
  144 + * @var float
  145 + *
  146 + * @ORM\Column(name="loss_in_m_6", type="float")
  147 + */
  148 + private $lossInM6 = 0;
  149 +
  150 + /**
  151 + * @var float
  152 + *
  153 + * @ORM\Column(name="congest_in_10_30", type="float")
  154 + */
  155 + private $congestIn1030 = 0;
  156 +
  157 + /**
  158 + * @var float
  159 + *
  160 + * @ORM\Column(name="congest_in_m_30", type="float")
  161 + */
  162 + private $congestInM30 = 0;
  163 +
  164 + /**
  165 + * @var float
  166 + *
  167 + * @ORM\Column(name="congest_out_10_30", type="float")
  168 + */
  169 + private $congestOut1030 = 0;
  170 +
  171 + /**
  172 + * @var float
  173 + *
  174 + * @ORM\Column(name="congest_out_m_30", type="float")
  175 + */
  176 + private $congestOutM30 = 0;
  177 +
  178 + /**
  179 + * @var \DateTime
  180 + *
  181 + * @ORM\Column(name="hmm_hour_in", type="time")
  182 + */
  183 + private $hmmHourIn;
  184 +
  185 + /**
  186 + * @var \DateTime
  187 + *
  188 + * @ORM\Column(name="hmm_hour_out", type="time")
  189 + */
  190 + private $hmmHourOut;
  191 +
  192 + /**
  193 + * @var integer
  194 + *
  195 + * @ORM\Column(name="hmm_peak_in", type="float")
  196 + */
  197 + private $hmmPeakIn = 0;
  198 +
  199 + /**
  200 + * @var integer
  201 + *
  202 + * @ORM\Column(name="hmm_peak_out", type="float")
  203 + */
  204 + private $hmmPeakOut = 0;
  205 +
  206 + /**
  207 + * @var integer
  208 + *
  209 + * @ORM\Column(name="hmm_media_in", type="float")
  210 + */
  211 + private $hmmMediaIn = 0;
  212 +
  213 + /**
  214 + * @var integer
  215 + *
  216 + * @ORM\Column(name="hmm_media_out", type="float")
  217 + */
  218 + private $hmmMediaOut = 0;
  219 +
  220 + /**
  221 + * @var float
  222 + *
  223 + * @ORM\Column(name="hmm_criticality_in", type="float")
  224 + */
  225 + private $hmmCriticalityIn = 0;
  226 +
  227 + /**
  228 + * @var float
  229 + *
  230 + * @ORM\Column(name="hmm_criticality_out", type="float")
  231 + */
  232 + private $hmmCriticalityOut = 0;
  233 +
  234 + /**
  235 + * @var integer
  236 + *
  237 + * @ORM\Column(name="hmm_hour_in_per", type="time")
  238 + */
  239 + private $hmmHourInPer;
  240 +
  241 + /**
  242 + * @var \DateTime
  243 + *
  244 + * @ORM\Column(name="hmm_hour_out_per", type="time")
  245 + */
  246 + private $hmmHourOutPer;
  247 +
  248 + /**
  249 + * @var integer
  250 + *
  251 + * @ORM\Column(name="hmm_peak_in_per", type="float")
  252 + */
  253 + private $hmmPeakInPer = 0;
  254 +
  255 + /**
  256 + * @var integer
  257 + *
  258 + * @ORM\Column(name="hmm_peak_out_per", type="float")
  259 + */
  260 + private $hmmPeakOutPer = 0;
  261 +
  262 + /**
  263 + * @var integer
  264 + *
  265 + * @ORM\Column(name="hmm_media_in_per", type="float")
  266 + */
  267 + private $hmmMediaInPer = 0;
  268 +
  269 + /**
  270 + * @var integer
  271 + *
  272 + * @ORM\Column(name="hmm_media_out_per", type="float")
  273 + */
  274 + private $hmmMediaOutPer = 0;
  275 +
  276 + /**
  277 + * @var float
  278 + *
  279 + * @ORM\Column(name="hmm_criticality_in_per", type="float")
  280 + */
  281 + private $hmmCriticalityInPer = 0;
  282 +
  283 + /**
  284 + * @var float
  285 + *
  286 + * @ORM\Column(name="hmm_criticality_out_per", type="float")
  287 + */
  288 + private $hmmCriticalityOutPer = 0;
  289 +
  290 + /**
  291 + * @var integer
  292 + *
  293 + * @ORM\Column(name="_7_19_peak_in", type="float")
  294 + */
  295 + private $_719PeakIn = 0;
  296 +
  297 + /**
  298 + * @var integer
  299 + *
  300 + * @ORM\Column(name="_7_19_peak_out", type="float")
  301 + */
  302 + private $_719PeakOut = 0;
  303 +
  304 + /**
  305 + * @var integer
  306 + *
  307 + * @ORM\Column(name="_7_19_media_in", type="float")
  308 + */
  309 + private $_719MediaIn = 0;
  310 +
  311 + /**
  312 + * @var integer
  313 + *
  314 + * @ORM\Column(name="_7_19_media_out", type="float")
  315 + */
  316 + private $_719MediaOut = 0;
  317 +
  318 + /**
  319 + * @var float
  320 + *
  321 + * @ORM\Column(name="_7_19_criticality_in", type="float")
  322 + */
  323 + private $_719CriticalityIn = 0;
  324 +
  325 + /**
  326 + * @var float
  327 + *
  328 + * @ORM\Column(name="_7_19_criticality_out", type="float")
  329 + */
  330 + private $_719CriticalityOut = 0;
  331 +
  332 +
  333 + /**
  334 + * Get id
  335 + *
  336 + * @return integer
  337 + */
  338 + public function getId()
  339 + {
  340 + return $this->id;
  341 + }
  342 +
  343 + /**
  344 + * Set codeInterface
  345 + *
  346 + * @param integer $codeInterface
  347 + * @return Performance
  348 + */
  349 + public function setCodeInterface($codeInterface)
  350 + {
  351 + $this->codeInterface = $codeInterface;
  352 +
  353 + return $this;
  354 + }
  355 +
  356 + /**
  357 + * Get codeInterface
  358 + *
  359 + * @return integer
  360 + */
  361 + public function getCodeInterface()
  362 + {
  363 + return $this->codeInterface;
  364 + }
  365 +
  366 + /**
  367 + * Set day
  368 + *
  369 + * @param \DateTime $day
  370 + * @return Performance
  371 + */
  372 + public function setDay($day)
  373 + {
  374 + $this->day = $day;
  375 +
  376 + return $this;
  377 + }
  378 +
  379 + /**
  380 + * Get day
  381 + *
  382 + * @return \DateTime
  383 + */
  384 + public function getDay()
  385 + {
  386 + return $this->day;
  387 + }
  388 +
  389 + /**
  390 + * Set cirIn
  391 + *
  392 + * @param integer $cirIn
  393 + * @return Performance
  394 + */
  395 + public function setCirIn($cirIn)
  396 + {
  397 + $this->cirIn = $cirIn;
  398 +
  399 + return $this;
  400 + }
  401 +
  402 + /**
  403 + * Get cirIn
  404 + *
  405 + * @return integer
  406 + */
  407 + public function getCirIn()
  408 + {
  409 + return $this->cirIn;
  410 + }
  411 +
  412 + /**
  413 + * Set cirOut
  414 + *
  415 + * @param integer $cirOut
  416 + * @return Performance
  417 + */
  418 + public function setCirOut($cirOut)
  419 + {
  420 + $this->cirOut = $cirOut;
  421 +
  422 + return $this;
  423 + }
  424 +
  425 + /**
  426 + * Get cirOut
  427 + *
  428 + * @return integer
  429 + */
  430 + public function getCirOut()
  431 + {
  432 + return $this->cirOut;
  433 + }
  434 +
  435 + /**
  436 + * Set cirInRec
  437 + *
  438 + * @param integer $cirInRec
  439 + * @return Performance
  440 + */
  441 + public function setCirInRec($cirInRec)
  442 + {
  443 + $this->cirInRec = $cirInRec;
  444 +
  445 + return $this;
  446 + }
  447 +
  448 + /**
  449 + * Get cirInRec
  450 + *
  451 + * @return integer
  452 + */
  453 + public function getCirInRec()
  454 + {
  455 + return $this->cirInRec;
  456 + }
  457 +
  458 + /**
  459 + * Set cirOutRec
  460 + *
  461 + * @param integer $cirOutRec
  462 + * @return Performance
  463 + */
  464 + public function setCirOutRec($cirOutRec)
  465 + {
  466 + $this->cirOutRec = $cirOutRec;
  467 +
  468 + return $this;
  469 + }
  470 +
  471 + /**
  472 + * Get cirOutRec
  473 + *
  474 + * @return integer
  475 + */
  476 + public function getCirOutRec()
  477 + {
  478 + return $this->cirOutRec;
  479 + }
  480 +
  481 + /**
  482 + * Set volumeIn
  483 + *
  484 + * @param integer $volumeIn
  485 + * @return Performance
  486 + */
  487 + public function setVolumeIn($volumeIn)
  488 + {
  489 + $this->volumeIn = $volumeIn;
  490 +
  491 + return $this;
  492 + }
  493 +
  494 + /**
  495 + * Get volumeIn
  496 + *
  497 + * @return integer
  498 + */
  499 + public function getVolumeIn()
  500 + {
  501 + return $this->volumeIn;
  502 + }
  503 +
  504 + /**
  505 + * Set volumeOut
  506 + *
  507 + * @param integer $volumeOut
  508 + * @return Performance
  509 + */
  510 + public function setVolumeOut($volumeOut)
  511 + {
  512 + $this->volumeOut = $volumeOut;
  513 +
  514 + return $this;
  515 + }
  516 +
  517 + /**
  518 + * Get volumeOut
  519 + *
  520 + * @return integer
  521 + */
  522 + public function getVolumeOut()
  523 + {
  524 + return $this->volumeOut;
  525 + }
  526 +
  527 + /**
  528 + * Set delay120160
  529 + *
  530 + * @param float $delay120160
  531 + * @return Performance
  532 + */
  533 + public function setDelay120160($delay120160)
  534 + {
  535 + $this->delay120160 = $delay120160;
  536 +
  537 + return $this;
  538 + }
  539 +
  540 + /**
  541 + * Get delay120160
  542 + *
  543 + * @return float
  544 + */
  545 + public function getDelay120160()
  546 + {
  547 + return $this->delay120160;
  548 + }
  549 +
  550 + /**
  551 + * Set delayM160
  552 + *
  553 + * @param float $delayM160
  554 + * @return Performance
  555 + */
  556 + public function setDelayM160($delayM160)
  557 + {
  558 + $this->delayM160 = $delayM160;
  559 +
  560 + return $this;
  561 + }
  562 +
  563 + /**
  564 + * Get delayM160
  565 + *
  566 + * @return float
  567 + */
  568 + public function getDelayM160()
  569 + {
  570 + return $this->delayM160;
  571 + }
  572 +
  573 + /**
  574 + * Set lossInHour
  575 + *
  576 + * @param \DateTime $lossInHour
  577 + * @return Performance
  578 + */
  579 + public function setLossInHour($lossInHour)
  580 + {
  581 + $this->lossInHour = $lossInHour;
  582 +
  583 + return $this;
  584 + }
  585 +
  586 + /**
  587 + * Get lossInHour
  588 + *
  589 + * @return \DateTime
  590 + */
  591 + public function getLossInHour()
  592 + {
  593 + return $this->lossInHour;
  594 + }
  595 +
  596 + /**
  597 + * Set lossInPeak
  598 + *
  599 + * @param float $lossInPeak
  600 + * @return Performance
  601 + */
  602 + public function setLossInPeak($lossInPeak)
  603 + {
  604 + $this->lossInPeak = $lossInPeak;
  605 +
  606 + return $this;
  607 + }
  608 +
  609 + /**
  610 + * Get lossInPeak
  611 + *
  612 + * @return float
  613 + */
  614 + public function getLossInPeak()
  615 + {
  616 + return $this->lossInPeak;
  617 + }
  618 +
  619 + /**
  620 + * Set lossOutHour
  621 + *
  622 + * @param \DateTime $lossOutHour
  623 + * @return Performance
  624 + */
  625 + public function setLossOutHour($lossOutHour)
  626 + {
  627 + $this->lossOutHour = $lossOutHour;
  628 +
  629 + return $this;
  630 + }
  631 +
  632 + /**
  633 + * Get lossOutHour
  634 + *
  635 + * @return \DateTime
  636 + */
  637 + public function getLossOutHour()
  638 + {
  639 + return $this->lossOutHour;
  640 + }
  641 +
  642 + /**
  643 + * Set lossOutPeak
  644 + *
  645 + * @param float $lossOutPeak
  646 + * @return Performance
  647 + */
  648 + public function setLossOutPeak($lossOutPeak)
  649 + {
  650 + $this->lossOutPeak = $lossOutPeak;
  651 +
  652 + return $this;
  653 + }
  654 +
  655 + /**
  656 + * Get lossOutPeak
  657 + *
  658 + * @return float
  659 + */
  660 + public function getLossOutPeak()
  661 + {
  662 + return $this->lossOutPeak;
  663 + }
  664 +
  665 + /**
  666 + * Set lossOut36
  667 + *
  668 + * @param float $lossOut36
  669 + * @return Performance
  670 + */
  671 + public function setLossOut36($lossOut36)
  672 + {
  673 + $this->lossOut36 = $lossOut36;
  674 +
  675 + return $this;
  676 + }
  677 +
  678 + /**
  679 + * Get lossOut36
  680 + *
  681 + * @return float
  682 + */
  683 + public function getLossOut36()
  684 + {
  685 + return $this->lossOut36;
  686 + }
  687 +
  688 + /**
  689 + * Set lossInt36
  690 + *
  691 + * @param float $lossInt36
  692 + * @return Performance
  693 + */
  694 + public function setLossInt36($lossInt36)
  695 + {
  696 + $this->lossInt36 = $lossInt36;
  697 +
  698 + return $this;
  699 + }
  700 +
  701 + /**
  702 + * Get lossInt36
  703 + *
  704 + * @return float
  705 + */
  706 + public function getLossInt36()
  707 + {
  708 + return $this->lossInt36;
  709 + }
  710 +
  711 + /**
  712 + * Set lossOutM6
  713 + *
  714 + * @param float $lossOutM6
  715 + * @return Performance
  716 + */
  717 + public function setLossOutM6($lossOutM6)
  718 + {
  719 + $this->lossOutM6 = $lossOutM6;
  720 +
  721 + return $this;
  722 + }
  723 +
  724 + /**
  725 + * Get lossOutM6
  726 + *
  727 + * @return float
  728 + */
  729 + public function getLossOutM6()
  730 + {
  731 + return $this->lossOutM6;
  732 + }
  733 +
  734 + /**
  735 + * Set lossInM6
  736 + *
  737 + * @param float $lossInM6
  738 + * @return Performance
  739 + */
  740 + public function setLossInM6($lossInM6)
  741 + {
  742 + $this->lossInM6 = $lossInM6;
  743 +
  744 + return $this;
  745 + }
  746 +
  747 + /**
  748 + * Get lossInM6
  749 + *
  750 + * @return float
  751 + */
  752 + public function getLossInM6()
  753 + {
  754 + return $this->lossInM6;
  755 + }
  756 +
  757 + /**
  758 + * Set congestIn1030
  759 + *
  760 + * @param float $congestIn1030
  761 + * @return Performance
  762 + */
  763 + public function setCongestIn1030($congestIn1030)
  764 + {
  765 + $this->congestIn1030 = $congestIn1030;
  766 +
  767 + return $this;
  768 + }
  769 +
  770 + /**
  771 + * Get congestIn1030
  772 + *
  773 + * @return float
  774 + */
  775 + public function getCongestIn1030()
  776 + {
  777 + return $this->congestIn1030;
  778 + }
  779 +
  780 + /**
  781 + * Set congestInM30
  782 + *
  783 + * @param float $congestInM30
  784 + * @return Performance
  785 + */
  786 + public function setCongestInM30($congestInM30)
  787 + {
  788 + $this->congestInM30 = $congestInM30;
  789 +
  790 + return $this;
  791 + }
  792 +
  793 + /**
  794 + * Get congestInM30
  795 + *
  796 + * @return float
  797 + */
  798 + public function getCongestInM30()
  799 + {
  800 + return $this->congestInM30;
  801 + }
  802 +
  803 + /**
  804 + * Set congestOut1030
  805 + *
  806 + * @param float $congestOut1030
  807 + * @return Performance
  808 + */
  809 + public function setCongestOut1030($congestOut1030)
  810 + {
  811 + $this->congestOut1030 = $congestOut1030;
  812 +
  813 + return $this;
  814 + }
  815 +
  816 + /**
  817 + * Get congestOut1030
  818 + *
  819 + * @return float
  820 + */
  821 + public function getCongestOut1030()
  822 + {
  823 + return $this->congestOut1030;
  824 + }
  825 +
  826 + /**
  827 + * Set congestOutM30
  828 + *
  829 + * @param float $congestOutM30
  830 + * @return Performance
  831 + */
  832 + public function setCongestOutM30($congestOutM30)
  833 + {
  834 + $this->congestOutM30 = $congestOutM30;
  835 +
  836 + return $this;
  837 + }
  838 +
  839 + /**
  840 + * Get congestOutM30
  841 + *
  842 + * @return float
  843 + */
  844 + public function getCongestOutM30()
  845 + {
  846 + return $this->congestOutM30;
  847 + }
  848 +
  849 + /**
  850 + * Set hmmHourIn
  851 + *
  852 + * @param \DateTime $hmmHourIn
  853 + * @return Performance
  854 + */
  855 + public function setHmmHourIn($hmmHourIn)
  856 + {
  857 + $this->hmmHourIn = $hmmHourIn;
  858 +
  859 + return $this;
  860 + }
  861 +
  862 + /**
  863 + * Get hmmHourIn
  864 + *
  865 + * @return \DateTime
  866 + */
  867 + public function getHmmHourIn()
  868 + {
  869 + return $this->hmmHourIn;
  870 + }
  871 +
  872 + /**
  873 + * Set hmmHourOut
  874 + *
  875 + * @param \DateTime $hmmHourOut
  876 + * @return Performance
  877 + */
  878 + public function setHmmHourOut($hmmHourOut)
  879 + {
  880 + $this->hmmHourOut = $hmmHourOut;
  881 +
  882 + return $this;
  883 + }
  884 +
  885 + /**
  886 + * Get hmmHourOut
  887 + *
  888 + * @return \DateTime
  889 + */
  890 + public function getHmmHourOut()
  891 + {
  892 + return $this->hmmHourOut;
  893 + }
  894 +
  895 + /**
  896 + * Set hmmPeakIn
  897 + *
  898 + * @param integer $hmmPeakIn
  899 + * @return Performance
  900 + */
  901 + public function setHmmPeakIn($hmmPeakIn)
  902 + {
  903 + $this->hmmPeakIn = $hmmPeakIn;
  904 +
  905 + return $this;
  906 + }
  907 +
  908 + /**
  909 + * Get hmmPeakIn
  910 + *
  911 + * @return integer
  912 + */
  913 + public function getHmmPeakIn()
  914 + {
  915 + return $this->hmmPeakIn;
  916 + }
  917 +
  918 + /**
  919 + * Set hmmPeakOut
  920 + *
  921 + * @param integer $hmmPeakOut
  922 + * @return Performance
  923 + */
  924 + public function setHmmPeakOut($hmmPeakOut)
  925 + {
  926 + $this->hmmPeakOut = $hmmPeakOut;
  927 +
  928 + return $this;
  929 + }
  930 +
  931 + /**
  932 + * Get hmmPeakOut
  933 + *
  934 + * @return integer
  935 + */
  936 + public function getHmmPeakOut()
  937 + {
  938 + return $this->hmmPeakOut;
  939 + }
  940 +
  941 + /**
  942 + * Set hmmMediaIn
  943 + *
  944 + * @param integer $hmmMediaIn
  945 + * @return Performance
  946 + */
  947 + public function setHmmMediaIn($hmmMediaIn)
  948 + {
  949 + $this->hmmMediaIn = $hmmMediaIn;
  950 +
  951 + return $this;
  952 + }
  953 +
  954 + /**
  955 + * Get hmmMediaIn
  956 + *
  957 + * @return integer
  958 + */
  959 + public function getHmmMediaIn()
  960 + {
  961 + return $this->hmmMediaIn;
  962 + }
  963 +
  964 + /**
  965 + * Set hmmMediaOut
  966 + *
  967 + * @param integer $hmmMediaOut
  968 + * @return Performance
  969 + */
  970 + public function setHmmMediaOut($hmmMediaOut)
  971 + {
  972 + $this->hmmMediaOut = $hmmMediaOut;
  973 +
  974 + return $this;
  975 + }
  976 +
  977 + /**
  978 + * Get hmmMediaOut
  979 + *
  980 + * @return integer
  981 + */
  982 + public function getHmmMediaOut()
  983 + {
  984 + return $this->hmmMediaOut;
  985 + }
  986 +
  987 + /**
  988 + * Set hmmCriticalityIn
  989 + *
  990 + * @param float $hmmCriticalityIn
  991 + * @return Performance
  992 + */
  993 + public function setHmmCriticalityIn($hmmCriticalityIn)
  994 + {
  995 + $this->hmmCriticalityIn = $hmmCriticalityIn;
  996 +
  997 + return $this;
  998 + }
  999 +
  1000 + /**
  1001 + * Get hmmCriticalityIn
  1002 + *
  1003 + * @return float
  1004 + */
  1005 + public function getHmmCriticalityIn()
  1006 + {
  1007 + return $this->hmmCriticalityIn;
  1008 + }
  1009 +
  1010 + /**
  1011 + * Set hmmCriticalityOut
  1012 + *
  1013 + * @param float $hmmCriticalityOut
  1014 + * @return Performance
  1015 + */
  1016 + public function setHmmCriticalityOut($hmmCriticalityOut)
  1017 + {
  1018 + $this->hmmCriticalityOut = $hmmCriticalityOut;
  1019 +
  1020 + return $this;
  1021 + }
  1022 +
  1023 + /**
  1024 + * Get hmmCriticalityOut
  1025 + *
  1026 + * @return float
  1027 + */
  1028 + public function getHmmCriticalityOut()
  1029 + {
  1030 + return $this->hmmCriticalityOut;
  1031 + }
  1032 +
  1033 + /**
  1034 + * Set hmmHourInPer
  1035 + *
  1036 + * @param integer $hmmHourInPer
  1037 + * @return Performance
  1038 + */
  1039 + public function setHmmHourInPer($hmmHourInPer)
  1040 + {
  1041 + $this->hmmHourInPer = $hmmHourInPer;
  1042 +
  1043 + return $this;
  1044 + }
  1045 +
  1046 + /**
  1047 + * Get hmmHourInPer
  1048 + *
  1049 + * @return integer
  1050 + */
  1051 + public function getHmmHourInPer()
  1052 + {
  1053 + return $this->hmmHourInPer;
  1054 + }
  1055 +
  1056 + /**
  1057 + * Set hmmHourOutPer
  1058 + *
  1059 + * @param \DateTime $hmmHourOutPer
  1060 + * @return Performance
  1061 + */
  1062 + public function setHmmHourOutPer($hmmHourOutPer)
  1063 + {
  1064 + $this->hmmHourOutPer = $hmmHourOutPer;
  1065 +
  1066 + return $this;
  1067 + }
  1068 +
  1069 + /**
  1070 + * Get hmmHourOutPer
  1071 + *
  1072 + * @return \DateTime
  1073 + */
  1074 + public function getHmmHourOutPer()
  1075 + {
  1076 + return $this->hmmHourOutPer;
  1077 + }
  1078 +
  1079 + /**
  1080 + * Set hmmPeakInPer
  1081 + *
  1082 + * @param integer $hmmPeakInPer
  1083 + * @return Performance
  1084 + */
  1085 + public function setHmmPeakInPer($hmmPeakInPer)
  1086 + {
  1087 + $this->hmmPeakInPer = $hmmPeakInPer;
  1088 +
  1089 + return $this;
  1090 + }
  1091 +
  1092 + /**
  1093 + * Get hmmPeakInPer
  1094 + *
  1095 + * @return integer
  1096 + */
  1097 + public function getHmmPeakInPer()
  1098 + {
  1099 + return $this->hmmPeakInPer;
  1100 + }
  1101 +
  1102 + /**
  1103 + * Set hmmPeakOutPer
  1104 + *
  1105 + * @param integer $hmmPeakOutPer
  1106 + * @return Performance
  1107 + */
  1108 + public function setHmmPeakOutPer($hmmPeakOutPer)
  1109 + {
  1110 + $this->hmmPeakOutPer = $hmmPeakOutPer;
  1111 +
  1112 + return $this;
  1113 + }
  1114 +
  1115 + /**
  1116 + * Get hmmPeakOutPer
  1117 + *
  1118 + * @return integer
  1119 + */
  1120 + public function getHmmPeakOutPer()
  1121 + {
  1122 + return $this->hmmPeakOutPer;
  1123 + }
  1124 +
  1125 + /**
  1126 + * Set hmmMediaInPer
  1127 + *
  1128 + * @param integer $hmmMediaInPer
  1129 + * @return Performance
  1130 + */
  1131 + public function setHmmMediaInPer($hmmMediaInPer)
  1132 + {
  1133 + $this->hmmMediaInPer = $hmmMediaInPer;
  1134 +
  1135 + return $this;
  1136 + }
  1137 +
  1138 + /**
  1139 + * Get hmmMediaInPer
  1140 + *
  1141 + * @return integer
  1142 + */
  1143 + public function getHmmMediaInPer()
  1144 + {
  1145 + return $this->hmmMediaInPer;
  1146 + }
  1147 +
  1148 + /**
  1149 + * Set hmmMediaOutPer
  1150 + *
  1151 + * @param integer $hmmMediaOutPer
  1152 + * @return Performance
  1153 + */
  1154 + public function setHmmMediaOutPer($hmmMediaOutPer)
  1155 + {
  1156 + $this->hmmMediaOutPer = $hmmMediaOutPer;
  1157 +
  1158 + return $this;
  1159 + }
  1160 +
  1161 + /**
  1162 + * Get hmmMediaOutPer
  1163 + *
  1164 + * @return integer
  1165 + */
  1166 + public function getHmmMediaOutPer()
  1167 + {
  1168 + return $this->hmmMediaOutPer;
  1169 + }
  1170 +
  1171 + /**
  1172 + * Set hmmCriticalityInPer
  1173 + *
  1174 + * @param float $hmmCriticalityInPer
  1175 + * @return Performance
  1176 + */
  1177 + public function setHmmCriticalityInPer($hmmCriticalityInPer)
  1178 + {
  1179 + $this->hmmCriticalityInPer = $hmmCriticalityInPer;
  1180 +
  1181 + return $this;
  1182 + }
  1183 +
  1184 + /**
  1185 + * Get hmmCriticalityInPer
  1186 + *
  1187 + * @return float
  1188 + */
  1189 + public function getHmmCriticalityInPer()
  1190 + {
  1191 + return $this->hmmCriticalityInPer;
  1192 + }
  1193 +
  1194 + /**
  1195 + * Set hmmCriticalityOutPer
  1196 + *
  1197 + * @param float $hmmCriticalityOutPer
  1198 + * @return Performance
  1199 + */
  1200 + public function setHmmCriticalityOutPer($hmmCriticalityOutPer)
  1201 + {
  1202 + $this->hmmCriticalityOutPer = $hmmCriticalityOutPer;
  1203 +
  1204 + return $this;
  1205 + }
  1206 +
  1207 + /**
  1208 + * Get hmmCriticalityOutPer
  1209 + *
  1210 + * @return float
  1211 + */
  1212 + public function getHmmCriticalityOutPer()
  1213 + {
  1214 + return $this->hmmCriticalityOutPer;
  1215 + }
  1216 +
  1217 + /**
  1218 + * Set 719PeakInt
  1219 + *
  1220 + * @param integer $719PeakInt
  1221 + * @return Performance
  1222 + */
  1223 + public function set719PeakIn($_719PeakIn)
  1224 + {
  1225 + $this->_719PeakIn = $_719PeakIn;
  1226 +
  1227 + return $this;
  1228 + }
  1229 +
  1230 + /**
  1231 + * Get 719PeakInt
  1232 + *
  1233 + * @return integer
  1234 + */
  1235 + public function get719PeakIn()
  1236 + {
  1237 + return $this->_719PeakIn;
  1238 + }
  1239 +
  1240 + /**
  1241 + * Set 719PeakOut
  1242 + *
  1243 + * @param integer $719PeakOut
  1244 + * @return Performance
  1245 + */
  1246 + public function set719PeakOut($_719PeakOut)
  1247 + {
  1248 + $this->_719PeakOut = $_719PeakOut;
  1249 +
  1250 + return $this;
  1251 + }
  1252 +
  1253 + /**
  1254 + * Get 719PeakOut
  1255 + *
  1256 + * @return integer
  1257 + */
  1258 + public function get719PeakOut()
  1259 + {
  1260 + return $this->_719PeakOut;
  1261 + }
  1262 +
  1263 + /**
  1264 + * Set 719MediaIn
  1265 + *
  1266 + * @param integer $719MediaIn
  1267 + * @return Performance
  1268 + */
  1269 + public function set719MediaIn($_719MediaIn)
  1270 + {
  1271 + $this->_719MediaIn = $_719MediaIn;
  1272 +
  1273 + return $this;
  1274 + }
  1275 +
  1276 + /**
  1277 + * Get 719MediaIn
  1278 + *
  1279 + * @return integer
  1280 + */
  1281 + public function get719MediaIn()
  1282 + {
  1283 + return $this->_719MediaIn;
  1284 + }
  1285 +
  1286 + /**
  1287 + * Set 719MediaOut
  1288 + *
  1289 + * @param integer $719MediaOut
  1290 + * @return Performance
  1291 + */
  1292 + public function set719MediaOut($_719MediaOut)
  1293 + {
  1294 + $this->_719MediaOut = $_719MediaOut;
  1295 +
  1296 + return $this;
  1297 + }
  1298 +
  1299 + /**
  1300 + * Get 719MediaOut
  1301 + *
  1302 + * @return integer
  1303 + */
  1304 + public function get719MediaOut()
  1305 + {
  1306 + return $this->_719MediaOut;
  1307 + }
  1308 +
  1309 + /**
  1310 + * Set 719CriticalityIn
  1311 + *
  1312 + * @param float $719CriticalityIn
  1313 + * @return Performance
  1314 + */
  1315 + public function set719CriticalityIn($_719CriticalityIn)
  1316 + {
  1317 + $this->_719CriticalityIn = $_719CriticalityIn;
  1318 +
  1319 + return $this;
  1320 + }
  1321 +
  1322 + /**
  1323 + * Get 719CriticalityIn
  1324 + *
  1325 + * @return float
  1326 + */
  1327 + public function get719CriticalityIn()
  1328 + {
  1329 + return $this->_719CriticalityIn;
  1330 + }
  1331 +
  1332 + /**
  1333 + * Set 719CriticalityOut
  1334 + *
  1335 + * @param float $719CriticalityOut
  1336 + * @return Performance
  1337 + */
  1338 + public function set719CriticalityOut($_719CriticalityOut)
  1339 + {
  1340 + $this->_719CriticalityOut = $_719CriticalityOut;
  1341 +
  1342 + return $this;
  1343 + }
  1344 +
  1345 + /**
  1346 + * Get 719CriticalityOut
  1347 + *
  1348 + * @return float
  1349 + */
  1350 + public function get719CriticalityOut()
  1351 + {
  1352 + return $this->_719CriticalityOut;
  1353 + }
  1354 +}
... ...
Entity/DailyPerformanceRepository.php 0 → 100755
  1 +++ a/Entity/DailyPerformanceRepository.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * DailyPerformanceRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class DailyPerformanceRepository extends EntityRepository
  14 +{
  15 +}
... ...
Entity/Entity.php 0 → 100755
  1 +++ a/Entity/Entity.php
... ... @@ -0,0 +1,140 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +use Doctrine\Common\Collections\ArrayCollection;
  7 +
  8 +/**
  9 + * Entity
  10 + *
  11 + * @ORM\Table(name="tb_entity")
  12 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\CustomEntityRepository")
  13 + */
  14 +class Entity
  15 +{
  16 + /**
  17 + * @var integer
  18 + *
  19 + * @ORM\Column(name="id", type="integer")
  20 + * @ORM\Id
  21 + * @ORM\GeneratedValue(strategy="AUTO")
  22 + */
  23 + private $id;
  24 +
  25 + /**
  26 + * @ORM\OneToMany(targetEntity="Circuits", mappedBy="entity")
  27 + */
  28 + protected $circuits;
  29 +
  30 + /**
  31 + * @var string
  32 + *
  33 + * @ORM\Column(name="identifier", type="string", length=255)
  34 + */
  35 + private $identifier;
  36 +
  37 + /**
  38 + * @var string
  39 + *
  40 + * @ORM\Column(name="description", type="text")
  41 + */
  42 + private $description;
  43 +
  44 + /**
  45 + * Construct
  46 + */
  47 + public function __construct()
  48 + {
  49 + $this->circuits = new ArrayCollection();
  50 + }
  51 +
  52 + /**
  53 + * Get id
  54 + *
  55 + * @return integer
  56 + */
  57 + public function getId()
  58 + {
  59 + return $this->id;
  60 + }
  61 +
  62 + /**
  63 + * Set identifier
  64 + *
  65 + * @param string $identifier
  66 + * @return Entity
  67 + */
  68 + public function setIdentifier($identifier)
  69 + {
  70 + $this->identifier = $identifier;
  71 +
  72 + return $this;
  73 + }
  74 +
  75 + /**
  76 + * Get identifier
  77 + *
  78 + * @return string
  79 + */
  80 + public function getIdentifier()
  81 + {
  82 + return $this->identifier;
  83 + }
  84 +
  85 + /**
  86 + * Set description
  87 + *
  88 + * @param string $description
  89 + * @return Entity
  90 + */
  91 + public function setDescription($description)
  92 + {
  93 + $this->description = $description;
  94 +
  95 + return $this;
  96 + }
  97 +
  98 + /**
  99 + * Get description
  100 + *
  101 + * @return string
  102 + */
  103 + public function getDescription()
  104 + {
  105 + return $this->description;
  106 + }
  107 +
  108 + /**
  109 + * Add circuits
  110 + *
  111 + * @param \Cocar\CocarBundle\Entity\Circuits $circuits
  112 + * @return Entity
  113 + */
  114 + public function addCircuit(\GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits $circuits)
  115 + {
  116 + $this->circuits[] = $circuits;
  117 +
  118 + return $this;
  119 + }
  120 +
  121 + /**
  122 + * Remove circuits
  123 + *
  124 + * @param \Cocar\CocarBundle\Entity\Circuits $circuits
  125 + */
  126 + public function removeCircuit(\GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits $circuits)
  127 + {
  128 + $this->circuits->removeElement($circuits);
  129 + }
  130 +
  131 + /**
  132 + * Get circuits
  133 + *
  134 + * @return \Doctrine\Common\Collections\Collection
  135 + */
  136 + public function getCircuits()
  137 + {
  138 + return $this->circuits;
  139 + }
  140 +}
0 141 \ No newline at end of file
... ...
Entity/Machine.php 0 → 100755
  1 +++ a/Entity/Machine.php
... ... @@ -0,0 +1,244 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +use Symfony\Component\Validator\Constraints as Assert;
  8 +use Symfony\Component\HttpFoundation\File\UploadedFile;
  9 +use Symfony\Component\HttpFoundation\File\File;
  10 +
  11 +/**
  12 + * Machine
  13 + *
  14 + * @ORM\Table(name="tb_machine")
  15 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\MachineRepository")
  16 + */
  17 +class Machine
  18 +{
  19 + /**
  20 + * @var integer
  21 + *
  22 + * @ORM\Column(name="id", type="integer")
  23 + * @ORM\Id
  24 + * @ORM\GeneratedValue(strategy="AUTO")
  25 + */
  26 + private $id;
  27 +
  28 + /**
  29 + * @ORM\ManyToOne(targetEntity="Circuits", inversedBy="machine")
  30 + * @ORM\JoinColumn(name="gateway", referencedColumnName="id")
  31 + */
  32 + protected $gateway;
  33 +
  34 + /**
  35 + * @var string
  36 + *
  37 + * @ORM\Column(name="ip", type="string", length=255)
  38 + */
  39 + private $ip;
  40 +
  41 + /**
  42 + * @var string
  43 + *
  44 + * @ORM\Column(name="mac_address", type="string", length=255)
  45 + */
  46 + private $macAddress;
  47 +
  48 + /**
  49 + * @ORM\Column(type="string", length=255, nullable=true)
  50 + */
  51 + public $path;
  52 +
  53 + /**
  54 + * @Assert\File(maxSize="6000000")
  55 + */
  56 + public $file;
  57 +
  58 + /**
  59 + * Set path
  60 + *
  61 + * @param string $path
  62 + * @return Carousel
  63 + */
  64 + public function setPath($path)
  65 + {
  66 + $this->path = $path;
  67 +
  68 + return $this;
  69 + }
  70 +
  71 + /**
  72 + * Get path
  73 + *
  74 + * @return string
  75 + */
  76 + public function getPath()
  77 + {
  78 + return $this->path;
  79 + }
  80 +
  81 + /**
  82 + * Sets file.
  83 + *
  84 + * @param UploadedFile $file
  85 + */
  86 + public function setFile(UploadedFile $file = null)
  87 + {
  88 + $this->file = $file;
  89 + }
  90 +
  91 + /**
  92 + * Get file.
  93 + *
  94 + * @return UploadedFile
  95 + */
  96 + public function getFile()
  97 + {
  98 + return $this->file;
  99 + }
  100 +
  101 + public function getAbsolutePath()
  102 + {
  103 + return null === $this->path
  104 + ? null
  105 + : $this->getUploadRootDir().'/'.$this->path;
  106 + }
  107 +
  108 + public function getWebPath()
  109 + {
  110 + return null === $this->path
  111 + ? null
  112 + : $this->getUploadDir().'/'.$this->path;
  113 + }
  114 +
  115 + protected function getUploadRootDir()
  116 + {
  117 + // the absolute directory path where uploaded
  118 + // documents should be saved
  119 + return __DIR__.'/../../../../web/'.$this->getUploadDir();
  120 + }
  121 +
  122 + protected function getUploadDir()
  123 + {
  124 + // get rid of the __DIR__ so it doesn't screw up
  125 + // when displaying uploaded doc/image in the view.
  126 + return 'uploads/documents';
  127 + }
  128 +
  129 + /**
  130 + * @ORM\PrePersist()
  131 + * @ORM\PreUpdate()
  132 + */
  133 + public function preUpload()
  134 + {
  135 + if (null !== $this->file) {
  136 + $filename = sha1(uniqid(mt_rand(), true));
  137 + $this->path = $filename.'.'.$this->getFile()->guessExtension();
  138 + }
  139 + }
  140 +
  141 + /**
  142 + * @ORM\PostPersist()
  143 + * @ORM\PostUpdate()
  144 + */
  145 + public function upload()
  146 + {
  147 + if (null === $this->file) {
  148 + return;
  149 + }
  150 +
  151 + $this->file->move($this->getUploadRootDir(), $this->path);
  152 +
  153 + unset($this->file);
  154 + }
  155 +
  156 + /**
  157 + * @ORM\PostRemove()
  158 + */
  159 + public function removeUpload()
  160 + {
  161 + if ($file = $this->getAbsolutePath()) {
  162 + unlink($file);
  163 + }
  164 + }
  165 +
  166 + /**
  167 + * Get id
  168 + *
  169 + * @return integer
  170 + */
  171 + public function getId()
  172 + {
  173 + return $this->id;
  174 + }
  175 +
  176 + /**
  177 + * Set ip
  178 + *
  179 + * @param string $ip
  180 + * @return Machine
  181 + */
  182 + public function setIp($ip)
  183 + {
  184 + $this->ip = $ip;
  185 +
  186 + return $this;
  187 + }
  188 +
  189 + /**
  190 + * Get ip
  191 + *
  192 + * @return string
  193 + */
  194 + public function getIp()
  195 + {
  196 + return $this->ip;
  197 + }
  198 +
  199 + /**
  200 + * Set macAddress
  201 + *
  202 + * @param string $macAddress
  203 + * @return Machine
  204 + */
  205 + public function setMacAddress($macAddress)
  206 + {
  207 + $this->macAddress = $macAddress;
  208 +
  209 + return $this;
  210 + }
  211 +
  212 + /**
  213 + * Get macAddress
  214 + *
  215 + * @return string
  216 + */
  217 + public function getMacAddress()
  218 + {
  219 + return $this->macAddress;
  220 + }
  221 +
  222 + /**
  223 + * Set gateway
  224 + *
  225 + * @param \Cocar\CocarBundle\Entity\Circuits $gateway
  226 + * @return Circuits
  227 + */
  228 + public function setGateway(\GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits $gateway = null)
  229 + {
  230 + $this->gateway = $gateway;
  231 +
  232 + return $this;
  233 + }
  234 +
  235 + /**
  236 + * Get gateway
  237 + *
  238 + * @return \GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits
  239 + */
  240 + public function getGateway()
  241 + {
  242 + return $this->gateway;
  243 + }
  244 +}
... ...
Entity/MachineRepository.php 0 → 100755
  1 +++ a/Entity/MachineRepository.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * MachineRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class MachineRepository extends EntityRepository
  14 +{
  15 +}
... ...
Entity/MonthlyPerformance.php 0 → 100755
  1 +++ a/Entity/MonthlyPerformance.php
... ... @@ -0,0 +1,454 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +/**
  8 + * MonthlyPerformance
  9 + *
  10 + * @ORM\Table(name="tb_monthly_perform")
  11 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\MonthlyPerformanceRepository")
  12 + */
  13 +class MonthlyPerformance
  14 +{
  15 + /**
  16 + * @var integer
  17 + *
  18 + * @ORM\Column(name="id", type="integer")
  19 + * @ORM\Id
  20 + * @ORM\GeneratedValue(strategy="AUTO")
  21 + */
  22 + private $id;
  23 +
  24 + /**
  25 + * @var \DateTime
  26 + *
  27 + * @ORM\Column(name="date", type="date")
  28 + */
  29 + private $date;
  30 +
  31 + /**
  32 + * @var integer
  33 + *
  34 + * @ORM\Column(name="code_interface", type="integer")
  35 + */
  36 + private $codeInterface;
  37 +
  38 + /**
  39 + * @var float
  40 + *
  41 + * @ORM\Column(name="use_20_50_in", type="float")
  42 + */
  43 + private $use2050In;
  44 +
  45 + /**
  46 + * @var float
  47 + *
  48 + * @ORM\Column(name="use_50_85_in", type="float")
  49 + */
  50 + private $use5085In;
  51 +
  52 + /**
  53 + * @var float
  54 + *
  55 + * @ORM\Column(name="use_m_85_in", type="float")
  56 + */
  57 + private $useM85In;
  58 +
  59 + /**
  60 + * @var float
  61 + *
  62 + * @ORM\Column(name="use_20_50_out", type="float")
  63 + */
  64 + private $use2050Out;
  65 +
  66 + /**
  67 + * @var float
  68 + *
  69 + * @ORM\Column(name="use_50_85_out", type="float")
  70 + */
  71 + private $use5085Out;
  72 +
  73 + /**
  74 + * @var float
  75 + *
  76 + * @ORM\Column(name="use_m_85_out", type="float")
  77 + */
  78 + private $useM85Out;
  79 +
  80 + /**
  81 + * @var float
  82 + *
  83 + * @ORM\Column(name="volume_in", type="float")
  84 + */
  85 + private $volumeIn;
  86 +
  87 + /**
  88 + * @var float
  89 + *
  90 + * @ORM\Column(name="volume_out", type="float")
  91 + */
  92 + private $volumeOut;
  93 +
  94 + /**
  95 + * @var integer
  96 + *
  97 + * @ORM\Column(name="cir_in", type="integer")
  98 + */
  99 + private $cirIn;
  100 +
  101 + /**
  102 + * @var integer
  103 + *
  104 + * @ORM\Column(name="cir_out", type="integer")
  105 + */
  106 + private $cirOut;
  107 +
  108 + /**
  109 + * @var integer
  110 + *
  111 + * @ORM\Column(name="cir_in_rec", type="integer")
  112 + */
  113 + private $cirInRec;
  114 +
  115 + /**
  116 + * @var integer
  117 + *
  118 + * @ORM\Column(name="cir_out_rec", type="integer")
  119 + */
  120 + private $cirOutRec;
  121 +
  122 +
  123 + /**
  124 + * Get id
  125 + *
  126 + * @return integer
  127 + */
  128 + public function getId()
  129 + {
  130 + return $this->id;
  131 + }
  132 +
  133 + /**
  134 + * Set date
  135 + *
  136 + * @param \DateTime $date
  137 + * @return MonthlyPerformance
  138 + */
  139 + public function setDate($date)
  140 + {
  141 + $this->date = $date;
  142 +
  143 + return $this;
  144 + }
  145 +
  146 + /**
  147 + * Get date
  148 + *
  149 + * @return \DateTime
  150 + */
  151 + public function getDate()
  152 + {
  153 + return $this->date;
  154 + }
  155 +
  156 + /**
  157 + * Set codeInterface
  158 + *
  159 + * @param integer $codeInterface
  160 + * @return MonthlyPerformance
  161 + */
  162 + public function setCodeInterface($codeInterface)
  163 + {
  164 + $this->codeInterface = $codeInterface;
  165 +
  166 + return $this;
  167 + }
  168 +
  169 + /**
  170 + * Get codeInterface
  171 + *
  172 + * @return integer
  173 + */
  174 + public function getCodeInterface()
  175 + {
  176 + return $this->codeInterface;
  177 + }
  178 +
  179 + /**
  180 + * Set use2050In
  181 + *
  182 + * @param float $use2050In
  183 + * @return MonthlyPerformance
  184 + */
  185 + public function setUse2050In($use2050In)
  186 + {
  187 + $this->use2050In = $use2050In;
  188 +
  189 + return $this;
  190 + }
  191 +
  192 + /**
  193 + * Get use2050In
  194 + *
  195 + * @return float
  196 + */
  197 + public function getUse2050In()
  198 + {
  199 + return $this->use2050In;
  200 + }
  201 +
  202 + /**
  203 + * Set use5085In
  204 + *
  205 + * @param float $use5085In
  206 + * @return MonthlyPerformance
  207 + */
  208 + public function setUse5085In($use5085In)
  209 + {
  210 + $this->use5085In = $use5085In;
  211 +
  212 + return $this;
  213 + }
  214 +
  215 + /**
  216 + * Get use5085In
  217 + *
  218 + * @return float
  219 + */
  220 + public function getUse5085In()
  221 + {
  222 + return $this->use5085In;
  223 + }
  224 +
  225 + /**
  226 + * Set useM85In
  227 + *
  228 + * @param float $useM85In
  229 + * @return MonthlyPerformance
  230 + */
  231 + public function setUseM85In($useM85In)
  232 + {
  233 + $this->useM85In = $useM85In;
  234 +
  235 + return $this;
  236 + }
  237 +
  238 + /**
  239 + * Get useM85In
  240 + *
  241 + * @return float
  242 + */
  243 + public function getUseM85In()
  244 + {
  245 + return $this->useM85In;
  246 + }
  247 +
  248 + /**
  249 + * Set use2050Out
  250 + *
  251 + * @param float $use2050Out
  252 + * @return MonthlyPerformance
  253 + */
  254 + public function setUse2050Out($use2050Out)
  255 + {
  256 + $this->use2050Out = $use2050Out;
  257 +
  258 + return $this;
  259 + }
  260 +
  261 + /**
  262 + * Get use2050Out
  263 + *
  264 + * @return float
  265 + */
  266 + public function getUse2050Out()
  267 + {
  268 + return $this->use2050Out;
  269 + }
  270 +
  271 + /**
  272 + * Set use5085Out
  273 + *
  274 + * @param float $use5085Out
  275 + * @return MonthlyPerformance
  276 + */
  277 + public function setUse5085Out($use5085Out)
  278 + {
  279 + $this->use5085Out = $use5085Out;
  280 +
  281 + return $this;
  282 + }
  283 +
  284 + /**
  285 + * Get use5085Out
  286 + *
  287 + * @return float
  288 + */
  289 + public function getUse5085Out()
  290 + {
  291 + return $this->use5085Out;
  292 + }
  293 +
  294 + /**
  295 + * Set useM85Out
  296 + *
  297 + * @param float $useM85Out
  298 + * @return MonthlyPerformance
  299 + */
  300 + public function setUseM85Out($useM85Out)
  301 + {
  302 + $this->useM85Out = $useM85Out;
  303 +
  304 + return $this;
  305 + }
  306 +
  307 + /**
  308 + * Get useM85Out
  309 + *
  310 + * @return float
  311 + */
  312 + public function getUseM85Out()
  313 + {
  314 + return $this->useM85Out;
  315 + }
  316 +
  317 + /**
  318 + * Set volumeIn
  319 + *
  320 + * @param float $volumeIn
  321 + * @return MonthlyPerformance
  322 + */
  323 + public function setVolumeIn($volumeIn)
  324 + {
  325 + $this->volumeIn = $volumeIn;
  326 +
  327 + return $this;
  328 + }
  329 +
  330 + /**
  331 + * Get volumeIn
  332 + *
  333 + * @return float
  334 + */
  335 + public function getVolumeIn()
  336 + {
  337 + return $this->volumeIn;
  338 + }
  339 +
  340 + /**
  341 + * Set volumeOut
  342 + *
  343 + * @param float $volumeOut
  344 + * @return MonthlyPerformance
  345 + */
  346 + public function setVolumeOut($volumeOut)
  347 + {
  348 + $this->volumeOut = $volumeOut;
  349 +
  350 + return $this;
  351 + }
  352 +
  353 + /**
  354 + * Get volumeOut
  355 + *
  356 + * @return float
  357 + */
  358 + public function getVolumeOut()
  359 + {
  360 + return $this->volumeOut;
  361 + }
  362 +
  363 + /**
  364 + * Set cirIn
  365 + *
  366 + * @param integer $cirIn
  367 + * @return MonthlyPerformance
  368 + */
  369 + public function setCirIn($cirIn)
  370 + {
  371 + $this->cirIn = $cirIn;
  372 +
  373 + return $this;
  374 + }
  375 +
  376 + /**
  377 + * Get cirIn
  378 + *
  379 + * @return integer
  380 + */
  381 + public function getCirIn()
  382 + {
  383 + return $this->cirIn;
  384 + }
  385 +
  386 + /**
  387 + * Set cirOut
  388 + *
  389 + * @param integer $cirOut
  390 + * @return MonthlyPerformance
  391 + */
  392 + public function setCirOut($cirOut)
  393 + {
  394 + $this->cirOut = $cirOut;
  395 +
  396 + return $this;
  397 + }
  398 +
  399 + /**
  400 + * Get cirOut
  401 + *
  402 + * @return integer
  403 + */
  404 + public function getCirOut()
  405 + {
  406 + return $this->cirOut;
  407 + }
  408 +
  409 + /**
  410 + * Set cirInRec
  411 + *
  412 + * @param integer $cirInRec
  413 + * @return MonthlyPerformance
  414 + */
  415 + public function setCirInRec($cirInRec)
  416 + {
  417 + $this->cirInRec = $cirInRec;
  418 +
  419 + return $this;
  420 + }
  421 +
  422 + /**
  423 + * Get cirInRec
  424 + *
  425 + * @return integer
  426 + */
  427 + public function getCirInRec()
  428 + {
  429 + return $this->cirInRec;
  430 + }
  431 +
  432 + /**
  433 + * Set cirOutRec
  434 + *
  435 + * @param integer $cirOutRec
  436 + * @return MonthlyPerformance
  437 + */
  438 + public function setCirOutRec($cirOutRec)
  439 + {
  440 + $this->cirOutRec = $cirOutRec;
  441 +
  442 + return $this;
  443 + }
  444 +
  445 + /**
  446 + * Get cirOutRec
  447 + *
  448 + * @return integer
  449 + */
  450 + public function getCirOutRec()
  451 + {
  452 + return $this->cirOutRec;
  453 + }
  454 +}
... ...
Entity/MonthlyPerformanceRepository.php 0 → 100755
  1 +++ a/Entity/MonthlyPerformanceRepository.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * MonthlyPerformanceRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class MonthlyPerformanceRepository extends EntityRepository
  14 +{
  15 +}
... ...
Entity/Reliability.php 0 → 100755
  1 +++ a/Entity/Reliability.php
... ... @@ -0,0 +1,124 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +/**
  8 + * Reliability
  9 + *
  10 + * @ORM\Table(name="tb_reliability")
  11 + * @ORM\Entity(repositoryClass="GerenciadorRedes\Bundle\CocarBundle\Entity\ReliabilityRepository")
  12 + */
  13 +class Reliability
  14 +{
  15 + /**
  16 + * @var integer
  17 + *
  18 + * @ORM\Column(name="id", type="integer")
  19 + * @ORM\Id
  20 + * @ORM\GeneratedValue(strategy="AUTO")
  21 + */
  22 + private $id;
  23 +
  24 + /**
  25 + * @var string
  26 + *
  27 + * @ORM\Column(name="code_interface", type="string", length=255)
  28 + */
  29 + private $codeInterface;
  30 +
  31 + /**
  32 + * @var integer
  33 + *
  34 + * @ORM\Column(name="date", type="integer")
  35 + */
  36 + private $date;
  37 +
  38 + /**
  39 + * @var integer
  40 + *
  41 + * @ORM\Column(name="rly", type="smallint")
  42 + */
  43 + private $rly;
  44 +
  45 +
  46 + /**
  47 + * Get id
  48 + *
  49 + * @return integer
  50 + */
  51 + public function getId()
  52 + {
  53 + return $this->id;
  54 + }
  55 +
  56 + /**
  57 + * Set codeInterface
  58 + *
  59 + * @param string $codeInterface
  60 + * @return Reliability
  61 + */
  62 + public function setCodeInterface($codeInterface)
  63 + {
  64 + $this->codeInterface = $codeInterface;
  65 +
  66 + return $this;
  67 + }
  68 +
  69 + /**
  70 + * Get codeInterface
  71 + *
  72 + * @return string
  73 + */
  74 + public function getCodeInterface()
  75 + {
  76 + return $this->codeInterface;
  77 + }
  78 +
  79 + /**
  80 + * Set date
  81 + *
  82 + * @param integer $date
  83 + * @return Reliability
  84 + */
  85 + public function setDate($date)
  86 + {
  87 + $this->date = $date;
  88 +
  89 + return $this;
  90 + }
  91 +
  92 + /**
  93 + * Get date
  94 + *
  95 + * @return integer
  96 + */
  97 + public function getDate()
  98 + {
  99 + return $this->date;
  100 + }
  101 +
  102 + /**
  103 + * Set rly
  104 + *
  105 + * @param integer $rly
  106 + * @return Reliability
  107 + */
  108 + public function setRly($rly)
  109 + {
  110 + $this->rly = $rly;
  111 +
  112 + return $this;
  113 + }
  114 +
  115 + /**
  116 + * Get rly
  117 + *
  118 + * @return integer
  119 + */
  120 + public function getRly()
  121 + {
  122 + return $this->rly;
  123 + }
  124 +}
0 125 \ No newline at end of file
... ...
Entity/ReliabilityRepository.php 0 → 100755
  1 +++ a/Entity/ReliabilityRepository.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +
  7 +/**
  8 + * EntityRepository
  9 + *
  10 + * This class was generated by the Doctrine ORM. Add your own custom
  11 + * repository methods below.
  12 + */
  13 +class ReliabilityRepository extends EntityRepository
  14 +{
  15 +}
... ...
Entity/Rrd.php 0 → 100755
  1 +++ a/Entity/Rrd.php
... ... @@ -0,0 +1,214 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +/**
  8 + * Rrd
  9 + *
  10 + * @ORM\Table(name="tb_rrdlog")
  11 + * @ORM\Entity
  12 + */
  13 +class Rrd
  14 +{
  15 + /**
  16 + * @var integer
  17 + *
  18 + * @ORM\Column(name="id", type="integer")
  19 + * @ORM\Id
  20 + * @ORM\GeneratedValue(strategy="AUTO")
  21 + */
  22 + private $id;
  23 +
  24 + /**
  25 + * @var datetime
  26 + *
  27 + * @ORM\Column(name="datetime", type="datetime")
  28 + */
  29 + private $datetime;
  30 +
  31 + /**
  32 + * @var integer
  33 + *
  34 + * @ORM\Column(name="code_interface", type="integer")
  35 + */
  36 + private $codeInterface;
  37 +
  38 + /**
  39 + * @var integer
  40 + *
  41 + * @ORM\Column(name="volume_in", type="float")
  42 + */
  43 + private $volumeIn;
  44 +
  45 + /**
  46 + * @var integer
  47 + *
  48 + * @ORM\Column(name="volume_out", type="float")
  49 + */
  50 + private $volumeOut;
  51 +
  52 + /**
  53 + * @var integer
  54 + *
  55 + * @ORM\Column(name="dellay", type="smallint", nullable=true)
  56 + */
  57 + private $dellay = 0;
  58 +
  59 + /**
  60 + * @var integer
  61 + *
  62 + * @ORM\Column(name="st_delay", type="smallint", nullable=true)
  63 + */
  64 + private $stDelay = 0;
  65 +
  66 +
  67 + /**
  68 + * Get id
  69 + *
  70 + * @return integer
  71 + */
  72 + public function getId()
  73 + {
  74 + return $this->id;
  75 + }
  76 +
  77 + /**
  78 + * Set datetime
  79 + *
  80 + * @param \DateTime $datetime
  81 + * @return Rrd
  82 + */
  83 + public function setDatetime($datetime)
  84 + {
  85 + $this->datetime = $datetime;
  86 +
  87 + return $this;
  88 + }
  89 +
  90 + /**
  91 + * Get datetime
  92 + *
  93 + * @return \DateTime
  94 + */
  95 + public function getDatetime()
  96 + {
  97 + return $this->datetime;
  98 + }
  99 +
  100 + /**
  101 + * Set codeInterface
  102 + *
  103 + * @param integer $codeInterface
  104 + * @return Rrd
  105 + */
  106 + public function setCodeInterface($codeInterface)
  107 + {
  108 + $this->codeInterface = $codeInterface;
  109 +
  110 + return $this;
  111 + }
  112 +
  113 + /**
  114 + * Get codeInterface
  115 + *
  116 + * @return integer
  117 + */
  118 + public function getCodeInterface()
  119 + {
  120 + return $this->codeInterface;
  121 + }
  122 +
  123 + /**
  124 + * Set volumeIn
  125 + *
  126 + * @param integer $volumeIn
  127 + * @return Rrd
  128 + */
  129 + public function setVolumeIn($volumeIn)
  130 + {
  131 + $this->volumeIn = $volumeIn;
  132 +
  133 + return $this;
  134 + }
  135 +
  136 + /**
  137 + * Get volumeIn
  138 + *
  139 + * @return integer
  140 + */
  141 + public function getVolumeIn()
  142 + {
  143 + return $this->volumeIn;
  144 + }
  145 +
  146 + /**
  147 + * Set volumeOut
  148 + *
  149 + * @param integer $volumeOut
  150 + * @return Rrd
  151 + */
  152 + public function setVolumeOut($volumeOut)
  153 + {
  154 + $this->volumeOut = $volumeOut;
  155 +
  156 + return $this;
  157 + }
  158 +
  159 + /**
  160 + * Get volumeOut
  161 + *
  162 + * @return integer
  163 + */
  164 + public function getVolumeOut()
  165 + {
  166 + return $this->volumeOut;
  167 + }
  168 +
  169 + /**
  170 + * Set dellay
  171 + *
  172 + * @param integer $dellay
  173 + * @return Rrd
  174 + */
  175 + public function setDellay($dellay)
  176 + {
  177 + $this->dellay = $dellay;
  178 +
  179 + return $this;
  180 + }
  181 +
  182 + /**
  183 + * Get dellay
  184 + *
  185 + * @return integer
  186 + */
  187 + public function getDellay()
  188 + {
  189 + return $this->dellay;
  190 + }
  191 +
  192 + /**
  193 + * Set stDelay
  194 + *
  195 + * @param integer $stDelay
  196 + * @return Rrd
  197 + */
  198 + public function setStDelay($stDelay)
  199 + {
  200 + $this->stDelay = $stDelay;
  201 +
  202 + return $this;
  203 + }
  204 +
  205 + /**
  206 + * Get stDelay
  207 + *
  208 + * @return integer
  209 + */
  210 + public function getStDelay()
  211 + {
  212 + return $this->stDelay;
  213 + }
  214 +}
... ...
Form/CircuitsType.php 0 → 100755
  1 +++ a/Form/CircuitsType.php
... ... @@ -0,0 +1,67 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Form;
  4 +
  5 +use Symfony\Component\Form\AbstractType;
  6 +use Symfony\Component\Form\FormBuilderInterface;
  7 +use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  8 +
  9 +class CircuitsType extends AbstractType
  10 +{
  11 + /**
  12 + * @param FormBuilderInterface $builder
  13 + * @param array $options
  14 + */
  15 + public function buildForm(FormBuilderInterface $builder, array $options)
  16 + {
  17 + $builder
  18 + ->add('codeInterface')
  19 + ->add('entity', 'entity',
  20 + array(
  21 + 'class' => 'CocarBundle:Entity',
  22 + 'property' => 'identifier'
  23 + )
  24 + )
  25 + ->add('description')
  26 + ->add('manages')
  27 + ->add('ipBackbone')
  28 + ->add('communitySnmpBackbone')
  29 + ->add('serialBackbone')
  30 + ->add('technology')
  31 + ->add('typeInterface', 'choice',
  32 + array(
  33 + 'choices' => array('circuito' => 'Circuito', 'porta' => 'Porta'),
  34 + 'expanded' => TRUE,
  35 + 'preferred_choices' => array('circuito'),
  36 + )
  37 + )
  38 + ->add('numSnmpInterface')
  39 + ->add('ipSerialInterface')
  40 + ->add('registerCircuit')
  41 + ->add('speed')
  42 + ->add('cirIn')
  43 + ->add('cirOut')
  44 + ->add('serialRouterTip')
  45 + ->add('snmpPortTip')
  46 + ->add('communitySnmpRouterTip')
  47 + ->add('ipSerialRouterTip');
  48 + }
  49 +
  50 + /**
  51 + * @param OptionsResolverInterface $resolver
  52 + */
  53 + public function setDefaultOptions(OptionsResolverInterface $resolver)
  54 + {
  55 + $resolver->setDefaults(array(
  56 + 'data_class' => 'GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits'
  57 + ));
  58 + }
  59 +
  60 + /**
  61 + * @return string
  62 + */
  63 + public function getName()
  64 + {
  65 + return 'cocar_cocarbundle_circuitstype';
  66 + }
  67 +}
... ...
Form/EntityType.php 0 → 100755
  1 +++ a/Form/EntityType.php
... ... @@ -0,0 +1,39 @@
  1 +<?php
  2 +
  3 +namespace GerenciadorRedes\Bundle\CocarBundle\Form;
  4 +
  5 +use Symfony\Component\Form\AbstractType;
  6 +use Symfony\Component\Form\FormBuilderInterface;
  7 +use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  8 +
  9 +class EntityType extends AbstractType
  10 +{
  11 + /**
  12 + * @param FormBuilderInterface $builder
  13 + * @param array $options
  14 + */
  15 + public function buildForm(FormBuilderInterface $builder, array $options)
  16 + {
  17 + $builder
  18 + ->add('identifier')
  19 + ->add('description');
  20 + }
  21 +
  22 + /**
  23 + * @param OptionsResolverInterface $resolver
  24 + */
  25 + public function setDefaultOptions(OptionsResolverInterface $resolver)
  26 + {
  27 + $resolver->setDefaults(array(
  28 + 'data_class' => 'GerenciadorRedes\Bundle\CocarBundle\Entity\Entity'
  29 + ));
  30 + }
  31 +
  32 + /**
  33 + * @return string
  34 + */
  35 + public function getName()
  36 + {
  37 + return 'cocar_cocarbundle_entitytype';
  38 + }
  39 +}
... ...
LICENSE 0 → 100755
  1 +++ a/LICENSE
... ... @@ -0,0 +1,19 @@
  1 +Copyright (c) 2004-2013 Fabien Potencier
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is furnished
  8 +to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in all
  11 +copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19 +THE SOFTWARE.
... ...
README.md 0 → 100755
  1 +++ a/README.md
... ... @@ -0,0 +1,89 @@
  1 +Cocar
  2 +===============
  3 +
  4 +Descrição: CocarBundle
  5 +
  6 +Pré-requisitos:
  7 +===============
  8 + * Protocolo de gerência SNMP
  9 + * Sistema de Banco de dados RRDTool
  10 + * Agendador de tarefas cron
  11 +
  12 + - Instalação: apt-get install snmp rrdtool php5-snmp php5-json php-gd libicu-dev
  13 +
  14 +Instalação:
  15 +------------
  16 +
  17 +1 – Adicione a seguinte linha ao seu composer.json
  18 +```js
  19 +//composer.json
  20 +{
  21 + //...
  22 +
  23 + "require": {
  24 + //...
  25 + "jpgraph/jpgraph": "dev-master",
  26 + "symfony/class-loader": "2.2.*",
  27 + "incenteev/composer-parameter-handler": "~2.0",
  28 + "friendsofsymfony/rest-bundle": "dev-master",
  29 + "jms/serializer": "0.14.*@dev",
  30 + "jms/serializer-bundle": "0.13.*@dev",
  31 + "knplabs/knp-paginator-bundle": "dev-master",
  32 + "gerenciador-redes/cocar-bundle": "dev-master"
  33 + }
  34 +
  35 + //...
  36 +}
  37 +```
  38 +
  39 +2 – Atualize o composer.
  40 +
  41 + php composer.phar update
  42 +
  43 +3 - Adicione o CocarBundle ao seu AppKernel.php
  44 +```php
  45 +<?php
  46 + public function registerBundles()
  47 + {
  48 + $bundles = array(
  49 + //...
  50 + new GerenciadorRedes\Bundle\CocarBundle\CocarBundle()
  51 + );
  52 + }
  53 +```
  54 +
  55 +4 – Configure a rota do CocarBundle em (app/config/routing.yml)
  56 +```php
  57 + CocarBundle_cocar_annotation:
  58 + resource: "@CocarBundle/Resources/config/routing.yml"
  59 + prefix: /
  60 +```
  61 +
  62 +5 – Crie as tabelas do CocarBundle.
  63 +
  64 + php app/console doctrine:schema:update --force
  65 +
  66 +6 – Instale os assets.
  67 +
  68 + php app/console assets:install
  69 + php app/console assetic:dump
  70 +
  71 +7 – Adicione os agendamentos ao cron.
  72 +
  73 +Atenção: Verifique os caminhos existentes em "schedules.txt" antes de adicioná-lo ao cron.
  74 +
  75 + crontab -u {usuario} schedules.txt
  76 +
  77 +Configuração:
  78 +===============
  79 + 1 – Cadastre uma nova entidade no menu (Entidades).
  80 +
  81 + 2 – Cadastre um novo circuito no menu (Circuitos).
  82 +
  83 +Atenção:
  84 +===============
  85 + Inicialmente os relatórios (menu Relatórios) estarão em branco, pois são gerados automaticamente
  86 + pelo sistema (através do cron). Geralmente este processo é executado entre 5 e 6:30 da manhã.
  87 + Isto é necessário por se tratar de um processo pesado, onde na parte do dia os dados são coletados,
  88 + e a noite são gerados os demais relatórios.
  89 +
... ...
Resources/config/routing.yml 0 → 100755
  1 +++ a/Resources/config/routing.yml
... ... @@ -0,0 +1,4 @@
  1 +CocarBundle_cocar_annotation:
  2 + resource: "@CocarBundle/Controller"
  3 + prefix: /cocar
  4 + type: annotation
0 5 \ No newline at end of file
... ...
Resources/config/services.yml 0 → 100755
  1 +++ a/Resources/config/services.yml
... ... @@ -0,0 +1,16 @@
  1 +parameters:
  2 +# cocar.example.class: Cocar\CocarBundle\Example
  3 +
  4 +services:
  5 +# cocar.example:
  6 +# class: %cocar.example.class%
  7 +# arguments: [@service_id, "plain_value", %parameter%]
  8 +
  9 +#services:
  10 +# cocar_graph:
  11 +# class: Cocar\CocarBundle\Controller\GraphController
  12 +services:
  13 + cocar_monitor:
  14 + class: GerenciadorRedes\Bundle\CocarBundle\Controller\MonitorController
  15 + circuit:
  16 + class: GerenciadorRedes\Bundle\CocarBundle\Entity\Circuits
0 17 \ No newline at end of file
... ...
Resources/doc/index.rst 0 → 100755
  1 +++ a/Resources/doc/index.rst
... ...
Resources/public/css/pagination.css 0 → 100755
  1 +++ a/Resources/public/css/pagination.css
... ... @@ -0,0 +1,536 @@
  1 +#tsc_breadcrumb-1,
  2 +#tsc_breadcrumb-2 { font: 11px Arial, Helvetica, sans-serif; height:30px; line-height:30px; color:#9b9b9b; border:solid 1px #cacaca; width:100%; overflow:hidden; margin:0px; padding:0px; }
  3 +#tsc_breadcrumb-1 li.current { color:#9b9b9b; border-right:1px solid #CCC; padding:0 14px; }
  4 +#tsc_breadcrumb-1 li,
  5 +#tsc_breadcrumb-2 li { list-style-type:none; float:left; }
  6 +#tsc_breadcrumb-1 a { height:30px; display:block; border:1px solid #CCC; border-top:0; border-bottom:0; padding:0 14px; margin:0 0 0 -1px; text-decoration: none; color:#454545; }
  7 +#tsc_breadcrumb-1 a:hover { color:#01C3FD; box-shadow:0 0 4px #c3c3c3; background-color:#eaeaea; }
  8 +#tsc_breadcrumb-2 a:hover { color:#01C3FD; box-shadow:0 0 4px #FFF; background-color:#FFF; }
  9 +#tsc_breadcrumb-2 li.current { color:#01C3FD; padding:0 15px; }
  10 +#tsc_breadcrumb-2 { background:#2C3037; border:solid 1px #2D3238; height:31px; }
  11 +#tsc_breadcrumb-2 a { height:33px; display:block; padding:0 15px; margin:0 0 0 -1px; text-decoration: none; color:#909EB2; }
  12 +
  13 +
  14 +#tsc_breadcrumb-3 {
  15 + height:2.3em;
  16 + border:1px solid #dedede;
  17 + list-style-type:none;
  18 + padding:0;
  19 + margin:0;
  20 + }
  21 +#tsc_breadcrumb-3 li {
  22 + float:left;
  23 + line-height:2.3em;
  24 + color:#777;
  25 + padding-left:.75em;
  26 + }
  27 +#tsc_breadcrumb-3 li a {
  28 + background:url(../images/crumbs3.gif) no-repeat right center;
  29 + display:block;
  30 + padding:0 15px 0 0;
  31 + }
  32 +#tsc_breadcrumb-3 li a:link,
  33 +#tsc_breadcrumb-3 li a:visited {
  34 + color:#777;
  35 + text-decoration:none;
  36 + }
  37 +a:link, a:visited,
  38 +#tsc_breadcrumb-3 li a:hover,
  39 +#tsc_breadcrumb-3 li a:focus {
  40 + color:#dd2c0d;
  41 + }
  42 +
  43 +
  44 +
  45 +
  46 +
  47 +
  48 +
  49 +
  50 + /* ------------------------------------------- */
  51 +
  52 + #tsc_breadcrumb-4{
  53 +
  54 + list-style-type:none;
  55 + padding:0;
  56 + margin:0;
  57 +
  58 + background: #eee;
  59 + border-width: 1px;
  60 + border-style: solid;
  61 + border-color: #f5f5f5 #e5e5e5 #ccc;
  62 + -moz-border-radius: 5px;
  63 + -webkit-border-radius: 5px;
  64 + border-radius: 5px;
  65 + -moz-box-shadow: 0 0 2px rgba(0,0,0,.2);
  66 + -webkit-box-shadow: 0 0 2px rgba(0,0,0,.2);
  67 + box-shadow: 0 0 2px rgba(0,0,0,.2);
  68 + /* Clear floats */
  69 + overflow: hidden;
  70 + width: 100%;
  71 + }
  72 +
  73 + #tsc_breadcrumb-4 li{
  74 + float: left;
  75 + }
  76 +
  77 + #tsc_breadcrumb-4 a{
  78 + padding: .7em 1em .7em 2em;
  79 + float: left;
  80 + text-decoration: none;
  81 + color: #444;
  82 + position: relative;
  83 + text-shadow: 0 1px 0 rgba(255,255,255,.5);
  84 + background-color: #ddd;
  85 + background-image: -webkit-gradient(linear, left top, right bottom, from(#f5f5f5), to(#ddd));
  86 + background-image: -webkit-linear-gradient(left, #f5f5f5, #ddd);
  87 + background-image: -moz-linear-gradient(left, #f5f5f5, #ddd);
  88 + background-image: -ms-linear-gradient(left, #f5f5f5, #ddd);
  89 + background-image: -o-linear-gradient(left, #f5f5f5, #ddd);
  90 + background-image: linear-gradient(to right, #f5f5f5, #ddd);
  91 + }
  92 +
  93 + #tsc_breadcrumb-4 li:first-child a{
  94 + padding-left: 1em;
  95 + -moz-border-radius: 5px 0 0 5px;
  96 + -webkit-border-radius: 5px 0 0 5px;
  97 + border-radius: 5px 0 0 5px;
  98 + }
  99 +
  100 + #tsc_breadcrumb-4 a:hover{
  101 + background: #fff;
  102 + }
  103 +
  104 + #tsc_breadcrumb-4 a::after,
  105 + #tsc_breadcrumb-4 a::before{
  106 + content: "";
  107 + position: absolute;
  108 + top: 50%;
  109 + margin-top: -1.5em;
  110 + border-top: 1.5em solid transparent;
  111 + border-bottom: 1.5em solid transparent;
  112 + border-left: 1em solid;
  113 + right: -1em;
  114 + }
  115 +
  116 + #tsc_breadcrumb-4 a::after{
  117 + z-index: 2;
  118 + border-left-color: #ddd;
  119 + }
  120 +
  121 + #tsc_breadcrumb-4 a::before{
  122 + border-left-color: #ccc;
  123 + right: -1.1em;
  124 + z-index: 1;
  125 + }
  126 +
  127 + #tsc_breadcrumb-4 a:hover::after{
  128 + border-left-color: #fff;
  129 + }
  130 +
  131 + #tsc_breadcrumb-4 .current,
  132 + #tsc_breadcrumb-4 .current:hover{
  133 + font-weight: bold;
  134 + background: none;
  135 + }
  136 +
  137 + #tsc_breadcrumb-4 .current::after,
  138 + #tsc_breadcrumb-4 .current::before{
  139 + content: normal;
  140 + }
  141 +
  142 + /*-----------------------------------*/
  143 +
  144 + #tsc_breadcrumb-5{
  145 + /* Clear floats */
  146 + overflow: hidden;
  147 + width: 100%;
  148 + list-style-type:none;
  149 + padding:0;
  150 + margin:0;
  151 + }
  152 +
  153 + #tsc_breadcrumb-5 ul{
  154 + list-style-type:none;
  155 + padding:0;
  156 + margin:0;
  157 +}
  158 +
  159 + #tsc_breadcrumb-5 li{
  160 + float: left;
  161 + margin: 0 .5em 0 1em;
  162 + }
  163 +
  164 + #tsc_breadcrumb-5 a{
  165 + background: #ddd;
  166 + padding: .7em 1em;
  167 + float: left;
  168 + text-decoration: none;
  169 + color: #444;
  170 + text-shadow: 0 1px 0 rgba(255,255,255,.5);
  171 + position: relative;
  172 + }
  173 +
  174 + #tsc_breadcrumb-5 a:hover{
  175 + background: #99db76;
  176 + }
  177 +
  178 + #tsc_breadcrumb-5 a::before{
  179 + content: "";
  180 + position: absolute;
  181 + top: 50%;
  182 + margin-top: -1.5em;
  183 + border-width: 1.5em 0 1.5em 1em;
  184 + border-style: solid;
  185 + border-color: #ddd #ddd #ddd transparent;
  186 + left: -1em;
  187 + }
  188 +
  189 + #tsc_breadcrumb-5 a:hover::before{
  190 + border-color: #99db76 #99db76 #99db76 transparent;
  191 + }
  192 +
  193 + #tsc_breadcrumb-5 a::after{
  194 + content: "";
  195 + position: absolute;
  196 + top: 50%;
  197 + margin-top: -1.5em;
  198 + border-top: 1.5em solid transparent;
  199 + border-bottom: 1.5em solid transparent;
  200 + border-left: 1em solid #ddd;
  201 + right: -1em;
  202 + }
  203 +
  204 + #tsc_breadcrumb-5 a:hover::after{
  205 + border-left-color: #99db76;
  206 + }
  207 +
  208 + #tsc_breadcrumb-5 .current,
  209 + #tsc_breadcrumb-5 .current:hover{
  210 + font-weight: bold;
  211 + background: none;
  212 + }
  213 +
  214 + #tsc_breadcrumb-5 .current::after,
  215 + #tsc_breadcrumb-5 .current::before{
  216 + content: normal;
  217 + }
  218 +
  219 + /* ------------------------------------------- */
  220 +
  221 + #tsc_breadcrumb-6{
  222 + /* Clear floats */
  223 + overflow: hidden;
  224 + width: 100%;
  225 + list-style-type:none;
  226 + padding:0;
  227 + margin:0;
  228 + }
  229 +
  230 + #tsc_breadcrumb-6 ul{
  231 + list-style-type:none;
  232 + padding:0;
  233 + margin:0;
  234 +}
  235 +
  236 + #tsc_breadcrumb-6 ul{
  237 + list-style-type:none;
  238 + padding:0;
  239 + margin:0;
  240 +}
  241 +
  242 + #tsc_breadcrumb-6 li{
  243 + float: left;
  244 + margin: 0 2em 0 0;
  245 +
  246 + }
  247 +
  248 + #tsc_breadcrumb-6 a{
  249 + padding: .7em 1em .7em 2em;
  250 + float: left;
  251 + text-decoration: none;
  252 + color: #444;
  253 + background: #ddd;
  254 + position: relative;
  255 + z-index: 1;
  256 + text-shadow: 0 1px 0 rgba(255,255,255,.5);
  257 + -moz-border-radius: .4em 0 0 .4em;
  258 + -webkit-border-radius: .4em 0 0 .4em;
  259 + border-radius: .4em 0 0 .4em;
  260 + }
  261 +
  262 + #tsc_breadcrumb-6 a:hover{
  263 + background: #abe0ef;
  264 + }
  265 +
  266 + #tsc_breadcrumb-6 a::after{
  267 + background: #ddd;
  268 + content: "";
  269 + height: 2.5em;
  270 + margin-top: -1.25em;
  271 + position: absolute;
  272 + right: -1em;
  273 + top: 50%;
  274 + width: 2.5em;
  275 + z-index: -1;
  276 + -webkit-transform: rotate(45deg);
  277 + -moz-transform: rotate(45deg);
  278 + -ms-transform: rotate(45deg);
  279 + -o-transform: rotate(45deg);
  280 + transform: rotate(45deg);
  281 + -moz-border-radius: .4em;
  282 + -webkit-border-radius: .4em;
  283 + border-radius: .4em;
  284 + }
  285 +
  286 + #tsc_breadcrumb-6 a:hover::after{
  287 + background: #abe0ef;
  288 + }
  289 +
  290 + #tsc_breadcrumb-6 .current,
  291 + #tsc_breadcrumb-6 .current:hover{
  292 + font-weight: bold;
  293 + background: none;
  294 + }
  295 +
  296 + #tsc_breadcrumb-6 .current::after{
  297 + content: normal;
  298 + }
  299 +
  300 + /* ------------------------------------------- */
  301 +
  302 + #tsc_breadcrumb-7{
  303 + /* Clear floats */
  304 + overflow: hidden;
  305 + width: 100%;
  306 + list-style-type:none;
  307 + padding:0;
  308 + margin:0;
  309 + }
  310 +
  311 + #tsc_breadcrumb-7 ul{
  312 + list-style-type:none;
  313 + padding:0;
  314 + margin:0;
  315 +}
  316 +
  317 + #tsc_breadcrumb-7 li{
  318 + float: left;
  319 + margin: 0 .5em 0 1em;
  320 + }
  321 +
  322 + #tsc_breadcrumb-7 a{
  323 + background: #ddd;
  324 + padding: .7em 1em;
  325 + float: left;
  326 + text-decoration: none;
  327 + color: #444;
  328 + text-shadow: 0 1px 0 rgba(255,255,255,.5);
  329 + position: relative;
  330 + }
  331 +
  332 + #tsc_breadcrumb-7 a:hover{
  333 + background: #efc9ab;
  334 + }
  335 +
  336 + #tsc_breadcrumb-7 a::before,
  337 + #tsc_breadcrumb-7 a::after{
  338 + content:'';
  339 + position:absolute;
  340 + top: 0;
  341 + bottom: 0;
  342 + width: 1em;
  343 + background: #ddd;
  344 + -webkit-transform: skew(-10deg);
  345 + -moz-transform: skew(-10deg);
  346 + -ms-transform: skew(-10deg);
  347 + -o-transform: skew(-10deg);
  348 + transform: skew(-10deg);
  349 + }
  350 +
  351 + #tsc_breadcrumb-7 a::before{
  352 +
  353 + left: -.5em;
  354 + -webkit-border-radius: 5px 0 0 5px;
  355 + -moz-border-radius: 5px 0 0 5px;
  356 + border-radius: 5px 0 0 5px;
  357 + }
  358 +
  359 + #tsc_breadcrumb-7 a:hover::before{
  360 + background: #efc9ab;
  361 + }
  362 +
  363 + #tsc_breadcrumb-7 a::after{
  364 + right: -.5em;
  365 + -webkit-border-radius: 0 5px 5px 0;
  366 + -moz-border-radius: 0 5px 5px 0;
  367 + border-radius: 0 5px 5px 0;
  368 + }
  369 +
  370 + #tsc_breadcrumb-7 a:hover::after{
  371 + background: #efc9ab;
  372 + }
  373 +
  374 + #tsc_breadcrumb-7 .current,
  375 + #tsc_breadcrumb-7 .current:hover{
  376 + font-weight: bold;
  377 + background: none;
  378 + }
  379 +
  380 + #tsc_breadcrumb-7 .current::after,
  381 + #tsc_breadcrumb-7 .current::before{
  382 + content: normal;
  383 + }
  384 +
  385 +
  386 +
  387 +
  388 +
  389 +
  390 +
  391 +
  392 +
  393 +
  394 +
  395 +
  396 +
  397 +
  398 +
  399 +ul.tsc_pagination { margin:4px 0; padding-left:414px; height:100%; overflow:hidden; font:12px 'Tahoma'; list-style-type:none; }
  400 +ul.tsc_pagination li { float:left; margin:0px; padding:0px; margin-left:5px; }
  401 +ul.tsc_pagination li:first-child { margin-left:0px; }
  402 +ul.tsc_pagination li a { color:black; display:block; text-decoration:none; padding:7px 10px 7px 10px; }
  403 +ul.tsc_pagination li a img { border:none; }
  404 +/*A */
  405 +
  406 +ul.tsc_paginationA li a { color:#FFFFFF; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
  407 +/*01 */
  408 +ul.tsc_paginationA01 li a { color:#474747; border:solid 1px #B6B6B6; padding:6px 9px 6px 9px; background:#E6E6E6; background:-moz-linear-gradient(top, #FFFFFF 1px, #F3F3F3 1px, #E6E6E6); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFFFFF), color-stop(0.02, #F3F3F3), color-stop(1, #E6E6E6)); }
  409 +ul.tsc_paginationA01 li a:hover,
  410 +ul.tsc_paginationA01 li a.current { background:#FFFFFF; }
  411 +/*02 */
  412 +ul.tsc_paginationA02 li a { color:#893A00; background:#FFCB00; background:-moz-linear-gradient(top, #FFD500, #FFCB00); background:-webkit-gradient(linear, 0 0, 0 100%, from(#FFD500), to(#FFCB00)); }
  413 +ul.tsc_paginationA02 li a:hover,
  414 +ul.tsc_paginationA02 li a.current { background:#FFF4BA; }
  415 +/*03 */
  416 +ul.tsc_paginationA03 li a { background:#FF7217; background:-moz-linear-gradient(top, #FF8E1F, #FF7217); background:-webkit-gradient(linear, 0 0, 0 100%, from(#FF8E1F), to(#FF7217)); }
  417 +ul.tsc_paginationA03 li a:hover,
  418 +ul.tsc_paginationA03 li a.current { color:#C34E00; background:#FFECDE; }
  419 +/*04 */
  420 +ul.tsc_paginationA04 li a { background:#D22020; background:-moz-linear-gradient(top, #DB2B2B, #D22020); background:-webkit-gradient(linear, 0 0, 0 100%, from(#DB2B2B), to(#D22020)); }
  421 +ul.tsc_paginationA04 li a:hover,
  422 +ul.tsc_paginationA04 li a.current { color:#9F0F0F; background:#FFE0E0; }
  423 +/*05 */
  424 +ul.tsc_paginationA05 li a { background:#699613; background:-moz-linear-gradient(top, #87AB19, #699613); background:-webkit-gradient(linear, 0 0, 0 100%, from(#87AB19), to(#699613)); }
  425 +ul.tsc_paginationA05 li a:hover,
  426 +ul.tsc_paginationA05 li a.current { color:#4F7119; background:#E7F2C7; }
  427 +/*06 */
  428 +ul.tsc_paginationA06 li a { background:#1D8A11; background:-moz-linear-gradient(top, #26A116, #1D8A11); background:-webkit-gradient(linear, 0 0, 0 100%, from(#26A116), to(#1D8A11)); }
  429 +ul.tsc_paginationA06 li a:hover,
  430 +ul.tsc_paginationA06 li a.current { color:#176D0E; background:#DCF4C9; }
  431 +/*07 */
  432 +ul.tsc_paginationA07 li a { background:#45ABEC; background:-moz-linear-gradient(top, #5CBCF0, #45ABEC); background:-webkit-gradient(linear, 0 0, 0 100%, from(#5CBCF0), to(#45ABEC)); }
  433 +ul.tsc_paginationA07 li a:hover,
  434 +ul.tsc_paginationA07 li a.current { color:#358FDD; background:#DFF4FF; }
  435 +/*08 */
  436 +ul.tsc_paginationA08 li a { background:#3862C8; background:-moz-linear-gradient(top, #4A81D3, #3862C8); background:-webkit-gradient(linear, 0 0, 0 100%, from(#4A81D3), to(#3862C8)); }
  437 +ul.tsc_paginationA08 li a:hover,
  438 +ul.tsc_paginationA08 li a.current { color:#355DDD; background:#DDE8FE; }
  439 +/*09 */
  440 +ul.tsc_paginationA09 li a { background:#5A7075; background:-moz-linear-gradient(top, #788C90, #5A7075); background:-webkit-gradient(linear, 0 0, 0 100%, from(#788C90), to(#5A7075)); }
  441 +ul.tsc_paginationA09 li a:hover,
  442 +ul.tsc_paginationA09 li a.current { color:#355DDD; background:#DDE8FE; }
  443 +/*10 */
  444 +ul.tsc_paginationA10 li a { background:#684BA6; background:-moz-linear-gradient(top, #8663B8, #684BA6); background:-webkit-gradient(linear, 0 0, 0 100%, from(#8663B8), to(#684BA6)); }
  445 +ul.tsc_paginationA10 li a:hover,
  446 +ul.tsc_paginationA10 li a.current { color:#643EB3; background:#EAE4F4; }
  447 +/*11 */
  448 +ul.tsc_paginationA11 li a { background:#9A6654; background:-moz-linear-gradient(top, #AE846F, #9A6654); background:-webkit-gradient(linear, 0 0, 0 100%, from(#AE846F), to(#9A6654)); }
  449 +ul.tsc_paginationA11 li a:hover,
  450 +ul.tsc_paginationA11 li a.current { color:#78594A; background:#F0E7E3; }
  451 +/*12 */
  452 +ul.tsc_paginationA12 li a { background:#323232; background:-moz-linear-gradient(top, #434343, #323232); background:-webkit-gradient(linear, 0 0, 0 100%, from(#434343), to(#323232)); }
  453 +ul.tsc_paginationA12 li a:hover,
  454 +ul.tsc_paginationA12 li a.current { color:#2F2F2F; background:#EAEAEA; }
  455 +
  456 +/* B */
  457 +ul.tsc_paginationB li a { border:solid 1px; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; padding:6px 9px 6px 9px; }
  458 +ul.tsc_paginationB li { padding-bottom:1px; }
  459 +ul.tsc_paginationB li a:hover,
  460 +ul.tsc_paginationB li a.current { color:#FFFFFF; box-shadow:0px 1px #EDEDED; -moz-box-shadow:0px 1px #EDEDED; -webkit-box-shadow:0px 1px #EDEDED; }
  461 +/* 01 */
  462 +ul.tsc_paginationB01 li a { color:#A74E0D; border-color:#F3D795; background:#FFFDF2; }
  463 +ul.tsc_paginationB01 li a:hover,
  464 +ul.tsc_paginationB01 li a.current { color:#893A00; text-shadow:0px 1px #FFEF42; border-color:#FFA200; background:#FFC800; background:-moz-linear-gradient(top, #FFFFFF 1px, #FFEA01 1px, #FFC800); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFFFFF), color-stop(0.02, #FFEA01), color-stop(1, #FFC800)); }
  465 +/* 02 */
  466 +ul.tsc_paginationB02 li a { color:#0A7EC5; border-color:#8DC5E6; background:#F8FCFF; }
  467 +ul.tsc_paginationB02 li a:hover,
  468 +ul.tsc_paginationB02 li a.current { text-shadow:0px 1px #388DBE; border-color:#3390CA; background:#58B0E7; background:-moz-linear-gradient(top, #B4F6FF 1px, #63D0FE 1px, #58B0E7); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #B4F6FF), color-stop(0.02, #63D0FE), color-stop(1, #58B0E7)); }
  469 +/* 03 */
  470 +ul.tsc_paginationB03 li a { color:#4A76C6; border-color:#8AAEEF; background:#F7F9FE; }
  471 +ul.tsc_paginationB03 li a:hover,
  472 +ul.tsc_paginationB03 li a.current { text-shadow:0px 1px #4876C9; border-color:#3D6DC3; background:#5A8CE7; background:-moz-linear-gradient(top, #C2E0FF 1px, #84AFFE 1px, #5A8CE7); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #C2E0FF), color-stop(0.02, #84AFFE), color-stop(1, #5A8CE7)); }
  473 +/* 04 */
  474 +ul.tsc_paginationB04 li a { color:#8D62C8; border-color:#BAA2DA; background:#F9F7FC; }
  475 +ul.tsc_paginationB04 li a:hover,
  476 +ul.tsc_paginationB04 li a.current { text-shadow:0px 1px #7955AB; border-color:#6F4DA0; background:#9168C9; background:-moz-linear-gradient(top, #DFBEFA 1px, #B088E7 1px, #9168C9); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #DFBEFA), color-stop(0.02, #B088E7), color-stop(1, #9168C9)); }
  477 +/* 05 */
  478 +ul.tsc_paginationB05 li a { color:#EF6420; border-color:#FFBD85; background:#FFFAF7; }
  479 +ul.tsc_paginationB05 li a:hover,
  480 +ul.tsc_paginationB05 li a.current { text-shadow:0px 1px #CA470E; border-color:#D13F11; background:#E95B2B; background:-moz-linear-gradient(top, #FFBE01 1px, #FE7C02 1px, #E95B2B); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFBE01), color-stop(0.02, #FE7C02), color-stop(1, #E95B2B)); }
  481 +/* 06 */
  482 +ul.tsc_paginationB06 li a { color:#E92F2F; border-color:#FFA5A5; background:#FFF8F8; }
  483 +ul.tsc_paginationB06 li a:hover,
  484 +ul.tsc_paginationB06 li a.current { text-shadow:0px 1px #B72E2E; border-color:#AD2D2D; background:#E43838; background:-moz-linear-gradient(top, #FF9B9B 1px, #FE5555 1px, #E43838); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FF9B9B), color-stop(0.02, #FE5555), color-stop(1, #E43838)); }
  485 +/* 07 */
  486 +ul.tsc_paginationB07 li a { color:#916C59; border-color:#D6BFB4; background:#FBF9F8; }
  487 +ul.tsc_paginationB07 li a:hover,
  488 +ul.tsc_paginationB07 li a.current { text-shadow:0px 1px #866454; border-color:#886756; background:#A37A66; background:-moz-linear-gradient(top, #E9C4B2 1px, #C59882 1px, #A37A66); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #E9C4B2), color-stop(0.02, #C59882), color-stop(1, #A37A66)); }
  489 +/* 08 */
  490 +ul.tsc_paginationB08 li a { color:#478223; border-color:#B2D397; background:#F7FAF4; }
  491 +ul.tsc_paginationB08 li a:hover,
  492 +ul.tsc_paginationB08 li a.current { text-shadow:0px 1px #4E802C; border-color:#478223; background:#599F2F; background:-moz-linear-gradient(top, #9FE355 1px, #79BF4A 1px, #599F2F); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #9FE355), color-stop(0.02, #79BF4A), color-stop(1, #599F2F)); }
  493 +/* 09 */
  494 +ul.tsc_paginationB09 li a { color:#707070; border-color:#CFCFCF; background:#FAFAFA; }
  495 +ul.tsc_paginationB09 li a:hover,
  496 +ul.tsc_paginationB09 li a.current { text-shadow:0px 1px #636363; border-color:#5D5D5D; background:#777777; background:-moz-linear-gradient(top, #C0C0C0 1px, #929292 1px, #777777); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #C0C0C0), color-stop(0.02, #929292), color-stop(1, #777777)); }
  497 +/* 10 */
  498 +ul.tsc_paginationB10 li a { color:#444444; border-color:#BEBEBE; background:#FAFAFA; }
  499 +ul.tsc_paginationB10 li a:hover,
  500 +ul.tsc_paginationB10 li a.current { text-shadow:0px 1px #3C3C3C; border-color:#202020; background:#525252; background:-moz-linear-gradient(top, #9F9F9F 1px, #6C6C6C 1px, #525252); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #9F9F9F), color-stop(0.02, #6C6C6C), color-stop(1, #525252)); }
  501 +
  502 +/* C */
  503 +ul.tsc_paginationC li a { color:#707070; background:#FFFFFF; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; border:solid 1px #DCDCDC; padding:6px 9px 6px 9px; }
  504 +ul.tsc_paginationC li { padding-bottom:1px; }
  505 +ul.tsc_paginationC li a:hover,
  506 +ul.tsc_paginationC li a.current { color:#FFFFFF; box-shadow:0px 1px #EDEDED; -moz-box-shadow:0px 1px #EDEDED; -webkit-box-shadow:0px 1px #EDEDED; }
  507 +/* 01 */
  508 +ul.tsc_paginationC01 li a:hover,
  509 +ul.tsc_paginationC01 li a.current { color:#893A00; text-shadow:0px 1px #FFEF42; border-color:#FFA200; background:#FFC800; background:-moz-linear-gradient(top, #FFFFFF 1px, #FFEA01 1px, #FFC800); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFFFFF), color-stop(0.02, #FFEA01), color-stop(1, #FFC800)); }
  510 +/* 02 */
  511 +ul.tsc_paginationC02 li a:hover,
  512 +ul.tsc_paginationC02 li a.current { text-shadow:0px 1px #388DBE; border-color:#3390CA; background:#58B0E7; background:-moz-linear-gradient(top, #B4F6FF 1px, #63D0FE 1px, #58B0E7); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #B4F6FF), color-stop(0.02, #63D0FE), color-stop(1, #58B0E7)); }
  513 +/* 03 */
  514 +ul.tsc_paginationC03 li a:hover,
  515 +ul.tsc_paginationC03 li a.current { text-shadow:0px 1px #4876C9; border-color:#3D6DC3; background:#5A8CE7; background:-moz-linear-gradient(top, #C2E0FF 1px, #84AFFE 1px, #5A8CE7); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #C2E0FF), color-stop(0.02, #84AFFE), color-stop(1, #5A8CE7)); }
  516 +/* 04 */
  517 +ul.tsc_paginationC04 li a:hover,
  518 +ul.tsc_paginationC04 li a.current { text-shadow:0px 1px #7955AB; border-color:#6F4DA0; background:#9168C9; background:-moz-linear-gradient(top, #DFBEFA 1px, #B088E7 1px, #9168C9); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #DFBEFA), color-stop(0.02, #B088E7), color-stop(1, #9168C9)); }
  519 +/* 05 */
  520 +ul.tsc_paginationC05 li a:hover,
  521 +ul.tsc_paginationC05 li a.current { text-shadow:0px 1px #CA470E; border-color:#D13F11; background:#E95B2B; background:-moz-linear-gradient(top, #FFBE01 1px, #FE7C02 1px, #E95B2B); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FFBE01), color-stop(0.02, #FE7C02), color-stop(1, #E95B2B)); }
  522 +/* 06 */
  523 +ul.tsc_paginationC06 li a:hover,
  524 +ul.tsc_paginationC06 li a.current { text-shadow:0px 1px #B72E2E; border-color:#AD2D2D; background:#E43838; background:-moz-linear-gradient(top, #FF9B9B 1px, #FE5555 1px, #E43838); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #FF9B9B), color-stop(0.02, #FE5555), color-stop(1, #E43838)); }
  525 +/* 07 */
  526 +ul.tsc_paginationC07 li a:hover,
  527 +ul.tsc_paginationC07 li a.current { text-shadow:0px 1px #866454; border-color:#886756; background:#A37A66; background:-moz-linear-gradient(top, #E9C4B2 1px, #C59882 1px, #A37A66); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #E9C4B2), color-stop(0.02, #C59882), color-stop(1, #A37A66)); }
  528 +/* 08 */
  529 +ul.tsc_paginationC08 li a:hover,
  530 +ul.tsc_paginationC08 li a.current { text-shadow:0px 1px #4E802C; border-color:#478223; background:#599F2F; background:-moz-linear-gradient(top, #9FE355 1px, #79BF4A 1px, #599F2F); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #9FE355), color-stop(0.02, #79BF4A), color-stop(1, #599F2F)); }
  531 +/* 09 */
  532 +ul.tsc_paginationC09 li a:hover,
  533 +ul.tsc_paginationC09 li a.current { text-shadow:0px 1px #636363; border-color:#5D5D5D; background:#777777; background:-moz-linear-gradient(top, #C0C0C0 1px, #929292 1px, #777777); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #C0C0C0), color-stop(0.02, #929292), color-stop(1, #777777)); }
  534 +/* 10 */
  535 +ul.tsc_paginationC10 li a:hover,
  536 +ul.tsc_paginationC10 li a.current { text-shadow:0px 1px #3C3C3C; border-color:#202020; background:#525252; background:-moz-linear-gradient(top, #9F9F9F 1px, #6C6C6C 1px, #525252); background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #9F9F9F), color-stop(0.02, #6C6C6C), color-stop(1, #525252)); }
... ...
Resources/public/css/style.css 0 → 100755
  1 +++ a/Resources/public/css/style.css
... ... @@ -0,0 +1,397 @@
  1 +.laterais
  2 + {
  3 + border-left: #F58735 1px solid;
  4 + border-right: #F58735 1px solid;
  5 + border-bottom: #F58735 1px solid;
  6 + FONT-FAMILY: Arial, Verdana;
  7 + FONT-SIZE: 8pt;
  8 + FONT-WEIGHT: bold
  9 + }
  10 +.final
  11 + {
  12 + border-bottom: #F58735 1px solid;
  13 + }
  14 +.thtt
  15 + {
  16 + FONT-FAMILY: Arial, Verdana;
  17 + FONT-SIZE: 9pt;
  18 + FONT-WEIGHT: bold;
  19 + TEXT-VALGIN: middle;
  20 + }
  21 +.OnLine
  22 + {
  23 + font-family: Verdana;
  24 + font-size: 7pt;
  25 + color: #000080;
  26 + font-weight: bold;
  27 + }
  28 +
  29 +.box {
  30 + display: inline-block;
  31 + width: 12%;
  32 + height: 100px;
  33 + margin: 1em;
  34 + vertical-align:top;
  35 +}
  36 +
  37 +.main {
  38 + display: inline-block;
  39 + width: 82%;
  40 + margin: 1em;
  41 + vertical-align:top;
  42 +}
  43 +
  44 +.caixa
  45 + {
  46 + BORDER-RIGHT: #F58735 1px solid;
  47 + BORDER-TOP: #F58735 1px solid;
  48 + BORDER-LEFT: #F58735 1px solid;
  49 + BORDER-BOTTOM: #F58735 1px solid;
  50 + FONT-SIZE: 10px;
  51 + FONT-FAMILY: Verdana, Arial;
  52 + width:100px;
  53 + }
  54 +.impar
  55 + {
  56 + background-color: #FFFFFF;
  57 + border-width: 1px;
  58 + border-style: solid;
  59 + border-color: #F58735;
  60 + FONT-FAMILY: Verdana, Arial;
  61 + FONT-SIZE: 8pt;
  62 + FONT-WEIGHT: bold
  63 + }
  64 +
  65 +.par
  66 + {
  67 + background-color: #EEEEE6;
  68 + border-width: 1px;
  69 + border-style: solid;
  70 + border-color: #F58735;
  71 + FONT-FAMILY: Verdana, Arial;
  72 + FONT-SIZE: 8pt;
  73 + FONT-WEIGHT: bold
  74 + }
  75 +
  76 +.tab
  77 + {
  78 + border: #F58735 2px solid;
  79 + }
  80 +.topo
  81 + {
  82 + background-color: #006666;
  83 + border-width: 1px;
  84 + border-style: solid;
  85 + border-color: #FF9900;
  86 + padding-left: 1;
  87 + padding-right: 1;
  88 + padding-top: 2;
  89 + padding-bottom: 2;
  90 + FONT: 10pt Verdana, Arial;
  91 + FONT-WEIGHT: bold;
  92 + COLOR: #FFFFFF;
  93 + }
  94 +
  95 +.rly
  96 + {
  97 + background-color: #CEFFCE;
  98 + border-width: 1px;
  99 + border-style: solid;
  100 + border-color: #FF9900;
  101 + padding-left: 1;
  102 + padding-right: 1;
  103 + padding-top: 2;
  104 + padding-bottom: 2;
  105 + FONT: 7pt Verdana, Arial;
  106 + FONT-WEIGHT: bold;
  107 + COLOR: #00000;
  108 + }
  109 +
  110 +.alto1
  111 + {
  112 + background-color: #80FFFF;
  113 + border-width: 1px;
  114 + border-style: solid;
  115 + border-color: #FF9900;
  116 + padding-left: 1;
  117 + padding-right: 1;
  118 + padding-top: 2;
  119 + padding-bottom: 2;
  120 + FONT: 7pt Verdana, Arial;
  121 + FONT-WEIGHT: bold;
  122 + COLOR: #000000;
  123 + }
  124 +
  125 +.alto2
  126 + {
  127 + background-color: #B3D9FF;
  128 + border-width: 1px;
  129 + border-style: solid;
  130 + border-color: #FF9900;
  131 + padding-left: 1;
  132 + padding-right: 1;
  133 + padding-top: 2;
  134 + padding-bottom: 2;
  135 + FONT: 7pt Verdana, Arial;
  136 + FONT-WEIGHT: bold;
  137 + COLOR: #000000;
  138 + }
  139 +
  140 +.zero1
  141 + {
  142 + background-color: #FFFFDD;
  143 + border-width: 1px;
  144 + border-style: solid;
  145 + border-color: #FF9900;
  146 + padding-left: 1;
  147 + padding-right: 1;
  148 + padding-top: 2;
  149 + padding-bottom: 2;
  150 + FONT: 7pt Verdana, Arial;
  151 + FONT-WEIGHT: bold;
  152 + COLOR: #0000BF;
  153 + }
  154 +
  155 +.zero2
  156 + {
  157 + background-color: #F0F000;
  158 + border-width: 1px;
  159 + border-style: solid;
  160 + border-color: #FF9900;
  161 + padding-left: 1;
  162 + padding-right: 1;
  163 + padding-top: 2;
  164 + padding-bottom: 2;
  165 + FONT: 7pt Verdana, Arial;
  166 + FONT-WEIGHT: bold;
  167 + COLOR: #0000BF;
  168 + }
  169 +
  170 +body
  171 + {
  172 + background-image: url("../images/background.gif");
  173 + scrollbar-face-color: #FFFFFF;
  174 + scrollbar-shadow-color: #c0c0c0;
  175 + scrollbar-highlight-color: #FFFFFF;
  176 + scrollbar-3dlight-color: #c0c0c0;
  177 + scrollbar-darkshadow-color: #FFFFFF;
  178 + scrollbar-track-color: #ffffff;
  179 + scrollbar-arrow-color: #c0c0c0;
  180 + font-family: Verdana, Arial;
  181 + font-size: 12pt;
  182 + }
  183 +
  184 +A:link
  185 + {
  186 + font-family: Verdana, Arial;
  187 + font-size: 8pt;
  188 + FONT-WEIGHT: bold;
  189 + COLOR: #000000;
  190 + TEXT-DECORATION: none;
  191 + CURSOR: hand;
  192 + }
  193 +
  194 +A:visited
  195 + {
  196 + font-family: Verdana, Arial;
  197 + font-size: 8pt;
  198 + FONT-WEIGHT: bold;
  199 + COLOR: #333333;
  200 + TEXT-DECORATION: none;
  201 + CURSOR: hand;
  202 + }
  203 +
  204 +A:active
  205 + {
  206 + font-family: Verdana, Arial;
  207 + font-size: 8pt;
  208 + FONT-WEIGHT: bold;
  209 + COLOR: #FF8000;
  210 + TEXT-DECORATION: none;
  211 + CURSOR: hand;
  212 + }
  213 +
  214 +A:hover
  215 + {
  216 + font-family: Verdana, Arial;
  217 + font-size: 8pt;
  218 + FONT-WEIGHT: bold;
  219 + TEXT-DECORATION: none;
  220 + color:#FF0000;
  221 + CURSOR: hand;
  222 + }
  223 +
  224 +
  225 +.result
  226 + {
  227 + border-width: 1px;
  228 + border-style: solid;
  229 + border-color: #F58735;
  230 + FONT-FAMILY: Verdana, Arial;
  231 + FONT-SIZE: 9pt;
  232 + FONT-WEIGHT: bold
  233 + }
  234 +
  235 +.thd
  236 + {
  237 + background-color: #006666;
  238 + border-width: 1px;
  239 + border-style: solid;
  240 + border-color: #F58735;
  241 + FONT-FAMILY: Verdana, Arial;
  242 + FONT-SIZE: 9pt;
  243 + FONT-WEIGHT: bold;
  244 + COLOR: #FFFFFF;
  245 + ALIGN: center;
  246 + }
  247 +
  248 +.acessos
  249 + {
  250 + border: #F58735 1px solid;
  251 + FONT-FAMILY: Verdana, Arial;
  252 + FONT-SIZE: 9pt;
  253 + FONT-WEIGHT: bold
  254 + }
  255 +
  256 +A
  257 + {
  258 + FONT-FAMILY: Verdana, Arial;
  259 + FONT-WEIGHT: bold;
  260 + FONT-SIZE: 8pt;
  261 + COLOR: #08296b;
  262 + text-decoration: none
  263 + }
  264 +
  265 +.sys
  266 + {
  267 + PADDING-LEFT: 10px;
  268 + FONT: 8pt Verdana, Arial;
  269 + FONT-WEIGHT: bold;
  270 + COLOR: #404000;
  271 + }
  272 +
  273 +.desc
  274 + {
  275 + PADDING-LEFT: 10px;
  276 + FONT: 8pt Verdana, Arial;
  277 + FONT-WEIGHT: bold;
  278 + COLOR: #000;
  279 + }
  280 +
  281 +.info
  282 + {
  283 + background-color: #404000;
  284 + border-width: 1px;
  285 + border-style: solid;
  286 + border-color: #F58735;
  287 + FONT-FAMILY: Verdana, Arial;
  288 + FONT-SIZE: 9pt;
  289 + FONT-WEIGHT: bold;
  290 + COLOR: #FFF;
  291 + ALIGN: center;
  292 + }
  293 +
  294 +.tht
  295 +
  296 + {
  297 +
  298 + font-size: 10pt;
  299 +
  300 + font-family: Arial, Verdana;
  301 +
  302 + font-weight: bold;
  303 +
  304 + text-align: left;
  305 +
  306 + text-valign: middle
  307 +
  308 + }
  309 +
  310 +.tdt
  311 +
  312 + {
  313 +
  314 + font-size: 10pt;
  315 +
  316 + font-family: Verdana, Arial;
  317 +
  318 + font-weight: bold;
  319 +
  320 + text-align: left;
  321 +
  322 + text-valign: middle
  323 +
  324 + }
  325 +
  326 +.tdi
  327 +
  328 + {
  329 +
  330 + font-size: 10pt;
  331 +
  332 + font-family: Verdana, Arial;
  333 +
  334 + font-weight: bold;
  335 +
  336 + text-align: left;
  337 +
  338 + text-valign: middle;
  339 +
  340 + BORDER-COLOR: #F58735;
  341 +
  342 + BORDER-STYLE: solid;
  343 +
  344 + BORDER-WIDTH: 1px;
  345 +
  346 + }
  347 +
  348 +.tdx
  349 +
  350 + {
  351 +
  352 + font-size: 9pt;
  353 +
  354 + font-family: Verdana, Arial;
  355 +
  356 + font-weight: bold;
  357 +
  358 + text-align: left;
  359 +
  360 + text-valign: middle;
  361 +
  362 + }
  363 +
  364 +table.records_list
  365 + {
  366 + border-collapse: collapse;
  367 + border: #0B3B0B 1px solid;
  368 + FONT-FAMILY: Verdana, Arial;
  369 + FONT-SIZE: 9pt;
  370 + FONT-WEIGHT: bold;
  371 + }
  372 +
  373 +table.records_list tr td
  374 + {
  375 + border: #0B3B0B 1px solid;
  376 + padding-left: 10px;
  377 + padding-right: 10px;
  378 + }
  379 +
  380 +.records_list th
  381 + {
  382 + background-color: #0B3B0B;
  383 + border: #FFF 1px solid;
  384 + color: #FFF;
  385 + padding-left: 10px;
  386 + padding-right: 10px;
  387 + padding-top: 5px;
  388 + padding-bottom: 5px;
  389 + }
  390 +
  391 +#form_choice
  392 + {
  393 + display: inline-block;
  394 + margin-right: 10px;
  395 + }
  396 +
  397 +
... ...
Resources/public/images/Fundo1.gif 0 → 100755

614 Bytes

Resources/public/images/ajuda.gif 0 → 100755

262 Bytes

Resources/public/images/ajuda_map.gif 0 → 100755

1.22 KB

Resources/public/images/alerta1.jpg 0 → 100755

1.29 KB

Resources/public/images/background.gif 0 → 100755

1.07 KB

Resources/public/images/boxverde_d.gif 0 → 100755

321 Bytes

Resources/public/images/boxverde_e.gif 0 → 100755

918 Bytes

Resources/public/images/boxverde_m.gif 0 → 100755

150 Bytes

Resources/public/images/bt_ok.gif 0 → 100755

79 Bytes

Resources/public/images/bt_voltar.gif 0 → 100755

129 Bytes

Resources/public/images/circuit.png 0 → 100755

265 Bytes

Resources/public/images/config.gif 0 → 100755

1.23 KB

Resources/public/images/contatos.gif 0 → 100755

980 Bytes

Resources/public/images/entity.png 0 → 100755

592 Bytes

Resources/public/images/fundo_barra.gif 0 → 100755

54 Bytes

Resources/public/images/fundoko.gif.1 0 → 100755
No preview for this file type
Resources/public/images/help1.gif 0 → 100755

342 Bytes

Resources/public/images/help_circuit.jpg 0 → 100755

87.8 KB

Resources/public/images/high.jpg 0 → 100755

759 Bytes

Resources/public/images/home.gif 0 → 100755

918 Bytes

Resources/public/images/info.gif 0 → 100755

1.05 KB

Resources/public/images/logo.gif 0 → 100755

3.42 KB

Resources/public/images/logo.png 0 → 100755

3.75 KB

Resources/public/images/mapabr.gif 0 → 100755

16 KB

Resources/public/images/rel.png 0 → 100755

3.85 KB

Resources/public/images/relatorios.jpeg 0 → 100755

807 Bytes

Resources/public/images/tabela.jpg 0 → 100755

594 Bytes

Resources/public/images/telnet.gif 0 → 100755

1.12 KB

Resources/public/images/top_dataprev.gif 0 → 100755

2.04 KB

Resources/public/images/top_logo.gif 0 → 100755

2.46 KB

Resources/public/images/top_pontos.gif 0 → 100755

1.15 KB

Resources/public/images/total.gif 0 → 100755

862 Bytes

Resources/public/images/traf.jpg 0 → 100755

575 Bytes

Resources/translations/messages.fr.xlf 0 → 100755
  1 +++ a/Resources/translations/messages.fr.xlf
... ... @@ -0,0 +1,11 @@
  1 +<?xml version="1.0"?>
  2 +<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  3 + <file source-language="en" datatype="plaintext" original="file.ext">
  4 + <body>
  5 + <trans-unit id="1">
  6 + <source>Symfony2 is great</source>
  7 + <target>J'aime Symfony2</target>
  8 + </trans-unit>
  9 + </body>
  10 + </file>
  11 +</xliff>
... ...
Resources/views/Circuits/edit.html.twig 0 → 100755
  1 +++ a/Resources/views/Circuits/edit.html.twig
... ... @@ -0,0 +1,110 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h2>{{ entity.description }}</h2>
  5 +
  6 + <form action="{{ path('circuits_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
  7 + <input type="hidden" name="_method" value="PUT" />
  8 + <table class="records_list" border=0 cellspacing=2 cellpadding=2>
  9 + <tr>
  10 + {{ form_errors(edit_form) }}
  11 +
  12 + <th> Código da Interface: </th>
  13 + <td> {{ form_widget(edit_form.codeInterface) }} </td>
  14 + </tr>
  15 + <tr>
  16 + <th> Descrição do circuito: </th>
  17 + <td> {{ form_widget(edit_form.description) }} </td>
  18 + </tr>
  19 + <tr>
  20 + <th> Entidade: </th>
  21 + <td> {{ form_widget(edit_form.entity) }} </td>
  22 + </tr>
  23 + <tr>
  24 + <th> Gerencia: </th>
  25 + <td> {{ form_widget(edit_form.manages) }} </td>
  26 + </tr>
  27 + <tr>
  28 + <th>IP roteador backbone: </th>
  29 + <td> {{ form_widget(edit_form.ipBackbone) }} </td>
  30 + </tr>
  31 + <tr>
  32 + <th> Community snmp do roteador backbone: </th>
  33 + <td> {{ form_widget(edit_form.communitySnmpBackbone) }} </td>
  34 + </tr>
  35 + <tr>
  36 + <th> Serial no roteador backbone: </th>
  37 + <td> {{ form_widget(edit_form.serialBackbone) }} </td>
  38 + </tr>
  39 + <tr>
  40 + <th> Tecnologia: </th>
  41 + <td> {{ form_widget(edit_form.technology) }} </th>
  42 + </tr>
  43 + <tr>
  44 + <th> Tipo da Interface: </th>
  45 + <td> {{ form_widget(edit_form.typeInterface) }} </td>
  46 + </tr>
  47 + <tr>
  48 + <th> Número SNMP da interface: </th>
  49 + <td> {{ form_widget(edit_form.numSnmpInterface) }} </td>
  50 + </tr>
  51 + <tr>
  52 + <th> IP da serial da Interface: </th>
  53 + <td> {{ form_widget(edit_form.ipSerialInterface) }} </td>
  54 + </tr>
  55 + <tr>
  56 + <th> Cadastro do circuito: </th>
  57 + <td> {{ form_widget(edit_form.registerCircuit) }} </td>
  58 + </tr>
  59 + <tr>
  60 + <th> Velocidade: </th>
  61 + <td> {{ form_widget(edit_form.speed) }} </td>
  62 + </tr>
  63 + <tr>
  64 + <th> CIR In: </th>
  65 + <td> {{ form_widget(edit_form.cirIn) }} </td>
  66 + </tr>
  67 + <tr>
  68 + <th> CIR Out: </th>
  69 + <td> {{ form_widget(edit_form.cirOut) }} </td>
  70 + </tr>
  71 + <tr>
  72 + <th> Serial no roteador da ponta: </th>
  73 + <td> {{ form_widget(edit_form.serialRouterTip) }} </td>
  74 + </tr>
  75 + <tr>
  76 + <th> Identificação SNMP da porta na ponta: </th>
  77 + <td> {{ form_widget(edit_form.snmpPortTip) }} </td>
  78 + </tr>
  79 + <tr>
  80 + <th> Community SNMP do roteador da ponta: </th>
  81 + <td> {{ form_widget(edit_form.communitySnmpRouterTip) }} </td>
  82 + </tr>
  83 + <tr>
  84 + <th> IP da serial do roteador da ponta: </th>
  85 + <td> {{ form_widget(edit_form.ipSerialRouterTip) }} </td>
  86 + </tr>
  87 + <tr>
  88 + <td colspan="2" align="center">
  89 + <button type="submit">Editar</button>
  90 + </td>
  91 + </tr>
  92 + </table>
  93 + {{ form_widget(edit_form._token) }}
  94 + </form>
  95 +
  96 + <ul class="record_actions">
  97 + <li>
  98 + <a href="{{ path('circuits') }}">
  99 + Lista de Circuitos
  100 + </a>
  101 + </li>
  102 + <li>
  103 + <form action="{{ path('circuits_delete', { 'id': entity.id }) }}" method="post">
  104 + <input type="hidden" name="_method" value="DELETE" />
  105 + {{ form_widget(delete_form) }}
  106 + <button type="submit">Deletar</button>
  107 + </form>
  108 + </li>
  109 +</ul>
  110 +{% endblock %}
... ...
Resources/views/Circuits/index.html.twig 0 → 100755
  1 +++ a/Resources/views/Circuits/index.html.twig
... ... @@ -0,0 +1,47 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h2>Circuitos cadastrados</h2>
  5 +
  6 + <table class="records_list">
  7 + <thead>
  8 + <tr>
  9 + <th>Id</th>
  10 + <th>Codeinterface</th>
  11 + <th>Description</th>
  12 + <th>Manages</th>
  13 + <th>Ipbackbone</th>
  14 + <th>Ações</th>
  15 + </tr>
  16 + </thead>
  17 + <tbody>
  18 + {% for entity in entities %}
  19 + <tr>
  20 + <td><a href="{{ path('circuits_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
  21 + <td>{{ entity.codeInterface }}</td>
  22 + <td>{{ entity.description }}</td>
  23 + <td>{{ entity.manages }}</td>
  24 + <td>{{ entity.ipBackbone }}</td>
  25 + <td>
  26 + <ul>
  27 + <li>
  28 + <a href="{{ path('circuits_show', { 'id': entity.id }) }}">Visualizar</a>
  29 + </li>
  30 + <li>
  31 + <a href="{{ path('circuits_edit', { 'id': entity.id }) }}">Editar</a>
  32 + </li>
  33 + </ul>
  34 + </td>
  35 + </tr>
  36 + {% endfor %}
  37 + </tbody>
  38 + </table>
  39 +
  40 + <ul>
  41 + <li>
  42 + <a href="{{ path('circuits_new') }}">
  43 + Cadastrar um novo circuito
  44 + </a>
  45 + </li>
  46 + </ul>
  47 + {% endblock %}
... ...
Resources/views/Circuits/new.html.twig 0 → 100755
  1 +++ a/Resources/views/Circuits/new.html.twig
... ... @@ -0,0 +1,118 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <style type="text/css">
  5 + body
  6 + {
  7 + scrollbar-face-color: #FFFFFF;
  8 + scrollbar-shadow-color: #c0c0c0;
  9 + scrollbar-highlight-color: #FFFFFF;
  10 + scrollbar-3dlight-color: #c0c0c0;
  11 + scrollbar-darkshadow-color: #FFFFFF;
  12 + scrollbar-track-color: #ffffff;
  13 + scrollbar-arrow-color: #c0c0c0;
  14 + font-family: Verdana, Arial;
  15 + font-size: 10pt;
  16 + }
  17 + </style>
  18 + <center><h3>Cadastro de Circuitos</h3></center>
  19 + <center>
  20 + <p>
  21 + Problemas ao cadastrar o circuito? Verifique a <a href="#help">tabela de configurações</a> ou faça o <a href="{{ path('cocar_snmpweb') }}">teste de snmp.</a>
  22 + </p>
  23 + <form action="{{ path('circuits_create') }}" method="post" {{ form_enctype(form) }}>
  24 + <table class="records_list" border=0 cellspacing=2 cellpadding=2>
  25 + <tr>
  26 + {{ form_errors(form) }}
  27 +
  28 + <th> Código da Interface: </th>
  29 + <td> {{ form_widget(form.codeInterface) }}</td>
  30 + </tr>
  31 + <tr>
  32 + <th> Descrição do circuito: </th>
  33 + <td> {{ form_widget(form.description) }} </td>
  34 + </tr>
  35 + <tr>
  36 + <th> Entidade: </th>
  37 + <td> {{ form_widget(form.entity) }} </td>
  38 + </tr>
  39 + <tr>
  40 + <th> Gerencia: </th>
  41 + <td> {{ form_widget(form.manages) }} </td>
  42 + </tr>
  43 + <tr>
  44 + <th>IP roteador backbone: </th>
  45 + <td> {{ form_widget(form.ipBackbone) }} </td>
  46 + </tr>
  47 + <tr>
  48 + <th> Community snmp do roteador backbone: </th>
  49 + <td> {{ form_widget(form.communitySnmpBackbone) }} </td>
  50 + </tr>
  51 + <tr>
  52 + <th> Serial no roteador backbone: </th>
  53 + <td> {{ form_widget(form.serialBackbone) }} </td>
  54 + </tr>
  55 + <tr>
  56 + <th> Tecnologia: </th>
  57 + <td> {{ form_widget(form.technology) }} </th>
  58 + </tr>
  59 + <tr>
  60 + <th> Tipo da Interface: </th>
  61 + <td> {{ form_widget(form.typeInterface) }} </td>
  62 + </tr>
  63 + <tr>
  64 + <th> Número SNMP da interface: </th>
  65 + <td> {{ form_widget(form.numSnmpInterface) }} </td>
  66 + </tr>
  67 + <tr>
  68 + <th> IP da serial da Interface: </th>
  69 + <td> {{ form_widget(form.ipSerialInterface) }} </td>
  70 + </tr>
  71 + <tr>
  72 + <th> Cadastro do circuito: </th>
  73 + <td> {{ form_widget(form.registerCircuit) }} </td>
  74 + </tr>
  75 + <tr>
  76 + <th> Velocidade: </th>
  77 + <td> {{ form_widget(form.speed) }} </td>
  78 + </tr>
  79 + <tr>
  80 + <th> CIR In: </th>
  81 + <td> {{ form_widget(form.cirIn) }} </td>
  82 + </tr>
  83 + <tr>
  84 + <th> CIR Out: </th>
  85 + <td> {{ form_widget(form.cirOut) }} </td>
  86 + </tr>
  87 + <tr>
  88 + <th> Serial no roteador da ponta: </th>
  89 + <td> {{ form_widget(form.serialRouterTip) }} </td>
  90 + </tr>
  91 + <tr>
  92 + <th> Identificação SNMP da porta na ponta: </th>
  93 + <td> {{ form_widget(form.snmpPortTip) }} </td>
  94 + </tr>
  95 + <tr>
  96 + <th> Community SNMP do roteador da ponta: </th>
  97 + <td> {{ form_widget(form.communitySnmpRouterTip) }} </td>
  98 + </tr>
  99 + <tr>
  100 + <th> IP da serial do roteador da ponta: </th>
  101 + <td> {{ form_widget(form.ipSerialRouterTip) }} </td>
  102 + </tr>
  103 + <tr>
  104 + <td colspan="2" align="center">
  105 + <button type="submit">Cadastrar</button>
  106 + </td>
  107 + </tr>
  108 + </table>
  109 + {{ form_widget(form._token) }}
  110 + </form>
  111 + {% image '@CocarBundle/Resources/public/images/help_circuit.jpg' %}
  112 + <div style="margin-top:60px">
  113 + <a id="help"><h2>Tabela de configurações</h2></a>
  114 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  115 + </div>
  116 + {% endimage %}
  117 + </center>
  118 +{% endblock %}
... ...
Resources/views/Circuits/show.html.twig 0 → 100755
  1 +++ a/Resources/views/Circuits/show.html.twig
... ... @@ -0,0 +1,106 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h1>Circuitos</h1>
  5 +
  6 + <table class="records_list">
  7 + <tbody>
  8 + <tr>
  9 + <th>Id</th>
  10 + <td>{{ entity.id }}</td>
  11 + </tr>
  12 + <tr>
  13 + <th>Código da Interface</th>
  14 + <td>{{ entity.codeInterface }}</td>
  15 + </tr>
  16 + <tr>
  17 + <th>Descrição do circuito</th>
  18 + <td>{{ entity.description }}</td>
  19 + </tr>
  20 + <tr>
  21 + <th>Gerencia</th>
  22 + <td>{{ entity.manages }}</td>
  23 + </tr>
  24 + <tr>
  25 + <th>IP roteador backbone</th>
  26 + <td>{{ entity.ipBackbone }}</td>
  27 + </tr>
  28 + <tr>
  29 + <th>Community snmp do roteador backbone</th>
  30 + <td>{{ entity.communitySnmpBackbone }}</td>
  31 + </tr>
  32 + <tr>
  33 + <th>Serial no roteador backbone</th>
  34 + <td>{{ entity.serialBackbone }}</td>
  35 + </tr>
  36 + <tr>
  37 + <th>Tecnologia</th>
  38 + <td>{{ entity.technology }}</td>
  39 + </tr>
  40 + <tr>
  41 + <th>Tipo da interface</th>
  42 + <td>{{ entity.typeInterface }}</td>
  43 + </tr>
  44 + <tr>
  45 + <th>Número SNMP da interface</th>
  46 + <td>{{ entity.numSnmpInterface }}</td>
  47 + </tr>
  48 + <tr>
  49 + <th>IP da serial da Interface</th>
  50 + <td>{{ entity.ipSerialInterface }}</td>
  51 + </tr>
  52 + <tr>
  53 + <th>Cadastro do circuito</th>
  54 + <td>{{ entity.registerCircuit }}</td>
  55 + </tr>
  56 + <tr>
  57 + <th>Velocidade</th>
  58 + <td>{{ entity.speed }}</td>
  59 + </tr>
  60 + <tr>
  61 + <th>CIR In</th>
  62 + <td>{{ entity.cirIn }}</td>
  63 + </tr>
  64 + <tr>
  65 + <th>CIR Out</th>
  66 + <td>{{ entity.cirOut }}</td>
  67 + </tr>
  68 + <tr>
  69 + <th>Serial no roteador da ponta</th>
  70 + <td>{{ entity.serialRouterTip }}</td>
  71 + </tr>
  72 + <tr>
  73 + <th>Identificação SNMP da porta na ponta</th>
  74 + <td>{{ entity.snmpPortTip }}</td>
  75 + </tr>
  76 + <tr>
  77 + <th>Community SNMP do roteador da ponta</th>
  78 + <td>{{ entity.communitySnmpRouterTip }}</td>
  79 + </tr>
  80 + <tr>
  81 + <th>IP da serial do roteador da ponta</th>
  82 + <td>{{ entity.ipSerialRouterTip }}</td>
  83 + </tr>
  84 + </tbody>
  85 + </table>
  86 +
  87 + <ul class="record_actions">
  88 + <li>
  89 + <a href="{{ path('circuits') }}">
  90 + Lista de circuitos
  91 + </a>
  92 + </li>
  93 + <li>
  94 + <a href="{{ path('circuits_edit', { 'id': entity.id }) }}">
  95 + Editar
  96 + </a>
  97 + </li>
  98 + <li>
  99 + <form action="{{ path('circuits_delete', { 'id': entity.id }) }}" method="post">
  100 + <input type="hidden" name="_method" value="DELETE" />
  101 + {{ form_widget(delete_form) }}
  102 + <button type="submit">Deletar</button>
  103 + </form>
  104 + </li>
  105 +</ul>
  106 +{% endblock %}
... ...
Resources/views/Default/index.html.twig 0 → 100755
  1 +++ a/Resources/views/Default/index.html.twig
... ... @@ -0,0 +1 @@
  1 +Hello!
... ...
Resources/views/Default/map.html.twig 0 → 100755
  1 +++ a/Resources/views/Default/map.html.twig
... ... @@ -0,0 +1,112 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block search %}
  4 + {% if search_result is defined %}
  5 + {% for result in search_result %}
  6 + <table width="150" border="0" cellspacing="0" cellpadding="0" style="margin-top: 5px">
  7 + <tbody>
  8 + <tr>
  9 + {% image '@CocarBundle/Resources/public/images/boxverde_e.gif' %}
  10 + <td width='1' align='right'><img border='0' src='{{ asset_url }}' width='5' height='25'></td>
  11 + {% endimage %}
  12 + </td>
  13 + {% image '@CocarBundle/Resources/public/images/boxverde_m.gif' %}
  14 + <td background='{{ asset_url }}' align='center' valign='middle' CLASS='thtt'>
  15 + <b>/{{ result.identifier }}</b>
  16 + </td>
  17 + {% endimage %}
  18 + {% image '@CocarBundle/Resources/public/images/boxverde_d.gif' %}
  19 + <td width='5'>
  20 + <img src='{{ asset_url }}' width='5' height='25'>
  21 + </td>
  22 + {% endimage %}
  23 + </tr>
  24 + </tbody>
  25 + </table>
  26 + <table width="150" border="0" cellspacing="0" cellpadding="4" class="laterais" bgcolor="#F3FAE9">
  27 + <tbody>
  28 + <tr>
  29 + <td>
  30 + <a href="{{ path('cocar_graph', {'id': result.id }) }}">
  31 + {{ result.description }}
  32 + </a><br>
  33 + </td>
  34 + </tr>
  35 + </tbody>
  36 + </table>
  37 + {% endfor %}
  38 + {% if search_result == null and search == true %}
  39 + <font size='1' face='Verdana, Arial, Helvetica, sans-serif' color="red">
  40 + <p>Nenhum resultado encontrado</p>
  41 + </font>
  42 + {% endif %}
  43 + {% endif %}
  44 +{% endblock %}
  45 +
  46 +{% block main %}
  47 + <table border="0" width="100%" cellspacing="4">
  48 + <tbody>
  49 + <tr>
  50 + <td height="26" align="center" valign="middle" class="topo" colspan="5">
  51 + Unidades que Apresentam Tráfego Alto
  52 + </td>
  53 + </tr>
  54 + <tr>
  55 + {% for ht in high_traffic %}
  56 + <td width="25%" height="26" align="center" valign="middle" class="rly">
  57 + <a href='graph/{{ ht.id }}'>{{ ht.description }}/{{ ht.entity }}</a>
  58 + </td>
  59 + {% endfor %}
  60 + </tr>
  61 + </tbody>
  62 + </table>
  63 + <table border="0" width="100%" cellspacing="4">
  64 + <tbody>
  65 + <tr>
  66 + <td height="26" align="center" valign="middle" class="topo" colspan="5">
  67 + Unidades que Não Apresentam Tráfego
  68 + </td>
  69 + </tr>
  70 + <tr>
  71 + {% for wt in without_traffic %}
  72 + <td width="25%" height="26" align="center" valign="middle" class="rly">
  73 + <a href='graph/{{ wt.id }}'>{{ wt.description }}/{{ wt.entity }}</a>
  74 + </td>
  75 + {% endfor %}
  76 + </tr>
  77 + </tbody>
  78 + </table>
  79 + <table border="0" width="100%" cellspacing="4">
  80 + <tbody>
  81 + <tr>
  82 + <td height="26" align="center" valign="middle" class="topo" colspan="5">
  83 + Unidades com Problemas de Confiabilidade
  84 + </td>
  85 + </tr>
  86 + <tr>
  87 + {% for rly in reliability %}
  88 + <td width="25%" height="26" align="center" valign="middle" class="rly">
  89 + <a href='graph/{{ rly.id }}'>{{ rly.description }}/{{ rly.entity }}</a>
  90 + </td>
  91 + {% endfor %}
  92 + </tr>
  93 + </tbody>
  94 + </table>
  95 +
  96 + <p align='center'>
  97 + <b>Total de Unidades com Alerta de Tráfego Irregular<FONT COLOR='#FF3300'> {{ (high_traffic|length + without_traffic|length) + reliability|length}} <FONT COLOR='#000000'>de</FONT> {{ total }}</FONT></b>
  98 + </p>
  99 +
  100 + <table width='490' cellspacing='2' cellpadding='2' ALIGN='center'>
  101 + <tr align='center' valign='middle'>
  102 + <td class='thd'>Tráfego Alto</TD>
  103 + <td CLASS='thd'>Tráfego Baixo</TD>
  104 + <td class='thd'>Confiabilidade</TD>
  105 + </tr>
  106 + <tr align='center' valign='middle'>
  107 + <td class='result'>{{ high_traffic|length }}</TD>
  108 + <td class='result'>{{ without_traffic|length }}</TD>
  109 + <td class='result'>{{ reliability|length }}</TD>
  110 + </tr>
  111 + </table>
  112 +{% endblock %}
0 113 \ No newline at end of file
... ...
Resources/views/Default/totalizer.html.twig 0 → 100755
  1 +++ a/Resources/views/Default/totalizer.html.twig
... ... @@ -0,0 +1,40 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main %}
  4 +
  5 + <p align='center'><B>Totaliza&ccedil;&atilde;o de Desempenho</B></p>
  6 +
  7 + <table width='550' cellspacing='2' cellpadding='1' CLASS='records_list' ALIGN="center">
  8 + <TR ALIGN='center' VALIGN='middle'>
  9 + <th width='130' HEIGHT="25">Organização</th>
  10 + <th width='110'>Tráfego Alto</th>
  11 + <th width='110'>Tráfego Baixo</th>
  12 + <th width='110'>Confiabilidade</th>
  13 + <th width='90'>Total</th>
  14 + </TR>
  15 + {% if circuits is defined %}
  16 + {% set total, t, high, without, rly = 0, 0, 0, 0, 0 %}
  17 + {% for key, cir in circuits %}
  18 + <TR ALIGN='center' VALIGN='middle'>
  19 + <TD ALIGN='left'>
  20 + <a href="{{ path('cocar_report', { 'id': key })}}">{{ cir.description }}</a>
  21 + </TD>
  22 + <TD>{{ cir.high }}</TD>
  23 + <TD>{{ cir.without }}</TD>
  24 + <TD>{{ cir.rly }}</TD>
  25 + <TD ALIGN='right'>{{ cir.totalCirc }}/{{ cir.total }}</TD>
  26 + </TR>
  27 + {% set total, t = total + cir.total, t + cir.totalCirc %}
  28 + {% set high, without, rly = high + cir.high, without + cir.without, rly + cir.rly %}
  29 + {% endfor %}
  30 + {% endif %}
  31 + <TR ALIGN='center' VALIGN='middle'>
  32 + <th>TOTAL</th>
  33 + <th>{{ high }}</th>
  34 + <th>{{ without }}</th>
  35 + <th>{{ rly }}</th>
  36 + <th ALIGN='right'>{{ t }}/{{ total }}</th>
  37 + </TR>
  38 + </table>
  39 +
  40 +{% endblock %}
0 41 \ No newline at end of file
... ...
Resources/views/Entity/edit.html.twig 0 → 100755
  1 +++ a/Resources/views/Entity/edit.html.twig
... ... @@ -0,0 +1,41 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h2>{{ entity.description }}</h2>
  5 +
  6 + <form action="{{ path('entity_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
  7 + <input type="hidden" name="_method" value="PUT" />
  8 + <table class="records_list" border=0 cellspacing=2 cellpadding=2>
  9 + <tr>
  10 + {{ form_errors(edit_form) }}
  11 + <th> Identificador: </th>
  12 + <td> {{ form_widget(edit_form.identifier) }} </td>
  13 + </tr>
  14 + <tr>
  15 + <th> Descrição da entidade: </th>
  16 + <td> {{ form_widget(edit_form.description) }} </td>
  17 + </tr>
  18 + <tr>
  19 + <td colspan="2" align="center">
  20 + <button type="submit">Editar</button>
  21 + </td>
  22 + </tr>
  23 + </table>
  24 + {{ form_rest(edit_form) }}
  25 + </form>
  26 +
  27 + <ul class="record_actions">
  28 + <li>
  29 + <a href="{{ path('entity') }}">
  30 + Voltar a lista
  31 + </a>
  32 + </li>
  33 + <li>
  34 + <form action="{{ path('entity_delete', { 'id': entity.id }) }}" method="post">
  35 + <input type="hidden" name="_method" value="DELETE" />
  36 + {{ form_widget(delete_form) }}
  37 + <button type="submit">Deletar</button>
  38 + </form>
  39 + </li>
  40 +</ul>
  41 +{% endblock %}
... ...
Resources/views/Entity/index.html.twig 0 → 100755
  1 +++ a/Resources/views/Entity/index.html.twig
... ... @@ -0,0 +1,43 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h2>Entidades cadastradas</h2>
  5 +
  6 + <table class="records_list">
  7 + <thead>
  8 + <tr>
  9 + <th>Id</th>
  10 + <th>Identificador</th>
  11 + <th>Descrição</th>
  12 + <th>Ações</th>
  13 + </tr>
  14 + </thead>
  15 + <tbody>
  16 + {% for entity in entities %}
  17 + <tr>
  18 + <td><a href="{{ path('entity_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
  19 + <td>{{ entity.identifier }}</td>
  20 + <td>{{ entity.description }}</td>
  21 + <td>
  22 + <ul>
  23 + <li>
  24 + <a href="{{ path('entity_show', { 'id': entity.id }) }}">Visualizar</a>
  25 + </li>
  26 + <li>
  27 + <a href="{{ path('entity_edit', { 'id': entity.id }) }}">Editar</a>
  28 + </li>
  29 + </ul>
  30 + </td>
  31 + </tr>
  32 + {% endfor %}
  33 + </tbody>
  34 + </table>
  35 +
  36 + <ul>
  37 + <li>
  38 + <a href="{{ path('entity_new') }}">
  39 + Cadastrar uma nova entidade
  40 + </a>
  41 + </li>
  42 + </ul>
  43 + {% endblock %}
... ...
Resources/views/Entity/new.html.twig 0 → 100755
  1 +++ a/Resources/views/Entity/new.html.twig
... ... @@ -0,0 +1,40 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <style type="text/css">
  5 + body
  6 + {
  7 + scrollbar-face-color: #FFFFFF;
  8 + scrollbar-shadow-color: #c0c0c0;
  9 + scrollbar-highlight-color: #FFFFFF;
  10 + scrollbar-3dlight-color: #c0c0c0;
  11 + scrollbar-darkshadow-color: #FFFFFF;
  12 + scrollbar-track-color: #ffffff;
  13 + scrollbar-arrow-color: #c0c0c0;
  14 + font-family: Verdana, Arial;
  15 + font-size: 10pt;
  16 + }
  17 + </style>
  18 + <center><h2>Cadastro de Entidades </h2></center>
  19 + <center>
  20 + <form action="{{ path('entity_create') }}" method="post" {{ form_enctype(form) }}>
  21 + <table class="records_list" border=0 cellspacing=2 cellpadding=2>
  22 + <tr>
  23 + {{ form_errors(form) }}
  24 + <th> Identificador: </th>
  25 + <td> {{ form_widget(form.identifier) }} </td>
  26 + </tr>
  27 + <tr>
  28 + <th> Descrição da entidade: </th>
  29 + <td> {{ form_widget(form.description) }} </td>
  30 + </tr>
  31 + <tr>
  32 + <td colspan="2" align="center">
  33 + <button type="submit">Cadastrar</button>
  34 + </td>
  35 + </tr>
  36 + </table>
  37 + {{ form_rest(form) }}
  38 + </form>
  39 + </center>
  40 +{% endblock %}
... ...
Resources/views/Entity/show.html.twig 0 → 100755
  1 +++ a/Resources/views/Entity/show.html.twig
... ... @@ -0,0 +1,42 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main -%}
  4 + <h2>Entidade</h2>
  5 +
  6 + <table class="records_list">
  7 + <tbody>
  8 + <tr>
  9 + <th>Id</th>
  10 + <td>{{ entity.id }}</td>
  11 + </tr>
  12 + <tr>
  13 + <th>Identificador</th>
  14 + <td>{{ entity.identifier }}</td>
  15 + </tr>
  16 + <tr>
  17 + <th>Descrição</th>
  18 + <td>{{ entity.description }}</td>
  19 + </tr>
  20 + </tbody>
  21 + </table>
  22 +
  23 + <ul class="record_actions">
  24 + <li>
  25 + <a href="{{ path('entity') }}">
  26 + Lista de entidade
  27 + </a>
  28 + </li>
  29 + <li>
  30 + <a href="{{ path('entity_edit', { 'id': entity.id }) }}">
  31 + Editar
  32 + </a>
  33 + </li>
  34 + <li>
  35 + <form action="{{ path('entity_delete', { 'id': entity.id }) }}" method="post">
  36 + <input type="hidden" name="_method" value="DELETE" />
  37 + {{ form_widget(delete_form) }}
  38 + <button type="submit">Deletar</button>
  39 + </form>
  40 + </li>
  41 +</ul>
  42 +{% endblock %}
... ...
Resources/views/Graph/graph.html.twig 0 → 100755
  1 +++ a/Resources/views/Graph/graph.html.twig
... ... @@ -0,0 +1,58 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main %}
  4 + <table width="100%" border="0" cellspacing="0" cellpadding="0">
  5 + <tbody>
  6 + <tr height="28" class="acessos">
  7 + <td valign="middle" align="center" width="50">
  8 + <a href="telnet://{{ circuit.ipBackbone }}" title="TELNET">
  9 + {% image '@CocarBundle/Resources/public/images/telnet.gif' %}
  10 + <img src="{{ asset_url }}" align="middle" border="0">
  11 + {% endimage %}
  12 + </a>
  13 + </td>
  14 + <td valign="middle" class="tht">
  15 + <font color="#0000FF">{{ circuit.entity.description|upper }}</font>: {{ circuit.description }} - ({{ circuit.ipBackbone }}) Nº {{ circuit.registerCircuit }}
  16 + </td>
  17 + </tr>
  18 + </tbody>
  19 + </table>
  20 + <table width="100%" border="0" cellspacing="0" cellpadding="2">
  21 + <tbody>
  22 + <tr height="28" class="info">
  23 + <td><b>wlan0</b></td>
  24 + <td><b>Porta: 1024 KB</b></td>
  25 + <td><b>Cir In: 512 KB</b></td>
  26 + <td><b>Cir Out: 512 KB</b></td>
  27 + </tr>
  28 + <tr></tr>
  29 + </tbody>
  30 + </table>
  31 + <table border="0" width="100%" cellspacing="4">
  32 + <tbody>
  33 + <tr>
  34 + <td height="26" align="center" valign="middle" class="topo" colspan="5">
  35 + <form action="{{ path('cocar_graphshow', { 'id': circuit.id }) }}" method="get" {{ form_enctype(form) }}>
  36 + {{ form_errors(form) }}
  37 + {{ form_widget(form.choice) }}
  38 + <div id="form_choice">
  39 + {{ form_widget(form.period) }}
  40 + </div>
  41 + {{ form_widget(form.send) }}
  42 + {{ form_rest(form) }}
  43 + </form>
  44 + </td>
  45 + </tr>
  46 + </tbody>
  47 + </table>
  48 + {% if img is defined %}
  49 + <div align="center" style="margin-top:40px">
  50 + {% for image in img %}
  51 + <img src="{{ asset('rrd/graficos/') }}{{ image }}"><p>
  52 + {% endfor %}
  53 + </div>
  54 + <div align="center">
  55 + {{ knp_pagination_render(img, "CocarBundle::pagination.html.twig") }}
  56 + </div>
  57 + {% endif %}
  58 +{% endblock %}
0 59 \ No newline at end of file
... ...
Resources/views/Graph/graphDailyPerfom.html.twig 0 → 100755
  1 +++ a/Resources/views/Graph/graphDailyPerfom.html.twig
... ... @@ -0,0 +1,11 @@
  1 +{% extends '::base.html.twig' %}
  2 +
  3 +{% block body -%}
  4 + <TABLE BORDER='0' WIDTH='100%' ALIGN='center' >
  5 + <TR>
  6 + <TD ALIGN='center' VALIGN='middle'>
  7 + <img src="{{ asset('rrd/graficos/') }}{{ img }}">
  8 + </TD>
  9 + </TR>
  10 + </TABLE>
  11 +{% endblock %}
0 12 \ No newline at end of file
... ...
Resources/views/Graph/graphTraffic.html.twig 0 → 100755
  1 +++ a/Resources/views/Graph/graphTraffic.html.twig
... ... @@ -0,0 +1,11 @@
  1 +{% extends '::base.html.twig' %}
  2 +
  3 +{% block body -%}
  4 + <TABLE BORDER='0' WIDTH='100%' ALIGN='center' >
  5 + <TR>
  6 + <TD ALIGN='center' VALIGN='middle'>
  7 + <img src="{{ asset('rrd/graficos/') }}{{ img }}">
  8 + </TD>
  9 + </TR>
  10 + </TABLE>
  11 +{% endblock %}
0 12 \ No newline at end of file
... ...
Resources/views/Graph/report.html.twig 0 → 100755
  1 +++ a/Resources/views/Graph/report.html.twig
... ... @@ -0,0 +1,80 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main %}
  4 +
  5 + <DIV ALIGN="left" style="margin-top:20px">
  6 + <FONT FACE="Verdana" SIZE="" COLOR="#004000">
  7 + <B>Rede de Acesso - Performance dos Circuitos</B>
  8 + </FONT>
  9 + </DIV>
  10 +
  11 + <table border="0" width="100%" cellpadding="5" CLASS="tdi" BGCOLOR="#FFCC99">
  12 + <TR>
  13 + <TD>
  14 + <a title='Clique para Concentradoras com alto Tráfego! ' href="">
  15 + {% image '@CocarBundle/Resources/public/images/high.jpg' %}
  16 + <img border="0" src="{{ asset_url }}"></a>
  17 + {% endimage %}
  18 + </a>
  19 + </TD>
  20 + <TD>
  21 + {% if circuit != null %}
  22 + <form action="{{ path('cocar_reportshow') }}" method="post" {{ form_enctype(form) }}>
  23 + {{ form_errors(form) }}
  24 + <select size='1' name='circuit' style="font-family: Verdana; font-size: 11px; background-color: #FAF8EB;">
  25 + {% for cir in circuit %}
  26 + <option selected value='{{ cir.id }}'>{{ cir.description }}</option>
  27 + {% endfor %}
  28 + </select>
  29 + <div id="form_choice">
  30 + {{ form_widget(form.type, {'attr': {'style': 'font-family: Verdana; font-size: 11px; background-color: #FAF8EB;'}}) }}
  31 + </div>
  32 + {{ form_widget(form.entity) }}
  33 + {{ form_widget(form.send) }}
  34 + {{ form_rest(form) }}
  35 + </form>
  36 + {% else %}
  37 + <h2>Atenção: Nenhum circuito encontrado!</h2>
  38 + {% endif %}
  39 + </TD>
  40 + {% if img is defined %}
  41 + <TD VALIGN='middle' ALIGN='center' WIDTH='50'><a href='' title=' Clique para verificar Tráfego! ' target='_blank'>
  42 + {% image '@CocarBundle/Resources/public/images/traf.jpg' %}
  43 + <img border="0" align="right" src="{{ asset_url }}" width='24' height='24'></a>
  44 + {% endimage %}
  45 + </a>
  46 + {% endif %}
  47 + </TABLE>
  48 + {% if img is defined %}
  49 + <TABLE border="0" WIDTH="100%" cellspacing="0" CLASS="texto">
  50 + <TR ALIGN="center" VALIGN="middle" BGCOLOR="#FFCC99">
  51 + <TD align="center">
  52 + {% if type is defined %}
  53 + <b><FONT size="4">{{ type }}</FONT></b></TD>
  54 + {% endif %}
  55 + <TD ALIGN="right">
  56 + <a title=' Clique para Tabela referente ao gráfico! ' href="">
  57 + {% image '@CocarBundle/Resources/public/images/help1.gif' %}
  58 + <img border="0" align="right" src="{{ asset_url }}" width='24' height='24'></a>
  59 + {% endimage %}
  60 + </a>
  61 + <a title=' Clique para Tabela referente ao gráfico! ' href="">
  62 + {% image '@CocarBundle/Resources/public/images/tabela.jpg' %}
  63 + <img border="0" align="right" src="{{ asset_url }}" width='24' height='24'></a>
  64 + {% endimage %}
  65 + </a>
  66 + </TD>
  67 + </TR>
  68 + <TR>
  69 + <TD COLSPAN="4"></TD>
  70 + </TR>
  71 + <TR ALIGN="left">
  72 + {% for image in img %}
  73 + <TD WIDTH="50%">
  74 + <img src="{{ asset('rrd/graficos/') }}{{ image }}" width="550px">
  75 + </TD>
  76 + {% endfor %}
  77 + </TR>
  78 + </TABLE>
  79 + {% endif %}
  80 +{% endblock %}
0 81 \ No newline at end of file
... ...
Resources/views/SnmpWeb/snmp.html.twig 0 → 100755
  1 +++ a/Resources/views/SnmpWeb/snmp.html.twig
... ... @@ -0,0 +1,29 @@
  1 +{% extends 'CocarBundle::layout.html.twig' %}
  2 +
  3 +{% block main %}
  4 + <table border="0" width="100%" cellspacing="4" class="topo">
  5 + <tbody>
  6 + <tr>
  7 + <td height="26" align="center" valign="middle" colspan="5">
  8 + <h2>Teste SNMP</h2>
  9 + </td>
  10 + </tr>
  11 + <tr>
  12 + <td height="26" align="center" valign="middle" colspan="5">
  13 + <form action="{{ path('cocar_infosnmp') }}" method="post" {{ form_enctype(form) }}>
  14 + {{ form_errors(form) }}
  15 + Host: {{ form_widget(form.host) }}
  16 + Community: {{ form_widget(form.community) }}
  17 + {{ form_widget(form.send) }}
  18 + {{ form_rest(form) }}
  19 + </form>
  20 + </td>
  21 + </tr>
  22 + <tr>
  23 + <td height="56" align="center" valign="middle" colspan="5">
  24 + <font size="1">Ex.: [HOST = 127.0.0.1 / COMMUNITY = public]</font>
  25 + </td>
  26 + </tr>
  27 + </tbody>
  28 + </table>
  29 +{% endblock %}
0 30 \ No newline at end of file
... ...
Resources/views/base.html.twig 0 → 100755
  1 +++ a/Resources/views/base.html.twig
... ... @@ -0,0 +1,11 @@
  1 +{% extends '::base.html.twig' %}
  2 +
  3 +{% block title 'Cocar' %}
  4 +
  5 +{% block stylesheets %}
  6 + {% stylesheets filter='cssrewrite'
  7 + 'bundles/cocar/css/*'
  8 + %}
  9 + <link rel="stylesheet" href="{{ asset_url }}" />
  10 + {% endstylesheets %}
  11 +{% endblock %}
0 12 \ No newline at end of file
... ...
Resources/views/layout.html.twig 0 → 100755
  1 +++ a/Resources/views/layout.html.twig
... ... @@ -0,0 +1,127 @@
  1 +{% extends 'CocarBundle::base.html.twig' %}
  2 +
  3 +{% block body -%}
  4 + <table border="0" width="100%" bgcolor="#CCCC99" cellspacing="0" cellpadding="0">
  5 + <tr>
  6 + <td width="350" CLASS="sys"><b><i>COCAR: Controlador Centralizado do Ambiente de Rede</i></b></td>
  7 + <td align="right" height="22" width="30%">
  8 + <b><font face="Verdana" color='#000000' size="1">
  9 + <script>
  10 + var now = new Date();
  11 + var mName = new Array("Janeiro", "Fevereiro", "Mar&ccedil;§o", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro");
  12 + var dName = new Array("Domingo", "Segunda-feira", "Ter&ccedil;a-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "S&aacute;bado");
  13 + var dayNr = now.getDate();
  14 + var Mes = now.getMonth() + 1;
  15 + var yearNr = now.getYear();
  16 + var H = now.getHours();
  17 + var M= now.getMinutes();
  18 + var S= now.getSeconds();
  19 +
  20 + if (dayNr < 10) { dayNr = "0" + dayNr }
  21 + if (Mes < 10) { Mes = "0" + Mes }
  22 + if (H < 10) { H = "0" + H }
  23 + if (M < 10) { M = "0" + M }
  24 + if (yearNr < 2000) { yearNr = 1900 + yearNr }
  25 +
  26 + document.write( dName[now.getDay()] + ", " + dayNr + "/" + Mes + "/"+ yearNr + " " + H + ":" + M )
  27 +
  28 + function showHideLayers(id, desc, action) {
  29 + if(action == 'show')
  30 + document.getElementById(id).innerHTML = desc;
  31 + else
  32 + document.getElementById(id).innerHTML = "";
  33 + }
  34 + </script>
  35 + </font></b>
  36 + </td>
  37 + <td align="right" height="22" width="20%">
  38 + <div id="descricao" class="desc"> </div>
  39 + </td>
  40 + <td align="right" class="menu">
  41 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  42 + <a HREF="{{ path('cocar_map') }}" target="_top" onmouseover="showHideLayers('descricao','Página Inicial','show')" onmouseout="showHideLayers('descricao','','hide')">
  43 + {% image '@CocarBundle/Resources/public/images/home.gif' %}
  44 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  45 + {% endimage %}
  46 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  47 + <a href="{{ path('entity') }}" onmouseover="showHideLayers('descricao','Entidades','show')" onmouseout="showHideLayers('descricao','','hide')">
  48 + {% image '@CocarBundle/Resources/public/images/entity.png' %}
  49 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  50 + {% endimage %}
  51 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  52 + <a href="{{ path('circuits') }}" onmouseover="showHideLayers('descricao','Circuitos','show')" onmouseout="showHideLayers('descricao','','hide')">
  53 + {% image '@CocarBundle/Resources/public/images/circuit.png' %}
  54 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  55 + {% endimage %}
  56 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  57 + <a href="{{ path('cocar_totalizer') }}" onmouseover="showHideLayers('descricao','Relatórios','show')" onmouseout="showHideLayers('descricao','','hide')">
  58 + {% image '@CocarBundle/Resources/public/images/rel.png' %}
  59 + <img border="0" src="{{ asset_url }}" align="middle" width="22"></a>
  60 + {% endimage %}
  61 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  62 + <a href="javascript:contatos();" OnClick="javascript:contatos();" onmouseover="showHideLayers('descricao','Contato','show')" onmouseout="showHideLayers('descricao','','hide')">
  63 + {% image '@CocarBundle/Resources/public/images/contatos.gif' %}
  64 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  65 + {% endimage %}
  66 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  67 + <a href="manual/cocar.pdf" onmouseover="showHideLayers('descricao','Manual','show')" onmouseout="showHideLayers('descricao','','hide')">
  68 + {% image '@CocarBundle/Resources/public/images/ajuda.gif' %}
  69 + <img border="0" src="{{ asset_url }}" align="middle"></a>
  70 + {% endimage %}
  71 + <B><font face="Verdana" color=#ffffff size="2"> | </font><B>
  72 + </td>
  73 + </tr>
  74 + </table>
  75 + <div class="box">
  76 + <table width='150' border='0' cellspacing='0' cellpadding='0'>
  77 + <tr>
  78 + {% image '@CocarBundle/Resources/public/images/boxverde_e.gif' %}
  79 + <td width='1' align='right'><img border='0' src='{{ asset_url }}' width='5' height='25'></td>
  80 + {% endimage %}
  81 + {% image '@CocarBundle/Resources/public/images/boxverde_m.gif' %}
  82 + <td background='{{ asset_url }}' align='center' valign='middle' CLASS='thtt'><b>Buscar</b></td>
  83 + {% endimage %}
  84 + {% image '@CocarBundle/Resources/public/images/boxverde_d.gif' %}
  85 + <td width='5'><img src='{{ asset_url }}' width='5' height='25'></td>
  86 + {% endimage %}
  87 + </tr>
  88 + </table>
  89 +
  90 + <table width='150' border='0' cellspacing='0' cellpadding='6' CLASS='laterais' bgcolor='#F3FAE9'>
  91 + <TR>
  92 + <TD>
  93 + <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  94 + <form name='search' method='post' action='{{ path('cocar_map') }}'>
  95 + <tr>
  96 + <td ALIGN='center'>
  97 + <input name='circuit' type='text' class='caixa' MAXLENGTH='22' VALUE="Buscar por circuito" onfocus="this.value='';">
  98 + </td>
  99 + <td align='left' margin-left=20px>
  100 + {% image '@CocarBundle/Resources/public/images/bt_ok.gif' %}
  101 + <input type='image' src='{{ asset_url }}' onClick='' style='cursor:hand;margin-left:5px'>
  102 + {% endimage %}
  103 + </td>
  104 + </tr>
  105 + </form>
  106 + </table>
  107 + </td>
  108 + </tr>
  109 + </table>
  110 + {% block search %}{% endblock %}
  111 +
  112 + <table width='140' border='0' cellspacing='0' cellpadding='0'>
  113 + <tr>
  114 + <td align='center' valign='middle'>
  115 + <p align='center'>
  116 + <font size='2' face='Verdana, Arial, Helvetica, sans-serif'>
  117 + <B>Digite o Nome da Unidade desejada.</B>
  118 + </font>
  119 + </p>
  120 + </td>
  121 + </tr>
  122 + </table>
  123 + </div>
  124 + <div class="main">
  125 + {% block main %}{% endblock %}
  126 + </div>
  127 +{% endblock %}
0 128 \ No newline at end of file
... ...
Resources/views/pagination.html.twig 0 → 100755
  1 +++ a/Resources/views/pagination.html.twig
... ... @@ -0,0 +1,68 @@
  1 + {% if pageCount > 1 %}
  2 + <ul class="tsc_pagination tsc_paginationB tsc_paginationB09">
  3 +
  4 + {% if previous is defined %}
  5 + <li>
  6 + <a href="{{ path(route, query|merge({(pageParameterName): previous})) }}">&laquo;&nbsp;{{ 'Anterior' }}</a>
  7 + </li>
  8 + {% else %}
  9 + <li>
  10 + <a href="#"> &laquo;&nbsp;{{ 'Anterior' }}</a>
  11 + </li>
  12 + {% endif %}
  13 +
  14 + {% if startPage > 1 %}
  15 + <li>
  16 + <a href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  17 + </li>
  18 + {% if startPage == 3 %}
  19 + <li>
  20 + <a href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  21 + </li>
  22 + {% elseif startPage != 2 %}
  23 + <li class="disabled">
  24 + &hellip;
  25 + </li>
  26 + {% endif %}
  27 + {% endif %}
  28 + {% for page in pagesInRange %}
  29 + {% if page != current %}
  30 + <li>
  31 + <a href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
  32 + </li>
  33 + {% else %}
  34 + <li>
  35 + <a href="#" class="current">{{ page }}</a>
  36 + </li>
  37 + {% endif %}
  38 +
  39 + {% endfor %}
  40 +
  41 + {% if pageCount > endPage %}
  42 + {% if pageCount > (endPage + 1) %}
  43 + {% if pageCount > (endPage + 2) %}
  44 + <li class="disabled">
  45 + &hellip;
  46 + </li>
  47 + {% else %}
  48 + <li>
  49 + <a href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  50 + </li>
  51 + {% endif %}
  52 + {% endif %}
  53 + <li>
  54 + <a href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  55 + </li>
  56 + {% endif %}
  57 +
  58 + {% if next is defined %}
  59 + <li>
  60 + <a href="{{ path(route, query|merge({(pageParameterName): next})) }}">{{ 'Próximo' }}&nbsp;&raquo;</a>
  61 + </li>
  62 + {% else %}
  63 + <li>
  64 + <a href="#">{{ 'Próximo' }}&nbsp;&raquo;</a>
  65 + </li>
  66 + {% endif %}
  67 + </ul>
  68 +{% endif %}
0 69 \ No newline at end of file
... ...
Tests/Controller/CircuitsControllerTest.php 0 → 100755
  1 +++ a/Tests/Controller/CircuitsControllerTest.php
... ... @@ -0,0 +1,55 @@
  1 +<?php
  2 +
  3 +namespace Cocar\CocarBundle\Tests\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  6 +
  7 +class CircuitsControllerTest extends WebTestCase
  8 +{
  9 + /*
  10 + public function testCompleteScenario()
  11 + {
  12 + // Create a new client to browse the application
  13 + $client = static::createClient();
  14 +
  15 + // Create a new entry in the database
  16 + $crawler = $client->request('GET', '/circuits/');
  17 + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /circuits/");
  18 + $crawler = $client->click($crawler->selectLink('Create a new entry')->link());
  19 +
  20 + // Fill in the form and submit it
  21 + $form = $crawler->selectButton('Create')->form(array(
  22 + 'cocar_cocarbundle_circuitstype[field_name]' => 'Test',
  23 + // ... other fields to fill
  24 + ));
  25 +
  26 + $client->submit($form);
  27 + $crawler = $client->followRedirect();
  28 +
  29 + // Check data in the show view
  30 + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
  31 +
  32 + // Edit the entity
  33 + $crawler = $client->click($crawler->selectLink('Edit')->link());
  34 +
  35 + $form = $crawler->selectButton('Edit')->form(array(
  36 + 'cocar_cocarbundle_circuitstype[field_name]' => 'Foo',
  37 + // ... other fields to fill
  38 + ));
  39 +
  40 + $client->submit($form);
  41 + $crawler = $client->followRedirect();
  42 +
  43 + // Check the element contains an attribute with value equals "Foo"
  44 + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
  45 +
  46 + // Delete the entity
  47 + $client->submit($crawler->selectButton('Delete')->form());
  48 + $crawler = $client->followRedirect();
  49 +
  50 + // Check the entity has been delete on the list
  51 + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
  52 + }
  53 +
  54 + */
  55 +}
... ...
Tests/Controller/DefaultControllerTest.php 0 → 100755
  1 +++ a/Tests/Controller/DefaultControllerTest.php
... ... @@ -0,0 +1,17 @@
  1 +<?php
  2 +
  3 +namespace Cocar\CocarBundle\Tests\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  6 +
  7 +class DefaultControllerTest extends WebTestCase
  8 +{
  9 + public function testIndex()
  10 + {
  11 + $client = static::createClient();
  12 +
  13 + $crawler = $client->request('GET', '/hello/Fabien');
  14 +
  15 + $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
  16 + }
  17 +}
... ...
Tests/Controller/EntityControllerTest.php 0 → 100755
  1 +++ a/Tests/Controller/EntityControllerTest.php
... ... @@ -0,0 +1,55 @@
  1 +<?php
  2 +
  3 +namespace Cocar\CocarBundle\Tests\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  6 +
  7 +class EntityControllerTest extends WebTestCase
  8 +{
  9 + /*
  10 + public function testCompleteScenario()
  11 + {
  12 + // Create a new client to browse the application
  13 + $client = static::createClient();
  14 +
  15 + // Create a new entry in the database
  16 + $crawler = $client->request('GET', '/entity/');
  17 + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /entity/");
  18 + $crawler = $client->click($crawler->selectLink('Create a new entry')->link());
  19 +
  20 + // Fill in the form and submit it
  21 + $form = $crawler->selectButton('Create')->form(array(
  22 + 'cocar_cocarbundle_entitytype[field_name]' => 'Test',
  23 + // ... other fields to fill
  24 + ));
  25 +
  26 + $client->submit($form);
  27 + $crawler = $client->followRedirect();
  28 +
  29 + // Check data in the show view
  30 + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
  31 +
  32 + // Edit the entity
  33 + $crawler = $client->click($crawler->selectLink('Edit')->link());
  34 +
  35 + $form = $crawler->selectButton('Edit')->form(array(
  36 + 'cocar_cocarbundle_entitytype[field_name]' => 'Foo',
  37 + // ... other fields to fill
  38 + ));
  39 +
  40 + $client->submit($form);
  41 + $crawler = $client->followRedirect();
  42 +
  43 + // Check the element contains an attribute with value equals "Foo"
  44 + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
  45 +
  46 + // Delete the entity
  47 + $client->submit($crawler->selectButton('Delete')->form());
  48 + $crawler = $client->followRedirect();
  49 +
  50 + // Check the entity has been delete on the list
  51 + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
  52 + }
  53 +
  54 + */
  55 +}
... ...
UPGRADE-2.2.md 0 → 100755
  1 +++ a/UPGRADE-2.2.md
... ... @@ -0,0 +1,30 @@
  1 +UPGRADE FROM 2.1 to 2.2
  2 +=======================
  3 +
  4 + * The [`web/.htaccess`](https://github.com/symfony/symfony-standard/blob/2.2/web/.htaccess)
  5 + file has been enhanced substantially to prevent duplicate content with and
  6 + without `/app.php` in the URI. It also improves functionality when using
  7 + Apache aliases or when mod_rewrite is not available. So you might want to
  8 + update your `.htaccess` file as well.
  9 +
  10 + * The ``_internal`` route is not used any more. It should then be removed
  11 + from both your routing and security configurations. A ``fragments`` key has
  12 + been added to the framework configuration and must be specified when ESI or
  13 + Hinclude are in use. No security configuration is required for this path as
  14 + by default ESI access is only permitted for trusted hosts and Hinclude
  15 + access uses an URL signing mechanism.
  16 +
  17 + ```
  18 + framework:
  19 + # ...
  20 + fragments: { path: /_proxy }
  21 + ```
  22 +
  23 +Functional Tests
  24 +----------------
  25 +
  26 + * The profiler has been disabled by default in the test environment. You can
  27 + enable it again by modifying the ``config_test.yml`` configuration file or
  28 + even better, you can just enable it for the very next request by calling
  29 + ``$client->enableProfiler()`` when you need the profiler in a test (that
  30 + speeds up functional tests quite a bit).
... ...
UPGRADE-2.3.md 0 → 100755
  1 +++ a/UPGRADE-2.3.md
... ... @@ -0,0 +1,52 @@
  1 +UPGRADE FROM 2.2 to 2.3
  2 +=======================
  3 +
  4 +When upgrading Symfony from 2.2 to 2.3, you need to do the following changes
  5 +to the code that came from the Standard Edition:
  6 +
  7 + * The debugging tools are not enabled by default anymore and should be added
  8 + to the
  9 + [`web/app_dev.php`](https://github.com/symfony/symfony-standard/blob/2.3/web/app_dev.php)
  10 + front controller manually, just after including the bootstrap cache:
  11 +
  12 + use Symfony\Component\Debug\Debug;
  13 +
  14 + Debug::enable();
  15 +
  16 + You also need to enable debugging in the
  17 + [`app/console`](https://github.com/symfony/symfony-standard/blob/2.3/app/console)
  18 + script, after the `$debug` variable is defined:
  19 +
  20 + use Symfony\Component\Debug\Debug;
  21 +
  22 + if ($debug) {
  23 + Debug::enable();
  24 + }
  25 +
  26 + * The `parameters.yml` file can now be managed by the
  27 + `incenteev/composer-parameter-handler` bundle that comes with the 2.3
  28 + Standard Edition:
  29 +
  30 + * add `"incenteev/composer-parameter-handler": "~2.0"` to your
  31 + `composer.json` file;
  32 +
  33 + * add `/app/config/parameters.yml` to your `.gitignore` file;
  34 +
  35 + * create a
  36 + [`app/config/parameters.yml.dist`](https://github.com/symfony/symfony-standard/blob/2.3/app/config/parameters.yml.dist)
  37 + file with sensible values for all your parameters.
  38 +
  39 + * It is highly recommended that you switch the minimum stability to `stable`
  40 + in your `composer.json` file.
  41 +
  42 + * If you are using Apache, have a look at the new
  43 + [`.htaccess`](https://github.com/symfony/symfony-standard/blob/2.3/web/.htaccess)
  44 + configuration and change yours accordingly.
  45 +
  46 + * In the
  47 + [`app/autoload.php`](https://github.com/symfony/symfony-standard/blob/2.3/app/autoload.php)
  48 + file, the section about `intl` should be removed as it is not needed anymore.
  49 +
  50 +You can also have a look at the
  51 +[diff](https://github.com/symfony/symfony-standard/compare/v2.2.0%E2%80%A62.3)
  52 +between the 2.2 version of the Standard Edition and the 2.3 version.
... ...
UPGRADE.md 0 → 100755
  1 +++ a/UPGRADE.md
... ... @@ -0,0 +1,268 @@
  1 +Symfony Standard Edition Upgrade
  2 +================================
  3 +
  4 +From Symfony 2.0 to Symfony 2.1
  5 +-------------------------------
  6 +
  7 +### Project Dependencies
  8 +
  9 +As of Symfony 2.1, project dependencies are managed by
  10 +[Composer](http://getcomposer.org/):
  11 +
  12 +* The `bin/vendors` script can be removed as `composer.phar` does all the work
  13 + now (it is recommended to install it globally on your machine).
  14 +
  15 +* The `deps` file need to be replaced with the `composer.json` one.
  16 +
  17 +* The `composer.lock` is the equivalent of the generated `deps.lock` file and
  18 + it is automatically generated by Composer.
  19 +
  20 +Download the default
  21 +[`composer.json`](https://raw.github.com/symfony/symfony-standard/2.1/composer.json)
  22 +and
  23 +[`composer.lock`](https://raw.github.com/symfony/symfony-standard/2.1/composer.lock)
  24 +files for Symfony 2.1 and put them into the main directory of your project. If
  25 +you have customized your `deps` file, move the added dependencies to the
  26 +`composer.json` file (many bundles and PHP libraries are already available as
  27 +Composer packages -- search for them on [Packagist](http://packagist.org/)).
  28 +
  29 +Remove your current `vendor` directory.
  30 +
  31 +Finally, run Composer:
  32 +
  33 + $ composer.phar install
  34 +
  35 +Note: You must complete the upgrade steps below so composer can successfully generate the autoload files.
  36 +
  37 +### `app/autoload.php`
  38 +
  39 +The default `autoload.php` reads as follows (it has been simplified a lot as
  40 +autoloading for libraries and bundles declared in your `composer.json` file is
  41 +automatically managed by the Composer autoloader):
  42 +
  43 + <?php
  44 +
  45 + use Doctrine\Common\Annotations\AnnotationRegistry;
  46 +
  47 + $loader = include __DIR__.'/../vendor/autoload.php';
  48 +
  49 + // intl
  50 + if (!function_exists('intl_get_error_code')) {
  51 + require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
  52 +
  53 + $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
  54 + }
  55 +
  56 + AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  57 +
  58 + return $loader;
  59 +
  60 +### `app/config/config.yml`
  61 +
  62 +The `framework.charset` setting must be removed. If you are not using `UTF-8`
  63 +for your application, override the `getCharset()` method in your `AppKernel`
  64 +class instead:
  65 +
  66 + class AppKernel extends Kernel
  67 + {
  68 + public function getCharset()
  69 + {
  70 + return 'ISO-8859-1';
  71 + }
  72 +
  73 + // ...
  74 + }
  75 +
  76 +You might want to add the new `strict_requirements` parameter to
  77 +`framework.router` (it avoids fatal errors in the production environment when
  78 +a link cannot be generated):
  79 +
  80 + framework:
  81 + router:
  82 + strict_requirements: %kernel.debug%
  83 +
  84 +You can even disable the requirements check on production with `null` as you should
  85 +know that the parameters for URL generation always pass the requirements, e.g. by
  86 +validating them beforehand. This additionally enhances performance. See
  87 +[config_prod.yml](https://github.com/symfony/symfony-standard/blob/master/app/config/config_prod.yml).
  88 +
  89 +The `default_locale` parameter is now a setting of the main `framework`
  90 +configuration (it was under the `framework.session` in 2.0):
  91 +
  92 + framework:
  93 + default_locale: %locale%
  94 +
  95 +The `auto_start` setting under `framework.session` must be removed as it is
  96 +not used anymore (the session is now always started on-demand). If
  97 +`auto_start` was the only setting under the `framework.session` entry, don't
  98 +remove it entirely, but set its value to `~` (`~` means `null` in YAML)
  99 +instead:
  100 +
  101 + framework:
  102 + session: ~
  103 +
  104 +The `trust_proxy_headers` setting was added in the default configuration file
  105 +(as it should be set to `true` when you install your application behind a
  106 +reverse proxy):
  107 +
  108 + framework:
  109 + trust_proxy_headers: false
  110 +
  111 +An empty `bundles` entry was added to the `assetic` configuration:
  112 +
  113 + assetic:
  114 + bundles: []
  115 +
  116 +The default `swiftmailer` configuration now has the `spool` setting configured
  117 +to the `memory` type to defer email sending after the response is sent to the
  118 +user (recommended for better end-user performance):
  119 +
  120 + swiftmailer:
  121 + spool: { type: memory }
  122 +
  123 +The `jms_security_extra` configuration was moved to the `security.yml`
  124 +configuration file.
  125 +
  126 +### `app/config/config_dev.yml`
  127 +
  128 +An example of how to send all emails to a unique address was added:
  129 +
  130 + #swiftmailer:
  131 + # delivery_address: me@example.com
  132 +
  133 +### `app/config/config_test.yml`
  134 +
  135 +The `storage_id` setting must be changed to `session.storage.mock_file`:
  136 +
  137 + framework:
  138 + session:
  139 + storage_id: session.storage.mock_file
  140 +
  141 +### `app/config/parameters.ini`
  142 +
  143 +The file has been converted to a YAML file which reads as follows:
  144 +
  145 + parameters:
  146 + database_driver: pdo_mysql
  147 + database_host: localhost
  148 + database_port: ~
  149 + database_name: symfony
  150 + database_user: root
  151 + database_password: ~
  152 +
  153 + mailer_transport: smtp
  154 + mailer_host: localhost
  155 + mailer_user: ~
  156 + mailer_password: ~
  157 +
  158 + locale: en
  159 + secret: ThisTokenIsNotSoSecretChangeIt
  160 +
  161 +Note that if you convert your parameters file to YAML, you must also change
  162 +its reference in `app/config/config.yml`.
  163 +
  164 +### `app/config/routing_dev.yml`
  165 +
  166 +The `_assetic` entry was removed:
  167 +
  168 + #_assetic:
  169 + # resource: .
  170 + # type: assetic
  171 +
  172 +### `app/config/security.yml`
  173 +
  174 +Under `security.access_control`, the default rule for internal routes was changed:
  175 +
  176 + security:
  177 + access_control:
  178 + #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
  179 +
  180 +Under `security.providers`, the `in_memory` example was updated to the following:
  181 +
  182 + security:
  183 + providers:
  184 + in_memory:
  185 + memory:
  186 + users:
  187 + user: { password: userpass, roles: [ 'ROLE_USER' ] }
  188 + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
  189 +
  190 +### `app/AppKernel.php`
  191 +
  192 +The following bundles have been added to the list of default registered bundles:
  193 +
  194 + new JMS\AopBundle\JMSAopBundle(),
  195 + new JMS\DiExtraBundle\JMSDiExtraBundle($this),
  196 +
  197 +You must also rename the DoctrineBundle from:
  198 +
  199 + new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
  200 +
  201 +to:
  202 +
  203 + new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  204 +
  205 +### `web/app.php`
  206 +
  207 +The default `web/app.php` file now reads as follows:
  208 +
  209 + <?php
  210 +
  211 + use Symfony\Component\ClassLoader\ApcClassLoader;
  212 + use Symfony\Component\HttpFoundation\Request;
  213 +
  214 + $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
  215 +
  216 + // Use APC for autoloading to improve performance.
  217 + // Change 'sf2' to a unique prefix in order to prevent cache key conflicts
  218 + // with other applications also using APC.
  219 + /*
  220 + $loader = new ApcClassLoader('sf2', $loader);
  221 + $loader->register(true);
  222 + */
  223 +
  224 + require_once __DIR__.'/../app/AppKernel.php';
  225 + //require_once __DIR__.'/../app/AppCache.php';
  226 +
  227 + $kernel = new AppKernel('prod', false);
  228 + $kernel->loadClassCache();
  229 + //$kernel = new AppCache($kernel);
  230 + $request = Request::createFromGlobals();
  231 + $response = $kernel->handle($request);
  232 + $response->send();
  233 + $kernel->terminate($request, $response);
  234 +
  235 +### `web/app_dev.php`
  236 +
  237 +The default `web/app_dev.php` file now reads as follows:
  238 +
  239 + <?php
  240 +
  241 + use Symfony\Component\HttpFoundation\Request;
  242 +
  243 + // If you don't want to setup permissions the proper way, just uncomment the following PHP line
  244 + // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
  245 + //umask(0000);
  246 +
  247 + // This check prevents access to debug front controllers that are deployed by accident to production servers.
  248 + // Feel free to remove this, extend it, or make something more sophisticated.
  249 + if (isset($_SERVER['HTTP_CLIENT_IP'])
  250 + || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  251 + || !in_array(@$_SERVER['REMOTE_ADDR'], array(
  252 + '127.0.0.1',
  253 + '::1',
  254 + ))
  255 + ) {
  256 + header('HTTP/1.0 403 Forbidden');
  257 + exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  258 + }
  259 +
  260 + $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
  261 + require_once __DIR__.'/../app/AppKernel.php';
  262 +
  263 + $kernel = new AppKernel('dev', true);
  264 + $kernel->loadClassCache();
  265 + $request = Request::createFromGlobals();
  266 + $response = $kernel->handle($request);
  267 + $response->send();
  268 + $kernel->terminate($request, $response);
... ...
autoload.php 0 → 100755
  1 +++ a/autoload.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +require_once './vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
  3 +
  4 +use Symfony\Component\ClassLoader\UniversalClassLoader;
  5 +
  6 +$loader = new UniversalClassLoader();
  7 +
  8 +// You can search the include_path as a last resort.
  9 +$loader->useIncludePath(true);
  10 +
  11 +// ... register namespaces and prefixes here - see below
  12 +
  13 +$loader->registerNamespace('Jpgraph', __DIR__.'/vendor/jpgraph/jpgraph/lib/JpGraph/src');
  14 +
  15 +$loader->register();
... ...