PonPort.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <?php
  2. namespace StatsBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Base\AdminBundle\Traits\TenancyIdTrait;
  6. use Base\AdminBundle\Traits\TenancyIdTraitInterface;
  7. /**
  8. * @ORM\Table
  9. * @ORM\Entity
  10. * @UniqueEntity(fields={"deviceServer", "oltDeviceId", "ponPort"}, message="errors.duplicate_key")
  11. * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"device_server_id", "olt_device_id", "pon_port"})})
  12. */
  13. class PonPort implements TenancyIdTraitInterface
  14. {
  15. use TenancyIdTrait;
  16. /**
  17. * @var int
  18. *
  19. * @ORM\Column(name="id", type="integer")
  20. * @ORM\Id
  21. * @ORM\GeneratedValue(strategy="AUTO")
  22. */
  23. private $id;
  24. /**
  25. * @var string
  26. *
  27. * @ORM\Column(type="string", length=25, nullable=true)
  28. */
  29. private $ponPort;
  30. /**
  31. * @var int
  32. *
  33. * @ORM\Column(type="integer", nullable=true)
  34. */
  35. private $oltDeviceId;
  36. /**
  37. * @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
  38. */
  39. protected $deviceServer;
  40. /**
  41. * @ORM\Column(type="datetime")
  42. */
  43. protected $updated;
  44. /**
  45. * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
  46. */
  47. public $txPower;
  48. /**
  49. * @ORM\Column(type="text", nullable=true)
  50. */
  51. public $rxPower;
  52. /**
  53. * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
  54. */
  55. public $voltage;
  56. /**
  57. * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
  58. */
  59. public $temperature;
  60. /**
  61. * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
  62. */
  63. public $biasCurrent;
  64. /**
  65. * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true)
  66. */
  67. public $inOctets;
  68. /**
  69. * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true)
  70. */
  71. public $outOctets;
  72. /**
  73. * @ORM\Column(type="integer", nullable=true)
  74. */
  75. public $online;
  76. /**
  77. * @ORM\Column(type="integer", nullable=true)
  78. */
  79. public $offline;
  80. /**
  81. * @var int
  82. *
  83. * @ORM\Column(type="integer", nullable=true)
  84. */
  85. private $index;
  86. /**
  87. * @return int
  88. */
  89. public function getId()
  90. {
  91. return $this->id;
  92. }
  93. /**
  94. * @return string
  95. */
  96. public function __toString()
  97. {
  98. return sprintf('%s', strtoupper($this->ponPort));
  99. }
  100. /**
  101. * Set ponPort
  102. *
  103. * @param string $ponPort
  104. *
  105. * @return PonPort
  106. */
  107. public function setPonPort($ponPort)
  108. {
  109. $this->ponPort = $ponPort;
  110. return $this;
  111. }
  112. /**
  113. * Get ponPort
  114. *
  115. * @return string
  116. */
  117. public function getPonPort()
  118. {
  119. return $this->ponPort;
  120. }
  121. /**
  122. * @param int $oltDeviceId
  123. *
  124. * @return PonPort
  125. */
  126. public function setOltDeviceId($oltDeviceId)
  127. {
  128. $this->oltDeviceId = $oltDeviceId;
  129. return $this;
  130. }
  131. /**
  132. * @return int
  133. */
  134. public function getOltDeviceId()
  135. {
  136. return $this->oltDeviceId;
  137. }
  138. /**
  139. * @param DeviceServer $deviceServer
  140. *
  141. * @return PonPort
  142. */
  143. public function setDeviceServer($deviceServer)
  144. {
  145. $this->deviceServer = $deviceServer;
  146. return $this;
  147. }
  148. /**
  149. * @return DeviceServer
  150. */
  151. public function getDeviceServer()
  152. {
  153. return $this->deviceServer;
  154. }
  155. /**
  156. * Set updated
  157. *
  158. * @param Datetime $updated
  159. *
  160. * @return PonPort
  161. */
  162. public function setUpdated($updated)
  163. {
  164. $this->updated = $updated;
  165. return $this;
  166. }
  167. /**
  168. * Get updated
  169. *
  170. * @return \DateTime
  171. */
  172. public function getUpdated()
  173. {
  174. return $this->updated;
  175. }
  176. /**
  177. * Set txPower
  178. *
  179. * @param decimal $txPower
  180. * @return PonPort
  181. */
  182. public function setTxPower($txPower)
  183. {
  184. $this->txPower = $txPower;
  185. return $this;
  186. }
  187. /**
  188. * Get txPower
  189. *
  190. * @return decimal
  191. */
  192. public function getTxPower()
  193. {
  194. if(is_null($this->txPower)) return null;
  195. return (float)$this->txPower;
  196. }
  197. /**
  198. * Set rxPower
  199. *
  200. * @param string $rxPower
  201. * @return PonPort
  202. */
  203. public function setRxPower($rxPower)
  204. {
  205. $this->rxPower = $rxPower;
  206. return $this;
  207. }
  208. /**
  209. * Get rxPower
  210. *
  211. * @return string
  212. */
  213. public function getRxPower()
  214. {
  215. return $this->rxPower;
  216. }
  217. /**
  218. * Get rxPower
  219. *
  220. * @return string
  221. */
  222. public function getArrayRxPower()
  223. {
  224. if ($this->rxPower) {
  225. return json_decode($this->rxPower, true);
  226. }
  227. return array();
  228. }
  229. /**
  230. * Set voltage
  231. *
  232. * @param decimal $voltage
  233. * @return PonPort
  234. */
  235. public function setVoltage($voltage)
  236. {
  237. $this->voltage = $voltage;
  238. return $this;
  239. }
  240. /**
  241. * Get voltage
  242. *
  243. * @return decimal
  244. */
  245. public function getVoltage()
  246. {
  247. if(is_null($this->voltage)) return null;
  248. return (float)$this->voltage;
  249. }
  250. /**
  251. * Set temperature
  252. *
  253. * @param decimal $temperature
  254. * @return PonPort
  255. */
  256. public function setTemperature($temperature)
  257. {
  258. $this->temperature = $temperature;
  259. return $this;
  260. }
  261. /**
  262. * Get temperature
  263. *
  264. * @return decimal
  265. */
  266. public function getTemperature()
  267. {
  268. if(is_null($this->temperature)) return null;
  269. return (float)$this->temperature;
  270. }
  271. /**
  272. * Set biasCurrent
  273. *
  274. * @param decimal $biasCurrent
  275. * @return PonPort
  276. */
  277. public function setBiasCurrent($biasCurrent)
  278. {
  279. $this->biasCurrent = $biasCurrent;
  280. return $this;
  281. }
  282. /**
  283. * Get biasCurrent
  284. *
  285. * @return decimal
  286. */
  287. public function getBiasCurrent()
  288. {
  289. if(is_null($this->biasCurrent)) return null;
  290. return (float)$this->biasCurrent;
  291. }
  292. /**
  293. * Set inOctets
  294. *
  295. * @param string $inOctets
  296. *
  297. * @return PonPort
  298. */
  299. public function setInOctets($inOctets)
  300. {
  301. $this->inOctets = $inOctets;
  302. return $this;
  303. }
  304. /**
  305. * Get inOctets
  306. *
  307. * @return string
  308. */
  309. public function getInOctets()
  310. {
  311. return (float) $this->inOctets;
  312. }
  313. /**
  314. * Set outOctets
  315. *
  316. * @param string $outOctets
  317. *
  318. * @return PonPort
  319. */
  320. public function setOutOctets($outOctets)
  321. {
  322. $this->outOctets = $outOctets;
  323. return $this;
  324. }
  325. /**
  326. * Get outOctets
  327. *
  328. * @return string
  329. */
  330. public function getOutOctets()
  331. {
  332. return (float) $this->outOctets;
  333. }
  334. /**
  335. * Set online
  336. *
  337. * @param integer $online
  338. *
  339. * @return PonPort
  340. */
  341. public function setOnline($online)
  342. {
  343. $this->online = $online;
  344. return $this;
  345. }
  346. /**
  347. * Get online
  348. *
  349. * @return integer
  350. */
  351. public function getOnline()
  352. {
  353. return $this->online;
  354. }
  355. /**
  356. * Set offline
  357. *
  358. * @param integer $offline
  359. *
  360. * @return PonPort
  361. */
  362. public function setOffline($offline)
  363. {
  364. $this->offline = $offline;
  365. return $this;
  366. }
  367. /**
  368. * Get offline
  369. *
  370. * @return integer
  371. */
  372. public function getOffline()
  373. {
  374. return $this->offline;
  375. }
  376. /**
  377. * Set index
  378. *
  379. * @param integer $index
  380. *
  381. * @return PonPort
  382. */
  383. public function setIndex($index)
  384. {
  385. $this->index = $index;
  386. return $this;
  387. }
  388. /**
  389. * Get index
  390. *
  391. * @return integer
  392. */
  393. public function getIndex()
  394. {
  395. return $this->index;
  396. }
  397. }