Commit 054506f5 authored by Robert Schmidt's avatar Robert Schmidt
Browse files

Merge branch 'integration_2024_w49' into 'develop'

Integration: `2024.w49`

See merge request oai/openairinterface5g!3148

* !3065 NAS Service Request enc/dec implementation
* !3129 Refactor UL MAC PDU decoding
* !3136 Use ninja -k option in CI
* !3137 T tracer: add macpdu traces for the NR UE
* !2392 Documentation: add multi-UE deployment with RFsimulator
* !3145 a lib has been added but missed dependancies
* !3050 doc: Add instructions for 5G NR gNB frequency configuration
* !3141 CI: Allow restart of the container if deployment fails
* !3138 Align YAML config getlist with libconfig implementation
* !3140 remove un-necessary global variables
* !3146 Updates to match more fapi-compliant tx_data.request
* !3025 New threadpool, fixed in NR UE
* CI: Remove USRP mgmt_addr from LTE-2x2 conf files
* !3147 Fronthaul xran library update to F release (2. and final step towards M-plane integration)
* !3142 Add CI test to trigger RLF with high pathloss in channelmod
parents c942fe43 ac6a37fa
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -1569,6 +1569,10 @@ set(libnas_emm_msg_OBJS
  ${NAS_SRC}COMMON/EMM/MSG/UplinkNasTransport.c
)

set(libnas_fgs_msg_OBJS
  ${NAS_SRC}COMMON/EMM/MSG/fgs_service_request.c
)

