|
@@ -13,6 +13,8 @@ use DeviceBundle\Validator\Constraints as ValidatorAssert;
|
|
|
use DeviceBundle\Interfaces\DeviceInterface;
|
|
|
use MapBundle\Entity\Interfaces\LocationInterface;
|
|
|
use MapBundle\Entity\Traits\LocationTrait;
|
|
|
+use WorkflowBundle\Entity\Interfaces\WorkflowInterface;
|
|
|
+use WorkflowBundle\Entity\Traits\WorkflowTrait;
|
|
|
|
|
|
/**
|
|
|
* @ORM\Entity
|
|
@@ -20,13 +22,14 @@ use MapBundle\Entity\Traits\LocationTrait;
|
|
|
*
|
|
|
* @ValidatorAssert\Device
|
|
|
*/
|
|
|
-class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
+class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface, WorkflowInterface
|
|
|
{
|
|
|
|
|
|
use ExtraDataTrait;
|
|
|
use TenancyIdTrait;
|
|
|
use LocationTrait;
|
|
|
-
|
|
|
+ use WorkflowTrait;
|
|
|
+
|
|
|
/**
|
|
|
* @var bigint $id
|
|
|
*
|
|
@@ -120,17 +123,18 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
* @ORM\Column(type="integer", options={"unsigned":true, "default":5})
|
|
|
*/
|
|
|
protected $timeOltOctets = 5;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @ORM\Column(type="integer", options={"unsigned":true, "default":5})
|
|
|
*/
|
|
|
protected $timePonStats = 5;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @ORM\Column(type="integer", options={"unsigned":true, "default":5})
|
|
|
*/
|
|
|
protected $timeOnuStats = 5;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
@@ -291,47 +295,6 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Workflow
|
|
|
- */
|
|
|
- public function getWorkflow()
|
|
|
- {
|
|
|
- return $this->workflow;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param Workflow $workflow
|
|
|
- * @return $this
|
|
|
- */
|
|
|
- public function setWorkflow($workflow)
|
|
|
- {
|
|
|
- $this->workflow = $workflow;
|
|
|
-
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- public function getWorkflowType()
|
|
|
- {
|
|
|
- $workflow = $this->getWorkflow();
|
|
|
-
|
|
|
- if ($workflow) {
|
|
|
- return $workflow->getType();
|
|
|
- }
|
|
|
-
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- public function getWorkflowName()
|
|
|
- {
|
|
|
- $workflow = $this->getWorkflow();
|
|
|
-
|
|
|
- if ($workflow) {
|
|
|
- return $workflow->getName();
|
|
|
- }
|
|
|
-
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
/* Va a quedar deprecate */
|
|
|
|
|
|
public function getWorkflowObject()
|
|
@@ -346,73 +309,6 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
return $this->workflow;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Get currentState
|
|
|
- *
|
|
|
- */
|
|
|
- public function getCurrentState()
|
|
|
- {
|
|
|
- return $this->currentState;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Set currentState
|
|
|
- *
|
|
|
- */
|
|
|
- public function setCurrentState($currentState)
|
|
|
- {
|
|
|
- $this->currentState = $currentState;
|
|
|
-
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Get transitionState
|
|
|
- *
|
|
|
- */
|
|
|
- public function getTransitionState()
|
|
|
- {
|
|
|
- return $this->transitionState;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Set transitionState
|
|
|
- *
|
|
|
- */
|
|
|
- public function setTransitionState($transitionState)
|
|
|
- {
|
|
|
- $this->transitionState = $transitionState;
|
|
|
-
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
- public function getTransitionWorkflow()
|
|
|
- {
|
|
|
- return "transition_state";
|
|
|
- }
|
|
|
-
|
|
|
- // Para coincider entre estos workflow servidos por servicio y aquellos levantados por ABM
|
|
|
- public function getServiceWorkflow()
|
|
|
- {
|
|
|
- global $kernel;
|
|
|
- $registry = $kernel->getContainer()->get('workflow.registry');
|
|
|
-
|
|
|
- $workflow_name = null;
|
|
|
- $workflow = $this->getWorkflow();
|
|
|
- if ($workflow) {
|
|
|
- $workflow_name = $workflow->getName();
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- $workflow = $registry->get($this, $workflow_name);
|
|
|
- } catch (ExceptionInterface $e) {
|
|
|
- $kernel->getContainer()->get('session')->getFlashBag()->add('danger', $kernel->getContainer()->get('translator')->trans('Incorrect Workflow', array(), 'FTTHBundle'));
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return $workflow;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @return array
|
|
|
*/
|
|
@@ -426,9 +322,9 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
$deviceData['tenancy'] = $this->tenancyId;
|
|
|
|
|
|
$deviceExtraData = array('snmpCommunity' => $this->snmpCommunity, 'sshUser' => $this->sshUser, 'sshPass' => $this->sshPass,
|
|
|
- 'libraryVersion' => $this->libraryVersion, 'name' => $this->name);
|
|
|
+ 'libraryVersion' => $this->libraryVersion, 'name' => $this->name);
|
|
|
|
|
|
- if($this->model) {
|
|
|
+ if ($this->model) {
|
|
|
$model = $this->getModel();
|
|
|
$deviceExtraData['modelId'] = $model->getId();
|
|
|
$deviceExtraData['mark'] = $model->getMark();
|
|
@@ -438,7 +334,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
$deviceExtraData['mark'] = null;
|
|
|
$deviceExtraData['library'] = null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$deviceExtraData['executeSnmp'] = $this->executeSnmp;
|
|
|
$deviceExtraData['timeScan'] = $this->timeScan;
|
|
|
$deviceExtraData['timeOnuStats'] = $this->timeOnuStats;
|
|
@@ -448,13 +344,6 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
$deviceData['extraData'] = json_encode($deviceExtraData);
|
|
|
|
|
|
return $deviceData;
|
|
|
-
|
|
|
-
|
|
|
- /*return array(
|
|
|
- 'deviceType' => get_class($this),
|
|
|
- 'deviceId' => $this->id,
|
|
|
- 'ip' => $this->ip,
|
|
|
- );*/
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -498,7 +387,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
{
|
|
|
return $this->timeScan;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Set timeOltOctets
|
|
|
*
|
|
@@ -518,7 +407,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
{
|
|
|
return $this->timeOltOctets;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Set timeOnuStats
|
|
|
*
|
|
@@ -538,7 +427,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
{
|
|
|
return $this->timeOnuStats;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Set timePonStats
|
|
|
*
|
|
@@ -558,7 +447,5 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
|
|
|
{
|
|
|
return $this->timePonStats;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|