|
@@ -1013,8 +1013,8 @@ class Services extends ApiServices
|
|
|
);
|
|
|
$ch = new Checks();
|
|
|
$id = $ch->integer($request, "id", true);
|
|
|
- $workflow = "administrative_state";
|
|
|
- $transition = "suspend_to_active";
|
|
|
+ $workflow = "onu_workflow_2";
|
|
|
+ $transition = "active";
|
|
|
$apiInstance->setDisabledTenancy(true);
|
|
|
$result = $apiInstance->getById($id);
|
|
|
$apiInstance->setDisabledTenancy(false);
|
|
@@ -1039,6 +1039,43 @@ class Services extends ApiServices
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public function getONUSuspend(Application $app)
|
|
|
+ {
|
|
|
+ $app->get('/api/v1/ftth/onu/suspend', function (Application $app, Request $request) {
|
|
|
+ $codeResponse = 400;
|
|
|
+ try {
|
|
|
+ $config = $this->setUserPasswordConfig($request, Configuration::getDefaultConfiguration());
|
|
|
+ $apiInstance = new ONUApi(
|
|
|
+ new Client(),
|
|
|
+ $config
|
|
|
+ );
|
|
|
+ $ch = new Checks();
|
|
|
+ $id = $ch->integer($request, "id", true);
|
|
|
+ $workflow = "onu_workflow_2";
|
|
|
+ $transition = "disable_delete";
|
|
|
+ $apiInstance->setDisabledTenancy(true);
|
|
|
+ $result = $apiInstance->getById($id);
|
|
|
+ $apiInstance->setDisabledTenancy(false);
|
|
|
+ if (!is_null($result)) {
|
|
|
+ $apiInstance->apply($id, $workflow, $transition);
|
|
|
+ $apiInstance->setDisabledTenancy(true);
|
|
|
+ $result = $apiInstance->getById($id);
|
|
|
+ $apiInstance->setDisabledTenancy(false);
|
|
|
+ if ($result) {
|
|
|
+ $content = $result->__toString();
|
|
|
+ $codeResponse = 200;
|
|
|
+ } else {
|
|
|
+ $content = "No se pudo obtener el acceso cargado. Verifique por sistema si la carga se realizo correctamente.";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $content = "No se encontro la onu de id = " . $id;
|
|
|
+ }
|
|
|
+ } catch (Throwable $t) {
|
|
|
+ $content = $t->getCode() . " - " . $t->getMessage();
|
|
|
+ }
|
|
|
+ return new Response($content, $codeResponse);
|
|
|
+ });
|
|
|
+ }
|
|
|
public function getONUDisable(Application $app)
|
|
|
{
|
|
|
$app->get('/api/v1/ftth/onu/disable', function (Application $app, Request $request) {
|
|
@@ -1051,8 +1088,46 @@ class Services extends ApiServices
|
|
|
);
|
|
|
$ch = new Checks();
|
|
|
$id = $ch->integer($request, "id", true);
|
|
|
- $workflow = "administrative_state";
|
|
|
- $transition = "active_to_suspend";
|
|
|
+ $workflow = "onu_workflow_2";
|
|
|
+ $transition = "disable";
|
|
|
+ $apiInstance->setDisabledTenancy(true);
|
|
|
+ $result = $apiInstance->getById($id);
|
|
|
+ $apiInstance->setDisabledTenancy(false);
|
|
|
+ if (!is_null($result)) {
|
|
|
+ $apiInstance->apply($id, $workflow, $transition);
|
|
|
+ $apiInstance->setDisabledTenancy(true);
|
|
|
+ $result = $apiInstance->getById($id);
|
|
|
+ $apiInstance->setDisabledTenancy(false);
|
|
|
+ if ($result) {
|
|
|
+ $content = $result->__toString();
|
|
|
+ $codeResponse = 200;
|
|
|
+ } else {
|
|
|
+ $content = "No se pudo obtener el acceso cargado. Verifique por sistema si la carga se realizo correctamente.";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $content = "No se encontro la onu de id = " . $id;
|
|
|
+ }
|
|
|
+ } catch (Throwable $t) {
|
|
|
+ $content = $t->getCode() . " - " . $t->getMessage();
|
|
|
+ }
|
|
|
+ return new Response($content, $codeResponse);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getONUEnable(Application $app)
|
|
|
+ {
|
|
|
+ $app->get('/api/v1/ftth/onu/enable', function (Application $app, Request $request) {
|
|
|
+ $codeResponse = 400;
|
|
|
+ try {
|
|
|
+ $config = $this->setUserPasswordConfig($request, Configuration::getDefaultConfiguration());
|
|
|
+ $apiInstance = new ONUApi(
|
|
|
+ new Client(),
|
|
|
+ $config
|
|
|
+ );
|
|
|
+ $ch = new Checks();
|
|
|
+ $id = $ch->integer($request, "id", true);
|
|
|
+ $workflow = "onu_workflow_2";
|
|
|
+ $transition = "active";
|
|
|
$apiInstance->setDisabledTenancy(true);
|
|
|
$result = $apiInstance->getById($id);
|
|
|
$apiInstance->setDisabledTenancy(false);
|