ValidationApi.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <?php
  2. namespace Swagger\Client\FTTH\Api;
  3. use Swagger\Client\ApiException;
  4. /**
  5. * TenancyApi Class Doc Comment
  6. *
  7. * @category Class
  8. * @package Swagger\Client\FTTH\Api
  9. * @author Swagger Codegen team
  10. * @link https://github.com/swagger-api/swagger-codegen
  11. */
  12. class ValidationApi
  13. {
  14. private $config;
  15. private $client;
  16. /**
  17. * ValidationApi constructor.
  18. * @param $config
  19. * @param $client
  20. */
  21. public function __construct($client, $config)
  22. {
  23. $this->config = $config;
  24. $this->client = $client;
  25. }
  26. /**
  27. * @param integer $id Id nap.
  28. * @return mixed|null
  29. */
  30. public function validNAP($id)
  31. {
  32. $resp = null;
  33. try {
  34. if (!is_null($id)) {
  35. $api = new NAPApi (
  36. $this->client,
  37. $this->config);
  38. $api->setDisabledTenancy(true);
  39. $resp = $api->getById($id);
  40. }
  41. } catch (ApiException $e) {
  42. }
  43. return $resp;
  44. }
  45. /**
  46. * @param integer $id Id olt.
  47. * @return mixed|null
  48. */
  49. public function validOLT($id)
  50. {
  51. $resp = null;
  52. try {
  53. if (!is_null($id)) {
  54. $api = new OLTApi (
  55. $this->client,
  56. $this->config);
  57. $api->setDisabledTenancy(true);
  58. $resp = $api->getById($id);
  59. }
  60. } catch (ApiException $e) {
  61. }
  62. return $resp;
  63. }
  64. /**
  65. * @param integer $id Id olt model.
  66. * @return mixed|null
  67. */
  68. public function validOLTModel($id)
  69. {
  70. $resp = null;
  71. try {
  72. if (!is_null($id)) {
  73. $api = new OLTModelApi(
  74. $this->client,
  75. $this->config);
  76. $api->setDisabledTenancy(true);
  77. $resp = $api->getById($id);
  78. }
  79. } catch (ApiException $e) {
  80. }
  81. return $resp;
  82. }
  83. /**
  84. * @param integer $id Id onu.
  85. * @return mixed|null
  86. */
  87. public function validONU($id)
  88. {
  89. $resp = null;
  90. try {
  91. if (!is_null($id)) {
  92. $api = new ONUApi(
  93. $this->client,
  94. $this->config);
  95. $api->setDisabledTenancy(true);
  96. $resp = $api->getById($id);
  97. }
  98. } catch (ApiException $e) {
  99. }
  100. return $resp;
  101. }
  102. /**
  103. * @param integer $id onu model.
  104. * @return mixed|null
  105. */
  106. public function validONUModel($id)
  107. {
  108. $resp = null;
  109. try {
  110. if (!is_null($id)) {
  111. $api = new ONUModelApi(
  112. $this->client,
  113. $this->config);
  114. $api->setDisabledTenancy(true);
  115. $resp = $api->getById($id);
  116. }
  117. } catch (ApiException $e) {
  118. }
  119. return $resp;
  120. }
  121. /**
  122. * @param integer $id Id profile.
  123. * @return mixed|null
  124. */
  125. public function validProfile($id)
  126. {
  127. $resp = null;
  128. try {
  129. if (!is_null($id)) {
  130. $api = new ProfileApi(
  131. $this->client,
  132. $this->config);
  133. $api->setDisabledTenancy(true);
  134. $resp = $api->getById($id);
  135. }
  136. } catch (ApiException $e) {
  137. }
  138. return $resp;
  139. }
  140. /**
  141. * @param integer $id Id onu profile.
  142. * @return mixed|null
  143. */
  144. public function validONUProfile($id)
  145. {
  146. $resp = null;
  147. try {
  148. if (!is_null($id)) {
  149. $api = new ONUProfileApi(
  150. $this->client,
  151. $this->config);
  152. $api->setDisabledTenancy(true);
  153. $resp = $api->getById($id);
  154. }
  155. } catch (ApiException $e) {
  156. }
  157. return $resp;
  158. }
  159. /**
  160. * @param integer $id Id vlan profile.
  161. * @return mixed|null
  162. */
  163. public function validVLanProfile($id)
  164. {
  165. $resp = null;
  166. try {
  167. if (!is_null($id)) {
  168. $api = new VLanProfileApi(
  169. $this->client,
  170. $this->config);
  171. $api->setDisabledTenancy(true);
  172. $resp = $api->getById($id);
  173. }
  174. } catch (ApiException $e) {
  175. }
  176. return $resp;
  177. }
  178. /**
  179. * @param integer $id Id onu template.
  180. * @return mixed|null
  181. */
  182. public function validONUTemplate($id)
  183. {
  184. $resp = null;
  185. try {
  186. if (!is_null($id)) {
  187. $api = new ONUTemplateApi(
  188. $this->client,
  189. $this->config);
  190. $api->setDisabledTenancy(true);
  191. $resp = $api->getById($id);
  192. }
  193. } catch (ApiException $e) {
  194. }
  195. return $resp;
  196. }
  197. /**
  198. * @param integer $id Id tcont profile.
  199. * @return mixed|null
  200. */
  201. public function validTContProfile($id)
  202. {
  203. $resp = null;
  204. try {
  205. if (!is_null($id)) {
  206. $api = new TContProfileApi(
  207. $this->client,
  208. $this->config);
  209. $api->setDisabledTenancy(true);
  210. $resp = $api->getById($id);
  211. }
  212. } catch (ApiException $e) {
  213. }
  214. return $resp;
  215. }
  216. /**
  217. * @param integer $id Id traffic profile.
  218. * @return mixed|null
  219. */
  220. public function validTrafficProfile($id)
  221. {
  222. $resp = null;
  223. try {
  224. if (!is_null($id)) {
  225. $api = new TrafficProfileApi(
  226. $this->client,
  227. $this->config);
  228. $api->setDisabledTenancy(true);
  229. $resp = $api->getById($id);
  230. }
  231. } catch (ApiException $e) {
  232. }
  233. return $resp;
  234. }
  235. /**
  236. * @param integer $id Id vlan id.
  237. * @return mixed|null
  238. */
  239. public function validVLanID($id)
  240. {
  241. $resp = null;
  242. try {
  243. if (!is_null($id)) {
  244. $api = new VLanIDApi(
  245. $this->client,
  246. $this->config);
  247. $api->setDisabledTenancy(true);
  248. $resp = $api->getById($id);
  249. }
  250. } catch (ApiException $e) {
  251. }
  252. return $resp;
  253. }
  254. /**
  255. * @param mixed|string $ids Ids vlan id.
  256. * @return mixed|null
  257. */
  258. public function validVLansID($ids)
  259. {
  260. if(!is_array($ids)) $ids = explode(",",$ids);
  261. $resp = array();
  262. try {
  263. if (!is_null($ids)) {
  264. foreach($ids as $id) {
  265. if($id instanceof \Swagger\Client\FTTH\Model\VLanID) {
  266. $resp[] = $id;
  267. continue;
  268. }
  269. $api = new VLanIDApi(
  270. $this->client,
  271. $this->config);
  272. $api->setDisabledTenancy(true);
  273. $vlan = $api->getById($id);
  274. if(is_null($vlan)) return null; //vlan doesn't exist
  275. $resp[] = $vlan;
  276. }
  277. }
  278. } catch (ApiException $e) {
  279. }
  280. return $resp;
  281. }
  282. /**
  283. * @param integer $ponSerialNumber Pon serial number.
  284. * @param integer $tenancy Tenancy id.
  285. * @return mixed|null
  286. */
  287. public function existsONU($ponSerialNumber, $tenancy)
  288. {
  289. $resp = null;
  290. try {
  291. if (!is_null($ponSerialNumber)) {
  292. $util = new \Utils();
  293. $api = new ONUApi(
  294. $this->client,
  295. $this->config);
  296. $values = $api->getList(null, null, $ponSerialNumber, null, null,
  297. null, null, null, null, null,
  298. null, null, null, null, null,
  299. null, null, null, null, $tenancy, 1, 1000000, 0);
  300. $resp = $util->valueExistsLower($ponSerialNumber,
  301. $values,
  302. "getPonSerialNumber");
  303. }
  304. } catch (ApiException $e) {
  305. }
  306. return $resp;
  307. }
  308. }