From 851bd25bee5c3a63592cd44dad304a8559072c6c Mon Sep 17 00:00:00 2001 From: rsarwad Date: Mon, 23 Dec 2019 09:52:58 +0530 Subject: [PATCH 01/26] Removal of un-used s1ap-deregister req to nas task --- .../c/oai/common/itti_free_defined_msg.c | 1 - lte/gateway/c/oai/include/s1ap_messages_def.h | 5 ---- .../c/oai/include/s1ap_messages_types.h | 5 ---- lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c | 27 ------------------- .../c/oai/tasks/nas/emm/sap/emm_cnDef.h | 1 - lte/gateway/c/oai/tasks/nas/emm/sap/emm_sap.h | 5 ++-- lte/gateway/c/oai/tasks/nas/nas_mme_task.c | 4 --- lte/gateway/c/oai/tasks/nas/nas_proc.c | 13 --------- lte/gateway/c/oai/tasks/nas/nas_proc.h | 1 - 9 files changed, 2 insertions(+), 60 deletions(-) diff --git a/lte/gateway/c/oai/common/itti_free_defined_msg.c b/lte/gateway/c/oai/common/itti_free_defined_msg.c index 6b68403755e4..91243885d2c8 100644 --- a/lte/gateway/c/oai/common/itti_free_defined_msg.c +++ b/lte/gateway/c/oai/common/itti_free_defined_msg.c @@ -153,7 +153,6 @@ void itti_free_msg_content(MessageDef* const message_p) case S1AP_UE_CAPABILITIES_IND: case S1AP_ENB_DEREGISTERED_IND: - case S1AP_DEREGISTER_UE_REQ: case S1AP_UE_CONTEXT_RELEASE_REQ: case S1AP_UE_CONTEXT_RELEASE_COMMAND: case S1AP_UE_CONTEXT_RELEASE_COMPLETE: diff --git a/lte/gateway/c/oai/include/s1ap_messages_def.h b/lte/gateway/c/oai/include/s1ap_messages_def.h index 5ebe337a1a5e..a64491f6c65f 100644 --- a/lte/gateway/c/oai/include/s1ap_messages_def.h +++ b/lte/gateway/c/oai/include/s1ap_messages_def.h @@ -106,11 +106,6 @@ MESSAGE_DEF( MESSAGE_PRIORITY_MED, itti_s1ap_eNB_deregistered_ind_t, s1ap_eNB_deregistered_ind) -MESSAGE_DEF( - S1AP_DEREGISTER_UE_REQ, - MESSAGE_PRIORITY_MED, - itti_s1ap_deregister_ue_req_t, - s1ap_deregister_ue_req) MESSAGE_DEF( S1AP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, diff --git a/lte/gateway/c/oai/include/s1ap_messages_types.h b/lte/gateway/c/oai/include/s1ap_messages_types.h index 5fb4ea3ced35..a91ccb8a3a66 100644 --- a/lte/gateway/c/oai/include/s1ap_messages_types.h +++ b/lte/gateway/c/oai/include/s1ap_messages_types.h @@ -50,7 +50,6 @@ (mSGpTR)->ittiMsg.s1ap_enb_initiated_reset_req #define S1AP_ENB_INITIATED_RESET_ACK(mSGpTR) \ (mSGpTR)->ittiMsg.s1ap_enb_initiated_reset_ack -#define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req #define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) \ (mSGpTR)->ittiMsg.s1ap_ue_context_release_req #define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) \ @@ -149,10 +148,6 @@ typedef struct itti_s1ap_eNB_deregistered_ind_s { uint32_t enb_id; } itti_s1ap_eNB_deregistered_ind_t; -typedef struct itti_s1ap_deregister_ue_req_s { - mme_ue_s1ap_id_t mme_ue_s1ap_id; -} itti_s1ap_deregister_ue_req_t; - typedef enum s1ap_reset_type_e { RESET_ALL = 0, RESET_PARTIAL diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c index e36c2a908ece..d704165e90f3 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c @@ -104,7 +104,6 @@ extern int emm_cn_wrapper_attach_accept(emm_context_t *emm_context); static int _emm_cn_authentication_res(emm_cn_auth_res_t *const msg); static int _emm_cn_authentication_fail(const emm_cn_auth_fail_t *msg); -static int _emm_cn_deregister_ue(const mme_ue_s1ap_id_t ue_id); static int _emm_cn_ula_success(emm_cn_ula_success_t *msg_pP); static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t *msg_pP); @@ -114,7 +113,6 @@ static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t *msg_pP); static const char *_emm_cn_primitive_str[] = { "EMM_CN_AUTHENTICATION_PARAM_RES", "EMM_CN_AUTHENTICATION_PARAM_FAIL", - "EMM_CN_DEREGISTER_UE", "EMM_CN_ULA_SUCCESS", "EMM_CN_CS_RESPONSE_SUCCESS", "EMM_CN_ULA_OR_CSRSP_FAIL", @@ -213,27 +211,6 @@ static int _emm_cn_smc_fail(const emm_cn_smc_fail_t *msg) OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } -//------------------------------------------------------------------------------ -static int _emm_cn_deregister_ue(const mme_ue_s1ap_id_t ue_id) -{ - int rc = RETURNok; - - OAILOG_FUNC_IN(LOG_NAS_EMM); - OAILOG_WARNING( - LOG_NAS_EMM, - "EMM-PROC - " - "TODO deregister UE " MME_UE_S1AP_ID_FMT - ", following procedure is a test\n", - ue_id); - emm_detach_request_ies_t params = {0}; - params.type = EMM_DETACH_TYPE_EPS; - params.switch_off = false; - params.is_native_sc = false; - params.ksi = 0; - increment_counter("ue_detach", 1, 1, "cause", "deregister_ue"); - emm_proc_detach_request(ue_id, ¶ms); - OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); -} //------------------------------------------------------------------------------ void _handle_apn_mismatch(ue_mm_context_t *const ue_context) { @@ -1270,10 +1247,6 @@ int emm_cn_send(const emm_cn_t *msg) rc = _emm_cn_authentication_fail(msg->u.auth_fail); break; - case EMMCN_DEREGISTER_UE: - rc = _emm_cn_deregister_ue(msg->u.deregister.ue_id); - break; - case EMMCN_ULA_SUCCESS: rc = _emm_cn_ula_success(msg->u.emm_cn_ula_success); break; diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cnDef.h b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cnDef.h index 00102e8feb2b..b45e9849ac90 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cnDef.h +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cnDef.h @@ -50,7 +50,6 @@ typedef enum emmcn_primitive_s { _EMMCN_START = 400, _EMMCN_AUTHENTICATION_PARAM_RES, _EMMCN_AUTHENTICATION_PARAM_FAIL, - _EMMCN_DEREGISTER_UE, _EMMCN_ULA_SUCCESS, _EMMCN_CS_RESPONSE_SUCCESS, _EMMCN_ULA_OR_CSRSP_FAIL, diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_sap.h b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_sap.h index 00375b8eb2ad..616a1fb928ec 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_sap.h +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_sap.h @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -113,7 +113,6 @@ typedef enum { EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES, EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL, - EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE, EMMCN_ULA_SUCCESS = _EMMCN_ULA_SUCCESS, EMMCN_CS_RESPONSE_SUCCESS = _EMMCN_CS_RESPONSE_SUCCESS, EMMCN_ULA_OR_CSRSP_FAIL = _EMMCN_ULA_OR_CSRSP_FAIL, diff --git a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c index 8be300db55ed..c7f274fa5e20 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c +++ b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c @@ -57,10 +57,6 @@ static void *nas_intertask_interface(void *args_p) OAI_FPRINTF_INFO("TASK_NAS_MME received MESSAGE_TEST\n"); } break; - case S1AP_DEREGISTER_UE_REQ: { - nas_proc_deregister_ue( - S1AP_DEREGISTER_UE_REQ(received_message_p).mme_ue_s1ap_id); - } break; case TERMINATE_MESSAGE: { put_mme_nas_state(&mme_app_desc_p); diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.c b/lte/gateway/c/oai/tasks/nas/nas_proc.c index 10e870da7f72..6f2c02dc170b 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.c +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.c @@ -488,19 +488,6 @@ int nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, nas_cause_t cause) OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } -//------------------------------------------------------------------------------ -int nas_proc_deregister_ue(mme_ue_s1ap_id_t ue_id) -{ - int rc = RETURNerror; - emm_sap_t emm_sap = {0}; - - OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_sap.primitive = EMMCN_DEREGISTER_UE; - emm_sap.u.emm_cn.u.deregister.ue_id = ue_id; - rc = emm_sap_send(&emm_sap); - OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); -} - //------------------------------------------------------------------------------ int nas_proc_ula_success(mme_ue_s1ap_id_t ue_id) { diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.h b/lte/gateway/c/oai/tasks/nas/nas_proc.h index 5a5fc8e5b3f8..ed7e9fd3e870 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.h +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.h @@ -125,7 +125,6 @@ int nas_proc_auth_param_res( uint8_t nb_vectors, eutran_vector_t *vectors); int nas_proc_auth_param_fail(mme_ue_s1ap_id_t ue_id, nas_cause_t cause); -int nas_proc_deregister_ue(uint32_t ue_id); int nas_proc_ula_success(mme_ue_s1ap_id_t ue_id); int nas_proc_cs_respose_success( emm_cn_cs_response_success_t* nas_cs_response_success); From 68d92f3b279a184f68814b2d9531bf83ca2bc864 Mon Sep 17 00:00:00 2001 From: rsarwad Date: Thu, 26 Dec 2019 18:12:07 +0530 Subject: [PATCH 02/26] As part of lockless changes 1. Removed the lock on ue context 2. Modified the mme app timers similar to nas timers 3. Removed the nas task --- .../c/oai/common/itti_free_defined_msg.c | 4 - lte/gateway/c/oai/include/messages_def.h | 1 - lte/gateway/c/oai/include/messages_types.h | 1 - .../c/oai/include/mme_app_messages_types.h | 1 + .../c/oai/include/mme_app_ue_context.h | 8 - lte/gateway/c/oai/include/nas_messages_def.h | 45 --- .../c/oai/include/nas_messages_types.h | 99 ------ lte/gateway/c/oai/oai_mme/CMakeLists.txt | 1 - lte/gateway/c/oai/oai_mme/oai_mme.c | 2 - .../c/oai/tasks/mme_app/mme_app_bearer.c | 301 +++++++++------- .../oai/tasks/mme_app/mme_app_capabilities.c | 1 - .../c/oai/tasks/mme_app/mme_app_context.c | 335 +++++++----------- .../c/oai/tasks/mme_app/mme_app_defs.h | 28 +- .../c/oai/tasks/mme_app/mme_app_detach.c | 3 - .../tasks/mme_app/mme_app_itti_messaging.c | 30 +- .../tasks/mme_app/mme_app_itti_messaging.h | 30 +- .../c/oai/tasks/mme_app/mme_app_location.c | 31 +- .../c/oai/tasks/mme_app/mme_app_main.c | 87 +---- .../c/oai/tasks/mme_app/mme_app_purge_ue.c | 7 +- .../c/oai/tasks/mme_app/mme_app_sgs_alert.c | 31 +- .../c/oai/tasks/mme_app/mme_app_sgs_detach.c | 258 ++++++++++---- .../c/oai/tasks/mme_app/mme_app_sgs_paging.c | 13 +- .../c/oai/tasks/mme_app/mme_app_sgsap.c | 3 - .../mme_app/mme_app_sgsap_location_update.c | 95 +++-- .../mme_app/mme_app_sgsap_service_abort.c | 18 +- .../tasks/mme_app/mme_app_state_converter.cpp | 1 - .../c/oai/tasks/mme_app/mme_app_transport.c | 6 +- lte/gateway/c/oai/tasks/nas/CMakeLists.txt | 1 - lte/gateway/c/oai/tasks/nas/api/mme/mme_api.c | 6 +- lte/gateway/c/oai/tasks/nas/api/mme/mme_api.h | 2 +- lte/gateway/c/oai/tasks/nas/emm/Attach.c | 9 - .../c/oai/tasks/nas/emm/Authentication.c | 73 +++- lte/gateway/c/oai/tasks/nas/emm/Detach.c | 14 +- .../c/oai/tasks/nas/emm/EmmStatusHdl.c | 1 - .../c/oai/tasks/nas/emm/Identification.c | 20 +- lte/gateway/c/oai/tasks/nas/emm/LowerLayer.c | 8 - .../c/oai/tasks/nas/emm/NasTransportHdl.c | 1 - .../c/oai/tasks/nas/emm/SecurityModeControl.c | 5 - .../c/oai/tasks/nas/emm/ServiceRequestHdl.c | 9 - .../c/oai/tasks/nas/emm/TrackingAreaUpdate.c | 12 - lte/gateway/c/oai/tasks/nas/emm/emm_data.h | 1 - .../c/oai/tasks/nas/emm/emm_data_ctx.c | 10 - lte/gateway/c/oai/tasks/nas/emm/emm_main.c | 6 +- lte/gateway/c/oai/tasks/nas/emm/emm_main.h | 2 +- lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c | 31 -- lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c | 23 -- .../c/oai/tasks/nas/emm/sap/emm_recv.c | 1 - .../c/oai/tasks/nas/emm/sap/emm_send.c | 6 - .../esm/DedicatedEpsBearerContextActivation.c | 1 - .../nas/esm/EpsBearerContextDeactivation.c | 3 - .../c/oai/tasks/nas/esm/sap/esm_recv.c | 3 - lte/gateway/c/oai/tasks/nas/nas_defs.h | 27 -- .../c/oai/tasks/nas/nas_itti_messaging.c | 113 ------ .../c/oai/tasks/nas/nas_itti_messaging.h | 58 --- lte/gateway/c/oai/tasks/nas/nas_mme_task.c | 120 ------- lte/gateway/c/oai/tasks/nas/nas_network.c | 6 +- lte/gateway/c/oai/tasks/nas/nas_network.h | 6 +- lte/gateway/c/oai/tasks/nas/nas_proc.c | 6 +- lte/gateway/c/oai/tasks/nas/nas_proc.h | 3 +- lte/gateway/c/oai/tasks/nas/nas_procedures.c | 1 - lte/gateway/c/oai/tasks/nas/util/nas_timer.c | 14 +- lte/gateway/c/oai/tasks/nas/util/nas_timer.h | 6 +- lte/gateway/c/oai/tasks/s6a/s6a_auth_info.c | 6 +- 63 files changed, 761 insertions(+), 1293 deletions(-) delete mode 100644 lte/gateway/c/oai/include/nas_messages_def.h delete mode 100644 lte/gateway/c/oai/include/nas_messages_types.h delete mode 100644 lte/gateway/c/oai/tasks/nas/nas_defs.h delete mode 100644 lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c delete mode 100644 lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h delete mode 100644 lte/gateway/c/oai/tasks/nas/nas_mme_task.c diff --git a/lte/gateway/c/oai/common/itti_free_defined_msg.c b/lte/gateway/c/oai/common/itti_free_defined_msg.c index 91243885d2c8..cdafa650327d 100644 --- a/lte/gateway/c/oai/common/itti_free_defined_msg.c +++ b/lte/gateway/c/oai/common/itti_free_defined_msg.c @@ -35,7 +35,6 @@ #include "itti_free_defined_msg.h" #include "async_system_messages_types.h" #include "ip_forward_messages_types.h" -#include "nas_messages_types.h" #include "s11_messages_types.h" #include "sctp_messages_types.h" @@ -100,9 +99,6 @@ void itti_free_msg_content(MessageDef* const message_p) "TODO clean pointer"); break; - case NAS_AUTHENTICATION_PARAM_REQ: - break; - case S11_CREATE_SESSION_REQUEST: { // DO nothing } break; diff --git a/lte/gateway/c/oai/include/messages_def.h b/lte/gateway/c/oai/include/messages_def.h index 591d8db09fb0..a570d86c451a 100644 --- a/lte/gateway/c/oai/include/messages_def.h +++ b/lte/gateway/c/oai/include/messages_def.h @@ -33,7 +33,6 @@ // Messages files used between tasks #include "gtpv1_u_messages_def.h" #include "ip_forward_messages_def.h" -#include "nas_messages_def.h" #include "s11_messages_def.h" #include "s1ap_messages_def.h" #include "s6a_messages_def.h" diff --git a/lte/gateway/c/oai/include/messages_types.h b/lte/gateway/c/oai/include/messages_types.h index aa5c22c422fc..7689e31d74b6 100644 --- a/lte/gateway/c/oai/include/messages_types.h +++ b/lte/gateway/c/oai/include/messages_types.h @@ -40,7 +40,6 @@ #include "s11_messages_types.h" #include "s5_messages_types.h" #include "s1ap_messages_types.h" -#include "nas_messages_types.h" #include "s6a_messages_types.h" #include "sctp_messages_types.h" #include "sgw_messages_types.h" diff --git a/lte/gateway/c/oai/include/mme_app_messages_types.h b/lte/gateway/c/oai/include/mme_app_messages_types.h index 524413f85cab..aef0c8a10a59 100644 --- a/lte/gateway/c/oai/include/mme_app_messages_types.h +++ b/lte/gateway/c/oai/include/mme_app_messages_types.h @@ -43,6 +43,7 @@ #include "3gpp_36.401.h" #include "common_types.h" #include "nas/securityDef.h" +#include "nas/as_message.h" #define MME_APP_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) \ (mSGpTR)->ittiMsg.mme_app_connection_establishment_cnf diff --git a/lte/gateway/c/oai/include/mme_app_ue_context.h b/lte/gateway/c/oai/include/mme_app_ue_context.h index 2cbc29a6dff5..5796571526ae 100644 --- a/lte/gateway/c/oai/include/mme_app_ue_context.h +++ b/lte/gateway/c/oai/include/mme_app_ue_context.h @@ -44,7 +44,6 @@ #include "common_types.h" #include "common_defs.h" #include "s1ap_messages_types.h" -#include "nas_messages_types.h" #include "s6a_messages_types.h" #include "security_types.h" #include "sgw_ie_defs.h" @@ -358,9 +357,6 @@ typedef struct sgs_context_s { * according to 3GPP TS.23.401 #5.7.2 */ typedef struct ue_mm_context_s { - /* mutex on the ue_mm_context_t + emm_context_s + esm_context_t */ - pthread_mutex_t recmutex; - /* msisdn: The basic MSISDN of the UE. The presence is dictated by its storage * in the HSS, set by S6A UPDATE LOCATION ANSWER */ @@ -602,10 +598,6 @@ void mme_remove_ue_context( mme_ue_context_t *const mme_ue_context, struct ue_mm_context_s *const ue_context_p); -int lock_ue_contexts(ue_mm_context_t *const ue_context_p); - -int unlock_ue_contexts(ue_mm_context_t *const ue_context_p); - /** \brief Allocate memory for a new UE context * @returns Pointer to the new structure, NULL if allocation failed **/ diff --git a/lte/gateway/c/oai/include/nas_messages_def.h b/lte/gateway/c/oai/include/nas_messages_def.h deleted file mode 100644 index 56f825b62cb6..000000000000 --- a/lte/gateway/c/oai/include/nas_messages_def.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ -//WARNING: Do not include this header directly. Use intertask_interface.h instead. - -/*! \file nas_messages_def.h - \brief - \author Sebastien ROUX, Lionel Gauthier - \company Eurecom - \email: lionel.gauthier@eurecom.fr -*/ - -//MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, itti_nas_rab_rel_req_t, nas_rab_rel_req) - -/* NAS layer -> MME app messages */ -MESSAGE_DEF( - NAS_AUTHENTICATION_PARAM_REQ, - MESSAGE_PRIORITY_MED, - itti_nas_auth_param_req_t, - nas_auth_param_req) diff --git a/lte/gateway/c/oai/include/nas_messages_types.h b/lte/gateway/c/oai/include/nas_messages_types.h deleted file mode 100644 index e94025bfbf05..000000000000 --- a/lte/gateway/c/oai/include/nas_messages_types.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2015, EURECOM (www.eurecom.fr) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. - */ - -/*! \file nas_messages_types.h - \brief - \author Sebastien ROUX, Lionel Gauthier - \company Eurecom - \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef FILE_NAS_MESSAGES_TYPES_SEEN -#define FILE_NAS_MESSAGES_TYPES_SEEN - -#include - -#include "3gpp_23.003.h" -#include "3gpp_29.274.h" -#include "nas/as_message.h" -#include "common_ies.h" -#include "nas/networkDef.h" - -#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param -#define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req -#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_auth_param_req -#define NAS_DATA_LENGHT_MAX 256 - -typedef struct itti_nas_info_transfer_s { - mme_ue_s1ap_id_t ue_id; /* UE lower layer identifier */ - //nas_error_code_t err_code; /* Transaction status */ - bstring nas_msg; /* Uplink NAS message */ -} itti_nas_info_transfer_t; - -typedef struct itti_nas_attach_req_s { - /* TODO: Set the correct size */ - char apn[100]; - char imsi[16]; -#define INITIAL_REQUEST (0x1) - unsigned initial : 1; - s1ap_initial_ue_message_t transparent; -} itti_nas_attach_req_t; - -typedef struct itti_nas_auth_req_s { - /* UE imsi */ - char imsi[16]; - -#define NAS_FAILURE_OK 0x0 -#define NAS_FAILURE_IND 0x1 - unsigned failure : 1; - int cause; -} itti_nas_auth_req_t; - -typedef struct itti_nas_auth_rsp_s { - char imsi[16]; -} itti_nas_auth_rsp_t; - -typedef struct itti_nas_auth_param_req_s { - /* UE identifier */ - mme_ue_s1ap_id_t ue_id; - - /* Imsi of the UE (In case of initial request) */ - char imsi[16]; - uint8_t imsi_length; - - /* Indicates whether the procedure corresponds to a new connection or not */ - uint8_t initial_req : 1; - - uint8_t re_synchronization : 1; - uint8_t auts[14]; - uint8_t num_vectors; -} itti_nas_auth_param_req_t; - -#endif /* FILE_NAS_MESSAGES_TYPES_SEEN */ diff --git a/lte/gateway/c/oai/oai_mme/CMakeLists.txt b/lte/gateway/c/oai/oai_mme/CMakeLists.txt index 3a77bf35eee1..c72613bba307 100644 --- a/lte/gateway/c/oai/oai_mme/CMakeLists.txt +++ b/lte/gateway/c/oai/oai_mme/CMakeLists.txt @@ -34,7 +34,6 @@ add_executable(mme ${PROJECT_SOURCE_DIR}/oai_mme/oai_mme.c ${PROJECT_SOURCE_DIR}/common/common_types.c ${PROJECT_SOURCE_DIR}/common/itti_free_defined_msg.c - ${PROJECT_SOURCE_DIR}/tasks/nas/nas_mme_task.c ${PROJECT_SOURCE_DIR}/tasks/service303/service303_task.c ${PROJECT_SOURCE_DIR}/tasks/service303/service303_mme_stats.c ${PROJECT_SOURCE_DIR}/tasks/grpc_service/grpc_service_task.c diff --git a/lte/gateway/c/oai/oai_mme/oai_mme.c b/lte/gateway/c/oai/oai_mme/oai_mme.c index 6e79054f4719..34eb0c7099af 100644 --- a/lte/gateway/c/oai/oai_mme/oai_mme.c +++ b/lte/gateway/c/oai/oai_mme/oai_mme.c @@ -39,7 +39,6 @@ #include "sctp_primitives_server.h" #include "s1ap_mme.h" #include "mme_app_extern.h" -#include "nas_defs.h" /* FreeDiameter headers for support of S6A interface */ #include "s6a_defs.h" #include "sgs_defs.h" @@ -101,7 +100,6 @@ int main(int argc, char *argv[]) send_app_health_to_service303(TASK_MME_APP, false); CHECK_INIT_RETURN(mme_app_init(&mme_config)); - CHECK_INIT_RETURN(nas_init(&mme_config)); CHECK_INIT_RETURN(sctp_init(&mme_config)); #if EMBEDDED_SGW CHECK_INIT_RETURN(sgw_init(&spgw_config, mme_config.use_stateless)); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c index c8dc0b8382ce..c4361c583a50 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c @@ -70,7 +70,6 @@ #include "mme_api.h" #include "mme_app_state.h" #include "mme_app_messages_types.h" -#include "nas_messages_types.h" #include "s11_messages_types.h" #include "s1ap_messages_types.h" #include "nas/securityDef.h" @@ -243,7 +242,6 @@ void mme_app_handle_conn_est_cnf(nas_establish_rsp_t* const nas_conn_est_cnf_p) mme_app_handle_nw_initiated_detach_request( ue_context_p->mme_ue_s1ap_id, SGS_INITIATED_IMSI_DETACH); ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE; - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } } @@ -430,16 +428,20 @@ void mme_app_handle_conn_est_cnf(nas_establish_rsp_t* const nas_conn_est_cnf_p) * If timer expires treat this as failure of ongoing procedure and abort corresponding NAS procedure such as ATTACH * or SERVICE REQUEST. Send UE context release command to eNB */ - if ( - timer_setup( - ue_context_p->initial_context_setup_rsp_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void *) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->initial_context_setup_rsp_timer.id)) < 0) { + nas_itti_timer_arg_t timer_callback_fun = {0}; + timer_callback_fun.nas_timer_callback = + mme_app_handle_initial_context_setup_rsp_timer_expiry; + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); + if (timer_setup( + ue_context_p->initial_context_setup_rsp_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->initial_context_setup_rsp_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start initial context setup response timer for UE id %d \n", @@ -453,7 +455,6 @@ void mme_app_handle_conn_est_cnf(nas_establish_rsp_t* const nas_conn_est_cnf_p) "for UE id %d \n", ue_context_p->mme_ue_s1ap_id); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -586,21 +587,6 @@ void mme_app_handle_initial_ue_message(mme_app_desc_t *mme_app_desc_p, DevMessage("mme_create_new_ue_context"); OAILOG_FUNC_OUT(LOG_MME_APP); } - // Initialize timers to INVALID IDs - ue_context_p->mobile_reachability_timer.id = MME_APP_TIMER_INACTIVE_ID; - ue_context_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; - ue_context_p->initial_context_setup_rsp_timer.id = - MME_APP_TIMER_INACTIVE_ID; - ue_context_p->initial_context_setup_rsp_timer.sec = - MME_APP_INITIAL_CONTEXT_SETUP_RSP_TIMER_VALUE; - ue_context_p->paging_response_timer.id = MME_APP_TIMER_INACTIVE_ID; - ue_context_p->paging_response_timer.sec = - MME_APP_PAGING_RESPONSE_TIMER_VALUE; - ue_context_p->ulr_response_timer.id = MME_APP_TIMER_INACTIVE_ID; - ue_context_p->ulr_response_timer.sec = MME_APP_ULR_RESPONSE_TIMER_VALUE; - ue_context_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; - ue_context_p->ue_context_modification_timer.sec = - MME_APP_UE_CONTEXT_MODIFICATION_TIMER_VALUE; is_mm_ctx_new = true; // Allocate new mme_ue_s1ap_id ue_context_p->mme_ue_s1ap_id = mme_app_ctx_get_new_ue_id(); @@ -661,8 +647,6 @@ void mme_app_handle_initial_ue_message(mme_app_desc_t *mme_app_desc_p, initial_pP->nas = NULL; - unlock_ue_contexts(ue_context_p); - OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -707,7 +691,6 @@ void mme_app_handle_erab_setup_req( OAILOG_WARNING( LOG_MME_APP, "Failed to allocate the memory for s1ap erab set request message\n"); - unlock_ue_contexts(ue_context_p); bdestroy_wrapper(&nas_msg); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -763,7 +746,6 @@ void mme_app_handle_erab_setup_req( ebi); bdestroy_wrapper(&nas_msg); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -830,8 +812,6 @@ void mme_app_handle_delete_session_rsp( ue_context_p->mme_ue_s1ap_id, pdn_disconnect_rsp.lbi); } - - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -863,9 +843,7 @@ void mme_app_handle_delete_session_rsp( "Deleting UE context associated in MME for " "mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT "\n ", ue_context_p->mme_ue_s1ap_id); - unlock_ue_contexts(ue_context_p); mme_remove_ue_context(&mme_app_desc_p->mme_ue_contexts, ue_context_p); - // return now, otherwize will unlock ue context already free OAILOG_FUNC_OUT(LOG_MME_APP); } else { if (ue_context_p->ue_context_rel_cause == S1AP_INVALID_CAUSE) { @@ -895,8 +873,6 @@ void mme_app_handle_delete_session_rsp( ue_context_p->ue_context_rel_cause = S1AP_INVALID_CAUSE; } } - - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -971,7 +947,6 @@ int mme_app_handle_create_sess_resp( bearer_id, transaction_identifier); rc = nas_proc_ula_or_csrsp_fail(&create_session_response_fail); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } increment_counter("mme_spgw_create_session_rsp", 1, 1, "result", "success"); @@ -1112,7 +1087,6 @@ int mme_app_handle_create_sess_resp( } nas_proc_cs_respose_success(&nas_pdn_cs_respose_success); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -1252,8 +1226,6 @@ void mme_app_handle_initial_context_setup_rsp(mme_app_desc_t *mme_app_desc_p, ue_context_p->sgs_context->mt_call_in_progress = false; } } - - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -1292,7 +1264,6 @@ void mme_app_handle_release_access_bearers_resp(mme_app_desc_t *mme_app_desc_p, &mme_app_desc_p->mme_ue_contexts, ue_context_p, ECM_IDLE); ue_context_p->ue_context_rel_cause = S1AP_INVALID_CAUSE; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -1328,7 +1299,6 @@ void mme_app_handle_s11_create_bearer_req( " of ue_id: " MME_UE_S1AP_ID_FMT "\n", linked_eps_bearer_id, ue_context_p->mme_ue_s1ap_id); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -1395,7 +1365,6 @@ void mme_app_handle_s11_create_bearer_req( free_wrapper((void **) &activate_ded_bearer_req.tft); free_wrapper((void **) &activate_ded_bearer_req.pco); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -1543,43 +1512,58 @@ void mme_app_handle_e_rab_setup_rsp( // not send S11 response // TODO create a procedure with bearers to receive a response from NAS } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ -void mme_app_handle_mobile_reachability_timer_expiry( - struct ue_mm_context_s *ue_context_p) +void mme_app_handle_mobile_reachability_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Mobile Reachability Timer expired, but no assoicated UE context found" + " for ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } ue_context_p->mobile_reachability_timer.id = MME_APP_TIMER_INACTIVE_ID; OAILOG_INFO( LOG_MME_APP, - "Expired- Mobile Reachability Timer for UE id %d \n", + "Expired- Mobile Reachability Timer for ue_id:" MME_UE_S1AP_ID_FMT " \n", ue_context_p->mme_ue_s1ap_id); - //Set PPF flag to false - ue_context_p->ppf = false; // Start Implicit Detach timer - if ( - timer_setup( - ue_context_p->implicit_detach_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void *) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->implicit_detach_timer.id)) < 0) { + nas_itti_timer_arg_t timer_callback_fun = {0}; + timer_callback_fun.nas_timer_callback = + mme_app_handle_implicit_detach_timer_expiry; + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); + if (timer_setup( + ue_context_p->implicit_detach_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->implicit_detach_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, - "Failed to start Implicit Detach timer for UE id %d \n", + "Failed to start Implicit Detach timer for UE id: " MME_UE_S1AP_ID_FMT + "\n", ue_context_p->mme_ue_s1ap_id); ue_context_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; } else { OAILOG_DEBUG( LOG_MME_APP, - "Started Implicit Detach timer for UE id %d \n", + "Started Implicit Detach timer for UE id: " MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); } /* PPF is set to false due to "Inactivity of UE including non reception of periodic TAU @@ -1589,32 +1573,61 @@ void mme_app_handle_mobile_reachability_timer_expiry( OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ -void mme_app_handle_implicit_detach_timer_expiry( - struct ue_mm_context_s *ue_context_p) +void mme_app_handle_implicit_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Implicit Detach Timer expired, but no assoicated UE context for" + "ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + OAILOG_INFO( LOG_MME_APP, "Implicit Detach timer expired for UE id" MME_UE_S1AP_ID_FMT "\n", - ue_context_p->mme_ue_s1ap_id); + mme_ue_s1ap_id); ue_context_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; // Initiate Implicit Detach for the UE - nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id); + nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ -void mme_app_handle_initial_context_setup_rsp_timer_expiry( - struct ue_mm_context_s *ue_context_p) +void mme_app_handle_initial_context_setup_rsp_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); - OAILOG_INFO( + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Initial context setup rsp Timer expired, but no assoicated UE context found" + " for ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + + + OAILOG_ERROR( LOG_MME_APP, "Expired- Initial context setup rsp timer for UE id %d \n", - ue_context_p->mme_ue_s1ap_id); + mme_ue_s1ap_id); ue_context_p->initial_context_setup_rsp_timer.id = MME_APP_TIMER_INACTIVE_ID; /* *********Abort the ongoing procedure********* * Check if UE is registered already that implies service request procedure is active. If so then release the S1AP @@ -1624,7 +1637,7 @@ void mme_app_handle_initial_context_setup_rsp_timer_expiry( ue_context_p->ue_context_rel_cause = S1AP_INITIAL_CONTEXT_SETUP_TMR_EXPRD; if (ue_context_p->mm_state == UE_UNREGISTERED) { // Initiate Implicit Detach for the UE - nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id); + nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id); increment_counter( "ue_attach", 1, @@ -1721,7 +1734,6 @@ void mme_app_handle_initial_context_setup_failure( INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED); } } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ @@ -1841,7 +1853,6 @@ int mme_app_paging_request_helper( LOG_MME_APP, "Paging process attempted for connected UE with id %d\n", ue_context_p->mme_ue_s1ap_id); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } message_p = itti_alloc_new_message(TASK_MME_APP, S1AP_PAGING_REQUEST); @@ -1849,7 +1860,6 @@ int mme_app_paging_request_helper( OAILOG_ERROR( LOG_MME_APP, "Failed to allocate the memory for paging request message\n"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } itti_s1ap_paging_request_t *paging_request = @@ -1889,17 +1899,21 @@ int mme_app_paging_request_helper( rc = itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); if (!set_timer) { - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } + nas_itti_timer_arg_t timer_callback_fun = {0}; + timer_callback_fun.nas_timer_callback = + (void *) mme_app_handle_paging_timer_expiry; + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); int timer_rc = timer_setup( ue_context_p->paging_response_timer.sec, 0, TASK_MME_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - (void *) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), + &timer_callback_fun, + sizeof(timer_callback_fun), &(ue_context_p->paging_response_timer.id)); if (timer_rc < 0) { OAILOG_ERROR( @@ -1907,7 +1921,6 @@ int mme_app_paging_request_helper( "Failed to start paging timer for ue %d\n", ue_context_p->mme_ue_s1ap_id); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, timer_rc); } @@ -1930,21 +1943,64 @@ int mme_app_handle_initial_paging_request(mme_app_desc_t *mme_app_desc_p, ue_context_p, true, true /* s-tmsi */, CN_DOMAIN_PS); } -int mme_app_handle_paging_timer_expiry(ue_mm_context_t *ue_context_p) +void mme_app_handle_paging_timer_expiry(void* args) { + OAILOG_FUNC_IN(LOG_MME_APP); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Paging Timer expired, but no assoicated UE context found" + " for ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + + OAILOG_ERROR( + LOG_MME_APP, + "Paging Timer expired for ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + ue_context_p->paging_response_timer.id = MME_APP_TIMER_INACTIVE_ID; - return mme_app_paging_request_helper( - ue_context_p, false, true /* s-tmsi */, CN_DOMAIN_PS); + if ((mme_app_paging_request_helper( + ue_context_p, false, true /* s-tmsi */, CN_DOMAIN_PS)) != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send Paging Message for ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + } + OAILOG_FUNC_OUT(LOG_MME_APP); } -void mme_app_handle_ulr_timer_expiry(ue_mm_context_t* ue_context_p) +void mme_app_handle_ulr_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Update Location Timer expired, but no assoicated UE context found" + " for ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } OAILOG_ERROR( LOG_MME_APP, "Update Location Timer expired for ue-id" MME_UE_S1AP_ID_FMT "\n", - ue_context_p->mme_ue_s1ap_id); + mme_ue_s1ap_id); ue_context_p->ulr_response_timer.id = MME_APP_TIMER_INACTIVE_ID; // Send PDN CONNECTIVITY FAIL message to NAS layer @@ -2085,7 +2141,6 @@ int mme_app_handle_nas_extended_service_req( "ue_context %d, %d\n", ue_id, ue_context_p->mme_ue_s1ap_id); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } } else { @@ -2173,35 +2228,24 @@ int mme_app_handle_nas_extended_service_req( */ rc = emm_proc_service_reject(ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE); - if (RETURNok == rc) { - OAILOG_INFO( - LOG_MME_APP, - "Send Service Reject because MT_CALL_CANCEL is set by network" - "for ue-id:" MME_UE_S1AP_ID_FMT "\n", - ue_id); - } else { - OAILOG_ERROR( - LOG_MME_APP, - "Failed to send Service Reject for ue-id:%u \n", - ue_id); - } } else if (ue_context_p->ecm_state == ECM_CONNECTED) { rc = emm_send_service_reject_in_dl_nas(ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE); - if (RETURNok == rc) { - OAILOG_INFO( - LOG_MME_APP, - "Send Service Reject because MT_CALL_CANCEL is set by network" - "for ue-id:" MME_UE_S1AP_ID_FMT "\n", - ue_id); - } else { - OAILOG_ERROR( - LOG_MME_APP, - "Failed to send Service Reject for ue-id:" - MME_UE_S1AP_ID_FMT" \n", - ue_id); - } } + if (RETURNok == rc) { + OAILOG_INFO( + LOG_MME_APP, + "Send Service Reject because MT_CALL_CANCEL is set by network" + "for ue-id:" MME_UE_S1AP_ID_FMT "\n", + ue_id); + } else { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send Service Reject for ue-id:" + MME_UE_S1AP_ID_FMT" \n", + ue_id); + } + //Reset call_cancelled flag ue_context_p->sgs_context->call_cancelled = false; OAILOG_WARNING( @@ -2249,21 +2293,33 @@ int mme_app_handle_nas_extended_service_req( "ERROR***** Invalid Service Type Received %d\n", service_type); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } //------------------------------------------------------------------------------ -void mme_app_handle_ue_context_modification_timer_expiry( - struct ue_mm_context_s *ue_context_p) +void mme_app_handle_ue_context_modification_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s* ue_context_p = NULL; - OAILOG_INFO( + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "UE context modification Timer expired, but no assoicated UE context " + "found for ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + + OAILOG_ERROR( LOG_MME_APP, "Expired- UE context modification timer for UE id %d \n", - ue_context_p->mme_ue_s1ap_id); + mme_ue_s1ap_id); ue_context_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; if (ue_context_p->sgs_context != NULL) { @@ -2529,7 +2585,6 @@ void mme_app_handle_modify_ue_ambr_request(mme_app_desc_t *mme_app_desc_p, for UE id %d\n", ue_context_p->mme_ue_s1ap_id); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2613,7 +2668,6 @@ void mme_app_handle_nw_init_ded_bearer_actv_req( free_wrapper((void **) &activate_ded_bearer_req.tft); free_wrapper((void **) &activate_ded_bearer_req.pco); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2796,7 +2850,6 @@ void mme_app_handle_nw_init_bearer_deactv_req( REQUEST_ACCEPTED); } } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2983,7 +3036,6 @@ void mme_app_handle_path_switch_request(mme_app_desc_t *mme_app_desc_p, itti_send_msg_to_task(TASK_SPGW, INSTANCE_DEFAULT, message_p); ue_context_p->path_switch_req = true; - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -3008,7 +3060,6 @@ void mme_app_handle_erab_rel_cmd( "UE context doesn't exist for ue_id " MME_UE_S1AP_ID_FMT "\n", ue_id); bdestroy_wrapper(&nas_msg); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -3021,7 +3072,6 @@ void mme_app_handle_erab_rel_cmd( ue_id, ebi); bdestroy_wrapper(&nas_msg); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -3074,7 +3124,6 @@ void mme_app_handle_erab_rel_cmd( ebi); itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_capabilities.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_capabilities.c index cdb1b1fabb19..aae9a3ec0d66 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_capabilities.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_capabilities.c @@ -70,6 +70,5 @@ int mme_app_handle_s1ap_ue_capabilities_ind(mme_app_desc_t *mme_app_desc_p, "UE radio capabilities of length %d found and cached\n", blength(ue_context_p->ue_radio_capability)); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c index 522eb5e71402..2484bc904709 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c @@ -72,7 +72,6 @@ #include "itti_types.h" #include "mme_api.h" #include "mme_app_state.h" -#include "nas_messages_types.h" #include "nas_timer.h" #include "obj_hashtable.h" #include "s1ap_messages_types.h" @@ -124,110 +123,15 @@ static void _directoryd_remove_location(uint64_t imsi, uint8_t imsi_len) imsi); } -//------------------------------------------------------------------------------ -int lock_ue_contexts(ue_mm_context_t *const ue_mm_context) -{ - OAILOG_FUNC_IN(LOG_MME_APP); - int rc = RETURNerror; - if (ue_mm_context) { - struct timeval start_time; - gettimeofday(&start_time, NULL); - struct timespec wait = {0}; // timed is useful for debug - wait.tv_sec = start_time.tv_sec + 5; - wait.tv_nsec = start_time.tv_usec * 1000; - rc = pthread_mutex_timedlock(&ue_mm_context->recmutex, &wait); - if (rc) { - OAILOG_ERROR( - LOG_MME_APP, - "Cannot lock UE context mutex, err=%s " MME_UE_S1AP_ID_FMT "\n", - strerror(rc), - ue_mm_context->mme_ue_s1ap_id); -#if ASSERT_MUTEX - struct timeval end_time; - gettimeofday(&end_time, NULL); - AssertFatal( - !rc, - "Cannot lock UE context mutex, err=%s took %ld seconds \n", - strerror(rc), - end_time.tv_sec - start_time.tv_sec); -#endif - } else { - OAILOG_DEBUG( - LOG_MME_APP, - "Locked UE context mutex for " MME_UE_S1AP_ID_FMT "\n", - ue_mm_context->mme_ue_s1ap_id); -#if DEBUG_MUTEX - OAILOG_TRACE( - LOG_MME_APP, - "UE context mutex locked, count %d lock %d\n", - ue_mm_context->recmutex.__data.__count, - ue_mm_context->recmutex.__data.__lock); -#endif - } - } - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} -//------------------------------------------------------------------------------ -int unlock_ue_contexts(ue_mm_context_t *const ue_mm_context) -{ - OAILOG_FUNC_IN(LOG_MME_APP); - int rc = RETURNerror; - if (ue_mm_context) { - OAILOG_DEBUG( - LOG_MME_APP, - "Unlocking UE context mutex for " MME_UE_S1AP_ID_FMT "\n", - ue_mm_context->mme_ue_s1ap_id); - rc = pthread_mutex_unlock(&ue_mm_context->recmutex); - if (rc) { - OAILOG_ERROR( - LOG_MME_APP, "Cannot unlock UE context mutex, err=%s\n", strerror(rc)); - } -#if DEBUG_MUTEX - OAILOG_TRACE( - LOG_MME_APP, - "UE context mutex unlocked, count %d lock %d\n", - ue_mm_context->recmutex.__data.__count, - ue_mm_context->recmutex.__data.__lock); -#endif - } - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} //------------------------------------------------------------------------------ // warning: lock the UE context -ue_mm_context_t *mme_create_new_ue_context(void) +ue_mm_context_t* mme_create_new_ue_context(void) { - ue_mm_context_t *new_p = calloc(1, sizeof(ue_mm_context_t)); - pthread_mutexattr_t mutexattr = {0}; - int rc = pthread_mutexattr_init(&mutexattr); - if (rc) { - OAILOG_ERROR( - LOG_MME_APP, - "Cannot create UE context, failed to init mutex attribute: %s\n", - strerror(rc)); - return NULL; - } - rc = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); - if (rc) { - OAILOG_ERROR( - LOG_MME_APP, - "Cannot create UE context, failed to set mutex attribute type: %s\n", - strerror(rc)); - return NULL; - } - rc = pthread_mutex_init(&new_p->recmutex, &mutexattr); - if (rc) { + ue_mm_context_t* new_p = calloc(1, sizeof(ue_mm_context_t)); + if (!new_p) { OAILOG_ERROR( LOG_MME_APP, - "Cannot create UE context, failed to init mutex: %s\n", - strerror(rc)); - return NULL; - } - rc = lock_ue_contexts(new_p); - if (rc) { - OAILOG_ERROR( - LOG_MME_APP, - "Cannot create UE context, failed to lock mutex: %s\n", - strerror(rc)); + "Failed to allocate memory for UE context \n"); return NULL; } @@ -240,6 +144,16 @@ ue_mm_context_t *mme_create_new_ue_context(void) new_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; new_p->initial_context_setup_rsp_timer.id = MME_APP_TIMER_INACTIVE_ID; + new_p->initial_context_setup_rsp_timer.sec = + MME_APP_INITIAL_CONTEXT_SETUP_RSP_TIMER_VALUE; + new_p->paging_response_timer.id = MME_APP_TIMER_INACTIVE_ID; + new_p->paging_response_timer.sec = MME_APP_PAGING_RESPONSE_TIMER_VALUE; + new_p->ulr_response_timer.id = MME_APP_TIMER_INACTIVE_ID; + new_p->ulr_response_timer.sec = MME_APP_ULR_RESPONSE_TIMER_VALUE; + new_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; + new_p->ue_context_modification_timer.sec = + MME_APP_UE_CONTEXT_MODIFICATION_TIMER_VALUE; + new_p->ue_context_rel_cause = S1AP_INVALID_CAUSE; new_p->send_ue_purge_request = false; new_p->hss_initiated_detach = false; @@ -458,7 +372,6 @@ ue_mm_context_t *mme_ue_context_exists_mme_ue_s1ap_id( (const hash_key_t) mme_ue_s1ap_id, (void **) &ue_context_p); if (ue_context_p) { - lock_ue_contexts(ue_context_p); OAILOG_TRACE( LOG_MME_APP, "UE " MME_UE_S1AP_ID_FMT " fetched MM state %s, ECM state %s\n ", @@ -962,107 +875,114 @@ void mme_remove_ue_context( OAILOG_FUNC_IN(LOG_MME_APP); hashtable_rc_t hash_rc = HASH_TABLE_OK; - DevAssert(mme_ue_context_p); - DevAssert(ue_context_p); - - if (!lock_ue_contexts(ue_context_p)) { - // Release emm and esm context - _clear_emm_ctxt(&ue_context_p->emm_context); - mme_app_ue_context_free_content(ue_context_p); - // IMSI - if (ue_context_p->emm_context._imsi64) { - hash_rc = hashtable_uint64_ts_remove( - mme_ue_context_p->imsi_ue_context_htbl, - (const hash_key_t) ue_context_p->emm_context._imsi64); - if (HASH_TABLE_OK != hash_rc) - OAILOG_ERROR( - LOG_MME_APP, - "UE context not found!\n" - " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ", IMSI " IMSI_64_FMT - " not in IMSI collection\n", - ue_context_p->enb_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id, - ue_context_p->emm_context._imsi64); - } + if (!mme_ue_context_p) { + OAILOG_ERROR( + LOG_MME_APP, + "mme_ue_context_p is NULL !! \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (!ue_context_p) { + OAILOG_ERROR( + LOG_MME_APP, + "ue_context_p is NULL !! \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } - // eNB UE S1P UE ID + // Release emm and esm context + _clear_emm_ctxt(&ue_context_p->emm_context); + mme_app_ue_context_free_content(ue_context_p); + // IMSI + if (ue_context_p->emm_context._imsi64) { hash_rc = hashtable_uint64_ts_remove( - mme_ue_context_p->enb_ue_s1ap_id_ue_context_htbl, - (const hash_key_t) ue_context_p->enb_s1ap_id_key); + mme_ue_context_p->imsi_ue_context_htbl, + (const hash_key_t) ue_context_p->emm_context._imsi64); if (HASH_TABLE_OK != hash_rc) OAILOG_ERROR( LOG_MME_APP, "UE context not found!\n" " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT - ", ENB_UE_S1AP_ID not in ENB_UE_S1AP_ID collection", + " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ", IMSI " IMSI_64_FMT + " not in IMSI collection\n", ue_context_p->enb_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); + ue_context_p->mme_ue_s1ap_id, + ue_context_p->emm_context._imsi64); + } - // filled S11 tun id - if (ue_context_p->mme_teid_s11) { - hash_rc = hashtable_uint64_ts_remove( - mme_ue_context_p->tun11_ue_context_htbl, - (const hash_key_t) ue_context_p->mme_teid_s11); - if (HASH_TABLE_OK != hash_rc) - OAILOG_ERROR( - LOG_MME_APP, - "UE Context not found!\n" - " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ", MME S11 TEID " TEID_FMT - " not in S11 collection\n", - ue_context_p->enb_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id, - ue_context_p->mme_teid_s11); - } - // filled guti - if ( - (ue_context_p->emm_context._guti.gummei.mme_code) || - (ue_context_p->emm_context._guti.gummei.mme_gid) || - (ue_context_p->emm_context._guti.m_tmsi) || - (ue_context_p->emm_context._guti.gummei.plmn.mcc_digit1) || - (ue_context_p->emm_context._guti.gummei.plmn.mcc_digit2) || - (ue_context_p->emm_context._guti.gummei.plmn - .mcc_digit3)) { // MCC 000 does not exist in ITU table - hash_rc = obj_hashtable_uint64_ts_remove( - mme_ue_context_p->guti_ue_context_htbl, - (const void *const) & ue_context_p->emm_context._guti, - sizeof(ue_context_p->emm_context._guti)); - if (HASH_TABLE_OK != hash_rc) - OAILOG_ERROR( - LOG_MME_APP, - "UE Context not found!\n" - " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT - ", GUTI not in GUTI collection\n", - ue_context_p->enb_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); - } + // eNB UE S1P UE ID + hash_rc = hashtable_uint64_ts_remove( + mme_ue_context_p->enb_ue_s1ap_id_ue_context_htbl, + (const hash_key_t) ue_context_p->enb_s1ap_id_key); + if (HASH_TABLE_OK != hash_rc) + OAILOG_ERROR( + LOG_MME_APP, + "UE context not found!\n" + " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT + ", ENB_UE_S1AP_ID not in ENB_UE_S1AP_ID collection", + ue_context_p->enb_ue_s1ap_id, + ue_context_p->mme_ue_s1ap_id); - // filled NAS UE ID/ MME UE S1AP ID - if (INVALID_MME_UE_S1AP_ID != ue_context_p->mme_ue_s1ap_id) { - hash_rc = hashtable_ts_remove( - mme_ue_context_p->mme_ue_s1ap_id_ue_context_htbl, - (const hash_key_t) ue_context_p->mme_ue_s1ap_id, - (void **) &ue_context_p); - if (HASH_TABLE_OK != hash_rc) - OAILOG_ERROR( - LOG_MME_APP, - "UE context not found!\n" - " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT - ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT - " not in MME UE S1AP ID collection", - ue_context_p->enb_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); - } + // filled S11 tun id + if (ue_context_p->mme_teid_s11) { + hash_rc = hashtable_uint64_ts_remove( + mme_ue_context_p->tun11_ue_context_htbl, + (const hash_key_t) ue_context_p->mme_teid_s11); + if (HASH_TABLE_OK != hash_rc) + OAILOG_ERROR( + LOG_MME_APP, + "UE Context not found!\n" + " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT ", MME S11 TEID " TEID_FMT + " not in S11 collection\n", + ue_context_p->enb_ue_s1ap_id, + ue_context_p->mme_ue_s1ap_id, + ue_context_p->mme_teid_s11); + } + // filled guti + if ( + (ue_context_p->emm_context._guti.gummei.mme_code) || + (ue_context_p->emm_context._guti.gummei.mme_gid) || + (ue_context_p->emm_context._guti.m_tmsi) || + (ue_context_p->emm_context._guti.gummei.plmn.mcc_digit1) || + (ue_context_p->emm_context._guti.gummei.plmn.mcc_digit2) || + (ue_context_p->emm_context._guti.gummei.plmn + .mcc_digit3)) { // MCC 000 does not exist in ITU table + hash_rc = obj_hashtable_uint64_ts_remove( + mme_ue_context_p->guti_ue_context_htbl, + (const void *const) & ue_context_p->emm_context._guti, + sizeof(ue_context_p->emm_context._guti)); + if (HASH_TABLE_OK != hash_rc) + OAILOG_ERROR( + LOG_MME_APP, + "UE Context not found!\n" + " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT + ", GUTI not in GUTI collection\n", + ue_context_p->enb_ue_s1ap_id, + ue_context_p->mme_ue_s1ap_id); + } - _directoryd_remove_location( - ue_context_p->emm_context._imsi64, - ue_context_p->emm_context._imsi.length); - unlock_ue_contexts(ue_context_p); - free_wrapper((void **) &ue_context_p); + // filled NAS UE ID/ MME UE S1AP ID + if (INVALID_MME_UE_S1AP_ID != ue_context_p->mme_ue_s1ap_id) { + hash_rc = hashtable_ts_remove( + mme_ue_context_p->mme_ue_s1ap_id_ue_context_htbl, + (const hash_key_t) ue_context_p->mme_ue_s1ap_id, + (void **) &ue_context_p); + if (HASH_TABLE_OK != hash_rc) + OAILOG_ERROR( + LOG_MME_APP, + "UE context not found!\n" + " enb_ue_s1ap_id " ENB_UE_S1AP_ID_FMT + ", mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT + " not in MME UE S1AP ID collection", + ue_context_p->enb_ue_s1ap_id, + ue_context_p->mme_ue_s1ap_id); } + + _directoryd_remove_location( + ue_context_p->emm_context._imsi64, + ue_context_p->emm_context._imsi.length); + free_wrapper((void **) &ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -1719,16 +1639,20 @@ void mme_ue_context_update_ue_sig_connection_state( if (mme_config.nas_config.t3412_min > 0) { // Start Mobile reachability timer only if peroidic TAU timer is not disabled - if ( - timer_setup( - ue_context_p->mobile_reachability_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void *) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->mobile_reachability_timer.id)) < 0) { + nas_itti_timer_arg_t timer_callback_arg = {0}; + timer_callback_arg.nas_timer_callback = + mme_app_handle_mobile_reachability_timer_expiry; + timer_callback_arg.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); + if (timer_setup( + ue_context_p->mobile_reachability_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_arg, + sizeof(timer_callback_arg), + &(ue_context_p->mobile_reachability_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start Mobile Reachability timer for UE id " @@ -2101,7 +2025,6 @@ void mme_app_handle_s1ap_ue_context_modification_resp( ue_context_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ @@ -2221,7 +2144,6 @@ void mme_app_handle_s1ap_ue_context_release_complete( } mme_remove_ue_context(&mme_app_desc_p->mme_ue_contexts, ue_context_p); update_mme_app_stats_connected_ue_sub(); - // return here avoid unlock_ue_contexts() OAILOG_FUNC_OUT(LOG_MME_APP); } else { // Send a DELETE_SESSION_REQUEST message to the SGW @@ -2241,7 +2163,6 @@ void mme_app_handle_s1ap_ue_context_release_complete( mme_ue_context_update_ue_sig_connection_state( &mme_app_desc_p->mme_ue_contexts, ue_context_p, ECM_IDLE); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2285,7 +2206,6 @@ void mme_ue_context_update_ue_emm_state( "UE STATE - UNREGISTERED. IMSI = " IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2356,7 +2276,6 @@ static void _mme_app_handle_s1ap_ue_context_release( " mme_ue_s1ap_id " MME_UE_S1AP_ID_FMT " Action--- Ignore the message\n", ue_mm_context->enb_ue_s1ap_id, ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_OUT(LOG_MME_APP); } else { // This case could happen during sctp reset, while attach procedure is ongoing and ue is in ECM_CONNECTED @@ -2434,7 +2353,6 @@ static void _mme_app_handle_s1ap_ue_context_release( } } } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2479,7 +2397,6 @@ void mme_ue_context_update_ue_sgs_vlr_reliable( (ue_context_p->sgs_context->vlr_reliable != vlr_reliable)) { ue_context_p->sgs_context->vlr_reliable = vlr_reliable; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2505,7 +2422,6 @@ bool mme_ue_context_get_ue_sgs_vlr_reliable( (ue_context_p->sgs_context->vlr_reliable == true)) { vlr_reliable = true; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, vlr_reliable); } @@ -2530,7 +2446,6 @@ void mme_ue_context_update_ue_sgs_neaf( (ue_context_p->sgs_context) && (ue_context_p->sgs_context->neaf != neaf)) { ue_context_p->sgs_context->neaf = neaf; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_OUT(LOG_MME_APP); } @@ -2552,10 +2467,8 @@ bool mme_ue_context_get_ue_sgs_neaf( if ( (ue_context_p->sgs_context) && (ue_context_p->sgs_context->neaf == true)) { OAILOG_ERROR(LOG_MME_APP, "In MME APP NEAF is set to True\n"); - unlock_ue_contexts(ue_context_p); return true; } else { - unlock_ue_contexts(ue_context_p); return false; } } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h index 5eb3d28ae59a..66d2ca750f6a 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h @@ -109,9 +109,6 @@ void mme_app_handle_release_access_bearers_resp(mme_app_desc_t *mme_app_desc_p, void mme_app_handle_s11_create_bearer_req(mme_app_desc_t *mme_app_desc_p, const itti_s11_create_bearer_request_t *const create_bearer_request_pP); -void mme_app_handle_nas_auth_param_req( - const itti_nas_auth_param_req_t *const nas_auth_param_req_pP); - void mme_app_handle_initial_context_setup_rsp(mme_app_desc_t *mme_app_desc_p, itti_mme_app_initial_context_setup_rsp_t *const initial_ctxt_setup_rsp_pP); @@ -148,16 +145,15 @@ void mme_ue_context_update_ue_sig_connection_state( ecm_state_t new_ecm_state); void mme_app_handle_mobile_reachability_timer_expiry( - struct ue_mm_context_s *ue_context_p); + void *args); void mme_app_handle_implicit_detach_timer_expiry( - struct ue_mm_context_s *ue_context_p); + void *args); void mme_app_handle_initial_context_setup_rsp_timer_expiry( - struct ue_mm_context_s *ue_context_p); + void *args); -void mme_app_handle_ue_context_modification_timer_expiry( - struct ue_mm_context_s *ue_context_p); +void mme_app_handle_ue_context_modification_timer_expiry(void *args); void mme_app_handle_enb_reset_req( const itti_s1ap_enb_initiated_reset_req_t const *enb_reset_req); @@ -165,15 +161,13 @@ void mme_app_handle_enb_reset_req( int mme_app_handle_initial_paging_request(mme_app_desc_t *mme_app_desc_p, const char *imsi); -int mme_app_handle_paging_timer_expiry(ue_mm_context_t *ue_context_p); -void mme_app_handle_ulr_timer_expiry(ue_mm_context_t *ue_context_p); +void mme_app_handle_paging_timer_expiry(void *args); +void mme_app_handle_ulr_timer_expiry(void *args); -void mme_app_handle_sgs_eps_detach_timer_expiry(ue_mm_context_t *ue_context_p); -void mme_app_handle_sgs_imsi_detach_timer_expiry(ue_mm_context_t *ue_context_p); -void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry( - ue_mm_context_t *ue_context_p); -void mme_app_handle_sgs_implicit_eps_detach_timer_expiry( - ue_mm_context_t *ue_context_p); +void mme_app_handle_sgs_eps_detach_timer_expiry(void *args); +void mme_app_handle_sgs_imsi_detach_timer_expiry(void *args); +void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(void *args); +void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void *args); int mme_app_send_s6a_cancel_location_ans( int cla_result, @@ -217,7 +211,7 @@ int send_itti_sgsap_location_update_req(ue_mm_context_t *ue_context); int mme_app_handle_sgsap_location_update_rej(mme_app_desc_t *mme_app_desc_p, itti_sgsap_location_update_rej_t *const itti_sgsap_location_update_rej); -void mme_app_handle_ts6_1_timer_expiry(struct ue_mm_context_s *ue_context_p); +void mme_app_handle_ts6_1_timer_expiry(void * args); int mme_app_handle_sgsap_reset_indication(mme_app_desc_t *mme_app_desc_p, itti_sgsap_vlr_reset_indication_t *const reset_indication_pP); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_detach.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_detach.c index 7782bd8ebf23..868534b0d1e2 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_detach.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_detach.c @@ -46,7 +46,6 @@ #include "mme_app_state.h" #include "emm_cnDef.h" #include "nas_proc.h" -#include "nas_messages_types.h" #include "s11_messages_types.h" #include "s1ap_messages_types.h" #include "service303.h" @@ -168,7 +167,6 @@ void mme_app_handle_detach_req(const mme_ue_s1ap_id_t ue_id) mme_remove_ue_context(&mme_app_desc_p->mme_ue_contexts, ue_context_p); } else { ue_context_p->ue_context_rel_cause = S1AP_INVALID_CAUSE; - unlock_ue_contexts(ue_context_p); } } } else { @@ -179,7 +177,6 @@ void mme_app_handle_detach_req(const mme_ue_s1ap_id_t ue_id) ue_context_p, ue_context_p->pdn_contexts[i]->default_ebi, i); } } - unlock_ue_contexts(ue_context_p); } OAILOG_FUNC_OUT(LOG_MME_APP); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c index 2ae6ce7a90fd..a477a04ad7c4 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c @@ -161,7 +161,8 @@ int mme_app_send_s11_release_access_bearers_req( ** description: Send itti mesage to SPGW task to send Create Session ** ** Request (CSR) ** ** ** - ** inputs: ue_context_p: Pointer to UE context ** + ** inputs: mme_app_desc_p: Pointer to structure, mme_app_desc_t ** + ** ue_mm_context: Pointer to ue_mm_context_s ** ** pdn_index: PDN index for which CSR is initiated ** ** ** ** outputs: ** @@ -180,9 +181,13 @@ int mme_app_send_s11_create_session_req( */ MessageDef* message_p = NULL; itti_s11_create_session_request_t* session_request_p = NULL; - int rc = RETURNok; - DevAssert(ue_mm_context); + if (!ue_mm_context) { + OAILOG_ERROR( + LOG_MME_APP, + "ue_mm_context is NULL \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } OAILOG_DEBUG( LOG_MME_APP, "Handling imsi " IMSI_64_FMT "\n", @@ -192,8 +197,10 @@ int mme_app_send_s11_create_session_req( * HSS rejected the bearer creation or roaming is not allowed for this * UE. This result will trigger an ESM Failure message sent to UE. */ - DevMessage( + OAILOG_ERROR( + LOG_MME_APP, "Not implemented: ACCESS NOT GRANTED, send ESM Failure to NAS\n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } message_p = itti_alloc_new_message(TASK_MME_APP, S11_CREATE_SESSION_REQUEST); @@ -369,10 +376,19 @@ int mme_app_send_s11_create_session_req( session_request_p->selection_mode = MS_O_N_P_APN_S_V; OAILOG_INFO( TASK_MME_APP, - "Sending S11 CREATE SESSION REQ message to SPGW for (ue_id = %u)\n", + "Sending S11 CREATE SESSION REQ message to SPGW for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_mm_context->mme_ue_s1ap_id); - rc = itti_send_msg_to_task(TASK_SPGW, INSTANCE_DEFAULT, message_p); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + if ((itti_send_msg_to_task(TASK_SPGW, INSTANCE_DEFAULT, message_p)) != + RETURNok) { + OAILOG_ERROR( + TASK_MME_APP, + "Failed to send S11 CREATE SESSION REQ message to SPGW for ue_id " + MME_UE_S1AP_ID_FMT "\n", + ue_mm_context->mme_ue_s1ap_id); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /**************************************************************************** diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h index 3d8ebf6229e5..ebd982931ddd 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h @@ -42,6 +42,7 @@ #include "mme_app_desc.h" #include "mme_app_ue_context.h" #include "s1ap_messages_types.h" +#include "mme_app_defs.h" void mme_app_itti_ue_context_release( struct ue_mm_context_s *ue_context_p, @@ -55,7 +56,7 @@ int mme_app_send_s11_create_session_req(mme_app_desc_t *mme_app_desc_p, const pdn_cid_t pdn_cid); static inline void mme_app_itti_ue_context_mod_for_csfb( - struct ue_mm_context_s *ue_context_p) + struct ue_mm_context_s* ue_context_p) { MessageDef *message_p; @@ -96,19 +97,24 @@ static inline void mme_app_itti_ue_context_mod_for_csfb( itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); /* Start timer to wait for UE Context Modification from eNB - * If timer expires treat this as failure of ongoing procedure and abort corresponding NAS procedure + * If timer expires treat this as failure of ongoing procedure + * and abort corresponding NAS procedure * such as SERVICE REQUEST and Send Service Reject to eNB */ - if ( - timer_setup( - ue_context_p->ue_context_modification_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void *) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->ue_context_modification_timer.id)) < 0) { + nas_itti_timer_arg_t timer_callback_fun = {0}; + timer_callback_fun.nas_timer_callback = + mme_app_handle_ue_context_modification_timer_expiry; + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); + if (timer_setup( + ue_context_p->ue_context_modification_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->ue_context_modification_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start UE context modification timer for UE id %d \n", diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_location.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_location.c index 01f74f344745..f0719e2e22e4 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_location.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_location.c @@ -51,7 +51,6 @@ #include "intertask_interface_types.h" #include "itti_types.h" #include "mme_app_desc.h" -#include "nas_messages_types.h" #include "s6a_messages_types.h" #include "service303.h" #include "sgs_messages_types.h" @@ -150,16 +149,18 @@ int mme_app_send_s6a_update_location_req( */ if (ue_context_p->location_info_confirmed_in_hss == false) { // Start ULR Response timer - if ( - timer_setup( - ue_context_p->ulr_response_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->ulr_response_timer.id)) < 0) { + nas_itti_timer_arg_t timer_callback_fun = {0}; + timer_callback_fun.nas_timer_callback = mme_app_handle_ulr_timer_expiry; + timer_callback_fun.nas_timer_callback_arg = (void *) &(ue_context_p->mme_ue_s1ap_id); + if (timer_setup( + ue_context_p->ulr_response_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->ulr_response_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start Update location update response timer for UE id %d " @@ -243,7 +244,6 @@ int mme_app_handle_s6a_update_location_ans( LOG_MME_APP, "Failed to handle Un-successful ULA message for ue_id (%u)\n", ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } } @@ -261,14 +261,12 @@ int mme_app_handle_s6a_update_location_ans( LOG_MME_APP, "Sent PDN Connectivity failure to NAS for ue_id (%u)\n", ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } else { OAILOG_ERROR( LOG_MME_APP, "Failed to send PDN Connectivity failure to NAS for ue_id (%u)\n", ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } } @@ -353,7 +351,6 @@ int mme_app_handle_s6a_update_location_ans( } rc = nas_proc_ula_success(ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -401,7 +398,6 @@ int mme_app_handle_s6a_cancel_location_req( "imsi " IMSI_64_FMT "\n", clr_pP->cancellation_type, imsi); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } /* @@ -423,7 +419,6 @@ int mme_app_handle_s6a_cancel_location_req( ue_context_p, true, false /* s-tmsi */, CN_DOMAIN_PS); // Set the flag and send detach to UE after receiving service req ue_context_p->emm_context.nw_init_bearer_deactv = true; - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } else { // Send N/W Initiated Detach Request to NAS module @@ -441,7 +436,6 @@ int mme_app_handle_s6a_cancel_location_req( "Failed to handle network initiated Detach Request in nas module for " "ue-id: " MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } else { // Send SGS explicit network initiated Detach Ind to SGS @@ -451,7 +445,6 @@ int mme_app_handle_s6a_cancel_location_req( } } } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c index a15652b93ceb..58a88cb8403f 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c @@ -39,6 +39,7 @@ #include "intertask_interface.h" #include "itti_free_defined_msg.h" #include "mme_config.h" +#include "nas_network.h" #include "timer.h" #include "mme_app_extern.h" #include "mme_app_ue_context.h" @@ -56,7 +57,6 @@ #include "itti_types.h" #include "mme_app_messages_types.h" #include "mme_app_state.h" -#include "nas_messages_types.h" #include "obj_hashtable.h" #include "s11_messages_types.h" #include "s1ap_messages_types.h" @@ -159,8 +159,6 @@ void *mme_app_thread(void *args) ue_context_p); ue_context_p->path_switch_req = false; } - - unlock_ue_contexts(ue_context_p); } } break; @@ -243,82 +241,9 @@ void *mme_app_thread(void *args) mme_app_desc_p->statistic_timer_id) { mme_app_statistics_display(); } else if (received_message_p->ittiMsg.timer_has_expired.arg != NULL) { - mme_ue_s1ap_id_t mme_ue_s1ap_id = - *((mme_ue_s1ap_id_t *) (received_message_p->ittiMsg - .timer_has_expired.arg)); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); - if (ue_context_p == NULL) { - OAILOG_WARNING( - LOG_MME_APP, - "Timer expired but no assoicated UE context for UE " - "id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); - timer_handle_expired( - received_message_p->ittiMsg.timer_has_expired.timer_id); - break; - } - if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->mobile_reachability_timer.id) { - // Mobile Reachability Timer expiry handler - mme_app_handle_mobile_reachability_timer_expiry(ue_context_p); - } else if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->implicit_detach_timer.id) { - // Implicit Detach Timer expiry handler - increment_counter("implicit_detach_timer_expired", 1, NO_LABELS); - mme_app_handle_implicit_detach_timer_expiry(ue_context_p); - } else if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->initial_context_setup_rsp_timer.id) { - // Initial Context Setup Rsp Timer expiry handler - increment_counter( - "initial_context_setup_request_timer_expired", 1, NO_LABELS); - mme_app_handle_initial_context_setup_rsp_timer_expiry(ue_context_p); - } else if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->paging_response_timer.id) { - mme_app_handle_paging_timer_expiry(ue_context_p); - } else if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->ulr_response_timer.id) { - mme_app_handle_ulr_timer_expiry(ue_context_p); - } else if ( - received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->ue_context_modification_timer.id) { - // UE Context modification Timer expiry handler - increment_counter( - "ue_context_modification_timer expired", 1, NO_LABELS); - mme_app_handle_ue_context_modification_timer_expiry(ue_context_p); - } else if (ue_context_p->sgs_context != NULL){ - if (received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->sgs_context->ts6_1_timer.id) { - mme_app_handle_ts6_1_timer_expiry(ue_context_p); - } else if (received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->sgs_context->ts8_timer.id) { - mme_app_handle_sgs_eps_detach_timer_expiry(ue_context_p); - } else if (received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->sgs_context->ts9_timer.id) { - mme_app_handle_sgs_imsi_detach_timer_expiry(ue_context_p); - } else if (received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->sgs_context->ts10_timer.id) { - mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(ue_context_p); - } else if (received_message_p->ittiMsg.timer_has_expired.timer_id == - ue_context_p->sgs_context->ts13_timer.id) { - mme_app_handle_sgs_implicit_eps_detach_timer_expiry(ue_context_p); - } - } - else { - OAILOG_WARNING( - LOG_MME_APP, - "Timer expired but no associated timer_id for UE " - "id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); - } - if (ue_context_p) { - unlock_ue_contexts(ue_context_p); - } + mme_app_nas_timer_handle_signal_expiry( + TIMER_HAS_EXPIRED(received_message_p).timer_id, + TIMER_HAS_EXPIRED(received_message_p).arg); } timer_handle_expired( received_message_p->ittiMsg.timer_has_expired.timer_id); @@ -535,6 +460,8 @@ int mme_app_init(const mme_config_t *mme_config_p) if (mme_app_edns_init(mme_config_p)) { OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } + // Initialise NAS module + nas_network_initialize(mme_config_p); /* * Create the thread associated with MME applicative layer */ @@ -564,5 +491,7 @@ void mme_app_exit(void) { mme_app_edns_exit(); clear_mme_nas_state(); + // Clean-up NAS module + nas_network_cleanup(); mme_config_exit(); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_purge_ue.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_purge_ue.c index ba6a9b29985f..fa942e8d8f79 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_purge_ue.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_purge_ue.c @@ -66,9 +66,11 @@ int mme_app_send_s6a_purge_ue_req(mme_app_desc_t *mme_app_desc_p, } message_p = itti_alloc_new_message(TASK_MME_APP, S6A_PURGE_UE_REQ); - if (message_p == NULL) { - unlock_ue_contexts(ue_context_p); + OAILOG_WARNING( + LOG_MME_APP, + "Failed to allocate memory for S6A_PURGE_UE_REQ for imsi " IMSI_64_FMT + "\n", imsi); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } @@ -82,7 +84,6 @@ int mme_app_send_s6a_purge_ue_req(mme_app_desc_t *mme_app_desc_p, rc = itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_alert.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_alert.c index 41e0003ed321..18e9a31f67ce 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_alert.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_alert.c @@ -48,7 +48,6 @@ #include "mme_config.h" #include "intertask_interface.h" #include "mme_app_sgs_fsm.h" -#include "assertions.h" #include "conversions.h" #include "mme_app_defs.h" #include "common_defs.h" @@ -82,7 +81,6 @@ static int _mme_app_send_sgsap_alert_ack( ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ - int mme_app_handle_sgsap_alert_request( mme_app_desc_t* mme_app_desc_p, itti_sgsap_alert_request_t* const sgsap_alert_req_pP) @@ -91,7 +89,12 @@ int mme_app_handle_sgsap_alert_request( struct ue_mm_context_s* ue_context_p = NULL; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(sgsap_alert_req_pP); + if (!sgsap_alert_req_pP) { + OAILOG_ERROR( + LOG_MME_APP, + "sgsap_alert_req_pP is NULL \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } IMSI_STRING_TO_IMSI64(sgsap_alert_req_pP->imsi, &imsi64); @@ -121,7 +124,6 @@ int mme_app_handle_sgsap_alert_request( sgsap_alert_req_pP, SGS_CAUSE_IMSI_DETACHED_FOR_EPS_SERVICE, imsi64); increment_counter( "sgsap_alert_reject", 1, 1, "cause", "ue_is_not_registered_to_eps"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } if (ue_context_p->sgs_context == NULL) { @@ -136,7 +138,6 @@ int mme_app_handle_sgsap_alert_request( ue_context_p->sgs_context->neaf = SET_NEAF; /* send Alert Ack */ _mme_app_send_sgsap_alert_ack(sgsap_alert_req_pP, imsi64); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } @@ -157,13 +158,20 @@ static int _mme_app_send_sgsap_alert_reject( SgsCause_t sgs_cause, uint64_t imsi64) { + OAILOG_FUNC_IN(LOG_MME_APP); int rc = RETURNerror; MessageDef* message_p = NULL; itti_sgsap_alert_reject_t* sgsap_alert_reject_pP = NULL; - OAILOG_FUNC_IN(LOG_MME_APP); message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_ALERT_REJECT); - AssertFatal(message_p, "itti_alloc_new_message Failed"); + if (!message_p) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_ALERT_REJECT for Imsi: " + IMSI_64_FMT "\n", + imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + } sgsap_alert_reject_pP = &message_p->ittiMsg.sgsap_alert_reject; memset((void*) sgsap_alert_reject_pP, 0, sizeof(itti_sgsap_alert_reject_t)); @@ -204,7 +212,14 @@ static int _mme_app_send_sgsap_alert_ack( OAILOG_FUNC_IN(LOG_MME_APP); message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_ALERT_ACK); - AssertFatal(message_p, "itti_alloc_new_message Failed"); + if (!message_p) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_ALERT_ACK for Imsi: " + IMSI_64_FMT "\n", + imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + } sgsap_alert_ack_pP = &message_p->ittiMsg.sgsap_alert_ack; memset((void*) sgsap_alert_ack_pP, 0, sizeof(itti_sgsap_alert_ack_t)); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c index 7fed6def9d5c..432404277d85 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c @@ -46,7 +46,7 @@ #include "intertask_interface_types.h" #include "itti_types.h" #include "log.h" -#include "mme_app_desc.h" +#include "mme_app_state.h" #include "mme_app_sgs_fsm.h" #include "s1ap_messages_types.h" #include "sgs_messages_types.h" @@ -68,11 +68,19 @@ static void mme_app_send_sgs_eps_detach_indication( OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_INFO( LOG_MME_APP, - "Send SGSAP_EPS_DETACH_IND to SGS, detach_type = (%d) for (ue_id = %u)\n", + "Send SGSAP_EPS_DETACH_IND to SGS, detach_type = %u for ue_id: " + MME_UE_S1AP_ID_FMT "\n", detach_type, ue_context_p->mme_ue_s1ap_id); message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_EPS_DETACH_IND); - AssertFatal(message_p, "itti_alloc_new_message Failed"); + if (!message_p) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_EPS_DETACH_IND for ue_id: " + MME_UE_S1AP_ID_FMT "\n", + ue_context_p->mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } memset( (void*) &message_p->ittiMsg.sgsap_eps_detach_ind, 0, @@ -89,51 +97,62 @@ static void mme_app_send_sgs_eps_detach_indication( itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); + nas_itti_timer_arg_t timer_callback_fun = {0}; + if (detach_type == SGS_NW_INITIATED_IMSI_DETACH_FROM_EPS) { + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_implicit_eps_detach_timer_expiry; + } else { + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_eps_detach_timer_expiry; + } + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); // Start SGS Implicit EPS Detach indication timer if (detach_type == SGS_NW_INITIATED_IMSI_DETACH_FROM_EPS) { - if ( - timer_setup( - ue_context_p->sgs_context->ts13_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->sgs_context->ts13_timer.id)) < 0) { + if (timer_setup( + ue_context_p->sgs_context->ts13_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->sgs_context->ts13_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, - "Failed to start SGS Implicit EPS Detach indication timer for UE id " - "%d \n", + "Failed to start SGS Implicit EPS Detach indication timer for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); ue_context_p->sgs_context->ts13_timer.id = MME_APP_TIMER_INACTIVE_ID; } else { OAILOG_DEBUG( LOG_MME_APP, - "Started SGS Implicit EPS Detach indication timer for UE id %d \n", + "Started SGS Implicit EPS Detach indication timer for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); } } else { // Start SGS EPS Detach indication timer - if ( - timer_setup( - ue_context_p->sgs_context->ts8_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->sgs_context->ts8_timer.id)) < 0) { + if (timer_setup( + ue_context_p->sgs_context->ts8_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->sgs_context->ts8_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, - "Failed to start SGS EPS Detach indication timer for UE id %d \n", + "Failed to start SGS EPS Detach indication timer for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); ue_context_p->sgs_context->ts8_timer.id = MME_APP_TIMER_INACTIVE_ID; } else { OAILOG_DEBUG( LOG_MME_APP, - "Started SGS EPS Detach indication timer for UE id %d \n", + "Started SGS EPS Detach indication timer for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); } @@ -143,7 +162,8 @@ static void mme_app_send_sgs_eps_detach_indication( if (timer_remove(ue_context_p->sgs_context->ts6_1_timer.id, NULL)) { OAILOG_ERROR( LOG_MME_APP, - "Failed to stop SGS Location Update Request timer for UE id %d \n", + "Failed to stop SGS Location Update Request timer for ue_id " + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); } ue_context_p->sgs_context->ts6_1_timer.id = MME_APP_TIMER_INACTIVE_ID; @@ -156,11 +176,32 @@ static void mme_app_send_sgs_eps_detach_indication( } /* handle the SGS EPS detach timer expiry. */ -void mme_app_handle_sgs_eps_detach_timer_expiry(ue_mm_context_t *ue_context_p) +void mme_app_handle_sgs_eps_detach_timer_expiry(void *args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(ue_context_p->sgs_context); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s *ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS EPS Detach Timer expired but no assoicated UE context for UE " + "id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (ue_context_p->sgs_context == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS EPS Detach Timer expired but no assoicated SGS context for UE " + "id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } /* * Increment the retransmission counter */ @@ -197,12 +238,32 @@ void mme_app_handle_sgs_eps_detach_timer_expiry(ue_mm_context_t *ue_context_p) } /* handle the SGS Implicit EPS detach timer expiry. */ -void mme_app_handle_sgs_implicit_eps_detach_timer_expiry( - ue_mm_context_t *ue_context_p) +void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(ue_context_p->sgs_context); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS IMPLICIT EPS DETACH Timer expired but no assoicated UE context " + "found for ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (ue_context_p->sgs_context == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS EPS Detach Timer expired but no assoicated SGS context for UE " + "id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } /* * Increment the retransmission counter */ @@ -247,11 +308,19 @@ void mme_app_send_sgs_imsi_detach_indication( OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_INFO( LOG_MME_APP, - "Send SGSAP_IMSI_DETACH_IND to SGS, detach_type = (%d) for (ue_id = %u)\n", + "Send SGSAP_IMSI_DETACH_IND to SGS, detach_type = %u for ue_id " + MME_UE_S1AP_ID_FMT "\n", detach_type, ue_context_p->mme_ue_s1ap_id); message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_IMSI_DETACH_IND); - AssertFatal(message_p, "itti_alloc_new_message Failed"); + if (!message_p) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_IMSI_DETACH_IND for ue_id: " + MME_UE_S1AP_ID_FMT "\n", + ue_context_p->mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } memset( (void*) &message_p->ittiMsg.sgsap_imsi_detach_ind, 0, @@ -265,18 +334,27 @@ void mme_app_send_sgs_imsi_detach_indication( SGSAP_IMSI_DETACH_IND(message_p).noneps_detach_type = detach_type; itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); + nas_itti_timer_arg_t timer_callback_fun = {0}; + if (detach_type == SGS_IMPLICIT_NW_INITIATED_IMSI_DETACH_FROM_EPS_N_NONEPS) { + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_implicit_imsi_detach_timer_expiry; + } else { + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_imsi_detach_timer_expiry; + } + timer_callback_fun.nas_timer_callback_arg = + (void *) &(ue_context_p->mme_ue_s1ap_id); if (detach_type == SGS_IMPLICIT_NW_INITIATED_IMSI_DETACH_FROM_EPS_N_NONEPS) { // Start SGS Implicit IMSI Detach indication timer - if ( - timer_setup( - ue_context_p->sgs_context->ts10_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->sgs_context->ts10_timer.id)) < 0) { + if (timer_setup( + ue_context_p->sgs_context->ts10_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->sgs_context->ts10_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start SGS Implicit IMSI Detach indication timer for UE id " @@ -291,16 +369,15 @@ void mme_app_send_sgs_imsi_detach_indication( } } else { // Start SGS IMSI Detach indication timer - if ( - timer_setup( - ue_context_p->sgs_context->ts9_timer.sec, - 0, - TASK_MME_APP, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), - &(ue_context_p->sgs_context->ts9_timer.id)) < 0) { + if (timer_setup( + ue_context_p->sgs_context->ts9_timer.sec, + 0, + TASK_MME_APP, + INSTANCE_DEFAULT, + TIMER_ONE_SHOT, + &timer_callback_fun, + sizeof(timer_callback_fun), + &(ue_context_p->sgs_context->ts9_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, "Failed to start SGS IMSI Detach indication timer for UE id %d \n", @@ -332,11 +409,32 @@ void mme_app_send_sgs_imsi_detach_indication( } /* handle the SGS IMSI detach timer expiry. */ -void mme_app_handle_sgs_imsi_detach_timer_expiry(ue_mm_context_t *ue_context_p) +void mme_app_handle_sgs_imsi_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(ue_context_p->sgs_context); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s *ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS IMSI Detach Timer expired but no assoicated UE context for UE " + "id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (ue_context_p->sgs_context == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS EPS Detach Timer expired but no assoicated SGS context for UE " + "id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } /* * Increment the retransmission counter */ @@ -396,12 +494,32 @@ void mme_app_handle_sgs_imsi_detach_timer_expiry(ue_mm_context_t *ue_context_p) } /* handle the SGS Implicit IMSI detach timer expiry. */ -void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry( - ue_mm_context_t *ue_context_p) +void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(ue_context_p->sgs_context); + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); + struct ue_mm_context_s *ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS IMPLICIT IMSI Detach Timer expired but no assoicated UE context for" + " ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (ue_context_p->sgs_context == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "SGS IMPLICIT IMSI Detach Timer expired but no assoicated SGS context for" + " ue_id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } /* * Increment the retransmission counter */ @@ -454,7 +572,7 @@ void mme_app_handle_sgs_detach_req( evnt.ue_id = ue_context_p->mme_ue_s1ap_id; evnt.ctx = ue_context_p->sgs_context; // check the SGS state and if it is null then do not send Detach towards SGS - OAILOG_DEBUG(LOG_MME_APP, "SGS Detach type = ( %d )\n", detach_type); + OAILOG_DEBUG(LOG_MME_APP, "SGS Detach type = ( %u )\n", detach_type); if (sgs_fsm_get_status(evnt.ue_id, evnt.ctx) != SGS_NULL) { switch (detach_type) { /* @@ -589,10 +707,8 @@ int mme_app_handle_sgs_eps_detach_ack( OAILOG_ERROR( LOG_MME_APP, "SGS context not found in mme_app_handle_sgs_eps_detach_ack\n"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } @@ -629,7 +745,8 @@ int mme_app_handle_sgs_imsi_detach_ack( if (timer_remove(ue_context_p->sgs_context->ts9_timer.id, NULL)) { OAILOG_ERROR( LOG_MME_APP, - "Failed to stop SGS IMSI Detach Indication timer for UE id %d \n", + "Failed to stop SGS IMSI Detach Indication timer for ue_id" + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); } ue_context_p->sgs_context->ts9_timer.id = MME_APP_TIMER_INACTIVE_ID; @@ -647,7 +764,7 @@ int mme_app_handle_sgs_imsi_detach_ack( OAILOG_DEBUG( LOG_MME_APP, "Detach Accept has been sent already after ts9 timer expired for " - "UE id %d, ignore the IMSI detach Ack \n", + "UE id " MME_UE_S1AP_ID_FMT ", ignore the IMSI detach Ack \n", ue_context_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } else { @@ -686,6 +803,5 @@ int mme_app_handle_sgs_imsi_detach_ack( "SGS context not found in mme_app_handle_sgs_imsi_detach_ack\n"); rc = RETURNerror; } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c index dd0a0ebf9a10..2f0371d3e8ba 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c @@ -51,7 +51,6 @@ #include "mme_app_state.h" #include "emm_cnDef.h" #include "nas_proc.h" -#include "nas_messages_types.h" #include "s1ap_messages_types.h" #include "sgs_messages_types.h" @@ -164,7 +163,6 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) SGS_CAUSE_IMSI_IMPLICITLY_DETACHED_FOR_NONEPS_SERVICE); increment_counter( "sgsap_paging_reject", 1, 1, "cause", "ue_requested_only_eps"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } /* Fetch LAI if present */ @@ -176,7 +174,6 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) PAGING_REQUEST_LAI_PARAMETER_PRESENT)) { rc = _sgsap_handle_paging_request_without_lai( ue_context_p, sgsap_paging_req_pP); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } if (ue_context_p->ecm_state == ECM_CONNECTED) { @@ -186,7 +183,6 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) rc = _sgs_handle_paging_request_for_mt_sms_in_idle( ue_context_p, sgsap_paging_req_pP); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -196,7 +192,6 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) ** Description Handle SGSAP-Paging request in SGS-Associated state ** ** for Mobile terminating call ** ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** - ** ue_context_p: UE context ** Outputs: ** ** Return: RETURNok, RETURNerror ** ** ** @@ -245,7 +240,6 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) SGS_CAUSE_MT_CSFB_CALL_REJECTED_BY_USER); increment_counter( "sgsap_paging_reject", 1, 1, "cause", "ue_requested_only_sms"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } /* Fetch LAI if present */ @@ -253,7 +247,6 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) PAGING_REQUEST_LAI_PARAMETER_PRESENT)) { rc = _sgsap_handle_paging_request_without_lai( ue_context_p, sgsap_paging_req_pP); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -270,7 +263,6 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) */ rc = _sgsap_handle_paging_request_without_lai( ue_context_p, sgsap_paging_req_pP); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -281,7 +273,6 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) rc = _sgs_handle_paging_request_for_mt_call_in_idle( ue_context_p, sgsap_paging_req_pP); } - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -611,6 +602,7 @@ int mme_app_send_sgsap_service_request( ** Description Build and send Paging reject ** ** Inputs: ue_context_p: pointer ue_context ** ** imsi : imsi ** + ** imsi_len : imsi length ** ** sgs_cause : paging reject cause ** ** Outputs: ** ** Return: RETURNok, RETURNerror ** @@ -710,7 +702,6 @@ int sgs_handle_null_paging_request(const sgs_fsm_t *evt) increment_counter( "sgsap_paging_reject", 1, 1, "cause", "paging_request_rx in null_state"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } @@ -894,7 +885,6 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t* mme_app_desc_p, SGS_CAUSE_IMSI_DETACHED_FOR_NONEPS_SERVICE); increment_counter( "sgsap_paging_reject", 1, 1, "cause", "SGS context not created"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } ue_context_p->sgs_context->sgsap_msg = (void *) sgsap_paging_req_pP; @@ -910,6 +900,5 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t* mme_app_desc_p, ue_context_p->mme_ue_s1ap_id); } ue_context_p->sgs_context->sgsap_msg = NULL; - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c index 66da913c61f5..cfdd2baaf35d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c @@ -45,7 +45,6 @@ #include "intertask_interface_types.h" #include "itti_types.h" #include "mme_app_desc.h" -#include "nas_messages_types.h" #include "sgs_messages_types.h" /**************************************************************************** @@ -103,7 +102,6 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, SGS_CAUSE_IMSI_DETACHED_FOR_NONEPS_SERVICE); increment_counter( "sgsap_paging_reject", 1, 1, "cause", "SGS context not created"); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } ue_context_p->sgs_context->sgsap_msg = (void *) sgsap_paging_req_pP; @@ -119,7 +117,6 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, ue_context_p->mme_ue_s1ap_id); } ue_context_p->sgs_context->sgsap_msg = NULL; - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c index 641e63af3895..278e274bdc7b 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c @@ -53,7 +53,6 @@ #include "itti_types.h" #include "mme_api.h" #include "mme_app_state.h" -#include "nas_messages_types.h" #include "s1ap_messages_types.h" #include "sgs_messages_types.h" #include "nas_proc.h" @@ -170,6 +169,15 @@ void mme_app_send_itti_sgsap_ue_activity_ind( MessageDef* message_p = NULL; message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_UE_ACTIVITY_IND); + if (!message_p) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP UE ACTIVITY IND for Imsi: " + "%s %d \n", + imsi, + imsi_len); + OAILOG_FUNC_OUT(LOG_MME_APP); + } memset( &message_p->ittiMsg.sgsap_ue_activity_ind, 0, @@ -178,18 +186,19 @@ void mme_app_send_itti_sgsap_ue_activity_ind( OAILOG_DEBUG(LOG_MME_APP, " Imsi : %s %d \n", imsi, imsi_len); SGSAP_UE_ACTIVITY_IND(message_p).imsi[imsi_len] = '\0'; SGSAP_UE_ACTIVITY_IND(message_p).imsi_length = imsi_len; - if ((itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p)) - == RETURNok) { + if ( + (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p)) == + RETURNok) { OAILOG_DEBUG( LOG_MME_APP, - "Sending ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi : " + "Sending ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi: " "%s %d \n", imsi, imsi_len); } else { OAILOG_ERROR( LOG_MME_APP, - "Failed to send ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi : " + "Failed to send ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi: " "%s %d \n", imsi, imsi_len); @@ -206,8 +215,8 @@ void mme_app_send_itti_sgsap_ue_activity_ind( ** ** ***********************************************************************************/ static int _copy_mobile_identity_helper( - MobileIdentity_t *mobileid_dest, - MobileIdentity_t *mobileid_src) + MobileIdentity_t* mobileid_dest, + MobileIdentity_t* mobileid_src) { OAILOG_FUNC_IN(LOG_MME_APP); @@ -233,20 +242,20 @@ static int _copy_mobile_identity_helper( ***********************************************************************************/ static int _build_sgs_status( - char *imsi, + char* imsi, uint8_t imsi_length, lai_t laicsfb, - MobileIdentity_t *mobileid, + MobileIdentity_t* mobileid, uint8_t msg_id) { int rc = RETURNok; OAILOG_FUNC_IN(LOG_MME_APP); - MessageDef *message_p = NULL; + MessageDef* message_p = NULL; message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_STATUS); - itti_sgsap_status_t *sgsap_status = &message_p->ittiMsg.sgsap_status; - memset((void *) sgsap_status, 0, sizeof(itti_sgsap_status_t)); + itti_sgsap_status_t* sgsap_status = &message_p->ittiMsg.sgsap_status; + memset((void*) sgsap_status, 0, sizeof(itti_sgsap_status_t)); //Encode IMSI sgsap_status->presencemask = SGSAP_IMSI; @@ -544,12 +553,13 @@ int send_itti_sgsap_location_update_req(ue_mm_context_t* ue_context_p) ue_context_p->e_utran_cgi.cell_identity.cell_id; // Send SGSAP Location Update Request to SGS task - if ((itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p)) - != RETURNok) { + if ( + (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p)) != + RETURNok) { OAILOG_ERROR( LOG_MME_APP, - "Failed to send SGS-Location Update Request for UE ID" - MME_UE_S1AP_ID_FMT "\n", + "Failed to send SGS-Location Update Request for UE ID" MME_UE_S1AP_ID_FMT + "\n", ue_context_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } @@ -566,7 +576,10 @@ int send_itti_sgsap_location_update_req(ue_mm_context_t* ue_context_p) ue_context_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - // Start Ts6-1 timer and change SGS state to LA_UPDATE_REQUESTED + /* Start Ts6-1 timer and change SGS state to LA_UPDATE_REQUESTED */ + nas_itti_timer_arg_t cb = {0}; + cb.nas_timer_callback = mme_app_handle_ts6_1_timer_expiry; + cb.nas_timer_callback_arg = (void*) &(ue_context_p->mme_ue_s1ap_id); sgs_fsm_set_status( ue_context_p->mme_ue_s1ap_id, ue_context_p->sgs_context, @@ -578,8 +591,8 @@ int send_itti_sgsap_location_update_req(ue_mm_context_t* ue_context_p) TASK_MME_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - (void*) &(ue_context_p->mme_ue_s1ap_id), - sizeof(mme_ue_s1ap_id_t), + &cb, + sizeof(cb), &(ue_context_p->sgs_context->ts6_1_timer.id)) < 0) { OAILOG_ERROR( LOG_MME_APP, @@ -638,7 +651,6 @@ int mme_app_handle_sgsap_location_update_acc( ((sgs_context_t*) sgs_fsm.ctx)->sgsap_msg = (void*) itti_sgsap_location_update_acc; - unlock_ue_contexts(ue_context_p); if (sgs_fsm_process(&sgs_fsm) != RETURNok) { OAILOG_ERROR( LOG_MME_APP, @@ -695,7 +707,6 @@ int mme_app_handle_sgsap_location_update_rej( ((sgs_context_t*) sgs_fsm.ctx)->sgsap_msg = (void*) itti_sgsap_location_update_rej; - unlock_ue_contexts(ue_context_p); if (sgs_fsm_process(&sgs_fsm) != RETURNok) { OAILOG_ERROR( LOG_MME_APP, @@ -857,8 +868,9 @@ int sgs_fsm_la_updt_req_loc_updt_acc(const sgs_fsm_t* fsm_evt) OAILOG_ERROR(LOG_MME_APP, "Failed to stop Ts6_1 timer \n"); } sgs_context->ts6_1_timer.id = MME_APP_TIMER_INACTIVE_ID; - if ((_handle_cs_domain_loc_updt_acc( - itti_sgsap_location_update_acc_p, ue_context_p)) == RETURNerror) { + if ( + (_handle_cs_domain_loc_updt_acc( + itti_sgsap_location_update_acc_p, ue_context_p)) == RETURNerror) { OAILOG_DEBUG( LOG_MME_APP, "Failed to update CSFB params received from MSC/VLR for UE " IMSI_64_FMT @@ -981,7 +993,6 @@ int sgs_fsm_la_updt_req_loc_updt_rej(const sgs_fsm_t* fsm_evt) if (itti_sgsap_location_update_rej_p->presencemask & SGSAP_LAI) { lai = &itti_sgsap_location_update_rej_p->laicsfb; } - unlock_ue_contexts(ue_context_p); // Handle SGS Location Update Failure nas_proc_cs_domain_location_updt_fail( itti_sgsap_location_update_rej_p->cause, lai, ue_context_p->mme_ue_s1ap_id); @@ -997,22 +1008,42 @@ int sgs_fsm_la_updt_req_loc_updt_rej(const sgs_fsm_t* fsm_evt) ** Inputs: ue_mm_context_s ** ** ** ***********************************************************************************/ - -void mme_app_handle_ts6_1_timer_expiry(struct ue_mm_context_s *ue_context_p) +void mme_app_handle_ts6_1_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); - DevAssert(ue_context_p->sgs_context != NULL); - OAILOG_WARNING( + mme_app_desc_t* mme_app_desc_p = NULL; + mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); + struct ue_mm_context_s* ue_context_p = NULL; + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Ts6-1 Timer expired, but no assoicated UE context " + "found for ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + if (ue_context_p->sgs_context == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Ts6-1 Timer expired, but sgs context is NULL for " + "ue-id " MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + OAILOG_ERROR( LOG_MME_APP, - "Expired- Ts6-1 timer for UE id %d \n", - ue_context_p->mme_ue_s1ap_id); + "Expired- Ts6-1 timer for ue_id:" MME_UE_S1AP_ID_FMT "\n", + mme_ue_s1ap_id); ue_context_p->sgs_context->ts6_1_timer.id = MME_APP_TIMER_INACTIVE_ID; ue_context_p->sgs_context->sgs_state = SGS_NULL; // Handle SGS Location Update Failure nas_proc_cs_domain_location_updt_fail( - SGS_MSC_NOT_REACHABLE, NULL, ue_context_p->mme_ue_s1ap_id); + SGS_MSC_NOT_REACHABLE, NULL, mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_service_abort.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_service_abort.c index dc4d39b3c5d7..62f7c6422f9b 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_service_abort.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_service_abort.c @@ -50,7 +50,6 @@ int mme_app_handle_sgsap_service_abort_request(mme_app_desc_t *mme_app_desc_p, { imsi64_t imsi64 = INVALID_IMSI64; struct ue_mm_context_s *ue_context_p = NULL; - int rc = RETURNok; sgs_fsm_t sgs_fsm; OAILOG_FUNC_IN(LOG_MME_APP); @@ -82,7 +81,6 @@ int mme_app_handle_sgsap_service_abort_request(mme_app_desc_t *mme_app_desc_p, "SGS context not found in mme_app_handle_sgsap_service_abort_req for " "IMSI %s\n", itti_sgsap_service_abort_req_p->imsi); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } @@ -97,12 +95,10 @@ int mme_app_handle_sgsap_service_abort_request(mme_app_desc_t *mme_app_desc_p, LOG_MME_APP, "Error in invoking FSM handler for primitive %d \n", sgs_fsm.primitive); - unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - unlock_ue_contexts(ue_context_p); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /********************************************************************************** @@ -116,8 +112,6 @@ int mme_app_handle_sgsap_service_abort_request(mme_app_desc_t *mme_app_desc_p, ***********************************************************************************/ int sgs_fsm_associated_service_abort_request(const sgs_fsm_t *fsm_evt) { - int rc = RETURNok; - OAILOG_FUNC_IN(LOG_MME_APP); sgs_context_t *sgs_context = (sgs_context_t *) fsm_evt->ctx; @@ -140,7 +134,7 @@ int sgs_fsm_associated_service_abort_request(const sgs_fsm_t *fsm_evt) fsm_evt->ue_id); } - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /********************************************************************************** @@ -153,8 +147,6 @@ int sgs_fsm_associated_service_abort_request(const sgs_fsm_t *fsm_evt) ***********************************************************************************/ int sgs_fsm_null_service_abort_request(const sgs_fsm_t *fsm_evt) { - int rc = RETURNok; - OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_ERROR( LOG_MME_APP, @@ -162,7 +154,7 @@ int sgs_fsm_null_service_abort_request(const sgs_fsm_t *fsm_evt) "state for UE ID %d\n", fsm_evt->ue_id); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /********************************************************************************** @@ -175,8 +167,6 @@ int sgs_fsm_null_service_abort_request(const sgs_fsm_t *fsm_evt) ***********************************************************************************/ int sgs_fsm_la_update_req_service_abort_request(const sgs_fsm_t *fsm_evt) { - int rc = RETURNok; - OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_ERROR( LOG_MME_APP, @@ -184,5 +174,5 @@ int sgs_fsm_la_update_req_service_abort_request(const sgs_fsm_t *fsm_evt) "LA-UPDATE-REQUESTED stae for UE ID %d\n", fsm_evt->ue_id); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp b/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp index 3fe29727b794..c46b139e74b5 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp @@ -101,7 +101,6 @@ void MmeNasStateConverter::proto_to_hashtable_ts( state_htbl->name->data, hashtable_rc_code2string(ht_rc)); } - unlock_ue_contexts(ue_context_p); OAILOG_INFO(LOG_MME_APP, "Written one key into hashtable_ts"); } } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_transport.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_transport.c index 60c144c5c83c..ed3e25f8eb52 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_transport.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_transport.c @@ -43,7 +43,6 @@ #include "intertask_interface_types.h" #include "itti_types.h" #include "mme_app_desc.h" -#include "nas_messages_types.h" #include "s1ap_messages_types.h" #include "sgs_messages_types.h" @@ -107,7 +106,8 @@ int mme_app_handle_nas_dl_req( /* * Move the UE to ECM Connected State ,if not in connected state already - * S1 Signaling connection gets established via first DL NAS Trasnport message in some scenarios so check the state + * S1 Signaling connection gets established via first DL NAS Trasnport + * message in some scenarios so check the state * first */ if (ue_context->ecm_state != ECM_CONNECTED) { @@ -130,7 +130,5 @@ int mme_app_handle_nas_dl_req( mme_app_itti_ue_context_release( ue_context, ue_context->ue_context_rel_cause); } - - unlock_ue_contexts(ue_context); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/CMakeLists.txt b/lte/gateway/c/oai/tasks/nas/CMakeLists.txt index 981a16cbae3d..1b36a2bf5452 100644 --- a/lte/gateway/c/oai/tasks/nas/CMakeLists.txt +++ b/lte/gateway/c/oai/tasks/nas/CMakeLists.txt @@ -204,7 +204,6 @@ set(libnas_mme_esm_sap_OBJS ) add_library(TASK_NAS - nas_itti_messaging.c nas_if_s1.c nas_if_s6a.c nas_network.c diff --git a/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.c b/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.c index f32e7396092f..5505a29b8c09 100644 --- a/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.c +++ b/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.c @@ -100,7 +100,7 @@ static int _mme_api_pdn_id = 0; ***************************************************************************/ int mme_api_get_emm_config( mme_api_emm_config_t *config, - struct mme_config_s *mme_config_p) + const struct mme_config_s *mme_config_p) { OAILOG_FUNC_IN(LOG_NAS); AssertFatal(mme_config_p->served_tai.nb_tai >= 1, "No TAI configured"); @@ -368,7 +368,6 @@ int mme_api_notify_imsi( imsi64, ue_mm_context->mme_teid_s11, &ue_mm_context->emm_context._guti); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS, RETURNok); } @@ -404,7 +403,6 @@ int mme_api_notify_new_guti(const mme_ue_s1ap_id_t id, guti_t* const guti) ue_mm_context->emm_context._imsi64, ue_mm_context->mme_teid_s11, guti); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS, RETURNok); } @@ -458,7 +456,6 @@ int mme_api_new_guti( // TODO Find another way to generate m_tmsi guti->m_tmsi = (tmsi_t)(uintptr_t) ue_context; if (guti->m_tmsi == INVALID_M_TMSI) { - unlock_ue_contexts(ue_context); OAILOG_FUNC_RETURN(LOG_NAS, RETURNerror); } mme_api_notify_new_guti(ue_context->mme_ue_s1ap_id, guti); @@ -642,7 +639,6 @@ int mme_api_new_guti( "UE " MME_UE_S1AP_ID_FMT " Got GUTI " GUTI_FMT "\n", ue_context->mme_ue_s1ap_id, GUTI_ARG(guti)); - unlock_ue_contexts(ue_context); OAILOG_FUNC_RETURN(LOG_NAS, RETURNok); } diff --git a/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.h b/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.h index d02ea27c078f..868079963b4b 100644 --- a/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.h +++ b/lte/gateway/c/oai/tasks/nas/api/mme/mme_api.h @@ -141,7 +141,7 @@ struct mme_config_s; int mme_api_get_emm_config( mme_api_emm_config_t *config, - struct mme_config_s *mme_config_p); + const struct mme_config_s *mme_config_p); #define REMOVE_OLD_CONTEXT true #define REMOVE_NEW_CONTEXT false diff --git a/lte/gateway/c/oai/tasks/nas/emm/Attach.c b/lte/gateway/c/oai/tasks/nas/emm/Attach.c index d2e02efb50cd..2c9fcce0c99a 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Attach.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Attach.c @@ -95,7 +95,6 @@ #include "emm_regDef.h" #include "esm_data.h" #include "mme_app_state.h" -#include "nas_messages_types.h" #include "nas_procedures.h" #include "dynamic_memory_check.h" #include "mme_app_defs.h" @@ -317,7 +316,6 @@ int emm_proc_attach_request( emm_sap.u.emm_cn.u.emm_cn_implicit_detach.ue_id = guti_ue_mm_ctx->mme_ue_s1ap_id; rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(guti_ue_mm_ctx); } // Allocate new context and process the new request as fresh attach request clear_emm_ctxt = true; @@ -446,9 +444,7 @@ int emm_proc_attach_request( LOG_NAS_EMM, "EMM-PROC - Sending Detach Request message to MME APP" "module for ue_id =" MME_UE_S1AP_ID_FMT "\n", ue_id); - unlock_ue_contexts(ue_mm_context); mme_app_handle_detach_req(ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(imsi_ue_mm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } } else if ( @@ -497,13 +493,11 @@ int emm_proc_attach_request( LOG_NAS_EMM, "EMM-PROC - Sending Detach Request message to MME APP" "module for ue_id =" MME_UE_S1AP_ID_FMT "\n", ue_id); - unlock_ue_contexts(ue_mm_context); mme_app_handle_detach_req(ue_mm_context->mme_ue_s1ap_id); OAILOG_WARNING( LOG_NAS_EMM, "EMM-PROC - Received duplicated Attach Request\n"); increment_counter( "duplicate_attach_request", 1, 1, "action", "ignored"); - unlock_ue_contexts(imsi_ue_mm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } } @@ -585,7 +579,6 @@ int emm_proc_attach_request( _emm_proc_create_procedure_attach_request(ue_mm_context, ies); } rc = _emm_attach_run_procedure(&ue_mm_context->emm_context); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /* @@ -640,7 +633,6 @@ int emm_proc_attach_reject(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause) rc = _emm_attach_reject( emm_ctx, (struct nas_base_proc_s *) &no_attach_proc); } - emm_context_unlock(emm_ctx); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -824,7 +816,6 @@ int emm_proc_attach_complete( rc = RETURNok; } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/Authentication.c b/lte/gateway/c/oai/tasks/nas/emm/Authentication.c index 72f91b012132..5f6bd45bf1f1 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Authentication.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Authentication.c @@ -38,7 +38,6 @@ #include "emm_data.h" #include "emm_sap.h" #include "emm_cause.h" -#include "nas_itti_messaging.h" #include "service303.h" #include "EmmCommon.h" #include "3gpp_23.003.h" @@ -117,6 +116,8 @@ static void _nas_itti_auth_info_req( const uint8_t num_vectorsP, const_bstring const auts_pP); +static void _s6a_auth_info_rsp_timer_expiry_handler(void *args); + /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ @@ -378,7 +379,7 @@ static int _start_authentication_information_procedure( auth_info_proc->success_notif = _auth_info_proc_success_cb; auth_info_proc->failure_notif = _auth_info_proc_failure_cb; auth_info_proc->cn_proc.base_proc.time_out = - s6a_auth_info_rsp_timer_expiry_handler; + _s6a_auth_info_rsp_timer_expiry_handler; auth_info_proc->ue_id = ue_id; auth_info_proc->resync = auth_info_proc->request_sent; @@ -699,7 +700,6 @@ int emm_proc_authentication_failure( resync_param.data = (unsigned char *) calloc(1, RESYNC_PARAM_LENGTH); DevAssert(resync_param.data != NULL); if (resync_param.data == NULL) { - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -715,7 +715,6 @@ int emm_proc_authentication_failure( free_wrapper((void **) &resync_param.data); emm_ctx_clear_auth_vectors(emm_ctx); rc = RETURNok; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { REQUIREMENT_3GPP_24_301(R10_5_4_2_7_e__NOTE3); @@ -897,11 +896,9 @@ int emm_proc_authentication_failure( LOG_NAS_EMM, "EMM-PROC - The MME received an unknown EMM CAUSE %d\n", emm_cause); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1053,7 +1050,6 @@ int emm_proc_authentication_complete( } else { OAILOG_ERROR(LOG_NAS_EMM, "Auth proc is null"); } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1070,7 +1066,7 @@ void set_callbacks_for_auth_info_proc(nas_auth_info_proc_t *auth_info_proc) auth_info_proc->success_notif = _auth_info_proc_success_cb; auth_info_proc->failure_notif = _auth_info_proc_failure_cb; auth_info_proc->cn_proc.base_proc.time_out = - s6a_auth_info_rsp_timer_expiry_handler; + _s6a_auth_info_rsp_timer_expiry_handler; } void set_callbacks_for_auth_proc(nas_emm_auth_proc_t *auth_proc) @@ -1188,7 +1184,6 @@ static void _authentication_t3460_handler(void *args) emm_sap.u.emm_cn.u.emm_cn_implicit_detach.ue_id = ue_id; emm_sap_send(&emm_sap); increment_counter("ue_attach", 1, 1, "action", "attach_abort"); - emm_context_unlock(emm_ctx); } } OAILOG_FUNC_OUT(LOG_NAS_EMM); @@ -1617,3 +1612,63 @@ static void _nas_itti_auth_info_req( itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_OUT(LOG_NAS); } + +/************************************************************************ + ** ** + ** Name: _s6a_auth_info_rsp_timer_expiry_handler ** + ** ** + ** Description: ** + ** The timer is used for monitoring Auth Response from HSS ** + ** On expiry, MME didn't get the auth vectors from HSS, so ** + ** MME shall sends Attach Reject to UE ** + ** ** + ** Inputs: args: handler parameters ** + ** ** + ** Outputs: ** + ** Return: None ** + ** Others: None ** + ** ** + ************************************************************************/ +static void _s6a_auth_info_rsp_timer_expiry_handler(void *args) +{ + OAILOG_FUNC_IN(LOG_NAS_EMM); + emm_context_t *emm_ctx = (emm_context_t *) (args); + + if (emm_ctx) { + nas_auth_info_proc_t *auth_info_proc = + get_nas_cn_procedure_auth_info(emm_ctx); + if (!auth_info_proc) { + OAILOG_FUNC_OUT(LOG_NAS_EMM); + } + + void *timer_callback_args = NULL; + nas_stop_Ts6a_auth_info( + auth_info_proc->ue_id, &auth_info_proc->timer_s6a, timer_callback_args); + + auth_info_proc->timer_s6a.id = NAS_TIMER_INACTIVE_ID; + if (auth_info_proc->resync) { + OAILOG_ERROR( + LOG_NAS_EMM, + "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Resync auth " + "procedure was in progress. Aborting attach procedure. UE " + "id " MME_UE_S1AP_ID_FMT "\n", + auth_info_proc->ue_id); + } else { + OAILOG_ERROR( + LOG_NAS_EMM, + "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Initial auth " + "procedure was in progress. Aborting attach procedure. UE " + "id " MME_UE_S1AP_ID_FMT "\n", + auth_info_proc->ue_id); + } + + // Send Attach Reject with cause NETWORK FAILURE and delete UE context + nas_proc_auth_param_fail(auth_info_proc->ue_id, NAS_CAUSE_NETWORK_FAILURE); + } else { + OAILOG_ERROR( + LOG_NAS_EMM, + "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Null EMM Context for " + "UE \n"); + } + OAILOG_FUNC_OUT(LOG_NAS_EMM); +} diff --git a/lte/gateway/c/oai/tasks/nas/emm/Detach.c b/lte/gateway/c/oai/tasks/nas/emm/Detach.c index efd87cf9e41c..c6d1a9087224 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Detach.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Detach.c @@ -35,7 +35,6 @@ #include "emm_proc.h" #include "emm_sap.h" #include "esm_sap.h" -#include "nas_itti_messaging.h" #include "service303.h" #include "3gpp_36.401.h" #include "DetachRequest.h" @@ -301,7 +300,6 @@ int emm_proc_sgs_detach_request( sgs_detach_type); } } - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } /**************************************************************************** @@ -415,7 +413,6 @@ int emm_proc_detach_request( "Do not clear emm context for UE Initiated IMSI Detach Request " " for the UE (ue_id=" MME_UE_S1AP_ID_FMT ")\n", ue_id); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } } @@ -429,13 +426,11 @@ int emm_proc_detach_request( emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; rc = emm_sap_send(&emm_sap); - emm_context_unlock(emm_ctx); - // Notify MME APP to trigger Session release towards SGW and S1 signaling release towards S1AP. + /* Notify MME APP to trigger Session release towards SGW and S1 signaling + * release towards S1AP. + */ mme_app_handle_detach_req(ue_id); - } else { - emm_context_unlock(emm_ctx); } - OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } @@ -493,12 +488,10 @@ int emm_proc_detach_accept(mme_ue_s1ap_id_t ue_id) emm_sap.u.emm_reg.ue_id = ue_id; emm_sap.u.emm_reg.ctx = emm_ctx; emm_sap_send(&emm_sap); - emm_context_unlock(emm_ctx); // Notify MME APP to trigger Session release towards SGW and S1 signaling release towards S1AP. mme_app_handle_detach_req(ue_id); } else { emm_ctx->is_imsi_only_detach = false; - emm_context_unlock(emm_ctx); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } @@ -591,7 +584,6 @@ int emm_proc_nw_initiated_detach_request( emm_ctx->t3422_arg = (void *) data; } } - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } //------------------------------------------------------------------------------ diff --git a/lte/gateway/c/oai/tasks/nas/emm/EmmStatusHdl.c b/lte/gateway/c/oai/tasks/nas/emm/EmmStatusHdl.c index e81215fe5777..431e3c2e968a 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/EmmStatusHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/EmmStatusHdl.c @@ -132,7 +132,6 @@ int emm_proc_status(mme_ue_s1ap_id_t ue_id, emm_cause_t emm_cause) */ emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx, false, true); rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/Identification.c b/lte/gateway/c/oai/tasks/nas/emm/Identification.c index 246168d2b2de..7d0397e26dcf 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Identification.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Identification.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -283,7 +283,6 @@ int emm_proc_identification_complete( rc = emm_sap_send(&emm_sap); } // else ignore the response if procedure not found - unlock_ue_contexts(ue_mm_context); } // else ignore the response if ue context not found OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -446,7 +445,6 @@ static int _identification_request(nas_emm_ident_proc_t *const proc) (void *) emm_ctx); } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -480,14 +478,14 @@ static int _identification_non_delivered_ho( int rc = RETURNerror; if (emm_proc) { nas_emm_ident_proc_t *ident_proc = (nas_emm_ident_proc_t *) emm_proc; - /************************README************************************************* - ** NAS Non Delivery indication during HO handling will be added when HO is supported - ** In non hand-over case if MME receives NAS Non Delivery indication message that implies - ** eNB and UE has lost radio connection. In this case aborting the Identification and - ** Attach Procedure. - ********************************************************************************* + /************************README******************************************* + ** NAS Non Delivery indication during HO handling will be added when HO is + ** supported In non hand-over case if MME receives NAS Non Delivery + ** indication message that implies eNB and UE has lost radio connection. + ** In this case aborting the Identification and Attach Procedure. + ***************************************************************************** REQUIREMENT_3GPP_24_301(R10_5_4_2_7_j); - *********************************************************************************/ + ******************************************************************************/ if (emm_ctx) { REQUIREMENT_3GPP_24_301(R10_5_4_2_7_j); /* diff --git a/lte/gateway/c/oai/tasks/nas/emm/LowerLayer.c b/lte/gateway/c/oai/tasks/nas/emm/LowerLayer.c index e8ff3986e59c..3b8b226e23d9 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/LowerLayer.c +++ b/lte/gateway/c/oai/tasks/nas/emm/LowerLayer.c @@ -102,7 +102,6 @@ int lowerlayer_success(mme_ue_s1ap_id_t ue_id, bstring *nas_msg) &emm_sap.u.emm_reg.u.ll_success.digest_len); } rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { OAILOG_INFO(LOG_NAS_EMM, "Unknown ue id " MME_UE_S1AP_ID_FMT "\n", ue_id); @@ -152,7 +151,6 @@ int lowerlayer_failure(mme_ue_s1ap_id_t ue_id, STOLEN_REF bstring *nas_msg) &emm_sap.u.emm_reg.u.ll_failure.digest_len); } rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { OAILOG_INFO(LOG_NAS_EMM, "Unknown ue id " MME_UE_S1AP_ID_FMT "\n", ue_id); @@ -201,7 +199,6 @@ int lowerlayer_non_delivery_indication( &emm_sap.u.emm_reg.u.non_delivery_ho.digest_len); } rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { OAILOG_INFO(LOG_NAS_EMM, "Unknown ue id " MME_UE_S1AP_ID_FMT "\n", ue_id); @@ -266,7 +263,6 @@ int lowerlayer_release(mme_ue_s1ap_id_t ue_id, int cause) OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -303,7 +299,6 @@ int lowerlayer_data_ind(mme_ue_s1ap_id_t ue_id, const_bstring data) esm_sap.recv = data; data = NULL; rc = esm_sap_send(&esm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -349,7 +344,6 @@ int lowerlayer_data_req(mme_ue_s1ap_id_t ue_id, bstring data) */ emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, sctx, false, true); rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -391,7 +385,6 @@ int lowerlayer_activate_bearer_req( emm_as_set_security_data( &emm_sap.u.emm_as.u.activate_bearer_context_req.sctx, sctx, false, true); rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -425,7 +418,6 @@ int lowerlayer_deactivate_bearer_req( emm_as_set_security_data( &emm_sap.u.emm_as.u.deactivate_bearer_context_req.sctx, sctx, false, true); rc = emm_sap_send(&emm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c index ff1d1b44aa19..75b5bd2b7d43 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c @@ -158,7 +158,6 @@ int emm_proc_uplink_nas_transport(mme_ue_s1ap_id_t ue_id, bstring nas_msg_pP) } } } - emm_context_unlock(emm_ctxt_p); } else { OAILOG_WARNING( LOG_NAS_EMM, diff --git a/lte/gateway/c/oai/tasks/nas/emm/SecurityModeControl.c b/lte/gateway/c/oai/tasks/nas/emm/SecurityModeControl.c index b2d2fe2a1785..ee626c853e55 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/SecurityModeControl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/SecurityModeControl.c @@ -62,7 +62,6 @@ #include "emm_data.h" #include "emm_sap.h" #include "secu_defs.h" -#include "nas_itti_messaging.h" #include "service303.h" #include "EmmCommon.h" #include "3gpp_23.003.h" @@ -484,7 +483,6 @@ int emm_proc_security_mode_complete( emm_ctx_set_attribute_valid(emm_ctx, EMM_CTXT_MEMBER_SECURITY); rc = emm_sap_send(&emm_sap); } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { OAILOG_ERROR( @@ -494,7 +492,6 @@ int emm_proc_security_mode_complete( rc = RETURNerror; } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -584,7 +581,6 @@ int emm_proc_security_mode_reject(mme_ue_s1ap_id_t ue_id) smc_proc->emm_com_proc.emm_proc.previous_emm_fsm_state; rc = emm_sap_send(&emm_sap); } - unlock_ue_contexts(ue_mm_context); mme_app_handle_detach_req(ue_id); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -793,7 +789,6 @@ static int _security_request(nas_emm_smc_proc_t *const smc_proc) emm_ctx); } } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c index e74a488e11c5..b4bef8977a55 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c @@ -135,8 +135,6 @@ static int _emm_service_reject(mme_ue_s1ap_id_t ue_id, uint8_t emm_cause) _clear_emm_ctxt(emm_ctx); } } - - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -208,11 +206,9 @@ int emm_proc_extended_service_request( "failure", "cause", "emm_cause_congestion"); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /* Handle extended service request received in ue connected mode */ - emm_context_unlock(emm_ctx); mme_app_handle_nas_extended_service_req(ue_id, msg->servicetype, msg->csfbresponse); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -320,7 +316,6 @@ int emm_recv_initial_ext_service_request( emm_sap.u.emm_cn.u.emm_cn_nw_initiated_detach.detach_type = NW_DETACH_TYPE_IMSI_DETACH; rc = emm_sap_send(&emm_sap); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -341,8 +336,6 @@ int emm_recv_initial_ext_service_request( emm_sap.u.emm_as.u.establish.presencemask |= SERVICE_TYPE_PRESENT; emm_sap.u.emm_as.u.establish.service_type = msg->servicetype; rc = emm_sap_send(&emm_sap); - - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -359,7 +352,6 @@ static int _check_paging_received_without_lai(mme_ue_s1ap_id_t ue_id) (ue_context->sgs_context->csfb_service_type == CSFB_SERVICE_MT_CALL_OR_SMS_WITHOUT_LAI)) { ue_context->sgs_context->csfb_service_type = CSFB_SERVICE_NONE; - unlock_ue_contexts(ue_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, true); } } @@ -393,6 +385,5 @@ int emm_send_service_reject_in_dl_nas( &emm_sap.u.emm_as.u.data.sctx, &emm_ctx->_security, false, true); rc = emm_sap_send(&emm_sap); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c index 2487c45b2b94..8266b91769f3 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c +++ b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c @@ -37,7 +37,6 @@ #include "emm_sap.h" #include "emm_cause.h" #include "service303.h" -#include "nas_itti_messaging.h" #include "conversions.h" #include "EmmCommon.h" #include "3gpp_23.003.h" @@ -54,7 +53,6 @@ #include "esm_data.h" #include "mme_api.h" #include "mme_app_state.h" -#include "nas_messages_types.h" #include "nas_procedures.h" #include "mme_app_itti_messaging.h" #include "mme_app_defs.h" @@ -227,7 +225,6 @@ int emm_proc_tracking_area_update_request( if (ue_mm_context) { emm_context = &ue_mm_context->emm_context; free_emm_tau_request_ies(&ies); - unlock_ue_contexts(ue_mm_context); OAILOG_DEBUG(LOG_NAS_EMM, "EMM-PROC- GUTI Context found\n"); } else { // NO S10 @@ -269,7 +266,6 @@ int emm_proc_tracking_area_update_request( (_esm_data.conf.features & MME_API_CSFB_SMS_SUPPORTED) || (_esm_data.conf.features & MME_API_SMS_SUPPORTED)) { if ((_csfb_handle_tracking_area_req(emm_context, ies)) == RETURNok) { - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } } @@ -299,7 +295,6 @@ int emm_proc_tracking_area_update_request( "cause", "normal_tau_not_supported"); free_emm_tau_request_ies(&ies); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -386,12 +381,10 @@ int emm_proc_tracking_area_update_request( "EMM-PROC- Processing Tracking Area Update Accept failed for " "ue_id=" MME_UE_S1AP_ID_FMT ")\n", ue_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } increment_counter( "tracking_area_update_req", 1, 1, "result", "success"); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } else { OAILOG_ERROR( @@ -404,7 +397,6 @@ int emm_proc_tracking_area_update_request( } free_emm_tau_request_ies(&ies); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /**************************************************************************** @@ -587,7 +579,6 @@ static int _emm_tracking_area_update_reject( } } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -763,7 +754,6 @@ static int _emm_tracking_area_update_accept(nas_emm_tau_proc_t *const tau_proc) &tau_proc->T3450, tau_proc->emm_spec_proc.emm_proc.base_proc.time_out, emm_context); - unlock_ue_contexts(ue_mm_context); increment_counter( "tracking_area_update", 1, @@ -873,7 +863,6 @@ static int _emm_tracking_area_update_accept(nas_emm_tau_proc_t *const tau_proc) } else { OAILOG_WARNING(LOG_NAS_EMM, "EMM-PROC - TAU procedure NULL"); } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1027,7 +1016,6 @@ int emm_proc_tau_complete(mme_ue_s1ap_id_t ue_id) mme_app_itti_ue_context_release( ue_context_p, ue_context_p->ue_context_rel_cause); } - emm_context_unlock(emm_ctx); } else { OAILOG_ERROR( LOG_NAS_EMM, diff --git a/lte/gateway/c/oai/tasks/nas/emm/emm_data.h b/lte/gateway/c/oai/tasks/nas/emm/emm_data.h index 801c5543eeb6..3e827c7c6c46 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/emm_data.h +++ b/lte/gateway/c/oai/tasks/nas/emm/emm_data.h @@ -509,7 +509,6 @@ struct emm_context_s *emm_context_get_by_imsi( struct emm_context_s *emm_context_get_by_guti( emm_data_t *emm_data, guti_t *guti); -int emm_context_unlock(struct emm_context_s *emm_context_p); int emm_context_upsert_imsi(emm_data_t *emm_data, struct emm_context_s *elm) __attribute__((nonnull)); diff --git a/lte/gateway/c/oai/tasks/nas/emm/emm_data_ctx.c b/lte/gateway/c/oai/tasks/nas/emm/emm_data_ctx.c index 0bd6ad4184d9..ae9630062073 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/emm_data_ctx.c +++ b/lte/gateway/c/oai/tasks/nas/emm/emm_data_ctx.c @@ -738,16 +738,6 @@ struct emm_context_s *emm_context_get_by_guti( return emm_context_p; } -//------------------------------------------------------------------------------ -int emm_context_unlock(struct emm_context_s *emm_context_p) -{ - if (emm_context_p) { - return unlock_ue_contexts( - PARENT_STRUCT(emm_context_p, struct ue_mm_context_s, emm_context)); - } - return RETURNerror; -} - //------------------------------------------------------------------------------ void emm_data_context_remove_mobile_ids( emm_data_t *emm_data, diff --git a/lte/gateway/c/oai/tasks/nas/emm/emm_main.c b/lte/gateway/c/oai/tasks/nas/emm/emm_main.c index e6197dab5e74..881c8d2b87d0 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/emm_main.c +++ b/lte/gateway/c/oai/tasks/nas/emm/emm_main.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -53,7 +53,7 @@ ** Others: _emm_data ** ** ** ***************************************************************************/ -void emm_main_initialize(mme_config_t *mme_config_p) +void emm_main_initialize(const mme_config_t *mme_config_p) { OAILOG_FUNC_IN(LOG_NAS_EMM); /* diff --git a/lte/gateway/c/oai/tasks/nas/emm/emm_main.h b/lte/gateway/c/oai/tasks/nas/emm/emm_main.h index 1f37e5e8ba75..07a1e807e33b 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/emm_main.h +++ b/lte/gateway/c/oai/tasks/nas/emm/emm_main.h @@ -62,7 +62,7 @@ emm_data_t _emm_data; /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ -void emm_main_initialize(mme_config_t *mme_config_p); +void emm_main_initialize(const mme_config_t *mme_config_p); void emm_main_cleanup(void); #endif /* __EMM_MAIN_H__*/ diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c index c8ac4784f39b..bfccd77b18c0 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c @@ -393,7 +393,6 @@ static int _emm_as_recv( ue_id, decoder_rc); *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } @@ -412,7 +411,6 @@ static int _emm_as_recv( ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } rc = @@ -473,7 +471,6 @@ static int _emm_as_recv( ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } @@ -499,7 +496,6 @@ static int _emm_as_recv( ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } @@ -516,7 +512,6 @@ static int _emm_as_recv( ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } rc = @@ -556,7 +551,6 @@ static int _emm_as_recv( ((1 == decode_status->security_context_available) && (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } rc = emm_recv_uplink_nas_transport( @@ -572,7 +566,6 @@ static int _emm_as_recv( ((0 == decode_status->integrity_protected_message) || (0 == decode_status->mac_matched))) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } @@ -664,7 +657,6 @@ static int _emm_as_recv( break; } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -751,7 +743,6 @@ static int _emm_as_data_ind(emm_as_data_t *msg, int *emm_cause) * Failed to decrypt the message */ *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, bytes); } else if ( header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { @@ -780,7 +771,6 @@ static int _emm_as_data_ind(emm_as_data_t *msg, int *emm_cause) } bdestroy_wrapper(&plain_msg); - unlock_ue_contexts(ue_mm_context); } } else { /* @@ -870,7 +860,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) if (decoder_rc < 0) { if (decoder_rc < TLV_FATAL_ERROR) { *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, decoder_rc); } else if (decoder_rc == TLV_MANDATORY_FIELD_NOT_PRESENT) { *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; @@ -925,7 +914,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) "UE.ue_id=" MME_UE_S1AP_ID_FMT " \n", msg->ue_id); //Clean up S1AP and MME UE Context - unlock_ue_contexts(ue_mm_context); mme_app_handle_detach_req(ue_mm_context->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } @@ -940,7 +928,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) *emm_cause = EMM_CAUSE_UE_IDENTITY_CANT_BE_DERIVED_BY_NW; // Delete EMM,ESM conext, MMEAPP UE context and S1AP context nas_proc_implicit_detach_ue_ind(ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } // Process Detach Request @@ -978,7 +965,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) "failure", "cause", "ue_context_not_available"); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1017,7 +1003,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) "failure", "cause", "ue_context_not_available"); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } // Process Service request @@ -1053,7 +1038,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) "failure", "cause", "ue_context_not_available"); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /* Process Extended-Service request */ @@ -1075,7 +1059,6 @@ static int _emm_as_establish_req(emm_as_establish_t *msg, int *emm_cause) break; } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1575,7 +1558,6 @@ static int _emm_as_data_req( } else { OAILOG_ERROR( LOG_NAS_EMM, "Security context is NULL for UE -> %d\n", msg->ue_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } @@ -1625,10 +1607,8 @@ static int _emm_as_data_req( else { as_msg->err_code = AS_SUCCESS; } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, AS_DL_INFO_TRANSFER_REQ); } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, 0); @@ -1719,10 +1699,8 @@ static int _emm_as_status_ind( if (bytes > 0) { as_msg->err_code = AS_SUCCESS; - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, AS_DL_INFO_TRANSFER_REQ); } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, 0); @@ -1882,10 +1860,8 @@ static int _emm_as_security_req( as_msg->err_code = AS_SUCCESS; nas_emm_procedure_register_emm_message( msg->ue_id, msg->puid, as_msg->nas_msg); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, AS_DL_INFO_TRANSFER_REQ); } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, 0); @@ -1984,7 +1960,6 @@ static int _emm_as_security_rej( int bytes = _emm_as_encode(&as_msg->nas_msg, &nas_msg, size, emm_security_context); - unlock_ue_contexts(ue_mm_context); if (bytes > 0) { /* * Indicate to lower layer that procedure needs to be terminated after sending DL NAS message. @@ -2077,7 +2052,6 @@ static int _emm_as_erab_setup_req( emm_security_context); } - unlock_ue_contexts(ue_mm_context); if (bytes > 0) { OAILOG_FUNC_RETURN(LOG_NAS_EMM, AS_ACTIVATE_BEARER_CONTEXT_REQ); } @@ -2162,7 +2136,6 @@ static int _emm_as_erab_rel_cmd( emm_security_context); } - unlock_ue_contexts(ue_mm_context); if (bytes > 0) { OAILOG_FUNC_RETURN(LOG_NAS_EMM, AS_DEACTIVATE_BEARER_CONTEXT_REQ); } @@ -2278,7 +2251,6 @@ static int _emm_as_establish_cnf( case EMM_AS_NAS_INFO_NONE: //Response to SR as_msg->err_code = AS_SUCCESS; ret_val = AS_NAS_ESTABLISH_CNF; - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, ret_val); default: OAILOG_WARNING( @@ -2296,7 +2268,6 @@ static int _emm_as_establish_cnf( "Set nas_msg.header.sequence_number -> %u\n", nas_msg.header.sequence_number); } else { - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, ret_val); } /* @@ -2314,7 +2285,6 @@ static int _emm_as_establish_cnf( as_msg->err_code = AS_SUCCESS; ret_val = AS_NAS_ESTABLISH_CNF; } - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, ret_val); } @@ -2418,7 +2388,6 @@ static int _emm_as_establish_rej( */ int bytes = _emm_as_encode(&as_msg->nas_msg, &nas_msg, size, emm_security_context); - unlock_ue_contexts(ue_mm_context); if (bytes > 0) { // This is to indicate MME-APP to release the S1AP UE context after sending the message. as_msg->err_code = AS_TERMINATED_NAS; diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c index 2bc2d7b35b15..5e61d5618eba 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c @@ -62,7 +62,6 @@ #include "conversions.h" #include "esm_sap.h" #include "service303.h" -#include "nas_itti_messaging.h" #include "mme_app_itti_messaging.h" #include "mme_app_apn_selection.h" #include "mme_config.h" @@ -82,7 +81,6 @@ #include "mme_app_state.h" #include "mme_app_messages_types.h" #include "mme_app_sgs_fsm.h" -#include "nas_messages_types.h" #include "nas_procedures.h" #include "nas/networkDef.h" #include "security_types.h" @@ -161,7 +159,6 @@ static int _emm_cn_authentication_res(emm_cn_auth_res_t *const msg) "id " MME_UE_S1AP_ID_FMT "...\n", msg->ue_id); } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -196,7 +193,6 @@ static int _emm_cn_authentication_fail(const emm_cn_auth_fail_t *msg) "id " MME_UE_S1AP_ID_FMT "...\n", msg->ue_id); } - unlock_ue_contexts(ue_mm_context); } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -308,7 +304,6 @@ static int _emm_cn_ula_success(emm_cn_ula_success_t *msg_pP) * by HSS,send Attach Reject to UE */ _handle_apn_mismatch(ue_mm_context); - unlock_ue_contexts(ue_mm_context); return RETURNerror; } @@ -404,7 +399,6 @@ static int _emm_cn_ula_success(emm_cn_ula_success_t *msg_pP) "Failed to Perform PDN connectivity procedure requested by ue" "for (ue_id =" MME_UE_S1AP_ID_FMT ")\n", ue_mm_context->mme_ue_s1ap_id); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } if (!is_pdn_context_exist_for_apn) { @@ -413,10 +407,8 @@ static int _emm_cn_ula_success(emm_cn_ula_success_t *msg_pP) increment_counter("mme_spgw_create_session_req", 1, NO_LABELS); } } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } @@ -451,7 +443,6 @@ static int _emm_cn_implicit_detach_ue(const uint32_t ue_id) rc = emm_proc_sgs_detach_request(ue_id, EMM_SGS_NW_INITIATED_EPS_DETACH); } - emm_context_unlock(emm_ctx_p); emm_proc_detach_request(ue_id, ¶ms); increment_counter("ue_detach", 1, 1, "cause", "implicit_detach"); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); @@ -648,7 +639,6 @@ static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) /* * Return indication that ESM procedure failed */ - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } } else { @@ -661,7 +651,6 @@ static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) * if attach_type == EMM_ATTACH_TYPE_COMBINED_EPS_IMSI */ if (_emm_proc_combined_attach_req(emm_ctx, rsp) == RETURNok) { - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNok); } @@ -700,7 +689,6 @@ static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) } } } - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -791,7 +779,6 @@ static int _emm_cn_ula_or_csrsp_fail(const emm_cn_ula_or_csrsp_fail_t* msg) "pdn_connection_estb_failed"); rc = emm_proc_attach_reject(msg->ue_id, EMM_CAUSE_ESM_FAILURE); } - emm_context_unlock(emm_ctx_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -836,7 +823,6 @@ static int _emm_cn_activate_dedicated_bearer_req( rc = esm_sap_send(&esm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -869,7 +855,6 @@ static int _emm_cn_deactivate_dedicated_bearer_req( rc = esm_sap_send(&esm_sap); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1060,8 +1045,6 @@ static int _emm_cn_cs_domain_loc_updt_fail( } //Store SGS Reject Cause to be sent in Attach/TAU emm_ctx_p->emm_cause = emm_cn_sgs_location_updt_fail.reject_cause; - - emm_context_unlock(emm_ctx_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1103,7 +1086,6 @@ static int _emm_cn_cs_domain_mm_information_req( if (ue_context_p->sgs_context == NULL) { OAILOG_WARNING( LOG_NAS_EMM, " Invalid SGS context for IMSI" IMSI_64_FMT "\n", imsi64); - emm_context_unlock(ctxt); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1128,7 +1110,6 @@ static int _emm_cn_cs_domain_mm_information_req( "imsi" IMSI_64_FMT "\n", imsi64); } - emm_context_unlock(ctxt); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1165,7 +1146,6 @@ static int _emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) "Building of deactivate_eps_bearer_context_request failed for bearer" "%u\n", msg->lbi); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } /* @@ -1179,7 +1159,6 @@ static int _emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) } else { OAILOG_ERROR( LOG_NAS_EMM, "Message encoding failed for bearer %u\n", msg->lbi); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } @@ -1199,7 +1178,6 @@ static int _emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) "Processing eps_bearer_context_deactivate_request failed for bearer" "%u\n", msg->lbi); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -1232,7 +1210,6 @@ static int _emm_cn_pdn_disconnect_rsp(emm_cn_pdn_disconnect_rsp_t* msg) LOG_NAS_EMM, "ESM-PROC - No PDN connection found (lbi=%u)\n", msg->lbi); rc = RETURNerror; } - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c index 2e486b8d9b25..f39d3c2b63c8 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c @@ -768,7 +768,6 @@ int emm_recv_service_request( "cause", "bearer_reestablish_failure"); } - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_send.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_send.c index d65882e2d63c..a09568b0c3ba 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_send.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_send.c @@ -295,7 +295,6 @@ int emm_send_attach_accept( LOG_NAS_EMM, "EMMAS-SAP - EPS emergency attach, currently unsupported for (ue_id = %u)\n", ue_id); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, 0); // TODO: fix once supported break; } @@ -508,8 +507,6 @@ int emm_send_attach_accept( emm_msg->presencemask |= ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; emm_msg->epsnetworkfeaturesupport = *msg->eps_network_feature_support; } - - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, size); } /**************************************************************************** @@ -602,7 +599,6 @@ int emm_send_attach_accept_dl_nas( OAILOG_ERROR( LOG_NAS_EMM, "EMMAS-SAP - EPS emergency attach, currently unsupported\n"); - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, 0); // TODO: fix once supported break; } @@ -773,8 +769,6 @@ int emm_send_attach_accept_dl_nas( emm_msg->presencemask |= ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; emm_msg->epsnetworkfeaturesupport = *msg->eps_network_feature_support; } - - emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, size); } diff --git a/lte/gateway/c/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.c b/lte/gateway/c/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.c index 2b0feacaa113..867e629d7cbd 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.c +++ b/lte/gateway/c/oai/tasks/nas/esm/DedicatedEpsBearerContextActivation.c @@ -35,7 +35,6 @@ #include "esm_ebr_context.h" #include "emm_sap.h" #include "mme_config.h" -#include "nas_itti_messaging.h" #include "3gpp_24.301.h" #include "3gpp_36.401.h" #include "EsmCause.h" diff --git a/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c b/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c index 3a279f619fd9..c328d29dfcad 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c +++ b/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c @@ -43,7 +43,6 @@ #include "common_defs.h" #include "emm_esmDef.h" #include "esm_sapDef.h" -#include "nas_itti_messaging.h" #include "esm_pt.h" #include "mme_app_state.h" @@ -483,7 +482,6 @@ static void _eps_bearer_deactivate_t3495_handler(void *args) "(ue_id=" MME_UE_S1AP_ID_FMT ", ebi=%d), \n", ue_id, ebi); - unlock_ue_contexts(ue_mm_context); OAILOG_FUNC_OUT(LOG_NAS_ESM); } // Fetch pdn id using bearer index @@ -536,7 +534,6 @@ static void _eps_bearer_deactivate_t3495_handler(void *args) ue_id, ebi); } - unlock_ue_contexts(ue_mm_context); } } diff --git a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c index 13c3978a5071..c4f3fe023c72 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c +++ b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c @@ -28,7 +28,6 @@ #include "3gpp_24.007.h" #include "3gpp_24.008.h" #include "mme_app_ue_context.h" -#include "nas_itti_messaging.h" #include "esm_recv.h" #include "esm_pt.h" #include "esm_ebr.h" @@ -378,7 +377,6 @@ esm_cause_t esm_recv_pdn_connectivity_request( "ESM-PROC - Cannot find free pdn_cid for ue id" MME_UE_S1AP_ID_FMT "\n", ue_id); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_ESM, ESM_CAUSE_INSUFFICIENT_RESOURCES); } // Update pdn connection id @@ -427,7 +425,6 @@ esm_cause_t esm_recv_pdn_connectivity_request( mme_app_send_s11_create_session_req( mme_app_desc_p, ue_mm_context_p, pdn_cid); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_ESM, esm_cause); } diff --git a/lte/gateway/c/oai/tasks/nas/nas_defs.h b/lte/gateway/c/oai/tasks/nas/nas_defs.h deleted file mode 100644 index 0f4dcccde3e4..000000000000 --- a/lte/gateway/c/oai/tasks/nas/nas_defs.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef FILE_NAS_DEFS_SEEN -#define FILE_NAS_DEFS_SEEN - -int nas_init(mme_config_t *mme_config_p); - -#endif /* FILE_NAS_DEFS_SEEN */ diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c deleted file mode 100644 index 83a8e6852a53..000000000000 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file nas_itti_messaging.c - \brief - \author Sebastien ROUX, Lionel GAUTHIER - \date - \email: lionel.gauthier@eurecom.fr -*/ - -#include -#include -#include -#include -#include -#include - -#include "bstrlib.h" -#include "log.h" -#include "assertions.h" -#include "conversions.h" -#include "intertask_interface.h" -#include "common_defs.h" -#include "secu_defs.h" -#include "mme_app_ue_context.h" -#include "esm_proc.h" -#include "nas_itti_messaging.h" -#include "nas_proc.h" -#include "emm_proc.h" -#include "3gpp_24.008.h" -#include "3gpp_24.301.h" -#include "3gpp_29.274.h" -#include "3gpp_33.401.h" -#include "EpsAttachType.h" -#include "common_ies.h" -#include "emm_data.h" -#include "intertask_interface_types.h" -#include "itti_types.h" -#include "mme_app_state.h" -#include "mme_app_messages_types.h" -#include "nas_messages_types.h" -#include "nas_procedures.h" -#include "nas_timer.h" -#include "s6a_messages_types.h" -#include "nas/securityDef.h" -#include "sgs_messages_types.h" - -#define TASK_ORIGIN TASK_NAS_MME - -//*************************************************************************** -void s6a_auth_info_rsp_timer_expiry_handler(void *args) -{ - OAILOG_FUNC_IN(LOG_NAS_EMM); - - emm_context_t *emm_ctx = (emm_context_t *) (args); - - if (emm_ctx) { - nas_auth_info_proc_t *auth_info_proc = - get_nas_cn_procedure_auth_info(emm_ctx); - if (!auth_info_proc) { - OAILOG_FUNC_OUT(LOG_NAS_EMM); - } - - void *timer_callback_args = NULL; - nas_stop_Ts6a_auth_info( - auth_info_proc->ue_id, &auth_info_proc->timer_s6a, timer_callback_args); - - auth_info_proc->timer_s6a.id = NAS_TIMER_INACTIVE_ID; - if (auth_info_proc->resync) { - OAILOG_ERROR( - LOG_NAS_EMM, - "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Resync auth " - "procedure was in progress. Aborting attach procedure. UE " - "id " MME_UE_S1AP_ID_FMT "\n", - auth_info_proc->ue_id); - } else { - OAILOG_ERROR( - LOG_NAS_EMM, - "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Initial auth " - "procedure was in progress. Aborting attach procedure. UE " - "id " MME_UE_S1AP_ID_FMT "\n", - auth_info_proc->ue_id); - } - - // Send Attach Reject with cause NETWORK FAILURE and delete UE context - nas_proc_auth_param_fail(auth_info_proc->ue_id, NAS_CAUSE_NETWORK_FAILURE); - } else { - OAILOG_ERROR( - LOG_NAS_EMM, - "EMM-PROC - Timer timer_s6_auth_info_rsp expired. Null EMM Context for " - "UE \n"); - } - - OAILOG_FUNC_OUT(LOG_NAS_EMM); -} diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h deleted file mode 100644 index 273ddf56a425..000000000000 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file nas_itti_messaging.h - \brief - \author Sebastien ROUX, Lionel GAUTHIER - \date - \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef FILE_NAS_ITTI_MESSAGING_SEEN -#define FILE_NAS_ITTI_MESSAGING_SEEN - -#include -#include - -#include "nas_message.h" -#include "nas/as_message.h" -#include "esm_proc.h" -#include "MobileStationClassmark2.h" -#include "3gpp_23.003.h" -#include "3gpp_24.007.h" -#include "3gpp_36.401.h" -#include "TrackingAreaIdentity.h" -#include "bstrlib.h" -#include "common_types.h" - -int nas_itti_dl_data_req( - const mme_ue_s1ap_id_t ue_idP, - bstring nas_msgP, - nas_error_code_t transaction_status); - -void nas_itti_sgsap_downlink_unitdata( - const char *const imsi, - uint8_t imsi_len, - const_bstring nas_msg); - -void s6a_auth_info_rsp_timer_expiry_handler(void *args); - -#endif /* FILE_NAS_ITTI_MESSAGING_SEEN */ diff --git a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c deleted file mode 100644 index c7f274fa5e20..000000000000 --- a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include - -#include "log.h" -#include "intertask_interface.h" -#include "itti_free_defined_msg.h" -#include "mme_config.h" -#include "nas_defs.h" -#include "nas_network.h" -#include "nas_proc.h" -#include "nas_timer.h" -#include "intertask_interface_types.h" -#include "mme_app_messages_types.h" -#include "mme_app_state.h" -#include "nas_messages_types.h" -#include "s1ap_messages_types.h" -#include "s6a_messages_types.h" -#include "sgs_messages_types.h" -#include "timer_messages_types.h" - -static void nas_exit(void); - -//------------------------------------------------------------------------------ -static void *nas_intertask_interface(void *args_p) -{ - itti_mark_task_ready(TASK_NAS_MME); - mme_app_desc_t *mme_app_desc_p; - - while (1) { - MessageDef *received_message_p = NULL; - - itti_receive_msg(TASK_NAS_MME, &received_message_p); - mme_app_desc_p = get_locked_mme_nas_state(false); - - switch (ITTI_MSG_ID(received_message_p)) { - case MESSAGE_TEST: { - OAI_FPRINTF_INFO("TASK_NAS_MME received MESSAGE_TEST\n"); - } break; - - - case TERMINATE_MESSAGE: { - put_mme_nas_state(&mme_app_desc_p); - nas_exit(); - OAI_FPRINTF_INFO("TASK_NAS_MME terminated\n"); - itti_free_msg_content(received_message_p); - itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - itti_exit_task(); - } break; - - case TIMER_HAS_EXPIRED: { - /* - * Call the NAS timer api - */ - nas_timer_handle_signal_expiry( - TIMER_HAS_EXPIRED(received_message_p).timer_id, - TIMER_HAS_EXPIRED(received_message_p).arg); - } break; - - default: { - OAILOG_DEBUG( - LOG_NAS, - "Unkwnon message ID %d:%s from %s\n", - ITTI_MSG_ID(received_message_p), - ITTI_MSG_NAME(received_message_p), - ITTI_MSG_ORIGIN_NAME(received_message_p)); - } break; - } - - put_mme_nas_state(&mme_app_desc_p); - itti_free_msg_content(received_message_p); - itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - received_message_p = NULL; - } - - return NULL; -} - -//------------------------------------------------------------------------------ -int nas_init(mme_config_t *mme_config_p) -{ - OAILOG_DEBUG(LOG_NAS, "Initializing NAS task interface\n"); - nas_network_initialize(mme_config_p); - - if (itti_create_task(TASK_NAS_MME, &nas_intertask_interface, NULL) < 0) { - OAILOG_ERROR(LOG_NAS, "Create task failed"); - OAILOG_DEBUG(LOG_NAS, "Initializing NAS task interface: FAILED\n"); - return -1; - } - - OAILOG_DEBUG(LOG_NAS, "Initializing NAS task interface: DONE\n"); - return 0; -} - -//------------------------------------------------------------------------------ -static void nas_exit(void) -{ - OAILOG_DEBUG(LOG_NAS, "Cleaning NAS task interface\n"); - nas_network_cleanup(); - OAILOG_DEBUG(LOG_NAS, "Cleaning NAS task interface: DONE\n"); -} diff --git a/lte/gateway/c/oai/tasks/nas/nas_network.c b/lte/gateway/c/oai/tasks/nas/nas_network.c index 100f55825d36..1247f4b0f1a2 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_network.c +++ b/lte/gateway/c/oai/tasks/nas/nas_network.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -51,7 +51,7 @@ ** Others: None ** ** ** ***************************************************************************/ -void nas_network_initialize(mme_config_t *mme_config_p) +void nas_network_initialize(const mme_config_t *mme_config_p) { OAILOG_FUNC_IN(LOG_NAS); /* diff --git a/lte/gateway/c/oai/tasks/nas/nas_network.h b/lte/gateway/c/oai/tasks/nas/nas_network.h index 139079c4864b..797a6e0c13b7 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_network.h +++ b/lte/gateway/c/oai/tasks/nas/nas_network.h @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -56,7 +56,7 @@ Description NAS procedure functions triggered by the network /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ -void nas_network_initialize(mme_config_t *mme_config_p); +void nas_network_initialize(const mme_config_t *mme_config_p); void nas_network_cleanup(void); diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.c b/lte/gateway/c/oai/tasks/nas/nas_proc.c index 6f2c02dc170b..602dfc1c4694 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.c +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.c @@ -92,7 +92,7 @@ static nas_cause_t s6a_error_2_nas_cause(uint32_t s6a_error, int experimental); ** Others: None ** ** ** ***************************************************************************/ -void nas_proc_initialize(mme_config_t *mme_config_p) +void nas_proc_initialize(const mme_config_t *mme_config_p) { OAILOG_FUNC_IN(LOG_NAS_EMM); /* @@ -378,12 +378,10 @@ int nas_proc_authentication_info_answer( if (!(emm_ctxt_p)) { OAILOG_ERROR( LOG_NAS_EMM, "That's embarrassing as we don't know this IMSI\n"); - unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } mme_ue_s1ap_id_t mme_ue_s1ap_id = ue_mm_context_p->mme_ue_s1ap_id; - unlock_ue_contexts(ue_mm_context_p); OAILOG_INFO( LOG_NAS_EMM, "Received Authentication Information Answer from S6A for" @@ -642,7 +640,6 @@ int nas_proc_downlink_unitdata(itti_sgsap_downlink_unitdata_t *dl_unitdata) * Notify EMM-AS SAP that Downlink Nas transport message has to be sent to the ue */ emm_sap.primitive = EMMAS_DATA_REQ; - emm_context_unlock(ctxt); rc = emm_sap_send(&emm_sap); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -768,7 +765,6 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_release_req) NW_DETACH_TYPE_IMSI_DETACH; rc = emm_sap_send(&emm_sap); } - emm_context_unlock(ctxt); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /**************************************************************************** diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.h b/lte/gateway/c/oai/tasks/nas/nas_proc.h index ed7e9fd3e870..fae59ccba78f 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.h +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.h @@ -51,7 +51,6 @@ Description NAS procedure call manager #include "TrackingAreaIdentity.h" #include "nas/as_message.h" #include "bstrlib.h" -#include "nas_messages_types.h" #include "mme_app_defs.h" #include "s6a_messages_types.h" #include "security_types.h" @@ -73,7 +72,7 @@ Description NAS procedure call manager /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ -void nas_proc_initialize(mme_config_t *mme_config_p); +void nas_proc_initialize(const mme_config_t *mme_config_p); void nas_proc_cleanup(void); diff --git a/lte/gateway/c/oai/tasks/nas/nas_procedures.c b/lte/gateway/c/oai/tasks/nas/nas_procedures.c index f6b473a74085..e9d3e9779294 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_procedures.c +++ b/lte/gateway/c/oai/tasks/nas/nas_procedures.c @@ -940,7 +940,6 @@ void nas_emm_procedure_register_emm_message( // forward to ESM, TODO later... } } - emm_context_unlock(emm_ctx); } //----------------------------------------------------------------------------- diff --git a/lte/gateway/c/oai/tasks/nas/util/nas_timer.c b/lte/gateway/c/oai/tasks/nas/util/nas_timer.c index 3869a7083852..0145e7c853a0 100644 --- a/lte/gateway/c/oai/tasks/nas/util/nas_timer.c +++ b/lte/gateway/c/oai/tasks/nas/util/nas_timer.c @@ -45,6 +45,7 @@ #include "dynamic_memory_check.h" #include "intertask_interface_types.h" #include "itti_types.h" +#include "log.h" //------------------------------------------------------------------------------ int nas_timer_init(void) @@ -78,7 +79,7 @@ long int nas_timer_start( timer_setup( sec, usec, - TASK_NAS_MME, + TASK_MME_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, &cb, @@ -113,11 +114,14 @@ long int nas_timer_stop(long int timer_id, void **nas_timer_callback_arg) } //------------------------------------------------------------------------------ -void nas_timer_handle_signal_expiry(long timer_id, nas_itti_timer_arg_t *cb) +void mme_app_nas_timer_handle_signal_expiry( + long timer_id, + nas_itti_timer_arg_t *cb) { - if (!timer_exists(timer_id)) { - return; + OAILOG_FUNC_IN(LOG_NAS); + if ((!timer_exists(timer_id)) || (cb->nas_timer_callback == NULL)) { + OAILOG_FUNC_OUT(LOG_NAS); } - cb->nas_timer_callback(cb->nas_timer_callback_arg); + OAILOG_FUNC_OUT(LOG_NAS); } diff --git a/lte/gateway/c/oai/tasks/nas/util/nas_timer.h b/lte/gateway/c/oai/tasks/nas/util/nas_timer.h index 6b3625319d98..f016a0e98702 100644 --- a/lte/gateway/c/oai/tasks/nas/util/nas_timer.h +++ b/lte/gateway/c/oai/tasks/nas/util/nas_timer.h @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -82,7 +82,7 @@ long int nas_timer_start( nas_timer_callback_t nas_timer_callback, void *nas_timer_callback_args); long int nas_timer_stop(long int timer_id, void **nas_timer_callback_arg); -void nas_timer_handle_signal_expiry( +void mme_app_nas_timer_handle_signal_expiry( long timer_id, nas_itti_timer_arg_t *nas_itti_timer_arg); diff --git a/lte/gateway/c/oai/tasks/s6a/s6a_auth_info.c b/lte/gateway/c/oai/tasks/s6a/s6a_auth_info.c index 5c60458b1e1f..ebbeb698e49d 100644 --- a/lte/gateway/c/oai/tasks/s6a/s6a_auth_info.c +++ b/lte/gateway/c/oai/tasks/s6a/s6a_auth_info.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -332,7 +332,7 @@ int s6a_aia_cb( } } - itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); err: return RETURNok; } From b680cbb1424b94e0d280a964711e2a5d60a29f7b Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Thu, 16 Jan 2020 04:10:49 -0800 Subject: [PATCH 03/26] Fix ports table bug Summary: Bug happened when adding existing equipment to position and going to ports table. Reviewed By: AmitArbel Differential Revision: D19373192 fbshipit-source-id: 4f26ec32bcc68c7afc6f89d2a56d55059f2064d2 --- .../app/components/equipment/EquipmentPortsTable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/equipment/EquipmentPortsTable.js b/symphony/app/fbcnms-projects/inventory/app/components/equipment/EquipmentPortsTable.js index 0fd608d25ebd..7d473b2d255a 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/equipment/EquipmentPortsTable.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/equipment/EquipmentPortsTable.js @@ -89,9 +89,9 @@ const findNestedPorts = ( } const portsToDisplay = [ - ...equipment.ports, + ...(equipment.ports ?? []), ...getNonInstancePortsDefinitions( - equipment.ports, + equipment.ports ?? [], equipment.equipmentType.portDefinitions, ).map(portDef => getInitialPortFromDefinition(nullthrows(equipment), portDef), @@ -101,7 +101,7 @@ const findNestedPorts = ( ...port, breadcrumbs: [equipment], })); - const nestedPorts = equipment.positions + const nestedPorts = (equipment.positions ?? []) .map(position => findNestedPorts(position.attachedEquipment).map(portWithBreadcrumbs => ({ ...portWithBreadcrumbs, From 637a09d830ac098d963ee3b2f73bf9b0acc82d86 Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Thu, 16 Jan 2020 04:16:40 -0800 Subject: [PATCH 04/26] Fix overflow layers Summary: Layers didn't have a scrollbar. Reviewed By: AmitArbel Differential Revision: D19364039 fbshipit-source-id: 916b19540e2d25d2bfbec98cfe2584b2cb524204 --- .../inventory/app/components/map/LocationsMap.js | 5 ++++- .../inventory/app/components/map/MapLayerLegend.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/map/LocationsMap.js b/symphony/app/fbcnms-projects/inventory/app/components/map/LocationsMap.js index 66c209771f5a..65487ea341ae 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/map/LocationsMap.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/map/LocationsMap.js @@ -37,6 +37,9 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', justifyContent: 'center', }, + legendContainer: { + height: '100%', + }, })); const locationTypesQuery = graphql` @@ -136,7 +139,7 @@ const LocationsMap = (_props: Props) => { return ( - + ({ id: type.id, diff --git a/symphony/app/fbcnms-projects/inventory/app/components/map/MapLayerLegend.js b/symphony/app/fbcnms-projects/inventory/app/components/map/MapLayerLegend.js index 0385da3dc918..40c8ab81e1e2 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/map/MapLayerLegend.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/map/MapLayerLegend.js @@ -23,6 +23,7 @@ const useStyles = makeStyles(theme => ({ padding: '24px 16px', position: 'relative', zIndex: 2, + overflowY: 'auto', }, typeItem: { display: 'flex', From 5dca67cf420b746d72c086aa981a64c41de556e7 Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Thu, 16 Jan 2020 04:17:32 -0800 Subject: [PATCH 05/26] Connect ports dialog - design gaps Summary: Making rows selectable and improving flow Reviewed By: AmitArbel Differential Revision: D19371996 fbshipit-source-id: c84dfa9be25f52139552865330a533ef87c3fc3b --- .../{services => }/AvailablePortsTable.js | 24 +- .../AvailablePortsTable_ports.graphql.js | 4 +- .../PowerSearchEquipmentResultsTable.js | 108 +- .../equipment/AvailablePortsTable.js | 151 - .../equipment/PortsConnectDialog.js | 63 +- .../PortsConnectDialogQuery.graphql.js | 3023 +---------------- .../services/AddEndpointToServiceDialog.js | 2 +- ...werSearchLinkFirstEquipmentResultsTable.js | 6 +- ...AddEndpointToServiceDialogQuery.graphql.js | 6 +- 9 files changed, 256 insertions(+), 3131 deletions(-) rename symphony/app/fbcnms-projects/inventory/app/components/{services => }/AvailablePortsTable.js (91%) rename symphony/app/fbcnms-projects/inventory/app/components/{services => }/__generated__/AvailablePortsTable_ports.graphql.js (96%) delete mode 100644 symphony/app/fbcnms-projects/inventory/app/components/equipment/AvailablePortsTable.js diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/AvailablePortsTable.js b/symphony/app/fbcnms-projects/inventory/app/components/AvailablePortsTable.js similarity index 91% rename from symphony/app/fbcnms-projects/inventory/app/components/services/AvailablePortsTable.js rename to symphony/app/fbcnms-projects/inventory/app/components/AvailablePortsTable.js index c1d0cb52e4f2..a213b49da542 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/AvailablePortsTable.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/AvailablePortsTable.js @@ -8,11 +8,11 @@ * @format */ -import type {Equipment, EquipmentPort} from '../../common/Equipment'; +import type {Equipment, EquipmentPort} from '../common/Equipment'; import type {WithStyles} from '@material-ui/core'; import AvailablePortsTable_ports from './__generated__/AvailablePortsTable_ports.graphql'; -import EquipmentBreadcrumbs from '../equipment/EquipmentBreadcrumbs'; +import EquipmentBreadcrumbs from './equipment/EquipmentBreadcrumbs'; import React from 'react'; import Text from '@fbcnms/ui/components/design-system/Text'; import classNames from 'classnames'; @@ -62,13 +62,27 @@ const styles = { textTransform: 'none', }, }, + checked: { + backgroundColor: symphony.palette.B50, + }, + row: { + '&:hover': { + backgroundColor: symphony.palette.background, + }, + '&:focus': { + outline: 'none', + }, + }, + clickableRow: { + cursor: 'pointer', + }, }; type Props = { equipment: Equipment, ports: AvailablePortsTable_ports, selectedPort: ?EquipmentPort, - onPortSelected: (port: EquipmentPort) => void, + onPortSelected?: (port: EquipmentPort) => void, } & WithStyles; const AvailablePortsTable = (props: Props) => { @@ -104,7 +118,7 @@ const AvailablePortsTable = (props: Props) => { }; const onRowClicked = ({_event, _index, rowData}) => { - onPortSelected(rowData); + onPortSelected && onPortSelected(rowData); }; if (ports.length === 0) { @@ -140,6 +154,7 @@ const AvailablePortsTable = (props: Props) => { classNames({ [classes.header]: index === -1, [classes.row]: index !== -1, + [classes.clickableRow]: onRowClicked != null, [classes.checked]: selectedPort && index !== -1 && @@ -208,6 +223,7 @@ export default withStyles(styles)( ...EquipmentBreadcrumbs_equipment } definition { + id name portType { name diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AvailablePortsTable_ports.graphql.js b/symphony/app/fbcnms-projects/inventory/app/components/__generated__/AvailablePortsTable_ports.graphql.js similarity index 96% rename from symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AvailablePortsTable_ports.graphql.js rename to symphony/app/fbcnms-projects/inventory/app/components/__generated__/AvailablePortsTable_ports.graphql.js index feaa538641ec..5ebfc5dea0b5 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AvailablePortsTable_ports.graphql.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/__generated__/AvailablePortsTable_ports.graphql.js @@ -26,6 +26,7 @@ export type AvailablePortsTable_ports = $ReadOnlyArray<{| +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, |}, +definition: {| + +id: string, +name: string, +portType: ?{| +name: string @@ -94,6 +95,7 @@ return { "concreteType": "EquipmentPortDefinition", "plural": false, "selections": [ + (v0/*: any*/), (v1/*: any*/), { "kind": "LinkedField", @@ -120,5 +122,5 @@ return { }; })(); // prettier-ignore -(node/*: any*/).hash = '99481330187e8b113a17e072d86af719'; +(node/*: any*/).hash = '28fb7ac76ca11ecf2ff60dae1869a25b'; module.exports = node; diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PowerSearchEquipmentResultsTable.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PowerSearchEquipmentResultsTable.js index aa10a54c7ce1..e2d0a82f77d5 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PowerSearchEquipmentResultsTable.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PowerSearchEquipmentResultsTable.js @@ -20,8 +20,11 @@ import Button from '@fbcnms/ui/components/design-system/Button'; import EquipmentBreadcrumbs from '../equipment/EquipmentBreadcrumbs'; import React from 'react'; import Text from '@fbcnms/ui/components/design-system/Text'; +import classNames from 'classnames'; +import symphony from '@fbcnms/ui/theme/symphony'; import withAlert from '@fbcnms/ui/components/Alert/withAlert'; import {AutoSizer, Column, Table} from 'react-virtualized'; +import {InventoryAPIUrls} from '../../common/InventoryAPI'; import {capitalize} from '@fbcnms/util/strings'; import {createFragmentContainer, graphql} from 'react-relay'; import {lowerCase} from 'lodash'; @@ -67,14 +70,30 @@ const styles = theme => ({ fontSize: '13px', lineHeight: '16px', }, + checked: { + backgroundColor: symphony.palette.B50, + }, + row: { + '&:hover': { + backgroundColor: symphony.palette.background, + }, + '&:focus': { + outline: 'none', + }, + }, + clickableRow: { + cursor: 'pointer', + }, }); type Props = WithAlert & WithStyles & ContextRouter & { equipment: PowerSearchEquipmentResultsTable_equipment, - onEquipmentSelected: (equipment: Equipment) => void, - onWorkOrderSelected: (workOrderId: string) => void, + selectedEquipment?: ?Equipment, + onEquipmentSelected?: (equipment: Equipment) => void, + onWorkOrderSelected?: (workOrderId: string) => void, + onRowSelected?: (equipment: Equipment) => void, }; class PowerSearchEquipmentResultsTable extends React.Component { @@ -91,52 +110,72 @@ class PowerSearchEquipmentResultsTable extends React.Component { }; _cellRenderer = ({dataKey, rowData, cellData}) => { - const {classes, history} = this.props; + const { + classes, + history, + onEquipmentSelected, + onWorkOrderSelected, + onRowSelected, + } = this.props; let content = null; if (dataKey === 'name') { - content = ( - - ); + if (onEquipmentSelected) { + content = ( + + ); + } else { + content = ( + + {cellData} + + ); + } } else if (dataKey === 'status' && rowData.futureState) { - content = ( - - ); + if (onWorkOrderSelected) { + content = ( + + ); + } } else if (dataKey === 'location') { content = ( - history.push( - `inventory/` + (locationId ? `?location=${locationId}` : ''), - ) + onParentLocationClicked={ + onRowSelected + ? null + : locationId => + history.push(InventoryAPIUrls.location(locationId)) } - onEquipmentClicked={equipmentId => - history.push( - `inventory/` + (equipmentId ? `?equipment=${equipmentId}` : ''), - ) + onEquipmentClicked={ + onRowSelected + ? null + : equipmentId => + history.push(InventoryAPIUrls.equipment(equipmentId)) } size="small" /> ); } else { - content = {cellData}; + content = ( + + {cellData} + + ); } return
{content}
; }; render() { - const {classes, equipment} = this.props; + const {classes, equipment, onRowSelected, selectedEquipment} = this.props; if (equipment.length === 0) { return null; } @@ -157,7 +196,20 @@ class PowerSearchEquipmentResultsTable extends React.Component { rowCount={equipment.length} rowGetter={({index}) => equipment[index]} gridClassName={classes.table} - rowClassName={({index}) => (index === -1 ? classes.header : '')}> + rowClassName={({index}) => + classNames({ + [classes.header]: index === -1, + [classes.row]: index !== -1, + [classes.clickableRow]: onRowSelected != null, + [classes.checked]: + selectedEquipment && + index !== -1 && + equipment[index].id === selectedEquipment.id, + }) + } + onRowClick={({_event, _index, rowData}) => + onRowSelected && onRowSelected(rowData) + }> ({ - noResultsRoot: { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - marginTop: '100px', - }, - noResultsLabel: { - color: theme.palette.grey[600], - }, - futureState: { - textTransform: 'capitalize', - maxWidth: '50px', - }, -}); - -type Props = { - equipment: Equipment, - sourcePortId: string, - onPortClicked: (port: EquipmentPort) => void, -} & WithStyles; - -const findNestedAvailablePorts = ( - equipment: ?Equipment, -): Array => { - if (!equipment) { - return []; - } - - const portsToDisplay = [ - ...equipment.ports, - ...getNonInstancePortsDefinitions( - equipment.ports, - equipment.equipmentType.portDefinitions, - ).map(portDef => - getInitialPortFromDefinition(nullthrows(equipment), portDef), - ), - ]; - const directPorts = portsToDisplay - .map(port => ({ - ...port, - breadcrumbs: [equipment], - })) - .filter(port => !port.link) - .sort((portA, portB) => - sortLexicographically(portA.definition.name, portB.definition.name), - ); - const nestedPorts = equipment.positions - .map(position => - findNestedAvailablePorts(position.attachedEquipment).map( - portWithBreadcrumbs => ({ - ...portWithBreadcrumbs, - breadcrumbs: [equipment, ...portWithBreadcrumbs.breadcrumbs], - }), - ), - ) - // $FlowFixMe: https://github.com/facebook/flow/pull/6948 - .flat(); - return [...directPorts, ...nestedPorts]; -}; - -const AvailablePortsTable = (props: Props) => { - const {equipment, sourcePortId, onPortClicked, classes} = props; - const ports = findNestedAvailablePorts(equipment).filter( - port => port.id != sourcePortId, - ); - if (ports.length === 0) { - return ( -
- - No available ports on - {` ${equipment.equipmentType.name} ${equipment.name}`} - -
- ); - } - - return ( - - - - Port Name - Parent Equipment - Visible Label - Type - {isTestEnv() && Status} - - - - {ports.map(port => { - const futureState = port.link?.futureState; - return ( - - - onPortClicked(port)}> - {port.definition.name} - - - - - - {port.definition.visibleLabel} - {isTestEnv() && ( - - - {futureState ? `Planned ${futureState.toLowerCase()}` : ''} - - - )} - - ); - })} - -
- ); -}; - -export default withStyles(styles)(AvailablePortsTable); diff --git a/symphony/app/fbcnms-projects/inventory/app/components/equipment/PortsConnectDialog.js b/symphony/app/fbcnms-projects/inventory/app/components/equipment/PortsConnectDialog.js index c53b1d3a53b6..18f17449ee4b 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/equipment/PortsConnectDialog.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/equipment/PortsConnectDialog.js @@ -8,13 +8,12 @@ * @format */ -import type {ContextRouter} from 'react-router-dom'; import type {Equipment, EquipmentPort} from '../../common/Equipment'; import type {PowerSearchEquipmentResultsTable_equipment} from '../comparison_view/__generated__/PowerSearchEquipmentResultsTable_equipment.graphql'; import type {Property} from '../../common/Property'; import type {WithStyles} from '@material-ui/core'; -import AvailablePortsTable from './AvailablePortsTable'; +import AvailablePortsTable from '../AvailablePortsTable'; import Button from '@fbcnms/ui/components/design-system/Button'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; @@ -35,7 +34,6 @@ import {getInitialPropertyFromType} from '../../common/PropertyType'; import {graphql} from 'react-relay'; import {sortPropertiesByIndex} from '../../common/Property'; import {uniqBy} from 'lodash'; -import {withRouter} from 'react-router-dom'; import {withStyles} from '@material-ui/core/styles'; const styles = theme => ({ @@ -85,8 +83,7 @@ type Props = { equipment: Equipment, port: EquipmentPort, onConnectPorts: (EquipmentPort, Array) => void, -} & WithStyles & - ContextRouter; +} & WithStyles; type State = { activeEquipement: ?Equipment, @@ -113,11 +110,8 @@ const portsConnectDialogQuery = graphql` bandwidth } } - positions { - ...EquipmentPortsTable_position @relay(mask: false) - } ports { - ...EquipmentPortsTable_port @relay(mask: false) + ...AvailablePortsTable_ports } } } @@ -136,15 +130,13 @@ class PortsConnectDialog extends React.Component { } handleElementSelected = equipment => { - this.setState(state => ({ - activeStep: state.activeStep + 1, + this.setState({ activeEquipement: equipment, - })); + }); }; handlePortSelected = (port: EquipmentPort) => { this.setState(state => ({ - activeStep: state.activeStep + 1, targetPort: port, linkProperties: uniqBy( [...state.linkProperties, ...this._getPortProperties(port)], @@ -168,8 +160,8 @@ class PortsConnectDialog extends React.Component { }); getStepContent = () => { - const {history, classes} = this.props; - const {linkProperties} = this.state; + const {classes} = this.props; + const {linkProperties, activeEquipement, targetPort} = this.state; const EquipmentTable = (props: { equipment: PowerSearchEquipmentResultsTable_equipment, }) => { @@ -177,10 +169,8 @@ class PortsConnectDialog extends React.Component {
- history.replace(`inventory?workorder=${workOrderId}`) - } + selectedEquipment={activeEquipement} + onRowSelected={this.handleElementSelected} />
); @@ -199,15 +189,16 @@ class PortsConnectDialog extends React.Component { { const {equipment} = props; return ( ); }} @@ -230,8 +221,8 @@ class PortsConnectDialog extends React.Component { ); default: @@ -259,7 +250,12 @@ class PortsConnectDialog extends React.Component { render() { const {classes} = this.props; - const {activeStep} = this.state; + const { + activeStep, + activeEquipement, + targetPort, + linkProperties, + } = this.state; const lastStep = activeStep == steps.length - 1; const connector = ( { {!lastStep && ( - )} @@ -307,8 +308,8 @@ class PortsConnectDialog extends React.Component { color="primary" onClick={() => this.props.onConnectPorts( - nullthrows(this.state.targetPort), - this.state.linkProperties, + nullthrows(targetPort), + linkProperties, ) }> Connect @@ -320,4 +321,4 @@ class PortsConnectDialog extends React.Component { } } -export default withRouter(withStyles(styles)(PortsConnectDialog)); +export default withStyles(styles)(PortsConnectDialog); diff --git a/symphony/app/fbcnms-projects/inventory/app/components/equipment/__generated__/PortsConnectDialogQuery.graphql.js b/symphony/app/fbcnms-projects/inventory/app/components/equipment/__generated__/PortsConnectDialogQuery.graphql.js index c427a618220a..a0ed9fd42ae8 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/equipment/__generated__/PortsConnectDialogQuery.graphql.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/equipment/__generated__/PortsConnectDialogQuery.graphql.js @@ -6,7 +6,7 @@ /** * @flow - * @relayHash 9fb63c327fbf6314cf44afc293dc814f + * @relayHash eab130c479c2b37c129e067e7f01bfe8 */ /* eslint-disable */ @@ -15,11 +15,7 @@ /*:: import type { ConcreteRequest } from 'relay-runtime'; -type EquipmentBreadcrumbs_equipment$ref = any; -export type FutureState = "INSTALL" | "REMOVE" | "%future added value"; -export type PropertyKind = "bool" | "date" | "datetime_local" | "email" | "enum" | "equipment" | "float" | "gps_location" | "int" | "location" | "range" | "service" | "string" | "%future added value"; -export type ServiceEndpointRole = "CONSUMER" | "PROVIDER" | "%future added value"; -export type WorkOrderStatus = "DONE" | "PENDING" | "PLANNED" | "%future added value"; +type AvailablePortsTable_ports$ref = any; export type PortsConnectDialogQueryVariables = {| equipmentId: string |}; @@ -37,1031 +33,8 @@ export type PortsConnectDialogQueryResponse = {| +bandwidth: ?string, |}>, |}, - +positions?: $ReadOnlyArray, - +linkPropertyTypes: $ReadOnlyArray, - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - |}, - +link: ?{| - +id: string, - +futureState: ?FutureState, - +ports: $ReadOnlyArray - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +futureState: ?FutureState, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, - |}, - |}>, - +workOrder: ?{| - +id: string, - +status: WorkOrderStatus, - |}, - +properties: $ReadOnlyArray, - +services: $ReadOnlyArray, - |}, - +properties: $ReadOnlyArray<{| - +id: string, - +propertyType: {| - +id: string, - +name: string, - +type: PropertyKind, - +isEditable: ?boolean, - +isMandatory: ?boolean, - +isInstanceProperty: ?boolean, - +stringValue: ?string, - |}, - +stringValue: ?string, - +intValue: ?number, - +floatValue: ?number, - +booleanValue: ?boolean, - +latitudeValue: ?number, - +longitudeValue: ?number, - +rangeFromValue: ?number, - +rangeToValue: ?number, - +equipmentValue: ?{| - +id: string, - +name: string, - |}, - +locationValue: ?{| - +id: string, - +name: string, - |}, - +serviceValue: ?{| - +id: string, - +name: string, - |}, - |}>, - +serviceEndpoints: $ReadOnlyArray<{| - +role: ServiceEndpointRole, - +service: {| - +name: string - |}, - |}>, - |}>, - +equipmentType: {| - +portDefinitions: $ReadOnlyArray - |}, - +positions: $ReadOnlyArray, - +linkPropertyTypes: $ReadOnlyArray, - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - |}, - +link: ?{| - +id: string, - +futureState: ?FutureState, - +ports: $ReadOnlyArray - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +futureState: ?FutureState, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, - |}, - |}>, - +workOrder: ?{| - +id: string, - +status: WorkOrderStatus, - |}, - +properties: $ReadOnlyArray, - +services: $ReadOnlyArray, - |}, - +properties: $ReadOnlyArray<{| - +id: string, - +propertyType: {| - +id: string, - +name: string, - +type: PropertyKind, - +isEditable: ?boolean, - +isMandatory: ?boolean, - +isInstanceProperty: ?boolean, - +stringValue: ?string, - |}, - +stringValue: ?string, - +intValue: ?number, - +floatValue: ?number, - +booleanValue: ?boolean, - +latitudeValue: ?number, - +longitudeValue: ?number, - +rangeFromValue: ?number, - +rangeToValue: ?number, - +equipmentValue: ?{| - +id: string, - +name: string, - |}, - +locationValue: ?{| - +id: string, - +name: string, - |}, - +serviceValue: ?{| - +id: string, - +name: string, - |}, - |}>, - +serviceEndpoints: $ReadOnlyArray<{| - +role: ServiceEndpointRole, - +service: {| - +name: string - |}, - |}>, - |}>, - +equipmentType: {| - +portDefinitions: $ReadOnlyArray - |}, - +positions: $ReadOnlyArray, - +linkPropertyTypes: $ReadOnlyArray, - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - |}, - +link: ?{| - +id: string, - +futureState: ?FutureState, - +ports: $ReadOnlyArray - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +futureState: ?FutureState, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, - |}, - |}>, - +workOrder: ?{| - +id: string, - +status: WorkOrderStatus, - |}, - +properties: $ReadOnlyArray, - +services: $ReadOnlyArray, - |}, - +properties: $ReadOnlyArray<{| - +id: string, - +propertyType: {| - +id: string, - +name: string, - +type: PropertyKind, - +isEditable: ?boolean, - +isMandatory: ?boolean, - +isInstanceProperty: ?boolean, - +stringValue: ?string, - |}, - +stringValue: ?string, - +intValue: ?number, - +floatValue: ?number, - +booleanValue: ?boolean, - +latitudeValue: ?number, - +longitudeValue: ?number, - +rangeFromValue: ?number, - +rangeToValue: ?number, - +equipmentValue: ?{| - +id: string, - +name: string, - |}, - +locationValue: ?{| - +id: string, - +name: string, - |}, - +serviceValue: ?{| - +id: string, - +name: string, - |}, - |}>, - +serviceEndpoints: $ReadOnlyArray<{| - +role: ServiceEndpointRole, - +service: {| - +name: string - |}, - |}>, - |}>, - +equipmentType: {| - +portDefinitions: $ReadOnlyArray - |}, - +positions: $ReadOnlyArray, - +linkPropertyTypes: $ReadOnlyArray, - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - |}, - +link: ?{| - +id: string, - +futureState: ?FutureState, - +ports: $ReadOnlyArray - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +futureState: ?FutureState, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, - |}, - |}>, - +workOrder: ?{| - +id: string, - +status: WorkOrderStatus, - |}, - +properties: $ReadOnlyArray, - +services: $ReadOnlyArray, - |}, - +properties: $ReadOnlyArray<{| - +id: string, - +propertyType: {| - +id: string, - +name: string, - +type: PropertyKind, - +isEditable: ?boolean, - +isMandatory: ?boolean, - +isInstanceProperty: ?boolean, - +stringValue: ?string, - |}, - +stringValue: ?string, - +intValue: ?number, - +floatValue: ?number, - +booleanValue: ?boolean, - +latitudeValue: ?number, - +longitudeValue: ?number, - +rangeFromValue: ?number, - +rangeToValue: ?number, - +equipmentValue: ?{| - +id: string, - +name: string, - |}, - +locationValue: ?{| - +id: string, - +name: string, - |}, - +serviceValue: ?{| - +id: string, - +name: string, - |}, - |}>, - +serviceEndpoints: $ReadOnlyArray<{| - +role: ServiceEndpointRole, - +service: {| - +name: string - |}, - |}>, - |}>, - +equipmentType: {| - +portDefinitions: $ReadOnlyArray - |}, - |} - |}>, - |} - |}>, - |} - |}>, - |} - |}>, +ports?: $ReadOnlyArray, - +linkPropertyTypes: $ReadOnlyArray, - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - |}, - +link: ?{| - +id: string, - +futureState: ?FutureState, - +ports: $ReadOnlyArray - |}, - |}, - +parentEquipment: {| - +id: string, - +name: string, - +futureState: ?FutureState, - +equipmentType: {| - +id: string, - +name: string, - +portDefinitions: $ReadOnlyArray, - |}, - +$fragmentRefs: EquipmentBreadcrumbs_equipment$ref, - |}, - |}>, - +workOrder: ?{| - +id: string, - +status: WorkOrderStatus, - |}, - +properties: $ReadOnlyArray, - +services: $ReadOnlyArray, - |}, - +properties: $ReadOnlyArray<{| - +id: string, - +propertyType: {| - +id: string, - +name: string, - +type: PropertyKind, - +isEditable: ?boolean, - +isMandatory: ?boolean, - +isInstanceProperty: ?boolean, - +stringValue: ?string, - |}, - +stringValue: ?string, - +intValue: ?number, - +floatValue: ?number, - +booleanValue: ?boolean, - +latitudeValue: ?number, - +longitudeValue: ?number, - +rangeFromValue: ?number, - +rangeToValue: ?number, - +equipmentValue: ?{| - +id: string, - +name: string, - |}, - +locationValue: ?{| - +id: string, - +name: string, - |}, - +serviceValue: ?{| - +id: string, - +name: string, - |}, - |}>, - +serviceEndpoints: $ReadOnlyArray<{| - +role: ServiceEndpointRole, - +service: {| - +name: string - |}, - |}>, + +$fragmentRefs: AvailablePortsTable_ports$ref |}>, |} |}; @@ -1091,1060 +64,33 @@ query PortsConnectDialogQuery( bandwidth } } - positions { - attachedEquipment { - id - name - ports { - id - definition { - id - name - index - visibleLabel - portType { - id - name - propertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - } - } - parentEquipment { - id - name - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - portType { - id - name - } - bandwidth - } - } - } - link { - id - futureState - ports { - id - definition { - id - name - visibleLabel - portType { - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - id - } - } - parentEquipment { - id - name - futureState - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - bandwidth - portType { - id - name - } - } - } - ...EquipmentBreadcrumbs_equipment - } - } - workOrder { - id - status - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - services { - id - name - } - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - serviceEndpoints { - role - service { - name - id - } - id - } - } - equipmentType { - portDefinitions { - id - name - visibleLabel - bandwidth - } - id - } - positions { - attachedEquipment { - id - name - ports { - id - definition { - id - name - index - visibleLabel - portType { - id - name - propertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - } - } - parentEquipment { - id - name - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - portType { - id - name - } - bandwidth - } - } - } - link { - id - futureState - ports { - id - definition { - id - name - visibleLabel - portType { - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - id - } - } - parentEquipment { - id - name - futureState - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - bandwidth - portType { - id - name - } - } - } - ...EquipmentBreadcrumbs_equipment - } - } - workOrder { - id - status - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - services { - id - name - } - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - serviceEndpoints { - role - service { - name - id - } - id - } - } - equipmentType { - portDefinitions { - id - name - visibleLabel - bandwidth - } - id - } - positions { - attachedEquipment { - id - name - ports { - id - definition { - id - name - index - visibleLabel - portType { - id - name - propertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - } - } - parentEquipment { - id - name - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - portType { - id - name - } - bandwidth - } - } - } - link { - id - futureState - ports { - id - definition { - id - name - visibleLabel - portType { - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - id - } - } - parentEquipment { - id - name - futureState - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - bandwidth - portType { - id - name - } - } - } - ...EquipmentBreadcrumbs_equipment - } - } - workOrder { - id - status - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - services { - id - name - } - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - serviceEndpoints { - role - service { - name - id - } - id - } - } - equipmentType { - portDefinitions { - id - name - visibleLabel - bandwidth - } - id - } - positions { - attachedEquipment { - id - name - ports { - id - definition { - id - name - index - visibleLabel - portType { - id - name - propertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - } - } - parentEquipment { - id - name - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - portType { - id - name - } - bandwidth - } - } - } - link { - id - futureState - ports { - id - definition { - id - name - visibleLabel - portType { - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - id - } - } - parentEquipment { - id - name - futureState - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - bandwidth - portType { - id - name - } - } - } - ...EquipmentBreadcrumbs_equipment - } - } - workOrder { - id - status - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - services { - id - name - } - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - serviceEndpoints { - role - service { - name - id - } - id - } - } - equipmentType { - portDefinitions { - id - name - visibleLabel - bandwidth - } - id - } - } - id - } - } - id - } - } - id - } - } - id - } ports { + ...AvailablePortsTable_ports id - definition { - id - name - index - visibleLabel - portType { - id - name - propertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - } - } - parentEquipment { - id - name - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - portType { - id - name - } - bandwidth - } - } - } - link { - id - futureState - ports { - id - definition { - id - name - visibleLabel - portType { - linkPropertyTypes { - id - name - type - index - stringValue - intValue - booleanValue - floatValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - isEditable - isInstanceProperty - isMandatory - } - id - } - } - parentEquipment { - id - name - futureState - equipmentType { - id - name - portDefinitions { - id - name - visibleLabel - bandwidth - portType { - id - name - } - } - } - ...EquipmentBreadcrumbs_equipment - } - } - workOrder { - id - status - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - services { - id - name - } - } - properties { - id - propertyType { - id - name - type - isEditable - isMandatory - isInstanceProperty - stringValue - } - stringValue - intValue - floatValue - booleanValue - latitudeValue - longitudeValue - rangeFromValue - rangeToValue - equipmentValue { - id - name - } - locationValue { - id - name - } - serviceValue { - id - name - } - } - serviceEndpoints { - role - service { - name - id - } - id - } } } id } } +fragment AvailablePortsTable_ports on EquipmentPort { + id + parentEquipment { + id + name + ...EquipmentBreadcrumbs_equipment + } + definition { + id + name + portType { + name + id + } + visibleLabel + } +} + fragment EquipmentBreadcrumbs_equipment on Equipment { id name @@ -2217,262 +163,6 @@ v4 = { "storageKey": null }, v5 = { - "kind": "ScalarField", - "alias": null, - "name": "bandwidth", - "args": null, - "storageKey": null -}, -v6 = { - "kind": "LinkedField", - "alias": null, - "name": "portDefinitions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortDefinition", - "plural": true, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - (v5/*: any*/) - ] -}, -v7 = { - "kind": "LinkedField", - "alias": null, - "name": "equipmentType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentType", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v6/*: any*/) - ] -}, -v8 = { - "kind": "ScalarField", - "alias": null, - "name": "index", - "args": null, - "storageKey": null -}, -v9 = { - "kind": "ScalarField", - "alias": null, - "name": "type", - "args": null, - "storageKey": null -}, -v10 = { - "kind": "ScalarField", - "alias": null, - "name": "stringValue", - "args": null, - "storageKey": null -}, -v11 = { - "kind": "ScalarField", - "alias": null, - "name": "intValue", - "args": null, - "storageKey": null -}, -v12 = { - "kind": "ScalarField", - "alias": null, - "name": "booleanValue", - "args": null, - "storageKey": null -}, -v13 = { - "kind": "ScalarField", - "alias": null, - "name": "floatValue", - "args": null, - "storageKey": null -}, -v14 = { - "kind": "ScalarField", - "alias": null, - "name": "latitudeValue", - "args": null, - "storageKey": null -}, -v15 = { - "kind": "ScalarField", - "alias": null, - "name": "longitudeValue", - "args": null, - "storageKey": null -}, -v16 = { - "kind": "ScalarField", - "alias": null, - "name": "rangeFromValue", - "args": null, - "storageKey": null -}, -v17 = { - "kind": "ScalarField", - "alias": null, - "name": "rangeToValue", - "args": null, - "storageKey": null -}, -v18 = { - "kind": "ScalarField", - "alias": null, - "name": "isEditable", - "args": null, - "storageKey": null -}, -v19 = { - "kind": "ScalarField", - "alias": null, - "name": "isInstanceProperty", - "args": null, - "storageKey": null -}, -v20 = { - "kind": "ScalarField", - "alias": null, - "name": "isMandatory", - "args": null, - "storageKey": null -}, -v21 = [ - (v2/*: any*/), - (v3/*: any*/), - (v9/*: any*/), - (v8/*: any*/), - (v10/*: any*/), - (v11/*: any*/), - (v12/*: any*/), - (v13/*: any*/), - (v14/*: any*/), - (v15/*: any*/), - (v16/*: any*/), - (v17/*: any*/), - (v18/*: any*/), - (v19/*: any*/), - (v20/*: any*/) -], -v22 = { - "kind": "LinkedField", - "alias": null, - "name": "linkPropertyTypes", - "storageKey": null, - "args": null, - "concreteType": "PropertyType", - "plural": true, - "selections": (v21/*: any*/) -}, -v23 = { - "kind": "LinkedField", - "alias": null, - "name": "definition", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortDefinition", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v8/*: any*/), - (v4/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "portType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortType", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "propertyTypes", - "storageKey": null, - "args": null, - "concreteType": "PropertyType", - "plural": true, - "selections": (v21/*: any*/) - }, - (v22/*: any*/) - ] - } - ] -}, -v24 = [ - (v2/*: any*/), - (v3/*: any*/) -], -v25 = { - "kind": "LinkedField", - "alias": null, - "name": "portType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortType", - "plural": false, - "selections": (v24/*: any*/) -}, -v26 = { - "kind": "LinkedField", - "alias": null, - "name": "parentEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "equipmentType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentType", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "portDefinitions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortDefinition", - "plural": true, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - (v25/*: any*/), - (v5/*: any*/) - ] - } - ] - } - ] -}, -v27 = { - "kind": "ScalarField", - "alias": null, - "name": "futureState", - "args": null, - "storageKey": null -}, -v28 = { "kind": "LinkedField", "alias": null, "name": "equipmentType", @@ -2495,230 +185,18 @@ v28 = { (v2/*: any*/), (v3/*: any*/), (v4/*: any*/), - (v5/*: any*/), - (v25/*: any*/) - ] - } - ] -}, -v29 = { - "kind": "LinkedField", - "alias": null, - "name": "workOrder", - "storageKey": null, - "args": null, - "concreteType": "WorkOrder", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "kind": "ScalarField", - "alias": null, - "name": "status", - "args": null, - "storageKey": null - } - ] -}, -v30 = { - "kind": "LinkedField", - "alias": null, - "name": "properties", - "storageKey": null, - "args": null, - "concreteType": "Property", - "plural": true, - "selections": [ - (v2/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "propertyType", - "storageKey": null, - "args": null, - "concreteType": "PropertyType", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v9/*: any*/), - (v18/*: any*/), - (v20/*: any*/), - (v19/*: any*/), - (v10/*: any*/) - ] - }, - (v10/*: any*/), - (v11/*: any*/), - (v13/*: any*/), - (v12/*: any*/), - (v14/*: any*/), - (v15/*: any*/), - (v16/*: any*/), - (v17/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "equipmentValue", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": (v24/*: any*/) - }, - { - "kind": "LinkedField", - "alias": null, - "name": "locationValue", - "storageKey": null, - "args": null, - "concreteType": "Location", - "plural": false, - "selections": (v24/*: any*/) - }, - { - "kind": "LinkedField", - "alias": null, - "name": "serviceValue", - "storageKey": null, - "args": null, - "concreteType": "Service", - "plural": false, - "selections": (v24/*: any*/) - } - ] -}, -v31 = { - "kind": "LinkedField", - "alias": null, - "name": "services", - "storageKey": null, - "args": null, - "concreteType": "Service", - "plural": true, - "selections": (v24/*: any*/) -}, -v32 = { - "kind": "ScalarField", - "alias": null, - "name": "role", - "args": null, - "storageKey": null -}, -v33 = { - "kind": "LinkedField", - "alias": null, - "name": "ports", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPort", - "plural": true, - "selections": [ - (v2/*: any*/), - (v23/*: any*/), - (v26/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "link", - "storageKey": null, - "args": null, - "concreteType": "Link", - "plural": false, - "selections": [ - (v2/*: any*/), - (v27/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "ports", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPort", - "plural": true, - "selections": [ - (v2/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "definition", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortDefinition", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "portType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortType", - "plural": false, - "selections": [ - (v22/*: any*/) - ] - } - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "parentEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v27/*: any*/), - (v28/*: any*/), - { - "kind": "FragmentSpread", - "name": "EquipmentBreadcrumbs_equipment", - "args": null - } - ] - } - ] - }, - (v29/*: any*/), - (v30/*: any*/), - (v31/*: any*/) - ] - }, - (v30/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "serviceEndpoints", - "storageKey": null, - "args": null, - "concreteType": "ServiceEndpoint", - "plural": true, - "selections": [ - (v32/*: any*/), { - "kind": "LinkedField", + "kind": "ScalarField", "alias": null, - "name": "service", - "storageKey": null, + "name": "bandwidth", "args": null, - "concreteType": "Service", - "plural": false, - "selections": [ - (v3/*: any*/) - ] + "storageKey": null } ] } ] }, -v34 = { +v6 = { "kind": "LinkedField", "alias": null, "name": "equipmentType", @@ -2727,206 +205,14 @@ v34 = { "concreteType": "EquipmentType", "plural": false, "selections": [ - (v6/*: any*/) + (v2/*: any*/), + (v3/*: any*/) ] }, -v35 = [ +v7 = [ (v3/*: any*/), (v2/*: any*/) -], -v36 = { - "kind": "LinkedField", - "alias": null, - "name": "ports", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPort", - "plural": true, - "selections": [ - (v2/*: any*/), - (v23/*: any*/), - (v26/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "link", - "storageKey": null, - "args": null, - "concreteType": "Link", - "plural": false, - "selections": [ - (v2/*: any*/), - (v27/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "ports", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPort", - "plural": true, - "selections": [ - (v2/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "definition", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortDefinition", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "portType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPortType", - "plural": false, - "selections": [ - (v22/*: any*/), - (v2/*: any*/) - ] - } - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "parentEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v27/*: any*/), - (v28/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "locationHierarchy", - "storageKey": null, - "args": null, - "concreteType": "Location", - "plural": true, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "locationType", - "storageKey": null, - "args": null, - "concreteType": "LocationType", - "plural": false, - "selections": (v35/*: any*/) - } - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "positionHierarchy", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - (v2/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "definition", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPositionDefinition", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/) - ] - }, - { - "kind": "LinkedField", - "alias": null, - "name": "parentEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "equipmentType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentType", - "plural": false, - "selections": (v24/*: any*/) - } - ] - } - ] - } - ] - } - ] - }, - (v29/*: any*/), - (v30/*: any*/), - (v31/*: any*/) - ] - }, - (v30/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "serviceEndpoints", - "storageKey": null, - "args": null, - "concreteType": "ServiceEndpoint", - "plural": true, - "selections": [ - (v32/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "service", - "storageKey": null, - "args": null, - "concreteType": "Service", - "plural": false, - "selections": (v35/*: any*/) - }, - (v2/*: any*/) - ] - } - ] -}, -v37 = { - "kind": "LinkedField", - "alias": null, - "name": "equipmentType", - "storageKey": null, - "args": null, - "concreteType": "EquipmentType", - "plural": false, - "selections": [ - (v6/*: any*/), - (v2/*: any*/) - ] -}; +]; return { "kind": "Request", "fragment": { @@ -2951,112 +237,23 @@ return { "selections": [ (v2/*: any*/), (v3/*: any*/), - (v7/*: any*/), + (v5/*: any*/), { "kind": "LinkedField", "alias": null, - "name": "positions", + "name": "ports", "storageKey": null, "args": null, - "concreteType": "EquipmentPosition", + "concreteType": "EquipmentPort", "plural": true, "selections": [ { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v33/*: any*/), - (v34/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "positions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v33/*: any*/), - (v34/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "positions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v33/*: any*/), - (v34/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "positions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v33/*: any*/), - (v34/*: any*/) - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] + "kind": "FragmentSpread", + "name": "AvailablePortsTable_ports", + "args": null } ] - }, - (v33/*: any*/) + } ] } ] @@ -3090,20 +287,21 @@ return { "type": "Equipment", "selections": [ (v3/*: any*/), - (v7/*: any*/), + (v5/*: any*/), { "kind": "LinkedField", "alias": null, - "name": "positions", + "name": "ports", "storageKey": null, "args": null, - "concreteType": "EquipmentPosition", + "concreteType": "EquipmentPort", "plural": true, "selections": [ + (v2/*: any*/), { "kind": "LinkedField", "alias": null, - "name": "attachedEquipment", + "name": "parentEquipment", "storageKey": null, "args": null, "concreteType": "Equipment", @@ -3111,95 +309,98 @@ return { "selections": [ (v2/*: any*/), (v3/*: any*/), - (v36/*: any*/), - (v37/*: any*/), + (v6/*: any*/), + { + "kind": "LinkedField", + "alias": null, + "name": "locationHierarchy", + "storageKey": null, + "args": null, + "concreteType": "Location", + "plural": true, + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + { + "kind": "LinkedField", + "alias": null, + "name": "locationType", + "storageKey": null, + "args": null, + "concreteType": "LocationType", + "plural": false, + "selections": (v7/*: any*/) + } + ] + }, { "kind": "LinkedField", "alias": null, - "name": "positions", + "name": "positionHierarchy", "storageKey": null, "args": null, "concreteType": "EquipmentPosition", "plural": true, "selections": [ + (v2/*: any*/), { "kind": "LinkedField", "alias": null, - "name": "attachedEquipment", + "name": "definition", "storageKey": null, "args": null, - "concreteType": "Equipment", + "concreteType": "EquipmentPositionDefinition", "plural": false, "selections": [ (v2/*: any*/), (v3/*: any*/), - (v36/*: any*/), - (v37/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "positions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v36/*: any*/), - (v37/*: any*/), - { - "kind": "LinkedField", - "alias": null, - "name": "positions", - "storageKey": null, - "args": null, - "concreteType": "EquipmentPosition", - "plural": true, - "selections": [ - { - "kind": "LinkedField", - "alias": null, - "name": "attachedEquipment", - "storageKey": null, - "args": null, - "concreteType": "Equipment", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v36/*: any*/), - (v37/*: any*/) - ] - }, - (v2/*: any*/) - ] - } - ] - }, - (v2/*: any*/) - ] - } + (v4/*: any*/) ] }, - (v2/*: any*/) + { + "kind": "LinkedField", + "alias": null, + "name": "parentEquipment", + "storageKey": null, + "args": null, + "concreteType": "Equipment", + "plural": false, + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + (v6/*: any*/) + ] + } ] } ] }, - (v2/*: any*/) + { + "kind": "LinkedField", + "alias": null, + "name": "definition", + "storageKey": null, + "args": null, + "concreteType": "EquipmentPortDefinition", + "plural": false, + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + { + "kind": "LinkedField", + "alias": null, + "name": "portType", + "storageKey": null, + "args": null, + "concreteType": "EquipmentPortType", + "plural": false, + "selections": (v7/*: any*/) + }, + (v4/*: any*/) + ] + } ] - }, - (v36/*: any*/) + } ] } ] @@ -3210,11 +411,11 @@ return { "operationKind": "query", "name": "PortsConnectDialogQuery", "id": null, - "text": "query PortsConnectDialogQuery(\n $equipmentId: ID!\n) {\n equipment: node(id: $equipmentId) {\n __typename\n ... on Equipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n }\n positions {\n attachedEquipment {\n id\n name\n ports {\n id\n definition {\n id\n name\n index\n visibleLabel\n portType {\n id\n name\n propertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n }\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n portType {\n id\n name\n }\n bandwidth\n }\n }\n }\n link {\n id\n futureState\n ports {\n id\n definition {\n id\n name\n visibleLabel\n portType {\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n id\n }\n }\n parentEquipment {\n id\n name\n futureState\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n portType {\n id\n name\n }\n }\n }\n ...EquipmentBreadcrumbs_equipment\n }\n }\n workOrder {\n id\n status\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n services {\n id\n name\n }\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n serviceEndpoints {\n role\n service {\n name\n id\n }\n id\n }\n }\n equipmentType {\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n id\n }\n positions {\n attachedEquipment {\n id\n name\n ports {\n id\n definition {\n id\n name\n index\n visibleLabel\n portType {\n id\n name\n propertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n }\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n portType {\n id\n name\n }\n bandwidth\n }\n }\n }\n link {\n id\n futureState\n ports {\n id\n definition {\n id\n name\n visibleLabel\n portType {\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n id\n }\n }\n parentEquipment {\n id\n name\n futureState\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n portType {\n id\n name\n }\n }\n }\n ...EquipmentBreadcrumbs_equipment\n }\n }\n workOrder {\n id\n status\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n services {\n id\n name\n }\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n serviceEndpoints {\n role\n service {\n name\n id\n }\n id\n }\n }\n equipmentType {\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n id\n }\n positions {\n attachedEquipment {\n id\n name\n ports {\n id\n definition {\n id\n name\n index\n visibleLabel\n portType {\n id\n name\n propertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n }\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n portType {\n id\n name\n }\n bandwidth\n }\n }\n }\n link {\n id\n futureState\n ports {\n id\n definition {\n id\n name\n visibleLabel\n portType {\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n id\n }\n }\n parentEquipment {\n id\n name\n futureState\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n portType {\n id\n name\n }\n }\n }\n ...EquipmentBreadcrumbs_equipment\n }\n }\n workOrder {\n id\n status\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n services {\n id\n name\n }\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n serviceEndpoints {\n role\n service {\n name\n id\n }\n id\n }\n }\n equipmentType {\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n id\n }\n positions {\n attachedEquipment {\n id\n name\n ports {\n id\n definition {\n id\n name\n index\n visibleLabel\n portType {\n id\n name\n propertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n }\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n portType {\n id\n name\n }\n bandwidth\n }\n }\n }\n link {\n id\n futureState\n ports {\n id\n definition {\n id\n name\n visibleLabel\n portType {\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n id\n }\n }\n parentEquipment {\n id\n name\n futureState\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n portType {\n id\n name\n }\n }\n }\n ...EquipmentBreadcrumbs_equipment\n }\n }\n workOrder {\n id\n status\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n services {\n id\n name\n }\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n serviceEndpoints {\n role\n service {\n name\n id\n }\n id\n }\n }\n equipmentType {\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n id\n }\n }\n id\n }\n }\n id\n }\n }\n id\n }\n }\n id\n }\n ports {\n id\n definition {\n id\n name\n index\n visibleLabel\n portType {\n id\n name\n propertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n }\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n portType {\n id\n name\n }\n bandwidth\n }\n }\n }\n link {\n id\n futureState\n ports {\n id\n definition {\n id\n name\n visibleLabel\n portType {\n linkPropertyTypes {\n id\n name\n type\n index\n stringValue\n intValue\n booleanValue\n floatValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n isEditable\n isInstanceProperty\n isMandatory\n }\n id\n }\n }\n parentEquipment {\n id\n name\n futureState\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n portType {\n id\n name\n }\n }\n }\n ...EquipmentBreadcrumbs_equipment\n }\n }\n workOrder {\n id\n status\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n services {\n id\n name\n }\n }\n properties {\n id\n propertyType {\n id\n name\n type\n isEditable\n isMandatory\n isInstanceProperty\n stringValue\n }\n stringValue\n intValue\n floatValue\n booleanValue\n latitudeValue\n longitudeValue\n rangeFromValue\n rangeToValue\n equipmentValue {\n id\n name\n }\n locationValue {\n id\n name\n }\n serviceValue {\n id\n name\n }\n }\n serviceEndpoints {\n role\n service {\n name\n id\n }\n id\n }\n }\n }\n id\n }\n}\n\nfragment EquipmentBreadcrumbs_equipment on Equipment {\n id\n name\n equipmentType {\n id\n name\n }\n locationHierarchy {\n id\n name\n locationType {\n name\n id\n }\n }\n positionHierarchy {\n id\n definition {\n id\n name\n visibleLabel\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n }\n }\n }\n}\n", + "text": "query PortsConnectDialogQuery(\n $equipmentId: ID!\n) {\n equipment: node(id: $equipmentId) {\n __typename\n ... on Equipment {\n id\n name\n equipmentType {\n id\n name\n portDefinitions {\n id\n name\n visibleLabel\n bandwidth\n }\n }\n ports {\n ...AvailablePortsTable_ports\n id\n }\n }\n id\n }\n}\n\nfragment AvailablePortsTable_ports on EquipmentPort {\n id\n parentEquipment {\n id\n name\n ...EquipmentBreadcrumbs_equipment\n }\n definition {\n id\n name\n portType {\n name\n id\n }\n visibleLabel\n }\n}\n\nfragment EquipmentBreadcrumbs_equipment on Equipment {\n id\n name\n equipmentType {\n id\n name\n }\n locationHierarchy {\n id\n name\n locationType {\n name\n id\n }\n }\n positionHierarchy {\n id\n definition {\n id\n name\n visibleLabel\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n }\n }\n }\n}\n", "metadata": {} } }; })(); // prettier-ignore -(node/*: any*/).hash = '9672bba6848ea6ee72e822943c65226a'; +(node/*: any*/).hash = 'c6ed674b707a49f18299bfa924724cd3'; module.exports = node; diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/AddEndpointToServiceDialog.js b/symphony/app/fbcnms-projects/inventory/app/components/services/AddEndpointToServiceDialog.js index e5aa69e2c2dc..2efb1be563a1 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/AddEndpointToServiceDialog.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/services/AddEndpointToServiceDialog.js @@ -12,7 +12,7 @@ import type {Equipment, EquipmentPort} from '../../common/Equipment'; import type {ServiceEndpointRole} from '../../mutations/__generated__/AddServiceEndpointMutation.graphql'; import type {WithStyles} from '@material-ui/core'; -import AvailablePortsTable from './AvailablePortsTable'; +import AvailablePortsTable from '../AvailablePortsTable'; import Button from '@fbcnms/ui/components/design-system/Button'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/PowerSearchLinkFirstEquipmentResultsTable.js b/symphony/app/fbcnms-projects/inventory/app/components/services/PowerSearchLinkFirstEquipmentResultsTable.js index f1986f5d4b7c..67edd243d10c 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/PowerSearchLinkFirstEquipmentResultsTable.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/services/PowerSearchLinkFirstEquipmentResultsTable.js @@ -61,12 +61,15 @@ const useStyles = makeStyles(theme => ({ }, row: { '&:hover': { - backgroundColor: symphony.palette.B50, + backgroundColor: symphony.palette.background, }, '&:focus': { outline: 'none', }, }, + clickableRow: { + cursor: 'pointer', + }, })); type Props = { @@ -133,6 +136,7 @@ const PowerSearchLinkFirstEquipmentResultsTable = (props: Props) => { classNames({ [classes.header]: index === -1, [classes.row]: index !== -1, + [classes.clickableRow]: onRowClicked != null, [classes.checked]: selectedEquipment && index !== -1 && diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AddEndpointToServiceDialogQuery.graphql.js b/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AddEndpointToServiceDialogQuery.graphql.js index 90484b52aeee..600a2180ce39 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AddEndpointToServiceDialogQuery.graphql.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/services/__generated__/AddEndpointToServiceDialogQuery.graphql.js @@ -6,7 +6,7 @@ /** * @flow - * @relayHash f96b1774dbdcaf150948ef827771bb20 + * @relayHash 83908f55e73a568dadcf6679c8edf8ff */ /* eslint-disable */ @@ -93,13 +93,13 @@ fragment AvailablePortsTable_ports on EquipmentPort { ...EquipmentBreadcrumbs_equipment } definition { + id name portType { name id } visibleLabel - id } } @@ -381,7 +381,7 @@ return { "operationKind": "query", "name": "AddEndpointToServiceDialogQuery", "id": null, - "text": "query AddEndpointToServiceDialogQuery(\n $filters: [PortFilterInput!]!\n) {\n portSearch(filters: $filters, limit: 50) {\n ports {\n id\n definition {\n id\n name\n }\n ...AvailablePortsTable_ports\n }\n }\n}\n\nfragment AvailablePortsTable_ports on EquipmentPort {\n id\n parentEquipment {\n id\n name\n ...EquipmentBreadcrumbs_equipment\n }\n definition {\n name\n portType {\n name\n id\n }\n visibleLabel\n id\n }\n}\n\nfragment EquipmentBreadcrumbs_equipment on Equipment {\n id\n name\n equipmentType {\n id\n name\n }\n locationHierarchy {\n id\n name\n locationType {\n name\n id\n }\n }\n positionHierarchy {\n id\n definition {\n id\n name\n visibleLabel\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n }\n }\n }\n}\n", + "text": "query AddEndpointToServiceDialogQuery(\n $filters: [PortFilterInput!]!\n) {\n portSearch(filters: $filters, limit: 50) {\n ports {\n id\n definition {\n id\n name\n }\n ...AvailablePortsTable_ports\n }\n }\n}\n\nfragment AvailablePortsTable_ports on EquipmentPort {\n id\n parentEquipment {\n id\n name\n ...EquipmentBreadcrumbs_equipment\n }\n definition {\n id\n name\n portType {\n name\n id\n }\n visibleLabel\n }\n}\n\nfragment EquipmentBreadcrumbs_equipment on Equipment {\n id\n name\n equipmentType {\n id\n name\n }\n locationHierarchy {\n id\n name\n locationType {\n name\n id\n }\n }\n positionHierarchy {\n id\n definition {\n id\n name\n visibleLabel\n }\n parentEquipment {\n id\n name\n equipmentType {\n id\n name\n }\n }\n }\n}\n", "metadata": {} } }; From eaf05cd106d3d87b27c7a8f022d85b3e1cb11f2b Mon Sep 17 00:00:00 2001 From: Alex Snast Date: Thu, 16 Jan 2020 04:18:31 -0800 Subject: [PATCH 06/26] symphony/graph: adding relay pagination support to all root queries returning connections Summary: Pull Request resolved: https://github.com/facebookincubator/symphony/pull/219 Reviewed By: idoshveki Differential Revision: D19410483 fbshipit-source-id: 7bdbc0df9b01fcb8bc8bfa1064a3d8654d04ff4f --- .../EquipmentTypesListQuery.graphql.js | 4 +- ...InventoryEntitiesTypeaheadQuery.graphql.js | 4 +- .../LocationTypesListQuery.graphql.js | 4 +- .../LocationsTreeQuery.graphql.js | 4 +- ...rSearchEquipmentTypeFilterQuery.graphql.js | 4 +- .../PowerSearchLocationFilterQuery.graphql.js | 4 +- ...erSearchLocationTypeFilterQuery.graphql.js | 4 +- ...SearchPortDefinitionFilterQuery.graphql.js | 4 +- ...tionTypesHookLocationTypesQuery.graphql.js | 4 +- .../EquipmentPortTypesQuery.graphql.js | 4 +- .../EquipmentTypesQuery.graphql.js | 4 +- .../LocationTypesQuery.graphql.js | 4 +- ...tTable__equipmentPortTypesQuery.graphql.js | 4 +- .../ServiceTypesQuery.graphql.js | 4 +- .../WorkOrderProjectTypesQuery.graphql.js | 6 +- .../WorkOrderTypesQuery.graphql.js | 4 +- .../LocationsMapTypesQuery.graphql.js | 6 +- .../ProjectTypesListQuery.graphql.js | 4 +- ...werSearchServiceTypeFilterQuery.graphql.js | 4 +- .../ServiceTypesListQuery.graphql.js | 4 +- ...ocationTypeahead_LocationsQuery.graphql.js | 4 +- ...rSearchWorkOrderTypeFilterQuery.graphql.js | 4 +- .../WorkOrderTypesListQuery.graphql.js | 4 +- .../WorkOrdersPaneQuery.graphql.js | 4 +- .../graphql/equipment_types_query.py | 2 +- .../graphql/location_type_locations_query.py | 2 +- .../graphql/location_types_query.py | 2 +- .../cli/pyinventory/graphql/search_query.py | 2 +- .../graphql/service_types_query.py | 2 +- symphony/graph/ent/gen.go | 2 +- symphony/graph/ent/locationtype.go | 4 +- symphony/graph/ent/pagination.go | 3208 +++++++++++++++++ .../cursor_test.go => ent/pagination_test.go} | 6 +- symphony/graph/ent/schema/location.go | 3 +- symphony/graph/exporter/utils.go | 16 +- symphony/graph/graphql/generated/exec.go | 2740 +++++++------- symphony/graph/graphql/models/cursor.go | 49 - symphony/graph/graphql/models/generated.go | 121 +- symphony/graph/graphql/resolver/location.go | 21 +- symphony/graph/graphql/resolver/project.go | 37 +- symphony/graph/graphql/resolver/query.go | 135 +- symphony/graph/graphql/resolver/survey.go | 10 +- .../graph/graphql/resolver/survey_test.go | 5 +- .../graph/graphql/schema/symphony.graphql | 330 +- symphony/graph/resolverutil/resolvers.go | 68 +- 45 files changed, 5133 insertions(+), 1732 deletions(-) create mode 100644 symphony/graph/ent/pagination.go rename symphony/graph/{graphql/models/cursor_test.go => ent/pagination_test.go} (89%) delete mode 100644 symphony/graph/graphql/models/cursor.go diff --git a/symphony/app/fbcnms-projects/inventory/app/components/__generated__/EquipmentTypesListQuery.graphql.js b/symphony/app/fbcnms-projects/inventory/app/components/__generated__/EquipmentTypesListQuery.graphql.js index 0ae5f8e224f1..967dc2623745 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/__generated__/EquipmentTypesListQuery.graphql.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/__generated__/EquipmentTypesListQuery.graphql.js @@ -6,7 +6,7 @@ /** * @flow - * @relayHash 3adb67e74eec89048cb3cf72db5e7838 + * @relayHash 856cd484d9bda9891f37a734ad1f3821 */ /* eslint-disable */ @@ -19,7 +19,7 @@ export type PropertyKind = "bool" | "date" | "datetime_local" | "email" | "enum" export type EquipmentTypesListQueryVariables = {||}; export type EquipmentTypesListQueryResponse = {| +equipmentTypes: {| - +edges: ?$ReadOnlyArray |}, +workOrderTypes: ?{| - +edges: ?$ReadOnlyArray *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ActionsRuleEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ActionsRuleEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// CheckListItemEdge is the edge representation of CheckListItem. +type CheckListItemEdge struct { + Node *CheckListItem `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// CheckListItemConnection is the connection containing edges to CheckListItem. +type CheckListItemConnection struct { + Edges []*CheckListItemEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to CheckListItem. +func (cli *CheckListItemQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*CheckListItemConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &CheckListItemConnection{ + Edges: []*CheckListItemEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &CheckListItemConnection{ + Edges: []*CheckListItemEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + cli = cli.Where(checklistitem.IDGT(after.ID)) + } + if before != nil { + cli = cli.Where(checklistitem.IDLT(before.ID)) + } + if first != nil { + cli = cli.Order(Asc(checklistitem.FieldID)).Limit(*first + 1) + } + if last != nil { + cli = cli.Order(Desc(checklistitem.FieldID)).Limit(*last + 1) + } + + nodes, err := cli.All(ctx) + if err != nil || len(nodes) == 0 { + return &CheckListItemConnection{ + Edges: []*CheckListItemEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn CheckListItemConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*CheckListItemEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &CheckListItemEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// CheckListItemDefinitionEdge is the edge representation of CheckListItemDefinition. +type CheckListItemDefinitionEdge struct { + Node *CheckListItemDefinition `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// CheckListItemDefinitionConnection is the connection containing edges to CheckListItemDefinition. +type CheckListItemDefinitionConnection struct { + Edges []*CheckListItemDefinitionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to CheckListItemDefinition. +func (clid *CheckListItemDefinitionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*CheckListItemDefinitionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &CheckListItemDefinitionConnection{ + Edges: []*CheckListItemDefinitionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &CheckListItemDefinitionConnection{ + Edges: []*CheckListItemDefinitionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + clid = clid.Where(checklistitemdefinition.IDGT(after.ID)) + } + if before != nil { + clid = clid.Where(checklistitemdefinition.IDLT(before.ID)) + } + if first != nil { + clid = clid.Order(Asc(checklistitemdefinition.FieldID)).Limit(*first + 1) + } + if last != nil { + clid = clid.Order(Desc(checklistitemdefinition.FieldID)).Limit(*last + 1) + } + + nodes, err := clid.All(ctx) + if err != nil || len(nodes) == 0 { + return &CheckListItemDefinitionConnection{ + Edges: []*CheckListItemDefinitionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn CheckListItemDefinitionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*CheckListItemDefinitionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &CheckListItemDefinitionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// CommentEdge is the edge representation of Comment. +type CommentEdge struct { + Node *Comment `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// CommentConnection is the connection containing edges to Comment. +type CommentConnection struct { + Edges []*CommentEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Comment. +func (c *CommentQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*CommentConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &CommentConnection{ + Edges: []*CommentEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &CommentConnection{ + Edges: []*CommentEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + c = c.Where(comment.IDGT(after.ID)) + } + if before != nil { + c = c.Where(comment.IDLT(before.ID)) + } + if first != nil { + c = c.Order(Asc(comment.FieldID)).Limit(*first + 1) + } + if last != nil { + c = c.Order(Desc(comment.FieldID)).Limit(*last + 1) + } + + nodes, err := c.All(ctx) + if err != nil || len(nodes) == 0 { + return &CommentConnection{ + Edges: []*CommentEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn CommentConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*CommentEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &CommentEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// CustomerEdge is the edge representation of Customer. +type CustomerEdge struct { + Node *Customer `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// CustomerConnection is the connection containing edges to Customer. +type CustomerConnection struct { + Edges []*CustomerEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Customer. +func (c *CustomerQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*CustomerConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &CustomerConnection{ + Edges: []*CustomerEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &CustomerConnection{ + Edges: []*CustomerEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + c = c.Where(customer.IDGT(after.ID)) + } + if before != nil { + c = c.Where(customer.IDLT(before.ID)) + } + if first != nil { + c = c.Order(Asc(customer.FieldID)).Limit(*first + 1) + } + if last != nil { + c = c.Order(Desc(customer.FieldID)).Limit(*last + 1) + } + + nodes, err := c.All(ctx) + if err != nil || len(nodes) == 0 { + return &CustomerConnection{ + Edges: []*CustomerEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn CustomerConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*CustomerEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &CustomerEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentEdge is the edge representation of Equipment. +type EquipmentEdge struct { + Node *Equipment `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentConnection is the connection containing edges to Equipment. +type EquipmentConnection struct { + Edges []*EquipmentEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Equipment. +func (e *EquipmentQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentConnection{ + Edges: []*EquipmentEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentConnection{ + Edges: []*EquipmentEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + e = e.Where(equipment.IDGT(after.ID)) + } + if before != nil { + e = e.Where(equipment.IDLT(before.ID)) + } + if first != nil { + e = e.Order(Asc(equipment.FieldID)).Limit(*first + 1) + } + if last != nil { + e = e.Order(Desc(equipment.FieldID)).Limit(*last + 1) + } + + nodes, err := e.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentConnection{ + Edges: []*EquipmentEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentCategoryEdge is the edge representation of EquipmentCategory. +type EquipmentCategoryEdge struct { + Node *EquipmentCategory `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentCategoryConnection is the connection containing edges to EquipmentCategory. +type EquipmentCategoryConnection struct { + Edges []*EquipmentCategoryEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentCategory. +func (ec *EquipmentCategoryQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentCategoryConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentCategoryConnection{ + Edges: []*EquipmentCategoryEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentCategoryConnection{ + Edges: []*EquipmentCategoryEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + ec = ec.Where(equipmentcategory.IDGT(after.ID)) + } + if before != nil { + ec = ec.Where(equipmentcategory.IDLT(before.ID)) + } + if first != nil { + ec = ec.Order(Asc(equipmentcategory.FieldID)).Limit(*first + 1) + } + if last != nil { + ec = ec.Order(Desc(equipmentcategory.FieldID)).Limit(*last + 1) + } + + nodes, err := ec.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentCategoryConnection{ + Edges: []*EquipmentCategoryEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentCategoryConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentCategoryEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentCategoryEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentPortEdge is the edge representation of EquipmentPort. +type EquipmentPortEdge struct { + Node *EquipmentPort `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentPortConnection is the connection containing edges to EquipmentPort. +type EquipmentPortConnection struct { + Edges []*EquipmentPortEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentPort. +func (ep *EquipmentPortQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentPortConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentPortConnection{ + Edges: []*EquipmentPortEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentPortConnection{ + Edges: []*EquipmentPortEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + ep = ep.Where(equipmentport.IDGT(after.ID)) + } + if before != nil { + ep = ep.Where(equipmentport.IDLT(before.ID)) + } + if first != nil { + ep = ep.Order(Asc(equipmentport.FieldID)).Limit(*first + 1) + } + if last != nil { + ep = ep.Order(Desc(equipmentport.FieldID)).Limit(*last + 1) + } + + nodes, err := ep.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentPortConnection{ + Edges: []*EquipmentPortEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentPortConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentPortEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentPortEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentPortDefinitionEdge is the edge representation of EquipmentPortDefinition. +type EquipmentPortDefinitionEdge struct { + Node *EquipmentPortDefinition `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentPortDefinitionConnection is the connection containing edges to EquipmentPortDefinition. +type EquipmentPortDefinitionConnection struct { + Edges []*EquipmentPortDefinitionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentPortDefinition. +func (epd *EquipmentPortDefinitionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentPortDefinitionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentPortDefinitionConnection{ + Edges: []*EquipmentPortDefinitionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentPortDefinitionConnection{ + Edges: []*EquipmentPortDefinitionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + epd = epd.Where(equipmentportdefinition.IDGT(after.ID)) + } + if before != nil { + epd = epd.Where(equipmentportdefinition.IDLT(before.ID)) + } + if first != nil { + epd = epd.Order(Asc(equipmentportdefinition.FieldID)).Limit(*first + 1) + } + if last != nil { + epd = epd.Order(Desc(equipmentportdefinition.FieldID)).Limit(*last + 1) + } + + nodes, err := epd.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentPortDefinitionConnection{ + Edges: []*EquipmentPortDefinitionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentPortDefinitionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentPortDefinitionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentPortDefinitionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentPortTypeEdge is the edge representation of EquipmentPortType. +type EquipmentPortTypeEdge struct { + Node *EquipmentPortType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentPortTypeConnection is the connection containing edges to EquipmentPortType. +type EquipmentPortTypeConnection struct { + Edges []*EquipmentPortTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentPortType. +func (ept *EquipmentPortTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentPortTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentPortTypeConnection{ + Edges: []*EquipmentPortTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentPortTypeConnection{ + Edges: []*EquipmentPortTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + ept = ept.Where(equipmentporttype.IDGT(after.ID)) + } + if before != nil { + ept = ept.Where(equipmentporttype.IDLT(before.ID)) + } + if first != nil { + ept = ept.Order(Asc(equipmentporttype.FieldID)).Limit(*first + 1) + } + if last != nil { + ept = ept.Order(Desc(equipmentporttype.FieldID)).Limit(*last + 1) + } + + nodes, err := ept.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentPortTypeConnection{ + Edges: []*EquipmentPortTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentPortTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentPortTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentPortTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentPositionEdge is the edge representation of EquipmentPosition. +type EquipmentPositionEdge struct { + Node *EquipmentPosition `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentPositionConnection is the connection containing edges to EquipmentPosition. +type EquipmentPositionConnection struct { + Edges []*EquipmentPositionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentPosition. +func (ep *EquipmentPositionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentPositionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentPositionConnection{ + Edges: []*EquipmentPositionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentPositionConnection{ + Edges: []*EquipmentPositionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + ep = ep.Where(equipmentposition.IDGT(after.ID)) + } + if before != nil { + ep = ep.Where(equipmentposition.IDLT(before.ID)) + } + if first != nil { + ep = ep.Order(Asc(equipmentposition.FieldID)).Limit(*first + 1) + } + if last != nil { + ep = ep.Order(Desc(equipmentposition.FieldID)).Limit(*last + 1) + } + + nodes, err := ep.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentPositionConnection{ + Edges: []*EquipmentPositionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentPositionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentPositionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentPositionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentPositionDefinitionEdge is the edge representation of EquipmentPositionDefinition. +type EquipmentPositionDefinitionEdge struct { + Node *EquipmentPositionDefinition `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentPositionDefinitionConnection is the connection containing edges to EquipmentPositionDefinition. +type EquipmentPositionDefinitionConnection struct { + Edges []*EquipmentPositionDefinitionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentPositionDefinition. +func (epd *EquipmentPositionDefinitionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentPositionDefinitionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentPositionDefinitionConnection{ + Edges: []*EquipmentPositionDefinitionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentPositionDefinitionConnection{ + Edges: []*EquipmentPositionDefinitionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + epd = epd.Where(equipmentpositiondefinition.IDGT(after.ID)) + } + if before != nil { + epd = epd.Where(equipmentpositiondefinition.IDLT(before.ID)) + } + if first != nil { + epd = epd.Order(Asc(equipmentpositiondefinition.FieldID)).Limit(*first + 1) + } + if last != nil { + epd = epd.Order(Desc(equipmentpositiondefinition.FieldID)).Limit(*last + 1) + } + + nodes, err := epd.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentPositionDefinitionConnection{ + Edges: []*EquipmentPositionDefinitionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentPositionDefinitionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentPositionDefinitionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentPositionDefinitionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// EquipmentTypeEdge is the edge representation of EquipmentType. +type EquipmentTypeEdge struct { + Node *EquipmentType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// EquipmentTypeConnection is the connection containing edges to EquipmentType. +type EquipmentTypeConnection struct { + Edges []*EquipmentTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to EquipmentType. +func (et *EquipmentTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*EquipmentTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &EquipmentTypeConnection{ + Edges: []*EquipmentTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &EquipmentTypeConnection{ + Edges: []*EquipmentTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + et = et.Where(equipmenttype.IDGT(after.ID)) + } + if before != nil { + et = et.Where(equipmenttype.IDLT(before.ID)) + } + if first != nil { + et = et.Order(Asc(equipmenttype.FieldID)).Limit(*first + 1) + } + if last != nil { + et = et.Order(Desc(equipmenttype.FieldID)).Limit(*last + 1) + } + + nodes, err := et.All(ctx) + if err != nil || len(nodes) == 0 { + return &EquipmentTypeConnection{ + Edges: []*EquipmentTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn EquipmentTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*EquipmentTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &EquipmentTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// FileEdge is the edge representation of File. +type FileEdge struct { + Node *File `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// FileConnection is the connection containing edges to File. +type FileConnection struct { + Edges []*FileEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to File. +func (f *FileQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*FileConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &FileConnection{ + Edges: []*FileEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &FileConnection{ + Edges: []*FileEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + f = f.Where(file.IDGT(after.ID)) + } + if before != nil { + f = f.Where(file.IDLT(before.ID)) + } + if first != nil { + f = f.Order(Asc(file.FieldID)).Limit(*first + 1) + } + if last != nil { + f = f.Order(Desc(file.FieldID)).Limit(*last + 1) + } + + nodes, err := f.All(ctx) + if err != nil || len(nodes) == 0 { + return &FileConnection{ + Edges: []*FileEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn FileConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*FileEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &FileEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// FloorPlanEdge is the edge representation of FloorPlan. +type FloorPlanEdge struct { + Node *FloorPlan `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// FloorPlanConnection is the connection containing edges to FloorPlan. +type FloorPlanConnection struct { + Edges []*FloorPlanEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to FloorPlan. +func (fp *FloorPlanQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*FloorPlanConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &FloorPlanConnection{ + Edges: []*FloorPlanEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &FloorPlanConnection{ + Edges: []*FloorPlanEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + fp = fp.Where(floorplan.IDGT(after.ID)) + } + if before != nil { + fp = fp.Where(floorplan.IDLT(before.ID)) + } + if first != nil { + fp = fp.Order(Asc(floorplan.FieldID)).Limit(*first + 1) + } + if last != nil { + fp = fp.Order(Desc(floorplan.FieldID)).Limit(*last + 1) + } + + nodes, err := fp.All(ctx) + if err != nil || len(nodes) == 0 { + return &FloorPlanConnection{ + Edges: []*FloorPlanEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn FloorPlanConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*FloorPlanEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &FloorPlanEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// FloorPlanReferencePointEdge is the edge representation of FloorPlanReferencePoint. +type FloorPlanReferencePointEdge struct { + Node *FloorPlanReferencePoint `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// FloorPlanReferencePointConnection is the connection containing edges to FloorPlanReferencePoint. +type FloorPlanReferencePointConnection struct { + Edges []*FloorPlanReferencePointEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to FloorPlanReferencePoint. +func (fprp *FloorPlanReferencePointQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*FloorPlanReferencePointConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &FloorPlanReferencePointConnection{ + Edges: []*FloorPlanReferencePointEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &FloorPlanReferencePointConnection{ + Edges: []*FloorPlanReferencePointEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + fprp = fprp.Where(floorplanreferencepoint.IDGT(after.ID)) + } + if before != nil { + fprp = fprp.Where(floorplanreferencepoint.IDLT(before.ID)) + } + if first != nil { + fprp = fprp.Order(Asc(floorplanreferencepoint.FieldID)).Limit(*first + 1) + } + if last != nil { + fprp = fprp.Order(Desc(floorplanreferencepoint.FieldID)).Limit(*last + 1) + } + + nodes, err := fprp.All(ctx) + if err != nil || len(nodes) == 0 { + return &FloorPlanReferencePointConnection{ + Edges: []*FloorPlanReferencePointEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn FloorPlanReferencePointConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*FloorPlanReferencePointEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &FloorPlanReferencePointEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// FloorPlanScaleEdge is the edge representation of FloorPlanScale. +type FloorPlanScaleEdge struct { + Node *FloorPlanScale `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// FloorPlanScaleConnection is the connection containing edges to FloorPlanScale. +type FloorPlanScaleConnection struct { + Edges []*FloorPlanScaleEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to FloorPlanScale. +func (fps *FloorPlanScaleQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*FloorPlanScaleConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &FloorPlanScaleConnection{ + Edges: []*FloorPlanScaleEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &FloorPlanScaleConnection{ + Edges: []*FloorPlanScaleEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + fps = fps.Where(floorplanscale.IDGT(after.ID)) + } + if before != nil { + fps = fps.Where(floorplanscale.IDLT(before.ID)) + } + if first != nil { + fps = fps.Order(Asc(floorplanscale.FieldID)).Limit(*first + 1) + } + if last != nil { + fps = fps.Order(Desc(floorplanscale.FieldID)).Limit(*last + 1) + } + + nodes, err := fps.All(ctx) + if err != nil || len(nodes) == 0 { + return &FloorPlanScaleConnection{ + Edges: []*FloorPlanScaleEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn FloorPlanScaleConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*FloorPlanScaleEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &FloorPlanScaleEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// LinkEdge is the edge representation of Link. +type LinkEdge struct { + Node *Link `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// LinkConnection is the connection containing edges to Link. +type LinkConnection struct { + Edges []*LinkEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Link. +func (l *LinkQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*LinkConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &LinkConnection{ + Edges: []*LinkEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &LinkConnection{ + Edges: []*LinkEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + l = l.Where(link.IDGT(after.ID)) + } + if before != nil { + l = l.Where(link.IDLT(before.ID)) + } + if first != nil { + l = l.Order(Asc(link.FieldID)).Limit(*first + 1) + } + if last != nil { + l = l.Order(Desc(link.FieldID)).Limit(*last + 1) + } + + nodes, err := l.All(ctx) + if err != nil || len(nodes) == 0 { + return &LinkConnection{ + Edges: []*LinkEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn LinkConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*LinkEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &LinkEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// LocationEdge is the edge representation of Location. +type LocationEdge struct { + Node *Location `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// LocationConnection is the connection containing edges to Location. +type LocationConnection struct { + Edges []*LocationEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Location. +func (l *LocationQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*LocationConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &LocationConnection{ + Edges: []*LocationEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &LocationConnection{ + Edges: []*LocationEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + l = l.Where(location.IDGT(after.ID)) + } + if before != nil { + l = l.Where(location.IDLT(before.ID)) + } + if first != nil { + l = l.Order(Asc(location.FieldID)).Limit(*first + 1) + } + if last != nil { + l = l.Order(Desc(location.FieldID)).Limit(*last + 1) + } + + nodes, err := l.All(ctx) + if err != nil || len(nodes) == 0 { + return &LocationConnection{ + Edges: []*LocationEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn LocationConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*LocationEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &LocationEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// LocationTypeEdge is the edge representation of LocationType. +type LocationTypeEdge struct { + Node *LocationType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// LocationTypeConnection is the connection containing edges to LocationType. +type LocationTypeConnection struct { + Edges []*LocationTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to LocationType. +func (lt *LocationTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*LocationTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &LocationTypeConnection{ + Edges: []*LocationTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &LocationTypeConnection{ + Edges: []*LocationTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + lt = lt.Where(locationtype.IDGT(after.ID)) + } + if before != nil { + lt = lt.Where(locationtype.IDLT(before.ID)) + } + if first != nil { + lt = lt.Order(Asc(locationtype.FieldID)).Limit(*first + 1) + } + if last != nil { + lt = lt.Order(Desc(locationtype.FieldID)).Limit(*last + 1) + } + + nodes, err := lt.All(ctx) + if err != nil || len(nodes) == 0 { + return &LocationTypeConnection{ + Edges: []*LocationTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn LocationTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*LocationTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &LocationTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// ProjectEdge is the edge representation of Project. +type ProjectEdge struct { + Node *Project `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ProjectConnection is the connection containing edges to Project. +type ProjectConnection struct { + Edges []*ProjectEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Project. +func (pr *ProjectQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*ProjectConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &ProjectConnection{ + Edges: []*ProjectEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &ProjectConnection{ + Edges: []*ProjectEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + pr = pr.Where(project.IDGT(after.ID)) + } + if before != nil { + pr = pr.Where(project.IDLT(before.ID)) + } + if first != nil { + pr = pr.Order(Asc(project.FieldID)).Limit(*first + 1) + } + if last != nil { + pr = pr.Order(Desc(project.FieldID)).Limit(*last + 1) + } + + nodes, err := pr.All(ctx) + if err != nil || len(nodes) == 0 { + return &ProjectConnection{ + Edges: []*ProjectEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn ProjectConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ProjectEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ProjectEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// ProjectTypeEdge is the edge representation of ProjectType. +type ProjectTypeEdge struct { + Node *ProjectType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ProjectTypeConnection is the connection containing edges to ProjectType. +type ProjectTypeConnection struct { + Edges []*ProjectTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to ProjectType. +func (pt *ProjectTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*ProjectTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &ProjectTypeConnection{ + Edges: []*ProjectTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &ProjectTypeConnection{ + Edges: []*ProjectTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + pt = pt.Where(projecttype.IDGT(after.ID)) + } + if before != nil { + pt = pt.Where(projecttype.IDLT(before.ID)) + } + if first != nil { + pt = pt.Order(Asc(projecttype.FieldID)).Limit(*first + 1) + } + if last != nil { + pt = pt.Order(Desc(projecttype.FieldID)).Limit(*last + 1) + } + + nodes, err := pt.All(ctx) + if err != nil || len(nodes) == 0 { + return &ProjectTypeConnection{ + Edges: []*ProjectTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn ProjectTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ProjectTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ProjectTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// PropertyEdge is the edge representation of Property. +type PropertyEdge struct { + Node *Property `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// PropertyConnection is the connection containing edges to Property. +type PropertyConnection struct { + Edges []*PropertyEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Property. +func (pr *PropertyQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*PropertyConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &PropertyConnection{ + Edges: []*PropertyEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &PropertyConnection{ + Edges: []*PropertyEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + pr = pr.Where(property.IDGT(after.ID)) + } + if before != nil { + pr = pr.Where(property.IDLT(before.ID)) + } + if first != nil { + pr = pr.Order(Asc(property.FieldID)).Limit(*first + 1) + } + if last != nil { + pr = pr.Order(Desc(property.FieldID)).Limit(*last + 1) + } + + nodes, err := pr.All(ctx) + if err != nil || len(nodes) == 0 { + return &PropertyConnection{ + Edges: []*PropertyEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn PropertyConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*PropertyEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &PropertyEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// PropertyTypeEdge is the edge representation of PropertyType. +type PropertyTypeEdge struct { + Node *PropertyType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// PropertyTypeConnection is the connection containing edges to PropertyType. +type PropertyTypeConnection struct { + Edges []*PropertyTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to PropertyType. +func (pt *PropertyTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*PropertyTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &PropertyTypeConnection{ + Edges: []*PropertyTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &PropertyTypeConnection{ + Edges: []*PropertyTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + pt = pt.Where(propertytype.IDGT(after.ID)) + } + if before != nil { + pt = pt.Where(propertytype.IDLT(before.ID)) + } + if first != nil { + pt = pt.Order(Asc(propertytype.FieldID)).Limit(*first + 1) + } + if last != nil { + pt = pt.Order(Desc(propertytype.FieldID)).Limit(*last + 1) + } + + nodes, err := pt.All(ctx) + if err != nil || len(nodes) == 0 { + return &PropertyTypeConnection{ + Edges: []*PropertyTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn PropertyTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*PropertyTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &PropertyTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// ServiceEdge is the edge representation of Service. +type ServiceEdge struct { + Node *Service `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ServiceConnection is the connection containing edges to Service. +type ServiceConnection struct { + Edges []*ServiceEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Service. +func (s *ServiceQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*ServiceConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &ServiceConnection{ + Edges: []*ServiceEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &ServiceConnection{ + Edges: []*ServiceEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + s = s.Where(service.IDGT(after.ID)) + } + if before != nil { + s = s.Where(service.IDLT(before.ID)) + } + if first != nil { + s = s.Order(Asc(service.FieldID)).Limit(*first + 1) + } + if last != nil { + s = s.Order(Desc(service.FieldID)).Limit(*last + 1) + } + + nodes, err := s.All(ctx) + if err != nil || len(nodes) == 0 { + return &ServiceConnection{ + Edges: []*ServiceEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn ServiceConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ServiceEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ServiceEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// ServiceEndpointEdge is the edge representation of ServiceEndpoint. +type ServiceEndpointEdge struct { + Node *ServiceEndpoint `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ServiceEndpointConnection is the connection containing edges to ServiceEndpoint. +type ServiceEndpointConnection struct { + Edges []*ServiceEndpointEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to ServiceEndpoint. +func (se *ServiceEndpointQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*ServiceEndpointConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &ServiceEndpointConnection{ + Edges: []*ServiceEndpointEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &ServiceEndpointConnection{ + Edges: []*ServiceEndpointEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + se = se.Where(serviceendpoint.IDGT(after.ID)) + } + if before != nil { + se = se.Where(serviceendpoint.IDLT(before.ID)) + } + if first != nil { + se = se.Order(Asc(serviceendpoint.FieldID)).Limit(*first + 1) + } + if last != nil { + se = se.Order(Desc(serviceendpoint.FieldID)).Limit(*last + 1) + } + + nodes, err := se.All(ctx) + if err != nil || len(nodes) == 0 { + return &ServiceEndpointConnection{ + Edges: []*ServiceEndpointEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn ServiceEndpointConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ServiceEndpointEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ServiceEndpointEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// ServiceTypeEdge is the edge representation of ServiceType. +type ServiceTypeEdge struct { + Node *ServiceType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// ServiceTypeConnection is the connection containing edges to ServiceType. +type ServiceTypeConnection struct { + Edges []*ServiceTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to ServiceType. +func (st *ServiceTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*ServiceTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &ServiceTypeConnection{ + Edges: []*ServiceTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &ServiceTypeConnection{ + Edges: []*ServiceTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + st = st.Where(servicetype.IDGT(after.ID)) + } + if before != nil { + st = st.Where(servicetype.IDLT(before.ID)) + } + if first != nil { + st = st.Order(Asc(servicetype.FieldID)).Limit(*first + 1) + } + if last != nil { + st = st.Order(Desc(servicetype.FieldID)).Limit(*last + 1) + } + + nodes, err := st.All(ctx) + if err != nil || len(nodes) == 0 { + return &ServiceTypeConnection{ + Edges: []*ServiceTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn ServiceTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*ServiceTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &ServiceTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyEdge is the edge representation of Survey. +type SurveyEdge struct { + Node *Survey `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyConnection is the connection containing edges to Survey. +type SurveyConnection struct { + Edges []*SurveyEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Survey. +func (s *SurveyQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyConnection{ + Edges: []*SurveyEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyConnection{ + Edges: []*SurveyEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + s = s.Where(survey.IDGT(after.ID)) + } + if before != nil { + s = s.Where(survey.IDLT(before.ID)) + } + if first != nil { + s = s.Order(Asc(survey.FieldID)).Limit(*first + 1) + } + if last != nil { + s = s.Order(Desc(survey.FieldID)).Limit(*last + 1) + } + + nodes, err := s.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyConnection{ + Edges: []*SurveyEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyCellScanEdge is the edge representation of SurveyCellScan. +type SurveyCellScanEdge struct { + Node *SurveyCellScan `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyCellScanConnection is the connection containing edges to SurveyCellScan. +type SurveyCellScanConnection struct { + Edges []*SurveyCellScanEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to SurveyCellScan. +func (scs *SurveyCellScanQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyCellScanConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyCellScanConnection{ + Edges: []*SurveyCellScanEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyCellScanConnection{ + Edges: []*SurveyCellScanEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + scs = scs.Where(surveycellscan.IDGT(after.ID)) + } + if before != nil { + scs = scs.Where(surveycellscan.IDLT(before.ID)) + } + if first != nil { + scs = scs.Order(Asc(surveycellscan.FieldID)).Limit(*first + 1) + } + if last != nil { + scs = scs.Order(Desc(surveycellscan.FieldID)).Limit(*last + 1) + } + + nodes, err := scs.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyCellScanConnection{ + Edges: []*SurveyCellScanEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyCellScanConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyCellScanEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyCellScanEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyQuestionEdge is the edge representation of SurveyQuestion. +type SurveyQuestionEdge struct { + Node *SurveyQuestion `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyQuestionConnection is the connection containing edges to SurveyQuestion. +type SurveyQuestionConnection struct { + Edges []*SurveyQuestionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to SurveyQuestion. +func (sq *SurveyQuestionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyQuestionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyQuestionConnection{ + Edges: []*SurveyQuestionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyQuestionConnection{ + Edges: []*SurveyQuestionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + sq = sq.Where(surveyquestion.IDGT(after.ID)) + } + if before != nil { + sq = sq.Where(surveyquestion.IDLT(before.ID)) + } + if first != nil { + sq = sq.Order(Asc(surveyquestion.FieldID)).Limit(*first + 1) + } + if last != nil { + sq = sq.Order(Desc(surveyquestion.FieldID)).Limit(*last + 1) + } + + nodes, err := sq.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyQuestionConnection{ + Edges: []*SurveyQuestionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyQuestionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyQuestionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyQuestionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyTemplateCategoryEdge is the edge representation of SurveyTemplateCategory. +type SurveyTemplateCategoryEdge struct { + Node *SurveyTemplateCategory `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyTemplateCategoryConnection is the connection containing edges to SurveyTemplateCategory. +type SurveyTemplateCategoryConnection struct { + Edges []*SurveyTemplateCategoryEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to SurveyTemplateCategory. +func (stc *SurveyTemplateCategoryQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyTemplateCategoryConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyTemplateCategoryConnection{ + Edges: []*SurveyTemplateCategoryEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyTemplateCategoryConnection{ + Edges: []*SurveyTemplateCategoryEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + stc = stc.Where(surveytemplatecategory.IDGT(after.ID)) + } + if before != nil { + stc = stc.Where(surveytemplatecategory.IDLT(before.ID)) + } + if first != nil { + stc = stc.Order(Asc(surveytemplatecategory.FieldID)).Limit(*first + 1) + } + if last != nil { + stc = stc.Order(Desc(surveytemplatecategory.FieldID)).Limit(*last + 1) + } + + nodes, err := stc.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyTemplateCategoryConnection{ + Edges: []*SurveyTemplateCategoryEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyTemplateCategoryConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyTemplateCategoryEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyTemplateCategoryEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyTemplateQuestionEdge is the edge representation of SurveyTemplateQuestion. +type SurveyTemplateQuestionEdge struct { + Node *SurveyTemplateQuestion `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyTemplateQuestionConnection is the connection containing edges to SurveyTemplateQuestion. +type SurveyTemplateQuestionConnection struct { + Edges []*SurveyTemplateQuestionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to SurveyTemplateQuestion. +func (stq *SurveyTemplateQuestionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyTemplateQuestionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyTemplateQuestionConnection{ + Edges: []*SurveyTemplateQuestionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyTemplateQuestionConnection{ + Edges: []*SurveyTemplateQuestionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + stq = stq.Where(surveytemplatequestion.IDGT(after.ID)) + } + if before != nil { + stq = stq.Where(surveytemplatequestion.IDLT(before.ID)) + } + if first != nil { + stq = stq.Order(Asc(surveytemplatequestion.FieldID)).Limit(*first + 1) + } + if last != nil { + stq = stq.Order(Desc(surveytemplatequestion.FieldID)).Limit(*last + 1) + } + + nodes, err := stq.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyTemplateQuestionConnection{ + Edges: []*SurveyTemplateQuestionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyTemplateQuestionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyTemplateQuestionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyTemplateQuestionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// SurveyWiFiScanEdge is the edge representation of SurveyWiFiScan. +type SurveyWiFiScanEdge struct { + Node *SurveyWiFiScan `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// SurveyWiFiScanConnection is the connection containing edges to SurveyWiFiScan. +type SurveyWiFiScanConnection struct { + Edges []*SurveyWiFiScanEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to SurveyWiFiScan. +func (swfs *SurveyWiFiScanQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*SurveyWiFiScanConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &SurveyWiFiScanConnection{ + Edges: []*SurveyWiFiScanEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &SurveyWiFiScanConnection{ + Edges: []*SurveyWiFiScanEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + swfs = swfs.Where(surveywifiscan.IDGT(after.ID)) + } + if before != nil { + swfs = swfs.Where(surveywifiscan.IDLT(before.ID)) + } + if first != nil { + swfs = swfs.Order(Asc(surveywifiscan.FieldID)).Limit(*first + 1) + } + if last != nil { + swfs = swfs.Order(Desc(surveywifiscan.FieldID)).Limit(*last + 1) + } + + nodes, err := swfs.All(ctx) + if err != nil || len(nodes) == 0 { + return &SurveyWiFiScanConnection{ + Edges: []*SurveyWiFiScanEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn SurveyWiFiScanConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*SurveyWiFiScanEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &SurveyWiFiScanEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// TechnicianEdge is the edge representation of Technician. +type TechnicianEdge struct { + Node *Technician `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// TechnicianConnection is the connection containing edges to Technician. +type TechnicianConnection struct { + Edges []*TechnicianEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to Technician. +func (t *TechnicianQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*TechnicianConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &TechnicianConnection{ + Edges: []*TechnicianEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &TechnicianConnection{ + Edges: []*TechnicianEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + t = t.Where(technician.IDGT(after.ID)) + } + if before != nil { + t = t.Where(technician.IDLT(before.ID)) + } + if first != nil { + t = t.Order(Asc(technician.FieldID)).Limit(*first + 1) + } + if last != nil { + t = t.Order(Desc(technician.FieldID)).Limit(*last + 1) + } + + nodes, err := t.All(ctx) + if err != nil || len(nodes) == 0 { + return &TechnicianConnection{ + Edges: []*TechnicianEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn TechnicianConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*TechnicianEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &TechnicianEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// WorkOrderEdge is the edge representation of WorkOrder. +type WorkOrderEdge struct { + Node *WorkOrder `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// WorkOrderConnection is the connection containing edges to WorkOrder. +type WorkOrderConnection struct { + Edges []*WorkOrderEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to WorkOrder. +func (wo *WorkOrderQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*WorkOrderConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &WorkOrderConnection{ + Edges: []*WorkOrderEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &WorkOrderConnection{ + Edges: []*WorkOrderEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + wo = wo.Where(workorder.IDGT(after.ID)) + } + if before != nil { + wo = wo.Where(workorder.IDLT(before.ID)) + } + if first != nil { + wo = wo.Order(Asc(workorder.FieldID)).Limit(*first + 1) + } + if last != nil { + wo = wo.Order(Desc(workorder.FieldID)).Limit(*last + 1) + } + + nodes, err := wo.All(ctx) + if err != nil || len(nodes) == 0 { + return &WorkOrderConnection{ + Edges: []*WorkOrderEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn WorkOrderConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*WorkOrderEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &WorkOrderEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// WorkOrderDefinitionEdge is the edge representation of WorkOrderDefinition. +type WorkOrderDefinitionEdge struct { + Node *WorkOrderDefinition `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// WorkOrderDefinitionConnection is the connection containing edges to WorkOrderDefinition. +type WorkOrderDefinitionConnection struct { + Edges []*WorkOrderDefinitionEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to WorkOrderDefinition. +func (wod *WorkOrderDefinitionQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*WorkOrderDefinitionConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &WorkOrderDefinitionConnection{ + Edges: []*WorkOrderDefinitionEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &WorkOrderDefinitionConnection{ + Edges: []*WorkOrderDefinitionEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + wod = wod.Where(workorderdefinition.IDGT(after.ID)) + } + if before != nil { + wod = wod.Where(workorderdefinition.IDLT(before.ID)) + } + if first != nil { + wod = wod.Order(Asc(workorderdefinition.FieldID)).Limit(*first + 1) + } + if last != nil { + wod = wod.Order(Desc(workorderdefinition.FieldID)).Limit(*last + 1) + } + + nodes, err := wod.All(ctx) + if err != nil || len(nodes) == 0 { + return &WorkOrderDefinitionConnection{ + Edges: []*WorkOrderDefinitionEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn WorkOrderDefinitionConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*WorkOrderDefinitionEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &WorkOrderDefinitionEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} + +// WorkOrderTypeEdge is the edge representation of WorkOrderType. +type WorkOrderTypeEdge struct { + Node *WorkOrderType `json:"node"` + Cursor Cursor `json:"cursor"` +} + +// WorkOrderTypeConnection is the connection containing edges to WorkOrderType. +type WorkOrderTypeConnection struct { + Edges []*WorkOrderTypeEdge `json:"edges"` + PageInfo PageInfo `json:"pageInfo"` +} + +// Paginate executes the query and returns a relay based cursor connection to WorkOrderType. +func (wot *WorkOrderTypeQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int) (*WorkOrderTypeConnection, error) { + if first != nil && last != nil { + return nil, ErrInvalidPagination + } + if first != nil { + if *first == 0 { + return &WorkOrderTypeConnection{ + Edges: []*WorkOrderTypeEdge{}, + }, nil + } else if *first < 0 { + return nil, ErrInvalidPagination + } + } + if last != nil { + if *last == 0 { + return &WorkOrderTypeConnection{ + Edges: []*WorkOrderTypeEdge{}, + }, nil + } else if *last < 0 { + return nil, ErrInvalidPagination + } + } + + if after != nil { + wot = wot.Where(workordertype.IDGT(after.ID)) + } + if before != nil { + wot = wot.Where(workordertype.IDLT(before.ID)) + } + if first != nil { + wot = wot.Order(Asc(workordertype.FieldID)).Limit(*first + 1) + } + if last != nil { + wot = wot.Order(Desc(workordertype.FieldID)).Limit(*last + 1) + } + + nodes, err := wot.All(ctx) + if err != nil || len(nodes) == 0 { + return &WorkOrderTypeConnection{ + Edges: []*WorkOrderTypeEdge{}, + }, err + } + if last != nil { + for left, right := 0, len(nodes)-1; left < right; left, right = left+1, right-1 { + nodes[left], nodes[right] = nodes[right], nodes[left] + } + } + + var conn WorkOrderTypeConnection + if first != nil && len(nodes) > *first { + conn.PageInfo.HasNextPage = true + nodes = nodes[:len(nodes)-1] + } else if last != nil && len(nodes) > *last { + conn.PageInfo.HasPreviousPage = true + nodes = nodes[1:] + } + conn.Edges = make([]*WorkOrderTypeEdge, len(nodes)) + for i, node := range nodes { + conn.Edges[i] = &WorkOrderTypeEdge{ + Node: node, + Cursor: Cursor{ + ID: node.ID, + }, + } + } + conn.PageInfo.StartCursor = &conn.Edges[0].Cursor + conn.PageInfo.EndCursor = &conn.Edges[len(conn.Edges)-1].Cursor + + return &conn, nil +} diff --git a/symphony/graph/graphql/models/cursor_test.go b/symphony/graph/ent/pagination_test.go similarity index 89% rename from symphony/graph/graphql/models/cursor_test.go rename to symphony/graph/ent/pagination_test.go index c84544827f11..a3a76a0a2b17 100644 --- a/symphony/graph/graphql/models/cursor_test.go +++ b/symphony/graph/ent/pagination_test.go @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package models +// Code generated (@generated) by entc, DO NOT EDIT. + +package ent import ( "bytes" @@ -15,7 +17,7 @@ import ( func TestCursorEncoding(t *testing.T) { t.Run("EncodeDecode", func(t *testing.T) { var buf bytes.Buffer - c := Cursor{ID: "42", Offset: 15} + c := Cursor{ID: "42"} c.MarshalGQL(&buf) var uc Cursor s, err := strconv.Unquote(buf.String()) diff --git a/symphony/graph/ent/schema/location.go b/symphony/graph/ent/schema/location.go index 682af344d82a..81ae3eb7cb08 100644 --- a/symphony/graph/ent/schema/location.go +++ b/symphony/graph/ent/schema/location.go @@ -20,7 +20,8 @@ type LocationType struct { func (LocationType) Fields() []ent.Field { return []ent.Field{ field.Bool("site"). - Default(false), + Default(false). + StructTag(`gqlgen:"isSite"`), field.String("name"). Unique(), field.String("map_type"). diff --git a/symphony/graph/exporter/utils.go b/symphony/graph/exporter/utils.go index 5b191c8eb802..64f6ca520a4c 100644 --- a/symphony/graph/exporter/utils.go +++ b/symphony/graph/exporter/utils.go @@ -20,7 +20,6 @@ import ( "github.com/facebookincubator/symphony/graph/ent/link" "github.com/facebookincubator/symphony/graph/ent/service" "github.com/facebookincubator/symphony/graph/graphql/models" - "github.com/facebookincubator/symphony/graph/resolverutil" "github.com/pkg/errors" ) @@ -51,7 +50,8 @@ func index(a []string, x string) int { } func locationTypeHierarchy(ctx context.Context, c *ent.Client) ([]string, error) { - locTypeResult, err := resolverutil.LocationTypes(ctx, c) + locTypeResult, err := c.LocationType.Query(). + Paginate(ctx, nil, nil, nil, nil) if err != nil { return nil, err } @@ -156,7 +156,8 @@ func propertyTypesSlice(ctx context.Context, ids []string, c *ent.Client, entity switch entity { case models.PropertyEntityEquipment: var equipTypesWithEquipment []ent.EquipmentType - equipTypes, err := resolverutil.EquipmentTypes(ctx, c) + equipTypes, err := c.EquipmentType.Query(). + Paginate(ctx, nil, nil, nil, nil) if err != nil { return nil, err } @@ -189,7 +190,8 @@ func propertyTypesSlice(ctx context.Context, ids []string, c *ent.Client, entity } case models.PropertyEntityLocation: var locTypesWithInstances []ent.LocationType - locTypes, err := resolverutil.LocationTypes(ctx, c) + locTypes, err := c.LocationType.Query(). + Paginate(ctx, nil, nil, nil, nil) if err != nil { return nil, err } @@ -222,7 +224,8 @@ func propertyTypesSlice(ctx context.Context, ids []string, c *ent.Client, entity } case models.PropertyEntityPort, models.PropertyEntityLink: var relevantPortTypes []ent.EquipmentPortType - portTypes, err := resolverutil.EquipmentPortTypes(ctx, c) + portTypes, err := c.EquipmentPortType.Query(). + Paginate(ctx, nil, nil, nil, nil) if err != nil { return nil, err } @@ -275,7 +278,8 @@ func propertyTypesSlice(ctx context.Context, ids []string, c *ent.Client, entity } case models.PropertyEntityService: var serviceTypesWithServices []ent.ServiceType - serviceTypes, err := resolverutil.ServiceTypes(ctx, c) + serviceTypes, err := c.ServiceType.Query(). + Paginate(ctx, nil, nil, nil, nil) if err != nil { return nil, err } diff --git a/symphony/graph/graphql/generated/exec.go b/symphony/graph/graphql/generated/exec.go index 48d262e76b94..e7110253e6b0 100644 --- a/symphony/graph/graphql/generated/exec.go +++ b/symphony/graph/graphql/generated/exec.go @@ -411,13 +411,13 @@ type ComplexityRoot struct { LocationType struct { ID func(childComplexity int) int Index func(childComplexity int) int - IsSite func(childComplexity int) int Locations func(childComplexity int, enforceHasLatLong *bool) int MapType func(childComplexity int) int MapZoomLevel func(childComplexity int) int Name func(childComplexity int) int NumberOfLocations func(childComplexity int) int PropertyTypes func(childComplexity int) int + Site func(childComplexity int) int SurveyTemplateCategories func(childComplexity int) int } @@ -596,21 +596,21 @@ type ComplexityRoot struct { ActionsTriggers func(childComplexity int) int Customer func(childComplexity int, id string) int CustomerSearch func(childComplexity int, limit *int) int - Customers func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int + Customers func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int Equipment func(childComplexity int, id string) int - EquipmentPortDefinitions func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int - EquipmentPortTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int + EquipmentPortDefinitions func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int + EquipmentPortTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int EquipmentSearch func(childComplexity int, filters []*models.EquipmentFilterInput, limit *int) int EquipmentType func(childComplexity int, id string) int - EquipmentTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int + EquipmentTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int FindLocationWithDuplicateProperties func(childComplexity int, locationTypeID string, propertyName string) int LatestPythonPackage func(childComplexity int) int LinkSearch func(childComplexity int, filters []*models.LinkFilterInput, limit *int) int Location func(childComplexity int, id string) int LocationSearch func(childComplexity int, filters []*models.LocationFilterInput, limit *int) int LocationType func(childComplexity int, id string) int - LocationTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int - Locations func(childComplexity int, onlyTopLevel *bool, types []string, name *string, needsSiteSurvey *bool, after *models.Cursor, first *int, before *models.Cursor, last *int) int + LocationTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int + Locations func(childComplexity int, onlyTopLevel *bool, types []string, name *string, needsSiteSurvey *bool, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int Me func(childComplexity int) int NearestSites func(childComplexity int, latitude float64, longitude float64, first int) int Node func(childComplexity int, id string) int @@ -619,19 +619,19 @@ type ComplexityRoot struct { Project func(childComplexity int, id string) int ProjectSearch func(childComplexity int, filters []*models.ProjectFilterInput, limit *int) int ProjectType func(childComplexity int, id string) int - ProjectTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int - SearchForEntity func(childComplexity int, name string, after *models.Cursor, first *int, before *models.Cursor, last *int) int + ProjectTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int + SearchForEntity func(childComplexity int, name string, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int Service func(childComplexity int, id string) int ServiceSearch func(childComplexity int, filters []*models.ServiceFilterInput, limit *int) int ServiceType func(childComplexity int, id string) int - ServiceTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int - Surveys func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int + ServiceTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int + Surveys func(childComplexity int) int Vertex func(childComplexity int, id string) int WorkOrder func(childComplexity int, id string) int WorkOrderSearch func(childComplexity int, filters []*models.WorkOrderFilterInput, limit *int) int WorkOrderType func(childComplexity int, id string) int - WorkOrderTypes func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int) int - WorkOrders func(childComplexity int, after *models.Cursor, first *int, before *models.Cursor, last *int, showCompleted *bool) int + WorkOrderTypes func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int) int + WorkOrders func(childComplexity int, after *ent.Cursor, first *int, before *ent.Cursor, last *int, showCompleted *bool) int } SearchEntriesConnection struct { @@ -979,11 +979,9 @@ type LocationResolver interface { FloorPlans(ctx context.Context, obj *ent.Location) ([]*ent.FloorPlan, error) } type LocationTypeResolver interface { - IsSite(ctx context.Context, obj *ent.LocationType) (bool, error) - PropertyTypes(ctx context.Context, obj *ent.LocationType) ([]*ent.PropertyType, error) NumberOfLocations(ctx context.Context, obj *ent.LocationType) (int, error) - Locations(ctx context.Context, obj *ent.LocationType, enforceHasLatLong *bool) (*models.LocationConnection, error) + Locations(ctx context.Context, obj *ent.LocationType, enforceHasLatLong *bool) (*ent.LocationConnection, error) SurveyTemplateCategories(ctx context.Context, obj *ent.LocationType) ([]*ent.SurveyTemplateCategory, error) } type MutationResolver interface { @@ -1081,21 +1079,21 @@ type QueryResolver interface { Node(ctx context.Context, id string) (ent.Noder, error) Location(ctx context.Context, id string) (*ent.Location, error) LocationType(ctx context.Context, id string) (*ent.LocationType, error) - LocationTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.LocationTypeConnection, error) - Locations(ctx context.Context, onlyTopLevel *bool, types []string, name *string, needsSiteSurvey *bool, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.LocationConnection, error) + LocationTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.LocationTypeConnection, error) + Locations(ctx context.Context, onlyTopLevel *bool, types []string, name *string, needsSiteSurvey *bool, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.LocationConnection, error) Equipment(ctx context.Context, id string) (*ent.Equipment, error) EquipmentType(ctx context.Context, id string) (*ent.EquipmentType, error) - EquipmentPortTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.EquipmentPortTypeConnection, error) - EquipmentPortDefinitions(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.EquipmentPortDefinitionConnection, error) - EquipmentTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.EquipmentTypeConnection, error) + EquipmentPortTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.EquipmentPortTypeConnection, error) + EquipmentPortDefinitions(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.EquipmentPortDefinitionConnection, error) + EquipmentTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.EquipmentTypeConnection, error) Service(ctx context.Context, id string) (*ent.Service, error) ServiceType(ctx context.Context, id string) (*ent.ServiceType, error) - ServiceTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.ServiceTypeConnection, error) + ServiceTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.ServiceTypeConnection, error) WorkOrder(ctx context.Context, id string) (*ent.WorkOrder, error) - WorkOrders(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int, showCompleted *bool) (*models.WorkOrderConnection, error) + WorkOrders(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int, showCompleted *bool) (*ent.WorkOrderConnection, error) WorkOrderType(ctx context.Context, id string) (*ent.WorkOrderType, error) - WorkOrderTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.WorkOrderTypeConnection, error) - SearchForEntity(ctx context.Context, name string, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.SearchEntriesConnection, error) + WorkOrderTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.WorkOrderTypeConnection, error) + SearchForEntity(ctx context.Context, name string, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*models.SearchEntriesConnection, error) EquipmentSearch(ctx context.Context, filters []*models.EquipmentFilterInput, limit *int) (*models.EquipmentSearchResult, error) WorkOrderSearch(ctx context.Context, filters []*models.WorkOrderFilterInput, limit *int) ([]*ent.WorkOrder, error) LinkSearch(ctx context.Context, filters []*models.LinkFilterInput, limit *int) (*models.LinkSearchResult, error) @@ -1105,16 +1103,16 @@ type QueryResolver interface { CustomerSearch(ctx context.Context, limit *int) ([]*ent.Customer, error) ServiceSearch(ctx context.Context, filters []*models.ServiceFilterInput, limit *int) (*models.ServiceSearchResult, error) PossibleProperties(ctx context.Context, entityType models.PropertyEntity) ([]*ent.PropertyType, error) - Surveys(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) ([]*ent.Survey, error) + Surveys(ctx context.Context) ([]*ent.Survey, error) FindLocationWithDuplicateProperties(ctx context.Context, locationTypeID string, propertyName string) ([]string, error) LatestPythonPackage(ctx context.Context) (*models.LatestPythonPackageResult, error) NearestSites(ctx context.Context, latitude float64, longitude float64, first int) ([]*ent.Location, error) Vertex(ctx context.Context, id string) (*ent.Node, error) ProjectType(ctx context.Context, id string) (*ent.ProjectType, error) - ProjectTypes(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.ProjectTypeConnection, error) + ProjectTypes(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.ProjectTypeConnection, error) Project(ctx context.Context, id string) (*ent.Project, error) Customer(ctx context.Context, id string) (*ent.Customer, error) - Customers(ctx context.Context, after *models.Cursor, first *int, before *models.Cursor, last *int) (*models.CustomerConnection, error) + Customers(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int) (*ent.CustomerConnection, error) ActionsRules(ctx context.Context) (*models.ActionsRulesSearchResult, error) ActionsTriggers(ctx context.Context) (*models.ActionsTriggersSearchResult, error) } @@ -2556,13 +2554,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LocationType.Index(childComplexity), true - case "LocationType.isSite": - if e.complexity.LocationType.IsSite == nil { - break - } - - return e.complexity.LocationType.IsSite(childComplexity), true - case "LocationType.locations": if e.complexity.LocationType.Locations == nil { break @@ -2610,6 +2601,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LocationType.PropertyTypes(childComplexity), true + case "LocationType.isSite": + if e.complexity.LocationType.Site == nil { + break + } + + return e.complexity.LocationType.Site(childComplexity), true + case "LocationType.surveyTemplateCategories": if e.complexity.LocationType.SurveyTemplateCategories == nil { break @@ -3902,7 +3900,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.Customers(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.Customers(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.equipment": if e.complexity.Query.Equipment == nil { @@ -3926,7 +3924,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.EquipmentPortDefinitions(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.EquipmentPortDefinitions(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.equipmentPortTypes": if e.complexity.Query.EquipmentPortTypes == nil { @@ -3938,7 +3936,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.EquipmentPortTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.EquipmentPortTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.equipmentSearch": if e.complexity.Query.EquipmentSearch == nil { @@ -3974,7 +3972,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.EquipmentTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.EquipmentTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.findLocationWithDuplicateProperties": if e.complexity.Query.FindLocationWithDuplicateProperties == nil { @@ -4053,7 +4051,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.LocationTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.LocationTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.locations": if e.complexity.Query.Locations == nil { @@ -4065,7 +4063,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.Locations(childComplexity, args["onlyTopLevel"].(*bool), args["types"].([]string), args["name"].(*string), args["needsSiteSurvey"].(*bool), args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.Locations(childComplexity, args["onlyTopLevel"].(*bool), args["types"].([]string), args["name"].(*string), args["needsSiteSurvey"].(*bool), args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.me": if e.complexity.Query.Me == nil { @@ -4168,7 +4166,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.ProjectTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.ProjectTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.searchForEntity": if e.complexity.Query.SearchForEntity == nil { @@ -4180,7 +4178,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.SearchForEntity(childComplexity, args["name"].(string), args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.SearchForEntity(childComplexity, args["name"].(string), args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.service": if e.complexity.Query.Service == nil { @@ -4228,19 +4226,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.ServiceTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.ServiceTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.surveys": if e.complexity.Query.Surveys == nil { break } - args, err := ec.field_Query_surveys_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.Surveys(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.Surveys(childComplexity), true case "Query.vertex": if e.complexity.Query.Vertex == nil { @@ -4300,7 +4293,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.WorkOrderTypes(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)), true + return e.complexity.Query.WorkOrderTypes(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)), true case "Query.workOrders": if e.complexity.Query.WorkOrders == nil { @@ -4312,7 +4305,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.WorkOrders(childComplexity, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int), args["showCompleted"].(*bool)), true + return e.complexity.Query.WorkOrders(childComplexity, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int), args["showCompleted"].(*bool)), true case "SearchEntriesConnection.edges": if e.complexity.SearchEntriesConnection.Edges == nil { @@ -5539,8 +5532,14 @@ type Viewer email: String! @goField(name: "user") } +""" +An object with an ID +""" interface Node @goModel(model: "github.com/facebookincubator/symphony/graph/ent.Noder") { + """ + The id of the object. + """ id: ID! } @@ -5932,87 +5931,171 @@ type SearchEntry { type: String! } -# search entries connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of search entries. +""" type SearchEntriesConnection { - edges: [SearchEntryEdge] - pageInfo: PageInfo + """ + A list of search entry edges. + """ + edges: [SearchEntryEdge!] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# search entry edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A search entry edge in a connection. +""" type SearchEntryEdge { + """ + The search entry at the end of the edge. + """ node: SearchEntry + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment port type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment port types. +""" type EquipmentPortTypeConnection { - edges: [EquipmentPortTypeEdge] - pageInfo: PageInfo + """ + A list of equipment port type edges. + """ + edges: [EquipmentPortTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment port type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment port type edge in a connection. +""" type EquipmentPortTypeEdge { + """ + The equipment port type at the end of the edge. + """ node: EquipmentPortType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment port definition connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment port definitions. +""" type EquipmentPortDefinitionConnection { - edges: [EquipmentPortDefinitionEdge] - pageInfo: PageInfo + """ + A list of equipment port definition edges. + """ + edges: [EquipmentPortDefinitionEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment port definition edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment port definition edge in a connection. +""" type EquipmentPortDefinitionEdge { + """ + The equipment port definition at the end of the edge. + """ node: EquipmentPortDefinition + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment types. +""" type EquipmentTypeConnection { - edges: [EquipmentTypeEdge] - pageInfo: PageInfo + """ + A list of equipment type edges. + """ + edges: [EquipmentTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment type edge in a connection. +""" type EquipmentTypeEdge { + """ + The equipment type at the end of the edge. + """ node: EquipmentType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# location type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of location types. +""" type LocationTypeConnection { - edges: [LocationTypeEdge] - pageInfo: PageInfo + """ + A list of location type edges. + """ + edges: [LocationTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# location type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A location type edge in a connection. +""" type LocationTypeEdge { + """ + The location type at the end of the edge. + """ node: LocationType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# location connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of locations. +""" type LocationConnection { - edges: [LocationEdge] - pageInfo: PageInfo + """ + A list of location edges. + """ + edges: [LocationEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# location edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A location edge in a connection. +""" type LocationEdge { + """ + The location at the end of the edge. + """ node: Location + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -6023,33 +6106,58 @@ directive @goModel( models: [String!] ) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION -# connection pagination cursor. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Cursor +""" +Position within a pagination. +""" scalar Cursor - @goModel( - model: "github.com/facebookincubator/symphony/graph/graphql/models.Cursor" - ) -# Information for paginating a connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo +""" +Information about pagination in a connection. +""" type PageInfo { + """ + When paginating forwards, are there more items? + """ hasNextPage: Boolean! + """ + When paginating backwards, are there more items? + """ hasPreviousPage: Boolean! + """ + When paginating forwards, the cursor to continue. + """ startCursor: Cursor + """ + When paginating backwards, the cursor to continue. + """ endCursor: Cursor } -# service type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of service types. +""" type ServiceTypeConnection { - edges: [ServiceTypeEdge] - pageInfo: PageInfo + """ + A list of service type edges. + """ + edges: [ServiceTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# service type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A service type edge in a connection. +""" type ServiceTypeEdge { + """ + The service type at the end of the edge. + """ node: ServiceType + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -6322,31 +6430,59 @@ type WorkOrder implements Node { checkList: [CheckListItem]! } -# work order type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of work order types. +""" type WorkOrderTypeConnection { - edges: [WorkOrderTypeEdge] - pageInfo: PageInfo + """ + A list of work order type edges. + """ + edges: [WorkOrderTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# work order type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A work order type edge in a connection. +""" type WorkOrderTypeEdge { + """ + The work order type at the end of the edge. + """ node: WorkOrderType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# work order connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of work orders. +""" type WorkOrderConnection { - edges: [WorkOrderEdge] - pageInfo: PageInfo + """ + A list of work order edges. + """ + edges: [WorkOrderEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# work order edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A work order edge in a connection. +""" type WorkOrderEdge { + """ + The work order at the end of the edge. + """ node: WorkOrder + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -6399,17 +6535,31 @@ directive @goField( name: String ) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION -# project type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of project types. +""" type ProjectTypeConnection { - edges: [ProjectTypeEdge!] + """ + A list of project type edges. + """ + edges: [ProjectTypeEdge!]! + """ + Information to aid in pagination. + """ pageInfo: PageInfo! } -# project type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A project type edge in a connection. +""" type ProjectTypeEdge { + """ + The project type at the end of the edge. + """ node: ProjectType + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -6617,17 +6767,31 @@ input ProjectFilterInput { stringValue: String } -# customer connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of customers. +""" type CustomerConnection { - edges: [CustomerEdge!] + """ + A list of customer edges. + """ + edges: [CustomerEdge!]! + """ + Information to aid in pagination. + """ pageInfo: PageInfo! } -# customer edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A customer edge in a connection. +""" type CustomerEdge { + """ + The customer at the end of the edge. + """ node: Customer + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -7126,8 +7290,21 @@ input AddActionsRuleInput { } type Query { + """ + Fetches current viewer. + """ me: Viewer - node(id: ID!): Node + + """ + Fetches an object given its ID. + """ + node( + """ + The ID of an object. + """ + id: ID! + ): Node + location(id: ID!): Location @deprecated(reason: "Use ` + "`" + `node` + "`" + ` instead") locationType(id: ID!): LocationType @deprecated(reason: "Use ` + "`" + `node` + "`" + ` instead") locationTypes( @@ -7224,7 +7401,7 @@ type Query { limit: Int = 500 ): ServiceSearchResult! possibleProperties(entityType: PropertyEntity!): [PropertyType!]! - surveys(after: Cursor, first: Int, before: Cursor, last: Int): [Survey]! + surveys: [Survey!]! findLocationWithDuplicateProperties( locationTypeId: ID! propertyName: String! @@ -8606,9 +8783,9 @@ func (ec *executionContext) field_Query_customer_args(ctx context.Context, rawAr func (ec *executionContext) field_Query_customers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8622,9 +8799,9 @@ func (ec *executionContext) field_Query_customers_args(ctx context.Context, rawA } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8644,9 +8821,9 @@ func (ec *executionContext) field_Query_customers_args(ctx context.Context, rawA func (ec *executionContext) field_Query_equipmentPortDefinitions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8660,9 +8837,9 @@ func (ec *executionContext) field_Query_equipmentPortDefinitions_args(ctx contex } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8682,9 +8859,9 @@ func (ec *executionContext) field_Query_equipmentPortDefinitions_args(ctx contex func (ec *executionContext) field_Query_equipmentPortTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8698,9 +8875,9 @@ func (ec *executionContext) field_Query_equipmentPortTypes_args(ctx context.Cont } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8756,9 +8933,9 @@ func (ec *executionContext) field_Query_equipmentType_args(ctx context.Context, func (ec *executionContext) field_Query_equipmentTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8772,9 +8949,9 @@ func (ec *executionContext) field_Query_equipmentTypes_args(ctx context.Context, } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8888,9 +9065,9 @@ func (ec *executionContext) field_Query_locationType_args(ctx context.Context, r func (ec *executionContext) field_Query_locationTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8904,9 +9081,9 @@ func (ec *executionContext) field_Query_locationTypes_args(ctx context.Context, } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8972,9 +9149,9 @@ func (ec *executionContext) field_Query_locations_args(ctx context.Context, rawA } } args["needsSiteSurvey"] = arg3 - var arg4 *models.Cursor + var arg4 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg4, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg4, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -8988,9 +9165,9 @@ func (ec *executionContext) field_Query_locations_args(ctx context.Context, rawA } } args["first"] = arg5 - var arg6 *models.Cursor + var arg6 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg6, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg6, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9126,9 +9303,9 @@ func (ec *executionContext) field_Query_projectType_args(ctx context.Context, ra func (ec *executionContext) field_Query_projectTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9142,9 +9319,9 @@ func (ec *executionContext) field_Query_projectTypes_args(ctx context.Context, r } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9186,9 +9363,9 @@ func (ec *executionContext) field_Query_searchForEntity_args(ctx context.Context } } args["name"] = arg0 - var arg1 *models.Cursor + var arg1 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg1, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg1, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9202,9 +9379,9 @@ func (ec *executionContext) field_Query_searchForEntity_args(ctx context.Context } } args["first"] = arg2 - var arg3 *models.Cursor + var arg3 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg3, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg3, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9260,9 +9437,9 @@ func (ec *executionContext) field_Query_serviceType_args(ctx context.Context, ra func (ec *executionContext) field_Query_serviceTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9276,9 +9453,9 @@ func (ec *executionContext) field_Query_serviceTypes_args(ctx context.Context, r } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9309,44 +9486,6 @@ func (ec *executionContext) field_Query_service_args(ctx context.Context, rawArg return args, nil } -func (ec *executionContext) field_Query_surveys_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 *models.Cursor - if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) - if err != nil { - return nil, err - } - } - args["after"] = arg0 - var arg1 *int - if tmp, ok := rawArgs["first"]; ok { - arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } - } - args["first"] = arg1 - var arg2 *models.Cursor - if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) - if err != nil { - return nil, err - } - } - args["before"] = arg2 - var arg3 *int - if tmp, ok := rawArgs["last"]; ok { - arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } - } - args["last"] = arg3 - return args, nil -} - func (ec *executionContext) field_Query_vertex_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -9400,9 +9539,9 @@ func (ec *executionContext) field_Query_workOrderType_args(ctx context.Context, func (ec *executionContext) field_Query_workOrderTypes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9416,9 +9555,9 @@ func (ec *executionContext) field_Query_workOrderTypes_args(ctx context.Context, } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9452,9 +9591,9 @@ func (ec *executionContext) field_Query_workOrder_args(ctx context.Context, rawA func (ec *executionContext) field_Query_workOrders_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Cursor + var arg0 *ent.Cursor if tmp, ok := rawArgs["after"]; ok { - arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg0, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -9468,9 +9607,9 @@ func (ec *executionContext) field_Query_workOrders_args(ctx context.Context, raw } } args["first"] = arg1 - var arg2 *models.Cursor + var arg2 *ent.Cursor if tmp, ok := rawArgs["before"]; ok { - arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, tmp) + arg2, err = ec.unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, tmp) if err != nil { return nil, err } @@ -11422,7 +11561,7 @@ func (ec *executionContext) _Customer_externalId(ctx context.Context, field grap return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _CustomerConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.CustomerConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _CustomerConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.CustomerConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -11448,15 +11587,18 @@ func (ec *executionContext) _CustomerConnection_edges(ctx context.Context, field return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.CustomerEdge) + res := resTmp.([]*ent.CustomerEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOCustomerEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerEdgeᚄ(ctx, field.Selections, res) + return ec.marshalNCustomerEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _CustomerConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.CustomerConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _CustomerConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.CustomerConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -11487,13 +11629,13 @@ func (ec *executionContext) _CustomerConnection_pageInfo(ctx context.Context, fi } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _CustomerEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.CustomerEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _CustomerEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.CustomerEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -11527,7 +11669,7 @@ func (ec *executionContext) _CustomerEdge_node(ctx context.Context, field graphq return ec.marshalOCustomer2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomer(ctx, field.Selections, res) } -func (ec *executionContext) _CustomerEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.CustomerEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _CustomerEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.CustomerEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -11558,10 +11700,10 @@ func (ec *executionContext) _CustomerEdge_cursor(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Device_id(ctx context.Context, field graphql.CollectedField, obj *models.Device) (ret graphql.Marshaler) { @@ -12823,7 +12965,7 @@ func (ec *executionContext) _EquipmentPortDefinition_bandwidth(ctx context.Conte return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortDefinitionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortDefinitionConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortDefinitionConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortDefinitionConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -12849,15 +12991,18 @@ func (ec *executionContext) _EquipmentPortDefinitionConnection_edges(ctx context return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.EquipmentPortDefinitionEdge) + res := resTmp.([]*ent.EquipmentPortDefinitionEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOEquipmentPortDefinitionEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionEdge(ctx, field.Selections, res) + return ec.marshalNEquipmentPortDefinitionEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortDefinitionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortDefinitionConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortDefinitionConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortDefinitionConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -12883,15 +13028,18 @@ func (ec *executionContext) _EquipmentPortDefinitionConnection_pageInfo(ctx cont return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortDefinitionEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortDefinitionEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortDefinitionEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortDefinitionEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -12925,7 +13073,7 @@ func (ec *executionContext) _EquipmentPortDefinitionEdge_node(ctx context.Contex return ec.marshalOEquipmentPortDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinition(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortDefinitionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortDefinitionEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortDefinitionEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortDefinitionEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -12956,10 +13104,10 @@ func (ec *executionContext) _EquipmentPortDefinitionEdge_cursor(ctx context.Cont } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _EquipmentPortType_id(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortType) (ret graphql.Marshaler) { @@ -13147,7 +13295,7 @@ func (ec *executionContext) _EquipmentPortType_numberOfPortDefinitions(ctx conte return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -13173,15 +13321,18 @@ func (ec *executionContext) _EquipmentPortTypeConnection_edges(ctx context.Conte return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.EquipmentPortTypeEdge) + res := resTmp.([]*ent.EquipmentPortTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOEquipmentPortTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeEdge(ctx, field.Selections, res) + return ec.marshalNEquipmentPortTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -13207,15 +13358,18 @@ func (ec *executionContext) _EquipmentPortTypeConnection_pageInfo(ctx context.Co return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -13249,7 +13403,7 @@ func (ec *executionContext) _EquipmentPortTypeEdge_node(ctx context.Context, fie return ec.marshalOEquipmentPortType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortType(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentPortTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentPortTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentPortTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPortTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -13280,10 +13434,10 @@ func (ec *executionContext) _EquipmentPortTypeEdge_cursor(ctx context.Context, f } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _EquipmentPosition_id(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentPosition) (ret graphql.Marshaler) { @@ -13940,7 +14094,7 @@ func (ec *executionContext) _EquipmentType_numberOfEquipment(ctx context.Context return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -13966,15 +14120,18 @@ func (ec *executionContext) _EquipmentTypeConnection_edges(ctx context.Context, return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.EquipmentTypeEdge) + res := resTmp.([]*ent.EquipmentTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOEquipmentTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeEdge(ctx, field.Selections, res) + return ec.marshalNEquipmentTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -14000,15 +14157,18 @@ func (ec *executionContext) _EquipmentTypeConnection_pageInfo(ctx context.Contex return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -14042,7 +14202,7 @@ func (ec *executionContext) _EquipmentTypeEdge_node(ctx context.Context, field g return ec.marshalOEquipmentType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentType(ctx, field.Selections, res) } -func (ec *executionContext) _EquipmentTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.EquipmentTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _EquipmentTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.EquipmentTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -14073,10 +14233,10 @@ func (ec *executionContext) _EquipmentTypeEdge_cursor(ctx context.Context, field } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Field_name(ctx context.Context, field graphql.CollectedField, obj *ent.Field) (ret graphql.Marshaler) { @@ -16166,7 +16326,7 @@ func (ec *executionContext) _Location_floorPlans(ctx context.Context, field grap return ec.marshalNFloorPlan2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFloorPlan(ctx, field.Selections, res) } -func (ec *executionContext) _LocationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.LocationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.LocationConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16192,15 +16352,18 @@ func (ec *executionContext) _LocationConnection_edges(ctx context.Context, field return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.LocationEdge) + res := resTmp.([]*ent.LocationEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOLocationEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationEdge(ctx, field.Selections, res) + return ec.marshalNLocationEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _LocationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.LocationConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.LocationConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16226,15 +16389,18 @@ func (ec *executionContext) _LocationConnection_pageInfo(ctx context.Context, fi return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _LocationEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.LocationEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.LocationEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16268,7 +16434,7 @@ func (ec *executionContext) _LocationEdge_node(ctx context.Context, field graphq return ec.marshalOLocation2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocation(ctx, field.Selections, res) } -func (ec *executionContext) _LocationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.LocationEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.LocationEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16299,10 +16465,10 @@ func (ec *executionContext) _LocationEdge_cursor(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _LocationSearchResult_locations(ctx context.Context, field graphql.CollectedField, obj *models.LocationSearchResult) (ret graphql.Marshaler) { @@ -16500,13 +16666,13 @@ func (ec *executionContext) _LocationType_isSite(ctx context.Context, field grap Object: "LocationType", Field: field, Args: nil, - IsMethod: true, + IsMethod: false, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.LocationType().IsSite(rctx, obj) + return obj.Site, nil }) if err != nil { ec.Error(ctx, err) @@ -16701,10 +16867,10 @@ func (ec *executionContext) _LocationType_locations(ctx context.Context, field g if resTmp == nil { return graphql.Null } - res := resTmp.(*models.LocationConnection) + res := resTmp.(*ent.LocationConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationConnection(ctx, field.Selections, res) + return ec.marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationConnection(ctx, field.Selections, res) } func (ec *executionContext) _LocationType_surveyTemplateCategories(ctx context.Context, field graphql.CollectedField, obj *ent.LocationType) (ret graphql.Marshaler) { @@ -16741,7 +16907,7 @@ func (ec *executionContext) _LocationType_surveyTemplateCategories(ctx context.C return ec.marshalOSurveyTemplateCategory2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurveyTemplateCategory(ctx, field.Selections, res) } -func (ec *executionContext) _LocationTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.LocationTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.LocationTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16767,15 +16933,18 @@ func (ec *executionContext) _LocationTypeConnection_edges(ctx context.Context, f return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.LocationTypeEdge) + res := resTmp.([]*ent.LocationTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOLocationTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeEdge(ctx, field.Selections, res) + return ec.marshalNLocationTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _LocationTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.LocationTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.LocationTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16801,15 +16970,18 @@ func (ec *executionContext) _LocationTypeConnection_pageInfo(ctx context.Context return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _LocationTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.LocationTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.LocationTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16843,7 +17015,7 @@ func (ec *executionContext) _LocationTypeEdge_node(ctx context.Context, field gr return ec.marshalOLocationType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationType(ctx, field.Selections, res) } -func (ec *executionContext) _LocationTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.LocationTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _LocationTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.LocationTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -16874,10 +17046,10 @@ func (ec *executionContext) _LocationTypeEdge_cursor(ctx context.Context, field } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Mutation_createSurvey(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -19629,7 +19801,7 @@ func (ec *executionContext) _NetworkTopology_links(ctx context.Context, field gr return ec.marshalNTopologyLink2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐTopologyLinkᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *ent.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -19666,7 +19838,7 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *ent.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -19703,7 +19875,7 @@ func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *ent.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -19731,13 +19903,13 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra if resTmp == nil { return graphql.Null } - res := resTmp.(*models.Cursor) + res := resTmp.(*ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *ent.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -19765,10 +19937,10 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.(*models.Cursor) + res := resTmp.(*ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _PortSearchResult_ports(ctx context.Context, field graphql.CollectedField, obj *models.PortSearchResult) (ret graphql.Marshaler) { @@ -20510,7 +20682,7 @@ func (ec *executionContext) _ProjectType_workOrders(ctx context.Context, field g return ec.marshalNWorkOrderDefinition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderDefinition(ctx, field.Selections, res) } -func (ec *executionContext) _ProjectTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.ProjectTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ProjectTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ProjectTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -20536,15 +20708,18 @@ func (ec *executionContext) _ProjectTypeConnection_edges(ctx context.Context, fi return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.ProjectTypeEdge) + res := resTmp.([]*ent.ProjectTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOProjectTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeEdgeᚄ(ctx, field.Selections, res) + return ec.marshalNProjectTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _ProjectTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.ProjectTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ProjectTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ProjectTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -20575,13 +20750,13 @@ func (ec *executionContext) _ProjectTypeConnection_pageInfo(ctx context.Context, } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _ProjectTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.ProjectTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ProjectTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ProjectTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -20615,7 +20790,7 @@ func (ec *executionContext) _ProjectTypeEdge_node(ctx context.Context, field gra return ec.marshalOProjectType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectType(ctx, field.Selections, res) } -func (ec *executionContext) _ProjectTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.ProjectTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ProjectTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ProjectTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -20646,10 +20821,10 @@ func (ec *executionContext) _ProjectTypeEdge_cursor(ctx context.Context, field g } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Property_id(ctx context.Context, field graphql.CollectedField, obj *ent.Property) (ret graphql.Marshaler) { @@ -22018,7 +22193,7 @@ func (ec *executionContext) _Query_locationTypes(ctx context.Context, field grap ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().LocationTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().LocationTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22027,10 +22202,10 @@ func (ec *executionContext) _Query_locationTypes(ctx context.Context, field grap if resTmp == nil { return graphql.Null } - res := resTmp.(*models.LocationTypeConnection) + res := resTmp.(*ent.LocationTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOLocationTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeConnection(ctx, field.Selections, res) + return ec.marshalOLocationTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_locations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22059,7 +22234,7 @@ func (ec *executionContext) _Query_locations(ctx context.Context, field graphql. ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Locations(rctx, args["onlyTopLevel"].(*bool), args["types"].([]string), args["name"].(*string), args["needsSiteSurvey"].(*bool), args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().Locations(rctx, args["onlyTopLevel"].(*bool), args["types"].([]string), args["name"].(*string), args["needsSiteSurvey"].(*bool), args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22068,10 +22243,10 @@ func (ec *executionContext) _Query_locations(ctx context.Context, field graphql. if resTmp == nil { return graphql.Null } - res := resTmp.(*models.LocationConnection) + res := resTmp.(*ent.LocationConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationConnection(ctx, field.Selections, res) + return ec.marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_equipment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22182,7 +22357,7 @@ func (ec *executionContext) _Query_equipmentPortTypes(ctx context.Context, field ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().EquipmentPortTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().EquipmentPortTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22194,10 +22369,10 @@ func (ec *executionContext) _Query_equipmentPortTypes(ctx context.Context, field } return graphql.Null } - res := resTmp.(*models.EquipmentPortTypeConnection) + res := resTmp.(*ent.EquipmentPortTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNEquipmentPortTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeConnection(ctx, field.Selections, res) + return ec.marshalNEquipmentPortTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_equipmentPortDefinitions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22226,7 +22401,7 @@ func (ec *executionContext) _Query_equipmentPortDefinitions(ctx context.Context, ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().EquipmentPortDefinitions(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().EquipmentPortDefinitions(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22238,10 +22413,10 @@ func (ec *executionContext) _Query_equipmentPortDefinitions(ctx context.Context, } return graphql.Null } - res := resTmp.(*models.EquipmentPortDefinitionConnection) + res := resTmp.(*ent.EquipmentPortDefinitionConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNEquipmentPortDefinitionConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionConnection(ctx, field.Selections, res) + return ec.marshalNEquipmentPortDefinitionConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_equipmentTypes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22270,7 +22445,7 @@ func (ec *executionContext) _Query_equipmentTypes(ctx context.Context, field gra ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().EquipmentTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().EquipmentTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22282,10 +22457,10 @@ func (ec *executionContext) _Query_equipmentTypes(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(*models.EquipmentTypeConnection) + res := resTmp.(*ent.EquipmentTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNEquipmentTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeConnection(ctx, field.Selections, res) + return ec.marshalNEquipmentTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_service(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22396,7 +22571,7 @@ func (ec *executionContext) _Query_serviceTypes(ctx context.Context, field graph ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ServiceTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().ServiceTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22405,10 +22580,10 @@ func (ec *executionContext) _Query_serviceTypes(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.(*models.ServiceTypeConnection) + res := resTmp.(*ent.ServiceTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOServiceTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeConnection(ctx, field.Selections, res) + return ec.marshalOServiceTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_workOrder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22478,7 +22653,7 @@ func (ec *executionContext) _Query_workOrders(ctx context.Context, field graphql ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().WorkOrders(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int), args["showCompleted"].(*bool)) + return ec.resolvers.Query().WorkOrders(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int), args["showCompleted"].(*bool)) }) if err != nil { ec.Error(ctx, err) @@ -22490,10 +22665,10 @@ func (ec *executionContext) _Query_workOrders(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*models.WorkOrderConnection) + res := resTmp.(*ent.WorkOrderConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNWorkOrderConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderConnection(ctx, field.Selections, res) + return ec.marshalNWorkOrderConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_workOrderType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22563,7 +22738,7 @@ func (ec *executionContext) _Query_workOrderTypes(ctx context.Context, field gra ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().WorkOrderTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().WorkOrderTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -22572,10 +22747,10 @@ func (ec *executionContext) _Query_workOrderTypes(ctx context.Context, field gra if resTmp == nil { return graphql.Null } - res := resTmp.(*models.WorkOrderTypeConnection) + res := resTmp.(*ent.WorkOrderTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOWorkOrderTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeConnection(ctx, field.Selections, res) + return ec.marshalOWorkOrderTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_searchForEntity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -22604,7 +22779,7 @@ func (ec *executionContext) _Query_searchForEntity(ctx context.Context, field gr ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().SearchForEntity(rctx, args["name"].(string), args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().SearchForEntity(rctx, args["name"].(string), args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -23034,17 +23209,10 @@ func (ec *executionContext) _Query_surveys(ctx context.Context, field graphql.Co IsMethod: true, } ctx = graphql.WithResolverContext(ctx, rctx) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_surveys_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Surveys(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().Surveys(rctx) }) if err != nil { ec.Error(ctx, err) @@ -23059,7 +23227,7 @@ func (ec *executionContext) _Query_surveys(ctx context.Context, field graphql.Co res := resTmp.([]*ent.Survey) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNSurvey2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurvey(ctx, field.Selections, res) + return ec.marshalNSurvey2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurveyᚄ(ctx, field.Selections, res) } func (ec *executionContext) _Query_findLocationWithDuplicateProperties(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -23292,7 +23460,7 @@ func (ec *executionContext) _Query_projectTypes(ctx context.Context, field graph ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ProjectTypes(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().ProjectTypes(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -23301,10 +23469,10 @@ func (ec *executionContext) _Query_projectTypes(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.(*models.ProjectTypeConnection) + res := resTmp.(*ent.ProjectTypeConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOProjectTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeConnection(ctx, field.Selections, res) + return ec.marshalOProjectTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_project(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -23415,7 +23583,7 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Customers(rctx, args["after"].(*models.Cursor), args["first"].(*int), args["before"].(*models.Cursor), args["last"].(*int)) + return ec.resolvers.Query().Customers(rctx, args["after"].(*ent.Cursor), args["first"].(*int), args["before"].(*ent.Cursor), args["last"].(*int)) }) if err != nil { ec.Error(ctx, err) @@ -23424,10 +23592,10 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. if resTmp == nil { return graphql.Null } - res := resTmp.(*models.CustomerConnection) + res := resTmp.(*ent.CustomerConnection) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOCustomerConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerConnection(ctx, field.Selections, res) + return ec.marshalOCustomerConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerConnection(ctx, field.Selections, res) } func (ec *executionContext) _Query_actionsRules(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -23604,7 +23772,7 @@ func (ec *executionContext) _SearchEntriesConnection_edges(ctx context.Context, res := resTmp.([]*models.SearchEntryEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx, field.Selections, res) + return ec.marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdgeᚄ(ctx, field.Selections, res) } func (ec *executionContext) _SearchEntriesConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.SearchEntriesConnection) (ret graphql.Marshaler) { @@ -23633,12 +23801,15 @@ func (ec *executionContext) _SearchEntriesConnection_pageInfo(ctx context.Contex return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(*ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) _SearchEntry_entityId(ctx context.Context, field graphql.CollectedField, obj *models.SearchEntry) (ret graphql.Marshaler) { @@ -23854,10 +24025,10 @@ func (ec *executionContext) _SearchEntryEdge_cursor(ctx context.Context, field g } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Service_id(ctx context.Context, field graphql.CollectedField, obj *ent.Service) (ret graphql.Marshaler) { @@ -24742,7 +24913,7 @@ func (ec *executionContext) _ServiceType_numberOfServices(ctx context.Context, f return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _ServiceTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.ServiceTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ServiceTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ServiceTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -24768,15 +24939,18 @@ func (ec *executionContext) _ServiceTypeConnection_edges(ctx context.Context, fi return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.ServiceTypeEdge) + res := resTmp.([]*ent.ServiceTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOServiceTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEdge(ctx, field.Selections, res) + return ec.marshalNServiceTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _ServiceTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.ServiceTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _ServiceTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.ServiceTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -24802,15 +24976,18 @@ func (ec *executionContext) _ServiceTypeConnection_pageInfo(ctx context.Context, return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _ServiceTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.ServiceTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ServiceTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.ServiceTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -24844,7 +25021,7 @@ func (ec *executionContext) _ServiceTypeEdge_node(ctx context.Context, field gra return ec.marshalOServiceType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceType(ctx, field.Selections, res) } -func (ec *executionContext) _ServiceTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.ServiceTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _ServiceTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.ServiceTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -24875,10 +25052,10 @@ func (ec *executionContext) _ServiceTypeEdge_cursor(ctx context.Context, field g } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _Survey_id(ctx context.Context, field graphql.CollectedField, obj *ent.Survey) (ret graphql.Marshaler) { @@ -28579,7 +28756,7 @@ func (ec *executionContext) _WorkOrder_checkList(ctx context.Context, field grap return ec.marshalNCheckListItem2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCheckListItem(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -28605,15 +28782,18 @@ func (ec *executionContext) _WorkOrderConnection_edges(ctx context.Context, fiel return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.WorkOrderEdge) + res := resTmp.([]*ent.WorkOrderEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOWorkOrderEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderEdge(ctx, field.Selections, res) + return ec.marshalNWorkOrderEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -28639,12 +28819,15 @@ func (ec *executionContext) _WorkOrderConnection_pageInfo(ctx context.Context, f return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } func (ec *executionContext) _WorkOrderDefinition_id(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderDefinition) (ret graphql.Marshaler) { @@ -28755,7 +28938,7 @@ func (ec *executionContext) _WorkOrderDefinition_type(ctx context.Context, field return ec.marshalNWorkOrderType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -28789,7 +28972,7 @@ func (ec *executionContext) _WorkOrderEdge_node(ctx context.Context, field graph return ec.marshalOWorkOrder2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrder(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -28820,10 +29003,10 @@ func (ec *executionContext) _WorkOrderEdge_cursor(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) _WorkOrderExecutionResult_id(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderExecutionResult) (ret graphql.Marshaler) { @@ -29267,7 +29450,7 @@ func (ec *executionContext) _WorkOrderType_checkListDefinitions(ctx context.Cont return ec.marshalNCheckListItemDefinition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCheckListItemDefinition(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderTypeConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -29293,15 +29476,18 @@ func (ec *executionContext) _WorkOrderTypeConnection_edges(ctx context.Context, return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*models.WorkOrderTypeEdge) + res := resTmp.([]*ent.WorkOrderTypeEdge) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOWorkOrderTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeEdge(ctx, field.Selections, res) + return ec.marshalNWorkOrderTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeEdgeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderTypeConnection) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderTypeConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderTypeConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -29327,15 +29513,18 @@ func (ec *executionContext) _WorkOrderTypeConnection_pageInfo(ctx context.Contex return graphql.Null } if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*models.PageInfo) + res := resTmp.(ent.PageInfo) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res) + return ec.marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderTypeEdge_node(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -29369,7 +29558,7 @@ func (ec *executionContext) _WorkOrderTypeEdge_node(ctx context.Context, field g return ec.marshalOWorkOrderType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx, field.Selections, res) } -func (ec *executionContext) _WorkOrderTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.WorkOrderTypeEdge) (ret graphql.Marshaler) { +func (ec *executionContext) _WorkOrderTypeEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *ent.WorkOrderTypeEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { if r := recover(); r != nil { @@ -29400,10 +29589,10 @@ func (ec *executionContext) _WorkOrderTypeEdge_cursor(ctx context.Context, field } return graphql.Null } - res := resTmp.(models.Cursor) + res := resTmp.(ent.Cursor) rctx.Result = res ctx = ec.Tracer.StartFieldChildExecution(ctx) - return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, field.Selections, res) + return ec.marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, field.Selections, res) } func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { @@ -34594,7 +34783,7 @@ func (ec *executionContext) _Customer(ctx context.Context, sel ast.SelectionSet, var customerConnectionImplementors = []string{"CustomerConnection"} -func (ec *executionContext) _CustomerConnection(ctx context.Context, sel ast.SelectionSet, obj *models.CustomerConnection) graphql.Marshaler { +func (ec *executionContext) _CustomerConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.CustomerConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, customerConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -34605,6 +34794,9 @@ func (ec *executionContext) _CustomerConnection(ctx context.Context, sel ast.Sel out.Values[i] = graphql.MarshalString("CustomerConnection") case "edges": out.Values[i] = ec._CustomerConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._CustomerConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -34623,7 +34815,7 @@ func (ec *executionContext) _CustomerConnection(ctx context.Context, sel ast.Sel var customerEdgeImplementors = []string{"CustomerEdge"} -func (ec *executionContext) _CustomerEdge(ctx context.Context, sel ast.SelectionSet, obj *models.CustomerEdge) graphql.Marshaler { +func (ec *executionContext) _CustomerEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.CustomerEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, customerEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -35081,7 +35273,7 @@ func (ec *executionContext) _EquipmentPortDefinition(ctx context.Context, sel as var equipmentPortDefinitionConnectionImplementors = []string{"EquipmentPortDefinitionConnection"} -func (ec *executionContext) _EquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentPortDefinitionConnection) graphql.Marshaler { +func (ec *executionContext) _EquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentPortDefinitionConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentPortDefinitionConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -35092,8 +35284,14 @@ func (ec *executionContext) _EquipmentPortDefinitionConnection(ctx context.Conte out.Values[i] = graphql.MarshalString("EquipmentPortDefinitionConnection") case "edges": out.Values[i] = ec._EquipmentPortDefinitionConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._EquipmentPortDefinitionConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -35107,7 +35305,7 @@ func (ec *executionContext) _EquipmentPortDefinitionConnection(ctx context.Conte var equipmentPortDefinitionEdgeImplementors = []string{"EquipmentPortDefinitionEdge"} -func (ec *executionContext) _EquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentPortDefinitionEdge) graphql.Marshaler { +func (ec *executionContext) _EquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentPortDefinitionEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentPortDefinitionEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -35210,7 +35408,7 @@ func (ec *executionContext) _EquipmentPortType(ctx context.Context, sel ast.Sele var equipmentPortTypeConnectionImplementors = []string{"EquipmentPortTypeConnection"} -func (ec *executionContext) _EquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentPortTypeConnection) graphql.Marshaler { +func (ec *executionContext) _EquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentPortTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentPortTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -35221,8 +35419,14 @@ func (ec *executionContext) _EquipmentPortTypeConnection(ctx context.Context, se out.Values[i] = graphql.MarshalString("EquipmentPortTypeConnection") case "edges": out.Values[i] = ec._EquipmentPortTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._EquipmentPortTypeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -35236,7 +35440,7 @@ func (ec *executionContext) _EquipmentPortTypeConnection(ctx context.Context, se var equipmentPortTypeEdgeImplementors = []string{"EquipmentPortTypeEdge"} -func (ec *executionContext) _EquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentPortTypeEdge) graphql.Marshaler { +func (ec *executionContext) _EquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentPortTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentPortTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -35512,7 +35716,7 @@ func (ec *executionContext) _EquipmentType(ctx context.Context, sel ast.Selectio var equipmentTypeConnectionImplementors = []string{"EquipmentTypeConnection"} -func (ec *executionContext) _EquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentTypeConnection) graphql.Marshaler { +func (ec *executionContext) _EquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -35523,8 +35727,14 @@ func (ec *executionContext) _EquipmentTypeConnection(ctx context.Context, sel as out.Values[i] = graphql.MarshalString("EquipmentTypeConnection") case "edges": out.Values[i] = ec._EquipmentTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._EquipmentTypeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -35538,7 +35748,7 @@ func (ec *executionContext) _EquipmentTypeConnection(ctx context.Context, sel as var equipmentTypeEdgeImplementors = []string{"EquipmentTypeEdge"} -func (ec *executionContext) _EquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.EquipmentTypeEdge) graphql.Marshaler { +func (ec *executionContext) _EquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.EquipmentTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, equipmentTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -36239,7 +36449,7 @@ func (ec *executionContext) _Location(ctx context.Context, sel ast.SelectionSet, var locationConnectionImplementors = []string{"LocationConnection"} -func (ec *executionContext) _LocationConnection(ctx context.Context, sel ast.SelectionSet, obj *models.LocationConnection) graphql.Marshaler { +func (ec *executionContext) _LocationConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.LocationConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, locationConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -36250,8 +36460,14 @@ func (ec *executionContext) _LocationConnection(ctx context.Context, sel ast.Sel out.Values[i] = graphql.MarshalString("LocationConnection") case "edges": out.Values[i] = ec._LocationConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._LocationConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -36265,7 +36481,7 @@ func (ec *executionContext) _LocationConnection(ctx context.Context, sel ast.Sel var locationEdgeImplementors = []string{"LocationEdge"} -func (ec *executionContext) _LocationEdge(ctx context.Context, sel ast.SelectionSet, obj *models.LocationEdge) graphql.Marshaler { +func (ec *executionContext) _LocationEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.LocationEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, locationEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -36348,19 +36564,10 @@ func (ec *executionContext) _LocationType(ctx context.Context, sel ast.Selection case "mapType": out.Values[i] = ec._LocationType_mapType(ctx, field, obj) case "isSite": - field := field - out.Concurrently(i, func() (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._LocationType_isSite(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } - return res - }) + out.Values[i] = ec._LocationType_isSite(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } case "index": out.Values[i] = ec._LocationType_index(ctx, field, obj) case "mapZoomLevel": @@ -36428,7 +36635,7 @@ func (ec *executionContext) _LocationType(ctx context.Context, sel ast.Selection var locationTypeConnectionImplementors = []string{"LocationTypeConnection"} -func (ec *executionContext) _LocationTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.LocationTypeConnection) graphql.Marshaler { +func (ec *executionContext) _LocationTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.LocationTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, locationTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -36439,8 +36646,14 @@ func (ec *executionContext) _LocationTypeConnection(ctx context.Context, sel ast out.Values[i] = graphql.MarshalString("LocationTypeConnection") case "edges": out.Values[i] = ec._LocationTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._LocationTypeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -36454,7 +36667,7 @@ func (ec *executionContext) _LocationTypeConnection(ctx context.Context, sel ast var locationTypeEdgeImplementors = []string{"LocationTypeEdge"} -func (ec *executionContext) _LocationTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.LocationTypeEdge) graphql.Marshaler { +func (ec *executionContext) _LocationTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.LocationTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, locationTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -36720,7 +36933,7 @@ func (ec *executionContext) _NetworkTopology(ctx context.Context, sel ast.Select var pageInfoImplementors = []string{"PageInfo"} -func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *models.PageInfo) graphql.Marshaler { +func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *ent.PageInfo) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, pageInfoImplementors) out := graphql.NewFieldSet(fields) @@ -36995,7 +37208,7 @@ func (ec *executionContext) _ProjectType(ctx context.Context, sel ast.SelectionS var projectTypeConnectionImplementors = []string{"ProjectTypeConnection"} -func (ec *executionContext) _ProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.ProjectTypeConnection) graphql.Marshaler { +func (ec *executionContext) _ProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ProjectTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, projectTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -37006,6 +37219,9 @@ func (ec *executionContext) _ProjectTypeConnection(ctx context.Context, sel ast. out.Values[i] = graphql.MarshalString("ProjectTypeConnection") case "edges": out.Values[i] = ec._ProjectTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._ProjectTypeConnection_pageInfo(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -37024,7 +37240,7 @@ func (ec *executionContext) _ProjectTypeConnection(ctx context.Context, sel ast. var projectTypeEdgeImplementors = []string{"ProjectTypeEdge"} -func (ec *executionContext) _ProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.ProjectTypeEdge) graphql.Marshaler { +func (ec *executionContext) _ProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ProjectTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, projectTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -37793,6 +38009,9 @@ func (ec *executionContext) _SearchEntriesConnection(ctx context.Context, sel as out.Values[i] = ec._SearchEntriesConnection_edges(ctx, field, obj) case "pageInfo": out.Values[i] = ec._SearchEntriesConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -38214,7 +38433,7 @@ func (ec *executionContext) _ServiceType(ctx context.Context, sel ast.SelectionS var serviceTypeConnectionImplementors = []string{"ServiceTypeConnection"} -func (ec *executionContext) _ServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.ServiceTypeConnection) graphql.Marshaler { +func (ec *executionContext) _ServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.ServiceTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, serviceTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -38225,8 +38444,14 @@ func (ec *executionContext) _ServiceTypeConnection(ctx context.Context, sel ast. out.Values[i] = graphql.MarshalString("ServiceTypeConnection") case "edges": out.Values[i] = ec._ServiceTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._ServiceTypeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -38240,7 +38465,7 @@ func (ec *executionContext) _ServiceTypeConnection(ctx context.Context, sel ast. var serviceTypeEdgeImplementors = []string{"ServiceTypeEdge"} -func (ec *executionContext) _ServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.ServiceTypeEdge) graphql.Marshaler { +func (ec *executionContext) _ServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.ServiceTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, serviceTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -39142,7 +39367,7 @@ func (ec *executionContext) _WorkOrder(ctx context.Context, sel ast.SelectionSet var workOrderConnectionImplementors = []string{"WorkOrderConnection"} -func (ec *executionContext) _WorkOrderConnection(ctx context.Context, sel ast.SelectionSet, obj *models.WorkOrderConnection) graphql.Marshaler { +func (ec *executionContext) _WorkOrderConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.WorkOrderConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, workOrderConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -39153,8 +39378,14 @@ func (ec *executionContext) _WorkOrderConnection(ctx context.Context, sel ast.Se out.Values[i] = graphql.MarshalString("WorkOrderConnection") case "edges": out.Values[i] = ec._WorkOrderConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._WorkOrderConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -39211,7 +39442,7 @@ func (ec *executionContext) _WorkOrderDefinition(ctx context.Context, sel ast.Se var workOrderEdgeImplementors = []string{"WorkOrderEdge"} -func (ec *executionContext) _WorkOrderEdge(ctx context.Context, sel ast.SelectionSet, obj *models.WorkOrderEdge) graphql.Marshaler { +func (ec *executionContext) _WorkOrderEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.WorkOrderEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, workOrderEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -39368,7 +39599,7 @@ func (ec *executionContext) _WorkOrderType(ctx context.Context, sel ast.Selectio var workOrderTypeConnectionImplementors = []string{"WorkOrderTypeConnection"} -func (ec *executionContext) _WorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *models.WorkOrderTypeConnection) graphql.Marshaler { +func (ec *executionContext) _WorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, obj *ent.WorkOrderTypeConnection) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, workOrderTypeConnectionImplementors) out := graphql.NewFieldSet(fields) @@ -39379,8 +39610,14 @@ func (ec *executionContext) _WorkOrderTypeConnection(ctx context.Context, sel as out.Values[i] = graphql.MarshalString("WorkOrderTypeConnection") case "edges": out.Values[i] = ec._WorkOrderTypeConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "pageInfo": out.Values[i] = ec._WorkOrderTypeConnection_pageInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -39394,7 +39631,7 @@ func (ec *executionContext) _WorkOrderTypeConnection(ctx context.Context, sel as var workOrderTypeEdgeImplementors = []string{"WorkOrderTypeEdge"} -func (ec *executionContext) _WorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *models.WorkOrderTypeEdge) graphql.Marshaler { +func (ec *executionContext) _WorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, obj *ent.WorkOrderTypeEdge) graphql.Marshaler { fields := graphql.CollectFields(ec.RequestContext, sel, workOrderTypeEdgeImplementors) out := graphql.NewFieldSet(fields) @@ -40275,12 +40512,12 @@ func (ec *executionContext) unmarshalNCommentInput2githubᚗcomᚋfacebookincuba return ec.unmarshalInputCommentInput(ctx, v) } -func (ec *executionContext) unmarshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, v interface{}) (models.Cursor, error) { - var res models.Cursor +func (ec *executionContext) unmarshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, v interface{}) (ent.Cursor, error) { + var res ent.Cursor return res, res.UnmarshalGQL(v) } -func (ec *executionContext) marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, sel ast.SelectionSet, v models.Cursor) graphql.Marshaler { +func (ec *executionContext) marshalNCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, sel ast.SelectionSet, v ent.Cursor) graphql.Marshaler { return v } @@ -40321,25 +40558,62 @@ func (ec *executionContext) marshalNCustomer2ᚕᚖgithubᚗcomᚋfacebookincuba return ret } -func (ec *executionContext) marshalNCustomerEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerEdge(ctx context.Context, sel ast.SelectionSet, v models.CustomerEdge) graphql.Marshaler { +func (ec *executionContext) marshalNCustomerEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerEdge(ctx context.Context, sel ast.SelectionSet, v ent.CustomerEdge) graphql.Marshaler { return ec._CustomerEdge(ctx, sel, &v) } -func (ec *executionContext) marshalNCustomerEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerEdge(ctx context.Context, sel ast.SelectionSet, v *models.CustomerEdge) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._CustomerEdge(ctx, sel, v) -} - -func (ec *executionContext) marshalNEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEdge(ctx context.Context, sel ast.SelectionSet, v ent.Edge) graphql.Marshaler { - return ec._Edge(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Edge) graphql.Marshaler { +func (ec *executionContext) marshalNCustomerEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.CustomerEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCustomerEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNCustomerEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerEdge(ctx context.Context, sel ast.SelectionSet, v *ent.CustomerEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._CustomerEdge(ctx, sel, v) +} + +func (ec *executionContext) marshalNEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEdge(ctx context.Context, sel ast.SelectionSet, v ent.Edge) graphql.Marshaler { + return ec._Edge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Edge) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -40661,11 +40935,11 @@ func (ec *executionContext) marshalNEquipmentPortDefinition2ᚖgithubᚗcomᚋfa return ec._EquipmentPortDefinition(ctx, sel, v) } -func (ec *executionContext) marshalNEquipmentPortDefinitionConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, v models.EquipmentPortDefinitionConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortDefinitionConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPortDefinitionConnection) graphql.Marshaler { return ec._EquipmentPortDefinitionConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNEquipmentPortDefinitionConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentPortDefinitionConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortDefinitionConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPortDefinitionConnection) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") @@ -40675,125 +40949,11 @@ func (ec *executionContext) marshalNEquipmentPortDefinitionConnection2ᚖgithub return ec._EquipmentPortDefinitionConnection(ctx, sel, v) } -func (ec *executionContext) unmarshalNEquipmentPortInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx context.Context, v interface{}) (models.EquipmentPortInput, error) { - return ec.unmarshalInputEquipmentPortInput(ctx, v) -} - -func (ec *executionContext) unmarshalNEquipmentPortInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx context.Context, v interface{}) (*models.EquipmentPortInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalNEquipmentPortInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx, v) - return &res, err -} - -func (ec *executionContext) marshalNEquipmentPortTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.EquipmentPortTypeConnection) graphql.Marshaler { - return ec._EquipmentPortTypeConnection(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEquipmentPortTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentPortTypeConnection) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EquipmentPortTypeConnection(ctx, sel, v) -} - -func (ec *executionContext) marshalNEquipmentPosition2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPosition) graphql.Marshaler { - return ec._EquipmentPosition(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEquipmentPosition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPosition) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalNEquipmentPosition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPosition) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalNEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPosition) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EquipmentPosition(ctx, sel, v) -} - -func (ec *executionContext) marshalNEquipmentPositionDefinition2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPositionDefinition) graphql.Marshaler { - return ec._EquipmentPositionDefinition(ctx, sel, &v) +func (ec *executionContext) marshalNEquipmentPortDefinitionEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPortDefinitionEdge) graphql.Marshaler { + return ec._EquipmentPortDefinitionEdge(ctx, sel, &v) } -func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPositionDefinition) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortDefinitionEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPortDefinitionEdge) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -40817,7 +40977,7 @@ func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚕᚖgithubᚗc if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOEquipmentPositionDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx, sel, v[i]) + ret[i] = ec.marshalNEquipmentPortDefinitionEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -40830,75 +40990,47 @@ func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚕᚖgithubᚗc return ret } -func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPositionDefinition) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortDefinitionEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPortDefinitionEdge) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } - return ec._EquipmentPositionDefinition(ctx, sel, v) + return ec._EquipmentPortDefinitionEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalNEquipmentPositionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx context.Context, v interface{}) (models.EquipmentPositionInput, error) { - return ec.unmarshalInputEquipmentPositionInput(ctx, v) +func (ec *executionContext) unmarshalNEquipmentPortInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx context.Context, v interface{}) (models.EquipmentPortInput, error) { + return ec.unmarshalInputEquipmentPortInput(ctx, v) } -func (ec *executionContext) unmarshalNEquipmentPositionInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx context.Context, v interface{}) (*models.EquipmentPositionInput, error) { +func (ec *executionContext) unmarshalNEquipmentPortInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx context.Context, v interface{}) (*models.EquipmentPortInput, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalNEquipmentPositionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx, v) + res, err := ec.unmarshalNEquipmentPortInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInput(ctx, v) return &res, err } -func (ec *executionContext) marshalNEquipmentSearchResult2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentSearchResult(ctx context.Context, sel ast.SelectionSet, v models.EquipmentSearchResult) graphql.Marshaler { - return ec._EquipmentSearchResult(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEquipmentSearchResult2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentSearchResult(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentSearchResult) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EquipmentSearchResult(ctx, sel, v) -} - -func (ec *executionContext) marshalNEquipmentType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentType(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentType) graphql.Marshaler { - return ec._EquipmentType(ctx, sel, &v) -} - -func (ec *executionContext) marshalNEquipmentType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentType(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentType) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._EquipmentType(ctx, sel, v) -} - -func (ec *executionContext) marshalNEquipmentTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.EquipmentTypeConnection) graphql.Marshaler { - return ec._EquipmentTypeConnection(ctx, sel, &v) +func (ec *executionContext) marshalNEquipmentPortTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPortTypeConnection) graphql.Marshaler { + return ec._EquipmentPortTypeConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNEquipmentTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPortTypeConnection) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } - return ec._EquipmentTypeConnection(ctx, sel, v) + return ec._EquipmentPortTypeConnection(ctx, sel, v) } -func (ec *executionContext) marshalNField2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx context.Context, sel ast.SelectionSet, v ent.Field) graphql.Marshaler { - return ec._Field(ctx, sel, &v) +func (ec *executionContext) marshalNEquipmentPortTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPortTypeEdge) graphql.Marshaler { + return ec._EquipmentPortTypeEdge(ctx, sel, &v) } -func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Field) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPortTypeEdge) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -40922,7 +41054,7 @@ func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋfacebookincubator if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNField2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx, sel, v[i]) + ret[i] = ec.marshalNEquipmentPortTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -40935,21 +41067,21 @@ func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋfacebookincubator return ret } -func (ec *executionContext) marshalNField2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx context.Context, sel ast.SelectionSet, v *ent.Field) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPortTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPortTypeEdge) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } - return ec._Field(ctx, sel, v) + return ec._EquipmentPortTypeEdge(ctx, sel, v) } -func (ec *executionContext) marshalNFile2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v ent.File) graphql.Marshaler { - return ec._File(ctx, sel, &v) +func (ec *executionContext) marshalNEquipmentPosition2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPosition) graphql.Marshaler { + return ec._EquipmentPosition(ctx, sel, &v) } -func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v []*ent.File) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPosition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPosition) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -40973,7 +41105,7 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋfacebookincubator if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOFile2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx, sel, v[i]) + ret[i] = ec.marshalOEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx, sel, v[i]) } if isLen1 { f(i) @@ -40986,40 +41118,335 @@ func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋfacebookincubator return ret } -func (ec *executionContext) marshalNFile2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v *ent.File) graphql.Marshaler { - if v == nil { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - return ec._File(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNFilterOperator2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐFilterOperator(ctx context.Context, v interface{}) (models.FilterOperator, error) { - var res models.FilterOperator - return res, res.UnmarshalGQL(v) -} - -func (ec *executionContext) marshalNFilterOperator2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐFilterOperator(ctx context.Context, sel ast.SelectionSet, v models.FilterOperator) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v interface{}) (float64, error) { - return graphql.UnmarshalFloat(v) -} - -func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { - res := graphql.MarshalFloat(v) - if res == graphql.Null { - if !ec.HasError(graphql.GetResolverContext(ctx)) { - ec.Errorf(ctx, "must not be null") - } - } - return res -} - -func (ec *executionContext) marshalNFloorPlan2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFloorPlan(ctx context.Context, sel ast.SelectionSet, v []*ent.FloorPlan) graphql.Marshaler { +func (ec *executionContext) marshalNEquipmentPosition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPosition) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNEquipmentPosition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPosition) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentPosition(ctx, sel, v) +} + +func (ec *executionContext) marshalNEquipmentPositionDefinition2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPositionDefinition) graphql.Marshaler { + return ec._EquipmentPositionDefinition(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentPositionDefinition) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOEquipmentPositionDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNEquipmentPositionDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPositionDefinition(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentPositionDefinition) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentPositionDefinition(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNEquipmentPositionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx context.Context, v interface{}) (models.EquipmentPositionInput, error) { + return ec.unmarshalInputEquipmentPositionInput(ctx, v) +} + +func (ec *executionContext) unmarshalNEquipmentPositionInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx context.Context, v interface{}) (*models.EquipmentPositionInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalNEquipmentPositionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPositionInput(ctx, v) + return &res, err +} + +func (ec *executionContext) marshalNEquipmentSearchResult2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentSearchResult(ctx context.Context, sel ast.SelectionSet, v models.EquipmentSearchResult) graphql.Marshaler { + return ec._EquipmentSearchResult(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEquipmentSearchResult2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentSearchResult(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentSearchResult) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentSearchResult(ctx, sel, v) +} + +func (ec *executionContext) marshalNEquipmentType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentType(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentType) graphql.Marshaler { + return ec._EquipmentType(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEquipmentType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentType(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentType) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentType(ctx, sel, v) +} + +func (ec *executionContext) marshalNEquipmentTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentTypeConnection) graphql.Marshaler { + return ec._EquipmentTypeConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEquipmentTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentTypeConnection) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentTypeConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNEquipmentTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentTypeEdge) graphql.Marshaler { + return ec._EquipmentTypeEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNEquipmentTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.EquipmentTypeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNEquipmentTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNEquipmentTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.EquipmentTypeEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._EquipmentTypeEdge(ctx, sel, v) +} + +func (ec *executionContext) marshalNField2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx context.Context, sel ast.SelectionSet, v ent.Field) graphql.Marshaler { + return ec._Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalNField2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Field) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNField2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNField2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐField(ctx context.Context, sel ast.SelectionSet, v *ent.Field) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Field(ctx, sel, v) +} + +func (ec *executionContext) marshalNFile2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v ent.File) graphql.Marshaler { + return ec._File(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFile2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v []*ent.File) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOFile2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNFile2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v *ent.File) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._File(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNFilterOperator2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐFilterOperator(ctx context.Context, v interface{}) (models.FilterOperator, error) { + var res models.FilterOperator + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNFilterOperator2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐFilterOperator(ctx context.Context, sel ast.SelectionSet, v models.FilterOperator) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v interface{}) (float64, error) { + return graphql.UnmarshalFloat(v) +} + +func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { + res := graphql.MarshalFloat(v) + if res == graphql.Null { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) marshalNFloorPlan2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFloorPlan(ctx context.Context, sel ast.SelectionSet, v []*ent.FloorPlan) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -41413,6 +41840,57 @@ func (ec *executionContext) marshalNLocation2ᚖgithubᚗcomᚋfacebookincubator return ec._Location(ctx, sel, v) } +func (ec *executionContext) marshalNLocationEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationEdge(ctx context.Context, sel ast.SelectionSet, v ent.LocationEdge) graphql.Marshaler { + return ec._LocationEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNLocationEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.LocationEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNLocationEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNLocationEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationEdge(ctx context.Context, sel ast.SelectionSet, v *ent.LocationEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._LocationEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNLocationFilterInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationFilterInput(ctx context.Context, v interface{}) (models.LocationFilterInput, error) { return ec.unmarshalInputLocationFilterInput(ctx, v) } @@ -41482,6 +41960,57 @@ func (ec *executionContext) marshalNLocationType2ᚖgithubᚗcomᚋfacebookincub return ec._LocationType(ctx, sel, v) } +func (ec *executionContext) marshalNLocationTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.LocationTypeEdge) graphql.Marshaler { + return ec._LocationTypeEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNLocationTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.LocationTypeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNLocationTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNLocationTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.LocationTypeEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._LocationTypeEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNLocationTypeIndex2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeIndex(ctx context.Context, v interface{}) ([]*models.LocationTypeIndex, error) { var vSlice []interface{} if v != nil { @@ -41563,11 +42092,11 @@ func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋfacebookincubatorᚋs return ret } -func (ec *executionContext) marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v models.PageInfo) graphql.Marshaler { +func (ec *executionContext) marshalNPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v ent.PageInfo) graphql.Marshaler { return ec._PageInfo(ctx, sel, &v) } -func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *models.PageInfo) graphql.Marshaler { +func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *ent.PageInfo) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") @@ -41775,11 +42304,48 @@ func (ec *executionContext) marshalNProjectType2ᚖgithubᚗcomᚋfacebookincuba return ec._ProjectType(ctx, sel, v) } -func (ec *executionContext) marshalNProjectTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.ProjectTypeEdge) graphql.Marshaler { +func (ec *executionContext) marshalNProjectTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.ProjectTypeEdge) graphql.Marshaler { return ec._ProjectTypeEdge(ctx, sel, &v) } -func (ec *executionContext) marshalNProjectTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.ProjectTypeEdge) graphql.Marshaler { +func (ec *executionContext) marshalNProjectTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.ProjectTypeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNProjectTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNProjectTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ProjectTypeEdge) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") @@ -42021,6 +42587,20 @@ func (ec *executionContext) marshalNSearchEntriesConnection2ᚖgithubᚗcomᚋfa return ec._SearchEntriesConnection(ctx, sel, v) } +func (ec *executionContext) marshalNSearchEntryEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx context.Context, sel ast.SelectionSet, v models.SearchEntryEdge) graphql.Marshaler { + return ec._SearchEntryEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNSearchEntryEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx context.Context, sel ast.SelectionSet, v *models.SearchEntryEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._SearchEntryEdge(ctx, sel, v) +} + func (ec *executionContext) marshalNService2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐService(ctx context.Context, sel ast.SelectionSet, v ent.Service) graphql.Marshaler { return ec._Service(ctx, sel, &v) } @@ -42259,6 +42839,57 @@ func (ec *executionContext) unmarshalNServiceTypeCreateData2githubᚗcomᚋfaceb return ec.unmarshalInputServiceTypeCreateData(ctx, v) } +func (ec *executionContext) marshalNServiceTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.ServiceTypeEdge) graphql.Marshaler { + return ec._ServiceTypeEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNServiceTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.ServiceTypeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNServiceTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNServiceTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.ServiceTypeEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._ServiceTypeEdge(ctx, sel, v) +} + func (ec *executionContext) unmarshalNServiceTypeEditData2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEditData(ctx context.Context, v interface{}) (models.ServiceTypeEditData, error) { return ec.unmarshalInputServiceTypeEditData(ctx, v) } @@ -42277,6 +42908,10 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S return res } +func (ec *executionContext) marshalNSurvey2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurvey(ctx context.Context, sel ast.SelectionSet, v ent.Survey) graphql.Marshaler { + return ec._Survey(ctx, sel, &v) +} + func (ec *executionContext) marshalNSurvey2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurvey(ctx context.Context, sel ast.SelectionSet, v []*ent.Survey) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -42314,6 +42949,53 @@ func (ec *executionContext) marshalNSurvey2ᚕᚖgithubᚗcomᚋfacebookincubato return ret } +func (ec *executionContext) marshalNSurvey2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurveyᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.Survey) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNSurvey2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurvey(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNSurvey2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurvey(ctx context.Context, sel ast.SelectionSet, v *ent.Survey) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Survey(ctx, sel, v) +} + func (ec *executionContext) marshalNSurveyCellScan2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐSurveyCellScan(ctx context.Context, sel ast.SelectionSet, v []*ent.SurveyCellScan) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup @@ -42755,11 +43437,11 @@ func (ec *executionContext) marshalNWorkOrder2ᚖgithubᚗcomᚋfacebookincubato return ec._WorkOrder(ctx, sel, v) } -func (ec *executionContext) marshalNWorkOrderConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderConnection(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderConnection) graphql.Marshaler { +func (ec *executionContext) marshalNWorkOrderConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderConnection(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderConnection) graphql.Marshaler { return ec._WorkOrderConnection(ctx, sel, &v) } -func (ec *executionContext) marshalNWorkOrderConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderConnection(ctx context.Context, sel ast.SelectionSet, v *models.WorkOrderConnection) graphql.Marshaler { +func (ec *executionContext) marshalNWorkOrderConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderConnection(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderConnection) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") @@ -42793,7 +43475,184 @@ func (ec *executionContext) marshalNWorkOrderDefinition2ᚕᚖgithubᚗcomᚋfac if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOWorkOrderDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderDefinition(ctx, sel, v[i]) + ret[i] = ec.marshalOWorkOrderDefinition2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderDefinition(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) unmarshalNWorkOrderDefinitionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx context.Context, v interface{}) (models.WorkOrderDefinitionInput, error) { + return ec.unmarshalInputWorkOrderDefinitionInput(ctx, v) +} + +func (ec *executionContext) unmarshalNWorkOrderDefinitionInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx context.Context, v interface{}) (*models.WorkOrderDefinitionInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalNWorkOrderDefinitionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx, v) + return &res, err +} + +func (ec *executionContext) marshalNWorkOrderEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderEdge(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderEdge) graphql.Marshaler { + return ec._WorkOrderEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNWorkOrderEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.WorkOrderEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNWorkOrderEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNWorkOrderEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderEdge(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderEdge) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._WorkOrderEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNWorkOrderFilterInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx context.Context, v interface{}) (models.WorkOrderFilterInput, error) { + return ec.unmarshalInputWorkOrderFilterInput(ctx, v) +} + +func (ec *executionContext) unmarshalNWorkOrderFilterInput2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInputᚄ(ctx context.Context, v interface{}) ([]*models.WorkOrderFilterInput, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]*models.WorkOrderFilterInput, len(vSlice)) + for i := range vSlice { + res[i], err = ec.unmarshalNWorkOrderFilterInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNWorkOrderFilterInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx context.Context, v interface{}) (*models.WorkOrderFilterInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalNWorkOrderFilterInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx, v) + return &res, err +} + +func (ec *executionContext) unmarshalNWorkOrderFilterType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterType(ctx context.Context, v interface{}) (models.WorkOrderFilterType, error) { + var res models.WorkOrderFilterType + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNWorkOrderFilterType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterType(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderFilterType) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNWorkOrderPriority2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderPriority(ctx context.Context, v interface{}) (models.WorkOrderPriority, error) { + var res models.WorkOrderPriority + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNWorkOrderPriority2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderPriority(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderPriority) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNWorkOrderStatus2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderStatus(ctx context.Context, v interface{}) (models.WorkOrderStatus, error) { + var res models.WorkOrderStatus + return res, res.UnmarshalGQL(v) +} + +func (ec *executionContext) marshalNWorkOrderStatus2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderStatus(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderStatus) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNWorkOrderType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderType) graphql.Marshaler { + return ec._WorkOrderType(ctx, sel, &v) +} + +func (ec *executionContext) marshalNWorkOrderType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderType) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._WorkOrderType(ctx, sel, v) +} + +func (ec *executionContext) marshalNWorkOrderTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderTypeEdge) graphql.Marshaler { + return ec._WorkOrderTypeEdge(ctx, sel, &v) +} + +func (ec *executionContext) marshalNWorkOrderTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*ent.WorkOrderTypeEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + rctx := &graphql.ResolverContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNWorkOrderTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -42806,89 +43665,14 @@ func (ec *executionContext) marshalNWorkOrderDefinition2ᚕᚖgithubᚗcomᚋfac return ret } -func (ec *executionContext) unmarshalNWorkOrderDefinitionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx context.Context, v interface{}) (models.WorkOrderDefinitionInput, error) { - return ec.unmarshalInputWorkOrderDefinitionInput(ctx, v) -} - -func (ec *executionContext) unmarshalNWorkOrderDefinitionInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx context.Context, v interface{}) (*models.WorkOrderDefinitionInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalNWorkOrderDefinitionInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderDefinitionInput(ctx, v) - return &res, err -} - -func (ec *executionContext) unmarshalNWorkOrderFilterInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx context.Context, v interface{}) (models.WorkOrderFilterInput, error) { - return ec.unmarshalInputWorkOrderFilterInput(ctx, v) -} - -func (ec *executionContext) unmarshalNWorkOrderFilterInput2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInputᚄ(ctx context.Context, v interface{}) ([]*models.WorkOrderFilterInput, error) { - var vSlice []interface{} - if v != nil { - if tmp1, ok := v.([]interface{}); ok { - vSlice = tmp1 - } else { - vSlice = []interface{}{v} - } - } - var err error - res := make([]*models.WorkOrderFilterInput, len(vSlice)) - for i := range vSlice { - res[i], err = ec.unmarshalNWorkOrderFilterInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) unmarshalNWorkOrderFilterInput2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx context.Context, v interface{}) (*models.WorkOrderFilterInput, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalNWorkOrderFilterInput2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterInput(ctx, v) - return &res, err -} - -func (ec *executionContext) unmarshalNWorkOrderFilterType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterType(ctx context.Context, v interface{}) (models.WorkOrderFilterType, error) { - var res models.WorkOrderFilterType - return res, res.UnmarshalGQL(v) -} - -func (ec *executionContext) marshalNWorkOrderFilterType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderFilterType(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderFilterType) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNWorkOrderPriority2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderPriority(ctx context.Context, v interface{}) (models.WorkOrderPriority, error) { - var res models.WorkOrderPriority - return res, res.UnmarshalGQL(v) -} - -func (ec *executionContext) marshalNWorkOrderPriority2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderPriority(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderPriority) graphql.Marshaler { - return v -} - -func (ec *executionContext) unmarshalNWorkOrderStatus2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderStatus(ctx context.Context, v interface{}) (models.WorkOrderStatus, error) { - var res models.WorkOrderStatus - return res, res.UnmarshalGQL(v) -} - -func (ec *executionContext) marshalNWorkOrderStatus2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderStatus(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderStatus) graphql.Marshaler { - return v -} - -func (ec *executionContext) marshalNWorkOrderType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderType) graphql.Marshaler { - return ec._WorkOrderType(ctx, sel, &v) -} - -func (ec *executionContext) marshalNWorkOrderType2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderType(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderType) graphql.Marshaler { +func (ec *executionContext) marshalNWorkOrderTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderTypeEdge) graphql.Marshaler { if v == nil { if !ec.HasError(graphql.GetResolverContext(ctx)) { ec.Errorf(ctx, "must not be null") } return graphql.Null } - return ec._WorkOrderType(ctx, sel, v) + return ec._WorkOrderTypeEdge(ctx, sel, v) } func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { @@ -43348,24 +44132,24 @@ func (ec *executionContext) marshalOComment2ᚖgithubᚗcomᚋfacebookincubator return ec._Comment(ctx, sel, v) } -func (ec *executionContext) unmarshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, v interface{}) (models.Cursor, error) { - var res models.Cursor +func (ec *executionContext) unmarshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, v interface{}) (ent.Cursor, error) { + var res ent.Cursor return res, res.UnmarshalGQL(v) } -func (ec *executionContext) marshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, sel ast.SelectionSet, v models.Cursor) graphql.Marshaler { +func (ec *executionContext) marshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, sel ast.SelectionSet, v ent.Cursor) graphql.Marshaler { return v } -func (ec *executionContext) unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, v interface{}) (*models.Cursor, error) { +func (ec *executionContext) unmarshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, v interface{}) (*ent.Cursor, error) { if v == nil { return nil, nil } - res, err := ec.unmarshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx, v) + res, err := ec.unmarshalOCursor2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx, v) return &res, err } -func (ec *executionContext) marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCursor(ctx context.Context, sel ast.SelectionSet, v *models.Cursor) graphql.Marshaler { +func (ec *executionContext) marshalOCursor2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCursor(ctx context.Context, sel ast.SelectionSet, v *ent.Cursor) graphql.Marshaler { if v == nil { return graphql.Null } @@ -43383,57 +44167,17 @@ func (ec *executionContext) marshalOCustomer2ᚖgithubᚗcomᚋfacebookincubator return ec._Customer(ctx, sel, v) } -func (ec *executionContext) marshalOCustomerConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerConnection(ctx context.Context, sel ast.SelectionSet, v models.CustomerConnection) graphql.Marshaler { +func (ec *executionContext) marshalOCustomerConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerConnection(ctx context.Context, sel ast.SelectionSet, v ent.CustomerConnection) graphql.Marshaler { return ec._CustomerConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOCustomerConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerConnection(ctx context.Context, sel ast.SelectionSet, v *models.CustomerConnection) graphql.Marshaler { +func (ec *executionContext) marshalOCustomerConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐCustomerConnection(ctx context.Context, sel ast.SelectionSet, v *ent.CustomerConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._CustomerConnection(ctx, sel, v) } -func (ec *executionContext) marshalOCustomerEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.CustomerEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNCustomerEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐCustomerEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - func (ec *executionContext) marshalODevice2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐDevice(ctx context.Context, sel ast.SelectionSet, v models.Device) graphql.Marshaler { return ec._Device(ctx, sel, &v) } @@ -43478,57 +44222,6 @@ func (ec *executionContext) marshalOEquipmentPortDefinition2ᚖgithubᚗcomᚋfa return ec._EquipmentPortDefinition(ctx, sel, v) } -func (ec *executionContext) marshalOEquipmentPortDefinitionEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, v models.EquipmentPortDefinitionEdge) graphql.Marshaler { - return ec._EquipmentPortDefinitionEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOEquipmentPortDefinitionEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, v []*models.EquipmentPortDefinitionEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOEquipmentPortDefinitionEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOEquipmentPortDefinitionEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortDefinitionEdge(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentPortDefinitionEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._EquipmentPortDefinitionEdge(ctx, sel, v) -} - func (ec *executionContext) unmarshalOEquipmentPortInput2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortInputᚄ(ctx context.Context, v interface{}) ([]*models.EquipmentPortInput, error) { var vSlice []interface{} if v != nil { @@ -43560,57 +44253,6 @@ func (ec *executionContext) marshalOEquipmentPortType2ᚖgithubᚗcomᚋfacebook return ec._EquipmentPortType(ctx, sel, v) } -func (ec *executionContext) marshalOEquipmentPortTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.EquipmentPortTypeEdge) graphql.Marshaler { - return ec._EquipmentPortTypeEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOEquipmentPortTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*models.EquipmentPortTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOEquipmentPortTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOEquipmentPortTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentPortTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentPortTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._EquipmentPortTypeEdge(ctx, sel, v) -} - func (ec *executionContext) marshalOEquipmentPosition2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐEquipmentPosition(ctx context.Context, sel ast.SelectionSet, v ent.EquipmentPosition) graphql.Marshaler { return ec._EquipmentPosition(ctx, sel, &v) } @@ -43664,57 +44306,6 @@ func (ec *executionContext) marshalOEquipmentType2ᚖgithubᚗcomᚋfacebookincu return ec._EquipmentType(ctx, sel, v) } -func (ec *executionContext) marshalOEquipmentTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.EquipmentTypeEdge) graphql.Marshaler { - return ec._EquipmentTypeEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOEquipmentTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*models.EquipmentTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOEquipmentTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOEquipmentTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐEquipmentTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.EquipmentTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._EquipmentTypeEdge(ctx, sel, v) -} - func (ec *executionContext) marshalOFile2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐFile(ctx context.Context, sel ast.SelectionSet, v ent.File) graphql.Marshaler { return ec._File(ctx, sel, &v) } @@ -43931,68 +44522,17 @@ func (ec *executionContext) marshalOLocation2ᚖgithubᚗcomᚋfacebookincubator return ec._Location(ctx, sel, v) } -func (ec *executionContext) marshalOLocationConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationConnection(ctx context.Context, sel ast.SelectionSet, v models.LocationConnection) graphql.Marshaler { +func (ec *executionContext) marshalOLocationConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationConnection(ctx context.Context, sel ast.SelectionSet, v ent.LocationConnection) graphql.Marshaler { return ec._LocationConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationConnection(ctx context.Context, sel ast.SelectionSet, v *models.LocationConnection) graphql.Marshaler { +func (ec *executionContext) marshalOLocationConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationConnection(ctx context.Context, sel ast.SelectionSet, v *ent.LocationConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._LocationConnection(ctx, sel, v) } -func (ec *executionContext) marshalOLocationEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationEdge(ctx context.Context, sel ast.SelectionSet, v models.LocationEdge) graphql.Marshaler { - return ec._LocationEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOLocationEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationEdge(ctx context.Context, sel ast.SelectionSet, v []*models.LocationEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOLocationEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOLocationEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationEdge(ctx context.Context, sel ast.SelectionSet, v *models.LocationEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._LocationEdge(ctx, sel, v) -} - func (ec *executionContext) marshalOLocationType2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationType(ctx context.Context, sel ast.SelectionSet, v ent.LocationType) graphql.Marshaler { return ec._LocationType(ctx, sel, &v) } @@ -44044,68 +44584,17 @@ func (ec *executionContext) marshalOLocationType2ᚖgithubᚗcomᚋfacebookincub return ec._LocationType(ctx, sel, v) } -func (ec *executionContext) marshalOLocationTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.LocationTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOLocationTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.LocationTypeConnection) graphql.Marshaler { return ec._LocationTypeConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOLocationTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.LocationTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOLocationTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐLocationTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.LocationTypeConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._LocationTypeConnection(ctx, sel, v) } -func (ec *executionContext) marshalOLocationTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.LocationTypeEdge) graphql.Marshaler { - return ec._LocationTypeEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOLocationTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*models.LocationTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOLocationTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOLocationTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.LocationTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._LocationTypeEdge(ctx, sel, v) -} - func (ec *executionContext) unmarshalOLocationTypeIndex2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐLocationTypeIndex(ctx context.Context, v interface{}) (models.LocationTypeIndex, error) { return ec.unmarshalInputLocationTypeIndex(ctx, v) } @@ -44125,17 +44614,6 @@ func (ec *executionContext) marshalONode2githubᚗcomᚋfacebookincubatorᚋsymp return ec._Node(ctx, sel, v) } -func (ec *executionContext) marshalOPageInfo2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v models.PageInfo) graphql.Marshaler { - return ec._PageInfo(ctx, sel, &v) -} - -func (ec *executionContext) marshalOPageInfo2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *models.PageInfo) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._PageInfo(ctx, sel, v) -} - func (ec *executionContext) marshalOProject2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProject(ctx context.Context, sel ast.SelectionSet, v ent.Project) graphql.Marshaler { return ec._Project(ctx, sel, &v) } @@ -44158,57 +44636,17 @@ func (ec *executionContext) marshalOProjectType2ᚖgithubᚗcomᚋfacebookincuba return ec._ProjectType(ctx, sel, v) } -func (ec *executionContext) marshalOProjectTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.ProjectTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOProjectTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.ProjectTypeConnection) graphql.Marshaler { return ec._ProjectTypeConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOProjectTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.ProjectTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOProjectTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProjectTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ProjectTypeConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._ProjectTypeConnection(ctx, sel, v) } -func (ec *executionContext) marshalOProjectTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.ProjectTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNProjectTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐProjectTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - func (ec *executionContext) marshalOProperty2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐProperty(ctx context.Context, sel ast.SelectionSet, v ent.Property) graphql.Marshaler { return ec._Property(ctx, sel, &v) } @@ -44357,11 +44795,7 @@ func (ec *executionContext) marshalOSearchEntry2ᚖgithubᚗcomᚋfacebookincuba return ec._SearchEntry(ctx, sel, v) } -func (ec *executionContext) marshalOSearchEntryEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx context.Context, sel ast.SelectionSet, v models.SearchEntryEdge) graphql.Marshaler { - return ec._SearchEntryEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx context.Context, sel ast.SelectionSet, v []*models.SearchEntryEdge) graphql.Marshaler { +func (ec *executionContext) marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.SearchEntryEdge) graphql.Marshaler { if v == nil { return graphql.Null } @@ -44388,7 +44822,7 @@ func (ec *executionContext) marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfaceboo if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalOSearchEntryEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx, sel, v[i]) + ret[i] = ec.marshalNSearchEntryEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx, sel, v[i]) } if isLen1 { f(i) @@ -44401,13 +44835,6 @@ func (ec *executionContext) marshalOSearchEntryEdge2ᚕᚖgithubᚗcomᚋfaceboo return ret } -func (ec *executionContext) marshalOSearchEntryEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐSearchEntryEdge(ctx context.Context, sel ast.SelectionSet, v *models.SearchEntryEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._SearchEntryEdge(ctx, sel, v) -} - func (ec *executionContext) marshalOService2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐService(ctx context.Context, sel ast.SelectionSet, v ent.Service) graphql.Marshaler { return ec._Service(ctx, sel, &v) } @@ -44465,68 +44892,17 @@ func (ec *executionContext) marshalOServiceType2ᚖgithubᚗcomᚋfacebookincuba return ec._ServiceType(ctx, sel, v) } -func (ec *executionContext) marshalOServiceTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.ServiceTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOServiceTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.ServiceTypeConnection) graphql.Marshaler { return ec._ServiceTypeConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOServiceTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.ServiceTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOServiceTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐServiceTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.ServiceTypeConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._ServiceTypeConnection(ctx, sel, v) } -func (ec *executionContext) marshalOServiceTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.ServiceTypeEdge) graphql.Marshaler { - return ec._ServiceTypeEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOServiceTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*models.ServiceTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOServiceTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOServiceTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐServiceTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.ServiceTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._ServiceTypeEdge(ctx, sel, v) -} - func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { return graphql.UnmarshalString(v) } @@ -45110,57 +45486,6 @@ func (ec *executionContext) unmarshalOWorkOrderDefinitionInput2ᚕᚖgithubᚗco return res, nil } -func (ec *executionContext) marshalOWorkOrderEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderEdge(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderEdge) graphql.Marshaler { - return ec._WorkOrderEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOWorkOrderEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderEdge(ctx context.Context, sel ast.SelectionSet, v []*models.WorkOrderEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOWorkOrderEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOWorkOrderEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderEdge(ctx context.Context, sel ast.SelectionSet, v *models.WorkOrderEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._WorkOrderEdge(ctx, sel, v) -} - func (ec *executionContext) marshalOWorkOrderExecutionResult2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderExecutionResult(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderExecutionResult) graphql.Marshaler { return ec._WorkOrderExecutionResult(ctx, sel, &v) } @@ -45231,68 +45556,17 @@ func (ec *executionContext) marshalOWorkOrderType2ᚖgithubᚗcomᚋfacebookincu return ec._WorkOrderType(ctx, sel, v) } -func (ec *executionContext) marshalOWorkOrderTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOWorkOrderTypeConnection2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, v ent.WorkOrderTypeConnection) graphql.Marshaler { return ec._WorkOrderTypeConnection(ctx, sel, &v) } -func (ec *executionContext) marshalOWorkOrderTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, v *models.WorkOrderTypeConnection) graphql.Marshaler { +func (ec *executionContext) marshalOWorkOrderTypeConnection2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋentᚐWorkOrderTypeConnection(ctx context.Context, sel ast.SelectionSet, v *ent.WorkOrderTypeConnection) graphql.Marshaler { if v == nil { return graphql.Null } return ec._WorkOrderTypeConnection(ctx, sel, v) } -func (ec *executionContext) marshalOWorkOrderTypeEdge2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, v models.WorkOrderTypeEdge) graphql.Marshaler { - return ec._WorkOrderTypeEdge(ctx, sel, &v) -} - -func (ec *executionContext) marshalOWorkOrderTypeEdge2ᚕᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, v []*models.WorkOrderTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - rctx := &graphql.ResolverContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalOWorkOrderTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeEdge(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - return ret -} - -func (ec *executionContext) marshalOWorkOrderTypeEdge2ᚖgithubᚗcomᚋfacebookincubatorᚋsymphonyᚋgraphᚋgraphqlᚋmodelsᚐWorkOrderTypeEdge(ctx context.Context, sel ast.SelectionSet, v *models.WorkOrderTypeEdge) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._WorkOrderTypeEdge(ctx, sel, v) -} - func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/symphony/graph/graphql/models/cursor.go b/symphony/graph/graphql/models/cursor.go deleted file mode 100644 index 5d2d3e5b1fcb..000000000000 --- a/symphony/graph/graphql/models/cursor.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2004-present Facebook All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package models - -import ( - "encoding/base64" - "fmt" - "io" - "strings" - - "github.com/ugorji/go/codec" -) - -// Cursor of a relay edge type. -type Cursor struct { - ID string - Offset int -} - -var quote = []byte(`"`) - -// MarshalGQL implements graphql.Marshaler interface. -func (c Cursor) MarshalGQL(w io.Writer) { - w.Write(quote) - defer w.Write(quote) - wc := base64.NewEncoder(base64.StdEncoding, w) - defer wc.Close() - _ = codec.NewEncoder(wc, &codec.MsgpackHandle{}).Encode(c) -} - -// UnmarshalGQL implements graphql.Unmarshaler interface. -func (c *Cursor) UnmarshalGQL(v interface{}) error { - s, ok := v.(string) - if !ok { - return fmt.Errorf("%T is not a string", v) - } - if err := codec.NewDecoder( - base64.NewDecoder( - base64.StdEncoding, - strings.NewReader(s), - ), - &codec.MsgpackHandle{}, - ).Decode(c); err != nil { - return fmt.Errorf("decode cursor: %w", err) - } - return nil -} diff --git a/symphony/graph/graphql/models/generated.go b/symphony/graph/graphql/models/generated.go index 02357f0b094e..a53254773e72 100644 --- a/symphony/graph/graphql/models/generated.go +++ b/symphony/graph/graphql/models/generated.go @@ -220,16 +220,6 @@ type CommentInput struct { Text string `json:"text"` } -type CustomerConnection struct { - Edges []*CustomerEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type CustomerEdge struct { - Node *ent.Customer `json:"node"` - Cursor Cursor `json:"cursor"` -} - type Device struct { ID string `json:"id"` Name string `json:"name"` @@ -339,16 +329,6 @@ type EquipmentFilterInput struct { MaxDepth *int `json:"maxDepth"` } -type EquipmentPortDefinitionConnection struct { - Edges []*EquipmentPortDefinitionEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type EquipmentPortDefinitionEdge struct { - Node *ent.EquipmentPortDefinition `json:"node"` - Cursor Cursor `json:"cursor"` -} - type EquipmentPortInput struct { ID *string `json:"id"` Name string `json:"name"` @@ -358,16 +338,6 @@ type EquipmentPortInput struct { Bandwidth *string `json:"bandwidth"` } -type EquipmentPortTypeConnection struct { - Edges []*EquipmentPortTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type EquipmentPortTypeEdge struct { - Node *ent.EquipmentPortType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type EquipmentPositionInput struct { ID *string `json:"id"` Name string `json:"name"` @@ -380,16 +350,6 @@ type EquipmentSearchResult struct { Count int `json:"count"` } -type EquipmentTypeConnection struct { - Edges []*EquipmentTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type EquipmentTypeEdge struct { - Node *ent.EquipmentType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type FileInput struct { ID string `json:"id"` FileName string `json:"fileName"` @@ -424,16 +384,6 @@ type LinkSide struct { Port string `json:"port"` } -type LocationConnection struct { - Edges []*LocationEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type LocationEdge struct { - Node *ent.Location `json:"node"` - Cursor Cursor `json:"cursor"` -} - type LocationFilterInput struct { FilterType LocationFilterType `json:"filterType"` Operator FilterOperator `json:"operator"` @@ -449,16 +399,6 @@ type LocationSearchResult struct { Count int `json:"count"` } -type LocationTypeConnection struct { - Edges []*LocationTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type LocationTypeEdge struct { - Node *ent.LocationType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type LocationTypeIndex struct { LocationTypeID string `json:"locationTypeID"` Index int `json:"index"` @@ -469,13 +409,6 @@ type NetworkTopology struct { Links []*TopologyLink `json:"links"` } -type PageInfo struct { - HasNextPage bool `json:"hasNextPage"` - HasPreviousPage bool `json:"hasPreviousPage"` - StartCursor *Cursor `json:"startCursor"` - EndCursor *Cursor `json:"endCursor"` -} - type PortFilterInput struct { FilterType PortFilterType `json:"filterType"` Operator FilterOperator `json:"operator"` @@ -497,16 +430,6 @@ type ProjectFilterInput struct { StringValue *string `json:"stringValue"` } -type ProjectTypeConnection struct { - Edges []*ProjectTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type ProjectTypeEdge struct { - Node *ent.ProjectType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type PropertyInput struct { ID *string `json:"id"` PropertyTypeID string `json:"propertyTypeID"` @@ -552,9 +475,12 @@ type PythonPackage struct { HasBreakingChange bool `json:"hasBreakingChange"` } +// A connection to a list of search entries. type SearchEntriesConnection struct { - Edges []*SearchEntryEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` + // A list of search entry edges. + Edges []*SearchEntryEdge `json:"edges"` + // Information to aid in pagination. + PageInfo *ent.PageInfo `json:"pageInfo"` } type SearchEntry struct { @@ -564,9 +490,12 @@ type SearchEntry struct { Type string `json:"type"` } +// A search entry edge in a connection. type SearchEntryEdge struct { - Node *SearchEntry `json:"node"` - Cursor Cursor `json:"cursor"` + // The search entry at the end of the edge. + Node *SearchEntry `json:"node"` + // A cursor for use in pagination. + Cursor ent.Cursor `json:"cursor"` } type ServiceCreateData struct { @@ -603,22 +532,12 @@ type ServiceSearchResult struct { Count int `json:"count"` } -type ServiceTypeConnection struct { - Edges []*ServiceTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - type ServiceTypeCreateData struct { Name string `json:"name"` HasCustomer bool `json:"hasCustomer"` Properties []*PropertyTypeInput `json:"properties"` } -type ServiceTypeEdge struct { - Node *ent.ServiceType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type ServiceTypeEditData struct { ID string `json:"id"` Name string `json:"name"` @@ -722,22 +641,12 @@ type TopologyLink struct { Target ent.Noder `json:"target"` } -type WorkOrderConnection struct { - Edges []*WorkOrderEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - type WorkOrderDefinitionInput struct { ID *string `json:"id"` Index *int `json:"index"` Type string `json:"type"` } -type WorkOrderEdge struct { - Node *ent.WorkOrder `json:"node"` - Cursor Cursor `json:"cursor"` -} - type WorkOrderExecutionResult struct { ID string `json:"id"` Name string `json:"name"` @@ -756,16 +665,6 @@ type WorkOrderFilterInput struct { MaxDepth *int `json:"maxDepth"` } -type WorkOrderTypeConnection struct { - Edges []*WorkOrderTypeEdge `json:"edges"` - PageInfo *PageInfo `json:"pageInfo"` -} - -type WorkOrderTypeEdge struct { - Node *ent.WorkOrderType `json:"node"` - Cursor Cursor `json:"cursor"` -} - type CellularNetworkType string const ( diff --git a/symphony/graph/graphql/resolver/location.go b/symphony/graph/graphql/resolver/location.go index 02933169226b..8a25a1cd3977 100644 --- a/symphony/graph/graphql/resolver/location.go +++ b/symphony/graph/graphql/resolver/location.go @@ -30,29 +30,16 @@ func (locationTypeResolver) NumberOfLocations(ctx context.Context, obj *ent.Loca return obj.QueryLocations().Count(ctx) } -func (locationTypeResolver) IsSite(ctx context.Context, obj *ent.LocationType) (bool, error) { - return obj.Site, nil -} - -func (locationTypeResolver) Locations(ctx context.Context, typ *ent.LocationType, enforceHasLatLong *bool) (*models.LocationConnection, error) { +func (locationTypeResolver) Locations(ctx context.Context, typ *ent.LocationType, enforceHasLatLong *bool) (*ent.LocationConnection, error) { query := typ.QueryLocations() if enforceHasLatLong != nil && *enforceHasLatLong { query = query.Where(location.LatitudeNEQ(0), location.LongitudeNEQ(0)) } - - locs, err := query.All(ctx) - if err != nil { - return nil, errors.Wrapf(err, "failed querying locations of type %q", typ.ID) - } - edges := make([]*models.LocationEdge, len(locs)) - for i, l := range locs { - edges[i] = &models.LocationEdge{Node: l} - } - return &models.LocationConnection{Edges: edges}, err + return query.Paginate(ctx, nil, nil, nil, nil) } -func (locationTypeResolver) SurveyTemplateCategories(ctx context.Context, ent *ent.LocationType) ([]*ent.SurveyTemplateCategory, error) { - return ent.QuerySurveyTemplateCategories().All(ctx) +func (locationTypeResolver) SurveyTemplateCategories(ctx context.Context, obj *ent.LocationType) ([]*ent.SurveyTemplateCategory, error) { + return obj.QuerySurveyTemplateCategories().All(ctx) } type locationResolver struct{} diff --git a/symphony/graph/graphql/resolver/project.go b/symphony/graph/graphql/resolver/project.go index bebf126e2d8d..969e1fceaa7c 100644 --- a/symphony/graph/graphql/resolver/project.go +++ b/symphony/graph/graphql/resolver/project.go @@ -187,38 +187,11 @@ func (r queryResolver) ProjectType(ctx context.Context, id string) (*ent.Project func (r queryResolver) ProjectTypes( ctx context.Context, - _ *models.Cursor, _ *int, - _ *models.Cursor, _ *int, -) (*models.ProjectTypeConnection, error) { - types, err := r.ClientFrom(ctx).ProjectType.Query().All(ctx) - switch { - case err != nil: - return nil, xerrors.Errorf("querying project types: %w", err) - case len(types) == 0: - return &models.ProjectTypeConnection{ - Edges: []*models.ProjectTypeEdge{}, - PageInfo: &models.PageInfo{}, - }, nil - } - edges := make([]*models.ProjectTypeEdge, len(types)) - for i, typ := range types { - edges[i] = &models.ProjectTypeEdge{ - Node: typ, - Cursor: models.Cursor{ - ID: typ.ID, - Offset: i, - }, - } - } - return &models.ProjectTypeConnection{ - Edges: edges, - PageInfo: &models.PageInfo{ - HasNextPage: false, - HasPreviousPage: false, - StartCursor: &edges[0].Cursor, - EndCursor: &edges[len(edges)-1].Cursor, - }, - }, nil + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.ProjectTypeConnection, error) { + return r.ClientFrom(ctx).ProjectType.Query(). + Paginate(ctx, after, first, before, last) } func (projectResolver) Type(ctx context.Context, obj *ent.Project) (*ent.ProjectType, error) { diff --git a/symphony/graph/graphql/resolver/query.go b/symphony/graph/graphql/resolver/query.go index 9052f7cfb5f6..a3f333373417 100644 --- a/symphony/graph/graphql/resolver/query.go +++ b/symphony/graph/graphql/resolver/query.go @@ -17,7 +17,6 @@ import ( "github.com/facebookincubator/symphony/graph/ent/propertytype" "github.com/facebookincubator/symphony/graph/ent/workorder" "github.com/facebookincubator/symphony/graph/graphql/models" - "github.com/facebookincubator/symphony/graph/resolverutil" "github.com/facebookincubator/symphony/graph/viewer" "github.com/facebookincubator/symphony/pkg/actions" "github.com/facebookincubator/symphony/pkg/actions/core" @@ -66,16 +65,20 @@ func (r queryResolver) LocationType(ctx context.Context, id string) (*ent.Locati } func (r queryResolver) LocationTypes( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.LocationTypeConnection, error) { - return resolverutil.LocationTypes(ctx, r.ClientFrom(ctx)) + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.LocationTypeConnection, error) { + return r.ClientFrom(ctx).LocationType.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) Locations( ctx context.Context, onlyTopLevel *bool, types []string, name *string, needsSiteSurvey *bool, - _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.LocationConnection, error) { + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.LocationConnection, error) { query := r.ClientFrom(ctx).Location.Query() if onlyTopLevel != nil && *onlyTopLevel { query = query.Where(location.Not(location.HasParent())) @@ -89,15 +92,7 @@ func (r queryResolver) Locations( if needsSiteSurvey != nil { query = query.Where(location.SiteSurveyNeeded(*needsSiteSurvey)) } - ls, err := query.All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying locations") - } - edges := make([]*models.LocationEdge, len(ls)) - for i, l := range ls { - edges[i] = &models.LocationEdge{Node: l} - } - return &models.LocationConnection{Edges: edges}, nil + return query.Paginate(ctx, after, first, before, last) } func (r queryResolver) NearestSites(ctx context.Context, latitude, longitude float64, first int) ([]*ent.Location, error) { @@ -132,10 +127,11 @@ func (r queryResolver) EquipmentType(ctx context.Context, id string) (*ent.Equip func (r queryResolver) EquipmentTypes( ctx context.Context, - _ *models.Cursor, _ *int, - _ *models.Cursor, _ *int, -) (*models.EquipmentTypeConnection, error) { - return resolverutil.EquipmentTypes(ctx, r.ClientFrom(ctx)) + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.EquipmentTypeConnection, error) { + return r.ClientFrom(ctx).EquipmentType.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) EquipmentPortType(ctx context.Context, id string) (*ent.EquipmentPortType, error) { @@ -147,21 +143,21 @@ func (r queryResolver) EquipmentPortType(ctx context.Context, id string) (*ent.E } func (r queryResolver) EquipmentPortTypes( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.EquipmentPortTypeConnection, error) { - return resolverutil.EquipmentPortTypes(ctx, r.ClientFrom(ctx)) + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.EquipmentPortTypeConnection, error) { + return r.ClientFrom(ctx).EquipmentPortType.Query(). + Paginate(ctx, after, first, before, last) } -func (r queryResolver) EquipmentPortDefinitions(ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int) (*models.EquipmentPortDefinitionConnection, error) { - eds, err := r.ClientFrom(ctx).EquipmentPortDefinition.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying equipment definitions") - } - edges := make([]*models.EquipmentPortDefinitionEdge, len(eds)) - for i, et := range eds { - edges[i] = &models.EquipmentPortDefinitionEdge{Node: et} - } - return &models.EquipmentPortDefinitionConnection{Edges: edges}, err +func (r queryResolver) EquipmentPortDefinitions( + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.EquipmentPortDefinitionConnection, error) { + return r.ClientFrom(ctx).EquipmentPortDefinition.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) WorkOrder(ctx context.Context, id string) (*ent.WorkOrder, error) { @@ -174,10 +170,10 @@ func (r queryResolver) WorkOrder(ctx context.Context, id string) (*ent.WorkOrder func (r queryResolver) WorkOrders( ctx context.Context, - _ *models.Cursor, _ *int, - _ *models.Cursor, _ *int, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, showCompleted *bool, -) (*models.WorkOrderConnection, error) { +) (*ent.WorkOrderConnection, error) { query := r.ClientFrom(ctx).WorkOrder.Query() if showCompleted != nil && !*showCompleted { query = query.Where(workorder.StatusIn( @@ -185,15 +181,7 @@ func (r queryResolver) WorkOrders( models.WorkOrderStatusPlanned.String(), )) } - wos, err := query.All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying work orders") - } - edges := make([]*models.WorkOrderEdge, len(wos)) - for i, wo := range wos { - edges[i] = &models.WorkOrderEdge{Node: wo} - } - return &models.WorkOrderConnection{Edges: edges}, nil + return query.Paginate(ctx, after, first, before, last) } func (r queryResolver) WorkOrderType(ctx context.Context, id string) (*ent.WorkOrderType, error) { @@ -205,25 +193,18 @@ func (r queryResolver) WorkOrderType(ctx context.Context, id string) (*ent.WorkO } func (r queryResolver) WorkOrderTypes( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.WorkOrderTypeConnection, error) { - ets, err := r.ClientFrom(ctx). - WorkOrderType.Query(). - All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying work order types") - } - edges := make([]*models.WorkOrderTypeEdge, len(ets)) - for i, et := range ets { - edges[i] = &models.WorkOrderTypeEdge{Node: et} - } - return &models.WorkOrderTypeConnection{Edges: edges}, err + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.WorkOrderTypeConnection, error) { + return r.ClientFrom(ctx).WorkOrderType.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) SearchForEntity( ctx context.Context, name string, - _ *models.Cursor, limit *int, - _ *models.Cursor, _ *int, + _ *ent.Cursor, limit *int, + _ *ent.Cursor, _ *int, ) (*models.SearchEntriesConnection, error) { if limit == nil { return nil, errors.New("first is a mandatory param") @@ -319,9 +300,7 @@ func (r queryResolver) PossibleProperties(ctx context.Context, entityType models return types, nil } -func (r queryResolver) Surveys( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) ([]*ent.Survey, error) { +func (r queryResolver) Surveys(ctx context.Context) ([]*ent.Survey, error) { surveys, err := r.ClientFrom(ctx).Survey.Query().All(ctx) if err != nil { return nil, errors.Wrap(err, "querying all surveys") @@ -346,9 +325,12 @@ func (r queryResolver) ServiceType(ctx context.Context, id string) (*ent.Service } func (r queryResolver) ServiceTypes( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.ServiceTypeConnection, error) { - return resolverutil.ServiceTypes(ctx, r.ClientFrom(ctx)) + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.ServiceTypeConnection, error) { + return r.ClientFrom(ctx).ServiceType.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) Customer(ctx context.Context, id string) (*ent.Customer, error) { @@ -360,17 +342,12 @@ func (r queryResolver) Customer(ctx context.Context, id string) (*ent.Customer, } func (r queryResolver) Customers( - ctx context.Context, _ *models.Cursor, _ *int, _ *models.Cursor, _ *int, -) (*models.CustomerConnection, error) { - sts, err := r.ClientFrom(ctx).Customer.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying customers") - } - edges := make([]*models.CustomerEdge, len(sts)) - for i, st := range sts { - edges[i] = &models.CustomerEdge{Node: st} - } - return &models.CustomerConnection{Edges: edges}, nil + ctx context.Context, + after *ent.Cursor, first *int, + before *ent.Cursor, last *int, +) (*ent.CustomerConnection, error) { + return r.ClientFrom(ctx).Customer.Query(). + Paginate(ctx, after, first, before, last) } func (r queryResolver) ActionsRules( @@ -466,8 +443,10 @@ func (queryResolver) LatestPythonPackage(context.Context) (*models.LatestPythonP break } } - res := models.LatestPythonPackageResult{LastPythonPackage: &packages[0], LastBreakingPythonPackage: &packages[lastBreakingChange]} - return &res, nil + return &models.LatestPythonPackageResult{ + LastPythonPackage: &packages[0], + LastBreakingPythonPackage: &packages[lastBreakingChange], + }, nil } func (r queryResolver) Vertex(ctx context.Context, id string) (*ent.Node, error) { diff --git a/symphony/graph/graphql/resolver/survey.go b/symphony/graph/graphql/resolver/survey.go index 2f32e10c5b56..a7215cd78a86 100644 --- a/symphony/graph/graphql/resolver/survey.go +++ b/symphony/graph/graphql/resolver/survey.go @@ -13,7 +13,7 @@ import ( type surveyResolver struct{} -func (surveyResolver) CreationTimestamp(ctx context.Context, obj *ent.Survey) (*int, error) { +func (surveyResolver) CreationTimestamp(_ context.Context, obj *ent.Survey) (*int, error) { timestamp := int(obj.CreationTimestamp.Unix()) if timestamp < 0 { return nil, nil @@ -21,7 +21,7 @@ func (surveyResolver) CreationTimestamp(ctx context.Context, obj *ent.Survey) (* return ×tamp, nil } -func (surveyResolver) CompletionTimestamp(ctx context.Context, obj *ent.Survey) (int, error) { +func (surveyResolver) CompletionTimestamp(_ context.Context, obj *ent.Survey) (int, error) { return int(obj.CompletionTimestamp.Unix()), nil } @@ -40,11 +40,11 @@ func (surveyResolver) SourceFile(ctx context.Context, obj *ent.Survey) (*ent.Fil type surveyCellScanResolver struct{} -func (surveyCellScanResolver) NetworkType(ctx context.Context, obj *ent.SurveyCellScan) (models.CellularNetworkType, error) { +func (surveyCellScanResolver) NetworkType(_ context.Context, obj *ent.SurveyCellScan) (models.CellularNetworkType, error) { return models.CellularNetworkType(obj.NetworkType), nil } -func (surveyCellScanResolver) Timestamp(ctx context.Context, obj *ent.SurveyCellScan) (*int, error) { +func (surveyCellScanResolver) Timestamp(_ context.Context, obj *ent.SurveyCellScan) (*int, error) { timestamp := int(obj.Timestamp.Unix()) if timestamp < 0 { return nil, nil @@ -54,6 +54,6 @@ func (surveyCellScanResolver) Timestamp(ctx context.Context, obj *ent.SurveyCell type surveyWiFiScanResolver struct{} -func (surveyWiFiScanResolver) Timestamp(ctx context.Context, obj *ent.SurveyWiFiScan) (int, error) { +func (surveyWiFiScanResolver) Timestamp(_ context.Context, obj *ent.SurveyWiFiScan) (int, error) { return int(obj.Timestamp.Unix()), nil } diff --git a/symphony/graph/graphql/resolver/survey_test.go b/symphony/graph/graphql/resolver/survey_test.go index 700310cf17ef..82f675413b1a 100644 --- a/symphony/graph/graphql/resolver/survey_test.go +++ b/symphony/graph/graphql/resolver/survey_test.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// nolint: goconst package resolver import ( @@ -86,7 +85,7 @@ func TestAddRemoveSurvey(t *testing.T) { }) require.NoError(t, err) - surveys, err := qr.Surveys(ctx, nil, nil, nil, nil) + surveys, err := qr.Surveys(ctx) require.NoError(t, err) require.Len(t, surveys, 1, "Verifying 'Surveys' return value") fetchedSurvey := surveys[0] @@ -134,7 +133,7 @@ func TestAddRemoveSurvey(t *testing.T) { _, err = mr.RemoveSiteSurvey(ctx, fetchedSurvey.ID) require.NoError(t, err) - surveys, err = qr.Surveys(ctx, nil, nil, nil, nil) + surveys, err = qr.Surveys(ctx) require.NoError(t, err) require.Len(t, surveys, 0, "Verifying 'Surveys' return value") diff --git a/symphony/graph/graphql/schema/symphony.graphql b/symphony/graph/graphql/schema/symphony.graphql index 969b7982d698..6b4060fe4e46 100644 --- a/symphony/graph/graphql/schema/symphony.graphql +++ b/symphony/graph/graphql/schema/symphony.graphql @@ -20,8 +20,14 @@ type Viewer email: String! @goField(name: "user") } +""" +An object with an ID +""" interface Node @goModel(model: "github.com/facebookincubator/symphony/graph/ent.Noder") { + """ + The id of the object. + """ id: ID! } @@ -413,87 +419,171 @@ type SearchEntry { type: String! } -# search entries connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of search entries. +""" type SearchEntriesConnection { - edges: [SearchEntryEdge] - pageInfo: PageInfo + """ + A list of search entry edges. + """ + edges: [SearchEntryEdge!] + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# search entry edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A search entry edge in a connection. +""" type SearchEntryEdge { + """ + The search entry at the end of the edge. + """ node: SearchEntry + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment port type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment port types. +""" type EquipmentPortTypeConnection { - edges: [EquipmentPortTypeEdge] - pageInfo: PageInfo + """ + A list of equipment port type edges. + """ + edges: [EquipmentPortTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment port type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment port type edge in a connection. +""" type EquipmentPortTypeEdge { + """ + The equipment port type at the end of the edge. + """ node: EquipmentPortType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment port definition connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment port definitions. +""" type EquipmentPortDefinitionConnection { - edges: [EquipmentPortDefinitionEdge] - pageInfo: PageInfo + """ + A list of equipment port definition edges. + """ + edges: [EquipmentPortDefinitionEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment port definition edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment port definition edge in a connection. +""" type EquipmentPortDefinitionEdge { + """ + The equipment port definition at the end of the edge. + """ node: EquipmentPortDefinition + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# equipment type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of equipment types. +""" type EquipmentTypeConnection { - edges: [EquipmentTypeEdge] - pageInfo: PageInfo + """ + A list of equipment type edges. + """ + edges: [EquipmentTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# equipment type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +An equipment type edge in a connection. +""" type EquipmentTypeEdge { + """ + The equipment type at the end of the edge. + """ node: EquipmentType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# location type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of location types. +""" type LocationTypeConnection { - edges: [LocationTypeEdge] - pageInfo: PageInfo + """ + A list of location type edges. + """ + edges: [LocationTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# location type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A location type edge in a connection. +""" type LocationTypeEdge { + """ + The location type at the end of the edge. + """ node: LocationType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# location connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of locations. +""" type LocationConnection { - edges: [LocationEdge] - pageInfo: PageInfo + """ + A list of location edges. + """ + edges: [LocationEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# location edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A location edge in a connection. +""" type LocationEdge { + """ + The location at the end of the edge. + """ node: Location + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -504,33 +594,58 @@ directive @goModel( models: [String!] ) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION -# connection pagination cursor. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Cursor +""" +Position within a pagination. +""" scalar Cursor - @goModel( - model: "github.com/facebookincubator/symphony/graph/graphql/models.Cursor" - ) -# Information for paginating a connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo +""" +Information about pagination in a connection. +""" type PageInfo { + """ + When paginating forwards, are there more items? + """ hasNextPage: Boolean! + """ + When paginating backwards, are there more items? + """ hasPreviousPage: Boolean! + """ + When paginating forwards, the cursor to continue. + """ startCursor: Cursor + """ + When paginating backwards, the cursor to continue. + """ endCursor: Cursor } -# service type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of service types. +""" type ServiceTypeConnection { - edges: [ServiceTypeEdge] - pageInfo: PageInfo + """ + A list of service type edges. + """ + edges: [ServiceTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# service type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A service type edge in a connection. +""" type ServiceTypeEdge { + """ + The service type at the end of the edge. + """ node: ServiceType + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -803,31 +918,59 @@ type WorkOrder implements Node { checkList: [CheckListItem]! } -# work order type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of work order types. +""" type WorkOrderTypeConnection { - edges: [WorkOrderTypeEdge] - pageInfo: PageInfo + """ + A list of work order type edges. + """ + edges: [WorkOrderTypeEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# work order type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A work order type edge in a connection. +""" type WorkOrderTypeEdge { + """ + The work order type at the end of the edge. + """ node: WorkOrderType + """ + A cursor for use in pagination. + """ cursor: Cursor! } -# work order connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of work orders. +""" type WorkOrderConnection { - edges: [WorkOrderEdge] - pageInfo: PageInfo + """ + A list of work order edges. + """ + edges: [WorkOrderEdge!]! + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! } -# work order edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A work order edge in a connection. +""" type WorkOrderEdge { + """ + The work order at the end of the edge. + """ node: WorkOrder + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -880,17 +1023,31 @@ directive @goField( name: String ) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION -# project type connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of project types. +""" type ProjectTypeConnection { - edges: [ProjectTypeEdge!] + """ + A list of project type edges. + """ + edges: [ProjectTypeEdge!]! + """ + Information to aid in pagination. + """ pageInfo: PageInfo! } -# project type edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A project type edge in a connection. +""" type ProjectTypeEdge { + """ + The project type at the end of the edge. + """ node: ProjectType + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -1098,17 +1255,31 @@ input ProjectFilterInput { stringValue: String } -# customer connection. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Connection-Types +""" +A connection to a list of customers. +""" type CustomerConnection { - edges: [CustomerEdge!] + """ + A list of customer edges. + """ + edges: [CustomerEdge!]! + """ + Information to aid in pagination. + """ pageInfo: PageInfo! } -# customer edge. -# ref: https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types +""" +A customer edge in a connection. +""" type CustomerEdge { + """ + The customer at the end of the edge. + """ node: Customer + """ + A cursor for use in pagination. + """ cursor: Cursor! } @@ -1607,8 +1778,21 @@ input AddActionsRuleInput { } type Query { + """ + Fetches current viewer. + """ me: Viewer - node(id: ID!): Node + + """ + Fetches an object given its ID. + """ + node( + """ + The ID of an object. + """ + id: ID! + ): Node + location(id: ID!): Location @deprecated(reason: "Use `node` instead") locationType(id: ID!): LocationType @deprecated(reason: "Use `node` instead") locationTypes( @@ -1705,7 +1889,7 @@ type Query { limit: Int = 500 ): ServiceSearchResult! possibleProperties(entityType: PropertyEntity!): [PropertyType!]! - surveys(after: Cursor, first: Int, before: Cursor, last: Int): [Survey]! + surveys: [Survey!]! findLocationWithDuplicateProperties( locationTypeId: ID! propertyName: String! diff --git a/symphony/graph/resolverutil/resolvers.go b/symphony/graph/resolverutil/resolvers.go index e5c2764fd32a..e340b69b394d 100644 --- a/symphony/graph/resolverutil/resolvers.go +++ b/symphony/graph/resolverutil/resolvers.go @@ -15,58 +15,6 @@ import ( "github.com/pkg/errors" ) -// LocationTypes is a helper to bring location types -func LocationTypes(ctx context.Context, client *ent.Client) (*models.LocationTypeConnection, error) { - lts, err := client.LocationType.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying location types") - } - edges := make([]*models.LocationTypeEdge, len(lts)) - for i, lt := range lts { - edges[i] = &models.LocationTypeEdge{Node: lt} - } - return &models.LocationTypeConnection{Edges: edges}, err -} - -// EquipmentTypes is a helper to bring equipment types -func EquipmentTypes(ctx context.Context, client *ent.Client) (*models.EquipmentTypeConnection, error) { - ets, err := client.EquipmentType.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying equipment types") - } - edges := make([]*models.EquipmentTypeEdge, len(ets)) - for i, et := range ets { - edges[i] = &models.EquipmentTypeEdge{Node: et} - } - return &models.EquipmentTypeConnection{Edges: edges}, err -} - -// ServiceTypes is a helper to bring service types -func ServiceTypes(ctx context.Context, client *ent.Client) (*models.ServiceTypeConnection, error) { - sts, err := client.ServiceType.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying service types") - } - edges := make([]*models.ServiceTypeEdge, len(sts)) - for i, et := range sts { - edges[i] = &models.ServiceTypeEdge{Node: et} - } - return &models.ServiceTypeConnection{Edges: edges}, err -} - -// EquipmentPortTypes is a helper to bring equipment port types -func EquipmentPortTypes(ctx context.Context, client *ent.Client) (*models.EquipmentPortTypeConnection, error) { - ets, err := client.EquipmentPortType.Query().All(ctx) - if err != nil { - return nil, errors.Wrap(err, "querying equipment types") - } - edges := make([]*models.EquipmentPortTypeEdge, len(ets)) - for i, et := range ets { - edges[i] = &models.EquipmentPortTypeEdge{Node: et} - } - return &models.EquipmentPortTypeConnection{Edges: edges}, err -} - // EquipmentTypes is a helper to bring equipment types func EquipmentSearch(ctx context.Context, client *ent.Client, filters []*models.EquipmentFilterInput, limit *int) (*models.EquipmentSearchResult, error) { var ( @@ -108,11 +56,10 @@ func EquipmentSearch(ctx context.Context, client *ent.Client, filters []*models. return nil, err } } - return &models.EquipmentSearchResult{ Equipment: res, Count: c, - }, err + }, nil } // nolint: dupl @@ -153,15 +100,13 @@ func PortSearch(ctx context.Context, client *ent.Client, filters []*models.PortF query.Limit(*limit) } ports, err := query.All(ctx) - if err != nil { return nil, errors.Wrapf(err, "Querying links failed") } - return &models.PortSearchResult{ Ports: ports, Count: count, - }, err + }, nil } // nolint: dupl @@ -194,15 +139,13 @@ func LocationSearch(ctx context.Context, client *ent.Client, filters []*models.L query.Limit(*limit) } locs, err := query.All(ctx) - if err != nil { return nil, errors.Wrapf(err, "Querying locations failed") } - return &models.LocationSearchResult{ Locations: locs, Count: count, - }, err + }, nil } // nolint: dupl @@ -244,11 +187,9 @@ func LinkSearch(ctx context.Context, client *ent.Client, filters []*models.LinkF query.Limit(*limit) } links, err := query.All(ctx) - if err != nil { return nil, errors.Wrapf(err, "Querying links failed") } - return &models.LinkSearchResult{ Links: links, Count: count, @@ -290,12 +231,11 @@ func ServiceSearch(ctx context.Context, client *ent.Client, filters []*models.Se query.Limit(*limit) } services, err := query.All(ctx) - if err != nil { return nil, errors.Wrapf(err, "Querying services failed") } return &models.ServiceSearchResult{ Services: services, Count: count, - }, err + }, nil } From 84c080b4b84f59c45e2a3c5b4e5a415c9da716a4 Mon Sep 17 00:00:00 2001 From: Amit Arbel Date: Thu, 16 Jan 2020 04:44:57 -0800 Subject: [PATCH 07/26] Fixing locations tree scrolling Reviewed By: dlvhdr Differential Revision: D19427672 fbshipit-source-id: 412accd8dfaf6cbb8196566f44def7711ac0809a --- .../inventory/app/components/InventoryTreeView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/InventoryTreeView.js b/symphony/app/fbcnms-projects/inventory/app/components/InventoryTreeView.js index 0fae08640ec8..24d38ac30463 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/InventoryTreeView.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/InventoryTreeView.js @@ -27,16 +27,16 @@ const useStyles = makeStyles(theme => ({ display: 'flex', flexGrow: 1, flexDirection: 'column', - overflowY: 'auto', + overflow: 'hidden', height: '100%', }, treeContainer: { backgroundColor: theme.palette.common.white, display: 'flex', flexDirection: 'column', + flexBasis: 0, flexGrow: 1, - marginBottom: '10px', - height: '100%', + overflowY: 'auto', }, headerRoot: { display: 'flex', From 1d4a6290ecffbd04f281c089cc617700ad47456b Mon Sep 17 00:00:00 2001 From: Ido Shveki Date: Thu, 16 Jan 2020 05:42:16 -0800 Subject: [PATCH 08/26] adding spaces Summary: Pull Request resolved: https://github.com/facebookincubator/symphony/pull/221 Reviewed By: dlvhdr Differential Revision: D19427660 fbshipit-source-id: 8db5af7582a5ea8036abb6da0ab6bb668a2c2bf2 --- .../inventory/app/components/CSVFileUpload.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js b/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js index 16b78b4a160d..2d4fff190c60 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js @@ -107,12 +107,13 @@ class CSVFileUpload extends React.Component { if (responseData.messageCode == SUCCESS_RESPONSE) { const entity = this.props.entity ? this.props.entity : ''; msg = fbt( - 'Successfully uploaded' + + 'Successfully uploaded ' + fbt.param('number of saved lines', responseData.successLines) + ' of ' + fbt.param('number of all lines', responseData.allLines) + + ' ' + fbt.param('type that was saved', entity) + - 'items', + ' items', 'message for a successful import', ); } From 64899a986f43d94cc0cf6a3ec4b40edd38d2f201 Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Thu, 16 Jan 2020 07:51:42 -0800 Subject: [PATCH 09/26] Fix connect ports wizard bug Summary: See task Reviewed By: alexsn Differential Revision: D19428251 fbshipit-source-id: 5d1cdb5f748424525e66a596ac00ac7077341e68 --- .../EquipmentComparisonViewQueryRenderer.js | 57 ++++++++----------- .../EquipmentPowerSearchBar.js | 16 +----- .../components/comparison_view/FilterUtils.js | 6 +- .../comparison_view/LinksPowerSearchBar.js | 14 +---- .../LocationsPowerSearchBar.js | 16 ++---- .../comparison_view/PortsPowerSearchBar.js | 13 +---- .../comparison_view/hooks/propertiesHook.js | 16 +++++- .../services/ServiceComparisonView.js | 8 +-- 8 files changed, 58 insertions(+), 88 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/EquipmentComparisonViewQueryRenderer.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/EquipmentComparisonViewQueryRenderer.js index fb0b46f0cf26..62d755460cb6 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/EquipmentComparisonViewQueryRenderer.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/EquipmentComparisonViewQueryRenderer.js @@ -26,11 +26,7 @@ import useLocationTypes from './hooks/locationTypesHook'; import usePropertyFilters from './hooks/propertiesHook'; import {EquipmentCriteriaConfig} from './EquipmentSearchConfig'; import {LogEvents, ServerLogger} from '../../common/LoggingUtils'; -import { - buildPropertyFilterConfigs, - getPossibleProperties, - getSelectedFilter, -} from './FilterUtils'; +import {buildPropertyFilterConfigs, getSelectedFilter} from './FilterUtils'; import {graphql} from 'relay-runtime'; import {makeStyles} from '@material-ui/styles'; import {useContext, useMemo, useState} from 'react'; @@ -95,11 +91,7 @@ const EquipmentComparisonViewQueryRenderer = (props: Props) => { const {limit, showExport, children} = props; const [count, setCount] = useState((0: number)); - const equipmentDataResponse = usePropertyFilters('equipment'); - - const possibleProperties = getPossibleProperties( - equipmentDataResponse.response, - ); + const possibleProperties = usePropertyFilters('equipment'); const equipmentPropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); @@ -130,29 +122,28 @@ const EquipmentComparisonViewQueryRenderer = (props: Props) => { return (
- {equipmentPropertiesFilterConfigs != null && - locationTypesFilterConfigs != null && ( - - getSelectedFilter(filterConfig, possibleProperties) - } - placeholder="Filter equipment" - searchConfig={EquipmentCriteriaConfig} - filterConfigs={filterConfigs} - footer={ - count != null - ? limit != null && count > limit - ? `1 to ${limit} of ${count}` - : `1 to ${count}` - : null - } - /> - )} + {possibleProperties != null && locationTypesFilterConfigs != null && ( + + getSelectedFilter(filterConfig, possibleProperties) + } + placeholder="Filter equipment" + searchConfig={EquipmentCriteriaConfig} + filterConfigs={filterConfigs} + footer={ + count != null + ? limit != null && count > limit + ? `1 to ${limit} of ${count}` + : `1 to ${count}` + : null + } + /> + )}
{ const {onFiltersChanged, filters, footer} = props; - const equipmentDataResponse = usePropertyFilters('equipment'); - - const possibleProperties = getPossibleProperties( - equipmentDataResponse.response, - ); - + const possibleProperties = usePropertyFilters('equipment'); const equipmentPropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); @@ -61,7 +51,7 @@ const EquipmentPowerSearchBar = (props: Props) => { onFilterRemoved={handleFilterRemoved} onFilterBlurred={handleFilterBlurred} getSelectedFilter={(filterConfig: FilterConfig) => - getSelectedFilter(filterConfig, possibleProperties) + getSelectedFilter(filterConfig, possibleProperties ?? []) } placeholder="Filter..." searchConfig={EquipmentCriteriaConfig} diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/FilterUtils.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/FilterUtils.js index d4b1785712da..f0a500a959d1 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/FilterUtils.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/FilterUtils.js @@ -138,8 +138,12 @@ export function getLocationTypes( } export const buildPropertyFilterConfigs = ( - definitions: Array, + definitions: ?Array, ): Array => { + if (definitions == null) { + return []; + } + return definitions .filter( d => diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LinksPowerSearchBar.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LinksPowerSearchBar.js index 485481c2a40b..ad6645a87b12 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LinksPowerSearchBar.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LinksPowerSearchBar.js @@ -21,11 +21,7 @@ import useLocationTypes from './hooks/locationTypesHook'; import usePropertyFilters from './hooks/propertiesHook'; import {LinkCriteriaConfig} from './LinkSearchConfig'; import {LogEvents, ServerLogger} from '../../common/LoggingUtils'; -import { - buildPropertyFilterConfigs, - getPossibleProperties, - getSelectedFilter, -} from './FilterUtils'; +import {buildPropertyFilterConfigs, getSelectedFilter} from './FilterUtils'; type Props = { filters: FiltersQuery, @@ -38,12 +34,8 @@ const LinksPowerSearchBar = (props: Props) => { const {isFeatureEnabled} = useContext(AppContext); const linkStatusEnabled = isFeatureEnabled('planned_equipment'); const locationTypesFilterConfigs = useLocationTypes(); - const linkPropertyResponse = usePropertyFilters('link'); - - const possibleProperties = getPossibleProperties( - linkPropertyResponse.response, - ); + const possibleProperties = usePropertyFilters('link'); const linkPropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); @@ -62,7 +54,7 @@ const LinksPowerSearchBar = (props: Props) => { onFilterRemoved={handleFilterRemoved} onFilterBlurred={handleFilterBlurred} getSelectedFilter={(filterConfig: FilterConfig) => - getSelectedFilter(filterConfig, possibleProperties) + getSelectedFilter(filterConfig, possibleProperties ?? []) } placeholder="Filter..." searchConfig={LinkCriteriaConfig} diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LocationsPowerSearchBar.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LocationsPowerSearchBar.js index f4e3f5b602ea..67a835bdef16 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LocationsPowerSearchBar.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/LocationsPowerSearchBar.js @@ -16,16 +16,11 @@ import type { import PowerSearchBar from '../power_search/PowerSearchBar'; import React from 'react'; - import useLocationTypes from './hooks/locationTypesHook'; import usePropertyFilters from './hooks/propertiesHook'; import {LocationCriteriaConfig} from './LocationSearchConfig'; import {LogEvents, ServerLogger} from '../../common/LoggingUtils'; -import { - buildPropertyFilterConfigs, - getPossibleProperties, - getSelectedFilter, -} from './FilterUtils'; +import {buildPropertyFilterConfigs, getSelectedFilter} from './FilterUtils'; type Props = { filters: FiltersQuery, @@ -36,15 +31,12 @@ type Props = { const LocationsPowerSearchBar = (props: Props) => { const {onFiltersChanged, filters, footer} = props; const locationTypesFilterConfigs = useLocationTypes(); - const locationDataResponse = usePropertyFilters('location'); - - const possibleProperties = getPossibleProperties( - locationDataResponse.response, - ); + const possibleProperties = usePropertyFilters('location'); const locationPropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); + const filterConfigs = LocationCriteriaConfig.map(ent => ent.filters) .reduce((allFilters, currentFilter) => allFilters.concat(currentFilter), []) .concat(locationPropertiesFilterConfigs ?? []) @@ -57,7 +49,7 @@ const LocationsPowerSearchBar = (props: Props) => { onFilterRemoved={handleFilterRemoved} onFilterBlurred={handleFilterBlurred} getSelectedFilter={(filterConfig: FilterConfig) => - getSelectedFilter(filterConfig, possibleProperties) + getSelectedFilter(filterConfig, possibleProperties ?? []) } placeholder="Filter..." searchConfig={LocationCriteriaConfig} diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PortsPowerSearchBar.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PortsPowerSearchBar.js index 58e88c244ca2..0dbac20d0c05 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PortsPowerSearchBar.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/PortsPowerSearchBar.js @@ -16,16 +16,11 @@ import type { import PowerSearchBar from '../power_search/PowerSearchBar'; import React from 'react'; - import useLocationTypes from './hooks/locationTypesHook'; import usePropertyFilters from './hooks/propertiesHook'; import {LogEvents, ServerLogger} from '../../common/LoggingUtils'; import {PortCriteriaConfig} from './PortSearchConfig'; -import { - buildPropertyFilterConfigs, - getPossibleProperties, - getSelectedFilter, -} from './FilterUtils'; +import {buildPropertyFilterConfigs, getSelectedFilter} from './FilterUtils'; type Props = { filters: FiltersQuery, @@ -37,9 +32,7 @@ const PortsPowerSearchBar = (props: Props) => { const {onFiltersChanged, filters, footer} = props; const locationTypesFilterConfigs = useLocationTypes(); - const propertyFilters = usePropertyFilters('port'); - - const possibleProperties = getPossibleProperties(propertyFilters.response); + const possibleProperties = usePropertyFilters('port'); const portPropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); @@ -57,7 +50,7 @@ const PortsPowerSearchBar = (props: Props) => { onFilterRemoved={handleFilterRemoved} onFilterBlurred={handleFilterBlurred} getSelectedFilter={(filterConfig: FilterConfig) => - getSelectedFilter(filterConfig, possibleProperties) + getSelectedFilter(filterConfig, possibleProperties ?? []) } placeholder="Filter..." searchConfig={PortCriteriaConfig} diff --git a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/hooks/propertiesHook.js b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/hooks/propertiesHook.js index 7c9ca32e417f..16995bb1ebb4 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/hooks/propertiesHook.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/comparison_view/hooks/propertiesHook.js @@ -7,9 +7,14 @@ * @flow * @format */ + +import type {PropertyType} from '../../../common/PropertyType'; + import RelayEnvironment from '../../../common/RelayEnvironment'; +import {getPossibleProperties} from '../FilterUtils'; import {graphql} from 'relay-runtime'; import {useGraphQL} from '@fbcnms/ui/hooks'; +import {useMemo} from 'react'; import type {EntityType} from '../ComparisonViewTypes'; const propertiesQuery = graphql` @@ -22,10 +27,17 @@ const propertiesQuery = graphql` } `; -const usePropertyFilters = (entityType: EntityType) => { - return useGraphQL(RelayEnvironment, propertiesQuery, { +const usePropertyFilters = (entityType: EntityType): ?Array => { + const propertiesResponse = useGraphQL(RelayEnvironment, propertiesQuery, { entityType: entityType.toString().toUpperCase(), }); + + return useMemo(() => { + if (propertiesResponse.response === null) { + return null; + } + return getPossibleProperties(propertiesResponse.response); + }, [propertiesResponse.response]); }; export default usePropertyFilters; diff --git a/symphony/app/fbcnms-projects/inventory/app/components/services/ServiceComparisonView.js b/symphony/app/fbcnms-projects/inventory/app/components/services/ServiceComparisonView.js index 49b03b8a1e50..7b9279a46975 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/services/ServiceComparisonView.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/services/ServiceComparisonView.js @@ -26,7 +26,6 @@ import useRouter from '@fbcnms/ui/hooks/useRouter'; import {ServiceSearchConfig} from './ServiceSearchConfig'; import { buildPropertyFilterConfigs, - getPossibleProperties, getSelectedFilter, } from '../comparison_view/FilterUtils'; import {makeStyles} from '@material-ui/styles'; @@ -79,10 +78,7 @@ const ServiceComparisonView = () => { 'service_endpoints', ); - const serviceDataResponse = usePropertyFilters('service'); - const possibleProperties = getPossibleProperties( - serviceDataResponse.response, - ); + const possibleProperties = usePropertyFilters('service'); const servicePropertiesFilterConfigs = buildPropertyFilterConfigs( possibleProperties, ); @@ -122,7 +118,7 @@ const ServiceComparisonView = () => { filterConfigs={filterConfigs} searchConfig={ServiceSearchConfig} getSelectedFilter={(filterConfig: FilterConfig) => - getSelectedFilter(filterConfig, possibleProperties) + getSelectedFilter(filterConfig, possibleProperties ?? []) } onFiltersChanged={filters => setFilters(filters)} filters={filters} From 372db50f69c8347a8f7a802cbe2470dd3897b3d8 Mon Sep 17 00:00:00 2001 From: Amit Arbel Date: Thu, 16 Jan 2020 08:19:48 -0800 Subject: [PATCH 10/26] Fixing Location Search by ExternalID (#223) Summary: Pull Request resolved: https://github.com/facebookincubator/symphony/pull/223 returning locations having externalId containing the query param as well Reviewed By: idoshveki Differential Revision: D19429548 fbshipit-source-id: 929341a146f13901ffe38dfe5bd669d3a4b81ee8 --- symphony/graph/graphql/resolver/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/symphony/graph/graphql/resolver/query.go b/symphony/graph/graphql/resolver/query.go index a3f333373417..063ca745b94f 100644 --- a/symphony/graph/graphql/resolver/query.go +++ b/symphony/graph/graphql/resolver/query.go @@ -214,7 +214,7 @@ func (r queryResolver) SearchForEntity( Where( location.Or( location.NameContainsFold(name), - location.ExternalID(name), + location.ExternalIDContainsFold(name), ), ). Limit(*limit). From 2895be82eaf12c84c9985998f45b81c57b2ab1f5 Mon Sep 17 00:00:00 2001 From: Amit Arbel Date: Thu, 16 Jan 2020 08:22:37 -0800 Subject: [PATCH 11/26] Changing Upload button to use Popover Menu Summary: Improving Look&Feel and using design system Reviewed By: dlvhdr Differential Revision: D19407977 fbshipit-source-id: 96f3e9a5e9a7d162d8212d794673e93b951694a0 --- .../Form/FormValidationContext.js | 4 +- .../design-system/FormField/FormField.js | 2 +- .../design-system/Select/PopoverMenu.js | 29 ++++-- .../components/popover-menu.stories.js | 3 +- .../inventory/app/common/CommonStrings.js | 14 +++ .../app/components/DocumentsAddButton.js | 96 ++++++------------- .../inventory/app/components/FileUpload.js | 2 +- 7 files changed, 71 insertions(+), 79 deletions(-) diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Form/FormValidationContext.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Form/FormValidationContext.js index b5cb8ebaaf32..56d42226c276 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Form/FormValidationContext.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Form/FormValidationContext.js @@ -155,14 +155,14 @@ const FormValidationMaintainer = function() { const errorChecks: Array<(v: FormInputValueValidation) => ?string> = useMemo( () => [ checkOuterErrorMessage, - checkOuterCallback, checkRequired, + checkOuterCallback, checkNumberInRange, ], [ checkOuterErrorMessage, - checkOuterCallback, checkRequired, + checkOuterCallback, checkNumberInRange, ], ); diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/FormField/FormField.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/FormField/FormField.js index 2d2ae8384b45..53648d92c96c 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/FormField/FormField.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/FormField/FormField.js @@ -86,7 +86,7 @@ const FormField = (props: Props) => { {children} {(helpText || (hasError && errorText)) && ( - {nullthrows(hasError ? errorText : helpText)} + {nullthrows((hasError && errorText) || helpText)} )} {!helpText && !hasError && hasSpacer && ( diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Select/PopoverMenu.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Select/PopoverMenu.js index c3e444f55f57..d82d7def921f 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Select/PopoverMenu.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/Select/PopoverMenu.js @@ -8,39 +8,50 @@ * @format */ -import type {ButtonVariant} from '../Button'; +import type {ButtonProps} from '../Button'; import type {OptionProps} from './SelectMenu'; import * as React from 'react'; import BasePopoverTrigger from '../ContexualLayer/BasePopoverTrigger'; import Button from '../Button'; import SelectMenu from './SelectMenu'; +import classNames from 'classnames'; +import emptyFunction from '@fbcnms/util/emptyFunction'; import {makeStyles} from '@material-ui/styles'; const useStyles = makeStyles({ menu: { margin: '8px 0px', }, + menuDockRight: { + position: 'absolute', + right: '0', + }, }); type Props = { className?: string, + menuDockRight?: boolean, children: React.Node, options: Array>, - onChange: (value: TValue) => void | (() => void), - variant?: ButtonVariant, + onChange?: (value: TValue) => void | (() => void), leftIcon?: React$ComponentType, rightIcon?: React$ComponentType, searchable?: boolean, onOptionsFetchRequested?: (searchTerm: string) => void, + ...ButtonProps, }; const PopoverMenu = ({ className, children, - variant = 'text', leftIcon, rightIcon, + menuDockRight, + onChange, + variant, + skin, + disabled, ...selectMenuProps }: Props) => { const classes = useStyles(); @@ -49,8 +60,11 @@ const PopoverMenu = ({ popover={ }> {(onShow, _onHide, contextRef) => ( @@ -58,10 +72,11 @@ const PopoverMenu = ({ onClick={onShow} ref={contextRef} variant={variant} + skin={skin || 'regular'} + disabled={disabled} className={className} leftIcon={leftIcon} - rightIcon={rightIcon} - skin="regular"> + rightIcon={rightIcon}> {children} )} diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/stories/components/popover-menu.stories.js b/symphony/app/fbcnms-packages/fbcnms-ui/stories/components/popover-menu.stories.js index f987df0d2d35..fdfc2d311750 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/stories/components/popover-menu.stories.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/stories/components/popover-menu.stories.js @@ -55,6 +55,7 @@ const PopoverMenuRoot = () => {
{ { Add Filter setOptions( diff --git a/symphony/app/fbcnms-projects/inventory/app/common/CommonStrings.js b/symphony/app/fbcnms-projects/inventory/app/common/CommonStrings.js index 4f8e517fa6e2..acc2781dfcfd 100644 --- a/symphony/app/fbcnms-projects/inventory/app/common/CommonStrings.js +++ b/symphony/app/fbcnms-projects/inventory/app/common/CommonStrings.js @@ -31,6 +31,20 @@ const Strings = { )}`, addButton: `${fbt('Add', 'Text for button that adds an item')}`, }, + documents: { + uploadButton: `${fbt('Upload', 'Upload files button caption')}`, + categories: [ + 'Archivos de Estudios Pre-instalación', + 'Archivos de Contratos', + 'Archivos de TSS', + 'DataFills', + 'ATP', + 'Topología', + 'Archivos Simulación', + 'Reportes de Mantenimiento', + 'Fotos', + ], + }, }; export default Strings; diff --git a/symphony/app/fbcnms-projects/inventory/app/components/DocumentsAddButton.js b/symphony/app/fbcnms-projects/inventory/app/components/DocumentsAddButton.js index ba8e74a0134e..56ed92a99d8e 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/DocumentsAddButton.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/DocumentsAddButton.js @@ -19,13 +19,12 @@ import type {WithSnackbarProps} from 'notistack'; import AddImageMutation from '../mutations/AddImageMutation'; import AppContext from '@fbcnms/ui/context/AppContext'; -import Button from '@material-ui/core/Button'; import CircularProgress from '@material-ui/core/CircularProgress'; import FileUpload from './FileUpload'; -import Menu from '@material-ui/core/Menu'; -import MenuItem from '@material-ui/core/MenuItem'; +import PopoverMenu from '@fbcnms/ui/components/design-system/Select/PopoverMenu'; import React from 'react'; import SnackbarItem from '@fbcnms/ui/components/SnackbarItem'; +import Strings from '../common/CommonStrings'; import {LogEvents, ServerLogger} from '../common/LoggingUtils'; import {withSnackbar} from 'notistack'; @@ -36,7 +35,7 @@ type Props = { type State = { isLoadingDocument: boolean, - anchorEl: ?HTMLElement, + isMenuOpened: boolean, }; const FileTypeEnum = { @@ -44,27 +43,14 @@ const FileTypeEnum = { FILE: 'FILE', }; -// TODO: We should make categories configurable and dynamic. -// we are testing this for now -const categories = [ - 'Archivos de Estudios Pre-instalación', - 'Archivos de Contratos', - 'Archivos de TSS', - 'DataFills', - 'ATP', - 'Topología', - 'Archivos Simulación', - 'Reportes de Mantenimiento', - 'Fotos', -]; - class DocumentsAddButton extends React.Component { static contextType = AppContext; context: AppContextType; + menuButtonRef = React.createRef(); state = { isLoadingDocument: false, - anchorEl: null, + isMenuOpened: false, }; render() { @@ -79,60 +65,38 @@ class DocumentsAddButton extends React.Component { return ; } - if (!categoriesEnabled) { - return ( - - ServerLogger.info(LogEvents.LOCATION_CARD_UPLOAD_FILE_CLICKED) - }> - Upload - - } - onFileUploaded={this.onDocumentUploaded(null)} - onProgress={() => this.setState({isLoadingDocument: true})} - /> - ); - } return ( <> - - - {categories.map(category => ( - {category} - } - onFileUploaded={this.onDocumentUploaded(category)} - onProgress={() => this.setState({isLoadingDocument: true})} - /> - ))} - + {categoriesEnabled && Strings.documents.categories.length ? ( + ({ + label: ( + this.setState({isLoadingDocument: true})} + /> + ), + value: category, + }))}> + {Strings.documents.uploadButton} + + ) : ( + this.setState({isLoadingDocument: true})} + /> + )} ); } - handleClick = event => { - ServerLogger.info(LogEvents.LOCATION_CARD_UPLOAD_FILE_CLICKED); - this.setState({anchorEl: event.currentTarget}); - }; - - handleClose = () => { - this.setState({anchorEl: null}); - }; - onDocumentUploaded = (category: ?string) => (file, key) => { + ServerLogger.info(LogEvents.LOCATION_CARD_UPLOAD_FILE_CLICKED); if (this.props.entityId == null) { return; } diff --git a/symphony/app/fbcnms-projects/inventory/app/components/FileUpload.js b/symphony/app/fbcnms-projects/inventory/app/components/FileUpload.js index 260301aa01a9..53a73dbd0938 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/FileUpload.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/FileUpload.js @@ -25,7 +25,7 @@ const useStyles = makeStyles({ fileButton: { cursor: 'pointer', display: 'flex', - width: 'fit-content', + width: '100%', }, }); From 049448fcf400f95088f55adcf60ff475314fdd25 Mon Sep 17 00:00:00 2001 From: Alex Clavelle Date: Thu, 16 Jan 2020 08:44:31 -0800 Subject: [PATCH 12/26] Labels editor Summary: Configure a rule to add labels to new firing alerts. Implemented in both PrometheusEditor and EventRuleEditor. * add new labels * edit existing labels * remove labels * reset form state * filters out networkID and severity since they are automatic https://pxl.cl/WDXV https://pxl.cl/WDXZ Reviewed By: rckclmbr Differential Revision: D19395065 fbshipit-source-id: 91b72466e63b1e563020fd1209c6f80b79762578 --- .../fbcnms-alarms/components/AlarmAPIType.js | 2 +- .../components/__tests__/hooks-test.js | 42 ++++ .../fbcnms-alarms/components/hooks.js | 12 +- .../components/rules/LabelsEditor.js | 189 ++++++++++++++++++ .../PrometheusEditor/PrometheusEditor.js | 27 ++- .../components/rules/RuleEditorBase.js | 52 +++-- .../rules/__tests__/AddEditRule-test.js | 6 +- .../rules/__tests__/LabelsEditor-test.js | 167 ++++++++++++++++ .../fbcnms-alarms/test/data.js | 12 +- 9 files changed, 474 insertions(+), 35 deletions(-) create mode 100644 symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/LabelsEditor.js create mode 100644 symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/LabelsEditor-test.js diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/AlarmAPIType.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/AlarmAPIType.js index 4595c11e0279..d48c7c853aff 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/AlarmAPIType.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/AlarmAPIType.js @@ -127,7 +127,7 @@ export type AlertConfig = {| expr: string, annotations?: {[string]: string}, for?: string, - labels?: {[string]: string}, + labels?: Labels, rawData?: AlertConfig, _isCustomAlertRule?: boolean, |}; diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/__tests__/hooks-test.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/__tests__/hooks-test.js index 45eb35205b05..ace32fa93afc 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/__tests__/hooks-test.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/__tests__/hooks-test.js @@ -194,6 +194,48 @@ describe('useForm hook', () => { list: [{test: 1}], }); }); + + test('editing a field calls onFormUpdated', () => { + const state = { + text: '', + list: [], + }; + const onFormUpdatedMock = jest.fn(); + const {result} = renderHook(() => + useForm({initialState: state, onFormUpdated: onFormUpdatedMock}), + ); + const textEventHandler = result.current.handleInputChange(val => ({ + text: val, + })); + hooksAct(() => { + textEventHandler({target: {value: 'test text'}}); + }); + expect(onFormUpdatedMock).toHaveBeenCalledWith({ + list: [], + text: 'test text', + }); + }); + + test('calling updateFormState calls onFormUpdated', () => { + const state = { + text: '', + list: [], + }; + const onFormUpdatedMock = jest.fn(); + const {result} = renderHook(() => + useForm({initialState: state, onFormUpdated: onFormUpdatedMock}), + ); + + hooksAct(() => { + result.current.updateFormState({ + text: 'test text', + }); + }); + expect(onFormUpdatedMock).toHaveBeenCalledWith({ + list: [], + text: 'test text', + }); + }); }); function mockRuleInterface( diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js index adef9695d244..dd46948b25ed 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js @@ -110,9 +110,12 @@ export function useForm({ ...update, }; setFormState(nextState); + if (typeof onFormUpdated === 'function') { + onFormUpdated(nextState); + } return nextState; }, - [formState, setFormState], + [formState, onFormUpdated, setFormState], ); /** @@ -168,12 +171,9 @@ export function useForm({ event: SyntheticInputEvent, ) => { const value = event.target.value; - const updated = updateFormState(formUpdate(value)); - if (typeof onFormUpdated === 'function') { - onFormUpdated(updated); - } + updateFormState(formUpdate(value)); }, - [onFormUpdated, updateFormState], + [updateFormState], ); return { diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/LabelsEditor.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/LabelsEditor.js new file mode 100644 index 000000000000..b4fd6045719f --- /dev/null +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/LabelsEditor.js @@ -0,0 +1,189 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + * + * Edit rule labels + */ + +import * as React from 'react'; +import Button from '@material-ui/core/Button'; +import Card from '@material-ui/core/Card'; +import CardContent from '@material-ui/core/CardContent'; +import CardHeader from '@material-ui/core/CardHeader'; +import DeleteIcon from '@material-ui/icons/Delete'; +import Grid from '@material-ui/core/Grid'; +import IconButton from '@material-ui/core/IconButton'; +import SyncIcon from '@material-ui/icons/Sync'; +import TextField from '@material-ui/core/TextField'; +import Tooltip from '@material-ui/core/Tooltip'; +import Typography from '@material-ui/core/Typography'; +import type {Labels} from '../AlarmAPIType'; + +const filteredLabels = new Set(['networkID', 'severity']); + +type Props = { + labels: {[string]: string}, + onChange: (newLabels: Labels) => void, +}; + +export default function LabelsEditor({labels, onChange}: Props) { + const [initialState] = React.useState(labels); + /** + * Use an array instead of an object because editing an object's key is not + * possible in this context without causing weird issues. + */ + const [labelsState, setLabelsState] = React.useState( + convertLabelsToPairs(labels, filteredLabels), + ); + + // use this instead of using setLabelsState directly + const updateLabels = React.useCallback( + (newLabelsState: Array<[string, string]>) => { + setLabelsState(newLabelsState); + const newLabels = convertPairsToLabels(newLabelsState); + onChange(newLabels); + }, + [onChange, setLabelsState], + ); + + // update a single label by index + const updateLabel = React.useCallback( + (index: number, key: string, value: string) => { + const labelsStateCopy = [...labelsState]; + const newLabel = [key, value]; + + if (labelsStateCopy[index]) { + // edit existing label + labelsStateCopy[index] = newLabel; + } else { + console.error(`no label found at index: ${index}`); + } + updateLabels(labelsStateCopy); + }, + [labelsState, updateLabels], + ); + + const handleKeyChange = React.useCallback( + (index: number, newKey: string) => { + updateLabel(index, newKey, labelsState[index][1]); + }, + [labelsState, updateLabel], + ); + + const handleValueChange = React.useCallback( + (index: number, value: string) => { + updateLabel(index, labelsState[index][0], value); + }, + [labelsState, updateLabel], + ); + + const addNewLabel = React.useCallback(() => { + updateLabels(labelsState.concat([['', '']])); + }, [updateLabels, labelsState]); + + const resetLabels = React.useCallback(() => { + updateLabels(convertLabelsToPairs(initialState, filteredLabels)); + }, [updateLabels, initialState]); + + const removeLabel = React.useCallback( + index => { + updateLabels([ + ...labelsState.slice(0, index - 1), + ...labelsState.slice(index + 1, labelsState.length), + ]); + }, + [labelsState, updateLabels], + ); + + return ( + + + + Labels + + + Add labels to the fired alert + + + } + action={ + + + + + + } + /> + + + {labelsState && + labelsState.map(([key, value], index) => ( + + + handleKeyChange(index, e.target.value)} + /> + + + handleValueChange(index, e.target.value)} + /> + + + removeLabel(index)}> + + + + + ))} + + + + + + + + ); +} + +// converts Labels to an array like [[key,value], [key,value]] +function convertLabelsToPairs( + labels: Labels, + filter: Set, +): Array<[string, string]> { + return Object.keys(labels) + .filter(key => !filter.has(key)) + .map(key => [key, labels[key]]); +} + +// converts n array like [[key,value], [key,value]] to Labels +function convertPairsToLabels(pairs: Array<[string, string]>): Labels { + return pairs.reduce((map, [key, val]) => { + if (key && key.trim() !== '') { + map[key] = val; + } + return map; + }, {}); +} diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js index 1e3048f17f87..44a522491048 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js @@ -28,9 +28,10 @@ import {useEnqueueSnackbar} from '@fbcnms/ui/hooks/useSnackbar'; import {useForm} from '../../hooks'; import {useRouter} from '@fbcnms/ui/hooks'; -import type {AlertConfig} from '../../AlarmAPIType'; +import type {AlertConfig, Labels as LabelsMap} from '../../AlarmAPIType'; import type {BinaryComparator} from '../../prometheus/PromQLTypes'; import type {GenericRule, RuleEditorProps} from '../RuleInterface'; +import type {RuleEditorBaseFields} from '../RuleEditorBase'; import type {ThresholdExpression} from './ToggleableExpressionEditor'; type MenuItemProps = {key: string, value: string, children: string}; @@ -67,6 +68,7 @@ type FormState = { timeNumber: number, timeUnit: string, description: string, + labels: LabelsMap, }; export type InputChangeFunc = ( @@ -211,11 +213,16 @@ export default function PrometheusEditor(props: PrometheusEditorProps) { updateFormState({ ruleName: editorBaseState.name, description: editorBaseState.description, + labels: editorBaseState.labels, }); }, [updateFormState], ); + const editorBaseInitialState = React.useMemo(() => toBaseFields(rule), [ + rule, + ]); + const saveAlert = async () => { try { if (!formState) { @@ -268,7 +275,7 @@ export default function PrometheusEditor(props: PrometheusEditorProps) { return ( , +): RuleEditorBaseFields { + return { + name: rule?.name || '', + description: rule?.description || '', + labels: rule?.rawRule?.labels || {}, + }; +} + export type Duration = { hours: number, minutes: number, diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/RuleEditorBase.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/RuleEditorBase.js index 777f93340250..3945946e2e9d 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/RuleEditorBase.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/RuleEditorBase.js @@ -17,6 +17,7 @@ import CardContent from '@material-ui/core/CardContent'; import CardHeader from '@material-ui/core/CardHeader'; import Editor from '../common/Editor'; import Grid from '@material-ui/core/Grid'; +import LabelsEditor from './LabelsEditor'; import RuleContext from './RuleContext'; import SelectReceiver from '../prometheus/Receivers/SelectReceiver'; import SelectRuleType from './SelectRuleType'; @@ -25,11 +26,11 @@ import Typography from '@material-ui/core/Typography'; import {useAlertRuleReceiver, useForm} from '../hooks'; import type {ApiUtil} from '../AlarmsApi'; import type {Props as EditorProps} from '../common/Editor'; -import type {GenericRule} from './RuleInterface'; +import type {Labels} from '../AlarmAPIType'; type Props = EditorProps & { onChange: (form: RuleEditorBaseFields) => void, - rule: ?GenericRule<*>, + initialState: ?RuleEditorBaseFields, apiUtil: ApiUtil, }; @@ -37,24 +38,25 @@ type Props = EditorProps & { export type RuleEditorBaseFields = { name: string, description: string, + labels: Labels, }; export default function RuleEditorBase({ isNew, apiUtil, children, - rule, + initialState, onChange, onSave, ...props }: Props) { const ruleContext = React.useContext(RuleContext); - const {formState, handleInputChange} = useForm({ - initialState: getInitialState(rule), + const {formState, handleInputChange, updateFormState} = useForm({ + initialState: initialState || defaultState(), onFormUpdated: onChange, }); const {receiver, setReceiver, saveReceiver} = useAlertRuleReceiver({ - ruleName: rule?.name || '', + ruleName: formState?.name || '', apiUtil, }); @@ -63,10 +65,19 @@ export default function RuleEditorBase({ await saveReceiver(); }, [saveReceiver, onSave]); + const handleLabelsChange = React.useCallback( + (labels: Labels) => { + updateFormState({ + labels, + }); + }, + [updateFormState], + ); + return ( @@ -150,25 +161,22 @@ export default function RuleEditorBase({ + + + ); } -/** - * map from GenericRule -> RuleEditorBaseFields or provide a default state - */ -function getInitialState(rule: ?GenericRule<*>): RuleEditorBaseFields { - if (rule) { - return { - name: rule.name, - description: rule.description, - }; - } else { - return { - name: '', - description: '', - }; - } +function defaultState(): RuleEditorBaseFields { + return { + name: '', + description: '', + labels: {}, + }; } diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/AddEditRule-test.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/AddEditRule-test.js index 015f97871310..8f57680fb411 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/AddEditRule-test.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/AddEditRule-test.js @@ -15,7 +15,9 @@ import {SymphonyWrapper} from '@fbcnms/test/testHelpers'; import {act, cleanup, fireEvent, render} from '@testing-library/react'; import {mockApiUtil, renderAsync} from '../../../test/testHelpers'; import {mockPrometheusRule} from '../../../test/data'; +import {toBaseFields} from '../PrometheusEditor/PrometheusEditor'; +import type {AlertConfig} from '../../AlarmAPIType'; import type {RuleEditorProps} from '../RuleInterface'; const commonProps = { @@ -240,7 +242,7 @@ describe('Receiver select', () => { }); }); -function MockRuleEditor(props: RuleEditorProps<{}>) { +function MockRuleEditor(props: RuleEditorProps) { const {apiUtil, isNew, rule} = props; return ( ) { onSave={jest.fn()} onExit={jest.fn()} onChange={jest.fn()} - rule={rule}> + initialState={toBaseFields(rule)}> ); diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/LabelsEditor-test.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/LabelsEditor-test.js new file mode 100644 index 000000000000..08763d1700b5 --- /dev/null +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/__tests__/LabelsEditor-test.js @@ -0,0 +1,167 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ +import 'jest-dom/extend-expect'; +import * as React from 'react'; +import LabelsEditor from '../LabelsEditor'; +import {act, cleanup, fireEvent, render} from '@testing-library/react'; + +const commonProps = { + labels: {}, + onChange: jest.fn(), +}; +afterEach(() => { + cleanup(); + jest.resetAllMocks(); +}); + +test('clicking the add button adds new textboxes', () => { + const {getByTestId, queryAllByPlaceholderText} = render( + , + ); + expect(queryAllByPlaceholderText(/name/i).length).toBe(0); + expect(queryAllByPlaceholderText(/value/i).length).toBe(0); + act(() => { + fireEvent.click(getByTestId('add-new-label')); + }); + + expect(queryAllByPlaceholderText(/name/i).length).toBe(1); + expect(queryAllByPlaceholderText(/value/i).length).toBe(1); + act(() => { + fireEvent.click(getByTestId('add-new-label')); + }); + expect(queryAllByPlaceholderText(/name/i).length).toBe(2); + expect(queryAllByPlaceholderText(/value/i).length).toBe(2); +}); + +test('typing into a key field edits the key of a label', () => { + const {getByDisplayValue} = render( + , + ); + + act(() => { + fireEvent.change(getByDisplayValue('testKey1'), { + target: {value: 'testKey1-edited'}, + }); + }); + act(() => { + fireEvent.change(getByDisplayValue('testKey2'), { + target: {value: 'testKey2-edited'}, + }); + }); + expect(commonProps.onChange).toHaveBeenCalledWith({ + 'testKey1-edited': 'testVal1', + 'testKey2-edited': 'testVal2', + }); +}); +test('typing into a value field edits the value of a label', () => { + const {getByDisplayValue} = render( + , + ); + + act(() => { + fireEvent.change(getByDisplayValue('testVal1'), { + target: {value: 'testVal1-edited'}, + }); + }); + act(() => { + fireEvent.change(getByDisplayValue('testVal2'), { + target: {value: 'testVal2-edited'}, + }); + }); + expect(commonProps.onChange).toHaveBeenCalledWith({ + testKey1: 'testVal1-edited', + testKey2: 'testVal2-edited', + }); +}); +test('labels without a key are filtered out', () => { + const {getByTestId, queryAllByPlaceholderText} = render( + , + ); + expect(queryAllByPlaceholderText(/name/i).length).toBe(1); + act(() => { + fireEvent.click(getByTestId('add-new-label')); + }); + expect(commonProps.onChange).toHaveBeenLastCalledWith({ + testKey1: 'testVal1', + }); + act(() => { + fireEvent.click(getByTestId('add-new-label')); + }); + expect(queryAllByPlaceholderText(/name/i).length).toBe(3); + expect(commonProps.onChange).toHaveBeenLastCalledWith({ + testKey1: 'testVal1', + }); +}); +test('clicking the reset button resets the label form to its initial state', () => { + const {getByDisplayValue, getByLabelText, getByTestId} = render( + , + ); + act(() => { + fireEvent.click(getByTestId('add-new-label')); + }); + + act(() => { + fireEvent.change(getByDisplayValue('testKey1'), { + target: {value: 'testKey1-edited'}, + }); + }); + + // ensure state has been changed properly + expect(commonProps.onChange).toHaveBeenLastCalledWith({ + 'testKey1-edited': 'testVal1', + }); + expect(getByDisplayValue('testKey1-edited')).not.toBeNull(); + // reset + act(() => { + fireEvent.click(getByLabelText(/Reset labels/i)); + }); + // ensure state is back to initial state + expect(commonProps.onChange).toHaveBeenLastCalledWith({ + testKey1: 'testVal1', + }); + expect(getByDisplayValue('testKey1')).not.toBeNull(); +}); +test('clicking the remove label button removes a label', () => { + const {getByLabelText, queryByLabelText} = render( + , + ); + act(() => { + fireEvent.click(getByLabelText(/remove label/i)); + }); + expect(queryByLabelText(/name/i)).toBeNull(); + expect(commonProps.onChange).toHaveBeenLastCalledWith({}); +}); diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/test/data.js b/symphony/app/fbcnms-packages/fbcnms-alarms/test/data.js index 4702a66cd8fb..30845340a49e 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/test/data.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/test/data.js @@ -8,9 +8,10 @@ * @format */ +import type {AlertConfig} from '../components/AlarmAPIType'; import type {GenericRule} from '../components/rules/RuleInterface'; -export function mockPrometheusRule(merge?: $Shape>) { +export function mockPrometheusRule(merge?: $Shape>) { return { name: '<>', severity: 'info', @@ -18,7 +19,14 @@ export function mockPrometheusRule(merge?: $Shape>) { expression: 'up == 0', period: '1m', ruleType: 'prometheus', - rawRule: {}, + rawRule: { + alert: '<>', + labels: { + severity: 'info', + }, + expr: 'up == 0', + for: '1m', + }, ...(merge || {}), }; } From 9bda39d3ca2285c75b858ccf2025fbc14135ca3d Mon Sep 17 00:00:00 2001 From: Alex Clavelle Date: Thu, 16 Jan 2020 08:44:31 -0800 Subject: [PATCH 13/26] move EventRuleEditor to useForm hook Summary: title explains it Reviewed By: fannycchen Differential Revision: D19416453 fbshipit-source-id: 4807933b2740ec6068721bde1831009fb8989e2b --- .../app/fbcnms-packages/fbcnms-alarms/components/hooks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js index dd46948b25ed..08063f1f5afc 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/hooks.js @@ -75,10 +75,10 @@ export function useLoadRules({ }; } -type InputChangeFunc = ( - formUpdate: FormUpdate, +type InputChangeFunc = ( + formUpdate: FormUpdate, ) => (event: SyntheticInputEvent) => void; -type FormUpdate = (val: string) => $Shape; +type FormUpdate = (val: TVal) => $Shape; export function useForm({ initialState, @@ -89,7 +89,7 @@ export function useForm({ }): {| formState: TFormState, updateFormState: (update: $Shape) => TFormState, - handleInputChange: InputChangeFunc, + handleInputChange: InputChangeFunc, updateListItem: ( listName: $Keys, idx: number, From 9da32e61f6f2e49203848bf81d6a1534adbeff25 Mon Sep 17 00:00:00 2001 From: Ido Shveki Date: Thu, 16 Jan 2020 09:11:58 -0800 Subject: [PATCH 14/26] Adding pre-flight flow (#207) Summary: Pull Request resolved: https://github.com/facebookincubator/symphony/pull/207 - In addition to "skipLines" (previous diff) I've added the (default and currently only) option to verify uploads before saving - Equipment instances will be saved if all rows (except "skip" ones) pass the verification step only. - All errors are returned to the client, and only the first one is shown at the moment. Next step: - Client: show the client (nicely) "you have 4 lines with errors, these are the errors" with options of : a = Commit the rest (will send the server the same file with "skip_lines" array and verify_before_commit=false) b = abort process. Reviewed By: a8m Differential Revision: D19286398 fbshipit-source-id: a6f8041610e9d8ecd3169d0d819bb0c95c18f0a4 --- .../inventory/app/components/CSVFileUpload.js | 42 ++- symphony/go.sum | 2 + symphony/graph/importer/constants.go | 4 +- symphony/graph/importer/exported_equipment.go | 239 +++++++++++------- symphony/graph/importer/exported_links.go | 2 +- symphony/graph/importer/exported_ports.go | 2 +- symphony/graph/importer/exported_service.go | 2 +- .../graph/importer/import_exported_utils.go | 32 ++- symphony/graph/importer/import_utils.go | 25 +- symphony/graph/resolverutil/mutations.go | 2 + 10 files changed, 235 insertions(+), 117 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js b/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js index 2d4fff190c60..9a0ea56054bd 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/CSVFileUpload.js @@ -31,6 +31,7 @@ const styles = { }; const SUCCESS_RESPONSE = 0; +const ERROR_RESPONSE = 1; type Props = { button: React.Element, @@ -96,6 +97,7 @@ class CSVFileUpload extends React.Component { formData.append(name, file); idx++; }); + formData.append('skip_lines', JSON.stringify([])); try { const response = await axios.post( this.props.uploadPath, @@ -103,21 +105,49 @@ class CSVFileUpload extends React.Component { config, ); let msg = ''; + let errorLines = fbt('', 'empty string'); + + const entity = this.props.entity ? this.props.entity : ''; const responseData = response.data; - if (responseData.messageCode == SUCCESS_RESPONSE) { - const entity = this.props.entity ? this.props.entity : ''; + const summary = responseData.summary; + + if (summary.messageCode == SUCCESS_RESPONSE) { + if (responseData.errors != null) { + const lines = responseData.errors.map(e => '#' + e.line); + errorLines = fbt( + 'Problematic lines are ' + + fbt.param('list of rows', lines.toString()), + 'list of rows', + ); + } msg = fbt( 'Successfully uploaded ' + - fbt.param('number of saved lines', responseData.successLines) + + fbt.param('number of saved lines', summary.successLines) + ' of ' + - fbt.param('number of all lines', responseData.allLines) + + fbt.param('number of all lines', summary.allLines) + ' ' + fbt.param('type that was saved', entity) + - ' items', + ' items. ' + + fbt.param('error lines', errorLines), 'message for a successful import', ); + this.props.onFileUploaded(msg); + } else if ( + summary.messageCode == ERROR_RESPONSE && + responseData.errors != null + ) { + const tmpErrMessage = + 'Row ' + + responseData.errors[0].line + + ': ' + + responseData.errors[0].message; + msg = fbt( + ' Uploaded Failed. ' + + fbt.param('error message from server', tmpErrMessage), + 'message for a failed import', + ); + this.props.onUploadFailed && this.props.onUploadFailed(msg); } - this.props.onFileUploaded(msg); } catch (error) { const message = error.response?.data; this.props.onUploadFailed && this.props.onUploadFailed(message); diff --git a/symphony/go.sum b/symphony/go.sum index 4c29e84965ef..8b106d3e4eb2 100644 --- a/symphony/go.sum +++ b/symphony/go.sum @@ -229,6 +229,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/justinas/nosurf v1.1.0 h1:qqV6FJmnDBJ6F9pOzhZgZitAZWBYonMOXglof7TtdZw= github.com/justinas/nosurf v1.1.0/go.mod h1:ALpWdSbuNGy2lZWtyXdjkYv4edL23oSEgfBT1gPJ5BQ= +github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= +github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= diff --git a/symphony/graph/importer/constants.go b/symphony/graph/importer/constants.go index bcb9ecc0639b..11c2f5b8a06e 100644 --- a/symphony/graph/importer/constants.go +++ b/symphony/graph/importer/constants.go @@ -9,5 +9,7 @@ type ReturnMessageCode int const ( // SuccessfullyUploaded code for successful upload - SuccessfullyUploaded ReturnMessageCode = 0 + SuccessfullyUploaded ReturnMessageCode = iota + // FailedToUpload code for fail in upload + FailedToUpload ) diff --git a/symphony/graph/importer/exported_equipment.go b/symphony/graph/importer/exported_equipment.go index 5f0eedbea8d0..ef4b298d7365 100644 --- a/symphony/graph/importer/exported_equipment.go +++ b/symphony/graph/importer/exported_equipment.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "net/http" + "strconv" "github.com/facebookincubator/symphony/graph/ent" "github.com/facebookincubator/symphony/graph/ent/equipmenttype" @@ -29,27 +30,35 @@ const minimalEquipmentLineLength = 9 func (m *importer) processExportedEquipment(w http.ResponseWriter, r *http.Request) { ctx := r.Context() log := m.log.For(ctx) - var err error nextLineToSkipIndex := -1 client := m.ClientFrom(ctx) log.Debug("Exported Equipment - started") + var ( + err error + affectedRows, numRows int + errs Errors + skipLines []int + verifyBeforeCommit bool + commitRuns []bool + ) if err := r.ParseMultipartForm(maxFormSize); err != nil { log.Warn("parsing multipart form", zap.Error(err)) http.Error(w, "cannot parse form", http.StatusInternalServerError) return } - count, numRows := 0, 0 err = r.ParseForm() if err != nil { errorReturn(w, "can't parse form", log, err) + return } - var skipLines []int - arg := r.FormValue("skip_lines") - if arg != "" { - err = json.Unmarshal([]byte(arg), &skipLines) + + skipLinesParam := r.FormValue("skip_lines") + if skipLinesParam != "" { + err := json.Unmarshal([]byte(skipLinesParam), &skipLines) if err != nil { errorReturn(w, "can't parse skipped lines", log, err) + return } } @@ -57,8 +66,22 @@ func (m *importer) processExportedEquipment(w http.ResponseWriter, r *http.Reque skipLines = sortSlice(skipLines, true) nextLineToSkipIndex = 0 } + commitParam := r.FormValue("verify_before_commit") + if commitParam != "" { + err := json.Unmarshal([]byte(commitParam), &verifyBeforeCommit) + if err != nil { + errorReturn(w, "can't parse run validations argument", log, err) + return + } + } + + if verifyBeforeCommit { + commitRuns = []bool{false, true} + } else { + commitRuns = []bool{true} + } for fileName := range r.MultipartForm.File { - first, reader, err := m.newReader(fileName, r) + first, _, err := m.newReader(fileName, r) importHeader := NewImportHeader(first, ImportEntityEquipment) if err != nil { errorReturn(w, fmt.Sprintf("cannot handle file: %q", fileName), log, err) @@ -84,116 +107,148 @@ func (m *importer) processExportedEquipment(w http.ResponseWriter, r *http.Reque return } ic := getImportContext(ctx) - for { - untrimmedLine, err := reader.Read() - if err != nil { - if err == io.EOF { - break - } - log.Warn("cannot read row", zap.Error(err)) - continue - } - numRows++ - if shouldSkipLine(skipLines, numRows, nextLineToSkipIndex) { - log.Warn("skipping line", zap.Error(err), zap.Int("line_number", numRows)) - nextLineToSkipIndex++ - continue + + for _, commit := range commitRuns { + // if we encounter errors on the "verifyBefore" flow - don't run the commit=true phase + if commit && verifyBeforeCommit && len(errs) != 0 { + break } - importLine := NewImportRecord(m.trimLine(untrimmedLine), importHeader) - name := importLine.Name() - equipTypName := importLine.TypeName() - equipType, err := client.EquipmentType.Query().Where(equipmenttype.Name(equipTypName)).Only(ctx) + numRows, affectedRows = 0, 0 + _, reader, err := m.newReader(fileName, r) if err != nil { - errorReturn(w, fmt.Sprintf("couldn't find equipment type %q (row #%d) ", equipTypName, numRows), log, err) + errorReturn(w, fmt.Sprintf("cannot handle file: %q", fileName), log, err) return } - - externalID := importLine.ExternalID() - id := importLine.ID() - if id == "" { - // new equip - parentLoc, err := m.verifyOrCreateLocationHierarchy(ctx, importLine) - if err != nil { - errorReturn(w, fmt.Sprintf("creating location hierarchy (row #%d).", numRows), log, err) - return - } - parentEquipmentID, positionDefinitionID, err := m.getPositionDetailsIfExists(ctx, parentLoc, importLine, true) + for { + untrimmedLine, err := reader.Read() if err != nil { - errorReturn(w, fmt.Sprintf("creating equipment hierarchy (row #%d)", numRows), log, err) - return - } - if parentEquipmentID != nil && positionDefinitionID != nil { - parentLoc = nil - } - var propInputs []*models.PropertyInput - if importLine.Len() > importHeader.PropertyStartIdx() { - propInputs, err = m.validatePropertiesForEquipmentType(ctx, importLine, equipType) - if err != nil { - errorReturn(w, fmt.Sprintf("validating property for type %q (row #%d)", equipType.Name, numRows), log, err) - return + if err == io.EOF { + break } + log.Warn("cannot read row", zap.Error(err)) + continue } - pos, err := resolverutil.GetOrCreatePosition(ctx, m.ClientFrom(ctx), parentEquipmentID, positionDefinitionID, true) - if err != nil { - errorReturn(w, fmt.Sprintf("creating equipment position (row #%d)", numRows), log, err) - return + numRows++ + if shouldSkipLine(skipLines, numRows, nextLineToSkipIndex) { + log.Warn("skipping line", zap.Error(err), zap.Int("line_number", numRows)) + nextLineToSkipIndex++ + continue } - equip, created, err := m.getOrCreateEquipment(ctx, m.r.Mutation(), name, equipType, &externalID, parentLoc, pos, propInputs) - if err != nil { - errorReturn(w, fmt.Sprintf("creating/fetching equipment (row #%d)", numRows), log, err) - return - } - if created { - count++ - log.Warn(fmt.Sprintf("(row #%d) creating equipment", numRows), zap.String("name", equip.Name), zap.String("id", equip.ID)) - } else { - errorReturn(w, "Equipment "+equip.Name+" already exists under location/position", log, nil) - return - } - } else { - // existingEquip - equipment, err := m.validateLineForExistingEquipment(ctx, id, importLine) + + importLine := NewImportRecord(m.trimLine(untrimmedLine), importHeader) + name := importLine.Name() + equipTypName := importLine.TypeName() + equipType, err := client.EquipmentType.Query().Where(equipmenttype.Name(equipTypName)).Only(ctx) if err != nil { - errorReturn(w, fmt.Sprintf("validating existing equipment: id %q (row #%d)", id, numRows), log, nil) - return + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: fmt.Sprintf("couldn't find equipment type %q", equipTypName)}) + continue } - typ := equipment.QueryType().OnlyX(ctx) - props := ic.equipmentTypeIDToProperties[typ.ID] - var inputs []*models.PropertyInput - for _, propName := range props { - inp, err := importLine.GetPropertyInput(m.ClientFrom(ctx), ctx, typ, propName) - propType := typ.QueryPropertyTypes().Where(propertytype.Name(propName)).OnlyX(ctx) + + externalID := importLine.ExternalID() + id := importLine.ID() + if id == "" { + // new equip + parentLoc, err := m.verifyOrCreateLocationHierarchy(ctx, importLine) if err != nil { - errorReturn(w, fmt.Sprintf("getting property input: prop %q (row #%d)", propName, numRows), log, nil) - return + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: "error while creating/verifying equipment hierarchy"}) + continue } - propID, err := equipment.QueryProperties().Where(property.HasTypeWith(propertytype.ID(propType.ID))).OnlyID(ctx) + parentEquipmentID, positionDefinitionID, err := m.getPositionDetailsIfExists(ctx, parentLoc, importLine, true) if err != nil { - if !ent.IsNotFound(err) { - errorReturn(w, fmt.Sprintf("property fetching error: property name %q (row #%d)", propName, numRows), log, nil) - return + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: "error while creating/verifying equipment hierarchy"}) + continue + + } + if parentEquipmentID != nil && positionDefinitionID != nil { + parentLoc = nil + } + var propInputs []*models.PropertyInput + if importLine.Len() > importHeader.PropertyStartIdx() { + propInputs, err = m.validatePropertiesForEquipmentType(ctx, importLine, equipType) + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: fmt.Sprintf("validating property for type %q", equipType.Name)}) + continue } + } + + var pos *ent.EquipmentPosition + var equip *ent.Equipment + var created bool + if commit { + pos, err = resolverutil.GetOrCreatePosition(ctx, m.ClientFrom(ctx), parentEquipmentID, positionDefinitionID, true) } else { - inp.ID = &propID + pos, err = resolverutil.ValidateAndGetPositionIfExists(ctx, client, parentEquipmentID, positionDefinitionID, true) + } + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: "error while creating/fetching equipment position"}) + continue + } + if commit { + _, created, err = m.getOrCreateEquipment(ctx, m.r.Mutation(), name, equipType, &externalID, parentLoc, pos, propInputs) + } else { + equip, err = m.getEquipmentIfExist(ctx, m.r.Mutation(), name, equipType, &externalID, parentLoc, pos, propInputs) + if equip == nil { + // mocking for pre-flight run + created = true + } + } + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: "error while creating/fetching equipment"}) + continue + } + if created { + affectedRows++ + } else { + log.Info("Row " + strconv.FormatInt(int64(numRows), 10) + ": Equipment already exists under location/position") + } + } else { + // existing equip + equipment, err := m.validateLineForExistingEquipment(ctx, id, importLine) + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: "error validating equipment line"}) + continue + } + typ := equipment.QueryType().OnlyX(ctx) + props := ic.equipmentTypeIDToProperties[typ.ID] + var inputs []*models.PropertyInput + for _, propName := range props { + inp, err := importLine.GetPropertyInput(m.ClientFrom(ctx), ctx, typ, propName) + propType := typ.QueryPropertyTypes().Where(propertytype.Name(propName)).OnlyX(ctx) + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: fmt.Sprintf("getting property input: prop %v", propName)}) + continue + } + propID, err := equipment.QueryProperties().Where(property.HasTypeWith(propertytype.ID(propType.ID))).OnlyID(ctx) + if err != nil { + if !ent.IsNotFound(err) { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: fmt.Sprintf("property fetching error: property name %v", propName)}) + continue + } + } else { + inp.ID = &propID + } + inputs = append(inputs, inp) + } + if commit { + affectedRows++ + _, err = m.r.Mutation().EditEquipment(ctx, models.EditEquipmentInput{ID: id, Name: name, Properties: inputs, ExternalID: &externalID}) + if err != nil { + errs = append(errs, ErrorLine{Line: numRows, Error: err.Error(), Message: fmt.Sprintf("editing equipment: id %v", id)}) + continue + } } - inputs = append(inputs, inp) - } - count++ - _, err = m.r.Mutation().EditEquipment(ctx, models.EditEquipmentInput{ID: id, Name: name, Properties: inputs, ExternalID: &externalID}) - if err != nil { - errorReturn(w, fmt.Sprintf("editing equipment: id %q (row #%d)", id, numRows), log, nil) - return } } } } - log.Debug("Exported Equipment - Done") + w.WriteHeader(http.StatusOK) - err = writeSuccessMessage(w, count, numRows) + err = writeSuccessMessage(w, affectedRows, numRows, errs, !verifyBeforeCommit || len(errs) == 0) if err != nil { errorReturn(w, "cannot marshal message", log, err) return } + log.Debug("Exported Equipment - Done", zap.Any("errors list", errs), zap.Int("all_lines", numRows), zap.Int("edited_added_rows", affectedRows)) } func (m *importer) validateLineForExistingEquipment(ctx context.Context, equipID string, importLine ImportRecord) (*ent.Equipment, error) { diff --git a/symphony/graph/importer/exported_links.go b/symphony/graph/importer/exported_links.go index aa54493a9cbb..1f466f52c3ae 100644 --- a/symphony/graph/importer/exported_links.go +++ b/symphony/graph/importer/exported_links.go @@ -198,7 +198,7 @@ func (m *importer) processExportedLinks(w http.ResponseWriter, r *http.Request) log.Debug("Exported links - Done") w.WriteHeader(http.StatusOK) - err := writeSuccessMessage(w, modifiedCount, numRows) + err := writeSuccessMessage(w, modifiedCount, numRows, nil, true) if err != nil { errorReturn(w, "cannot marshal message", log, err) return diff --git a/symphony/graph/importer/exported_ports.go b/symphony/graph/importer/exported_ports.go index 844f476efb40..99c97632e26c 100644 --- a/symphony/graph/importer/exported_ports.go +++ b/symphony/graph/importer/exported_ports.go @@ -130,7 +130,7 @@ func (m *importer) processExportedPorts(w http.ResponseWriter, r *http.Request) } log.Debug("Exported ports - Done") w.WriteHeader(http.StatusOK) - err := writeSuccessMessage(w, count, numRows) + err := writeSuccessMessage(w, count, numRows, nil, true) if err != nil { errorReturn(w, "cannot marshal message", log, err) return diff --git a/symphony/graph/importer/exported_service.go b/symphony/graph/importer/exported_service.go index ab70e1b90aa8..369093d650b0 100644 --- a/symphony/graph/importer/exported_service.go +++ b/symphony/graph/importer/exported_service.go @@ -158,7 +158,7 @@ func (m *importer) processExportedService(w http.ResponseWriter, r *http.Request } log.Debug("Exported Service - Done") w.WriteHeader(http.StatusOK) - err := writeSuccessMessage(w, count, numRows) + err := writeSuccessMessage(w, count, numRows, nil, true) if err != nil { errorReturn(w, "cannot marshal message", log, err) return diff --git a/symphony/graph/importer/import_exported_utils.go b/symphony/graph/importer/import_exported_utils.go index f99f189904aa..5704f918215c 100644 --- a/symphony/graph/importer/import_exported_utils.go +++ b/symphony/graph/importer/import_exported_utils.go @@ -45,12 +45,24 @@ type SuccessMessage struct { AllLines int `json:"allLines"` } -func writeSuccessMessage(w http.ResponseWriter, success, all int) error { +type ReturnMessage struct { + Summary SuccessMessage `json:"summary"` + Errors Errors `json:"errors"` +} + +func writeSuccessMessage(w http.ResponseWriter, success, all int, errs Errors, isSuccess bool) error { w.Header().Set("Content-Type", "application/json") - msg, err := json.Marshal(SuccessMessage{ - MessageCode: int(SuccessfullyUploaded), - SuccessLines: success, - AllLines: all, + messageCode := int(SuccessfullyUploaded) + if !isSuccess { + messageCode = int(FailedToUpload) + } + msg, err := json.Marshal(ReturnMessage{ + Summary: SuccessMessage{ + MessageCode: messageCode, + SuccessLines: success, + AllLines: all, + }, + Errors: errs, }) if err != nil { return err @@ -59,6 +71,16 @@ func writeSuccessMessage(w http.ResponseWriter, success, all int) error { return nil } +// ErrorLine represents a line which failed to validate +type ErrorLine struct { + Line int `json:"line"` + Error string `json:"error"` + Message string `json:"message"` +} + +// ErrorLine represents a summary of the errors while uploading a CSV file +type Errors []ErrorLine + func shouldSkipLine(a []int, currRow, nextLineToSkipIndex int) bool { if nextLineToSkipIndex >= 0 && nextLineToSkipIndex < len(a) { return currRow == a[nextLineToSkipIndex] diff --git a/symphony/graph/importer/import_utils.go b/symphony/graph/importer/import_utils.go index c1d49cdc1920..e552f5f764f3 100644 --- a/symphony/graph/importer/import_utils.go +++ b/symphony/graph/importer/import_utils.go @@ -6,9 +6,10 @@ package importer import ( "context" - "github.com/AlekSi/pointer" "strconv" + "github.com/AlekSi/pointer" + "github.com/facebookincubator/symphony/graph/ent" "github.com/facebookincubator/symphony/graph/ent/customer" "github.com/facebookincubator/symphony/graph/ent/equipment" @@ -173,7 +174,7 @@ func (m *importer) getOrCreateLocation(ctx context.Context, name string, latitud return l, true } -func (m *importer) getOrCreateEquipment(ctx context.Context, mr generated.MutationResolver, name string, equipType *ent.EquipmentType, externalID *string, loc *ent.Location, position *ent.EquipmentPosition, props []*models.PropertyInput) (*ent.Equipment, bool, error) { +func (m *importer) getEquipmentIfExist(ctx context.Context, mr generated.MutationResolver, name string, equipType *ent.EquipmentType, externalID *string, loc *ent.Location, position *ent.EquipmentPosition, props []*models.PropertyInput) (*ent.Equipment, error) { log := m.log.For(ctx) client := m.ClientFrom(ctx) rq := client.EquipmentType.Query(). @@ -192,20 +193,26 @@ func (m *importer) getOrCreateEquipment(ctx context.Context, mr generated.Mutati } equip, err := rq.First(ctx) if ent.MaskNotFound(err) != nil { - return nil, false, err + return nil, err } if equip != nil { log.Debug("equipment exists", zap.String("name", name), zap.String("type", equipType.ID), ) - return equip, false, nil + return equip, nil } - if !ent.IsNotFound(err) { - panic(err) + return nil, nil +} + +func (m *importer) getOrCreateEquipment(ctx context.Context, mr generated.MutationResolver, name string, equipType *ent.EquipmentType, externalID *string, loc *ent.Location, position *ent.EquipmentPosition, props []*models.PropertyInput) (*ent.Equipment, bool, error) { + log := m.log.For(ctx) + eq, err := m.getEquipmentIfExist(ctx, mr, name, equipType, externalID, loc, position, props) + if err != nil || eq != nil { + return eq, false, err } - var locID *string + var locID *string if loc != nil { locID = &loc.ID } @@ -217,8 +224,7 @@ func (m *importer) getOrCreateEquipment(ctx context.Context, mr generated.Mutati parentEquipmentID = &p positionDefinitionID = &d } - - equip, err = mr.AddEquipment(ctx, models.AddEquipmentInput{ + equip, err := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: name, Type: equipType.ID, Location: locID, @@ -232,7 +238,6 @@ func (m *importer) getOrCreateEquipment(ctx context.Context, mr generated.Mutati return nil, false, err } log.Debug("Creating new equipment", zap.String("equip.Name", equip.Name), zap.String("equip.ID", equip.ID)) - return equip, true, nil } diff --git a/symphony/graph/resolverutil/mutations.go b/symphony/graph/resolverutil/mutations.go index 91e4a41c7468..10c99f1ed39d 100644 --- a/symphony/graph/resolverutil/mutations.go +++ b/symphony/graph/resolverutil/mutations.go @@ -28,9 +28,11 @@ func ValidateAndGetPositionIfExists(ctx context.Context, client *ent.Client, par equipmentpositiondefinition.ID(*positionDefinitionID), )). Only(ctx) + if err != nil && !ent.IsNotFound(err) { return nil, errors.Wrapf(err, "querying equipment: definition=%q, parent=%q", *positionDefinitionID, *parentEquipmentID) } + if ep != nil { if mustBeEmpty { hasAttachment, err := ep.QueryAttachment().Exist(ctx) From d02acafae16c2087e9f3e791197736d7762a1457 Mon Sep 17 00:00:00 2001 From: Amit Arbel Date: Thu, 16 Jan 2020 09:17:16 -0800 Subject: [PATCH 15/26] Improving PropertyType duplicate name enfocement Summary: Trimming name on blur Reviewed By: dlvhdr Differential Revision: D19428460 fbshipit-source-id: 9ce392038fd37ee9857edacbaf729d0e90704fe3 --- .../app/components/form/PropertyTypeTable.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/form/PropertyTypeTable.js b/symphony/app/fbcnms-projects/inventory/app/components/form/PropertyTypeTable.js index a7ab5930ca54..a69df281da2a 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/form/PropertyTypeTable.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/form/PropertyTypeTable.js @@ -148,6 +148,7 @@ class PropertyTypeTable extends React.Component { className={classes.input} value={property.name} onChange={this._handleChange('name', i)} + onBlur={() => this._handleNameBlur(i)} margin="dense" /> @@ -264,6 +265,23 @@ class PropertyTypeTable extends React.Component { ); }; + _handleNameBlur = index => { + const name = this.props.propertyTypes[index]?.name; + const trimmedName = name && name.trim(); + if (name === trimmedName) { + return; + } + + this.props.onPropertiesChanged( + updateItem( + this.props.propertyTypes, + index, + 'name', + trimmedName, + ), + ); + }; + _handleChecked = index => event => { this.props.onPropertiesChanged( updateItem( From f184d404f5e5032ed22e2f26a2a962b0063393bb Mon Sep 17 00:00:00 2001 From: rsarwad Date: Thu, 16 Jan 2020 11:30:36 -0800 Subject: [PATCH 16/26] Lockless changes for CSFB procedure, MO/MT call and SMS (#1057) Summary: As we merge the MME and NAS tasks into one, this change implements the changes to merge CSFB procedures for MO/MT call and SMS, MM information, Non EPS Alert and UE activity Indication. Type: Refactor Pull Request resolved: https://github.com/facebookincubator/magma/pull/1057 Test Plan: Executed s1ap tester test suite Reviewed By: ulaskozat Differential Revision: D19412128 Pulled By: ssanadhya fbshipit-source-id: 13300b1a6ffbd8a067a76ccb4b7181f09ef08030 --- lte/gateway/c/oai/include/nas_messages_def.h | 15 - .../c/oai/include/nas_messages_types.h | 36 -- .../c/oai/tasks/mme_app/mme_app_bearer.c | 201 +++++++---- .../c/oai/tasks/mme_app/mme_app_defs.h | 13 +- .../tasks/mme_app/mme_app_itti_messaging.c | 259 +++++++++++++- .../tasks/mme_app/mme_app_itti_messaging.h | 17 + .../c/oai/tasks/mme_app/mme_app_main.c | 34 +- .../c/oai/tasks/mme_app/mme_app_sgs_paging.c | 333 ++++++++---------- .../c/oai/tasks/mme_app/mme_app_sgsap.c | 53 +-- lte/gateway/c/oai/tasks/nas/emm/Attach.c | 4 +- .../c/oai/tasks/nas/emm/NasTransportHdl.c | 8 +- .../c/oai/tasks/nas/emm/ServiceRequestHdl.c | 16 +- .../c/oai/tasks/nas/emm/TrackingAreaUpdate.c | 2 +- lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c | 17 +- .../c/oai/tasks/nas/emm/sap/emm_recv.c | 4 +- .../c/oai/tasks/nas/nas_itti_messaging.c | 152 -------- .../c/oai/tasks/nas/nas_itti_messaging.h | 26 -- lte/gateway/c/oai/tasks/nas/nas_mme_task.c | 32 -- lte/gateway/c/oai/tasks/nas/nas_proc.c | 90 +---- lte/gateway/c/oai/tasks/nas/nas_proc.h | 6 +- .../c/oai/tasks/sgs/sgs_service_handler.c | 6 +- 21 files changed, 627 insertions(+), 697 deletions(-) diff --git a/lte/gateway/c/oai/include/nas_messages_def.h b/lte/gateway/c/oai/include/nas_messages_def.h index 6ddbdf83c71d..56f825b62cb6 100644 --- a/lte/gateway/c/oai/include/nas_messages_def.h +++ b/lte/gateway/c/oai/include/nas_messages_def.h @@ -43,18 +43,3 @@ MESSAGE_DEF( MESSAGE_PRIORITY_MED, itti_nas_auth_param_req_t, nas_auth_param_req) -MESSAGE_DEF( - NAS_EXTENDED_SERVICE_REQ, - MESSAGE_PRIORITY_MED, - itti_nas_extended_service_req_t, - nas_extended_service_req) -MESSAGE_DEF( - NAS_CS_SERVICE_NOTIFICATION, - MESSAGE_PRIORITY_MED, - itti_nas_cs_service_notification_t, - nas_cs_service_notification) -MESSAGE_DEF( - NAS_NOTIFY_SERVICE_REJECT, - MESSAGE_PRIORITY_MED, - itti_nas_notify_service_reject_t, - nas_notify_service_reject) diff --git a/lte/gateway/c/oai/include/nas_messages_types.h b/lte/gateway/c/oai/include/nas_messages_types.h index 7247f86e1f9e..e94025bfbf05 100644 --- a/lte/gateway/c/oai/include/nas_messages_types.h +++ b/lte/gateway/c/oai/include/nas_messages_types.h @@ -49,22 +49,7 @@ #define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req #define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) \ (mSGpTR)->ittiMsg.nas_auth_param_req -#define NAS_CS_SERVICE_NOTIFICATION(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_cs_service_notification #define NAS_DATA_LENGHT_MAX 256 -#define NAS_EXTENDED_SERVICE_REQ(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_extended_service_req -#define NAS_NOTIFY_SERVICE_REJECT(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_notify_service_reject - -typedef struct itti_nas_cs_service_notification_s { - mme_ue_s1ap_id_t ue_id; /* UE lower layer identifier */ -#define NAS_PAGING_ID_IMSI 0X00 -#define NAS_PAGING_ID_TMSI 0X01 - uint8_t paging_id; /* Paging UE ID, to be sent in CS Service Notification */ - bstring - cli; /* If CLI received in Sgsap-Paging_Req,shall sent in CS Service Notification */ -} itti_nas_cs_service_notification_t; typedef struct itti_nas_info_transfer_s { mme_ue_s1ap_id_t ue_id; /* UE lower layer identifier */ @@ -111,25 +96,4 @@ typedef struct itti_nas_auth_param_req_s { uint8_t num_vectors; } itti_nas_auth_param_req_t; -typedef struct itti_nas_extended_service_req_s { - /* UE identifier */ - mme_ue_s1ap_id_t ue_id; - uint8_t servType; /* service type */ - /* csfb_response is valid only if service type Mobile Terminating CSFB */ - uint8_t csfb_response; -} itti_nas_extended_service_req_t; - -/* ITTI message used to intimate service reject for ongoing service request procedure - * from mme_app to nas - */ -typedef struct itti_nas_notify_service_reject_s { - mme_ue_s1ap_id_t ue_id; - uint8_t emm_cause; -#define INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED 0x00 -#define UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED 0x01 -#define MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE 0x02 -#define MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE 0x03 - uint8_t failed_procedure; -} itti_nas_notify_service_reject_t; - #endif /* FILE_NAS_MESSAGES_TYPES_SEEN */ diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c index ff661f057dc3..a0935cdebe56 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c @@ -2169,35 +2169,32 @@ void mme_app_handle_suspend_acknowledge(mme_app_desc_t *mme_app_desc_p, } //------------------------------------------------------------------------------ -int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, - itti_nas_extended_service_req_t *const nas_extended_service_req_pP) +int mme_app_handle_nas_extended_service_req( + const mme_ue_s1ap_id_t ue_id, + const uint8_t service_type, + uint8_t csfb_response) { struct ue_mm_context_s *ue_context_p = NULL; + mme_app_desc_t* mme_app_desc_p = NULL; int rc = RETURNok; - mme_ue_s1ap_id_t ue_id = INVALID_MME_UE_S1AP_ID; - Service_Type serviceType = -1; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(nas_extended_service_req_pP); - serviceType = nas_extended_service_req_pP->servType; - ue_id = nas_extended_service_req_pP->ue_id; if (ue_id == INVALID_MME_UE_S1AP_ID) { OAILOG_ERROR( LOG_MME_APP, - "ERROR***** Invalid UE Id received from NAS in Extended Service " - "Request\n"); + "ERROR***** Invalid UE Id received in Extended Service Request \n"); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } + mme_app_desc_p = get_mme_nas_state(false); ue_context_p = - mme_ue_context_exists_mme_ue_s1ap_id(&mme_app_desc_p->mme_ue_contexts, - ue_id); + mme_ue_context_exists_mme_ue_s1ap_id(&mme_app_desc_p->mme_ue_contexts, ue_id); if (ue_context_p) { if (ue_id != ue_context_p->mme_ue_s1ap_id) { OAILOG_ERROR( LOG_MME_APP, "ERROR***** Abnormal case: ue_id does not match with ue_id in " - "ue_context %d, %d\n", + "ue_context" MME_UE_S1AP_ID_FMT "," MME_UE_S1AP_ID_FMT "\n", ue_id, ue_context_p->mme_ue_s1ap_id); unlock_ue_contexts(ue_context_p); @@ -2212,19 +2209,26 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - switch (serviceType) { + switch (service_type) { /* Extended Service request received for CSFB */ case MO_CS_FB1: case MT_CS_FB1: case MO_CS_FB: if (ue_context_p->sgs_context != NULL) { ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_MO_CALL; - /*If call_cancelled is set to TRUE when MO call is triggered. Set call_cancelled to false*/ - if (ue_context_p->sgs_context->call_cancelled == true) { + /* If call_cancelled is set to TRUE when MO call is triggered. + * Set call_cancelled to false + */ + if (ue_context_p->sgs_context->call_cancelled) { ue_context_p->sgs_context->call_cancelled = false; } mme_app_itti_ue_context_mod_for_csfb(ue_context_p); } else { + OAILOG_ERROR( + LOG_MME_APP, + "SGS context is NULL for ue_id:" MME_UE_S1AP_ID_FMT + "So send Service Reject to UE \n", + ue_context_p->mme_ue_s1ap_id); /* send Service Reject to UE */ mme_app_notify_service_reject_to_nas( ue_context_p->mme_ue_s1ap_id, @@ -2233,19 +2237,21 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } break; case MT_CS_FB: - if (nas_extended_service_req_pP->csfb_response == CSFB_REJECTED_BY_UE) { - if (ue_context_p->sgs_context != NULL) { - /*If call_cancelled is set to TRUE and we receive EXT Service Request with csfb_response - *set to call_rejected. Set call_cancelled to false*/ - if (ue_context_p->sgs_context->call_cancelled == true) { + if (csfb_response == CSFB_REJECTED_BY_UE) { + if (ue_context_p->sgs_context) { + /* If call_cancelled is set to TRUE and + * receive EXT Service Request with csfb_response + * set to call_rejected. Set call_cancelled to false + */ + if (ue_context_p->sgs_context->call_cancelled) { ue_context_p->sgs_context->call_cancelled = false; } - if ( - (rc = mme_app_send_sgsap_paging_reject( + rc = mme_app_send_sgsap_paging_reject( ue_context_p, ue_context_p->emm_context._imsi64, ue_context_p->emm_context._imsi.length, - SGS_CAUSE_MT_CSFB_CALL_REJECTED_BY_USER)) != RETURNok) { + SGS_CAUSE_MT_CSFB_CALL_REJECTED_BY_USER); + if (rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to send SGSAP-Paging Reject for imsi with reject cause:" @@ -2257,37 +2263,60 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } else { OAILOG_ERROR( LOG_MME_APP, - "sgs_context is null for ue" IMSI_64_FMT "\n", + "sgs_context is null for IMSI" IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } } else if ( - nas_extended_service_req_pP->csfb_response == CSFB_ACCEPTED_BY_UE) { - DevAssert(ue_context_p->sgs_context); - /*Set mt_call_in_progress flag as UE accepted the MT Call. + csfb_response == CSFB_ACCEPTED_BY_UE) { + if (!ue_context_p->sgs_context) { + OAILOG_ERROR( + LOG_MME_APP, + "sgs_context is null for IMSI" IMSI_64_FMT "\n", + ue_context_p->emm_context._imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + /* Set mt_call_in_progress flag as UE accepted the MT Call. * This will be used to decide whether to abort the on going MT call or * not when SERVICE ABORT request is received from MSC/VLR */ ue_context_p->sgs_context->mt_call_in_progress = true; if (ue_context_p->sgs_context->call_cancelled) { - /*Sending Service Reject to UE as MSC/VLR has triggered SGSAP SERVICE ABORT*/ + /* Sending Service Reject to UE as MSC/VLR has triggered + * SGSAP SERVICE ABORT + */ if (ue_context_p->ecm_state == ECM_IDLE) { + /* If ECM state is IDLE send + * service_reject in Establish cnf else send in DL NAS Transport + */ + OAILOG_ERROR( + LOG_MME_APP, + "MT CS call is accepted by UE in idle mode for ue_id:" + MME_UE_S1AP_ID_FMT " But MT_CALL_CANCEL is set by MSC," + " so sending service reject to UE \n", + ue_id); mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, + ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE, - MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE); + INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED); } else if (ue_context_p->ecm_state == ECM_CONNECTED) { + OAILOG_ERROR( + LOG_MME_APP, + "MT CS call is accepted by UE in connected mode for ue_id:" + MME_UE_S1AP_ID_FMT " But MT_CALL_CANCEL is set by MSC," + " so sending service reject to UE \n", + ue_id); mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, + ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE, - MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE); + UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } //Reset call_cancelled flag ue_context_p->sgs_context->call_cancelled = false; OAILOG_WARNING( LOG_MME_APP, - "Sending Service Reject to NAS as MSC has triggered SGSAP SERVICE " - "ABORT" - "Request for UE id :%u \n", + "Sending Service Reject to NAS module as MSC has triggered SGS " + "SERVICE ABORT Request for ue_id: " MME_UE_S1AP_ID_FMT "\n", ue_id); } else { mme_app_itti_ue_context_mod_for_csfb(ue_context_p); @@ -2295,8 +2324,9 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } else { OAILOG_WARNING( LOG_MME_APP, - "Invalid csfb_response for service type :%d and ue_id :%u \n", - nas_extended_service_req_pP->servType, + "Invalid csfb_response for service type :%d and ue_id: " + MME_UE_S1AP_ID_FMT "\n", + service_type, ue_id); } break; @@ -2306,9 +2336,16 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, ue_context_p->sgs_context->is_emergency_call = true; mme_app_itti_ue_context_mod_for_csfb(ue_context_p); } else { - /* send Service Reject to UE */ - mme_app_notify_service_reject_to_nas(ue_context_p->mme_ue_s1ap_id, EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); + // Notify NAS module to send Service Reject message to UE + OAILOG_ERROR( + LOG_MME_APP, + "For MO_CS_FB_EMRGNCY_CALL, SGS context is not found for ue_id:" + MME_UE_S1AP_ID_FMT " MME shall send Service Reject to ue", + ue_context_p->mme_ue_s1ap_id); + mme_app_notify_service_reject_to_nas( + ue_context_p->mme_ue_s1ap_id, + EMM_CAUSE_CONGESTION, + UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } break; /* packet service via s1 */ @@ -2322,7 +2359,7 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, OAILOG_ERROR( LOG_MME_APP, "ERROR***** Invalid Service Type Received %d\n", - serviceType); + service_type); } unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); @@ -2360,10 +2397,17 @@ int handle_csfb_s1ap_procedure_failure( char *failed_statement, uint8_t failed_procedure) { - int rc = RETURNok; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); + if (!ue_context_p) { + OAILOG_ERROR(LOG_MME_APP, "Failed to find UE context \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + + OAILOG_ERROR( + LOG_MME_APP, + "Handle handle_csfb_s1ap_procedure_failure for ue_id" + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); /* If ICS procedure is initiated due to CS-Paging in UE idle mode * On ICS failure, send sgsap-Paging Reject to VLR */ @@ -2390,24 +2434,18 @@ int handle_csfb_s1ap_procedure_failure( increment_counter( "sgsap_paging_reject", 1, 1, "cause", failed_statement); } - rc = mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, - EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); - } else if ( - ue_context_p->sgs_context->csfb_service_type == CSFB_SERVICE_MO_CALL) { - /* send Service Reject to UE */ - rc = mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, - EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } + // send Service Reject to UE + mme_app_notify_service_reject_to_nas( + ue_context_p->mme_ue_s1ap_id, + EMM_CAUSE_CONGESTION, + failed_procedure); ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE; if (failed_statement) { increment_counter("nas service reject", 1, 1, "cause", failed_statement); } } - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /**************************************************************************** @@ -2421,39 +2459,46 @@ int handle_csfb_s1ap_procedure_failure( ** emm_casue: failed cause ** ** Failed_procedure: ICS/UE context modification ** ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** ***************************************************************************/ - -int mme_app_notify_service_reject_to_nas( +void mme_app_notify_service_reject_to_nas( mme_ue_s1ap_id_t ue_id, uint8_t emm_cause, uint8_t failed_procedure) { - int rc = RETURNok; - MessageDef *message_p = NULL; - itti_nas_notify_service_reject_t *itti_nas_notify_service_reject_p = NULL; OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_INFO( LOG_MME_APP, " Ongoing Service request procedure failed," - "send Notify Service Reject to NAS for ue_id :%u \n", + "send Notify Service Reject to NAS module for ue_id :" + MME_UE_S1AP_ID_FMT" \n", ue_id); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_NOTIFY_SERVICE_REJECT); - itti_nas_notify_service_reject_p = - &message_p->ittiMsg.nas_notify_service_reject; - memset( - (void *) itti_nas_notify_service_reject_p, - 0, - sizeof(itti_nas_extended_service_req_t)); - - itti_nas_notify_service_reject_p->ue_id = ue_id; - itti_nas_notify_service_reject_p->emm_cause = emm_cause; - itti_nas_notify_service_reject_p->failed_procedure = failed_procedure; - - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + switch (failed_procedure) { + case INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED: { + if ((emm_proc_service_reject(ue_id, emm_cause)) != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "emm_proc_service_reject() failed for ue_id "MME_UE_S1AP_ID_FMT "\n", + ue_id); + } + break; + } + case UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED: { + if ((emm_send_service_reject_in_dl_nas(ue_id, emm_cause)) != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "emm_send_service_reject_in_dl_nas() failed for ue_id " + MME_UE_S1AP_ID_FMT "\n", + ue_id); + } + break; + } + default: { + OAILOG_ERROR(LOG_MME_APP, "Invalid failed procedure for ue-id" + MME_UE_S1AP_ID_FMT "\n", ue_id); + break; + } + } + OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ void mme_app_handle_create_dedicated_bearer_rsp( diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h index 7a51af9452df..709b66e601c4 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h @@ -60,8 +60,10 @@ int mme_app_handle_s6a_update_location_ans(mme_app_desc_t *mme_app_desc_p, int mme_app_handle_s6a_cancel_location_req(mme_app_desc_t *mme_app_desc_p, const s6a_cancel_location_req_t *const clr_pP); -int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, - itti_nas_extended_service_req_t *const nas_extended_service_req_pP); +int mme_app_handle_nas_extended_service_req( + const mme_ue_s1ap_id_t ue_id, + const uint8_t servicetype, + uint8_t csfb_response); void mme_app_handle_detach_req(const mme_ue_s1ap_id_t ue_id); @@ -197,11 +199,6 @@ int mme_app_handle_s6a_reset_req(mme_app_desc_t *mme_app_desc_p, int mme_app_send_s6a_reset_ans(int rsa_result, void *msg_rsa_p); -int mme_app_send_nas_cs_service_notification( - mme_ue_s1ap_id_t ue_id, - uint8_t paging_id, - bstring cli); - int mme_app_send_sgsap_service_request( uint8_t service_indicator, struct ue_mm_context_s *ue_context_p); @@ -253,7 +250,7 @@ int mme_app_send_sgsap_paging_reject( uint8_t imsi_len, SgsCause_t sgs_cause); -int mme_app_notify_service_reject_to_nas( +void mme_app_notify_service_reject_to_nas( mme_ue_s1ap_id_t ue_id, uint8_t emm_cause, uint8_t failed_procedure); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c index 73b593f9f0d0..cc30c9c82b00 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c @@ -60,7 +60,17 @@ #define TASK_SPGW TASK_S11 #endif -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_itti_ue_context_release() ** + ** ** + ** description: Send itti mesage to S1ap task to send UE Context Release ** + ** Request ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** emm_casue: failed cause ** + ** ** + ***************************************************************************/ void mme_app_itti_ue_context_release( struct ue_mm_context_s *ue_context_p, enum s1cause cause) @@ -70,6 +80,12 @@ void mme_app_itti_ue_context_release( OAILOG_FUNC_IN(LOG_MME_APP); message_p = itti_alloc_new_message(TASK_MME_APP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for S1AP_UE_CONTEXT_RELEASE_COMMAND \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } OAILOG_INFO( LOG_MME_APP, "Sending UE Context Release Cmd to S1ap for (ue_id = %u)\n" @@ -86,7 +102,20 @@ void mme_app_itti_ue_context_release( OAILOG_FUNC_OUT(LOG_MME_APP); } -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_send_s11_release_access_bearers_req ** + ** ** + ** description: Send itti mesage to SPGW task to send Release Access ** + ** Bearer Request (RAB) ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** pdn_index: PDN index for which RAB is initiated ** + ** ** + ** outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** + ***************************************************************************/ int mme_app_send_s11_release_access_bearers_req( struct ue_mm_context_s *const ue_mm_context, const pdn_cid_t pdn_index) @@ -103,6 +132,12 @@ int mme_app_send_s11_release_access_bearers_req( DevAssert(ue_mm_context); message_p = itti_alloc_new_message(TASK_MME_APP, S11_RELEASE_ACCESS_BEARERS_REQUEST); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for S11_RELEASE_ACCESS_BEARERS_REQUEST \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } release_access_bearers_request_p = &message_p->ittiMsg.s11_release_access_bearers_request; release_access_bearers_request_p->local_teid = ue_mm_context->mme_teid_s11; @@ -117,7 +152,20 @@ int mme_app_send_s11_release_access_bearers_req( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_send_s11_create_session_req ** + ** ** + ** description: Send itti mesage to SPGW task to send Create Session ** + ** Request (CSR) ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** pdn_index: PDN index for which CSR is initiated ** + ** ** + ** outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** + ***************************************************************************/ int mme_app_send_s11_create_session_req( mme_app_desc_t* mme_app_desc_p, struct ue_mm_context_s* const ue_mm_context, @@ -324,3 +372,208 @@ int mme_app_send_s11_create_session_req( rc = itti_send_msg_to_task(TASK_SPGW, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } + +/**************************************************************************** + ** ** + ** name: nas_itti_sgsap_uplink_unitdata ** + ** ** + ** description: Send itti mesage to SGS task to send NAS message ** + ** ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** nas_msg: NAS message ** + ** imeisv_pP: IMEISV of UE ** + ** mobilestationclassmark2_pP: Mobile station classmark-2 of UE ** + ** tai_pP: TAI of UE ** + ** ecgi_pP: ecgi of UE ** + ** ** + ***************************************************************************/ +void nas_itti_sgsap_uplink_unitdata( + const char *const imsi, + uint8_t imsi_len, + bstring nas_msg, + imeisv_t *imeisv_pP, + MobileStationClassmark2 *mobilestationclassmark2_pP, + tai_t *tai_pP, + ecgi_t *ecgi_pP) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + int uetimezone = 0; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_UPLINK_UNITDATA); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_UPLINK_UNITDATA \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_uplink_unitdata, + 0, + sizeof(itti_sgsap_uplink_unitdata_t)); + memcpy(SGSAP_UPLINK_UNITDATA(message_p).imsi, imsi, imsi_len); + SGSAP_UPLINK_UNITDATA(message_p).imsi[imsi_len] = '\0'; + SGSAP_UPLINK_UNITDATA(message_p).imsi_length = imsi_len; + SGSAP_UPLINK_UNITDATA(message_p).nas_msg_container = nas_msg; + nas_msg = NULL; + /* + * optional - UE Time Zone + * update the ue time zone presence bitmask + */ + if ((uetimezone = get_time_zone()) != RETURNerror) { + SGSAP_UPLINK_UNITDATA(message_p).opt_ue_time_zone = timezone; + SGSAP_UPLINK_UNITDATA(message_p).presencemask = + UPLINK_UNITDATA_UE_TIMEZONE_PARAMETER_PRESENT; + } + /* + * optional - IMEISV + * update the imeisv presence bitmask + */ + if (imeisv_pP) { + hexa_to_ascii( + (uint8_t *) imeisv_pP->u.value, + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv, + 8); + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv[imeisv_pP->length] = '\0'; + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv_length = imeisv_pP->length; + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_IMEISV_PARAMETER_PRESENT; + } + /* + * optional - mobile station classmark2 + * update the mobile station classmark2 presence bitmask. + */ + if (mobilestationclassmark2_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_mobilestationclassmark2 = + *((MobileStationClassmark2_t *) mobilestationclassmark2_pP); + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_MOBILE_STATION_CLASSMARK_2_PARAMETER_PRESENT; + } + /* + * optional - tai + * update the tai presence bitmask. + */ + if (tai_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_tai = *((tai_t *) tai_pP); + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_TAI_PARAMETER_PRESENT; + } + /* + * optional - ecgi + * update the ecgi presence bitmask. + */ + if (ecgi_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_ecgi = *ecgi_pP; + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_ECGI_PARAMETER_PRESENT; + } + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP Uplink Unitdata to SGS task for Imsi : " + "%s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP Uplink Unitdata to SGS task for Imsi :%s \n", + imsi); + } + + OAILOG_FUNC_OUT(LOG_MME_APP); +} + +/**************************************************************************** + ** ** + ** name: mme_app_itti_sgsap_tmsi_reallocation_comp ** + ** ** + ** description: Send itti mesage, TMSI Reallocation Complete message ** + ** to SGS task ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** ** + ***************************************************************************/ +void mme_app_itti_sgsap_tmsi_reallocation_comp( + const char *imsi, + const unsigned int imsi_len) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_TMSI_REALLOC_COMP); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_TMSI_REALLOC_COMP \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_tmsi_realloc_comp, + 0, + sizeof(itti_sgsap_tmsi_reallocation_comp_t)); + memcpy(SGSAP_TMSI_REALLOC_COMP(message_p).imsi, imsi, imsi_len); + SGSAP_TMSI_REALLOC_COMP(message_p).imsi[imsi_len] = '\0'; + SGSAP_TMSI_REALLOC_COMP(message_p).imsi_length = imsi_len; + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP Tmsi Reallocation Complete to SGS task for Imsi : " + "%s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP Tmsi Reallocation Complete to SGS task for Imsi :%s \n", + imsi); + } + OAILOG_FUNC_OUT(LOG_MME_APP); +} + +/**************************************************************************** + ** ** + ** name: mme_app_itti_sgsap_ue_activity_ind ** + ** ** + ** description: Send itti mesage, UE Activity Indication message ** + ** to SGS task ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** ** + ***************************************************************************/ +void mme_app_itti_sgsap_ue_activity_ind( + const char *imsi, + const unsigned int imsi_len) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_UE_ACTIVITY_IND); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_UE_ACTIVITY_IND \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_ue_activity_ind, + 0, + sizeof(itti_sgsap_ue_activity_ind_t)); + memcpy(SGSAP_UE_ACTIVITY_IND(message_p).imsi, imsi, imsi_len); + SGSAP_UE_ACTIVITY_IND(message_p).imsi[imsi_len] = '\0'; + SGSAP_UE_ACTIVITY_IND(message_p).imsi_length = imsi_len; + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP UE ACTIVITY IND to SGS task for Imsi : %s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP UE ACTIVITY IND to SGS task for Imsi :%s \n", + imsi); + } + OAILOG_FUNC_OUT(LOG_MME_APP); +} diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h index 97ccf54446a0..9a9e4577a9a2 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h @@ -124,4 +124,21 @@ static inline void mme_app_itti_ue_context_mod_for_csfb( OAILOG_FUNC_OUT(LOG_MME_APP); } +void nas_itti_sgsap_uplink_unitdata( + const char *const imsi, + uint8_t imsi_len, + bstring nas_msg, + imeisv_t *imeisv, + MobileStationClassmark2 *mobilestationclassmark2, + tai_t *tai, + ecgi_t *ecgi); + +void mme_app_itti_sgsap_tmsi_reallocation_comp( + const char *imsi, + const unsigned int imsi_len); + +void mme_app_itti_sgsap_ue_activity_ind( + const char *imsi, + const unsigned int imsi_len); + #endif /* FILE_MME_APP_ITTI_MESSAGING_SEEN */ diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c index 145ff71c39a5..9e9fc633c49d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c @@ -188,11 +188,6 @@ void *mme_app_thread(void *args) mme_app_handle_e_rab_rel_rsp(&S1AP_E_RAB_REL_RSP(received_message_p)); } break; - case NAS_EXTENDED_SERVICE_REQ: { - mme_app_handle_nas_extended_service_req(mme_app_desc_p, - &received_message_p->ittiMsg.nas_extended_service_req); - } break; - case S1AP_INITIAL_UE_MESSAGE: { mme_app_handle_initial_ue_message(mme_app_desc_p, &S1AP_INITIAL_UE_MESSAGE(received_message_p)); @@ -470,10 +465,31 @@ void *mme_app_thread(void *args) &MME_APP_DL_DATA_REJ(received_message_p).nas_msg); } break; - case TERMINATE_MESSAGE: { - /* - * Termination message received TODO -> release any data allocated - */ + case SGSAP_DOWNLINK_UNITDATA: { + /* We received the Downlink Unitdata from MSC, trigger a + * Downlink Nas Transport message to UE. + */ + nas_proc_downlink_unitdata( + &SGSAP_DOWNLINK_UNITDATA(received_message_p)); + } break; + + case SGSAP_RELEASE_REQ: { + /* We received the SGS Release request from MSC,to indicate that there + * are no more NAS messages to be exchanged between the VLR and the UE, + * or when a further exchange of NAS messages for the specified UE is + * not possible due to an error. + */ + nas_proc_sgs_release_req(&SGSAP_RELEASE_REQ(received_message_p)); + } break; + + case SGSAP_MM_INFORMATION_REQ: { + // Received SGSAP MM Information Request message from SGS task + nas_proc_cs_domain_mm_information_request( + &SGSAP_MM_INFORMATION_REQ(received_message_p)); + } break; + + case TERMINATE_MESSAGE: { + // Termination message received TODO -> release any data allocated put_mme_nas_state(&mme_app_desc_p); mme_app_exit(); itti_free_msg_content(received_message_p); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c index c1d4ee4036de..a448efe1439c 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c @@ -82,15 +82,15 @@ static int _sgs_handle_paging_request_for_mt_sms_in_connected( static int _sgs_handle_paging_request_for_mt_sms_in_idle( ue_mm_context_t *ue_context_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP); -/********************************************************************************** - ** ** - ** Name: sgs_handle_associated_paging_request() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ +/***************************************************************************** + ** ** + ** Name: sgs_handle_associated_paging_request() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) { int rc = RETURNerror; @@ -101,7 +101,8 @@ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) OAILOG_DEBUG( LOG_MME_APP, - "Handle paging request in Associated state for ue-id :%u \n", + "Handle paging request in Associated state for ue-id " + MME_UE_S1AP_ID_FMT "\n", evt->ue_id); sgs_context_t *sgs_context = (sgs_context_t *) evt->ctx; sgsap_paging_req_pP = (itti_sgsap_paging_request_t *) sgs_context->sgsap_msg; @@ -115,18 +116,16 @@ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_sms() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** for Mobile terminating sms ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** - ** ue_context_p: UE context - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_sms() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** for Mobile terminating sms ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) { int rc = RETURNerror; @@ -136,7 +135,7 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t *mme_app_desc_p = get_mme_nas_state(false); + mme_app_desc_t* mme_app_desc_p = get_mme_nas_state(false); ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( &mme_app_desc_p->mme_ue_contexts, evt->ue_id); if (!ue_context_p) { @@ -191,28 +190,27 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_call() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** for Mobile terminating call ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** +/****************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_call() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** for Mobile terminating call ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** ** ue_context_p: UE context - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - -static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +*******************************************************************************/ +static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) { int rc = RETURNerror; - ue_mm_context_t *ue_context_p = NULL; - sgs_context_t *sgs_context = NULL; - itti_sgsap_paging_request_t *sgsap_paging_req_pP = NULL; + ue_mm_context_t* ue_context_p = NULL; + sgs_context_t* sgs_context = NULL; + itti_sgsap_paging_request_t* sgsap_paging_req_pP = NULL; imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t *mme_app_desc_p = get_mme_nas_state(false); + mme_app_desc_t* mme_app_desc_p = get_mme_nas_state(false); ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( &mme_app_desc_p->mme_ue_contexts, evt->ue_id); if (!ue_context_p) { @@ -223,7 +221,9 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } sgs_context = (sgs_context_t *) evt->ctx; - /*If call_cancelled is set to TRUE when a new Paging message is received.Set call_cancelled to false*/ + /* If call_cancelled is set to TRUE when a new Paging message + * is received.Set call_cancelled to false + */ if (sgs_context->call_cancelled == true) { sgs_context->call_cancelled = false; } @@ -257,7 +257,7 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } - /* Check the vlr-reliable flag */ + // Check the vlr-reliable flag if (sgs_context->vlr_reliable == false) { OAILOG_DEBUG( LOG_MME_APP, @@ -265,7 +265,9 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) "\n", sgs_context->vlr_reliable, ue_context_p->emm_context._imsi64); - /* Handling for paging received without LAI and vlr-reliable flag set to false is same */ + /* Handling for paging received without LAI and vlr-reliable flag set to + * false is same + */ rc = _sgsap_handle_paging_request_without_lai( ue_context_p, sgsap_paging_req_pP); unlock_ue_contexts(ue_context_p); @@ -283,28 +285,35 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_call_in_connected() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** and UE connected state for Mobile terminating call ** - ** Inputs: ue_context_p: UE context ** - ** itti_sgsap_paging_request_t : received sgs-paging request ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_call_in_connected() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** and UE connected state for Mobile terminating call ** + ** Inputs: ue_context_p: UE context ** + ** itti_sgsap_paging_request_t : received sgs-paging request ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_call_in_connected( - ue_mm_context_t *ue_context_p, - itti_sgsap_paging_request_t *const sgsap_paging_req_pP) + ue_mm_context_t* ue_context_p, + itti_sgsap_paging_request_t* const sgsap_paging_req_pP) { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; bstring cli = NULL; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(sgsap_paging_req_pP); + + if (!ue_context_p) { + OAILOG_ERROR(LOG_MME_APP, "Invalid ue_context_p \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + if (!sgsap_paging_req_pP) { + OAILOG_ERROR(LOG_MME_APP, "Null Paging Request Received \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } OAILOG_INFO( LOG_MME_APP, @@ -315,25 +324,26 @@ static int _sgs_handle_paging_request_for_mt_call_in_connected( /* Fetch TMSI if present */ if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } /* Fetch CLI if present */ if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_CLI_PARAMETER_PRESENT) { bassign(cli, sgsap_paging_req_pP->opt_cli); } - if ( - RETURNok != (rc = mme_app_send_nas_cs_service_notification( - ue_context_p->mme_ue_s1ap_id, paging_id, cli))) { + rc = nas_proc_cs_service_notification( + ue_context_p->mme_ue_s1ap_id, paging_id, cli); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, - "Failed to send CS-Service Notification to NAS for ue-id :%u \n", + "Failed to handle CS-Service Notification at NAS module for" + " ue-id:" MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - if ( - RETURNok != (rc = mme_app_send_sgsap_service_request( - sgsap_paging_req_pP->service_indicator, ue_context_p))) { + rc = mme_app_send_sgsap_service_request( + sgsap_paging_req_pP->service_indicator, ue_context_p); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send CS-Service Request to SGS-Task for ue-id :%u \n", @@ -344,18 +354,17 @@ static int _sgs_handle_paging_request_for_mt_call_in_connected( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_sms_in_connected() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** and UE connected state for Mobile terminating sms ** - ** Inputs: ue_context_p: UE context ** - ** itti_sgsap_paging_request_t : received sgs-paging request ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_sms_in_connected() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** and UE connected state for Mobile terminating sms ** + ** Inputs: ue_context_p: UE context ** + ** itti_sgsap_paging_request_t : received sgs-paging request ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_sms_in_connected( ue_mm_context_t *ue_context_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP) @@ -372,9 +381,9 @@ static int _sgs_handle_paging_request_for_mt_sms_in_connected( "\n", ue_context_p->emm_context._imsi64); - if ( - RETURNok != (rc = mme_app_send_sgsap_service_request( - sgsap_paging_req_pP->service_indicator, ue_context_p))) { + rc = mme_app_send_sgsap_service_request( + sgsap_paging_req_pP->service_indicator, ue_context_p); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send CS-Service Request to SGS-Task for ue-id :%u \n", @@ -403,7 +412,7 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); DevAssert(ue_context_p); DevAssert(sgsap_paging_req_pP); @@ -426,18 +435,18 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( "IMSI " IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); rc = mme_app_paging_request_helper( - ue_context_p, false, NAS_PAGING_ID_IMSI, CN_DOMAIN_PS); + ue_context_p, false, MME_APP_PAGING_ID_IMSI, CN_DOMAIN_PS); } else { - /* Fetch TMSI if present */ + // Fetch TMSI if present if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } - /* if TMSI is received, then page with S-TMSI otherwise page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, CN_DOMAIN_CS)) != RETURNok) { + // if TMSI is received, then page with S-TMSI otherwise page with IMSI + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, CN_DOMAIN_CS); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send PAGING Message to UE for UE-id:%u \n", @@ -448,10 +457,9 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( sgsap_paging_req_pP->service_indicator; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + _mme_app_send_sgsap_ue_unreachable(ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -479,7 +487,7 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); DevAssert(ue_context_p); DevAssert(sgsap_paging_req_pP); @@ -502,18 +510,18 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( "IMSI " IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); rc = mme_app_paging_request_helper( - ue_context_p, false, NAS_PAGING_ID_IMSI, CN_DOMAIN_PS); + ue_context_p, false, MME_APP_PAGING_ID_IMSI, CN_DOMAIN_PS); } else { - /* Fetch TMSI if present */ + // Fetch TMSI if present if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } - /* if TMSI is received, then page with S-TMSI otherwise page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, CN_DOMAIN_PS)) != RETURNok) { + // if TMSI is received, then page with S-TMSI otherwise page with IMSI + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, CN_DOMAIN_PS); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send PAGING Message to UE for UE-id:%u \n", @@ -524,10 +532,10 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( sgsap_paging_req_pP->service_indicator; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + rc = _mme_app_send_sgsap_ue_unreachable( + ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -596,60 +604,17 @@ int mme_app_send_sgsap_service_request( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: mme_app_send_nas_cs_service_notification() ** - ** Description If SGSAP-Paging request received in UE ECM_Connected state ** - ** Send CS Service Notofication ** - ** Inputs: ue_id: UE identifier ** - ** paging_id Indicates the identity used for paging non-eps services ** - ** cli Calling Line Identification ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ -int mme_app_send_nas_cs_service_notification( - mme_ue_s1ap_id_t ue_id, - uint8_t paging_id, - bstring cli) -{ - int rc = RETURNerror; - MessageDef *message_p = NULL; - itti_nas_cs_service_notification_t *cs_service_notification_p = NULL; - - OAILOG_FUNC_IN(LOG_MME_APP); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_CS_SERVICE_NOTIFICATION); - AssertFatal(message_p, "itti_alloc_new_message Failed"); - cs_service_notification_p = &message_p->ittiMsg.nas_cs_service_notification; - memset( - (void *) cs_service_notification_p, - 0, - sizeof(itti_nas_cs_service_notification_t)); - - cs_service_notification_p->ue_id = ue_id; - cs_service_notification_p->paging_id = paging_id; - bassign(cs_service_notification_p->cli, cli); - - OAILOG_INFO( - LOG_MME_APP, - "Send NAS CS Service Notification from MME app for ue_id:%u \n", - ue_id); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} - -/********************************************************************************** - ** ** - ** Name: mme_app_send_sgsap_paging_reject() ** - ** Description Build and send Paging reject ** - ** Inputs: ue_context_p: pointer ue_context ** - ** imsi : imsi ** - ** sgs_cause : paging reject cause ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** +/***************************************************************************** + ** ** + ** Name: mme_app_send_sgsap_paging_reject() ** + ** Description Build and send Paging reject ** + ** Inputs: ue_context_p: pointer ue_context ** + ** imsi : imsi ** + ** sgs_cause : paging reject cause ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** ** -***********************************************************************************/ +******************************************************************************/ int mme_app_send_sgsap_paging_reject( struct ue_mm_context_s *ue_context_p, imsi64_t imsi, @@ -807,14 +772,13 @@ static int _mme_app_send_sgsap_ue_unreachable( ** Return: RETURNok, RETURNerror ** ** ***********************************************************************************/ - static int _sgsap_handle_paging_request_without_lai( - ue_mm_context_t *ue_context_p, - itti_sgsap_paging_request_t *const sgsap_paging_req_pP) + ue_mm_context_t* ue_context_p, + itti_sgsap_paging_request_t* const sgsap_paging_req_pP) { int rc = RETURNok; s1ap_cn_domain_t cn_domain = CN_DOMAIN_CS; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); if (!ue_context_p) { @@ -822,7 +786,7 @@ static int _sgsap_handle_paging_request_without_lai( OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } if (!sgsap_paging_req_pP) { - OAILOG_ERROR(LOG_MME_APP, "Null Pagaing Request Received \n"); + OAILOG_ERROR(LOG_MME_APP, "Null Paging Request Received \n"); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } @@ -832,7 +796,7 @@ static int _sgsap_handle_paging_request_without_lai( "\n", ue_context_p->emm_context._imsi64); if (ue_context_p->ecm_state == ECM_CONNECTED) { - // Send N/W Initiated Detach Request to NAS + // Send N/W Initiated Detach Request to NAS module emm_cn_nw_initiated_detach_ue_t emm_cn_nw_initiated_detach = {0}; emm_cn_nw_initiated_detach.ue_id = ue_context_p->mme_ue_s1ap_id; @@ -843,23 +807,27 @@ static int _sgsap_handle_paging_request_without_lai( * The value of ppf-paging proceeding flag will be "true" */ if (ue_context_p->ppf) { - /* if Paging request received without LAI for MT SMS, always page with S-TMSI */ + /* if Paging request received without LAI for MT SMS, + * always page with S-TMSI + */ if (sgsap_paging_req_pP->service_indicator == SGSAP_SMS_INDICATOR) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; cn_domain = CN_DOMAIN_PS; } - /* if Paging request received without LAI for CS call, always page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, cn_domain)) == RETURNok) { + /* if Paging request received without LAI for CS call, + * always page with IMSI + */ + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, cn_domain); + if (rc == RETURNok) { ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_MT_CALL_OR_SMS_WITHOUT_LAI; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + rc = _mme_app_send_sgsap_ue_unreachable( + ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -883,17 +851,19 @@ static int _sgsap_handle_paging_request_without_lai( ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ - -int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, +int mme_app_handle_sgsap_paging_request(mme_app_desc_t* mme_app_desc_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP) { - struct ue_mm_context_s *ue_context_p = NULL; - int rc = RETURNok; + struct ue_mm_context_s* ue_context_p = NULL; + int rc = RETURNerror; sgs_fsm_t sgs_fsm; imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(sgsap_paging_req_pP); + if (!sgsap_paging_req_pP) { + OAILOG_ERROR(LOG_MME_APP, "Received sgsap_paging_req_pP is NULL \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + } IMSI_STRING_TO_IMSI64(sgsap_paging_req_pP->imsi, &imsi64); @@ -934,8 +904,9 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, sgs_fsm.ue_id = ue_context_p->mme_ue_s1ap_id; sgs_fsm.ctx = (void *) ue_context_p->sgs_context; - /* Invoke SGS FSM */ - if (RETURNok != (rc = sgs_fsm_process(&sgs_fsm))) { + // Invoke SGS FSM + rc = sgs_fsm_process(&sgs_fsm); + if(rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to execute SGS State machine for ue_id :%u \n", diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c index 6e7b55d09dab..f9a9a84a508d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c @@ -111,8 +111,9 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, sgs_fsm.ue_id = ue_context_p->mme_ue_s1ap_id; sgs_fsm.ctx = (void *) ue_context_p->sgs_context; - /* Invoke SGS FSM */ - if (RETURNok != (rc = sgs_fsm_process(&sgs_fsm))) { + // Invoke SGS FSM + rc = sgs_fsm_process(&sgs_fsm); + if(rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to execute SGS State machine for ue_id :%u \n", @@ -123,51 +124,3 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/**************************************************************************** - ** ** - ** Name: mme_app_notify_service_reject_to_nas() ** - ** ** - ** Description: As part of handling CSFB procedure, if ICS or UE context ** - ** modification failed, indicate to NAS to send Service Reject to UE ** - ** ** - ** Inputs: ue_id: UE identifier ** - ** emm_casue: failed cause ** - ** Failed_procedure: ICS/UE context modification ** - ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** - ***************************************************************************/ - -int mme_app_notify_service_reject_to_nas( - mme_ue_s1ap_id_t ue_id, - uint8_t emm_cause, - uint8_t failed_procedure) -{ - int rc = RETURNok; - MessageDef *message_p = NULL; - itti_nas_notify_service_reject_t *itti_nas_notify_service_reject_p = NULL; - OAILOG_FUNC_IN(LOG_MME_APP); - OAILOG_INFO( - LOG_MME_APP, - " Ongoing Service request procedure failed," - "send Notify Service Reject to NAS for ue_id :%u \n", - ue_id); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_NOTIFY_SERVICE_REJECT); - itti_nas_notify_service_reject_p = - &message_p->ittiMsg.nas_notify_service_reject; - memset( - (void *) itti_nas_notify_service_reject_p, - 0, - sizeof(itti_nas_extended_service_req_t)); - - itti_nas_notify_service_reject_p->ue_id = ue_id; - itti_nas_notify_service_reject_p->emm_cause = emm_cause; - itti_nas_notify_service_reject_p->failed_procedure = failed_procedure; - - OAILOG_INFO( - LOG_MME_APP, " Send Notify service reject to NAS for UE-id :%u \n", ue_id); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} diff --git a/lte/gateway/c/oai/tasks/nas/emm/Attach.c b/lte/gateway/c/oai/tasks/nas/emm/Attach.c index 5a7aa50bc66e..d2e02efb50cd 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Attach.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Attach.c @@ -78,7 +78,7 @@ #include "esm_sap.h" #include "emm_cause.h" #include "mme_config.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "service303.h" #include "common_ies.h" #include "3gpp_23.003.h" @@ -720,7 +720,7 @@ int emm_proc_attach_complete( OAILOG_INFO( LOG_NAS_EMM, " Sending SGSAP TMSI REALLOCATION COMPLETE to SGS for ue_id = (%u)\n", ue_id); - nas_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); emm_ctx->csfbparams.newTmsiAllocated = false; /* update the neaf flag to false after sending the Tmsi Reallocation Complete message to SGS */ mme_ue_context_update_ue_sgs_neaf(ue_id, false); diff --git a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c index b503f28ea304..ff1d1b44aa19 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -33,7 +33,7 @@ Subsystem EPS Mobility Management - Author + Author Description Defines the Nas Transport EMM procedure executed by the Non-Access Stratum. @@ -45,7 +45,7 @@ #include "emm_proc.h" #include "log.h" #include "emm_data.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "conversions.h" #include "3gpp_23.003.h" #include "3gpp_36.401.h" diff --git a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c index 801310e3038d..9df1a16fc1d8 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -32,7 +32,7 @@ #include "emm_data.h" #include "emm_sap.h" #include "emm_cause.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "service303.h" #include "conversions.h" #include "3gpp_23.003.h" @@ -47,6 +47,7 @@ #include "mme_api.h" #include "mme_app_state.h" #include "nas_message.h" +#include "mme_app_defs.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -188,7 +189,7 @@ int emm_proc_extended_service_request( if (mme_ue_context_get_ue_sgs_neaf(ue_id) == true) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); mme_ue_context_update_ue_sgs_neaf(ue_id, false); } } @@ -210,9 +211,10 @@ int emm_proc_extended_service_request( emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } - /* notify MME-APP for extended service request reception in ue connected mode */ + // Handle extended service request received in ue connected mode emm_context_unlock(emm_ctx); - nas_itti_extended_service_req(ue_id, msg->servicetype, msg->csfbresponse); + mme_app_handle_nas_extended_service_req(ue_id, msg->servicetype, + msg->csfbresponse); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -270,7 +272,7 @@ int emm_recv_initial_ext_service_request( if (mme_ue_context_get_ue_sgs_neaf(ue_id) == true) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); mme_ue_context_update_ue_sgs_neaf(ue_id, false); } } diff --git a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c index cd49b5c6b876..816316ea9586 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c +++ b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c @@ -167,7 +167,7 @@ int _csfb_handle_tracking_area_req( EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING) || (emm_context_p->tau_updt_type == EPS_UPDATE_TYPE_PERIODIC_UPDATING))) { if ( - (ue_mm_context->sgs_context->vlr_reliable) && + (ue_mm_context->sgs_context->vlr_reliable == true) && (ue_mm_context->sgs_context->sgs_state == SGS_ASSOCIATED)) { OAILOG_INFO( LOG_MME_APP, "Do not send Location Update Request to MSC\n"); diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c index ff6574688665..95db4e79f0be 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c @@ -35,7 +35,7 @@ #include "mme_app_ue_context.h" #include "nas/as_message.h" #include "emm_cause.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "emm_as.h" #include "emm_recv.h" #include "LowerLayer.h" @@ -521,17 +521,18 @@ static int _emm_as_recv( } rc = emm_recv_tau_complete(ue_id, &emm_msg->tracking_area_update_complete); - /* - * send the SGSAP TMSI Reallocation complete message towards SGS. - * if csfb newTmsiAllocated flag is true - * After sending set it to false - */ + /* send the SGSAP TMSI Reallocation complete message towards SGS. + * if csfb newTmsiAllocated flag is true + * After sending set it to false + */ if (emm_ctx->csfbparams.newTmsiAllocated) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); emm_ctx->csfbparams.newTmsiAllocated = false; - /* update the neaf flag to false after sending the Tmsi Reallocation Complete message to SGS */ + /* update the neaf flag to false after sending the Tmsi Reallocation + * Complete message to SGS + */ mme_ue_context_update_ue_sgs_neaf(ue_id, false); } break; diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c index 55ed9662d2c0..2e486b8d9b25 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c @@ -34,7 +34,7 @@ #include "3gpp_requirements_24.301.h" #include "emm_sap.h" #include "service303.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "conversions.h" #include "3gpp_24.301.h" #include "AdditionalUpdateType.h" @@ -732,7 +732,7 @@ int emm_recv_service_request( if(service_type != CSFB_SERVICE_MT_SMS) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); } mme_ue_context_update_ue_sgs_neaf(ue_id, false); } diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c index d2455d476195..83a8e6852a53 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c +++ b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c @@ -111,155 +111,3 @@ void s6a_auth_info_rsp_timer_expiry_handler(void *args) OAILOG_FUNC_OUT(LOG_NAS_EMM); } - -void nas_itti_extended_service_req( - const mme_ue_s1ap_id_t ue_id, - const uint8_t servicetype, - uint8_t csfb_response) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_EXTENDED_SERVICE_REQ); - memset( - &message_p->ittiMsg.nas_extended_service_req, - 0, - sizeof(itti_nas_extended_service_req_t)); - NAS_EXTENDED_SERVICE_REQ(message_p).ue_id = ue_id; - NAS_EXTENDED_SERVICE_REQ(message_p).servType = servicetype; - NAS_EXTENDED_SERVICE_REQ(message_p).csfb_response = csfb_response; - - OAILOG_INFO( - LOG_MME_APP, - "Send NAS_EXTENDED_SERVICE_REQ from Nas to Mme-app for ue_id :%u\n", - ue_id); - itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -void nas_itti_sgsap_uplink_unitdata( - const char *const imsi, - uint8_t imsi_len, - bstring nas_msg, - imeisv_t *imeisv_pP, - MobileStationClassmark2 *mobilestationclassmark2_pP, - tai_t *tai_pP, - ecgi_t *ecgi_pP) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - int uetimezone = 0; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_UPLINK_UNITDATA); - AssertFatal(message_p, "itti_alloc_new_message Failed"); - memset( - &message_p->ittiMsg.sgsap_uplink_unitdata, - 0, - sizeof(itti_sgsap_uplink_unitdata_t)); - memcpy(SGSAP_UPLINK_UNITDATA(message_p).imsi, imsi, imsi_len); - SGSAP_UPLINK_UNITDATA(message_p).imsi[imsi_len] = '\0'; - SGSAP_UPLINK_UNITDATA(message_p).imsi_length = imsi_len; - SGSAP_UPLINK_UNITDATA(message_p).nas_msg_container = nas_msg; - nas_msg = NULL; - /* - * optional - UE Time Zone - * update the ue time zone presence bitmask - */ - if ((uetimezone = get_time_zone()) != RETURNerror) { - SGSAP_UPLINK_UNITDATA(message_p).opt_ue_time_zone = timezone; - SGSAP_UPLINK_UNITDATA(message_p).presencemask = - UPLINK_UNITDATA_UE_TIMEZONE_PARAMETER_PRESENT; - } - /* - * optional - IMEISV - * update the imeisv presence bitmask - */ - if (imeisv_pP) { - hexa_to_ascii( - (uint8_t *) imeisv_pP->u.value, - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv, - 8); - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv[imeisv_pP->length] = '\0'; - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv_length = imeisv_pP->length; - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_IMEISV_PARAMETER_PRESENT; - } - /* - * optional - mobile station classmark2 - * update the mobile station classmark2 presence bitmask. - */ - if (mobilestationclassmark2_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_mobilestationclassmark2 = - *((MobileStationClassmark2_t *) mobilestationclassmark2_pP); - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_MOBILE_STATION_CLASSMARK_2_PARAMETER_PRESENT; - } - /* - * optional - tai - * update the tai presence bitmask. - */ - if (tai_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_tai = *((tai_t *) tai_pP); - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_TAI_PARAMETER_PRESENT; - } - /* - * optional - ecgi - * update the ecgi presence bitmask. - */ - if (ecgi_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_ecgi = *ecgi_pP; - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_ECGI_PARAMETER_PRESENT; - } - - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_TMSI_REALLOC_COMP); - memset( - &message_p->ittiMsg.sgsap_tmsi_realloc_comp, - 0, - sizeof(itti_sgsap_tmsi_reallocation_comp_t)); - memcpy(SGSAP_TMSI_REALLOC_COMP(message_p).imsi, imsi, imsi_len); - SGSAP_TMSI_REALLOC_COMP(message_p).imsi[imsi_len] = '\0'; - SGSAP_TMSI_REALLOC_COMP(message_p).imsi_length = imsi_len; - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -//------------------------------------------------------------------------------ -void nas_itti_sgsap_ue_activity_ind( - const char *imsi, - const unsigned int imsi_len) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_UE_ACTIVITY_IND); - memset( - &message_p->ittiMsg.sgsap_ue_activity_ind, - 0, - sizeof(itti_sgsap_ue_activity_ind_t)); - memcpy(SGSAP_UE_ACTIVITY_IND(message_p).imsi, imsi, imsi_len); - SGSAP_UE_ACTIVITY_IND(message_p).imsi[imsi_len] = '\0'; - SGSAP_UE_ACTIVITY_IND(message_p).imsi_length = imsi_len; - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - OAILOG_DEBUG( - LOG_NAS, - " Sending NAS ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi : %s \n", - imsi); - - OAILOG_FUNC_OUT(LOG_NAS); -} diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h index 5d1c382e56fe..273ddf56a425 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h +++ b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h @@ -48,37 +48,11 @@ int nas_itti_dl_data_req( bstring nas_msgP, nas_error_code_t transaction_status); -void nas_itti_extended_service_req( - const mme_ue_s1ap_id_t ue_id, - const uint8_t servicetype, - uint8_t csfb_response); - -void nas_itti_sgsap_uplink_unitdata( - const char *const imsi, - uint8_t imsi_len, - bstring nas_msg, - imeisv_t *imeisv, - MobileStationClassmark2 *mobilestationclassmark2, - tai_t *tai, - ecgi_t *ecgi); - void nas_itti_sgsap_downlink_unitdata( const char *const imsi, uint8_t imsi_len, const_bstring nas_msg); -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len); - -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len); - void s6a_auth_info_rsp_timer_expiry_handler(void *args); -void nas_itti_sgsap_ue_activity_ind( - const char *imsi, - const unsigned int imsi_len); - #endif /* FILE_NAS_ITTI_MESSAGING_SEEN */ diff --git a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c index 8a0acc83d030..8be300db55ed 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c +++ b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c @@ -62,38 +62,6 @@ static void *nas_intertask_interface(void *args_p) S1AP_DEREGISTER_UE_REQ(received_message_p).mme_ue_s1ap_id); } break; - case SGSAP_DOWNLINK_UNITDATA: { - /* - * We received the Downlink Unitdata from MSC, trigger a - * Downlink Nas Transport message to UE. - */ - nas_proc_downlink_unitdata( - &SGSAP_DOWNLINK_UNITDATA(received_message_p)); - } break; - - case SGSAP_RELEASE_REQ: { - /* - * We received the SGS Release request from MSC,to indicate that there are no more NAS messages to be exchanged - * between the VLR and the UE, or when a further exchange of NAS messages for the specified UE is not possible - * due to an error. - */ - nas_proc_sgs_release_req(&SGSAP_RELEASE_REQ(received_message_p)); - } break; - case SGSAP_MM_INFORMATION_REQ: { - /*Received SGSAP MM Information Request message from SGS task*/ - nas_proc_cs_domain_mm_information_request( - &SGSAP_MM_INFORMATION_REQ(received_message_p)); - } break; - case NAS_CS_SERVICE_NOTIFICATION: { - nas_proc_cs_service_notification( - &NAS_CS_SERVICE_NOTIFICATION(received_message_p)); - } break; - - case NAS_NOTIFY_SERVICE_REJECT: { - nas_proc_notify_service_reject( - &NAS_NOTIFY_SERVICE_REJECT(received_message_p)); - } break; - case TERMINATE_MESSAGE: { put_mme_nas_state(&mme_app_desc_p); nas_exit(); diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.c b/lte/gateway/c/oai/tasks/nas/nas_proc.c index c68e69f263b6..7da154ca2bb0 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.c +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.c @@ -62,6 +62,7 @@ #include "mme_app_state.h" #include "nas_procedures.h" #include "service303.h" +#include "sgs_messages_types.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -783,6 +784,7 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_release_req) emm_context_unlock(ctxt); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } + /**************************************************************************** ** ** ** Name: nas_proc_cs_service_notification() ** @@ -790,16 +792,19 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_release_req) ** Description: Processes CS Paging Request message from MSC/VLR ** ** over SGs interface ** ** ** - ** Inputs: ** - ** cs_service_notification: The received message from MME app ** + ** Inputs: ue_id: UE identifier ** + ** paging_id Indicates the identity used for ** + ** paging non-eps services ** + ** cli Calling Line Identification ** ** ** ** Outputs: ** ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ - int nas_proc_cs_service_notification( - itti_nas_cs_service_notification_t *const cs_service_notification) + mme_ue_s1ap_id_t ue_id, + uint8_t paging_id, + bstring cli) { int rc = RETURNerror; emm_sap_t emm_sap = {0}; @@ -807,14 +812,13 @@ int nas_proc_cs_service_notification( OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.u.emm_as.u.data.nas_info = EMM_AS_NAS_DATA_CS_SERVICE_NOTIFICATION; - emm_sap.u.emm_as.u.data.ue_id = cs_service_notification->ue_id; + emm_sap.u.emm_as.u.data.ue_id = ue_id; emm_sap.u.emm_as.u.data.nas_msg = NULL; /*No Esm container*/ - emm_sap.u.emm_as.u.data.paging_identity = cs_service_notification->paging_id; - emm_sap.u.emm_as.u.data.cli = cs_service_notification->cli; + emm_sap.u.emm_as.u.data.paging_identity = paging_id; + bassign(emm_sap.u.emm_as.u.data.cli, cli); rc = emm_sap_send(&emm_sap); if (emm_sap.u.emm_as.u.data.cli) { bdestroy(emm_sap.u.emm_as.u.data.cli); - cs_service_notification->cli = NULL; } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -912,11 +916,10 @@ static nas_cause_t s6a_error_2_nas_cause(uint32_t s6a_error, int experimental) default: break; } } - return NAS_CAUSE_NETWORK_FAILURE; } -/* Handle CS domain MM-Information request from MSC/VLR */ +// Handle CS domain MM-Information request from MSC/VLR int nas_proc_cs_domain_mm_information_request( itti_sgsap_mm_information_req_t *const mm_information_req_pP) @@ -931,73 +934,6 @@ int nas_proc_cs_domain_mm_information_request( OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } -/**************************************************************************** - ** ** - ** Name: nas_proc_notify_service_reject() ** - ** ** - ** Description: Processes Service Reject notification received from ** - ** MME APP ** - ** ** - ** Inputs: ** - ** service_reject_p : The received message from MME app ** - ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** - ***************************************************************************/ - -int nas_proc_notify_service_reject( - itti_nas_notify_service_reject_t *const service_reject_p) -{ - int rc = RETURNerror; - - OAILOG_FUNC_IN(LOG_NAS_EMM); - DevAssert(service_reject_p); - if ( - service_reject_p->failed_procedure == - INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED) { - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for failed procedure %d for ue-id: %u \n", - service_reject_p->failed_procedure, - service_reject_p->ue_id); - rc = emm_proc_service_reject( - service_reject_p->ue_id, service_reject_p->emm_cause); - } else if ( - service_reject_p->failed_procedure == - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED) { - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for failed UE_CONTEXT_MODIFICATION procedure for " - "ue-id:%u \n", - service_reject_p->ue_id); - rc = emm_send_service_reject_in_dl_nas( - service_reject_p->ue_id, service_reject_p->emm_cause); - } else if ( - service_reject_p->failed_procedure == - MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE) { - // If ECM state is IDLE send service_reject in Establish cnf else send in DL NAS Transport - rc = emm_proc_service_reject( - service_reject_p->ue_id, service_reject_p->emm_cause); - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for FAILED_PROCEDURE_MT_CALL_CANCELLED_BY_NW " - "procedure for ue-id:%u \n", - service_reject_p->ue_id); - } else if ( - service_reject_p->failed_procedure == - MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE) { - rc = emm_send_service_reject_in_dl_nas( - service_reject_p->ue_id, service_reject_p->emm_cause); - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for FAILED_PROCEDURE_MT_CALL_CANCELLED_BY_NW " - "procedure for ue-id:%u \n", - service_reject_p->ue_id); - } - OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); -} - /**************************************************************************** ** ** ** Name: nas_proc_pdn_disconnect_rsp ** diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.h b/lte/gateway/c/oai/tasks/nas/nas_proc.h index 675b07542db5..5a5fc8e5b3f8 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.h +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.h @@ -144,9 +144,9 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_rel); int nas_proc_cs_domain_mm_information_request( itti_sgsap_mm_information_req_t *const mm_information_req_pP); int nas_proc_cs_service_notification( - itti_nas_cs_service_notification_t *const cs_service_notification); -int nas_proc_notify_service_reject( - itti_nas_notify_service_reject_t *const service_reject_p); + mme_ue_s1ap_id_t ue_id, + uint8_t paging_id, + bstring cli); int nas_proc_delete_dedicated_bearer( emm_cn_deactivate_dedicated_bearer_req_t *emm_cn_deactivate); int nas_proc_pdn_disconnect_rsp( diff --git a/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c b/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c index ecc420b265cd..a6192bbe1401 100644 --- a/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c +++ b/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c @@ -151,7 +151,7 @@ int handle_sgs_downlink_unitdata( sgs_dl_unitdata_p, sizeof(itti_sgsap_downlink_unitdata_t)); // send it to NAS module for further processing - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -169,7 +169,7 @@ int handle_sgs_release_req(const itti_sgsap_release_req_t *sgs_release_req_p) OAILOG_DEBUG(LOG_SGS, "Received SGS Release Request message from FedGW\n"); memcpy(sgs_rel_req_p, sgs_release_req_p, sizeof(itti_sgsap_release_req_t)); // send it to NAS module for further processing - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /* Fed GW calls below function, on reception of MM Information Request from MSC/VLR @@ -205,7 +205,7 @@ int handle_sgs_mm_information_request( "Imsi :%s \n", mm_information_req_p->imsi); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_SGS, rc); } From 32251d51653c14508c8e627c1e5daa6784825326 Mon Sep 17 00:00:00 2001 From: Shruti Sanadhya Date: Thu, 16 Jan 2020 11:58:48 -0800 Subject: [PATCH 17/26] Fixing memory leaks in MME and base state converter Summary: The State converter class for MME has memory leakage due to multiple bstring allocation. This change frees up the memory for each bstring. Reviewed By: ardzoht Differential Revision: D18423543 fbshipit-source-id: 4795bb8daf7751e7c29a436cd34ed21a402b6440 --- .../tasks/mme_app/mme_app_state_converter.cpp | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp b/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp index 3fe29727b794..e11ca2dce0ae 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_state_converter.cpp @@ -71,6 +71,7 @@ void MmeNasStateConverter::hashtable_ts_to_proto( keys->keys[i]); } } + FREE_HASHTABLE_KEY_ARRAY(keys); } void MmeNasStateConverter::proto_to_hashtable_ts( @@ -433,14 +434,17 @@ void MmeNasStateConverter::pdn_context_to_proto( state_pdn_context.apn_subscribed, pdn_context_proto->mutable_apn_subscribed()); pdn_context_proto->set_pdn_type(state_pdn_context.pdn_type); - BSTRING_TO_STRING( - paa_to_bstring(&state_pdn_context.paa), pdn_context_proto->mutable_paa()); + bstring bstr_buffer = paa_to_bstring(&state_pdn_context.paa); + BSTRING_TO_STRING(bstr_buffer, pdn_context_proto->mutable_paa()); BSTRING_TO_STRING( state_pdn_context.apn_oi_replacement, pdn_context_proto->mutable_apn_oi_replacement()); - BSTRING_TO_STRING( - ip_address_to_bstring(&state_pdn_context.p_gw_address_s5_s8_cp), + bdestroy(bstr_buffer); + bstr_buffer = + ip_address_to_bstring(&state_pdn_context.p_gw_address_s5_s8_cp); + BSTRING_TO_STRING(bstr_buffer, pdn_context_proto->mutable_p_gw_address_s5_s8_cp()); + bdestroy(bstr_buffer); pdn_context_proto->set_p_gw_teid_s5_s8_cp( state_pdn_context.p_gw_teid_s5_s8_cp); eps_subscribed_qos_profile_to_proto( @@ -457,9 +461,13 @@ void MmeNasStateConverter::pdn_context_to_proto( pdn_context_proto->add_bearer_contexts( state_pdn_context.bearer_contexts[i]); } + + bstr_buffer = + ip_address_to_bstring(&state_pdn_context.s_gw_address_s11_s4); BSTRING_TO_STRING( - ip_address_to_bstring(&state_pdn_context.s_gw_address_s11_s4), + bstr_buffer, pdn_context_proto->mutable_s_gw_address_s11_s4()); + bdestroy_wrapper(&bstr_buffer); pdn_context_proto->set_s_gw_teid_s11_s4(state_pdn_context.s_gw_teid_s11_s4); esm_pdn_to_proto( state_pdn_context.esm_data, pdn_context_proto->mutable_esm_data()); @@ -481,16 +489,17 @@ void MmeNasStateConverter::proto_to_pdn_context( STRING_TO_BSTRING( pdn_context_proto.apn_subscribed(), state_pdn_context->apn_subscribed); state_pdn_context->pdn_type = pdn_context_proto.pdn_type(); - bstring paa_bstr; - STRING_TO_BSTRING(pdn_context_proto.paa(), paa_bstr); - bstring_to_paa(paa_bstr, &state_pdn_context->paa); + bstring bstr_buffer; + STRING_TO_BSTRING(pdn_context_proto.paa(), bstr_buffer); + bstring_to_paa(bstr_buffer, &state_pdn_context->paa); + bdestroy(bstr_buffer); STRING_TO_BSTRING( pdn_context_proto.apn_oi_replacement(), state_pdn_context->apn_oi_replacement); - bstring ip_addr_bstr; - STRING_TO_BSTRING(pdn_context_proto.p_gw_address_s5_s8_cp(), ip_addr_bstr); + STRING_TO_BSTRING(pdn_context_proto.p_gw_address_s5_s8_cp(), bstr_buffer); bstring_to_ip_address( - ip_addr_bstr, &state_pdn_context->p_gw_address_s5_s8_cp); + bstr_buffer, &state_pdn_context->p_gw_address_s5_s8_cp); + bdestroy(bstr_buffer); state_pdn_context->p_gw_teid_s5_s8_cp = pdn_context_proto.p_gw_teid_s5_s8_cp(); proto_to_eps_subscribed_qos_profile( @@ -506,8 +515,9 @@ void MmeNasStateConverter::proto_to_pdn_context( state_pdn_context->bearer_contexts[i] = pdn_context_proto.bearer_contexts(i); } - STRING_TO_BSTRING(pdn_context_proto.s_gw_address_s11_s4(), ip_addr_bstr); - bstring_to_ip_address(ip_addr_bstr, &state_pdn_context->s_gw_address_s11_s4); + STRING_TO_BSTRING(pdn_context_proto.s_gw_address_s11_s4(), bstr_buffer); + bstring_to_ip_address(bstr_buffer, &state_pdn_context->s_gw_address_s11_s4); + bdestroy_wrapper(&bstr_buffer); state_pdn_context->s_gw_teid_s11_s4 = pdn_context_proto.s_gw_teid_s11_s4(); proto_to_esm_pdn(pdn_context_proto.esm_data(), &state_pdn_context->esm_data); state_pdn_context->is_active = pdn_context_proto.is_active(); From 30287ca82ce8e7b75fee03bfc0188bc384bdbb07 Mon Sep 17 00:00:00 2001 From: Shruti Sanadhya Date: Thu, 16 Jan 2020 11:58:48 -0800 Subject: [PATCH 18/26] Handling Terminate message in NAS and PGW tasks after state is destroyed Summary: When MME receives a SIGTERM signal, a terminate message is sent to all ITTI tasks. If NAS task tries to read the mme_nas_state after the MME task has terminated a segmentation fault is triggered. Similarly, if PGW task tries to read the spgw_state after the SGW task has already terminated, it fails the assert on non-null state. This change skips the spgw_state lookup when PGW task receives a Terminate message. Reviewed By: andreilee Differential Revision: D19200343 fbshipit-source-id: 8384fb3b42477b715b1ea7bd98a342812c7213a7 --- lte/gateway/c/oai/tasks/nas/nas_mme_task.c | 4 +++- lte/gateway/c/oai/tasks/sgw/pgw_task.c | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c index 8be300db55ed..1e825600f5c1 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c +++ b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c @@ -50,7 +50,9 @@ static void *nas_intertask_interface(void *args_p) MessageDef *received_message_p = NULL; itti_receive_msg(TASK_NAS_MME, &received_message_p); - mme_app_desc_p = get_locked_mme_nas_state(false); + if (ITTI_MSG_ID(received_message_p) != TERMINATE_MESSAGE) { + mme_app_desc_p = get_locked_mme_nas_state(false); + } switch (ITTI_MSG_ID(received_message_p)) { case MESSAGE_TEST: { diff --git a/lte/gateway/c/oai/tasks/sgw/pgw_task.c b/lte/gateway/c/oai/tasks/sgw/pgw_task.c index 8c8dcfad3370..f8f037b9188c 100644 --- a/lte/gateway/c/oai/tasks/sgw/pgw_task.c +++ b/lte/gateway/c/oai/tasks/sgw/pgw_task.c @@ -59,9 +59,11 @@ static void *pgw_intertask_interface(void *args_p) itti_receive_msg(TASK_PGW_APP, &received_message_p); - spgw_state_p = get_spgw_state(false); - AssertFatal( - spgw_state_p != NULL, "Failed to retrieve SPGW state on PGW task"); + if (ITTI_MSG_ID(received_message_p) != TERMINATE_MESSAGE) { + spgw_state_p = get_spgw_state(false); + AssertFatal( + spgw_state_p != NULL, "Failed to retrieve SPGW state on PGW task"); + } switch (ITTI_MSG_ID(received_message_p)) { case PGW_NW_INITIATED_ACTIVATE_BEARER_REQ: { From a3c9977c6f91095a103d1a31f45721756c7dff4f Mon Sep 17 00:00:00 2001 From: Scott Smith Date: Thu, 16 Jan 2020 15:36:28 -0800 Subject: [PATCH 19/26] Add ExecutionResult to `executor.Execute` (#170) Summary: Pull Request resolved: https://github.com/facebookincubator/symphony/pull/170 Adds a return value to `Execute()` which holds the actionIDs of successfully executed actions, as well as an array of error messages with its associated actionID. Reviewed By: rckclmbr Differential Revision: D19204025 fbshipit-source-id: a9f2bd706ba42719d7240a10486dcba8adfc8bfe --- symphony/graph/graphgrpc/actionsalert.go | 33 ++- symphony/graph/graphgrpc/rpc.pb.go | 197 ++++++++++++++---- symphony/graph/graphgrpc/rpc.proto | 12 +- symphony/pkg/actions/context.go | 4 +- symphony/pkg/actions/executor/executor.go | 19 +- .../pkg/actions/executor/executor_test.go | 42 +++- 6 files changed, 254 insertions(+), 53 deletions(-) diff --git a/symphony/graph/graphgrpc/actionsalert.go b/symphony/graph/graphgrpc/actionsalert.go index 18b277d73eed..4a85354ff47c 100644 --- a/symphony/graph/graphgrpc/actionsalert.go +++ b/symphony/graph/graphgrpc/actionsalert.go @@ -6,9 +6,14 @@ package graphgrpc import ( "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/facebookincubator/symphony/pkg/actions/executor" + "github.com/facebookincubator/symphony/pkg/actions" "github.com/facebookincubator/symphony/pkg/actions/core" - "github.com/golang/protobuf/ptypes/empty" ) type ( @@ -21,13 +26,13 @@ type ( ActionsProvider func(ctx context.Context, tenantID string) (*actions.Client, error) ) -// NewActionsAlertService returns a new ActionsAlertService +//NewActionsAlertService returns a new ActionsAlertService func NewActionsAlertService(provider ActionsProvider) ActionsAlertService { return ActionsAlertService{provider} } // Receive an alert payload and execute the triggered actions -func (s ActionsAlertService) Trigger(ctx context.Context, payload *AlertPayload) (*empty.Empty, error) { +func (s ActionsAlertService) Trigger(ctx context.Context, payload *AlertPayload) (*ExecutionResult, error) { triggerPayload := make(map[string]interface{}) triggerPayload["networkID"] = payload.NetworkID for key, val := range payload.Labels { @@ -37,9 +42,25 @@ func (s ActionsAlertService) Trigger(ctx context.Context, payload *AlertPayload) client, err := s.actionsProvider(ctx, payload.TenantID) if err != nil { - return &empty.Empty{}, err + return &ExecutionResult{}, status.Error(codes.Internal, "error getting tenant client") } - client.Execute(context.Background(), "", idToPayload) + res := client.Execute(context.Background(), "", idToPayload) + + return executorResultToMessage(res), nil +} - return &empty.Empty{}, nil +func executorResultToMessage(res executor.ExecutionResult) *ExecutionResult { + var successStrings []string + for _, id := range res.Successes { + successStrings = append(successStrings, string(id)) + } + var errors []*ExecutionError + for _, err := range res.Errors { + errors = append(errors, &ExecutionError{Id: string(err.ID), Err: err.Error}) + } + + return &ExecutionResult{ + Successes: successStrings, + Errors: errors, + } } diff --git a/symphony/graph/graphgrpc/rpc.pb.go b/symphony/graph/graphgrpc/rpc.pb.go index 91be1560ff65..85ed3ad47281 100644 --- a/symphony/graph/graphgrpc/rpc.pb.go +++ b/symphony/graph/graphgrpc/rpc.pb.go @@ -1,7 +1,3 @@ -// Copyright (c) 2004-present Facebook All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // Code generated by protoc-gen-go. DO NOT EDIT. // source: rpc.proto @@ -14,6 +10,8 @@ import ( empty "github.com/golang/protobuf/ptypes/empty" wrappers "github.com/golang/protobuf/ptypes/wrappers" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" math "math" ) @@ -177,43 +175,144 @@ func (m *AlertPayload) GetLabels() map[string]string { return nil } +type ExecutionResult struct { + Successes []string `protobuf:"bytes,1,rep,name=successes,proto3" json:"successes,omitempty"` + Errors []*ExecutionError `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExecutionResult) Reset() { *m = ExecutionResult{} } +func (m *ExecutionResult) String() string { return proto.CompactTextString(m) } +func (*ExecutionResult) ProtoMessage() {} +func (*ExecutionResult) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{3} +} + +func (m *ExecutionResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExecutionResult.Unmarshal(m, b) +} +func (m *ExecutionResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExecutionResult.Marshal(b, m, deterministic) +} +func (m *ExecutionResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecutionResult.Merge(m, src) +} +func (m *ExecutionResult) XXX_Size() int { + return xxx_messageInfo_ExecutionResult.Size(m) +} +func (m *ExecutionResult) XXX_DiscardUnknown() { + xxx_messageInfo_ExecutionResult.DiscardUnknown(m) +} + +var xxx_messageInfo_ExecutionResult proto.InternalMessageInfo + +func (m *ExecutionResult) GetSuccesses() []string { + if m != nil { + return m.Successes + } + return nil +} + +func (m *ExecutionResult) GetErrors() []*ExecutionError { + if m != nil { + return m.Errors + } + return nil +} + +type ExecutionError struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExecutionError) Reset() { *m = ExecutionError{} } +func (m *ExecutionError) String() string { return proto.CompactTextString(m) } +func (*ExecutionError) ProtoMessage() {} +func (*ExecutionError) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{4} +} + +func (m *ExecutionError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExecutionError.Unmarshal(m, b) +} +func (m *ExecutionError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExecutionError.Marshal(b, m, deterministic) +} +func (m *ExecutionError) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecutionError.Merge(m, src) +} +func (m *ExecutionError) XXX_Size() int { + return xxx_messageInfo_ExecutionError.Size(m) +} +func (m *ExecutionError) XXX_DiscardUnknown() { + xxx_messageInfo_ExecutionError.DiscardUnknown(m) +} + +var xxx_messageInfo_ExecutionError proto.InternalMessageInfo + +func (m *ExecutionError) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ExecutionError) GetErr() string { + if m != nil { + return m.Err + } + return "" +} + func init() { proto.RegisterType((*Tenant)(nil), "graph.Tenant") proto.RegisterType((*TenantList)(nil), "graph.TenantList") proto.RegisterType((*AlertPayload)(nil), "graph.AlertPayload") proto.RegisterMapType((map[string]string)(nil), "graph.AlertPayload.LabelsEntry") + proto.RegisterType((*ExecutionResult)(nil), "graph.ExecutionResult") + proto.RegisterType((*ExecutionError)(nil), "graph.executionError") } func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } var fileDescriptor_77a6da22d6a3feb1 = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x51, 0x5d, 0x8b, 0xd3, 0x40, - 0x14, 0x25, 0x49, 0x37, 0xbb, 0xbd, 0xeb, 0x8a, 0xce, 0x8a, 0x84, 0x58, 0xd6, 0xa5, 0x2f, 0xee, - 0x83, 0x24, 0x18, 0x59, 0xbf, 0x1e, 0xc4, 0x6a, 0x8b, 0x14, 0x2a, 0x48, 0x5b, 0x7c, 0xf0, 0x6d, - 0x92, 0xde, 0xa6, 0xa1, 0xe9, 0xcc, 0x30, 0x99, 0xb6, 0xe4, 0x57, 0xf9, 0x7f, 0xfc, 0x35, 0x92, - 0x99, 0xa4, 0xb6, 0x6a, 0x11, 0x7d, 0x09, 0xf7, 0x9e, 0x73, 0x6e, 0xee, 0x99, 0x73, 0xa1, 0x2d, - 0x45, 0x12, 0x08, 0xc9, 0x15, 0x27, 0x27, 0xa9, 0xa4, 0x62, 0xe1, 0x3f, 0x4a, 0x39, 0x4f, 0x73, - 0x0c, 0x35, 0x18, 0xaf, 0xe7, 0x21, 0xae, 0x84, 0x2a, 0x8d, 0xc6, 0xbf, 0xfa, 0x95, 0xdc, 0x4a, - 0x2a, 0x04, 0xca, 0xc2, 0xf0, 0xdd, 0xa7, 0xe0, 0x4e, 0x91, 0x51, 0xa6, 0xc8, 0x5d, 0xb0, 0xb3, - 0x99, 0x67, 0x5d, 0x5b, 0x37, 0xed, 0xb1, 0x9d, 0xcd, 0x08, 0x81, 0x16, 0xa3, 0x2b, 0xf4, 0x6c, - 0x8d, 0xe8, 0xba, 0x7b, 0x0b, 0x60, 0xd4, 0xa3, 0xac, 0x50, 0xe4, 0x09, 0x9c, 0x2a, 0xdd, 0x15, - 0x9e, 0x75, 0xed, 0xdc, 0x9c, 0x47, 0x17, 0x81, 0x76, 0x14, 0x18, 0xcd, 0xb8, 0x61, 0xbb, 0xdf, - 0x2d, 0xb8, 0xd3, 0xcb, 0x51, 0xaa, 0xcf, 0xb4, 0xcc, 0x39, 0x9d, 0x11, 0x1f, 0xce, 0x0c, 0x37, - 0xec, 0xd7, 0x1b, 0x77, 0x3d, 0xe9, 0x40, 0x9b, 0x56, 0xda, 0xbd, 0xe5, 0x3f, 0x81, 0x8a, 0x65, - 0xa8, 0xb6, 0x5c, 0x2e, 0x87, 0x7d, 0xcf, 0x31, 0xec, 0x0e, 0x20, 0x2f, 0xc1, 0xcd, 0x69, 0x8c, - 0x79, 0xe1, 0xb5, 0xb4, 0xa1, 0xc7, 0xb5, 0xa1, 0xfd, 0xe5, 0xc1, 0x48, 0x2b, 0x06, 0x4c, 0xc9, - 0x72, 0x5c, 0xcb, 0xfd, 0xd7, 0x70, 0xbe, 0x07, 0x93, 0x7b, 0xe0, 0x2c, 0xb1, 0xac, 0xad, 0x55, - 0x25, 0x79, 0x00, 0x27, 0x1b, 0x9a, 0xaf, 0x1b, 0x47, 0xa6, 0x79, 0x63, 0xbf, 0xb2, 0xa2, 0x6f, - 0x36, 0x5c, 0x98, 0x07, 0x4f, 0x50, 0x6e, 0xb2, 0x04, 0xc9, 0x2d, 0xb8, 0x1f, 0x24, 0x52, 0x85, - 0xa4, 0x13, 0x98, 0xf8, 0x83, 0x26, 0xfe, 0x60, 0xa2, 0x64, 0xc6, 0xd2, 0x2f, 0xd5, 0xb4, 0x7f, - 0x18, 0x17, 0x79, 0x06, 0x2d, 0x1d, 0xeb, 0xc3, 0xdf, 0x86, 0x06, 0xd5, 0x41, 0xfd, 0xfb, 0x07, - 0x72, 0x2d, 0x8d, 0xc0, 0xf9, 0x88, 0xea, 0xdf, 0xd6, 0xbc, 0x83, 0xb3, 0xa9, 0x5c, 0xb3, 0xe4, - 0xef, 0xfe, 0x8e, 0x18, 0x21, 0x6f, 0xc1, 0xed, 0x63, 0x8e, 0xff, 0x3b, 0x1f, 0x7d, 0x82, 0xcb, - 0x5e, 0xa2, 0x32, 0xce, 0x0a, 0x7d, 0x97, 0x26, 0xb6, 0x17, 0x70, 0x3a, 0x95, 0x59, 0x9a, 0xa2, - 0x24, 0x97, 0x7f, 0xb8, 0xdb, 0xb1, 0xdf, 0xbd, 0xbf, 0xfa, 0xda, 0x99, 0xc7, 0x49, 0x58, 0x94, - 0x2b, 0xb1, 0xe0, 0xac, 0x0c, 0xf5, 0xa8, 0xf9, 0xa6, 0x52, 0x24, 0xb1, 0xab, 0xf5, 0xcf, 0x7f, - 0x04, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x07, 0xf4, 0x72, 0x3a, 0x03, 0x00, 0x00, + // 481 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x5d, 0x4f, 0xd4, 0x40, + 0x14, 0x4d, 0xdb, 0xa5, 0xb0, 0x17, 0x41, 0x1c, 0xd4, 0x34, 0x75, 0x83, 0xa4, 0x2f, 0xf2, 0xa0, + 0xdd, 0x58, 0x83, 0x5f, 0x0f, 0x46, 0x74, 0x37, 0x86, 0x04, 0x13, 0x53, 0x36, 0x3e, 0xf8, 0x60, + 0x32, 0xdb, 0xbd, 0x94, 0x86, 0x6e, 0xdb, 0xdc, 0x99, 0x82, 0xfd, 0x55, 0xfe, 0x1f, 0x7f, 0x8d, + 0x99, 0x99, 0x16, 0x76, 0x41, 0x63, 0xe4, 0xa5, 0x99, 0x7b, 0xce, 0x99, 0xb9, 0xa7, 0xf7, 0x1e, + 0xe8, 0x53, 0x95, 0x84, 0x15, 0x95, 0xb2, 0x64, 0x2b, 0x29, 0xf1, 0xea, 0xd4, 0x7f, 0x94, 0x96, + 0x65, 0x9a, 0xe3, 0x50, 0x83, 0xd3, 0xfa, 0x64, 0x88, 0xf3, 0x4a, 0x36, 0x46, 0xe3, 0xef, 0x5c, + 0x27, 0x2f, 0x88, 0x57, 0x15, 0x92, 0x30, 0x7c, 0xf0, 0x14, 0xdc, 0x09, 0x16, 0xbc, 0x90, 0x6c, + 0x13, 0xec, 0x6c, 0xe6, 0x59, 0xbb, 0xd6, 0x5e, 0x3f, 0xb6, 0xb3, 0x19, 0x63, 0xd0, 0x2b, 0xf8, + 0x1c, 0x3d, 0x5b, 0x23, 0xfa, 0x1c, 0xec, 0x03, 0x18, 0xf5, 0x51, 0x26, 0x24, 0x7b, 0x02, 0xab, + 0x52, 0x57, 0xc2, 0xb3, 0x76, 0x9d, 0xbd, 0xf5, 0x68, 0x23, 0xd4, 0x8e, 0x42, 0xa3, 0x89, 0x3b, + 0x36, 0xf8, 0x65, 0xc1, 0x9d, 0x83, 0x1c, 0x49, 0x7e, 0xe1, 0x4d, 0x5e, 0xf2, 0x19, 0xf3, 0x61, + 0xcd, 0x70, 0x87, 0xa3, 0xb6, 0xe3, 0x65, 0xcd, 0x06, 0xd0, 0xe7, 0x4a, 0xbb, 0xd0, 0xfc, 0x0a, + 0x50, 0x6c, 0x81, 0xf2, 0xa2, 0xa4, 0xb3, 0xc3, 0x91, 0xe7, 0x18, 0xf6, 0x12, 0x60, 0xaf, 0xc0, + 0xcd, 0xf9, 0x14, 0x73, 0xe1, 0xf5, 0xb4, 0xa1, 0xc7, 0xad, 0xa1, 0xc5, 0xe6, 0xe1, 0x91, 0x56, + 0x8c, 0x0b, 0x49, 0x4d, 0xdc, 0xca, 0xfd, 0x37, 0xb0, 0xbe, 0x00, 0xb3, 0x2d, 0x70, 0xce, 0xb0, + 0x69, 0xad, 0xa9, 0x23, 0xbb, 0x0f, 0x2b, 0xe7, 0x3c, 0xaf, 0x3b, 0x47, 0xa6, 0x78, 0x6b, 0xbf, + 0xb6, 0x82, 0xef, 0x70, 0x77, 0xfc, 0x03, 0x93, 0x5a, 0x66, 0x65, 0x11, 0xa3, 0xa8, 0x73, 0xa9, + 0x4c, 0x8a, 0x3a, 0x49, 0x50, 0x08, 0x34, 0xa3, 0xe9, 0xc7, 0x57, 0x00, 0x7b, 0x06, 0x2e, 0x12, + 0x95, 0x24, 0x3c, 0x5b, 0x9b, 0x7c, 0xd0, 0x9a, 0xc4, 0xee, 0x95, 0xb1, 0x62, 0xe3, 0x56, 0x14, + 0x44, 0xb0, 0xb9, 0xcc, 0xdc, 0xd8, 0xd4, 0x16, 0x38, 0x48, 0xd4, 0x3a, 0x53, 0xc7, 0xe8, 0xa7, + 0x0d, 0x1b, 0x66, 0x09, 0xc7, 0x48, 0xe7, 0x59, 0x82, 0x6c, 0x1f, 0xdc, 0x8f, 0x84, 0x5c, 0x22, + 0x1b, 0x84, 0x26, 0x12, 0x61, 0x17, 0x89, 0xf0, 0x58, 0x52, 0x56, 0xa4, 0x5f, 0xd5, 0x1f, 0xf9, + 0xcb, 0x2b, 0x64, 0xcf, 0xa1, 0xa7, 0x57, 0xfd, 0xf0, 0xc6, 0xa5, 0xb1, 0x0a, 0x99, 0x7f, 0x6f, + 0x49, 0xae, 0xa5, 0x11, 0x38, 0x9f, 0x50, 0xfe, 0x5f, 0x9b, 0xf7, 0xb0, 0x36, 0xa1, 0xba, 0x48, + 0xfe, 0xed, 0xef, 0x2f, 0x46, 0xd8, 0x3b, 0x70, 0x47, 0x98, 0xe3, 0x6d, 0xef, 0x47, 0x9f, 0x61, + 0xfb, 0x20, 0x51, 0x23, 0x16, 0x3a, 0x2b, 0xdd, 0xd8, 0x5e, 0xc2, 0xea, 0x84, 0xb2, 0x34, 0x45, + 0x62, 0xdb, 0x7f, 0xc8, 0x92, 0x7a, 0x4e, 0x83, 0xd7, 0x12, 0xf0, 0x61, 0xe7, 0xdb, 0xe0, 0x64, + 0x9a, 0x0c, 0x45, 0x33, 0xaf, 0x4e, 0xcb, 0xa2, 0x19, 0x6a, 0x95, 0xf9, 0xa6, 0x54, 0x25, 0x53, + 0x57, 0xb7, 0x7f, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x93, 0x0e, 0xd2, 0x9b, 0xce, 0x03, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -297,6 +396,26 @@ type TenantServiceServer interface { Delete(context.Context, *wrappers.StringValue) (*empty.Empty, error) } +// UnimplementedTenantServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTenantServiceServer struct { +} + +func (*UnimplementedTenantServiceServer) Create(ctx context.Context, req *wrappers.StringValue) (*Tenant, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (*UnimplementedTenantServiceServer) List(ctx context.Context, req *empty.Empty) (*TenantList, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedTenantServiceServer) Get(ctx context.Context, req *wrappers.StringValue) (*Tenant, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (*UnimplementedTenantServiceServer) Truncate(ctx context.Context, req *wrappers.StringValue) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Truncate not implemented") +} +func (*UnimplementedTenantServiceServer) Delete(ctx context.Context, req *wrappers.StringValue) (*empty.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} + func RegisterTenantServiceServer(s *grpc.Server, srv TenantServiceServer) { s.RegisterService(&_TenantService_serviceDesc, srv) } @@ -424,7 +543,7 @@ var _TenantService_serviceDesc = grpc.ServiceDesc{ // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ActionsAlertServiceClient interface { - Trigger(ctx context.Context, in *AlertPayload, opts ...grpc.CallOption) (*empty.Empty, error) + Trigger(ctx context.Context, in *AlertPayload, opts ...grpc.CallOption) (*ExecutionResult, error) } type actionsAlertServiceClient struct { @@ -435,8 +554,8 @@ func NewActionsAlertServiceClient(cc *grpc.ClientConn) ActionsAlertServiceClient return &actionsAlertServiceClient{cc} } -func (c *actionsAlertServiceClient) Trigger(ctx context.Context, in *AlertPayload, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) +func (c *actionsAlertServiceClient) Trigger(ctx context.Context, in *AlertPayload, opts ...grpc.CallOption) (*ExecutionResult, error) { + out := new(ExecutionResult) err := c.cc.Invoke(ctx, "/graph.ActionsAlertService/Trigger", in, out, opts...) if err != nil { return nil, err @@ -446,7 +565,15 @@ func (c *actionsAlertServiceClient) Trigger(ctx context.Context, in *AlertPayloa // ActionsAlertServiceServer is the server API for ActionsAlertService service. type ActionsAlertServiceServer interface { - Trigger(context.Context, *AlertPayload) (*empty.Empty, error) + Trigger(context.Context, *AlertPayload) (*ExecutionResult, error) +} + +// UnimplementedActionsAlertServiceServer can be embedded to have forward compatible implementations. +type UnimplementedActionsAlertServiceServer struct { +} + +func (*UnimplementedActionsAlertServiceServer) Trigger(ctx context.Context, req *AlertPayload) (*ExecutionResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method Trigger not implemented") } func RegisterActionsAlertServiceServer(s *grpc.Server, srv ActionsAlertServiceServer) { diff --git a/symphony/graph/graphgrpc/rpc.proto b/symphony/graph/graphgrpc/rpc.proto index 2e75d9bb4b90..fee5a890cfa3 100644 --- a/symphony/graph/graphgrpc/rpc.proto +++ b/symphony/graph/graphgrpc/rpc.proto @@ -29,7 +29,7 @@ message TenantList { } service ActionsAlertService { - rpc Trigger(AlertPayload) returns (google.protobuf.Empty); + rpc Trigger(AlertPayload) returns (ExecutionResult); } message AlertPayload { @@ -38,3 +38,13 @@ message AlertPayload { string networkID = 3; map labels = 4; } + +message ExecutionResult { + repeated string successes = 1; + repeated executionError errors = 2; +} + +message executionError { + string id = 1; + string err = 2; +} diff --git a/symphony/pkg/actions/context.go b/symphony/pkg/actions/context.go index f19c5f6462c6..8324301d701c 100644 --- a/symphony/pkg/actions/context.go +++ b/symphony/pkg/actions/context.go @@ -38,8 +38,8 @@ func (c *Client) Triggers() []core.Trigger { } // Execute delegates to executor.Execute -func (c *Client) Execute(ctx context.Context, objectID string, triggerToPayload map[core.TriggerID]map[string]interface{}) { - c.executor.Execute(ctx, objectID, triggerToPayload) +func (c *Client) Execute(ctx context.Context, objectID string, triggerToPayload map[core.TriggerID]map[string]interface{}) executor.ExecutionResult { + return c.executor.Execute(ctx, objectID, triggerToPayload) } type contextKey struct{} diff --git a/symphony/pkg/actions/executor/executor.go b/symphony/pkg/actions/executor/executor.go index 7cb4dc206b79..0f1a48324eba 100644 --- a/symphony/pkg/actions/executor/executor.go +++ b/symphony/pkg/actions/executor/executor.go @@ -19,11 +19,12 @@ type Executor struct { } // Execute runs all workflows for the specified object/trigger -func (exc Executor) Execute(ctx context.Context, objectID string, triggerToPayload map[core.TriggerID]map[string]interface{}) { +func (exc Executor) Execute(ctx context.Context, objectID string, triggerToPayload map[core.TriggerID]map[string]interface{}) ExecutionResult { // Note that we should keep this interface serializable, so if we need to eventually // offload this to workers, we can + execResult := ExecutionResult{} for triggerID, inputPayload := range triggerToPayload { trigger, err := exc.Registry.TriggerForID(triggerID) if err != nil { @@ -50,10 +51,14 @@ func (exc Executor) Execute(ctx context.Context, objectID string, triggerToPaylo err := exc.executeAction(rule, ruleAction, inputPayload) if err != nil { exc.OnError(ctx, errors.Errorf("executing action %s: %v", ruleAction.ActionID, err)) + execResult.Errors = append(execResult.Errors, ExecutionError{ruleAction.ActionID, err.Error()}) + } else { + execResult.Successes = append(execResult.Successes, ruleAction.ActionID) } } } } + return execResult } func (exc Executor) executeAction(rule core.Rule, ruleAction *core.ActionsRuleAction, inputPayload map[string]interface{}) error { @@ -72,3 +77,15 @@ func (exc Executor) executeAction(rule core.Rule, ruleAction *core.ActionsRuleAc } return nil } + +// ExecutionResult stores the results of a call to Execute +type ExecutionResult struct { + Successes []core.ActionID + Errors []ExecutionError +} + +// ExecutionError holds an ActionID with the error associated with it +type ExecutionError struct { + ID core.ActionID + Error string +} diff --git a/symphony/pkg/actions/executor/executor_test.go b/symphony/pkg/actions/executor/executor_test.go index 05ea5bb284a3..1fa250d4c3c6 100644 --- a/symphony/pkg/actions/executor/executor_test.go +++ b/symphony/pkg/actions/executor/executor_test.go @@ -6,6 +6,7 @@ package executor import ( "context" + "errors" "testing" "github.com/facebookincubator/symphony/pkg/actions/action/mockaction" @@ -18,6 +19,7 @@ import ( var ( testActionID1 core.ActionID = "action1" + testActionID2 core.ActionID = "action2" testTriggerID1 core.TriggerID = "trigger1" testTriggerID2 core.TriggerID = "trigger2" @@ -57,40 +59,60 @@ func TestExecutor(t *testing.T) { }, } + testErrRule := core.Rule{ + ID: "errRule", + TriggerID: testTriggerID2, + RuleActions: []*core.ActionsRuleAction{ + { + ActionID: testActionID2, + Data: "testdata", + }, + }, + } + trigger1 := mocktrigger.New() trigger1.On("ID").Return(testTriggerID1) trigger1.On("SupportedFilters").Return([]core.Filter{networkIDFilter}) trigger2 := mocktrigger.New() trigger2.On("ID").Return(testTriggerID2) - trigger1.On("SupportedFilters").Return([]core.Filter{networkIDFilter}) + trigger2.On("SupportedFilters").Return([]core.Filter{networkIDFilter}) action := mockaction.New() action.On("ID").Return(testActionID1) action.On("Execute", mock.Anything).Return(nil) + errAction := mockaction.New() + errAction.On("ID").Return(testActionID2) + errAction.On("Execute", mock.Anything).Return(errors.New("error")) + registry := NewRegistry() registry.MustRegisterAction(action) + registry.MustRegisterAction(errAction) registry.MustRegisterTrigger(trigger1) registry.MustRegisterTrigger(trigger2) exc := Executor{ Registry: registry, DataLoader: BasicDataLoader{ - Rules: []core.Rule{testRule}, - }, - OnError: func(ctx context.Context, err error) { - assert.Fail(t, "error in test when shouldnt be", err) + Rules: []core.Rule{testRule, testErrRule}, }, + OnError: func(ctx context.Context, err error) {}, } triggers := map[core.TriggerID]map[string]interface{}{ testTriggerID1: payload1, testTriggerID2: payload1, } - exc.Execute(context.Background(), "id123", triggers) + res := exc.Execute(context.Background(), "id123", triggers) + assert.Equal(t, []core.ActionID{action.ID()}, res.Successes) + assert.Equal(t, []ExecutionError{{ + ID: errAction.ID(), + Error: "executing action2: error", + }}, res.Errors) action.AssertNumberOfCalls(t, "Execute", 1) + errAction.AssertNumberOfCalls(t, "Execute", 1) } func TestExecutorRuleFilter(t *testing.T) { @@ -139,7 +161,9 @@ func TestExecutorRuleFilter(t *testing.T) { triggers := map[core.TriggerID]map[string]interface{}{ testTriggerID1: payload1, } - exc.Execute(context.Background(), "id123", triggers) + res := exc.Execute(context.Background(), "id123", triggers) + assert.Len(t, res.Successes, 0) + assert.Len(t, res.Errors, 0) action.AssertNumberOfCalls(t, "Execute", 0) } @@ -166,7 +190,9 @@ func TestExecutorUnregisteredTrigger(t *testing.T) { testTriggerID1: payload1, testTriggerID2: payload1, } - exc.Execute(context.Background(), "id123", triggers) + res := exc.Execute(context.Background(), "id123", triggers) + assert.Len(t, res.Successes, 0) + assert.Len(t, res.Errors, 0) mockErrorHandler.AssertNumberOfCalls(t, "LogError", 1) } From 41b128cb3b0f33b8253ec2d166d03e404e4c9b09 Mon Sep 17 00:00:00 2001 From: Murtadha Al-Tameemi Date: Thu, 16 Jan 2020 19:29:06 -0800 Subject: [PATCH 20/26] Fix issue with gateway status Summary: Not sure this is the best way to fix this, we basically can't compute the status on the fly each time, so need to compute it when we fetch the data from the server Reviewed By: rckclmbr Differential Revision: D19401561 fbshipit-source-id: cfa9e58bf64422b8014dd6477a2c2504468c2acd --- .../fbcnms-packages/fbcnms-ui/hooks/index.js | 1 + .../fbcnms-ui/hooks/useInterval.js | 32 +++++++++++++++++++ .../app/components/cwf/CWFGateways.js | 7 +++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/hooks/index.js b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/index.js index a8330cfe275d..a620f23d5085 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/hooks/index.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/index.js @@ -12,3 +12,4 @@ export {default as useAxios} from './useAxios'; export {default as useRouter} from './useRouter'; export {default as useSnackbar} from './useSnackbar'; export {default as useGraphQL} from './useGraphQL'; +export {default as useInterval} from './useInterval'; diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js new file mode 100644 index 000000000000..107966aadbf2 --- /dev/null +++ b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js @@ -0,0 +1,32 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +import {useEffect, useRef} from 'react'; + +// from https://overreacted.io/making-setinterval-declarative-with-react-hooks/ +export default function useInterval(callback: () => void, delay: number) { + const savedCallback = useRef void>(); + + // Remember the latest callback. + useEffect(() => { + savedCallback.current = callback; + }, [callback]); + + // Set up the interval. + useEffect(() => { + function tick() { + savedCallback.current && savedCallback.current(); + } + if (delay !== null) { + const id = setInterval(tick, delay); + return () => clearInterval(id); + } + }, [delay]); +} diff --git a/symphony/app/fbcnms-projects/magmalte/app/components/cwf/CWFGateways.js b/symphony/app/fbcnms-projects/magmalte/app/components/cwf/CWFGateways.js index b869ee65a9ba..208458641b9f 100644 --- a/symphony/app/fbcnms-projects/magmalte/app/components/cwf/CWFGateways.js +++ b/symphony/app/fbcnms-projects/magmalte/app/components/cwf/CWFGateways.js @@ -41,7 +41,7 @@ import {findIndex} from 'lodash'; import {makeStyles} from '@material-ui/styles'; import {map} from 'lodash'; import {useCallback, useState} from 'react'; -import {useRouter} from '@fbcnms/ui/hooks'; +import {useInterval, useRouter} from '@fbcnms/ui/hooks'; const useStyles = makeStyles(theme => ({ header: { @@ -81,11 +81,13 @@ const useStyles = makeStyles(theme => ({ })); const FIVE_MINS = 5 * 60 * 1000; +const REFRESH_INTERVAL = 2 * 60 * 1000; function CWFGateways(props: WithAlert & {}) { const [gateways, setGateways] = useState(null); const [expanded, setExpanded] = useState>(new Set()); const {match, history, relativePath, relativeUrl} = useRouter(); + const [lastFetchTime, setLastFetchTime] = useState(Date.now()); const networkId = nullthrows(match.params.networkId); const classes = useStyles(); @@ -93,8 +95,11 @@ function CWFGateways(props: WithAlert & {}) { MagmaV1API.getCwfByNetworkIdGateways, {networkId}, useCallback(response => setGateways(map(response, g => g)), []), + lastFetchTime, ); + useInterval(() => setLastFetchTime(Date.now()), REFRESH_INTERVAL); + if (!gateways || isLoading) { return ; } From 514da1e4bf74f4ca496660c7fe38c31df4fd37c6 Mon Sep 17 00:00:00 2001 From: Murtadha Al-Tameemi Date: Thu, 16 Jan 2020 19:29:06 -0800 Subject: [PATCH 21/26] Update setInterval to useInterval Reviewed By: rckclmbr Differential Revision: D19416826 fbshipit-source-id: a2ce23004855aedd0723f822a91d403a9e2d8fd0 --- .../fbcnms-ui/hooks/useInterval.js | 6 +++-- .../components/devices/DevicesStatusTable.js | 27 +++++++++---------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js index 107966aadbf2..5fcbd7b7d980 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/hooks/useInterval.js @@ -10,9 +10,11 @@ import {useEffect, useRef} from 'react'; +type TFunction = () => void | Promise; + // from https://overreacted.io/making-setinterval-declarative-with-react-hooks/ -export default function useInterval(callback: () => void, delay: number) { - const savedCallback = useRef void>(); +export default function useInterval(callback: TFunction, delay: number) { + const savedCallback = useRef(); // Remember the latest callback. useEffect(() => { diff --git a/symphony/app/fbcnms-projects/magmalte/app/components/devices/DevicesStatusTable.js b/symphony/app/fbcnms-projects/magmalte/app/components/devices/DevicesStatusTable.js index c2ad4b6eb43a..f6997bcb348b 100644 --- a/symphony/app/fbcnms-projects/magmalte/app/components/devices/DevicesStatusTable.js +++ b/symphony/app/fbcnms-projects/magmalte/app/components/devices/DevicesStatusTable.js @@ -30,8 +30,8 @@ import {Route} from 'react-router-dom'; import nullthrows from '@fbcnms/util/nullthrows'; import {augmentDevicesMap} from './DevicesUtils'; import {makeStyles} from '@material-ui/styles'; -import {useCallback, useEffect, useState} from 'react'; -import {useRouter} from '@fbcnms/ui/hooks'; +import {useCallback, useState} from 'react'; +import {useInterval, useRouter} from '@fbcnms/ui/hooks'; const useStyles = makeStyles(theme => ({ actionsColumn: { @@ -74,19 +74,16 @@ export default function DevicesStatusTable() { useCallback(response => setDevices(response || {}), []), ); - useEffect(() => { - const interval = setInterval(async () => { - try { - const response = await MagmaV1API.getSymphonyByNetworkIdDevices({ - networkId: nullthrows(match.params.networkId), - }); - setDevices(response || {}); - } catch (err) { - console.error(`Warning: cannot refresh'. ${err}`); - } - }, REFRESH_INTERVAL); - return () => clearInterval(interval); - }, [match]); + useInterval(async () => { + try { + const response = await MagmaV1API.getSymphonyByNetworkIdDevices({ + networkId: nullthrows(match.params.networkId), + }); + setDevices(response || {}); + } catch (err) { + console.error(`Warning: cannot refresh'. ${err}`); + } + }, REFRESH_INTERVAL); let errorMessage = null; let fullDevices = {}; From c20abfd355dfd72ca20dc9b7ad6e55081661f257 Mon Sep 17 00:00:00 2001 From: Murtadha Al-Tameemi Date: Thu, 16 Jan 2020 23:23:17 -0800 Subject: [PATCH 22/26] Fix inconsistency in new survey category Reviewed By: apbuteau Differential Revision: D19439150 fbshipit-source-id: c8e615aa4906c361ed5452fcdf7594dec7ff8f9c --- .../components/configure/AddEditLocationTypeCard.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditLocationTypeCard.js b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditLocationTypeCard.js index 9609fce2882a..926932ce922f 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditLocationTypeCard.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditLocationTypeCard.js @@ -513,15 +513,7 @@ class AddEditLocationTypeCard extends React.Component { id: 'Category@tmp', categoryTitle: '', categoryDescription: '', - surveyTemplateQuestions: [ - { - id: 'Question@tmp', - questionTitle: '', - questionDescription: '', - questionType: 'BOOL', - index: 0, - }, - ], + surveyTemplateQuestions: [], }, ], }; From b0950e921af4a859eaaa1ca076a21ca0115255b7 Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Fri, 17 Jan 2020 00:06:35 -0800 Subject: [PATCH 23/26] Fix default property row not showing on service and work order types Reviewed By: rckclmbr Differential Revision: D19427934 fbshipit-source-id: fea9b4d8f646069105b482f42ba7271a7b187da9 --- .../configure/AddEditServiceTypeCard.js | 35 +++++++++-------- .../configure/AddEditWorkOrderTypeCard.js | 39 ++++++++++--------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditServiceTypeCard.js b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditServiceTypeCard.js index 607a5a95a75d..4803edc74e59 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditServiceTypeCard.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditServiceTypeCard.js @@ -324,22 +324,25 @@ class AddEditServiceTypeCard extends React.Component { id: editingServiceType?.id ?? 'ServiceType@tmp0', name: editingServiceType?.name ?? '', numberOfServices: editingServiceType?.numberOfServices ?? 0, - propertyTypes: propertyTypes || [ - { - id: 'PropertyType@tmp', - name: '', - type: 'string', - index: editingServiceType?.propertyTypes?.length ?? 0, - booleanValue: false, - stringValue: null, - intValue: null, - floatValue: null, - latitudeValue: null, - longitudeValue: null, - isEditable: true, - isInstanceProperty: true, - }, - ], + propertyTypes: + propertyTypes.length > 0 + ? propertyTypes + : [ + { + id: 'PropertyType@tmp', + name: '', + type: 'string', + index: editingServiceType?.propertyTypes?.length ?? 0, + booleanValue: false, + stringValue: null, + intValue: null, + floatValue: null, + latitudeValue: null, + longitudeValue: null, + isEditable: true, + isInstanceProperty: true, + }, + ], }; } } diff --git a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditWorkOrderTypeCard.js b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditWorkOrderTypeCard.js index 8ae27e5b858c..bf5cf426e42e 100644 --- a/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditWorkOrderTypeCard.js +++ b/symphony/app/fbcnms-projects/inventory/app/components/configure/AddEditWorkOrderTypeCard.js @@ -435,24 +435,27 @@ class AddEditWorkOrderTypeCard extends React.Component { name: editingWorkOrderType?.name ?? '', description: editingWorkOrderType?.description, numberOfWorkOrders: editingWorkOrderType?.numberOfWorkOrders ?? 0, - propertyTypes: propertyTypes || [ - { - id: 'PropertyType@tmp', - name: '', - index: editingWorkOrderType?.propertyTypes?.length ?? 0, - type: 'string', - booleanValue: false, - stringValue: null, - intValue: null, - floatValue: null, - latitudeValue: null, - longitudeValue: null, - isEditable: true, - isMandatory: false, - isInstanceProperty: true, - isDeleted: false, - }, - ], + propertyTypes: + propertyTypes.length > 0 + ? propertyTypes + : [ + { + id: 'PropertyType@tmp', + name: '', + index: editingWorkOrderType?.propertyTypes?.length ?? 0, + type: 'string', + booleanValue: false, + stringValue: null, + intValue: null, + floatValue: null, + latitudeValue: null, + longitudeValue: null, + isEditable: true, + isMandatory: false, + isInstanceProperty: true, + isDeleted: false, + }, + ], checkListDefinitions: checkListDefinitions, }; } From b87d21d2325fb68cd35d2ed598075bdd2789fede Mon Sep 17 00:00:00 2001 From: Oriol Batalla Date: Fri, 17 Jan 2020 01:40:46 -0800 Subject: [PATCH 24/26] Addition of eventlet in python dependencies for AGW v.0.24 Summary: Python Ryu 4.50 breaks python eventlet 0.23. So we have to avoid that version. Setup.py contains the python dependencies to build AGW. Adding this line to the setup.py will force an evenl version higher than 0.23 Reviewed By: tmdzk Differential Revision: D19442865 fbshipit-source-id: 1a5d637503e0e5320481def6ac532ca38e54fe8f --- lte/gateway/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lte/gateway/python/setup.py b/lte/gateway/python/setup.py index 083da521cb64..22d5c2d0e256 100644 --- a/lte/gateway/python/setup.py +++ b/lte/gateway/python/setup.py @@ -95,7 +95,7 @@ 'idna==2.8', 'python-dateutil==2.8', 'six>=1.12.0', - 'eventlet!=0.23' + 'eventlet>=0.24' ], extras_require={ 'dev': [ From 0846dfe553e1ffb98822791dab7f323e6f83ff62 Mon Sep 17 00:00:00 2001 From: Jacky Tian Date: Fri, 17 Jan 2020 01:41:16 -0800 Subject: [PATCH 25/26] Update charts for terraform-based helm deploy. Summary: - Append module name to configs secret volumes to allow using the same secret for different module configs - Bump chart versions and dependencies Reviewed By: alexsn Differential Revision: D19441883 fbshipit-source-id: 0a32834e9a86905132cab1d65f6480827d47aa49 --- orc8r/cloud/helm/orc8r/Chart.yaml | 2 +- orc8r/cloud/helm/orc8r/charts/metrics/Chart.yaml | 2 +- orc8r/cloud/helm/orc8r/requirements.lock | 2 +- orc8r/cloud/helm/orc8r/requirements.yaml | 2 +- orc8r/cloud/helm/orc8r/templates/controller.deployment.yaml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/orc8r/cloud/helm/orc8r/Chart.yaml b/orc8r/cloud/helm/orc8r/Chart.yaml index ced5c2d05c80..f1d5d8e89ef9 100644 --- a/orc8r/cloud/helm/orc8r/Chart.yaml +++ b/orc8r/cloud/helm/orc8r/Chart.yaml @@ -9,7 +9,7 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for magma orchestrator name: orc8r -version: 1.2.2 +version: 1.3.3 engine: gotpl sources: - https://github.com/facebookincubator/magma diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/Chart.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/Chart.yaml index 9b3d64130267..0423587d0121 100644 --- a/orc8r/cloud/helm/orc8r/charts/metrics/Chart.yaml +++ b/orc8r/cloud/helm/orc8r/charts/metrics/Chart.yaml @@ -9,7 +9,7 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for magma metrics name: metrics -version: 1.2.1 +version: 1.3.0 engine: gotpl sources: - https://github.com/facebookincubator/magma diff --git a/orc8r/cloud/helm/orc8r/requirements.lock b/orc8r/cloud/helm/orc8r/requirements.lock index b4451006b4eb..6619be48426f 100644 --- a/orc8r/cloud/helm/orc8r/requirements.lock +++ b/orc8r/cloud/helm/orc8r/requirements.lock @@ -4,7 +4,7 @@ dependencies: version: 0.1.3 - name: metrics repository: "" - version: 1.2.1 + version: 1.3.0 - name: nms repository: "" version: 0.1.0 diff --git a/orc8r/cloud/helm/orc8r/requirements.yaml b/orc8r/cloud/helm/orc8r/requirements.yaml index f6968d548561..c707e0e77083 100644 --- a/orc8r/cloud/helm/orc8r/requirements.yaml +++ b/orc8r/cloud/helm/orc8r/requirements.yaml @@ -11,7 +11,7 @@ dependencies: repository: "" condition: secrets.create - name: metrics - version: 1.2.1 + version: 1.3.0 repository: "" condition: metrics.enabled - name: nms diff --git a/orc8r/cloud/helm/orc8r/templates/controller.deployment.yaml b/orc8r/cloud/helm/orc8r/templates/controller.deployment.yaml index bf3067aeb6ad..9aeb968e51f2 100644 --- a/orc8r/cloud/helm/orc8r/templates/controller.deployment.yaml +++ b/orc8r/cloud/helm/orc8r/templates/controller.deployment.yaml @@ -51,7 +51,7 @@ spec: secretName: {{ required "secret.envdir must be provided" .Values.secret.envdir }} {{- if .Values.secret.configs }} {{- range $module, $secretName := .Values.secret.configs }} - - name: {{ $secretName }} + - name: {{ $secretName }}-{{ $module }} secret: secretName: {{ $secretName }} {{- end }} @@ -71,7 +71,7 @@ spec: {{- end }} {{- if .Values.secret.configs }} {{- range $module, $secretName := .Values.secret.configs }} - - name: {{ $secretName }} + - name: {{ $secretName }}-{{ $module }} mountPath: {{ print "/var/opt/magma/configs/" $module }} readOnly: true {{- end }} From f433a72cfa4f72fada336a9c423a0b80ef94f3cc Mon Sep 17 00:00:00 2001 From: rsarwad Date: Fri, 17 Jan 2020 15:24:32 +0530 Subject: [PATCH 26/26] Addressed review comments --- .../c/oai/tasks/mme_app/mme_app_bearer.c | 140 +++++++----------- .../c/oai/tasks/mme_app/mme_app_context.c | 21 +-- .../c/oai/tasks/mme_app/mme_app_defs.h | 29 ++-- .../c/oai/tasks/mme_app/mme_app_sgs_detach.c | 83 ++++------- .../mme_app/mme_app_sgsap_location_update.c | 14 +- .../c/oai/tasks/nas/emm/Authentication.c | 12 +- .../c/oai/tasks/nas/esm/esm_data_context.c | 4 +- lte/gateway/c/oai/tasks/nas/util/nas_timer.c | 2 + 8 files changed, 110 insertions(+), 195 deletions(-) diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c index a54e593412a5..d05599d7f00d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c @@ -695,7 +695,7 @@ void mme_app_handle_initial_ue_message(mme_app_desc_t *mme_app_desc_p, /* * Error during ue context malloc */ - DevMessage("mme_create_new_ue_context"); + OAILOG_ERROR(LOG_MME_APP, "Failed to create new ue context \n"); OAILOG_FUNC_OUT(LOG_MME_APP); } is_mm_ctx_new = true; @@ -1628,26 +1628,17 @@ void mme_app_handle_e_rab_setup_rsp( void mme_app_handle_mobile_reachability_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "Mobile reachability timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Mobile Reachability Timer expired, but no assoicated UE context found" - " for ue-id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } ue_context_p->mobile_reachability_timer.id = MME_APP_TIMER_INACTIVE_ID; - OAILOG_INFO( - LOG_MME_APP, - "Expired- Mobile Reachability Timer for ue_id:" MME_UE_S1AP_ID_FMT " \n", - ue_context_p->mme_ue_s1ap_id); + // Start Implicit Detach timer nas_itti_timer_arg_t timer_callback_fun = {0}; timer_callback_fun.nas_timer_callback = @@ -1685,28 +1676,16 @@ void mme_app_handle_mobile_reachability_timer_expiry(void* args) void mme_app_handle_implicit_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "Implicit detach timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Implicit Detach Timer expired, but no assoicated UE context for" - "ue-id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - - OAILOG_INFO( - LOG_MME_APP, - "Implicit Detach timer expired for UE id" MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); ue_context_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; - // Initiate Implicit Detach for the UE nas_proc_implicit_detach_ue_ind(mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); @@ -1716,27 +1695,15 @@ void mme_app_handle_implicit_detach_timer_expiry(void* args) void mme_app_handle_initial_context_setup_rsp_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "Initial context setup response timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Initial context setup rsp Timer expired, but no assoicated UE context found" - " for ue_id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - - - OAILOG_ERROR( - LOG_MME_APP, - "Expired- Initial context setup rsp timer for UE id %d \n", - mme_ue_s1ap_id); ue_context_p->initial_context_setup_rsp_timer.id = MME_APP_TIMER_INACTIVE_ID; /* *********Abort the ongoing procedure********* * Check if UE is registered already that implies service request procedure is active. If so then release the S1AP @@ -2055,27 +2022,13 @@ int mme_app_handle_initial_paging_request(mme_app_desc_t *mme_app_desc_p, void mme_app_handle_paging_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); struct ue_mm_context_s* ue_context_p = NULL; + ue_context_p = mme_app_get_ue_context(mme_ue_s1ap_id, "Paging timer"); - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Paging Timer expired, but no assoicated UE context found" - " for ue_id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - - OAILOG_ERROR( - LOG_MME_APP, - "Paging Timer expired for ue_id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); - ue_context_p->paging_response_timer.id = MME_APP_TIMER_INACTIVE_ID; if ((mme_app_paging_request_helper( ue_context_p, false, true /* s-tmsi */, CN_DOMAIN_PS)) != RETURNok) { @@ -2090,26 +2043,15 @@ void mme_app_handle_paging_timer_expiry(void* args) void mme_app_handle_ulr_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "Update location timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Update Location Timer expired, but no assoicated UE context found" - " for ue_id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - - OAILOG_ERROR( - LOG_MME_APP, - "Update Location Timer expired for ue-id" MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); ue_context_p->ulr_response_timer.id = MME_APP_TIMER_INACTIVE_ID; // Send PDN CONNECTIVITY FAIL message to NAS layer @@ -2332,10 +2274,11 @@ int mme_app_handle_nas_extended_service_req( * not when SERVICE ABORT request is received from MSC/VLR */ ue_context_p->sgs_context->mt_call_in_progress = true; + /* If call_cancelled is set, send Service Reject to UE as MSC/VLR + * has triggered SGSAP SERVICE ABORT procedure + */ if (ue_context_p->sgs_context->call_cancelled) { - /* Sending Service Reject to UE as MSC/VLR has triggered - * SGSAP SERVICE ABORT - * If UE's ECM state is IDLE send + /* If UE's ECM state is IDLE send * service_reject in Establish cnf else send in DL NAS Transport */ if (ue_context_p->ecm_state == ECM_IDLE) { @@ -2418,26 +2361,15 @@ int mme_app_handle_nas_extended_service_req( void mme_app_handle_ue_context_modification_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "UE context modification timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "UE context modification Timer expired, but no assoicated UE context " - "found for ue-id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - - OAILOG_ERROR( - LOG_MME_APP, - "Expired- UE context modification timer for UE id %d \n", - mme_ue_s1ap_id); ue_context_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; if (ue_context_p->sgs_context != NULL) { @@ -3457,3 +3389,31 @@ void mme_app_update_paging_tai_list( } OAILOG_FUNC_OUT(LOG_MME_APP); } + +// Fetch UE context based on mme_ue_s1ap_id and return pointer to UE context +ue_mm_context_t* mme_app_get_ue_context( + mme_ue_s1ap_id_t mme_ue_s1ap_id, char* timer_name) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + mme_app_desc_t* mme_app_desc_p = NULL; + struct ue_mm_context_s* ue_context_p = NULL; + + OAILOG_ERROR(LOG_MME_APP, "Expired- %s for ue_id " MME_UE_S1AP_ID_FMT + "\n", + timer_name, + mme_ue_s1ap_id); + + mme_app_desc_p = get_mme_nas_state(false); + ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( + &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + if (ue_context_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to get ue context while handling %s for ue_id " + MME_UE_S1AP_ID_FMT "\n", + timer_name, + mme_ue_s1ap_id); + return NULL; + } + return ue_context_p; +} diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c index 2484bc904709..291672501a50 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_context.c @@ -143,21 +143,16 @@ ue_mm_context_t* mme_create_new_ue_context(void) new_p->mobile_reachability_timer.id = MME_APP_TIMER_INACTIVE_ID; new_p->implicit_detach_timer.id = MME_APP_TIMER_INACTIVE_ID; - new_p->initial_context_setup_rsp_timer.id = MME_APP_TIMER_INACTIVE_ID; - new_p->initial_context_setup_rsp_timer.sec = - MME_APP_INITIAL_CONTEXT_SETUP_RSP_TIMER_VALUE; - new_p->paging_response_timer.id = MME_APP_TIMER_INACTIVE_ID; - new_p->paging_response_timer.sec = MME_APP_PAGING_RESPONSE_TIMER_VALUE; - new_p->ulr_response_timer.id = MME_APP_TIMER_INACTIVE_ID; - new_p->ulr_response_timer.sec = MME_APP_ULR_RESPONSE_TIMER_VALUE; - new_p->ue_context_modification_timer.id = MME_APP_TIMER_INACTIVE_ID; - new_p->ue_context_modification_timer.sec = - MME_APP_UE_CONTEXT_MODIFICATION_TIMER_VALUE; + new_p->initial_context_setup_rsp_timer = (struct mme_app_timer_t) { + MME_APP_TIMER_INACTIVE_ID, MME_APP_INITIAL_CONTEXT_SETUP_RSP_TIMER_VALUE}; + new_p->paging_response_timer = (struct mme_app_timer_t) { + MME_APP_TIMER_INACTIVE_ID, MME_APP_PAGING_RESPONSE_TIMER_VALUE}; + new_p->ulr_response_timer = (struct mme_app_timer_t) { + MME_APP_TIMER_INACTIVE_ID, MME_APP_ULR_RESPONSE_TIMER_VALUE}; + new_p->ue_context_modification_timer = (struct mme_app_timer_t) { + MME_APP_TIMER_INACTIVE_ID, MME_APP_UE_CONTEXT_MODIFICATION_TIMER_VALUE}; new_p->ue_context_rel_cause = S1AP_INVALID_CAUSE; - new_p->send_ue_purge_request = false; - new_p->hss_initiated_detach = false; - new_p->location_info_confirmed_in_hss = false; new_p->sgs_context = NULL; return new_p; } diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h index 2d1fb2d4ac05..eaccd3e2e1c2 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h @@ -146,16 +146,13 @@ void mme_ue_context_update_ue_sig_connection_state( struct ue_mm_context_s *ue_context_p, ecm_state_t new_ecm_state); -void mme_app_handle_mobile_reachability_timer_expiry( - void *args); +void mme_app_handle_mobile_reachability_timer_expiry(void* args); -void mme_app_handle_implicit_detach_timer_expiry( - void *args); +void mme_app_handle_implicit_detach_timer_expiry(void* args); -void mme_app_handle_initial_context_setup_rsp_timer_expiry( - void *args); +void mme_app_handle_initial_context_setup_rsp_timer_expiry(void* args); -void mme_app_handle_ue_context_modification_timer_expiry(void *args); +void mme_app_handle_ue_context_modification_timer_expiry(void* args); void mme_app_handle_enb_reset_req( const itti_s1ap_enb_initiated_reset_req_t const *enb_reset_req); @@ -163,13 +160,13 @@ void mme_app_handle_enb_reset_req( int mme_app_handle_initial_paging_request(mme_app_desc_t *mme_app_desc_p, const char *imsi); -void mme_app_handle_paging_timer_expiry(void *args); -void mme_app_handle_ulr_timer_expiry(void *args); +void mme_app_handle_paging_timer_expiry(void* args); +void mme_app_handle_ulr_timer_expiry(void* args); -void mme_app_handle_sgs_eps_detach_timer_expiry(void *args); -void mme_app_handle_sgs_imsi_detach_timer_expiry(void *args); -void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(void *args); -void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void *args); +void mme_app_handle_sgs_eps_detach_timer_expiry(void* args); +void mme_app_handle_sgs_imsi_detach_timer_expiry(void* args); +void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(void* args); +void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void* args); int mme_app_send_s6a_cancel_location_ans( int cla_result, @@ -213,7 +210,7 @@ int send_itti_sgsap_location_update_req(ue_mm_context_t *ue_context); int mme_app_handle_sgsap_location_update_rej(mme_app_desc_t *mme_app_desc_p, itti_sgsap_location_update_rej_t *const itti_sgsap_location_update_rej); -void mme_app_handle_ts6_1_timer_expiry(void * args); +void mme_app_handle_ts6_1_timer_expiry(void* args); int mme_app_handle_sgsap_reset_indication(mme_app_desc_t *mme_app_desc_p, itti_sgsap_vlr_reset_indication_t *const reset_indication_pP); @@ -316,6 +313,10 @@ int mme_app_create_sgs_context(ue_mm_context_t* ue_context_p); int map_sgs_emm_cause(SgsRejectCause_t sgs_cause); +ue_mm_context_t* mme_app_get_ue_context( + mme_ue_s1ap_id_t mme_ue_s1ap_id, + char* timer_name); + #define ATTACH_REQ (1 << 0) #define TAU_REQUEST (1 << 1) #define INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED 0x00 diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c index 719d09e757ed..4cbbf358aaef 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_detach.c @@ -97,17 +97,14 @@ static void mme_app_send_sgs_eps_detach_indication( itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); nas_itti_timer_arg_t timer_callback_fun = {0}; - if (detach_type == SGS_NW_INITIATED_IMSI_DETACH_FROM_EPS) { - timer_callback_fun.nas_timer_callback = - mme_app_handle_sgs_implicit_eps_detach_timer_expiry; - } else { - timer_callback_fun.nas_timer_callback = - mme_app_handle_sgs_eps_detach_timer_expiry; - } timer_callback_fun.nas_timer_callback_arg = (void *) &(ue_context_p->mme_ue_s1ap_id); + // Start SGS Implicit EPS Detach indication timer if (detach_type == SGS_NW_INITIATED_IMSI_DETACH_FROM_EPS) { + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_implicit_eps_detach_timer_expiry; + if (timer_setup( ue_context_p->sgs_context->ts13_timer.sec, 0, @@ -132,6 +129,9 @@ static void mme_app_send_sgs_eps_detach_indication( } } else { // Start SGS EPS Detach indication timer + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_eps_detach_timer_expiry; + if (timer_setup( ue_context_p->sgs_context->ts8_timer.sec, 0, @@ -174,23 +174,15 @@ static void mme_app_send_sgs_eps_detach_indication( OAILOG_FUNC_OUT(LOG_MME_APP); } -/* handle the SGS EPS detach timer expiry. */ +// handle the SGS EPS detach timer expiry void mme_app_handle_sgs_eps_detach_timer_expiry(void *args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s *ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context(mme_ue_s1ap_id, "sgs eps detach timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "SGS EPS Detach Timer expired but no assoicated UE context for UE " - "id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } if (ue_context_p->sgs_context == NULL) { @@ -236,26 +228,21 @@ void mme_app_handle_sgs_eps_detach_timer_expiry(void *args) OAILOG_FUNC_OUT(LOG_MME_APP); } -/* handle the SGS Implicit EPS detach timer expiry. */ +// handle the SGS Implicit EPS detach timer expiry void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "sgs implicit eps detach timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "SGS IMPLICIT EPS DETACH Timer expired but no assoicated UE context " - "found for ue-id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - if (ue_context_p->sgs_context == NULL) { + + if (ue_context_p->sgs_context == NULL) { OAILOG_ERROR( LOG_MME_APP, "SGS EPS Detach Timer expired but no assoicated SGS context for UE " @@ -267,7 +254,7 @@ void mme_app_handle_sgs_implicit_eps_detach_timer_expiry(void* args) * Increment the retransmission counter */ ue_context_p->sgs_context->ts13_retransmission_count += 1; - OAILOG_WARNING( + OAILOG_ERROR( LOG_NAS_EMM, "MME APP: Ts13 timer expired,retransmission " "counter = %u \n", @@ -334,17 +321,14 @@ void mme_app_send_sgs_imsi_detach_indication( itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); nas_itti_timer_arg_t timer_callback_fun = {0}; - if (detach_type == SGS_IMPLICIT_NW_INITIATED_IMSI_DETACH_FROM_EPS_N_NONEPS) { - timer_callback_fun.nas_timer_callback = - mme_app_handle_sgs_implicit_imsi_detach_timer_expiry; - } else { - timer_callback_fun.nas_timer_callback = - mme_app_handle_sgs_imsi_detach_timer_expiry; - } timer_callback_fun.nas_timer_callback_arg = (void *) &(ue_context_p->mme_ue_s1ap_id); + if (detach_type == SGS_IMPLICIT_NW_INITIATED_IMSI_DETACH_FROM_EPS_N_NONEPS) { // Start SGS Implicit IMSI Detach indication timer + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_implicit_imsi_detach_timer_expiry; + if (timer_setup( ue_context_p->sgs_context->ts10_timer.sec, 0, @@ -368,6 +352,9 @@ void mme_app_send_sgs_imsi_detach_indication( } } else { // Start SGS IMSI Detach indication timer + timer_callback_fun.nas_timer_callback = + mme_app_handle_sgs_imsi_detach_timer_expiry; + if (timer_setup( ue_context_p->sgs_context->ts9_timer.sec, 0, @@ -411,19 +398,13 @@ void mme_app_send_sgs_imsi_detach_indication( void mme_app_handle_sgs_imsi_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s *ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "sgs imsi detach timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "SGS IMSI Detach Timer expired but no assoicated UE context for UE " - "id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } if (ue_context_p->sgs_context == NULL) { @@ -496,19 +477,13 @@ void mme_app_handle_sgs_imsi_detach_timer_expiry(void* args) void mme_app_handle_sgs_implicit_imsi_detach_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t *) (args)); struct ue_mm_context_s *ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context( + mme_ue_s1ap_id, + "sgs implicit imsi detach timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "SGS IMPLICIT IMSI Detach Timer expired but no assoicated UE context for" - " ue_id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } if (ue_context_p->sgs_context == NULL) { diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c index e90feb0dd644..fe708f72f3bc 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c @@ -986,19 +986,11 @@ int sgs_fsm_la_updt_req_loc_updt_rej(const sgs_fsm_t* fsm_evt) void mme_app_handle_ts6_1_timer_expiry(void* args) { OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t* mme_app_desc_p = NULL; mme_ue_s1ap_id_t mme_ue_s1ap_id = *((mme_ue_s1ap_id_t*) (args)); struct ue_mm_context_s* ue_context_p = NULL; - mme_app_desc_p = get_mme_nas_state(false); - ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( - &mme_app_desc_p->mme_ue_contexts, mme_ue_s1ap_id); + ue_context_p = mme_app_get_ue_context(mme_ue_s1ap_id,"sgs ts6_1 timer"); if (ue_context_p == NULL) { - OAILOG_ERROR( - LOG_MME_APP, - "Ts6-1 Timer expired, but no assoicated UE context " - "found for ue-id " MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } if (ue_context_p->sgs_context == NULL) { @@ -1009,10 +1001,6 @@ void mme_app_handle_ts6_1_timer_expiry(void* args) mme_ue_s1ap_id); OAILOG_FUNC_OUT(LOG_MME_APP); } - OAILOG_ERROR( - LOG_MME_APP, - "Expired- Ts6-1 timer for ue_id:" MME_UE_S1AP_ID_FMT "\n", - mme_ue_s1ap_id); ue_context_p->sgs_context->ts6_1_timer.id = MME_APP_TIMER_INACTIVE_ID; ue_context_p->sgs_context->sgs_state = SGS_NULL; diff --git a/lte/gateway/c/oai/tasks/nas/emm/Authentication.c b/lte/gateway/c/oai/tasks/nas/emm/Authentication.c index 5f6bd45bf1f1..9544a06e1f0e 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Authentication.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Authentication.c @@ -1624,24 +1624,20 @@ static void _nas_itti_auth_info_req( ** ** ** Inputs: args: handler parameters ** ** ** - ** Outputs: ** - ** Return: None ** - ** Others: None ** - ** ** ************************************************************************/ -static void _s6a_auth_info_rsp_timer_expiry_handler(void *args) +static void _s6a_auth_info_rsp_timer_expiry_handler(void* args) { OAILOG_FUNC_IN(LOG_NAS_EMM); - emm_context_t *emm_ctx = (emm_context_t *) (args); + emm_context_t* emm_ctx = (emm_context_t *) (args); if (emm_ctx) { - nas_auth_info_proc_t *auth_info_proc = + nas_auth_info_proc_t* auth_info_proc = get_nas_cn_procedure_auth_info(emm_ctx); if (!auth_info_proc) { OAILOG_FUNC_OUT(LOG_NAS_EMM); } - void *timer_callback_args = NULL; + void* timer_callback_args = NULL; nas_stop_Ts6a_auth_info( auth_info_proc->ue_id, &auth_info_proc->timer_s6a, timer_callback_args); diff --git a/lte/gateway/c/oai/tasks/nas/esm/esm_data_context.c b/lte/gateway/c/oai/tasks/nas/esm/esm_data_context.c index 920b22d58ff5..8d1b230c2450 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/esm_data_context.c +++ b/lte/gateway/c/oai/tasks/nas/esm/esm_data_context.c @@ -116,9 +116,7 @@ void free_esm_context_content(esm_context_t *esm_ctx) if (esm_ctx) { nas_stop_T3489(esm_ctx); if (esm_ctx->esm_proc_data) { - if (esm_ctx->esm_proc_data->apn) { - bdestroy_wrapper(&esm_ctx->esm_proc_data->apn); - } + bdestroy_wrapper(&esm_ctx->esm_proc_data->apn); free_wrapper((void**)&esm_ctx->esm_proc_data); } } diff --git a/lte/gateway/c/oai/tasks/nas/util/nas_timer.c b/lte/gateway/c/oai/tasks/nas/util/nas_timer.c index 0145e7c853a0..a965011c4f3b 100644 --- a/lte/gateway/c/oai/tasks/nas/util/nas_timer.c +++ b/lte/gateway/c/oai/tasks/nas/util/nas_timer.c @@ -120,6 +120,8 @@ void mme_app_nas_timer_handle_signal_expiry( { OAILOG_FUNC_IN(LOG_NAS); if ((!timer_exists(timer_id)) || (cb->nas_timer_callback == NULL)) { + OAILOG_ERROR( + LOG_NAS, "Invalid timer id %ld \n", timer_id); OAILOG_FUNC_OUT(LOG_NAS); } cb->nas_timer_callback(cb->nas_timer_callback_arg);