diff --git a/CMakeLists.txt b/CMakeLists.txt index b54130b30a..9061f2f71c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,11 +300,7 @@ add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace" ON) add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace" ON) set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) -add_library(ITTI - ${OCP_ITTI}/intertask_interface.cpp - ${OPENAIR_DIR}/common/utils/backtrace.c - ) - +add_library(ITTI ${OCP_ITTI}/intertask_interface.cpp) target_link_libraries(ITTI PRIVATE asn1_nr_rrc asn1_lte_rrc) # asn1c skeletons have hardcoded this flag to make customized debug logs @@ -487,6 +483,7 @@ add_library(CONFIG_LIB ${CONFIG_ROOTDIR}/config_userapi.c ${CONFIG_ROOTDIR}/config_cmdline.c ) +target_link_libraries(CONFIG_LIB PRIVATE dl UTIL) add_library(params_libconfig MODULE ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c) target_link_libraries(params_libconfig config) # shared library loader @@ -783,7 +780,6 @@ add_library(UTIL ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/time_meas.c ${OPENAIR_DIR}/common/utils/time_stat.c ) @@ -1005,7 +1001,7 @@ add_dependencies(ldpc_cl nrLDPC_decoder_kernels_CL) # Base CUDA setting ############################################## -add_boolean_option(BUILD_CUDA False "Build support for CUDA" OFF) +add_boolean_option(ENABLE_LDPC_CUDA OFF "Build support for CUDA" OFF) if (ENABLE_LDPC_CUDA) find_package(CUDA REQUIRED) SET(CUDA_NVCC_FLAG "${CUDA_NVCC_FLAGS};-arch=sm_60;") @@ -2040,6 +2036,19 @@ add_library(SIMU STATIC ${SIMUSRC} ) target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAIR1_DIR}/SIMULATION/RF) target_link_libraries(SIMU PRIVATE asn1_nr_rrc asn1_lte_rrc) +# Qt-based scope +add_boolean_option(ENABLE_NRQTSCOPE OFF "Build the Qt-Scope" OFF) +if (ENABLE_NRQTSCOPE) + find_package(Qt5 REQUIRED COMPONENTS Widgets Charts) + message ("Qt5 Widgets and Charts found for nrqtscope") + set(QTSCOPE_SOURCE_NR ${OPENAIR1_DIR}/PHY/TOOLS/nr_phy_qt_scope.cpp) + # Creates rules for calling the Meta-Object Compiler (moc) on the given source files + qt5_wrap_cpp(QTSCOPE_SOURCE_NR ${OPENAIR1_DIR}/PHY/TOOLS/nr_phy_qt_scope.h) + add_library(nrqtscope MODULE ${QTSCOPE_SOURCE_NR}) + target_link_libraries(nrqtscope PRIVATE Qt5::Widgets Qt5::Charts) + target_link_libraries(nrqtscope PRIVATE asn1_nr_rrc asn1_lte_rrc) +endif() + add_library(SIMU_ETH ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c @@ -2116,7 +2125,6 @@ add_definitions(-DASN1_MINIMUM_VERSION=924) # add executables for operation ################################# add_library(minimal_lib - ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/LOG/log.c ${OPENAIR_DIR}/common/utils/minimal_stub.c ${T_SOURCE} @@ -2175,49 +2183,15 @@ target_link_libraries(lte-softmodem PRIVATE -Wl,--start-group lte_rrc nr_rrc s1ap m2ap x2ap m3ap GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${RAL_LIB} ${NAS_UE_LIB} ITTI SIMU + ${NAS_UE_LIB} ITTI SIMU -Wl,--end-group z dl) target_link_libraries(lte-softmodem PRIVATE ${LIBXML2_LIBRARIES}) -target_link_libraries(lte-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS}) -target_link_libraries(lte-softmodem PRIVATE ${LIB_LMS_LIBRARIES}) +target_link_libraries(lte-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp) target_link_libraries(lte-softmodem PRIVATE ${T_LIB}) target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) -add_executable(ocp-enb - ${OPENAIR_DIR}/executables/main-ocp.c - ${OPENAIR_DIR}/executables/softmodem-common.c - ${OPENAIR_DIR}/executables/main-fs6.c - ${OPENAIR_DIR}/executables/transport_split.c - ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c - ${OPENAIR_DIR}/executables/create_tasks.c - ${OPENAIR_DIR}/executables/create_tasks_mbms.c - ${OPENAIR_DIR}/radio/COMMON/common_lib.c - ${OPENAIR_DIR}/radio/COMMON/record_player.c - ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c - ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c - ${OPENAIR_DIR}/common/utils/lte/ue_power.c - ${OPENAIR_DIR}/common/utils/lte/prach_utils.c - ${PHY_INTERFACE_DIR}/queue_t.c - ${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c - ${T_SOURCE} - ${SHLIB_LOADER_SOURCES} - ) -add_dependencies(ocp-enb oai_iqplayer coding params_libconfig rfsimulator) - -target_link_libraries (ocp-enb - -Wl,--start-group - lte_rrc nr_rrc s1ap m2ap x2ap m3ap GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB - PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU - ${RAL_LIB} ${NAS_UE_LIB} ITTI - -Wl,--end-group z dl) -target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIB_LMS_LIBRARIES} ${T_LIB}) - add_executable(oairu ${OPENAIR_DIR}/executables/lte-ru.c ${OPENAIR_DIR}/executables/ru_control.c @@ -2236,7 +2210,7 @@ target_link_libraries(oairu PRIVATE PHY_COMMON PHY_RU UTIL -Wl,--end-group z dl) -target_link_libraries(oairu PRIVATE pthread m CONFIG_LIB rt ${CMAKE_DL_LIBS} ${T_LIB}) +target_link_libraries(oairu PRIVATE pthread m CONFIG_LIB rt ${T_LIB}) target_link_libraries(oairu PRIVATE asn1_nr_rrc asn1_lte_rrc) # force the generation of ASN.1 so that we don't need to wait during the build @@ -2275,12 +2249,11 @@ target_link_libraries(lte-uesoftmodem PRIVATE lte_rrc nr_rrc s1ap x2ap m2ap m3ap SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU L2_UE L2_LTE SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${ATLAS_LIBRARIES} + ${NAS_UE_LIB} ITTI ${ATLAS_LIBRARIES} -Wl,--end-group z dl) target_link_libraries(lte-uesoftmodem PRIVATE ${LIBXML2_LIBRARIES}) -target_link_libraries(lte-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) -target_link_libraries(lte-uesoftmodem PRIVATE ${LIB_LMS_LIBRARIES}) +target_link_libraries(lte-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${ATLAS_LIBRARIES}) target_link_libraries(lte-uesoftmodem PRIVATE ${T_LIB}) target_link_libraries(lte-uesoftmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) @@ -2317,14 +2290,13 @@ add_executable(nr-softmodem target_link_libraries(nr-softmodem PRIVATE -Wl,--start-group UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECU_CN SECU_OSA - ITTI ${RAL_LIB} ${NAS_UE_LIB} lte_rrc nr_rrc + ITTI ${NAS_UE_LIB} lte_rrc nr_rrc ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU x2ap f1ap m2ap m3ap e1ap -Wl,--end-group z dl) target_link_libraries(nr-softmodem PRIVATE ${LIBXML2_LIBRARIES}) -target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) -target_link_libraries(nr-softmodem PRIVATE ${LIB_LMS_LIBRARIES}) +target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${ATLAS_LIBRARIES}) target_link_libraries(nr-softmodem PRIVATE ${T_LIB}) target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) @@ -2385,12 +2357,11 @@ target_link_libraries(nr-uesoftmodem PRIVATE nr_rrc SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB - ${RAL_LIB} ITTI ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU + ITTI ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU -Wl,--end-group z dl) target_link_libraries(nr-uesoftmodem PRIVATE ${LIBXML2_LIBRARIES}) -target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) -target_link_libraries(nr-uesoftmodem PRIVATE ${LIB_LMS_LIBRARIES}) +target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB}) target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc asn1_lte_rrc) @@ -2533,7 +2504,6 @@ target_link_libraries(nr_dlsim PRIVATE m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc asn1_lte_rrc) -target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) add_executable(nr_prachsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c @@ -2585,7 +2555,6 @@ target_link_libraries(nr_ulsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON lte_rrc nr_rrc CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE x2ap SECU_CN ngap NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) -target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc asn1_lte_rrc) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) diff --git a/ci-scripts/Jenkinsfile-cluster b/ci-scripts/Jenkinsfile-cluster index e3f7da6141..013fe744c3 100644 --- a/ci-scripts/Jenkinsfile-cluster +++ b/ci-scripts/Jenkinsfile-cluster @@ -155,14 +155,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - echo "no ADB_IPAddress given" - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - echo "no ADB_IPAddress given" - allParametersPresent = false - } if (params.OC_Credentials == null) { echo "no OC_Credentials given" allParametersPresent = false @@ -207,14 +199,13 @@ pipeline { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-physim-deploy b/ci-scripts/Jenkinsfile-physim-deploy index a0ed1a2f80..2bdcac42aa 100644 --- a/ci-scripts/Jenkinsfile-physim-deploy +++ b/ci-scripts/Jenkinsfile-physim-deploy @@ -140,12 +140,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } if (params.OC_Credentials == null) { allParametersPresent = false } @@ -192,15 +186,14 @@ pipeline { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-full-ran b/ci-scripts/Jenkinsfile-tmp-full-ran index e4564d777e..a074ef3369 100644 --- a/ci-scripts/Jenkinsfile-tmp-full-ran +++ b/ci-scripts/Jenkinsfile-tmp-full-ran @@ -155,13 +155,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } - if (allParametersPresent) { echo "All parameters are present" if (eNB_AllowMergeRequestProcess) { @@ -202,14 +195,13 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb b/ci-scripts/Jenkinsfile-tmp-multi-enb index e0c756befb..f8a0216fff 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb @@ -150,13 +150,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } - if (allParametersPresent) { echo "All parameters are present" if (eNB_AllowMergeRequestProcess) { @@ -198,14 +191,13 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false @@ -220,20 +212,6 @@ pipeline { } stage ("Terminate") { parallel { - stage('Terminate UE') { - // Bypassing this stage if there are no abd server defined - when { - expression { params.ADB_IPAddress != "none" } - } - steps { - echo '\u2705 \u001B[32mTerminate UE\u001B[0m' - withCredentials([ - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] - ]) { - sh "python3 ci-scripts/main.py --mode=TerminateUE --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password}" - } - } - } stage('Terminate eNB') { steps { echo '\u2705 \u001B[32mTerminate eNB\u001B[0m' diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 43d6372a33..e7f803b45c 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -169,12 +169,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } if (params.DataBaseHost == "none") { DataBaseHost = pythonExecutor } @@ -220,15 +214,14 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 271b9d042a..037f7e6897 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -89,10 +89,6 @@ pipeline { string(name: 'EPC_Type', defaultValue: 'ltebox', description: 'EPC type: OAI or ltebox') credentials(name: 'EPC_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for EPC') string(name: 'EPC_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of EPC source code') - - //ADB server parameters - string(name: 'ADB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of ADB server') - credentials(name: 'ADB_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for ADB') } */ @@ -171,13 +167,6 @@ pipeline { allParametersPresent = false } - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } - if (allParametersPresent) { echo "All parameters are present" if (eNB_AllowMergeRequestProcess) { @@ -217,14 +206,13 @@ pipeline { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false @@ -239,27 +227,6 @@ pipeline { } stage ("Terminate") { parallel { - stage('Terminate UE') { - // Bypassing this stage if there are no abd server defined - when { - expression { params.ADB_IPAddress != "none" } - } - steps { - echo '\u2705 \u001B[32mTerminate UE\u001B[0m' - withCredentials([ - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] - ]) { - sh "python3 ci-scripts/main.py --mode=TerminateUE --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password}" - } - } - post { - success { - script { - termStatusArray[termUE] = true - } - } - } - } stage('Terminate eNB') { steps { echo '\u2705 \u001B[32mTerminate eNB\u001B[0m' @@ -517,13 +484,6 @@ pipeline { // Making sure that we really shutdown every thing before leaving failure { script { - if ((!termStatusArray[termUE]) && (params.ADB_IPAddress != "none")) { - withCredentials([ - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] - ]) { - sh "python3 ci-scripts/main.py --mode=TerminateUE --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password}" - } - } if (!termStatusArray[termENB]) { withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index 5a1e28d9f9..97e878cd25 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -142,13 +142,6 @@ pipeline { allParametersPresent = false } */ - if (params.ADB_IPAddress == null) { - allParametersPresent = false - } - if (params.ADB_Credentials == null) { - allParametersPresent = false - } - if (allParametersPresent) { echo "All parameters are present" if (eNB_AllowMergeRequestProcess) { @@ -187,14 +180,13 @@ pipeline { } withCredentials([ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'], - [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 01e3eba465..07c1ce5db0 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -227,23 +227,13 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE) EPC.ContainerPrefix=matchReg.group(1) elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE) - CiTestObj.ADBIPAddress = matchReg.group(1) + print("ignoring --ADBIPAddress parameter") elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE) - CiTestObj.ADBUserName = matchReg.group(1) + print("ignoring --ADBUserName parameter") elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE) - if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE): - if re.match('distributed', matchReg.group(1), re.IGNORECASE): - CiTestObj.ADBCentralized = False - else: - CiTestObj.ADBCentralized = True - else: - sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)') + print("ignoring --ADBType parameter") elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE): - matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE) - CiTestObj.ADBPassword = matchReg.group(1) + print("ignoring --ADBPassword parameter") elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE) CiTestObj.testXMLfiles.append(matchReg.group(1)) diff --git a/ci-scripts/build_fr1_from_yaml.py b/ci-scripts/build_fr1_from_yaml.py index a5492df6f6..4687c3ee02 100755 --- a/ci-scripts/build_fr1_from_yaml.py +++ b/ci-scripts/build_fr1_from_yaml.py @@ -39,10 +39,6 @@ def main(): '--ranAllowMerge=' + params['ranAllowMerge'] + ' ' + \ '--ranTargetBranch=' + params['ranTargetBranch'] + ' ' + \ \ - '--ADBIPAddress=' + params['ADB']['ADBIPAddress'] + ' ' + \ - '--ADBUserName=' + params['ADB']['ADBUserName'] + ' ' + \ - '--ADBPassword=' + params['ADB']['ADBPassword'] + ' ' + \ - \ '--UEIPAddress=' + params['UE']['UEIPAddress'] + ' ' + \ '--UEUserName=' + params['UE']['UEUserName'] + ' ' + \ '--UEPassword=' + params['UE']['UEPassword'] + ' ' + \ diff --git a/ci-scripts/build_fr1_template.yaml b/ci-scripts/build_fr1_template.yaml index 5c7b2fc6f4..bedeeb09d7 100755 --- a/ci-scripts/build_fr1_template.yaml +++ b/ci-scripts/build_fr1_template.yaml @@ -12,12 +12,6 @@ steps: - TesteNB,xml_files/fr1_nsa_base_next.xml #ue toggle, nodes initialize, ue toggle, ping, nodes terminate - TesteNB,xml_files/fr1_epc_closure.xml - -ADB: #on Caracal - ADBIPAddress : 172.21.16.132 - ADBUserName : oaici - ADBPassword : KkexF6CErOi1fNuebCPsuIVK - RAN: - eNBIPAddress : 192.168.18.199 #eNB on Minimassive eNBUserName : oaicicd diff --git a/ci-scripts/ci_ctl_adb.sh b/ci-scripts/ci_ctl_adb.sh new file mode 100755 index 0000000000..25fd4d0afc --- /dev/null +++ b/ci-scripts/ci_ctl_adb.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +usage() { + echo "usage: $0 " + echo "available commands: initialize, attach, detach, terminate, check" +} + +if [ $# -ne 2 ]; then + usage + exit 1 +fi + +cmd=$1 +id=$2 + +flightmode_off() { + set +x + adb -s $id shell "/data/local/tmp/on" +} + +flightmode_on() { + set +x + adb -s $id shell "/data/local/tmp/off" +} + +initialize() { + set +x + adb -s $id shell "svc data enable" # make sure data services are enabled + flightmode_on +} + +terminate() { + echo "terminate: does nothing" +} + +check() { + declare -A service=( ["0"]="IN_SERVICE" ["1"]="OUT_OF_SERVICE" ["2"]="EMERGENCY_ONLY" ["3"]="RADIO_POWERED_OFF") + declare -A data=( ["0"]="DISCONNECTED" ["1"]="CONNECTING" ["2"]="CONNECTED" ["3"]="SUSPENDED") + serv_idx=$(adb -s $id shell "dumpsys telephony.registry" | sed -n 's/.*mServiceState=\([0-3]\).*/\1/p') + data_idx=$(adb -s $id shell "dumpsys telephony.registry" | sed -n 's/.*mDataConnectionState=\([0-3]\).*/\1/p') + data_reason=$(adb -s $id shell "dumpsys telephony.registry" | sed -n 's/.*mDataConnectionReason=\([0-9a-zA-Z_]\+\).*/\1/p') + #echo "Status Check UE $id" + echo "Service State: ${service[$serv_idx]}" + echo "Data State: ${data[$data_idx]}" + echo "Data Reason: ${data_reason}" +} + +case "${cmd}" in + initialize) initialize;; + attach) flightmode_off;; + detach) flightmode_on;; + terminate) terminate;; + check) check;; + *) echo "Invalid command $cmd"; usage; exit 1;; +esac diff --git a/ci-scripts/ci_ctl_qtel.py b/ci-scripts/ci_ctl_qtel.py index 3785d7ee89..4567c07d68 100644 --- a/ci-scripts/ci_ctl_qtel.py +++ b/ci-scripts/ci_ctl_qtel.py @@ -33,7 +33,6 @@ import sys import time import serial - class qtel_ctl: #--------------- #private methods @@ -75,12 +74,15 @@ class qtel_ctl: self.__set_modem_state(self.modem,'0') - - if __name__ == "__main__": #argv[1] : usb port #argv[2] : qtel command (see function pointers dict "wup", "detach" etc ...) - command = sys.argv[2] - Module=qtel_ctl(sys.argv[1]) + if len(sys.argv) >= 3: + command = sys.argv[2] + print(command) + Module=qtel_ctl(sys.argv[1]) #calling the function to be applied - Module.cmd_dict[command]() + Module.cmd_dict[command]() + print(Module.cmd_dict[command]) + else: + print("To many arguments") diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 76ebaf0f97..23d6aee785 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -1,106 +1,128 @@ idefix: - ID: idefix - State : enabled - Kind : quectel - Process : - Name : quectel-CM - Cmd : /home/oaicicd/quectel-CM/quectel-CM -4 -s - Apn : - ltebox : oai.ipv4 - WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup - DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach - LogStore : /media/usb-drive/ci_qlogs - PLMN : 22201 - UENetwork : wwan0 - HostIPAddress : 172.21.16.135 - HostUsername : oaicicd - HostPassword : oaicicd - HostSourceCodePath : none - MTU : 1500 + Host: idefix + InitScript: sudo stdbuf -oL /home/oaicicd/quectel-CM/quectel-CM -4 -s oai.ipv4 &> /tmp/quectel-cm.log & + TermScript: sudo -S killall --signal SIGKILL quectel-CM + AttachScript: sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 wup + DetachScript: sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 detach + UENetworkScript: ip a show dev wwan0 + IF: wwan0 + MTU: 1500 + Trace: True + LogStore: /media/usb-drive/ci_qlogs nrmodule2_quectel: - ID: nrmodule2_quectel - State : enabled - Kind : quectel - Process : - Name : quectel-CM - Cmd : /home/nrmodule2/quectel-CM/quectel-CM -4 -s - Apn : - OAICN5G : oai - OAI-Rel14-Docker : oai.ipv4 - WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup - DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach - LogStore : /media/ci_qlogs - PLMN : 20897 - UENetwork : wwan0 - HostIPAddress : 172.21.16.139 - HostUsername : nrmodule2 - HostPassword : linux - HostSourceCodePath : none - StartCommands : - - sudo -S ip link set dev wwan1 mtu 1500 - MTU : 1500 + Host: nrmodule2 + InitScript: sudo stdbuf -oL /home/nrmodule2/quectel-CM/quectel-CM -4 -s oai.ipv4 &> /tmp/quecel-cm.log & + TermScript: sudo -S killall --signal SIGKILL quectel-CM + AttachScript: sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 wup + DetachScript: sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 detach + UENetworkScript: ip a show dev wwan0 + IF: wwan0 + MTU: 1500 + LogStore: /media/ci_qlogs -# CAUTION: 192.168.18.89 address has to be changed when the server is moved -#single UE single ping +adb_ue_1: + Host: nano + InitScript: /home/oaicicd/ci_ctl_adb.sh initialize 5200a933fee93521 + TermScript: /home/oaicicd/ci_ctl_adb.sh terminate 5200a933fee93521 + AttachScript: /home/oaicicd/ci_ctl_adb.sh attach 5200a933fee93521 + DetachScript: /home/oaicicd/ci_ctl_adb.sh detach 5200a933fee93521 + CheckStatusScript: /home/oaicicd/ci_ctl_adb.sh check 5200a933fee93521 + DataEnableScript: adb -s 5200a933fee93521 shell "svc data enable" + DataDisableScript: adb -s 5200a933fee93521 shell "svc data disable" + UENetworkScript: adb -s 5200a933fee93521 shell "ip address show | grep rmnet" + CmdPrefix: adb -s 5200a933fee93521 shell + MTU: 1500 + LogStore: /media/usb-drive/ci_adb_1-logs +adb_ue_2: + Host: nano + InitScript: /home/oaicicd/ci_ctl_adb.sh initialize 5200c00db4413517 + TermScript: /home/oaicicd/ci_ctl_adb.sh terminate 5200c00db4413517 + AttachScript: /home/oaicicd/ci_ctl_adb.sh attach 5200c00db4413517 + DetachScript: /home/oaicicd/ci_ctl_adb.sh detach 5200c00db4413517 + CheckStatusScript: /home/oaicicd/ci_ctl_adb.sh check 5200c00db4413517 + DataEnableScript: adb -s 5200c00db4413517 shell "svc data enable" + DataDisableScript: adb -s 5200c00db4413517 shell "svc data disable" + UENetworkScript: adb -s 5200c00db4413517 shell "ip address show | grep rmnet" + CmdPrefix: adb -s 5200c00db4413517 shell + MTU: 1500 + LogStore: /media/usb-drive/ci_adb_2-logs + +amarisoft_ue: + Host: amariue + InitScript: nohup /root/NV18-06-2022/ue/lteue /root/NV18-06-2022/ue/config/oaicicd-ue-ci-test.cfg & + TermScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"quit"}' amarisoft_ue_1: - ID: amarisoft_ue_1 - State : enabled - Kind : amarisoft - #not required for AS config but needed for py script - WakeupScript : none - DetachScript : none - #end - Cmd : /root/NV18-06-2022/ue/lteue - Config : /root/NV17-12-21/ue/config/oaicicd-ue-Ping-SATest.cfg - Duration : 60 - Ping : /tmp/test_ue1.log - UELog : /tmp/ue1.log - HostIPAddress : 172.21.16.144 - HostUsername : root - HostPassword : toor - HostSourceCodePath : /tmp - - -#an other scenario example -#notice : this will not work as such, only suggestion for multi ue scenario + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":1}' + UENetworkScript: ip netns exec ue1 ip a show dev pdn0 + CmdPrefix: ip netns exec ue1 + MTU: 1500 amarisoft_ue_2: - ID: amarisoft_ue_2 - State : enabled - Kind : amarisoft - #not required for AS config but needed for py script - WakeupScript : none - DetachScript : none - #end - Cmd : /root/NV18-06-2022/ue/lteue - Config : /root/NV17-12-21/ue/config/xxxxxxx.cfg #to be updated for an other scenario - Duration : 60 - Ping : - - /tmp/test_ue1.log #to be updated fo an other scenario - - /tmp/test_ue2.log #could be a list for a multi ue scenario - UELog : - - /tmp/ue1.log - - /tmp/ue1.log - HostIPAddress : 192.168.18.89 - HostUsername : root - HostPassword : toor - HostSourceCodePath : /tmp - - -#do not remove -dummy: - ID: '' - State : '' - Kind : '' - Process : - Name : '' - Cmd : '' - WakeupScript : '' - DetachScript : '' - PLMN : 22201 - UENetwork : wwan0 - HostIPAddress : 172.21.16.135 - HostUsername : oaicicd - HostPassword : oaicicd - HostSourceCodePath : none - + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":2}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":2}' + UENetworkScript: ip netns exec ue2 ip a show dev pdn0 + CmdPrefix: ip netns exec ue2 + MTU: 1500 +amarisoft_ue_3: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":3}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":3}' + UENetworkScript: ip netns exec ue3 ip a show dev pdn0 + CmdPrefix: ip netns exec ue3 + MTU: 1500 +amarisoft_ue_4: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":4}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":4}' + UENetworkScript: ip netns exec ue4 ip a show dev pdn0 + CmdPrefix: ip netns exec ue4 + MTU: 1500 +amarisoft_ue_5: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":5}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":5}' + UENetworkScript: ip netns exec ue5 ip a show dev pdn0 + CmdPrefix: ip netns exec ue5 + MTU: 1500 +amarisoft_ue_6: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":6}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":6}' + UENetworkScript: ip netns exec ue6 ip a show dev pdn0 + CmdPrefix: ip netns exec ue6 + MTU: 1500 +amarisoft_ue_7: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":7}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":7}' + UENetworkScript: ip netns exec ue7 ip a show dev pdn0 + CmdPrefix: ip netns exec ue7 + MTU: 1500 +amarisoft_ue_8: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":8}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":8}' + UENetworkScript: ip netns exec ue8 ip a show dev pdn0 + CmdPrefix: ip netns exec ue8 + MTU: 1500 +amarisoft_ue_9: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":9}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":9}' + UENetworkScript: ip netns exec ue9 ip a show dev pdn0 + CmdPrefix: ip netns exec ue9 + MTU: 1500 +amarisoft_ue_10: + Host: amariue + AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":10}' + DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":10}' + UENetworkScript: ip netns exec ue10 ip a show dev pdn0 + CmdPrefix: ip netns exec ue10 + MTU: 1500 +oai_ue_obelix: + Host: obelix + UENetworkScript: ip a show dev oaitun_ue1 + IF: oaitun_ue1 diff --git a/ci-scripts/cls_amarisoft_ue.py b/ci-scripts/cls_amarisoft_ue.py deleted file mode 100644 index 9f4976792d..0000000000 --- a/ci-scripts/cls_amarisoft_ue.py +++ /dev/null @@ -1,81 +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 OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698 -# * -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Required Python Version -# Python 3.x -# -#--------------------------------------------------------------------- - -#to use isfile -import os -import sys -import logging -#to create a SSH object locally in the methods -import sshconnection -#time.sleep -import time - - -import re -import subprocess - -from datetime import datetime - - -class AS_UE: - - def __init__(self,Module): - #create attributes as in the UE dictionary - for k, v in Module.items(): - setattr(self, k, v) - - - - -#-----------------$ -#PUBLIC Methods$ -#-----------------$ - - def WaitEndScenario(self): - logging.debug('waiting for scenario duration') - time.sleep(int(self.Duration)) - - def KillASUE(self): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('killall --signal SIGKILL lteue-avx2', '\$', 5) - mySSH.close() - - def RunScenario(self): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - - logging.debug("Deleting old artifacts :") - cmd='rm -rf ' + self.Ping + ' ' + self.UELog - mySSH.command(cmd, '\$',5) - logging.debug("Running scenario :") - cmd='echo $USER; nohup '+self.Cmd + ' ' + self.Config + ' &' - mySSH.command(cmd, '\$',5) - - mySSH.close() - - - diff --git a/ci-scripts/cls_ci_ueinfra.py b/ci-scripts/cls_ci_ueinfra.py deleted file mode 100644 index 0326a92a4f..0000000000 --- a/ci-scripts/cls_ci_ueinfra.py +++ /dev/null @@ -1,57 +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 OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698 -# * -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Required Python Version -# Python 3.x -# -#--------------------------------------------------------------------- - -#to use isfile -import os -import sys -import logging -#to create a SSH object locally in the methods -import sshconnection -#time.sleep -import time -#to load ue infrastructure dictionary -import yaml - -class InfraUE: - def __init__(self): - self.ci_ue_infra ={} - - -#-----------------$ -#PUBLIC Methods$ -#-----------------$ - - #This method reads the yaml file describing the multi-UE infrastructure - #and stores the infra permanently in the related class attribute self.ci_ue_infra - def Get_UE_Infra(self,ue_infra_filename): - f_yaml=ue_infra_filename - with open(f_yaml,'r') as file: - logging.debug('Loading UE infrastructure from file '+f_yaml) - #load it permanently in the class attribute - self.ci_ue_infra = yaml.load(file,Loader=yaml.FullLoader) - - - diff --git a/ci-scripts/cls_cmd.py b/ci-scripts/cls_cmd.py index 8694502fe2..acf1f6e0d2 100644 --- a/ci-scripts/cls_cmd.py +++ b/ci-scripts/cls_cmd.py @@ -32,10 +32,17 @@ import os import paramiko import uuid +# helper that returns either LocalCmd or RemoteCmd based on passed host name +def getConnection(host, d=None): + if host is None or host.lower() in ["", "none", "localhost"]: + return LocalCmd(d=d) + else: + return RemoteCmd(host, d=d) + # provides a partial interface for the legacy SSHconnection class (getBefore(), command()) class Cmd(metaclass=abc.ABCMeta): def cd(self, d, silent=False): - if d == None or d == '' or d == []: + if d == None or d == '': self.cwd = None elif d[0] == '/': self.cwd = d @@ -51,9 +58,13 @@ class Cmd(metaclass=abc.ABCMeta): def run(self, line, timeout=300, silent=False): return - @abc.abstractmethod - def command(self, commandline, expectedline, timeout, silent=False, resync=False): - return + def command(self, commandline, expectedline=None, timeout=300, silent=False, resync=False): + splitted = commandline.split(' ') + if splitted[0] == 'cd': + self.cd(' '.join(splitted[1:]), silent) + else: + self.run(commandline, timeout, silent) + return 0 @abc.abstractmethod def close(self): @@ -82,7 +93,12 @@ class LocalCmd(Cmd): if not silent: logging.info(line) try: - ret = sp.run(line, shell=True, cwd=self.cwd, stdout=sp.PIPE, stderr=sp.STDOUT, timeout=timeout) + if line.strip().endswith('&'): + # if we wait for stdout, subprocess does not return before the end of the command + # however, we don't want to wait for commands with &, so just return fake command + ret = sp.run(line, shell=True, cwd=self.cwd, timeout=5) + else: + ret = sp.run(line, shell=True, cwd=self.cwd, stdout=sp.PIPE, stderr=sp.STDOUT, timeout=timeout) except Exception as e: ret = sp.CompletedProcess(args=line, returncode=255, stdout=f'Exception: {str(e)}'.encode('utf-8')) if ret.stdout is None: @@ -93,14 +109,6 @@ class LocalCmd(Cmd): self.cp = ret return ret - def command(self, commandline, expectedline=None, timeout=300, silent=False, resync=False): - line = [s for s in commandline.split(' ') if len(s) > 0] - if line[0] == 'cd': - self.cd(line[1], silent) - else: - self.run(line, timeout, silent) - return 0 - def close(self): pass @@ -108,16 +116,14 @@ class LocalCmd(Cmd): return self.cp.stdout def copyin(self, scpIp, scpUser, scpPw, src, tgt): - logging.warning("LocalCmd emulating sshconnection.copyin() function") self.run(f'cp -r {src} {tgt}') def copyout(self, scpIp, scpUser, scpPw, src, tgt): - logging.warning("LocalCmd emulating sshconnection.copyout() function") self.run(f'cp -r {src} {tgt}') class RemoteCmd(Cmd): def __init__(self, hostname, d=None): - logging.getLogger('paramiko').setLevel(logging.INFO) # prevent spamming through Paramiko + logging.getLogger('paramiko').setLevel(logging.ERROR) # prevent spamming through Paramiko self.client = paramiko.SSHClient() self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) cfg = RemoteCmd._lookup_ssh_config(hostname) @@ -146,33 +152,27 @@ class RemoteCmd(Cmd): return cfg def run(self, line, timeout=300, silent=False, reportNonZero=True): - if type(line) is list: - line = ' '.join(line) if not silent: - logging.debug(line) + logging.info(line) if self.cwd: line = f"cd {self.cwd} && {line}" - args = line.split(' ') try: - stdin, stdout, stderr = self.client.exec_command(line, timeout=timeout) - ret = sp.CompletedProcess(args=args, returncode=stdout.channel.recv_exit_status(), stdout=stdout.read(size=None) + stderr.read(size=None)) + if line.strip().endswith('&'): + # if we wait for stdout, Paramiko does not return before the end of the command + # however, we don't want to wait for commands with &, so just return fake command + self.client.exec_command(line, timeout = 5) + ret = sp.CompletedProcess(args=line, returncode=0, stdout=b'') + else: + stdin, stdout, stderr = self.client.exec_command(line, timeout=timeout) + ret = sp.CompletedProcess(args=line, returncode=stdout.channel.recv_exit_status(), stdout=stdout.read(size=None) + stderr.read(size=None)) except Exception as e: - ret = sp.CompletedProcess(args=args, returncode=255, stdout=f'Exception: {str(e)}'.encode('utf-8')) + ret = sp.CompletedProcess(args=line, returncode=255, stdout=f'Exception: {str(e)}'.encode('utf-8')) ret.stdout = ret.stdout.decode('utf-8').strip() if reportNonZero and ret.returncode != 0: - cmd = ' '.join(ret.args) - logging.warning(f'command "{cmd}" returned non-zero returncode {ret.returncode}: output:\n{ret.stdout}') + logging.warning(f'command "{line}" returned non-zero returncode {ret.returncode}: output:\n{ret.stdout}') self.cp = ret return ret - def command(self, commandline, expectedline=None, timeout=300, silent=False, resync=False): - line = [s for s in commandline.split(' ') if len(s) > 0] - if line[0] == 'cd': - self.cd(line[1], silent) - else: - self.run(line, timeout, silent) - return 0 - def close(self): self.client.close() @@ -180,7 +180,6 @@ class RemoteCmd(Cmd): return self.cp.stdout def copyout(self, src, tgt, recursive=False): - logging.warning("RemoteCmd emulating sshconnection.copyout() function, ignoring scpIp") logging.debug(f"copyout: local:{src} -> remote:{tgt}") if recursive: tmpfile = f"{uuid.uuid4()}.tar" @@ -198,7 +197,6 @@ class RemoteCmd(Cmd): sftp.close() def copyin(self, src, tgt, recursive=False): - logging.warning("RemoteCmd emulating sshconnection.copyout() function") logging.debug(f"copyin: remote:{src} -> local:{tgt}") if recursive: tmpfile = f"{uuid.uuid4()}.tar" diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 8d4175fe24..4c7701842e 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -927,24 +927,21 @@ class Containerize(): mySSH.copyin(lIpAddr, lUserName, lPassWord, logfilename, '.') mySSH.close() - html_queue = SimpleQueue() - html_cell = '
\n'
+		message = ''
 		if usedImage != '':
