123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- <?php
- namespace StatsBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use Symfony\Component\Validator\Constraints as Assert;
- use JMS\Serializer\Annotation as JMS;
- use Base\AdminBundle\Traits\TenancyIdTrait;
- use Base\AdminBundle\Traits\TenancyIdTraitInterface;
- /**
- * @ORM\Table
- * @ORM\Entity(repositoryClass="StatsBundle\Repository\OnuRepository")
- * @UniqueEntity(fields={"deviceServer", "oltDeviceId", "ponSerialNumber"}, message="errors.duplicate_key")
- * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"device_server_id", "olt_device_id", "pon_serial_number"})})
- */
- class Onu implements TenancyIdTraitInterface
- {
- use TenancyIdTrait;
-
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $index;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $ponSerialNumber;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $oltDeviceId;
- /**
- * @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
- *
- * @JMS\MaxDepth(1)
- */
- protected $deviceServer;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $deviceId;
-
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=255, nullable=true)
- *
- * @Assert\Ip
- */
- private $ip;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=12, nullable=true)
- */
- private $mac;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $serialNumber;
- /**
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $ponPort;
- /**
- * @ORM\Column(name="status", type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT FALSE")
- */
- public $status = false;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $txPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $rxPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $voltage;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $temperature;
- /**
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- public $uptime;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $updated;
- /**
- * @ORM\Column(type="decimal", precision=10, scale=7, nullable=true)
- */
- public $lat;
-
- /**
- * @ORM\Column(type="decimal", precision=10, scale=7, nullable=true)
- */
- public $lng;
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true, options={"comment":"Bandwidth in b/s"})
- */
- public $inOctets;
-
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true, options={"comment":"Bandwidth in b/s"})
- */
- public $outOctets;
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @return string
- */
- public function getCustomId()
- {
- return sprintf('%s~%s~%s', strtolower($this->ponSerialNumber), $this->oltDeviceId, $this->deviceServer->getId());
- }
- /**
- * @return string
- */
- public function __toString()
- {
- return sprintf('%s', strtoupper($this->ponSerialNumber));
- }
- /**
- * @param string $ip
- *
- * @return Device
- */
- public function setIp($ip = null)
- {
- $this->ip = $ip;
- return $this;
- }
- /**
- * @return string
- */
- public function getIp()
- {
- return $this->ip;
- }
- /**
- * Set mac
- *
- * @param string $mac
- *
- * @return ONU
- */
- public function setMac($mac)
- {
- $this->mac = $mac;
- return $this;
- }
- /**
- * Get mac
- *
- * @return string
- */
- public function getMac()
- {
- return $this->mac;
- }
- /**
- * Set serialNumber
- *
- * @param string $serialNumber
- *
- * @return ONU
- */
- public function setSerialNumber($serialNumber)
- {
- $this->serialNumber = $serialNumber;
- return $this;
- }
- /**
- * Get serialNumber
- *
- * @return string
- */
- public function getSerialNumber()
- {
- return $this->serialNumber;
- }
- /**
- * Set ponSerialNumber
- *
- * @param string $ponSerialNumber
- *
- * @return ONU
- */
- public function setPonSerialNumber($ponSerialNumber)
- {
- $this->ponSerialNumber = $ponSerialNumber;
- return $this;
- }
- /**
- * Get ponSerialNumber
- *
- * @return string
- */
- public function getPonSerialNumber()
- {
- return strtoupper($this->ponSerialNumber);
- }
- /**
- * Set ponPort
- *
- * @param string $ponPort
- *
- * @return ONU
- */
- public function setPonPort($ponPort)
- {
- $this->ponPort = $ponPort;
- return $this;
- }
- /**
- * Get ponPort
- *
- * @return string
- */
- public function getPonPort()
- {
- return $this->ponPort;
- }
- /**
- * @param int $deviceId
- *
- * @return ONU
- */
- public function setDeviceId($deviceId)
- {
- $this->deviceId = $deviceId;
- return $this;
- }
- /**
- * @return int
- */
- public function getDeviceId()
- {
- return $this->deviceId;
- }
- /**
- * @param int $oltDeviceId
- *
- * @return ONU
- */
- public function setOltDeviceId($oltDeviceId)
- {
- $this->oltDeviceId = $oltDeviceId;
- return $this;
- }
- /**
- * @return int
- */
- public function getOltDeviceId()
- {
- return $this->oltDeviceId;
- }
- /**
- * @return DeviceServer
- */
- public function getDeviceServer()
- {
- return $this->deviceServer;
- }
- /**
- * @param DeviceServer $deviceServer
- *
- * @return ONU
- */
- public function setDeviceServer($deviceServer)
- {
- $this->deviceServer = $deviceServer;
- return $this;
- }
- public function getShortType()
- {
- return str_replace("FTTHBundle\\Entity\\", "", $this->deviceType);
- }
-
- /**
- * Set updated
- *
- * @param Datetime $tenancyId
- *
- * @return ONU
- */
- public function setUpdated($updated)
- {
- $this->updated = $updated;
- return $this;
- }
- /**
- * Get updated
- *
- * @return \DateTime
- */
- public function getUpdated()
- {
- return $this->updated;
- }
- /**
- * Set txPower
- *
- * @param decimal $txPower
- * @return ONU
- */
- public function setTxPower($txPower)
- {
- $this->txPower = $txPower;
- return $this;
- }
- /**
- * Get txPower
- *
- * @return decimal
- */
- public function getTxPower()
- {
- if(is_null($this->txPower)) return null;
-
- return (float)$this->txPower;
- }
- /**
- * Set rxPower
- *
- * @param decimal $rxPower
- * @return ONU
- */
- public function setRxPower($rxPower)
- {
- $this->rxPower = $rxPower;
- return $this;
- }
- /**
- * Get rxPower
- *
- * @return decimal
- */
- public function getRxPower()
- {
- if(is_null($this->rxPower)) return null;
-
- return (float)$this->rxPower;
- }
- /**
- * Set voltage
- *
- * @param decimal $voltage
- * @return ONU
- */
- public function setVoltage($voltage)
- {
- $this->voltage = $voltage;
- return $this;
- }
- /**
- * Get voltage
- *
- * @return decimal
- */
- public function getVoltage()
- {
- if(is_null($this->voltage)) return null;
-
- return (float)$this->voltage;
- }
- /**
- * Set temperature
- *
- * @param decimal $temperature
- * @return ONU
- */
- public function setTemperature($temperature)
- {
- $this->temperature = $temperature;
- return $this;
- }
- /**
- * Get temperature
- *
- * @return decimal
- */
- public function getTemperature()
- {
- if(is_null($this->temperature)) return null;
-
- return (float)$this->temperature;
- }
- /**
- * Set uptime
- *
- * @param string $uptime
- * @return ONU
- */
- public function setUptime($uptime)
- {
- $this->uptime = $uptime;
- return $this;
- }
- /**
- * Get uptime
- *
- * @return string
- */
- public function getUptime()
- {
- return $this->uptime;
- }
- /**
- * Set lat
- *
- * @param decimal $lat
- * @return ONU
- */
- public function setLat($lat)
- {
- $this->lat = $lat;
- return $this;
- }
-
- /**
- * Get lat
- *
- * @return decimal
- */
- public function getLat()
- {
- if(is_null($this->lat)) return null;
- return (float)$this->lat;
- }
-
- /**
- * Set lng
- *
- * @param decimal $lng
- * @return ONU
- */
- public function setLng($lng)
- {
- $this->lng = $lng;
- return $this;
- }
-
- /**
- * Get lng
- *
- * @return decimal
- */
- public function getLng()
- {
- if(is_null($this->lng)) return null;
- return (float)$this->lng;
- }
- /**
- * Set status
- *
- * @param boolean $status
- * @return ONU
- */
- public function setStatus($status)
- {
- $this->status = $status;
- return $this;
- }
-
- /**
- * Get status
- *
- * @return boolean
- */
- public function getStatus()
- {
- if(is_null($this->status)) return null;
-
- return (boolean)$this->status;
- }
- /**
- * Set index
- *
- * @param integer $index
- *
- * @return ONU
- */
- public function setIndex($index)
- {
- $this->index = $index;
- return $this;
- }
- /**
- * Get index
- *
- * @return integer
- */
- public function getIndex()
- {
- return $this->index;
- }
- /**
- * Set inOctets
- *
- * @param float $inOctets
- *
- * @return ONU
- */
- public function setInOctets($inOctets)
- {
- $this->inOctets = $inOctets;
- return $this;
- }
- /**
- * Get inOctets
- *
- * @return float
- */
- public function getInOctets()
- {
- return (float) $this->inOctets;
- }
- /**
- * Set outOctets
- *
- * @param float $outOctets
- *
- * @return ONU
- */
- public function setOutOctets($outOctets)
- {
- $this->outOctets = $outOctets;
- return $this;
- }
- /**
- * Get outOctets
- *
- * @return float
- */
- public function getOutOctets()
- {
- return (float) $this->outOctets;
- }
- }
|