set(libnas_esm_msg_OBJS
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
@@ -1682,7 +1686,6 @@ set (libnas_utils_OBJS
  ${NAS_SRC}COMMON/UTIL/nas_timer.c
  ${NAS_SRC}COMMON/UTIL/socket.c
  ${NAS_SRC}COMMON/UTIL/stty.c
  ${NAS_SRC}COMMON/UTIL/TLVEncoder.c
  ${NAS_SRC}COMMON/UTIL/TLVDecoder.c
  ${NAS_SRC}COMMON/UTIL/OctetString.c
)
@@ -1793,6 +1796,7 @@ add_library(LIB_NAS_SIMUE
  ${libnas_api_OBJS}
  ${libnas_ue_api_OBJS}
  ${libnas_emm_msg_OBJS}
  ${libnas_fgs_msg_OBJS}
  ${libnas_esm_msg_OBJS}
  ${libnas_ies_OBJS}
  ${libnas_utils_OBJS}
@@ -1839,6 +1843,7 @@ include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
include_directories(${NAS_SRC}UE/API/USIM)
include_directories(${NAS_SRC}UE/EMM)
include_directories(${NAS_SRC}UE/EMM/MSG)
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
@@ -1905,12 +1910,6 @@ add_executable(measurement_display
  ${OPENAIR_DIR}/common/utils/threadPool/measurement_display.c)
target_link_libraries (measurement_display minimal_lib)

add_executable(test5Gnas
  ${OPENAIR_DIR}/openair3/TEST/test5Gnas.c
)
target_link_libraries (test5Gnas LIB_5GNAS_GNB minimal_lib )


# lte-softmodem is both eNB and UE implementation
###################################################

+46 −43
Original line number Diff line number Diff line
@@ -145,10 +145,6 @@ def AnalyzeBuildLogs(buildRoot, images, globalStatus):
		collectInfo[image] = files
	return collectInfo

def GetContainerName(ssh, svcName, file):
	ret = ssh.run(f"docker compose -f {file} config --format json {svcName}  | jq -r '.services.\"{svcName}\".container_name'", silent=True)
	return ret.stdout

def GetImageName(ssh, svcName, file):
	ret = ssh.run(f"docker compose -f {file} config --format json {svcName}  | jq -r '.services.\"{svcName}\".image'", silent=True)
	if ret.returncode != 0:
@@ -156,17 +152,18 @@ def GetImageName(ssh, svcName, file):
	else:
		return ret.stdout.strip()

def GetContainerHealth(ssh, containerName):
	if containerName is None:
		return False
	if 'db_init' in containerName or 'db-init' in containerName: # exits with 0, there cannot be healthy
		return True
def GetServiceHealth(ssh, svcName, file):
	if svcName is None:
		return False, f"Service {svcName} not found in {file}"
	image = GetImageName(ssh, svcName, file)
	if 'db_init' in svcName or 'db-init' in svcName: # exits with 0, there cannot be healthy
		return True, f"Service {svcName} healthy, image {image}"
	for _ in range(8):
		result = ssh.run(f'docker inspect --format="{{{{.State.Health.Status}}}}" {containerName}', silent=True)
		result = ssh.run(f"docker compose -f {file} ps --format json {svcName}  | jq -r 'if type==\"array\" then .[0].Health else .Health end'", silent=True)
		if result.stdout == 'healthy':
			return True
			return True, f"Service {svcName} healthy, image {image}"
		time.sleep(5)
	return False
	return False, f"Failed to deploy: service {svcName}"

def ExistEnvFilePrint(ssh, wd, prompt='env vars in existing'):
	ret = ssh.run(f'cat {wd}/.env', silent=True, reportNonZero=False)
@@ -218,9 +215,9 @@ def GetServices(ssh, requested, file):
    else:
        return requested

def CopyinContainerLog(ssh, lSourcePath, yaml, containerName, filename):
def CopyinServiceLog(ssh, lSourcePath, yaml, svcName, wd_yaml, filename):
	remote_filename = f"{lSourcePath}/cmake_targets/log/{filename}"
	ssh.run(f'docker logs {containerName} &> {remote_filename}')
	ssh.run(f'docker compose -f {wd_yaml} logs {svcName} --no-log-prefix &> {remote_filename}')
	local_dir = f"{os.getcwd()}/../cmake_targets/log/{yaml}"
	local_filename = f"{local_dir}/{filename}"
	return ssh.copyin(remote_filename, local_filename)
@@ -336,6 +333,7 @@ class Containerize():
		self.imageToCopy = ''
		#checkers from xml
		self.ran_checkers={}
		self.num_attempts = 1

		self.flexricTag = ''

@@ -843,50 +841,55 @@ class Containerize():

	def DeployObject(self, HTML):
		svr = self.eNB_serverId[self.eNB_instance]
		num_attempts = self.num_attempts
		lIpAddr, lSourcePath = self.GetCredentials(svr)
		logging.debug('\u001B[1m Deploying OAI Object on server: ' + lIpAddr + '\u001B[0m')
		logging.debug(f'Deploying OAI Object on server: {lIpAddr}')
		yaml = self.yamlPath[self.eNB_instance].strip('/')
		# creating the log folder by default
		local_dir = f"{os.getcwd()}/../cmake_targets/log/{yaml.split('/')[-1]}"
		os.system(f'mkdir -p {local_dir}')
		wd = f'{lSourcePath}/{yaml}'

		wd_yaml = f'{wd}/docker-compose.y*ml'
		yaml_dir = yaml.split('/')[-1]
		with cls_cmd.getConnection(lIpAddr) as ssh:
			services = GetServices(ssh, self.services[self.eNB_instance], f"{wd}/docker-compose.y*ml")
			services = GetServices(ssh, self.services[self.eNB_instance], wd_yaml)
			if services == [] or services == ' ' or services == None:
				msg = "Cannot determine services to start"
				msg = 'Cannot determine services to start'
				logging.error(msg)
				HTML.CreateHtmlTestRowQueue('N/A', 'KO', [msg])
				return False

			ExistEnvFilePrint(ssh, wd)
			WriteEnvFile(ssh, services, wd, self.deploymentTag, self.flexricTag)

			logging.info(f"will start services {services}")
			status = ssh.run(f'docker compose -f {wd}/docker-compose.y*ml up -d -- {services}')
			if num_attempts <= 0:
				raise ValueError(f'Invalid value for num_attempts: {num_attempts}, must be greater than 0')
			for attempt in range(num_attempts):
				imagesInfo = []
				healthInfo = []
				logging.info(f'will start services {services}')
				status = ssh.run(f'docker compose -f {wd_yaml} up -d -- {services}')
				if status.returncode != 0:
				msg = f"cannot deploy services {services}: {status.stdout}"
					msg = f'cannot deploy services {services}: {status.stdout}'
					logging.error(msg)
				HTML.CreateHtmlTestRowQueue('N/A', 'KO', [msg])
					HTML.CreateHtmlTestRowQueue('N/A', 'NOK', [msg])
					return False

			imagesInfo = []
			fstatus = True
				for svc in services.split():
				containerName = GetContainerName(ssh, svc, f"{wd}/docker-compose.y*ml")
				healthy = GetContainerHealth(ssh, containerName)
				if not healthy:
					imagesInfo += [f"Failed to deploy: service {svc}"]
					fstatus = False
				else:
					image = GetImageName(ssh, svc, f"{wd}/docker-compose.y*ml")
					logging.info(f"service {svc} healthy, container {containerName}, image {image}")
					imagesInfo += [f"service {svc} healthy, image {image}"]
		if fstatus:
					health, msg = GetServiceHealth(ssh, svc, f'{wd_yaml}')
					logging.info(msg)
					imagesInfo.append(msg)
					healthInfo.append(health)
				deployed = all(healthInfo)
				if deployed:
					break
				elif (attempt < num_attempts - 1):
					logging.warning(f'Failed to deploy on attempt {attempt}, restart services {services}')
					for svc in services.split():
						CopyinServiceLog(ssh, lSourcePath, yaml_dir, svc, wd_yaml, f'{svc}-{HTML.testCase_id}-attempt{attempt}.log')
					ssh.run(f'docker compose -f {wd_yaml} down -- {services}')
		if deployed:
			HTML.CreateHtmlTestRowQueue('N/A', 'OK', ['\n'.join(imagesInfo)])
		else:
			HTML.CreateHtmlTestRowQueue('N/A', 'KO', ['\n'.join(imagesInfo)])
		return fstatus
		return deployed

	def UndeployObject(self, HTML, RAN):
		svr = self.eNB_serverId[self.eNB_instance]
@@ -902,7 +905,7 @@ class Containerize():
			if services is not None:
				all_serv = " ".join([s for s, _ in services])
				ssh.run(f'docker compose -f {wd}/docker-compose.y*ml stop -- {all_serv}')
				copyin_res = all(CopyinContainerLog(ssh, lSourcePath, yaml_dir, c, f'{s}-{HTML.testCase_id}.log') for s, c in services)
				copyin_res = all(CopyinServiceLog(ssh, lSourcePath, yaml_dir, s, f"{wd}/docker-compose.y*ml", f'{s}-{HTML.testCase_id}.log') for s, c in services)
			else:
				logging.warning('could not identify services to stop => no log file')
			ssh.run(f'docker compose -f {wd}/docker-compose.y*ml down -v')
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ RUs = (
         max_pdschReferenceSignalPower = -27;
         max_rxgain                    = 75;
         eNB_instances  = [0];
         sdr_addrs      = "mgmt_addr=172.21.19.13,addr=192.168.80.250";
         sdr_addrs      = "addr=192.168.80.250";

    }
);  
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ RUs = (
         max_pdschReferenceSignalPower = -27;
         max_rxgain                    = 75;
         eNB_instances  = [0];
         sdr_addrs      = "mgmt_addr=172.21.19.13,addr=192.168.80.250";
         sdr_addrs      = "addr=192.168.80.250";

    }
);  
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ RUs = (
         max_pdschReferenceSignalPower = -27;
         max_rxgain                    = 75;
         eNB_instances  = [0];
         sdr_addrs      = "mgmt_addr=172.21.19.13,addr=192.168.80.250";
         sdr_addrs      = "addr=192.168.80.250";

    }
);  
Loading