-			html_cell += f'Used Image = {usedImage} :\n'
-			html_cell += imageInfo
+			message += f'Used Image = {usedImage} :\n'
+			message += imageInfo
 		else:
-			html_cell += 'Could not retrieve used image info!\n'
+			message += 'Could not retrieve used image info!\n'
 		if status:
-			html_cell += '\nHealthy deployment!\n'
+			message += '\nHealthy deployment!\n'
 		else:
-			html_cell += '\nUnhealthy deployment! -- Check logs for reason!\n'
-		html_cell += '
' - html_queue.put(html_cell) + message += '\nUnhealthy deployment! -- Check logs for reason!\n' if status: - HTML.CreateHtmlTestRowQueue('N/A', 'OK', CONST.ENB_PROCESS_OK, html_queue) + HTML.CreateHtmlTestRowQueue('N/A', 'OK', [message]) else: self.exitStatus = 1 - HTML.CreateHtmlTestRowQueue('N/A', 'KO', CONST.ENB_PROCESS_OK, html_queue) + HTML.CreateHtmlTestRowQueue('N/A', 'KO', [message]) def UndeployObject(self, HTML, RAN): @@ -1116,37 +1113,30 @@ class Containerize(): else: time.sleep(10) - imagesInfo = '' + html_cell = '' for newCont in newContainers: if newCont == 'rfsim4g-db-init': continue cmd = 'docker inspect -f "{{.Config.Image}}" ' + newCont imageInspect = myCmd.run(cmd, timeout=30, silent=True) imageName = str(imageInspect.stdout).strip() - cmd = 'docker image inspect --format "{{.RepoTags}}\t{{.Size}} bytes\t{{.Created}}\t{{.Id}}" ' + imageName + cmd = 'docker image inspect --format \'{{.RepoTags}}\t{{.Size}} bytes\t{{index (split .Created ".") 0}}\n{{.Id}}\' ' + imageName imageInspect = myCmd.run(cmd, 30, silent=True) - imagesInfo += imageInspect.stdout.strip() + html_cell += imageInspect.stdout + '\n' myCmd.close() - html_queue = SimpleQueue() - html_cell = '
\n'
-		for imageInfo in imagesInfo.split('\n'):
-			html_cell += imageInfo[:-11] + '\n'
-		html_cell += '\n'
 		for cState in containerStatus:
 			html_cell += cState + '\n'
-		html_cell += '
' - html_queue.put(html_cell) if count == 100 and healthy == self.nb_healthy[0]: if self.tsharkStarted == False: logging.debug('Starting tshark on public network') self.CaptureOnDockerNetworks() - HTML.CreateHtmlTestRowQueue('n/a', 'OK', 1, html_queue) + HTML.CreateHtmlTestRowQueue('n/a', 'OK', [html_cell]) for cState in containerStatus: logging.debug(cState) logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') else: - HTML.CreateHtmlTestRowQueue('Could not deploy in time', 'KO', 1, html_queue) + HTML.CreateHtmlTestRowQueue('Could not deploy in time', 'KO', [html_cell]) for cState in containerStatus: logging.debug(cState) logging.error('\u001B[1m Deploying OAI Object(s) FAILED\u001B[0m') @@ -1357,10 +1347,7 @@ class Containerize(): message += statLine + '\n' myCmd.close() - html_queue = SimpleQueue() - html_cell = '
\n' + message + '
' - html_queue.put(html_cell) - HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', 1, html_queue) + HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', [message]) def PingFromContainer(self, HTML, RAN, UE): myCmd = cls_cmd.LocalCmd() @@ -1419,14 +1406,11 @@ class Containerize(): logging.info('\u001B[1m Ping Test PASS\u001B[0m') def PingExit(self, HTML, RAN, UE, status, message): - html_queue = SimpleQueue() - html_cell = '
UE\n' + message + '
' - html_queue.put(html_cell) if status: - HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', 1, html_queue) + HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', [message]) else: logging.error('\u001B[1;37;41m ping test FAIL -- ' + message + ' \u001B[0m') - HTML.CreateHtmlTestRowQueue(self.pingOptions, 'KO', 1, html_queue) + HTML.CreateHtmlTestRowQueue(self.pingOptions, 'KO', [message]) # Automatic undeployment logging.warning('----------------------------------------') logging.warning('\u001B[1m Starting Automatic undeployment \u001B[0m') @@ -1475,14 +1459,12 @@ class Containerize(): self.IperfExit(HTML, RAN, UE, iperfStatus, msg) def IperfExit(self, HTML, RAN, UE, status, message): - html_queue = SimpleQueue() - html_cell = '
UE\n' + message + '
' - html_queue.put(html_cell) + html_cell = f'UE\n{message}' if status: - HTML.CreateHtmlTestRowQueue(self.cliOptions, 'OK', 1, html_queue) + HTML.CreateHtmlTestRowQueue(self.cliOptions, 'OK', [html_cell]) else: logging.error('\u001B[1m Iperf Test FAIL -- ' + message + ' \u001B[0m') - HTML.CreateHtmlTestRowQueue(self.cliOptions, 'KO', 1, html_queue) + HTML.CreateHtmlTestRowQueue(self.cliOptions, 'KO', [html_cell]) # Automatic undeployment logging.warning('----------------------------------------') logging.warning('\u001B[1m Starting Automatic undeployment \u001B[0m') diff --git a/ci-scripts/cls_cots_ue.py b/ci-scripts/cls_cots_ue.py deleted file mode 100644 index 59c2713b47..0000000000 --- a/ci-scripts/cls_cots_ue.py +++ /dev/null @@ -1,138 +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 OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698 -# * -# * 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 -# */ -#--------------------------------------------------------------------- -# Python for CI of OAI-eNB + COTS-UE -# -# Required Python Version -# Python 3.x -# -# Required Python Package -# pexpect -#--------------------------------------------------------------------- - -#to use isfile -import os -import sys -#to use logging.info() -import logging -#to create a SSH object locally in the methods -import sshconnection -#time.sleep -import time -#to load cots_ue dictionary -import yaml - -class CotsUe: - def __init__(self,ADBIPAddr,ADBUserName,ADBPassWord): - self.cots_id = '' #cots id from yaml oppo, s10 etc... - self.ADBIPAddr = ADBIPAddr - self.ADBUserName = ADBUserName - self.ADBPassWord = ADBPassWord - self.cots_run_mode = '' #on of off to toggle airplane mode on/off - self.__cots_cde_dict_file = 'cots_ue_ctl.yaml' - self.__SetAirplaneRetry = 3 - - -#-----------------$ -#PUBLIC Methods$ -#-----------------$ - - def Check_Airplane(self): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.ADBIPAddr, self.ADBUserName, self.ADBPassWord) - status=mySSH.cde_check_value('adb shell settings get global airplane_mode_on ', ['0','1'],5) - mySSH.close() - return status - - #simply check if the device id exists in the dictionary - #returns true if it exists, false otherwise - def Check_Exists(self,target_id): - #load cots commands dictionary - if (os.path.isfile(self.__cots_cde_dict_file)): - yaml_file=self.__cots_cde_dict_file - elif (os.path.isfile('ci-scripts/'+self.__cots_cde_dict_file)): - yaml_file='ci-scripts/'+self.__cots_cde_dict_file - else: - logging.error("COTS UE dictionary yaml file cannot be found") - sys.exit("COTS UE dictionary yaml file cannot be found") - - #load cots commands dictionary - with open(yaml_file,'r') as file: - cots_ue_ctl = yaml.load(file,Loader=yaml.FullLoader) - #check if ue id is in the dictionary - if target_id in cots_ue_ctl: - return True - else: - return False - - def Set_Airplane(self, target_id, target_state_str): - #loading cots commands dictionary - - if (os.path.isfile(self.__cots_cde_dict_file)): - yaml_file=self.__cots_cde_dict_file - elif (os.path.isfile('ci-scripts/'+self.__cots_cde_dict_file)): - yaml_file='ci-scripts/'+self.__cots_cde_dict_file - else: - logging.error("COTS UE dictionary yaml file cannot be found") - sys.exit("COTS UE dictionary yaml file cannot be found") - - #load cots commands dictionary - with open(yaml_file,'r') as file: - cots_ue_ctl = yaml.load(file,Loader=yaml.FullLoader) - #check if ue id is in the dictionary - if target_id in cots_ue_ctl: - mySSH = sshconnection.SSHConnection() - mySSH.open(self.ADBIPAddr, self.ADBUserName, self.ADBPassWord) - logging.info(str(self.ADBIPAddr)+' '+str(self.ADBUserName)+' '+str(self.ADBPassWord)) - mySSH.command('adb start-server','\$',5) - mySSH.command('adb devices','\$',5) - logging.info("Toggling COTS UE Airplane mode to : "+target_state_str) - #get current state - current_state = self.Check_Airplane() - if target_state_str.lower()=="on": - target_state=1 - else: - target_state=0 - if current_state != target_state: - #toggle state - retry = 0 - while (current_state!=target_state) and (retry < self.__SetAirplaneRetry): - #loop over the command list from dictionary for the selected ue, to switch to required state - for i in range (0,len(cots_ue_ctl[target_id])): - mySSH.command(cots_ue_ctl[target_id][i], '\$', 5) - time.sleep(1) - current_state = self.Check_Airplane() - retry+=1 - #could not toggle despite the retry - if current_state != target_state: - logging.error("ATTENTION : Could not toggle to : "+target_state_str) - logging.error("Current state is : "+ str(current_state)) - else: - logging.info("Airplane mode is already "+ target_state_str) - mySSH.command('adb kill-server','\$',5) - mySSH.close() - #ue id is NOT in the dictionary - else: - logging.error("COTS UE Id from XML could not be found in UE YAML dictionary " + self.__cots_cde_dict_file) - sys.exit("COTS UE Id from XML could not be found in UE YAML dictionary " + self.__cots_cde_dict_file) - - - - diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index dcf75a34fc..7fb7882b8d 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -28,177 +28,197 @@ import os import sys import logging -#to create a SSH object locally in the methods -import sshconnection #time.sleep import time - - import re import subprocess - from datetime import datetime +import yaml #for log rotation mgt import cls_log_mgt +import cls_cmd class Module_UE: - def __init__(self,Module): - #create attributes as in the Module dictionary - for k, v in Module.items(): - setattr(self, k, v) - self.UEIPAddress = "" - #dictionary linking command names and related module scripts - self.cmd_dict= {"wup": self.WakeupScript,"detach":self.DetachScript}#dictionary of function scripts - self.ue_trace='' + def __init__(self, module_name, filename="ci_ueinfra.yaml"): + with open(filename, 'r') as f: + all_ues = yaml.load(f, Loader=yaml.FullLoader) + m = all_ues.get(module_name) + if m is None: + raise Exception(f'no such module name "{module_name}" in "{filename}"') + self.module_name = module_name + self.host = m['Host'] + self.cmd_dict = { + "attach": m.get('AttachScript'), + "detach": m.get('DetachScript'), + "initialize": m.get('InitScript'), + "terminate": m.get('TermScript'), + "getNetwork": m.get('UENetworkScript'), + "check": m.get('CheckStatusScript'), + "dataEnable": m.get('DataEnableScript'), + "dataDisable": m.get('DataDisableScript'), + } + self.interface = m.get('IF') + self.MTU = m.get('MTU') + self.trace = m.get('trace') == True + self.logStore = m.get('LogStore') + self.cmd_prefix = m.get('CmdPrefix') + logging.info(f'initialized UE {self.module_name}@{self.host} from {filename}') + def __str__(self): + return f"{self.module_name}@{self.host} [IP: {self.getIP()}]" + def __repr__(self): + return self.__str__() + + def _command(self, cmd, silent = False): + if cmd is None: + raise Exception("no command provided") + if self.host == "" or self.host == "localhost": + c = cls_cmd.LocalCmd() + else: + c = cls_cmd.RemoteCmd(self.host) + response = c.run(cmd, silent=silent) + c.close() + return response.stdout #-----------------$ #PUBLIC Methods$ #-----------------$ - #this method checks if the specified Process is running on the server hosting the module - #if not it will be started - def CheckCMProcess(self,CNType): - HOST=self.HostUsername+'@'+self.HostIPAddress - COMMAND="ps aux | grep --colour=never " + self.Process['Name'] + " | grep -v grep " - logging.debug(COMMAND) - ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) - result = ssh.stdout.readlines() - if len(result)!=0: - logging.debug(self.Process['Name'] + " process found") - return True - else:#start process and check again - logging.debug(self.Process['Name'] + " process NOT found") - #starting the process - logging.debug('Starting ' + self.Process['Name']) - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -f /tmp/quectel-cm.log','\$',5) - mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S stdbuf -o0 ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' > /tmp/quectel-cm.log 2>&1 &','\$',5) - mySSH.close() - #checking the process + def initialize(self): + if self.trace: + raise Exception("UE tracing not implemented yet") + self._enableTrace() + # we first terminate to make sure the UE has been stopped + if self.cmd_dict["detach"]: + self._command(self.cmd_dict["detach"], silent=True) + self._command(self.cmd_dict["terminate"], silent=True) + self._command(self.cmd_dict["initialize"]) + + def terminate(self): + self._command(self.cmd_dict["terminate"]) + if self.trace: + raise Exception("UE tracing not implemented yet") + self._disableTrace() + return self._logCollect() + return None + + def attach(self, attach_tries = 4, attach_timeout = 60): + ip = None + while attach_tries > 0: + self._command(self.cmd_dict["attach"]) + timeout = attach_timeout + logging.debug("Waiting for IP address to be assigned") + while timeout > 0 and not ip: + time.sleep(5) + timeout -= 5 + ip = self.getIP() + if ip: + break + logging.warning(f"UE did not receive IP address after {attach_timeout} s, detaching") + attach_tries -= 1 + self._command(self.cmd_dict["detach"]) time.sleep(5) - HOST=self.HostUsername+'@'+self.HostIPAddress - COMMAND="ps aux | grep --colour=never " + self.Process['Name'] + " | grep -v grep " - logging.debug(COMMAND) - ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) - result = ssh.stdout.readlines() - if len(result)!=0: - logging.debug(self.Process['Name'] + " process found") - return True - else: - logging.debug(self.Process['Name'] + " process NOT found") - return False - - #Generic command function, using function pointers dictionary - def Command(self,cmd): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.cmd_dict[cmd],'\$',10) - time.sleep(5) - logging.debug("Module "+ cmd) - mySSH.close() - - - #this method retrieves the Module IP address (not the Host IP address) - def GetModuleIPAddress(self): - HOST=self.HostUsername+'@'+self.HostIPAddress - response= [] - tentative = 8 - while (len(response)==0) and (tentative>0): - COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never inet | grep " + self.UENetwork - if tentative == 8: - logging.debug(COMMAND) - ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) - response = ssh.stdout.readlines() - tentative-=1 - time.sleep(2) - if (tentative==0) and (len(response)==0): - logging.debug('\u001B[1;37;41m Module IP Address Not Found! Time expired \u001B[0m') - return -1 - else: #check response - result = re.search('inet (?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', response[0].decode("utf-8") ) - if result is not None: - if result.group('moduleipaddress') is not None: - self.UEIPAddress = result.group('moduleipaddress') - logging.debug('\u001B[1mUE Module IP Address is ' + self.UEIPAddress + '\u001B[0m') - return 0 - else: - logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m') - return -1 - else: - logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m') - return -1 - - def CheckModuleMTU(self): - HOST=self.HostUsername+'@'+self.HostIPAddress - response= [] - tentative = 3 - while (len(response)==0) and (tentative>0): - COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never mtu" - logging.debug(COMMAND) - ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) - response = ssh.stdout.readlines() - tentative-=1 - time.sleep(10) - if (tentative==0) and (len(response)==0): - logging.debug('\u001B[1;37;41m Module NIC MTU Not Found! Time expired \u001B[0m') - return -1 - else: #check response - result = re.search('mtu (?P[0-9]+)', response[0].decode("utf-8") ) - if result is not None: - if (result.group('mtu') is not None) and (str(result.group('mtu'))==str(self.MTU)) : - logging.debug('\u001B[1mUE Module NIC MTU is ' + str(self.MTU) + ' as expected\u001B[0m') - return 0 - else: - logging.debug('\u001B[1;37;41m Incorrect Module NIC MTU ' + str(result.group('mtu')) + '! Expected : ' + str(self.MTU) + '\u001B[0m') - return -1 - else: - logging.debug('\u001B[1;37;41m Module NIC MTU Not Found! \u001B[0m') - return -1 - - def EnableTrace(self): - if self.ue_trace=="yes": - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - #delete old artifacts - mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -rf ci_qlog','\$',5) - #start Trace, artifact is created in home dir - mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg > /dev/null 2>&1 &','\$', 5) - mySSH.close() - - def DisableTrace(self): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('echo ' + self.HostPassword + ' | sudo -S killall --signal=SIGINT *QLog*', '\$',5) - mySSH.close() - - - def DisableCM(self): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - mySSH.command('echo ' + self.HostPassword + ' | sudo -S killall --signal SIGKILL *'+self.Process['Name']+'*', '\$', 5) - mySSH.close() - - - def LogCollect(self): - if self.ue_trace=="yes": - mySSH = sshconnection.SSHConnection() - mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) - #archive qlog to USB stick in /media/usb-drive/ci_qlogs with datetime suffix - now=datetime.now() - now_string = now.strftime("%Y%m%d-%H%M") - source='ci_qlog' - destination= self.LogStore + '/ci_qlog_'+now_string+'.zip' - #qlog artifact is zipped into the target folder - mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' > /dev/null 2>&1 &','\$', 10) - mySSH.close() - #post action : log cleaning to make sure enough space is reserved for the next run - Log_Mgt=cls_log_mgt.Log_Mgt(self.HostUsername,self.HostIPAddress, self.HostPassword, self.LogStore) - Log_Mgt.LogRotation() + if ip: + logging.debug(f'\u001B[1mUE IP Address is {ip}\u001B[0m') else: - destination="" + logging.debug('\u001B[1;37;41mUE IP Address Not Found!\u001B[0m') + return ip + + def detach(self): + self._command(self.cmd_dict["detach"]) + + def check(self): + cmd = self.cmd_dict["check"] + if cmd: + return self._command(cmd) + else: + logging.warning(f"requested status check of UE {self.getName()}, but operation is not supported") + return f"UE {self.getName()} does not support status checking" + + def dataEnable(self): + cmd = self.cmd_dict["dataEnable"] + if cmd: + self._command(cmd) + return True + else: + message = f"requested enabling data of UE {self.getName()}, but operation is not supported" + logging.error(message) + return False + + def dataDisable(self): + cmd = self.cmd_dict["dataDisable"] + if cmd: + self._command(cmd) + return True + else: + message = f"requested disabling data of UE {self.getName()}, but operation is not supported" + logging.error(message) + return False + + def getIP(self): + output = self._command(self.cmd_dict["getNetwork"], silent=True) + result = re.search('inet (?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', output) + if result and result.group('ip'): + ip = result.group('ip') + return ip + return None + + def checkMTU(self): + output = self._command(self.cmd_dict["getNetwork"], silent=True) + result = re.search('mtu (?P[0-9]+)', output) + if result and result.group('mtu') and int(result.group('mtu')) == self.MTU: + logging.debug('\u001B[1mUE Module NIC MTU is ' + str(self.MTU) + ' as expected\u001B[0m') + return True + else: + logging.debug('\u001B[1;37;41m Incorrect Module NIC MTU or MTU not found! Expected: ' + str(self.MTU) + '\u001B[0m') + return False + + def getName(self): + return self.module_name + + def getIFName(self): + return self.interface + + def getHost(self): + return self.host + + def getCmdPrefix(self): + return self.cmd_prefix if self.cmd_prefix else "" + + def _enableTrace(self): + raise Exception("not implemented") + mySSH = sshconnection.SSHConnection() + mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) + #delete old artifacts + mySSH.command('echo ' + ' ' + ' | sudo -S rm -rf ci_qlog','\$',5) + #start Trace, artifact is created in home dir + mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg > /dev/null 2>&1 &','\$', 5) + mySSH.close() + + def _disableTrace(self): + raise Exception("not implemented") + mySSH = sshconnection.SSHConnection() + mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) + mySSH.command('echo ' + ' ' + ' | sudo -S killall --signal=SIGINT *QLog*', '\$',5) + mySSH.close() + + + def _logCollect(self): + raise Exception("not implemented") + mySSH = sshconnection.SSHConnection() + mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) + #archive qlog to USB stick in /media/usb-drive/ci_qlogs with datetime suffix + now=datetime.now() + now_string = now.strftime("%Y%m%d-%H%M") + source='ci_qlog' + destination= self.LogStore + '/ci_qlog_'+now_string+'.zip' + #qlog artifact is zipped into the target folder + mySSH.command('echo $USER; echo ' + ' ' + ' | nohup sudo -S zip -r '+destination+' '+source+' > /dev/null 2>&1 &','\$', 10) + mySSH.close() + #post action : log cleaning to make sure enough space is reserved for the next run + Log_Mgt=cls_log_mgt.Log_Mgt(self.HostUsername,self.HostIPAddress, self.HostPassword, self.LogStore) return destination + diff --git a/ci-scripts/cls_oai_html.py b/ci-scripts/cls_oai_html.py index 48123f52ad..48a88a8590 100644 --- a/ci-scripts/cls_oai_html.py +++ b/ci-scripts/cls_oai_html.py @@ -84,16 +84,6 @@ class HTMLManagement(): self.CpuModel = ['', ''] self.CpuMHz = ['', ''] -#----------------------------------------------------------- -# Setters and Getters -#----------------------------------------------------------- - - def SethtmlUEConnected(self, nbUEs): - if nbUEs > 0: - self.htmlUEConnected = nbUEs - else: - self.htmlUEConnected = 1 - #----------------------------------------------------------- @@ -101,7 +91,7 @@ class HTMLManagement(): #----------------------------------------------------------- - def CreateHtmlHeader(self, ADBIPAddress): + def CreateHtmlHeader(self): if (not self.htmlHeaderCreated): logging.info('\u001B[1m----------------------------------------\u001B[0m') logging.info('\u001B[1m Creating HTML header \u001B[0m') @@ -116,7 +106,7 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.write(' Test Results for TEMPLATE_JOB_NAME job build #TEMPLATE_BUILD_ID\n') self.htmlFile.write('\n') - self.htmlFile.write('
\n') + self.htmlFile.write('
\n') self.htmlFile.write('
\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -183,15 +173,6 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.write('
\n') - if (ADBIPAddress != 'none') and (ADBIPAddress != 'modules'): - self.htmlFile.write('

' + str(self.htmlNb_Smartphones) + ' UE(s) is(are) connected to ADB bench server

\n') - self.htmlFile.write('

' + str(self.htmlNb_CATM_Modules) + ' CAT-M UE(s) is(are) connected to bench server

\n') - elif (ADBIPAddress == 'modules'): - self.htmlUEConnected = 1 - self.htmlFile.write('

1 commercial module is connected to CI bench

\n') - else: - self.htmlUEConnected = 1 - self.htmlFile.write('

1 OAI UE(s) is(are) connected to CI bench

\n') self.htmlFile.write('
\n') self.htmlFile.write('