diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..d7126a6224
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+# vim swp
+*.swp
+
+# log and exec file
+log/
+lte_build_oai/
+targets/bin/
+cmake_targets/nas_sim_tools/build/
diff --git a/README.txt b/README.txt
index aec938c0d3..37f6a86571 100644
--- a/README.txt
+++ b/README.txt
@@ -17,7 +17,7 @@ openairinterface5g
├── maketags : Script to generate emacs tags
├── nfapi : Contains the NFAPI code. A local Readme file provides more details.
├── openair1 : 3GPP LTE Rel-10/12 PHY layer + PHY RF simulation. A local Readme file provides more details.
-├── openair2 : 3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
+├── openair2 : 3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
├── COMMON
├── DOCS
├── ENB_APP
@@ -61,3 +61,5 @@ v1.0.0 -> January 2019. This version first implements the architectural split de
S1-flex has been introduced.
New tools: config library, telnet server, ...
A lot of bugfixes and a proper automated Continuous Integration process validates contributions.
+v1.0.1 -> February 2019: Bug fix for the UE L1 simulator.
+v1.0.2 -> February 2019: Full OAI support for 3.13.1 UHD
diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab
index fc0290fc44..56624d3230 100644
--- a/ci-scripts/Jenkinsfile-gitlab
+++ b/ci-scripts/Jenkinsfile-gitlab
@@ -33,15 +33,18 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
def doRedHatBuild = false
def doFlexranCtrlTest = false
+// Location of the executor node
+def nodeExecutor = params.nodeExecutor
+
pipeline {
agent {
- label 'bellatrix'
+ label nodeExecutor
}
options {
disableConcurrentBuilds()
timestamps()
gitLabConnection('OAI GitLab')
- gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", "Test L2-sim", "Test-FDD-Band7", "Test-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40"])
+ gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", "Test L2-sim", "Test-Mono-FDD-Band7", "Test-Mono-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40", "Test-Mono-FDD-Band13"])
ansiColor('xterm')
}
@@ -85,6 +88,9 @@ pipeline {
echo "GitLab Act is ${env.gitlabActionType}"
script {
if ("MERGE".equals(env.gitlabActionType)) {
+ // since a bit, in push events, gitlabUserEmail is not populated
+ gitCommitAuthorEmailAddr = env.gitlabUserEmail
+ echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}"
// GitLab-Jenkins plugin integration is lacking to perform the merge by itself
// Doing it manually --> it may have merge conflicts
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
@@ -104,6 +110,11 @@ pipeline {
} else {
echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}"
+ // since a bit, in push events, gitlabUserEmail is not populated
+ gitCommitAuthorEmailAddr = sh returnStdout: true, script: 'git log -n1 --pretty=format:%ae ${GIT_COMMIT}'
+ gitCommitAuthorEmailAddr = gitCommitAuthorEmailAddr.trim()
+ echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}"
+ sh "git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG"
sh "zip -r -qq localZip.zip ."
// Running astyle options on all C/H files in the repository
@@ -129,6 +140,7 @@ pipeline {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
addGitLabMRComment comment: message
+ currentBuild.result = 'FAILURE'
}
}
}
@@ -166,14 +178,6 @@ pipeline {
}
}
- stage ("Start VM -- L2-Sim") {
- steps {
- timeout (time: 5, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
- }
- }
- }
-
stage ("Start VM -- phy-sim") {
steps {
timeout (time: 5, unit: 'MINUTES') {
@@ -223,7 +227,7 @@ pipeline {
steps {
gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
@@ -232,20 +236,11 @@ pipeline {
steps {
gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
}
- stage ("Build L2-Simulator-eNB") {
- steps {
- //gitlabCommitStatus(name: "Build UE-ethernet") {
- timeout (time: 20, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
- }
- //}
- }
- }
stage ("Build physical simulators") {
steps {
gitlabCommitStatus(name: "Build phy-sim") {
@@ -260,7 +255,7 @@ pipeline {
expression {doRedHatBuild}
}
steps {
- gitlabCommitStatus(name: "Build eNb-USRP-CentOS") {
+ gitlabCommitStatus(name: "Build eNb-USRP-RHE") {
script {
try {
withCredentials([
@@ -271,7 +266,7 @@ pipeline {
}
}
} catch (Exception e) {
- echo "Red Hat build failed not an error now"
+ echo "Red Hat build failed but we could keep running pipeline if all ubuntu-based build passed"
}
}
}
@@ -279,6 +274,11 @@ pipeline {
}
}
post {
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
always {
script {
dir ('archives') {
@@ -289,6 +289,17 @@ pipeline {
}
if ("MERGE".equals(env.gitlabActionType)) {
sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
+ // If the merge request has introduced more CPPCHECK errors or warnings, notifications in GitLab
+ if (fileExists('oai_cppcheck_added_errors.txt')) {
+ def ret=readFile('./oai_cppcheck_added_errors.txt').trim();
+ if ("0".equals(ret)) {
+ echo "No added cppcheck warnings/errors in this merge request"
+ } else {
+ def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some modified files in Merge Request MAY have INTRODUCED up to " + ret + " CPPCHECK errors/warnings"
+ addGitLabMRComment comment: message
+ }
+ }
+ // If the merge request has introduced compilation warnings, notifications in GitLab
sh "./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
def res=readFile('./oai_warning_files.txt').trim();
if ("0".equals(res)) {
@@ -312,174 +323,160 @@ pipeline {
stage ("Variant Tests") {
parallel {
- stage ("Test physical simulators") {
- steps {
- gitlabCommitStatus(name: "Test phy-sim") {
- timeout (time: 20, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
- }
- }
- }
- }
- stage ("Test basic simulator") {
- steps {
- gitlabCommitStatus(name: "Test basic-sim") {
- timeout (time: 30, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
- }
- }
- }
- }
- stage ("Test L2 simulator") {
- steps {
- gitlabCommitStatus(name: "Test L2-sim") {
- timeout (time: 30, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
- }
- }
- }
- }
- stage ("Build Flexran Controller") {
- when {
- expression {doFlexranCtrlTest}
- }
- steps {
- timeout (time: 20, unit: 'MINUTES') {
- sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant flexran-rtc --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
- }
- }
- }
- stage ("Test FDD - Band 7 - B210") {
- steps {
- script {
- if ("MERGE".equals(env.gitlabActionType)) {
- gitlabCommitStatus(name: "Test-FDD-Band7") {
- build job: 'eNB-CI-FDD-Band7-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
- string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
- booleanParam(name: 'eNB_mergeRequest', value: true)
- ]
- }
- } else {
- gitlabCommitStatus(name: "Test-FDD-Band7") {
- build job: 'eNB-CI-FDD-Band7-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
- string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
- booleanParam(name: 'eNB_mergeRequest', value: false)
- ]
- }
- }
- }
- }
- post {
- // In case of any non-success, we are retrieving the HTML report of the last completed
- // slave job.
- // The only drop-back is that we may retrieve the HTML report of a previous build
- always {
- script {
- if (!fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) {
- copyArtifacts(projectName: 'eNB-CI-FDD-Band7-B210',
- filter: 'test_results*.html',
- selector: lastCompleted())
- if (fileExists('test_results-eNB-CI-FDD-Band7-B210.html')) {
- sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-FDD-Band7-B210.html"
- archiveArtifacts artifacts: 'test_results-eNB-CI-FDD-Band7-B210.html'
+ stage ("VM-based tests") {
+ stages {
+ stage ("Test physical simulators") {
+ steps {
+ script {
+ timeout (time: 20, unit: 'MINUTES') {
+ try {
+ gitlabCommitStatus(name: "Test phy-sim") {
+ sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ }
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
}
}
}
}
- }
- }
- stage ("Test TDD - Band 40 - B210") {
- steps {
- script {
- if ("MERGE".equals(env.gitlabActionType)) {
- gitlabCommitStatus(name: "Test-TDD-Band40") {
- build job: 'eNB-CI-TDD-Band40-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
- string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
- booleanParam(name: 'eNB_mergeRequest', value: true)
- ]
- }
- } else {
- gitlabCommitStatus(name: "Test-TDD-Band40") {
- build job: 'eNB-CI-TDD-Band40-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
- string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
- booleanParam(name: 'eNB_mergeRequest', value: false)
- ]
+ stage ("Build Flexran Controller") {
+ when {
+ expression {doFlexranCtrlTest}
+ }
+ steps {
+ script {
+ timeout (time: 20, unit: 'MINUTES') {
+ try {
+ sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant flexran-rtc --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
+ }
}
}
}
- }
- post {
- // In case of any non-success, we are retrieving the HTML report of the last completed
- // slave job.
- // The only drop-back is that we may retrieve the HTML report of a previous build
- always {
- script {
- if (!fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) {
- copyArtifacts(projectName: 'eNB-CI-TDD-Band40-B210',
- filter: 'test_results*.html',
- selector: lastCompleted())
- if (fileExists('test_results-eNB-CI-TDD-Band40-B210.html')) {
- sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-TDD-Band40-B210.html"
- archiveArtifacts artifacts: 'test_results-eNB-CI-TDD-Band40-B210.html'
+ stage ("Test basic simulator") {
+ steps {
+ script {
+ timeout (time: 30, unit: 'MINUTES') {
+ try {
+ gitlabCommitStatus(name: "Test basic-sim") {
+ sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ }
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
}
}
}
}
+ stage ("Test L1 simulator") {
+ steps {
+ script {
+ timeout (time: 30, unit: 'MINUTES') {
+ try {
+ gitlabCommitStatus(name: "Test L1-sim") {
+ sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l1-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+ }
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ }
+ stage ("Test RF simulator") {
+ steps {
+ script {
+ timeout (time: 30, unit: 'MINUTES') {
+ try {
+ gitlabCommitStatus(name: "Test RF-sim") {
+ sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant rf-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
+ }
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ }
+ stage ("Test L2 simulator") {
+ steps {
+ script {
+ timeout (time: 30, unit: 'MINUTES') {
+ try {
+ gitlabCommitStatus(name: "Test L2-sim") {
+ sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ }
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ }
+ stage ("Destroy all Virtual Machines") {
+ steps {
+ sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+ }
+ }
+ }
+ }
+ stage ("Test MONOLITHIC - FDD - Band 7 - B210") {
+ steps {
+ script {
+ triggerSlaveJob ('eNB-CI-FDD-Band7-B210', 'Test-Mono-FDD-Band7')
+ }
+ }
+ post {
+ always {
+ script {
+ finalizeSlaveJob('eNB-CI-FDD-Band7-B210')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ stage ("Test MONOLITHIC - TDD - Band 40 - B210") {
+ steps {
+ script {
+ triggerSlaveJob ('eNB-CI-TDD-Band40-B210', 'Test-Mono-TDD-Band40')
+ }
+ }
+ post {
+ always {
+ script {
+ finalizeSlaveJob('eNB-CI-TDD-Band40-B210')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
}
}
stage ("Test IF4p5 - FDD - Band 7 - B210") {
steps {
script {
- if ("MERGE".equals(env.gitlabActionType)) {
- gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") {
- build job: 'eNB-CI-IF4p5-FDD-Band7-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
- string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
- booleanParam(name: 'eNB_mergeRequest', value: true)
- ]
- }
- } else {
- gitlabCommitStatus(name: "Test-IF4p5-FDD-Band7") {
- build job: 'eNB-CI-IF4p5-FDD-Band7-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
- string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
- booleanParam(name: 'eNB_mergeRequest', value: false)
- ]
- }
- }
+ sh "sleep 60"
+ triggerSlaveJob ('eNB-CI-IF4p5-FDD-Band7-B210', 'Test-IF4p5-FDD-Band7')
}
}
post {
- // In case of any non-success, we are retrieving the HTML report of the last completed
- // slave job.
- // The only drop-back is that we may retrieve the HTML report of a previous build
always {
script {
- if (!fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) {
- copyArtifacts(projectName: 'eNB-CI-IF4p5-FDD-Band7-B210',
- filter: 'test_results*.html',
- selector: lastCompleted())
- if (fileExists('test_results-eNB-CI-IF4p5-FDD-Band7-B210.html')) {
- sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-FDD-Band7-B210.html"
- archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-FDD-Band7-B210.html'
- }
- }
+ finalizeSlaveJob('eNB-CI-IF4p5-FDD-Band7-B210')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
}
}
}
@@ -487,44 +484,78 @@ pipeline {
stage ("Test IF4p5 - TDD - Band 40 - B210") {
steps {
script {
- if ("MERGE".equals(env.gitlabActionType)) {
- gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") {
- build job: 'eNB-CI-IF4p5-TDD-Band40-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
- string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
- booleanParam(name: 'eNB_mergeRequest', value: true)
- ]
- }
- } else {
- gitlabCommitStatus(name: "Test-IF4p5-TDD-Band40") {
- build job: 'eNB-CI-IF4p5-TDD-Band40-B210',
- parameters: [
- string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
- string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
- string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
- booleanParam(name: 'eNB_mergeRequest', value: false)
- ]
- }
- }
+ sh "sleep 60"
+ triggerSlaveJob ('eNB-CI-IF4p5-TDD-Band40-B210', 'Test-IF4p5-TDD-Band40')
}
}
post {
- // In case of any non-success, we are retrieving the HTML report of the last completed
- // slave job.
- // The only drop-back is that we may retrieve the HTML report of a previous build
always {
script {
- if (!fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) {
- copyArtifacts(projectName: 'eNB-CI-IF4p5-TDD-Band40-B210',
- filter: 'test_results*.html',
- selector: lastCompleted())
- if (fileExists('test_results-eNB-CI-IF4p5-TDD-Band40-B210.html')) {
- sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-eNB-CI-IF4p5-TDD-Band40-B210.html"
- archiveArtifacts artifacts: 'test_results-eNB-CI-IF4p5-TDD-Band40-B210.html'
- }
- }
+ finalizeSlaveJob('eNB-CI-IF4p5-TDD-Band40-B210')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ stage ("Test MONOLITHIC - FDD - Band 13 - B210") {
+ steps {
+ script {
+ triggerSlaveJob ('eNB-CI-MONO-FDD-Band13-B210', 'Test-Mono-FDD-Band13')
+ }
+ }
+ post {
+ always {
+ script {
+ finalizeSlaveJob('eNB-CI-MONO-FDD-Band13-B210')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ stage ("Test OAI UE - FDD - Band 20 - B200") {
+ steps {
+ script {
+ triggerSlaveJobNoGitLab ('UE-CI-FDD-Band20-B200')
+ }
+ }
+ post {
+ always {
+ script {
+ finalizeSlaveJob('UE-CI-FDD-Band20-B200')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ }
+ }
+ }
+ }
+ stage ("Test OAI UE - OAI eNB - FDD - Band 7 - B200") {
+ steps {
+ script {
+ // Delayed trigger on slave job, so it is always the last one to run
+ sh "sleep 240"
+ triggerSlaveJob ('eNB-UE-CI-MONO-FDD-Band7-B200', 'Test-eNB-OAI-UE-FDD-Band7')
+ }
+ }
+ post {
+ always {
+ script {
+ finalizeSlaveJob('eNB-UE-CI-MONO-FDD-Band7-B200')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
}
}
}
@@ -552,11 +583,6 @@ pipeline {
}
}
}
- stage ("Destroy all Virtual Machines") {
- steps {
- sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
- }
- }
}
post {
always {
@@ -565,13 +591,18 @@ pipeline {
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
emailext attachmentsPattern: '*results*.html',
body: '''Hi,
+
Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
Regards,
OAI CI Team''',
replyTo: 'no-reply@openairinterface.org',
subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!',
- to: env.gitlabUserEmail
+ to: gitCommitAuthorEmailAddr
+
+ if (fileExists('.git/CI_COMMIT_MSG')) {
+ sh "rm -f .git/CI_COMMIT_MSG"
+ }
}
}
success {
@@ -602,3 +633,66 @@ OAI CI Team''',
}
}
}
+
+// ---- Slave Job functions
+
+def triggerSlaveJob (jobName, gitlabStatusName) {
+ if ("MERGE".equals(env.gitlabActionType)) {
+ gitlabCommitStatus(name: gitlabStatusName) {
+ build job: jobName,
+ parameters: [
+ string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
+ string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
+ string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
+ booleanParam(name: 'eNB_mergeRequest', value: true),
+ string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
+ ]
+ }
+ } else {
+ gitlabCommitStatus(name: gitlabStatusName) {
+ build job: jobName,
+ parameters: [
+ string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
+ string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
+ string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
+ booleanParam(name: 'eNB_mergeRequest', value: false)
+ ]
+ }
+ }
+}
+
+def triggerSlaveJobNoGitLab (jobName) {
+ if ("MERGE".equals(env.gitlabActionType)) {
+ build job: jobName,
+ parameters: [
+ string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
+ string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
+ string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
+ booleanParam(name: 'eNB_mergeRequest', value: true),
+ string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
+ ]
+ } else {
+ build job: jobName,
+ parameters: [
+ string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
+ string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
+ string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
+ booleanParam(name: 'eNB_mergeRequest', value: false)
+ ]
+ }
+}
+
+def finalizeSlaveJob(jobName) {
+ // In case of any non-success, we are retrieving the HTML report of the last completed
+ // slave job. The only drop-back is that we may retrieve the HTML report of a previous build
+ fileName = "test_results-${jobName}.html"
+ if (!fileExists(fileName)) {
+ copyArtifacts(projectName: jobName,
+ filter: 'test_results*.html',
+ selector: lastCompleted())
+ if (fileExists(fileName)) {
+ sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}"
+ archiveArtifacts artifacts: fileName
+ }
+ }
+}
diff --git a/ci-scripts/Jenkinsfile-tmp-full-ran b/ci-scripts/Jenkinsfile-tmp-full-ran
new file mode 100644
index 0000000000..3e0777b6a7
--- /dev/null
+++ b/ci-scripts/Jenkinsfile-tmp-full-ran
@@ -0,0 +1,430 @@
+#!/bin/groovy
+/*
+ * 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
+ */
+
+// Template Jenkins Declarative Pipeline script to run Test w/ RF HW
+
+// Location of the python executor node shall be in the same subnet as the others servers
+def pythonExecutor = params.pythonExecutor
+
+// Location of the test XML file to be run
+def testXMLFile = params.pythonTestXmlFile
+def mainPythonAllXmlFiles = ""
+def buildStageStatus = true
+
+// Name of the test stage
+def testStageName = params.pipelineTestStageName
+
+// Name of the phone resource
+def ciSmartPhoneResource = params.smartphonesResource
+
+// Name of the phone resource
+def oaiUEResource = params.oaiUEResource
+
+// Terminate Status
+def termENB = 0
+def termOAIUE = 1
+def termStatusArray = new Boolean[termOAIUE + 1]
+termStatusArray[termENB] = false
+termStatusArray[termOAIUE] = false
+
+// Global Parameters. Normally they should be populated when the master job
+// triggers the slave job with parameters
+def eNB_Repository
+def eNB_Branch
+def eNB_CommitID
+def eNB_AllowMergeRequestProcess = false
+def eNB_TargetBranch
+
+pipeline {
+ agent {
+ label pythonExecutor
+ }
+ options {
+ disableConcurrentBuilds()
+ ansiColor('xterm')
+ lock(extra: [[resource: ciSmartPhoneResource]], resource: ciSmartPhoneResource)
+ }
+
+ stages {
+ stage ("Verify Parameters") {
+ steps {
+ script {
+ echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
+ def allParametersPresent = true
+
+ // It is already to late to check it
+ if (params.pythonExecutor != null) {
+ echo "eNB CI executor node : ${pythonExecutor}"
+ }
+ // If not present picking a default Stage Name
+ if (params.pipelineTestStageName == null) {
+ // picking default
+ testStageName = 'Template Test Stage'
+ }
+
+ if (params.smartphonesResource == null) {
+ allParametersPresent = false
+ }
+ if (params.oaiUEResource == null) {
+ allParametersPresent = false
+ }
+ if (params.eNB_IPAddress == null) {
+ allParametersPresent = false
+ }
+ if (params.eNB_SourceCodePath == null) {
+ allParametersPresent = false
+ }
+ if (params.eNB_Credentials == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_IPAddress == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_SourceCodePath == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_Credentials == null) {
+ allParametersPresent = false
+ }
+ // the following 4 parameters should be pushed by the master trigger
+ // if not present, take the job GIT variables (used for developing)
+ if (params.eNB_Repository == null) {
+ eNB_Repository = env.GIT_URL
+ } else {
+ eNB_Repository = params.eNB_Repository
+ }
+ echo "eNB_Repository : ${eNB_Repository}"
+ if (params.eNB_Branch == null) {
+ eNB_Branch = env.GIT_BRANCH
+ } else {
+ eNB_Branch = params.eNB_Branch
+ }
+ echo "eNB_Branch : ${eNB_Branch}"
+ if (params.eNB_CommitID == null) {
+ eNB_CommitID = env.GIT_COMMIT
+ } else {
+ eNB_CommitID = params.eNB_CommitID
+ }
+ echo "eNB_CommitID : ${eNB_CommitID}"
+ if (params.eNB_mergeRequest != null) {
+ eNB_AllowMergeRequestProcess = params.eNB_mergeRequest
+ if (eNB_AllowMergeRequestProcess) {
+ if (params.eNB_TargetBranch != null) {
+ eNB_TargetBranch = params.eNB_TargetBranch
+ } else {
+ eNB_TargetBranch = 'develop'
+ }
+ echo "eNB_TargetBranch : ${eNB_TargetBranch}"
+ }
+ }
+
+ if (params.EPC_IPAddress == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_Type == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_SourceCodePath == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_Credentials == null) {
+ 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) {
+ sh "git fetch"
+ sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest"
+ } else {
+ sh "git fetch"
+ sh "git checkout -f ${eNB_CommitID}"
+ }
+ } else {
+ echo "Some parameters are missing"
+ sh "./ci-scripts/fail.sh"
+ }
+ }
+ }
+ }
+ stage ("Build and Test") {
+ steps {
+ script {
+ dir ('ci-scripts') {
+ echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
+ // If not present picking a default XML file
+ if (params.pythonTestXmlFile == null) {
+ // picking default
+ testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml'
+ echo "Test XML file(default): ${testXMLFile}"
+ mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
+ } else {
+ String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
+ for (xmlFile in myXmlTestSuite) {
+ if (fileExists(xmlFile)) {
+ mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
+ echo "Test XML file : ${xmlFile}"
+ }
+ }
+ }
+ withCredentials([
+ [$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 --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}"
+ String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
+ for (xmlFile in myXmlTestSuite) {
+ if (fileExists(xmlFile)) {
+ try {
+ sh "python3 main.py --mode=TesteNB --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${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}"
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ buildStageStatus = false
+ }
+ }
+ }
+ sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}"
+ }
+ }
+ }
+ }
+ }
+ stage ("Terminate") {
+ parallel {
+ stage('Terminate eNB') {
+ steps {
+ echo '\u2705 \u001B[32mTerminate eNB\u001B[0m'
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=TerminateeNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
+ }
+ }
+ post {
+ success {
+ script {
+ termStatusArray[termENB] = true
+ }
+ }
+ }
+ }
+ stage('Terminate OAI-UE') {
+ steps {
+ echo '\u2705 \u001B[32mTerminate OAI-UE\u001B[0m'
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=TerminateOAIUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}"
+ }
+ }
+ post {
+ success {
+ script {
+ termStatusArray[termOAIUE] = true
+ }
+ }
+ }
+ }
+ }
+ }
+ stage('Log Collection') {
+ parallel {
+ stage('Log Collection (eNB - Run)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}"
+
+ echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m'
+ sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("enb.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "enb.log.${env.BUILD_ID}.zip"
+ }
+ if(fileExists("ci-scripts/test_results.html")) {
+ sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
+ sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID} #' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
+ archiveArtifacts "test_results-${JOB_NAME}.html"
+ }
+ }
+ }
+ }
+ stage('Log Collection (OAI UE - Run)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (OAI UE - Run)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectOAIUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}"
+
+ echo '\u2705 \u001B[32mLog Transfer (OAI UE - Run)\u001B[0m'
+ sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/ue.log.zip ./ue.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("ue.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "ue.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (Ping)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (Ping)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectPing --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
+
+ echo '\u2705 \u001B[32mLog Transfer (Ping)\u001B[0m'
+ sh "sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/ping.log.zip ./ping.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("ping.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "ping.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (Iperf)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (Iperf)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectIperf --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
+
+ echo '\u2705 \u001B[32mLog Transfer (Iperf)\u001B[0m'
+ sh "sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/iperf.log.zip ./iperf.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("iperf.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "iperf.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (SPGW)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (SPGW)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectSPGW --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
+
+ echo '\u2705 \u001B[32mLog Transfer (SPGW)\u001B[0m'
+ sh "sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/spgw.log.zip ./spgw.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("spgw.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "spgw.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (MME)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (MME)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectMME --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
+
+ echo '\u2705 \u001B[32mLog Transfer (MME)\u001B[0m'
+ sh "sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/mme.log.zip ./mme.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("mme.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "mme.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (HSS)') {
+ steps {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password']
+ ]) {
+ echo '\u2705 \u001B[32mLog Collection (HSS)\u001B[0m'
+ sh "python3 ci-scripts/main.py --mode=LogCollectHSS --EPCIPAddress=${params.EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --EPCType=${params.EPC_Type}"
+
+ echo '\u2705 \u001B[32mLog Transfer (HSS)\u001B[0m'
+ sh "sshpass -p \'${EPC_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${EPC_Username}@${params.EPC_IPAddress}:${EPC_SourceCodePath}/scripts/hss.log.zip ./hss.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("hss.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "hss.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ always {
+ script {
+ if (params.pipelineZipsConsoleLog != null) {
+ if (params.pipelineZipsConsoleLog) {
+ echo "Archiving Jenkins console log"
+ sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true"
+ sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true"
+ if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ }
+ // Making sure that we really shutdown every thing before leaving
+ failure {
+ script {
+ if (!termStatusArray[termENB]) {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=TerminateeNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
+ }
+ }
+ if (!termStatusArray[termOAIUE]) {
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=TerminateOAIUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran
index 39347b3558..5ffaefa89f 100644
--- a/ci-scripts/Jenkinsfile-tmp-ran
+++ b/ci-scripts/Jenkinsfile-tmp-ran
@@ -106,19 +106,6 @@ pipeline {
if (params.pythonExecutor != null) {
echo "eNB CI executor node : ${pythonExecutor}"
}
- // If not present picking a default XML file
- if (params.pythonTestXmlFile == null) {
- // picking default
- testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml'
- echo "Test XML file(default): ${testXMLFile}"
- mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
- } else {
- String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
- for (xmlFile in myXmlTestSuite) {
- mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
- echo "Test XML file : ${xmlFile}"
- }
- }
// If not present picking a default Stage Name
if (params.pipelineTestStageName == null) {
// picking default
@@ -191,6 +178,13 @@ pipeline {
if (allParametersPresent) {
echo "All parameters are present"
+ if (eNB_AllowMergeRequestProcess) {
+ sh "git fetch"
+ sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest"
+ } else {
+ sh "git fetch"
+ sh "git checkout -f ${eNB_CommitID}"
+ }
} else {
echo "Some parameters are missing"
sh "./ci-scripts/fail.sh"
@@ -203,6 +197,21 @@ pipeline {
script {
dir ('ci-scripts') {
echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
+ // If not present picking a default XML file
+ if (params.pythonTestXmlFile == null) {
+ // picking default
+ testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml'
+ echo "Test XML file(default): ${testXMLFile}"
+ mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
+ } else {
+ String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
+ for (xmlFile in myXmlTestSuite) {
+ if (fileExists(xmlFile)) {
+ mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
+ echo "Test XML file : ${xmlFile}"
+ }
+ }
+ }
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'],
@@ -211,6 +220,7 @@ pipeline {
sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${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} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${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}"
} catch (Exception e) {
@@ -218,6 +228,7 @@ pipeline {
buildStageStatus = false
}
}
+ }
sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
}
}
diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue
new file mode 100644
index 0000000000..c2db977bcb
--- /dev/null
+++ b/ci-scripts/Jenkinsfile-tmp-ue
@@ -0,0 +1,271 @@
+#!/bin/groovy
+/*
+ * 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
+ */
+
+// Template Jenkins Declarative Pipeline script to run Test w/ RF HW
+
+// Location of the python executor node shall be in the same subnet as the others servers
+def pythonExecutor = params.pythonExecutor
+
+// Location of the test XML file to be run
+def testXMLFile = params.pythonTestXmlFile
+def mainPythonAllXmlFiles = ""
+def buildStageStatus = true
+
+// Name of the test stage
+def testStageName = params.pipelineTestStageName
+
+// Name of the phone resource
+def ciSmartPhoneResource = params.smartphonesResource
+
+// Terminate Status
+def termUE = 0
+def termENB = 1
+def termSPGW = 2
+def termMME = 3
+def termHSS = 4
+def termStatusArray = new Boolean[termHSS + 1]
+termStatusArray[termUE] = false
+termStatusArray[termENB] = false
+termStatusArray[termSPGW] = false
+termStatusArray[termMME] = false
+termStatusArray[termHSS] = false
+
+// Global Parameters. Normally they should be populated when the master job
+// triggers the slave job with parameters
+def eNB_Repository
+def eNB_Branch
+def eNB_CommitID
+def eNB_AllowMergeRequestProcess = false
+def eNB_TargetBranch
+
+pipeline {
+ agent {
+ label pythonExecutor
+ }
+ options {
+ disableConcurrentBuilds()
+ ansiColor('xterm')
+ lock (ciSmartPhoneResource)
+ }
+ stages {
+ stage ("Verify Parameters") {
+ steps {
+ script {
+ echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
+ def allParametersPresent = true
+
+ // It is already to late to check it
+ if (params.pythonExecutor != null) {
+ echo "eNB CI executor node : ${pythonExecutor}"
+ }
+ // If not present picking a default Stage Name
+ if (params.pipelineTestStageName == null) {
+ // picking default
+ testStageName = 'Template Test Stage'
+ }
+
+ if (params.smartphonesResource == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_IPAddress == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_SourceCodePath == null) {
+ allParametersPresent = false
+ }
+ if (params.UE_Credentials == null) {
+ allParametersPresent = false
+ }
+ // the following 4 parameters should be pushed by the master trigger
+ // if not present, take the job GIT variables (used for developing)
+ if (params.eNB_Repository == null) {
+ eNB_Repository = env.GIT_URL
+ } else {
+ eNB_Repository = params.eNB_Repository
+ }
+ echo "eNB_Repository : ${eNB_Repository}"
+ if (params.eNB_Branch == null) {
+ eNB_Branch = env.GIT_BRANCH
+ } else {
+ eNB_Branch = params.eNB_Branch
+ }
+ echo "eNB_Branch : ${eNB_Branch}"
+ if (params.eNB_CommitID == null) {
+ eNB_CommitID = env.GIT_COMMIT
+ } else {
+ eNB_CommitID = params.eNB_CommitID
+ }
+ echo "eNB_CommitID : ${eNB_CommitID}"
+ if (params.eNB_mergeRequest != null) {
+ eNB_AllowMergeRequestProcess = params.eNB_mergeRequest
+ if (eNB_AllowMergeRequestProcess) {
+ if (params.eNB_TargetBranch != null) {
+ eNB_TargetBranch = params.eNB_TargetBranch
+ } else {
+ eNB_TargetBranch = 'develop'
+ }
+ echo "eNB_TargetBranch : ${eNB_TargetBranch}"
+ }
+ }
+/*
+ if (params.EPC_IPAddress == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_Type == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_SourceCodePath == null) {
+ allParametersPresent = false
+ }
+ if (params.EPC_Credentials == null) {
+ 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) {
+ sh "git fetch"
+ sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest"
+ } else {
+ sh "git fetch"
+ sh "git checkout -f ${eNB_CommitID}"
+ }
+ } else {
+ echo "Some parameters are missing"
+ sh "./ci-scripts/fail.sh"
+ }
+ }
+ }
+ }
+ stage ("Build and Test") {
+ steps {
+ script {
+ dir ('ci-scripts') {
+ echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
+ // If not present picking a default XML file
+ if (params.pythonTestXmlFile == null) {
+ // picking default
+ testXMLFile = 'xml_files/ue_band20_build.xml'
+ echo "Test XML file(default): ${testXMLFile}"
+ mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
+ } else {
+ String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
+ for (xmlFile in myXmlTestSuite) {
+ if (fileExists(xmlFile)) {
+ mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
+ echo "Test XML file : ${xmlFile}"
+ }
+ }
+ }
+ 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 --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${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} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}"
+ } catch (Exception e) {
+ currentBuild.result = 'FAILURE'
+ buildStageStatus = false
+ }
+ }
+ }
+ sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}"
+ }
+ }
+ }
+ }
+ }
+ stage('Log Collection') {
+ parallel {
+ stage('Log Collection (OAI UE - Build)') {
+ steps {
+ echo '\u2705 \u001B[32mLog Collection (OAI UE - Build)\u001B[0m'
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=LogCollectBuild --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}"
+
+ echo '\u2705 \u001B[32mLog Transfer (UE - Build)\u001B[0m'
+ sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("build.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "build.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ stage('Log Collection (OAI UE - Run)') {
+ steps {
+ echo '\u2705 \u001B[32mLog Collection (OAI UE - Run)\u001B[0m'
+ withCredentials([
+ [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
+ ]) {
+ sh "python3 ci-scripts/main.py --mode=LogCollectOAIUE --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath}"
+
+ echo '\u2705 \u001B[32mLog Transfer (UE - Run)\u001B[0m'
+ sh "sshpass -p \'${UE_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${UE_Username}@${params.UE_IPAddress}:${UE_SourceCodePath}/cmake_targets/ue.log.zip ./ue.log.${env.BUILD_ID}.zip || true"
+ }
+ script {
+ if(fileExists("ue.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "ue.log.${env.BUILD_ID}.zip"
+ }
+ if(fileExists("ci-scripts/test_results.html")) {
+ sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
+ sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID} #' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
+ archiveArtifacts "test_results-${JOB_NAME}.html"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ always {
+ script {
+ if (params.pipelineZipsConsoleLog != null) {
+ if (params.pipelineZipsConsoleLog) {
+ echo "Archiving Jenkins console log"
+ sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true"
+ sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true"
+ if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) {
+ archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ci-scripts/add_user_to_conf_file.awk b/ci-scripts/add_user_to_conf_file.awk
new file mode 100644
index 0000000000..b338d5e7ac
--- /dev/null
+++ b/ci-scripts/add_user_to_conf_file.awk
@@ -0,0 +1,33 @@
+BEGIN{lineIdx=0;captureUEDesc=0}
+{
+ if ($0 ~/UE0/) {
+ captureUEDesc = 1
+ }
+ if (captureUEDesc == 1) {
+ captureLine[lineIdx] = $0
+ lineIdx = lineIdx + 1
+ }
+ print $0
+}
+END {
+ for (ueIdx = 1; ueIdx < num_ues; ueIdx++) {
+ print ""
+ for (k = 0; k < lineIdx; k++) {
+ if (captureLine[k] ~/UE0/) {
+ mLine = captureLine[k]
+ gsub("UE0", "UE"ueIdx, mLine)
+ print mLine
+ } else {
+ if (captureLine[k] ~/MSIN=/) {
+ mLine = captureLine[k]
+ MSIN=sprintf("%08d", 1111+int(ueIdx))
+ gsub("00001111", MSIN, mLine)
+ print mLine
+ } else {
+ print captureLine[k]
+ }
+ }
+
+ }
+ }
+}
diff --git a/ci-scripts/add_user_to_subscriber_list.awk b/ci-scripts/add_user_to_subscriber_list.awk
new file mode 100644
index 0000000000..1e25990f59
--- /dev/null
+++ b/ci-scripts/add_user_to_subscriber_list.awk
@@ -0,0 +1,27 @@
+BEGIN{lineIdx=0}
+{
+ captureLine[lineIdx] = $0
+ lineIdx = lineIdx + 1
+ print $0
+}
+END{
+ for (ueIdx = 1; ueIdx < num_ues; ueIdx++) {
+ for (k = 0; k < lineIdx; k++) {
+ if (captureLine[k] ~/UserName=/) {
+ mLine = captureLine[k]
+ MSIN=sprintf("%08d", 1111+int(ueIdx))
+ gsub("00001111", MSIN, mLine)
+ print mLine
+ } else {
+ if (captureLine[k] ~/SubscriptionIndex/) {
+ mLine = captureLine[k]
+ MSIN=sprintf("%d", 111+int(ueIdx))
+ gsub("111", MSIN, mLine)
+ print mLine
+ } else {
+ print captureLine[k]
+ }
+ }
+ }
+ }
+}
diff --git a/ci-scripts/buildOnRH.sh b/ci-scripts/buildOnRH.sh
index bb57cde165..076f34f8d2 100755
--- a/ci-scripts/buildOnRH.sh
+++ b/ci-scripts/buildOnRH.sh
@@ -180,7 +180,7 @@ echo "Checking build status"
echo "############################################################"
LOG_PATTERN=.Rel14.txt
-NB_PATTERN_FILES=4
+NB_PATTERN_FILES=7
LOG_FILES=`ls $ARCHIVES_LOC/*.txt`
STATUS=0
@@ -204,12 +204,13 @@ then
STATUS=-1
fi
+echo "COMMAND: build_oai -I -w USRP --eNB" > $ARCHIVES_LOC/build_final_status.log
if [ $STATUS -eq 0 ]
then
- echo "BUILD_OK" > $ARCHIVES_LOC/build_final_status.log
+ echo "BUILD_OK" >> $ARCHIVES_LOC/build_final_status.log
echo "STATUS seems OK"
else
- echo "BUILD_KO" > $ARCHIVES_LOC/build_final_status.log
+ echo "BUILD_KO" >> $ARCHIVES_LOC/build_final_status.log
echo "STATUS failed?"
fi
exit $STATUS
diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh
index f9fb3b776f..ee5fc56c5f 100755
--- a/ci-scripts/buildOnVM.sh
+++ b/ci-scripts/buildOnVM.sh
@@ -94,17 +94,24 @@ function build_on_vm {
echo "############################################################"
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################"
+ acquire_vm_create_lock
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $VM_NAME --insecure
+
+ VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
+ echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ release_vm_create_lock
+ else
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $VM_NAME --insecure
+
+ VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
+ echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
fi
- echo "Waiting for VM to be started"
- uvt-kvm wait $VM_NAME --insecure
-
- VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
- echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
-
echo "############################################################"
- echo "Copying GIT repo into VM ($VM_NAME)"
+ echo "Copying GIT repo into VM ($VM_NAME)"
echo "############################################################"
if [[ "$VM_NAME" == *"-flexran-rtc"* ]]
then
@@ -206,6 +213,6 @@ function build_on_vm {
echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh" >> $VM_CMDS
fi
fi
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
rm -f $VM_CMDS
}
diff --git a/ci-scripts/checkAddedWarnings.sh b/ci-scripts/checkAddedWarnings.sh
index 609261becf..0ffaee9500 100755
--- a/ci-scripts/checkAddedWarnings.sh
+++ b/ci-scripts/checkAddedWarnings.sh
@@ -95,7 +95,7 @@ fi
# Merge request scenario
-MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"`
+MERGE_COMMMIT=`git log -n1 --pretty=format:%H`
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
echo " ---- Checking the modified files by the merge request ----"
diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh
index 61cbf12560..6ac43ca19f 100755
--- a/ci-scripts/checkCodingFormattingRules.sh
+++ b/ci-scripts/checkCodingFormattingRules.sh
@@ -111,7 +111,7 @@ fi
# Merge request scenario
-MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"`
+MERGE_COMMMIT=`git log -n1 --pretty=format:%H`
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
echo " ---- Checking the modified files by the merge request ----"
diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
new file mode 100644
index 0000000000..becd484c56
--- /dev/null
+++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
@@ -0,0 +1,221 @@
+Active_eNBs = ( "eNB-CU-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs = (
+ {
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB-CU-Eurecom-LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ tr_s_preference = "f1"
+
+ local_s_if_name = "lo";
+ remote_s_address = "127.0.0.3";
+ local_s_address = "127.0.0.4";
+ local_s_portc = 501;
+ remote_s_portc = 500;
+ local_s_portd = 601;
+ remote_s_portd = 600;
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNodeB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 100;
+ pbch_repetition = "FALSE";
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 2;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 0;
+ pdsch_referenceSignalPower = -29;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnable = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /*
+ srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;
+ */
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = 64;
+ rach_preamblesGroupAConfig = "DISABLE";
+ /*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+ */
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -108;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = 128;
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff= 2;
+ ue_TimersAndConstants_t300 = 1000;
+ ue_TimersAndConstants_t301 = 1000;
+ ue_TimersAndConstants_t310 = 1000;
+ ue_TimersAndConstants_t311 = 10000;
+ ue_TimersAndConstants_n310 = 20;
+ ue_TimersAndConstants_n311 = 1;
+ ue_TransmissionMode = 1;
+
+ //Parameters for SIB18
+ rxPool_sc_CP_Len = "normal";
+ rxPool_sc_Period = "sf40";
+ rxPool_data_CP_Len = "normal";
+ rxPool_ResourceConfig_prb_Num = 20;
+ rxPool_ResourceConfig_prb_Start = 5;
+ rxPool_ResourceConfig_prb_End = 44;
+ rxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ rxPool_ResourceConfig_offsetIndicator_choice = 0;
+ rxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ /*
+ rxPool_dataHoppingConfig_hoppingParameter = 0;
+ rxPool_dataHoppingConfig_numSubbands = "ns1";
+ rxPool_dataHoppingConfig_rbOffset = 0;
+ rxPool_commTxResourceUC-ReqAllowed = "TRUE";
+ */
+
+ // Parameters for SIB19
+ discRxPool_cp_Len = "normal"
+ discRxPool_discPeriod = "rf32"
+ discRxPool_numRetx = 1;
+ discRxPool_numRepetition = 2;
+ discRxPool_ResourceConfig_prb_Num = 5;
+ discRxPool_ResourceConfig_prb_Start = 3;
+ discRxPool_ResourceConfig_prb_End = 21;
+ discRxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ discRxPool_ResourceConfig_offsetIndicator_choice = 0;
+ discRxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ }
+ );
+
+
+ srb1_parameters :
+ {
+ # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+ timer_poll_retransmit = 80;
+
+ # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+ timer_reordering = 35;
+
+ # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+ timer_status_prohibit = 0;
+
+ # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+ poll_pdu = 4;
+
+ # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+ poll_byte = 99999;
+
+ # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+ max_retx_threshold = 4;
+ }
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = (
+ {
+ ipv4 = "CI_MME_IP_ADDR";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES : {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
+ ENB_INTERFACE_NAME_FOR_S1U = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ pdcp_log_level = "info";
+ pdcp_log_verbosity = "high";
+ rrc_log_level = "info";
+ rrc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+ gtp_log_level = "info";
+ gtp_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
new file mode 100644
index 0000000000..7e4dfc6de6
--- /dev/null
+++ b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
@@ -0,0 +1,221 @@
+Active_eNBs = ( "eNB-CU-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs = (
+ {
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB-CU-Eurecom-LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ tr_s_preference = "f1"
+
+ local_s_if_name = "lo";
+ remote_s_address = "127.0.0.3";
+ local_s_address = "127.0.0.4";
+ local_s_portc = 501;
+ remote_s_portc = 500;
+ local_s_portd = 601;
+ remote_s_portd = 600;
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNodeB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 25;
+ pbch_repetition = "FALSE";
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 2;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 0;
+ pdsch_referenceSignalPower = -25;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnable = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /*
+ srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;
+ */
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = 64;
+ rach_preamblesGroupAConfig = "DISABLE";
+ /*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+ */
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -108;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = 128;
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff= 2;
+ ue_TimersAndConstants_t300 = 1000;
+ ue_TimersAndConstants_t301 = 1000;
+ ue_TimersAndConstants_t310 = 1000;
+ ue_TimersAndConstants_t311 = 10000;
+ ue_TimersAndConstants_n310 = 20;
+ ue_TimersAndConstants_n311 = 1;
+ ue_TransmissionMode = 1;
+
+ //Parameters for SIB18
+ rxPool_sc_CP_Len = "normal";
+ rxPool_sc_Period = "sf40";
+ rxPool_data_CP_Len = "normal";
+ rxPool_ResourceConfig_prb_Num = 20;
+ rxPool_ResourceConfig_prb_Start = 5;
+ rxPool_ResourceConfig_prb_End = 44;
+ rxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ rxPool_ResourceConfig_offsetIndicator_choice = 0;
+ rxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ /*
+ rxPool_dataHoppingConfig_hoppingParameter = 0;
+ rxPool_dataHoppingConfig_numSubbands = "ns1";
+ rxPool_dataHoppingConfig_rbOffset = 0;
+ rxPool_commTxResourceUC-ReqAllowed = "TRUE";
+ */
+
+ // Parameters for SIB19
+ discRxPool_cp_Len = "normal"
+ discRxPool_discPeriod = "rf32"
+ discRxPool_numRetx = 1;
+ discRxPool_numRepetition = 2;
+ discRxPool_ResourceConfig_prb_Num = 5;
+ discRxPool_ResourceConfig_prb_Start = 3;
+ discRxPool_ResourceConfig_prb_End = 21;
+ discRxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ discRxPool_ResourceConfig_offsetIndicator_choice = 0;
+ discRxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ }
+ );
+
+
+ srb1_parameters :
+ {
+ # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+ timer_poll_retransmit = 80;
+
+ # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+ timer_reordering = 35;
+
+ # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+ timer_status_prohibit = 0;
+
+ # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+ poll_pdu = 4;
+
+ # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+ poll_byte = 99999;
+
+ # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+ max_retx_threshold = 4;
+ }
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = (
+ {
+ ipv4 = "CI_MME_IP_ADDR";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES : {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
+ ENB_INTERFACE_NAME_FOR_S1U = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ pdcp_log_level = "info";
+ pdcp_log_verbosity = "high";
+ rrc_log_level = "info";
+ rrc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+ gtp_log_level = "info";
+ gtp_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
new file mode 100644
index 0000000000..b1c4774aba
--- /dev/null
+++ b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
@@ -0,0 +1,221 @@
+Active_eNBs = ( "eNB-CU-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs = (
+ {
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB-CU-Eurecom-LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ tr_s_preference = "f1"
+
+ local_s_if_name = "lo";
+ remote_s_address = "127.0.0.3";
+ local_s_address = "127.0.0.4";
+ local_s_portc = 501;
+ remote_s_portc = 500;
+ local_s_portd = 601;
+ remote_s_portd = 600;
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNodeB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 50;
+ pbch_repetition = "FALSE";
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 2;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 0;
+ pdsch_referenceSignalPower = -27;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnable = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /*
+ srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;
+ */
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = 64;
+ rach_preamblesGroupAConfig = "DISABLE";
+ /*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+ */
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -108;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = 128;
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff= 2;
+ ue_TimersAndConstants_t300 = 1000;
+ ue_TimersAndConstants_t301 = 1000;
+ ue_TimersAndConstants_t310 = 1000;
+ ue_TimersAndConstants_t311 = 10000;
+ ue_TimersAndConstants_n310 = 20;
+ ue_TimersAndConstants_n311 = 1;
+ ue_TransmissionMode = 1;
+
+ //Parameters for SIB18
+ rxPool_sc_CP_Len = "normal";
+ rxPool_sc_Period = "sf40";
+ rxPool_data_CP_Len = "normal";
+ rxPool_ResourceConfig_prb_Num = 20;
+ rxPool_ResourceConfig_prb_Start = 5;
+ rxPool_ResourceConfig_prb_End = 44;
+ rxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ rxPool_ResourceConfig_offsetIndicator_choice = 0;
+ rxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000";
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ /*
+ rxPool_dataHoppingConfig_hoppingParameter = 0;
+ rxPool_dataHoppingConfig_numSubbands = "ns1";
+ rxPool_dataHoppingConfig_rbOffset = 0;
+ rxPool_commTxResourceUC-ReqAllowed = "TRUE";
+ */
+
+ // Parameters for SIB19
+ discRxPool_cp_Len = "normal"
+ discRxPool_discPeriod = "rf32"
+ discRxPool_numRetx = 1;
+ discRxPool_numRepetition = 2;
+ discRxPool_ResourceConfig_prb_Num = 5;
+ discRxPool_ResourceConfig_prb_Start = 3;
+ discRxPool_ResourceConfig_prb_End = 21;
+ discRxPool_ResourceConfig_offsetIndicator_present = "prSmall";
+ discRxPool_ResourceConfig_offsetIndicator_choice = 0;
+ discRxPool_ResourceConfig_subframeBitmap_present = "prBs40";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff";
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5;
+ discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
+ }
+ );
+
+
+ srb1_parameters :
+ {
+ # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+ timer_poll_retransmit = 80;
+
+ # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+ timer_reordering = 35;
+
+ # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+ timer_status_prohibit = 0;
+
+ # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+ poll_pdu = 4;
+
+ # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+ poll_byte = 99999;
+
+ # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+ max_retx_threshold = 4;
+ }
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = (
+ {
+ ipv4 = "CI_MME_IP_ADDR";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES : {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
+ ENB_INTERFACE_NAME_FOR_S1U = "eth0";
+ ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ pdcp_log_level = "info";
+ pdcp_log_verbosity = "high";
+ rrc_log_level = "info";
+ rrc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+ gtp_log_level = "info";
+ gtp_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
new file mode 100644
index 0000000000..fe994ef889
--- /dev/null
+++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
@@ -0,0 +1,119 @@
+Active_eNBs = ( "eNB-Eurecom-DU");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ ////////// Identification parameters:
+ eNB_CU_ID = 0xe00;
+
+ eNB_name = "eNB-Eurecom-DU";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNODEB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 100;
+ Nid_cell_mbsfn = 0;
+ nb_antenna_ports = 1;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 90;
+ rx_gain = 115;
+
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+ }
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "f1";
+ local_n_if_name = "lo";
+ remote_n_address = "127.0.0.4";
+ local_n_address = "127.0.0.3";
+ local_n_portc = 500;
+ remote_n_portc = 501;
+ local_n_portd = 600;
+ remote_n_portd = 601;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes";
+ nb_tx = 1;
+ nb_rx = 1;
+ att_tx = 10;
+ att_rx = 10;
+ bands = [7];
+ max_pdschReferenceSignalPower = -29;
+ max_rxgain = 115;
+ eNB_instances = [0];
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ hw_log_level = "info";
+ hw_log_verbosity = "medium";
+ phy_log_level = "info";
+ phy_log_verbosity = "medium";
+ mac_log_level = "info";
+ mac_log_verbosity = "high";
+ rlc_log_level = "info";
+ rlc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
new file mode 100644
index 0000000000..85407e3f35
--- /dev/null
+++ b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
@@ -0,0 +1,119 @@
+Active_eNBs = ( "eNB-Eurecom-DU");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ ////////// Identification parameters:
+ eNB_CU_ID = 0xe00;
+
+ eNB_name = "eNB-Eurecom-DU";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNODEB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 25;
+ Nid_cell_mbsfn = 0;
+ nb_antenna_ports = 1;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 90;
+ rx_gain = 125;
+
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+ }
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "f1";
+ local_n_if_name = "lo";
+ remote_n_address = "127.0.0.4";
+ local_n_address = "127.0.0.3";
+ local_n_portc = 500;
+ remote_n_portc = 501;
+ local_n_portd = 600;
+ remote_n_portd = 601;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes";
+ nb_tx = 1;
+ nb_rx = 1;
+ att_tx = 10;
+ att_rx = 10;
+ bands = [7];
+ max_pdschReferenceSignalPower = -25;
+ max_rxgain = 125;
+ eNB_instances = [0];
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ hw_log_level = "info";
+ hw_log_verbosity = "medium";
+ phy_log_level = "info";
+ phy_log_verbosity = "medium";
+ mac_log_level = "info";
+ mac_log_verbosity = "high";
+ rlc_log_level = "info";
+ rlc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
new file mode 100644
index 0000000000..3e97f58068
--- /dev/null
+++ b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
@@ -0,0 +1,119 @@
+Active_eNBs = ( "eNB-Eurecom-DU");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ ////////// Identification parameters:
+ eNB_CU_ID = 0xe00;
+
+ eNB_name = "eNB-Eurecom-DU";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } )
+
+ nr_cellid = 12345678L
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNODEB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 7;
+ downlink_frequency = 2680000000L;
+ uplink_frequency_offset = -120000000;
+ Nid_cell = 0;
+ N_RB_DL = 50;
+ Nid_cell_mbsfn = 0;
+ nb_antenna_ports = 1;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 90;
+ rx_gain = 120;
+
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+ }
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "f1";
+ local_n_if_name = "lo";
+ remote_n_address = "127.0.0.4";
+ local_n_address = "127.0.0.3";
+ local_n_portc = 500;
+ remote_n_portc = 501;
+ local_n_portd = 600;
+ remote_n_portd = 601;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes";
+ nb_tx = 1;
+ nb_rx = 1;
+ att_tx = 10;
+ att_rx = 10;
+ bands = [7];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 120;
+ eNB_instances = [0];
+ }
+);
+
+log_config = {
+ global_log_level = "info";
+ global_log_verbosity = "medium";
+ hw_log_level = "info";
+ hw_log_verbosity = "medium";
+ phy_log_level = "info";
+ phy_log_verbosity = "medium";
+ mac_log_level = "info";
+ mac_log_verbosity = "high";
+ rlc_log_level = "info";
+ rlc_log_verbosity = "medium";
+ flexran_agent_log_level = "info";
+ flexran_agent_log_verbosity = "medium";
+};
+
+NETWORK_CONTROLLER : {
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
diff --git a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
index e3d3402c1c..ea8a56e385 100644
--- a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
+++ b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
@@ -13,9 +13,9 @@ eNBs =
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
- tracking_area_code = "1";
+ tracking_area_code = 1;
- plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2;} );
+ plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2;} );
tr_s_preference = "local_mac"
@@ -48,23 +48,23 @@ eNBs =
prach_zero_correlation = 1;
prach_freq_offset = 1;
pucch_delta_shift = 1;
- pucch_nRB_CQI = 1;
- pucch_nCS_AN = 0;
- pucch_n1_AN = 32;
- pdsch_referenceSignalPower = -27;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 0;
+ pdsch_referenceSignalPower = -24;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
- pusch_hoppingOffset = 0;
+ pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
- srs_enable = "DISABLE";
- /* srs_BandwidthConfig =;
+ srs_enable = "DISABLE";
+ /* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
@@ -73,14 +73,14 @@ eNBs =
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
msg3_delta_Preamble = 6;
- pucch_deltaF_Format1 = "deltaF2";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
- pucch_deltaF_Format2b = "deltaF0";
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
- rach_numberOfRA_Preambles = "n64"; #64
- rach_preamblesGroupAConfig = "DISABLE";
+ rach_numberOfRA_Preambles = "n64"; #64
+ rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
@@ -105,7 +105,7 @@ eNBs =
ue_TransmissionMode = "tm1";
# eMTC Parameters
- emtc_parameters :
+ emtc_parameters :
{
eMTC_configured = 1;
#hyperSFN_r13 = 0;
@@ -115,7 +115,7 @@ eNBs =
#SIB1
schedulingInfoSIB1_BR_r13 = 4;
- #system_info_value_tag_SI =
+ #system_info_value_tag_SI =
#(
# {
# systemInfoValueTagSi_r13 = 0;
@@ -124,7 +124,7 @@ eNBs =
cellSelectionInfoCE_r13 = "ENABLE";
q_RxLevMinCE_r13 = -70;
- bandwidthReducedAccessRelatedInfo_r13 = "ENABLE"
+ bandwidthReducedAccessRelatedInfo_r13 = "ENABLE"
si_WindowLength_BR_r13 = "ms20"; #0
si_RepetitionPattern_r13 = "everyRF"; #0
@@ -136,7 +136,7 @@ eNBs =
}
);
- fdd_DownlinkOrTddSubframeBitmapBR_r13 = "subframePattern40-r13";
+ fdd_DownlinkOrTddSubframeBitmapBR_r13 = "subframePattern40-r13";
fdd_DownlinkOrTddSubframeBitmapBR_val_r13 = 0xFFFFFFFFFF;
startSymbolBR_r13 = 2;
si_HoppingConfigCommon_r13 = "off"; #1; # Note: 1==OFF !
@@ -157,14 +157,14 @@ eNBs =
rach_numberOfRA_Preambles = 60; #14
rach_powerRampingStep = 4;
- rach_preambleInitialReceivedTargetPower = -110;
+ rach_preambleInitialReceivedTargetPower = -110;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 64;
rach_maxHARQ_Msg3Tx = 4;
# max size for this array is 4
- rach_CE_LevelInfoList_r13 =
+ rach_CE_LevelInfoList_r13 =
(
{
firstPreamble_r13 = 60;
@@ -175,7 +175,7 @@ eNBs =
}
);
- # BCCH CONFIG
+ # BCCH CONFIG
bcch_modificationPeriodCoeff = 2;
#PCCH Config
@@ -189,8 +189,8 @@ eNBs =
prach_zero_correlation = 1;
prach_freq_offset = 1;
- #PDSCH Config Common
- pdsch_referenceSignalPower = -27
+ #PDSCH Config Common
+ pdsch_referenceSignalPower = -24
pdsch_p_b = 0;
@@ -208,27 +208,27 @@ eNBs =
pucch_delta_shift = 1;
pucch_nRB_CQI = 0;
pucch_nCS_AN = 0;
- pucch_n1_AN = 32;
+ pucch_n1_AN = 0;
pusch_p0_Nominal = -96;
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
- pucch_deltaF_Format1 = "deltaF0";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format1 = "deltaF0";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
msg3_delta_Preamble = 6;
prach_ConfigCommon_v1310 = "ENABLE";
-
+
mpdcch_startSF_CSS_RA_r13 = "fdd-r13";
mpdcch_startSF_CSS_RA_r13_val = "v1"; #0
prach_HoppingOffset_r13 = 0;
-
+
pdsch_maxNumRepetitionCEmodeA_r13 = "r16"; #0
#pdsch_maxNumRepetitionCEmodeB_r13 = "r384"; # NULL - 2
@@ -245,7 +245,7 @@ eNBs =
);
# max size for this array is 4
- prach_parameters_ce_r13 =
+ prach_parameters_ce_r13 =
(
{
prach_config_index_br = 3;
@@ -255,17 +255,17 @@ eNBs =
numRepetitionPerPreambleAttempt_r13 = 1; #0
mpdcch_NumRepetition_RA_r13 = 1; #0
prach_HoppingConfig_r13 = 0; #1
- max_available_narrow_band = [3];
+ max_available_narrow_band = [3];
}
);
- n1PUCCH_AN_InfoList_r13 =
+ n1PUCCH_AN_InfoList_r13 =
(
{
- pucch_info_value = 0;
+ pucch_info_value = 33;
}
);
-
+
ue_TimersAndConstants_t300 = "ms1000";
ue_TimersAndConstants_t301 = "ms400";
@@ -283,21 +283,21 @@ eNBs =
}
- pucch_NumRepetitionCE_Msg4_Level0_r13 = "n1"; #0
+ pucch_NumRepetitionCE_Msg4_Level0_r13 = "n1"; #0
#pucch_NumRepetitionCE_Msg4_Level1_r13 = "n2"; #1
#pucch_NumRepetitionCE_Msg4_Level2_r13 = "n16"; #2
#pucch_NumRepetitionCE_Msg4_Level3_r13 = "n32"; #3
- sib2_freq_hoppingParameters_r13 :
+ sib2_freq_hoppingParameters_r13 :
{
#sib2_mpdcch_pdsch_hoppingNB_r13 = "nb2"; #0
#sib2_interval_DLHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- #sib2_interval_DLHoppingConfigCommonModeA_r13_val = "int1";
+ #sib2_interval_DLHoppingConfigCommonModeA_r13_val = "int1";
#sib2_interval_DLHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- #sib2_interval_DLHoppingConfigCommonModeB_r13_val = "int2";
+ #sib2_interval_DLHoppingConfigCommonModeB_r13_val = "int2";
sib2_interval_ULHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
- sib2_interval_ULHoppingConfigCommonModeA_r13_val = "int4"; #2
+ sib2_interval_ULHoppingConfigCommonModeA_r13_val = "int4"; #2
# sib2_interval_ULHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
# sib2_interval_ULHoppingConfigCommonModeB_r13_val = "int2"; #0
@@ -305,11 +305,11 @@ eNBs =
}
rach_preamblesGroupAConfig = "DISABLE";
-
+
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
-
+
}
@@ -360,6 +360,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -392,36 +397,56 @@ eNBs =
);
MACRLCs = (
- {
+ {
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ prach_dtx_threshold = 200;
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 0
att_rx = 0;
bands = [13];
- max_pdschReferenceSignalPower = -27;
- max_rxgain = 125;
+ max_pdschReferenceSignalPower = -24;
+ max_rxgain = 110;
eNB_instances = [0];
}
-);
+);
+
+THREAD_STRUCT = (
+ {
+ #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+ parallel_config = "PARALLEL_SINGLE_THREAD";
+ #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+ worker_config = "WORKER_ENABLE";
+ }
+);
+
+NETWORK_CONTROLLER :
+{
+ FLEXRAN_ENABLED = "no";
+ FLEXRAN_INTERFACE_NAME = "lo";
+ FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
+ FLEXRAN_PORT = 2210;
+ FLEXRAN_CACHE = "/mnt/oai_agent_cache";
+ FLEXRAN_AWAIT_RECONF = "no";
+};
log_config :
{
@@ -440,4 +465,3 @@ log_config :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
index b6028a8152..370697660e 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf
@@ -37,7 +37,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
- rx_gain = 125;
+ rx_gain = 115;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -178,8 +183,8 @@ MACRLCs = (
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
scheduler_mode = "fairRR";
- puSch10xSnr = 200;
- puCch10xSnr = 200;
+ puSch10xSnr = 150;
+ puCch10xSnr = 150;
}
);
diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
index 10cbd04e9a..fbbc2f1154 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -178,8 +183,8 @@ MACRLCs = (
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
scheduler_mode = "fairRR";
- puSch10xSnr = 200;
- puCch10xSnr = 200;
+ puSch10xSnr = 150;
+ puCch10xSnr = 150;
}
);
@@ -199,7 +204,7 @@ RUs = (
att_rx = 0;
bands = [38];
max_pdschReferenceSignalPower = -27;
- max_rxgain = 115;
+ max_rxgain = 125;
eNB_instances = [0];
}
diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
index c79dbf1ac0..f49d860a51 100644
--- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
@@ -37,7 +37,7 @@ eNBs =
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
- rx_gain = 125;
+ rx_gain = 120;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -178,8 +183,8 @@ MACRLCs = (
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
scheduler_mode = "fairRR";
- puSch10xSnr = 200;
- puCch10xSnr = 200;
+ puSch10xSnr = 150;
+ puCch10xSnr = 150;
}
);
@@ -199,7 +204,7 @@ RUs = (
att_rx = 0;
bands = [38];
max_pdschReferenceSignalPower = -27;
- max_rxgain = 115;
+ max_rxgain = 120;
eNB_instances = [0];
}
diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
index 2c2ca635a6..c119e2f1c0 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf
@@ -178,6 +178,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
index 4dd8c1ee22..a0d3ba6d06 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
@@ -178,6 +178,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
index cae47b152c..92a6e6f0bc 100644
--- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf
@@ -94,6 +94,14 @@ eNBs =
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
+ drx_Config_present = "prSetup"; //"prSetup" "prRelease"
+ drx_onDurationTimer = "psf1"; // "psfX": X=1,2,3,4,5,6,8,10,20,30,40,50,60,80,100
+ drx_InactivityTimer = "psf1"; // "psfX": X=1,2,3,4,5,6,8,10,20,30,40,50,60,80,100,200,300,500,750,1280,1920,2560
+ drx_RetransmissionTimer = "psf1"; // "psfX": X=1,2,4,6,8,16,24,33
+ drx_longDrx_CycleStartOffset_present = "prSf128"; // "psfX": X=10,20,32,40,64,80,128,160,256,320,512,640,1024,1280,2048,2560
+ drx_longDrx_CycleStartOffset = 0; // X >= 0 && X < drx_longDrx_CycleStartOffset_present
+ drx_shortDrx_Cycle = "sf16"; // "sfX": X=2,5,8,10,16,20,32,40,64,80,128,160,256,320,512,640
+ drx_shortDrx_ShortCycleTimer = 3; // 1..16 integer. Total duration in short cycle = drx_shortDrx_Cycle*drx_shortDrx_ShortCycleTimer [subframe]
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
@@ -178,6 +186,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
index 4e5510b0d4..b006e04e91 100644
--- a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
@@ -181,6 +181,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -202,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 2
nb_rx = 2
@@ -224,7 +229,7 @@ RUs = (
max_rxgain = 115;
eNB_instances = [0];
}
-);
+);
THREAD_STRUCT = (
{
@@ -262,4 +267,3 @@ log_config :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/lte-fdd-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-basic-sim.conf
index 594e3299db..cabbed871a 100644
--- a/ci-scripts/conf_files/lte-fdd-basic-sim.conf
+++ b/ci-scripts/conf_files/lte-fdd-basic-sim.conf
@@ -178,6 +178,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
@@ -200,18 +205,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
- }
+ }
);
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
@@ -223,7 +228,7 @@ RUs = (
eNB_instances = [0];
}
-);
+);
THREAD_STRUCT = (
{
@@ -261,4 +266,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/lte-tdd-basic-sim.conf b/ci-scripts/conf_files/lte-tdd-basic-sim.conf
index da330d2379..a376f45453 100644
--- a/ci-scripts/conf_files/lte-tdd-basic-sim.conf
+++ b/ci-scripts/conf_files/lte-tdd-basic-sim.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
index 285b7eaf9f..d39f1e0620 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf
@@ -144,6 +144,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
index 62e7fb48a4..0ae17356de 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf
@@ -144,6 +144,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
index f99b701b8e..c58f05c82f 100644
--- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf
@@ -144,6 +144,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
index 6c80a4f7cf..6f6aa98788 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf
@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
-
+
////////// Identification parameters:
eNB_ID = 0xe00;
@@ -181,6 +181,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -202,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
- }
+ }
);
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
@@ -229,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
-);
+);
THREAD_STRUCT = (
{
@@ -267,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
index f4be50810c..ec7fce3dbf 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf
@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
-
+
////////// Identification parameters:
eNB_ID = 0xe00;
@@ -181,6 +181,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -202,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
- }
+ }
);
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
@@ -229,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
-);
+);
THREAD_STRUCT = (
{
@@ -267,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
index 48c8370b4b..4ebbff4bda 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf
@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
-
+
////////// Identification parameters:
eNB_ID = 0xe00;
@@ -181,6 +181,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
@@ -202,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
- }
+ }
);
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "local_mac";
- }
+ }
);
RUs = (
- {
+ {
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
@@ -229,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
-);
+);
THREAD_STRUCT = (
{
@@ -267,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
index c2a86f079e..52c0593d1b 100644
--- a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
+++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
@@ -179,6 +179,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "ens3";
@@ -196,13 +201,13 @@ eNBs =
MACRLCs = (
{
num_cc = 1;
- local_s_if_name = "lo:";
- remote_s_address = "127.0.0.1";
- local_s_address = "127.0.0.2";
- local_s_portc = 50001;
- remote_s_portc = 50000;
- local_s_portd = 50011;
- remote_s_portd = 50010;
+ local_s_if_name = "ens3";
+ remote_s_address = "CI_UE_IP_ADDR";
+ local_s_address = "CI_ENB_IP_ADDR";
+ local_s_portc = 50001;
+ remote_s_portc = 50000;
+ local_s_portd = 50011;
+ remote_s_portd = 50010;
tr_s_preference = "nfapi";
tr_n_preference = "local_RRC";
}
@@ -211,7 +216,7 @@ MACRLCs = (
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
- parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
+ parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
diff --git a/ci-scripts/conf_files/rru.fdd.band7.conf b/ci-scripts/conf_files/rru.fdd.band7.conf
index dab69e1f1e..ea923ae371 100644
--- a/ci-scripts/conf_files/rru.fdd.band7.conf
+++ b/ci-scripts/conf_files/rru.fdd.band7.conf
@@ -42,4 +42,3 @@ log_config = {
rrc_log_level ="error";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/rru.tdd.band40.conf b/ci-scripts/conf_files/rru.tdd.band40.conf
index 775a2fbc67..fb2b9399e2 100644
--- a/ci-scripts/conf_files/rru.tdd.band40.conf
+++ b/ci-scripts/conf_files/rru.tdd.band40.conf
@@ -42,4 +42,3 @@ log_config = {
rrc_log_level ="error";
rrc_log_verbosity ="medium";
};
-
diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf
index ea0236cab4..2b602cbcf2 100644
--- a/ci-scripts/conf_files/ue.nfapi.conf
+++ b/ci-scripts/conf_files/ue.nfapi.conf
@@ -17,21 +17,21 @@ log_config = {
L1s = (
- {
+ {
num_cc = 1;
tr_n_preference = "nfapi";
- local_n_if_name = "lo";
- remote_n_address = "127.0.0.2";
- local_n_address = "127.0.0.1";
- local_n_portc = 50000;
- remote_n_portc = 50001;
- local_n_portd = 50010;
- remote_n_portd = 50011;
+ local_n_if_name = "ens3";
+ remote_n_address = "CI_ENB_IP_ADDR";
+ local_n_address = "CI_UE_IP_ADDR";
+ local_n_portc = 50000;
+ remote_n_portc = 50001;
+ local_n_portd = 50010;
+ remote_n_portd = 50011;
}
);
RUs = (
- {
+ {
local_rf = "yes"
nb_tx = 1
nb_rx = 1
@@ -40,5 +40,5 @@ RUs = (
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
- }
+ }
);
diff --git a/ci-scripts/cppcheck_suppressions.list b/ci-scripts/cppcheck_suppressions.list
new file mode 100644
index 0000000000..4536f57315
--- /dev/null
+++ b/ci-scripts/cppcheck_suppressions.list
@@ -0,0 +1,101 @@
+// *INDENT-OFF* cppcheck doesn't like "astyling" this file!!!!
+// /*
+// * 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
+// */
+//*****************************************************************************
+//*****************************************************************************
+// section for "valid" memory leaks: the related functions are allocators and
+// the caller is responsible of freeing the memory. cppcheck has a mechanism
+// to check more accuretaly this, by defining callers responsible of freeing
+// but tools like valgring might be more suitable
+//
+//-----------------------------------------------------------------------------
+// suppress error about keysP memory leak, free must be done by calling func
+memleak:common/utils/hashtable/obj_hashtable.c
+//-----------------------------------------------------------------------------
+// suppress error about keys memory leak, free must be done by calling func
+memleak:openair2/UTIL/OMG/omg_hashtable.c
+//-----------------------------------------------------------------------------
+// suppress error about data memory leak. This is the buffer where
+// _emm_as_encode function creates the encoded buffer
+//
+memleak:openair3/NAS/UE/EMM/SAP/emm_as.c
+//-----------------------------------------------------------------------------
+//*****************************************************************************
+// section for files not used in oai exec's included in CI.
+// Possibly candidates for removal otherwise should be documented and updated
+// for project rules enforcement
+// ----------------------------------------------------------------------------
+// likely sources for test programs, maintained?
+invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
+memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
+invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
+//
+//-----------------------------------------------------------------------------
+// oaisim deprecated, remove?
+doubleFree:openair3/TEST/oaisim_mme_list_benchmark.c
+//
+//-----------------------------------------------------------------------------
+// is itti analyzer deprecated
+nullPointer:common/utils/itti_analyzer/itti_analyzer.c
+nullPointerRedundantCheck:common/utils/itti_analyzer/libbuffers/buffers.c
+doubleFree:common/utils/itti_analyzer/libbuffers/socket.c
+memleak:common/utils/itti_analyzer/libbuffers/socket.c
+memleak:common/utils/itti_analyzer/libparser/array_type.c
+memleak:common/utils/itti_analyzer/libui/ui_callbacks.c
+//-----------------------------------------------------------------------------
+// obviously never even compiled!!!
+syntaxError:openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
+//-----------------------------------------------------------------------------
+// omg, otg commented out in cmakelist to be cleaned up definitely?
+arrayIndexOutOfBounds:openair2/UTIL/OMG/omg.c
+uninitvar:openair2/UTIL/OTG/otg_rx_socket.c
+//-----------------------------------------------------------------------------
+// cppcheck is not able to understand that buf is initialized at the first
+// iteration of the loop.
+nullPointer:common/utils/T/local_tracer.c:243
+//-----------------------------------------------------------------------------
+// once again cppcheck does not understand that fds is initialized in the
+// first iteration of the loop
+nullPointer:common/utils/T/tracer/multi.c:264
+nullPointer:common/utils/T/tracer/multi.c:265
+//
+//*****************************************************************************
+//
+// True problems we don't know how to fix, Suppression is commented out,
+// as these kind of problem need either to be fixed or can be suppressed
+// when fully uderstood
+//-----------------------------------------------------------------------------
+// the function [nv]fapi_pnf_p7_config_create should return
+// _this. _this points to a structure and a dynamically allocated field is
+// returned. cppcheck suspects _this will never be released, so do i
+// memleak:nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
+// memleak:nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
+//-----------------------------------------------------------------------------
+// may be security_data->kenb.value is released from calling functions. But even
+// when, for test, freeing it before returning from emm_proc_security_mode_command
+// which does the allocation, cppcheck complains. So something might be wrong...
+// memleak:openair3/NAS/UE/EMM/SecurityModeControl.c
+//-----------------------------------------------------------------------------
+// when used, nobody but the original developer can guess if sn_data_cnf is set or not
+// cppcheck found that in some cases it is not, code needs cleanup before fixing that...
+// uninitvar:openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
+//*****************************************************************************
+// *INDENT-ON*
diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh
index 192008d867..e693b07b91 100755
--- a/ci-scripts/createVM.sh
+++ b/ci-scripts/createVM.sh
@@ -49,6 +49,35 @@ function create_usage {
echo ""
}
+function acquire_vm_create_lock {
+ local FlockFile="/tmp/vmclone.lck"
+ local unlocked="0"
+ touch ${FlockFile} 2>/dev/null
+ if [[ $? -ne 0 ]]
+ then
+ echo "Cannot access lock file ${FlockFile}"
+ exit 2
+ fi
+ while [ $unlocked -eq 0 ]
+ do
+ exec 5>${FlockFile}
+ flock -nx 5
+ if [[ $? -ne 0 ]]
+ then
+ echo "Another instance of VM creation is running"
+ sleep 10
+ else
+ unlocked="1"
+ fi
+ done
+ chmod 666 ${FlockFile} 2>/dev/null
+}
+
+function release_vm_create_lock {
+ local FlockFile="/tmp/vmclone.lck"
+ rm -Rf ${FlockFile}
+}
+
function create_vm {
echo "############################################################"
echo "OAI CI VM script"
@@ -60,10 +89,12 @@ function create_vm {
echo "############################################################"
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################"
+ acquire_vm_create_lock
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
echo "Waiting for VM to be started"
uvt-kvm wait $VM_NAME --insecure
VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ release_vm_create_lock
}
diff --git a/ci-scripts/doGitLabMerge.sh b/ci-scripts/doGitLabMerge.sh
index 852b6407ea..dd93ff41b7 100755
--- a/ci-scripts/doGitLabMerge.sh
+++ b/ci-scripts/doGitLabMerge.sh
@@ -103,6 +103,11 @@ esac
done
+if [[ $TARGET_COMMIT_ID == "latest" ]]
+then
+ TARGET_COMMIT_ID=`git log -n1 --pretty=format:%H origin/$TARGET_BRANCH`
+fi
+
echo "Source Branch is : $SOURCE_BRANCH"
echo "Source Commit ID is : $SOURCE_COMMIT_ID"
echo "Target Branch is : $TARGET_BRANCH"
@@ -121,6 +126,7 @@ git config user.email "jenkins@openairinterface.org"
git config user.name "OAI Jenkins"
git checkout -f $SOURCE_COMMIT_ID
+git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI"
diff --git a/ci-scripts/doc/ci_dev_home.md b/ci-scripts/doc/ci_dev_home.md
new file mode 100644
index 0000000000..3bfc36d3f4
--- /dev/null
+++ b/ci-scripts/doc/ci_dev_home.md
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Dev documentation
+
+
+
+
+VM-based RF-Less Environment:
+
+* [How to setup your test env](./vm_based_simulator_env.md)
+* [How to deal with OAI source files](./vm_based_simulator_sources.md)
+* [The main script](./vm_based_simulator_main_scripts.md)
+* [How to create one or several VM instances](./vm_based_simulator_create.md)
+* [How to build an OAI variant](./vm_based_simulator_build.md)
+* [How the build is checked](./vm_based_simulator_check_build.md)
+* [How to test an OAI variant](./vm_based_simulator_test.md)
+* [How to destroy all VM instances](./vm_based_simulator_destroy.md)
+
+Currently missing documentation:
+* How to generate a build report
+* How to generate a test report
+
+---
+
diff --git a/ci-scripts/doc/vm_based_simulator_build.md b/ci-scripts/doc/vm_based_simulator_build.md
new file mode 100644
index 0000000000..ca3ab356ea
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_build.md
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: build an OAI variant
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Detailed Description](#2-detailed-description)
+3. [Typical Usage](#3-typical-usage)
+
+# 1. Introduction #
+
+```bash
+$ cd /tmp/CI-raphael
+$ ls *.zip
+localZip.zip
+$ ./ci-scripts/oai-ci-vm-tool build --help
+OAI CI VM script
+ Original Author: Raphael Defosseux
+ Requirements:
+ -- uvtool uvtool-libvirt apt-cacher
+ -- xenial image already synced
+ Default:
+ -- eNB with USRP
+
+Usage:
+------
+ oai-ci-vm-tool build [OPTIONS]
+
+Mandatory Options:
+--------
+ --job-name #### OR -jn ####
+ Specify the name of the Jenkins job.
+
+ --build-id #### OR -id ####
+ Specify the build ID of the Jenkins job.
+
+ --workspace #### OR -ws ####
+ Specify the workspace.
+
+Options:
+--------
+ # OpenAirInterface Build Variants
+ --variant enb-usrp OR -v1
+ --variant basic-sim OR -v2
+ --variant phy-sim OR -v3
+ --variant cppcheck OR -v4
+ --variant enb-ethernet OR -v7
+ --variant ue-ethernet OR -v8
+ # non-OSA Build Variants
+ --variant flexran-rtc OR -v10
+ # OpenAirInterface Test Variants
+ --variant l1-sim OR -v20
+ --variant rf-sim OR -v21
+ --variant l2-sim OR -v22
+ Specify the variant to build.
+
+ --keep-vm-alive OR -k
+ Keep the VM alive after the build.
+
+ --daemon OR -D
+ Run as daemon
+
+ --help OR -h
+ Print this help message.
+```
+
+# 2. Detailed Description #
+
+Source file concerned: `ci-scripts/buildOnVM.sh`
+
+## 2.1. build_on_vm function ##
+
+* First check if the ZIP file is available and if the apt-cacher proxy configuration file is present. If not, it will stop.
+* Check if the VM instance is alive. If not, create it.
+* Once the VM is alive, retrieve the IP address with VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
+* We copy the ZIP file to the VM : `scp localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu`
+* apt-cacher proxy file: `scp etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu`
+
+Then we open a SSH session on the VM : `ssh ubuntu@$VM_IP_ADDR`
+
+* We copy the apt-cacher proxy file to its destination space: `sudo cp 01proxy /etc/apt/apt.conf.d/`
+* We create an hush login file to eliminate the ssh opening session messages.
+* We unzip the ZIP file into `/home/ubuntu/tmp/` folder
+* and we work from there.
+
+# 3. Typical Usage #
+
+## 3.1. Build in the foreground, check the results and destroy the VM at the end ##
+
+```bash
+$ cd /tmp/CI-raphael
+$ ls *.zip
+localZip.zip
+$ ./ci-scripts/oai-ci-vm-tool build --workspace /tmp/CI-raphael --job-name RAN-CI-develop --build-id 47 --variant enb-usrp
+############################################################
+OAI CI VM script
+############################################################
+VM_NAME = RAN-CI-develop-b47-enb-usrp
+VM_CMD_FILE = RAN-CI-develop-b47-enb-usrp_cmds.txt
+JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/enb_usrp
+BUILD_OPTIONS = --eNB -w USRP --mu
+VM_MEMORY = 2048 MBytes
+VM_CPU = 4
+############################################################
+Creating VM (RAN-CI-develop-b47-enb-usrp) on Ubuntu Cloud Image base
+############################################################
+Waiting for VM to be started
+Warning: Permanently added '192.168.122.2' (ECDSA) to the list of known hosts.
+RAN-CI-develop-b47-enb-usrp has for IP addr = 192.168.122.2
+############################################################
+Copying GIT repo into VM (RAN-CI-develop-b47-enb-usrp)
+############################################################
+Warning: Permanently added '192.168.122.2' (ECDSA) to the list of known hosts.
+############################################################
+Running install and build script on VM (RAN-CI-develop-b47-enb-usrp)
+############################################################
+Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-145-generic x86_64)
+
+ * Documentation: https://help.ubuntu.com
+ * Management: https://landscape.canonical.com
+ * Support: https://ubuntu.com/advantage
+
+ Get cloud support with Ubuntu Advantage Cloud Guest:
+ http://www.ubuntu.com/business/services/cloud
+
+0 packages can be updated.
+0 updates are security updates.
+
+New release '18.04.2 LTS' available.
+Run 'do-release-upgrade' to upgrade to it.
+
+
+sudo apt-get --yes --quiet install zip subversion libboost-dev
+unzip -qq -DD ../localZip.zip
+cd /home/ubuntu/tmp
+source oaienv
+cd cmake_targets
+./build_oai -I --eNB -w USRP --mu
+
+# Here wait for a few minutes 8 to 12 minutes #
+
+############################################################
+Creating a tmp folder to store results and artifacts
+############################################################
+############################################################
+Destroying VM
+############################################################
+# Host 192.168.122.2 found: line 19
+/home/eurecom/.ssh/known_hosts updated.
+Original contents retained as /home/eurecom/.ssh/known_hosts.old
+############################################################
+Checking build status
+############################################################
+STATUS seems OK
+```
+
+If you are adding the `-k` or `--keep-vm-alive` option, the VM instance will not be destroyed and you explore what happenned.
+
+## 3.2. Build in the background ##
+
+This is how it is done in the CI master job pipeline.
+
+```bash
+$ cd /tmp/CI-raphael
+$ ls *.zip
+localZip.zip
+$ ./ci-scripts/oai-ci-vm-tool build --workspace /tmp/CI-raphael --job-name RAN-CI-develop --build-id 47 --variant phy-sim --daemon
+12:44:24 ############################################################
+12:44:24 OAI CI VM script
+12:44:24 ############################################################
+12:44:24 VM_NAME = RAN-CI-develop-b47-phy-sim
+12:44:24 VM_CMD_FILE = RAN-CI-develop-b47-phy-sim_cmds.txt
+12:44:24 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+12:44:24 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/phy_sim
+12:44:24 BUILD_OPTIONS = --phy_simulators
+12:44:24 VM_MEMORY = 2048 MBytes
+12:44:24 VM_CPU = 4
+12:44:24 ############################################################
+12:44:24 Creating VM (RAN-CI-develop-b47-phy-sim) on Ubuntu Cloud Image base
+12:44:24 ############################################################
+12:44:27 Waiting for VM to be started
+12:46:34 Warning: Permanently added '192.168.122.220' (ECDSA) to the list of known hosts.
+12:46:34 RAN-CI-develop-b47-phy-sim has for IP addr = 192.168.122.220
+12:46:34 ############################################################
+12:46:34 Copying GIT repo into VM (RAN-CI-develop-b47-phy-sim)
+12:46:34 ############################################################
+12:46:34 Warning: Permanently added '192.168.122.220' (ECDSA) to the list of known hosts.
+12:46:34 ############################################################
+12:46:34 Running install and build script on VM (RAN-CI-develop-b47-phy-sim)
+12:46:34 ############################################################
+12:46:34 Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-145-generic x86_64)
+12:46:34
+12:46:34 * Documentation: https://help.ubuntu.com
+12:46:34 * Management: https://landscape.canonical.com
+12:46:34 * Support: https://ubuntu.com/advantage
+12:46:34
+12:46:34 Get cloud support with Ubuntu Advantage Cloud Guest:
+12:46:34 http://www.ubuntu.com/business/services/cloud
+12:46:34
+12:46:34 0 packages can be updated.
+12:46:34 0 updates are security updates.
+12:46:34
+12:46:34 New release '18.04.2 LTS' available.
+12:46:34 Run 'do-release-upgrade' to upgrade to it.
+12:46:34
+12:46:34
+12:46:34 sudo apt-get --yes --quiet install zip daemon subversion libboost-dev
+12:46:46 unzip -qq -DD ../localZip.zip
+12:46:48 source oaienv
+12:46:48 sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh
+12:46:48 STATUS seems OK
+```
+
+So here is 2.5 minutes, a VM was created, source files copied and the build process is started in the background.
+
+```bash
+$ cd /tmp/raphael
+$ ./ci-scripts/oai-ci-vm-tool wait --workspace /var/jenkins/workspace/RAN-CI-develop --variant phy-sim --job-name RAN-CI-develop --build-id 47 --keep-vm-alive
+12:49:14 ############################################################
+12:49:14 OAI CI VM script
+12:49:14 ############################################################
+12:49:14 VM_NAME = RAN-CI-develop-b47-phy-sim
+12:49:14 VM_CMD_FILE = RAN-CI-develop-b47-phy-sim_cmds.txt
+12:49:14 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+12:49:14 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/phy_sim
+12:49:14 BUILD_OPTIONS = --phy_simulators
+12:49:15 Waiting for VM to be started
+12:49:15 Warning: Permanently added '192.168.122.220' (ECDSA) to the list of known hosts.
+12:49:16 RAN-CI-develop-b47-phy-sim has for IP addr = 192.168.122.220
+12:49:16 ############################################################
+12:49:16 Waiting build process to end on VM (RAN-CI-develop-b47-phy-sim)
+12:49:16 ############################################################
+12:49:16 ps -aux | grep build
+12:54:23 ############################################################
+12:54:23 Creating a tmp folder to store results and artifacts
+12:54:23 ############################################################
+12:54:23 ############################################################
+12:54:23 Checking build status
+12:54:23 ############################################################
+12:54:23 STATUS seems OK
+```
+
+Here the `--keep-vm-alive` option is used to keep the VM alive and performs some testing.
+
+---
+
+Next step: [how the build is checked](./vm_based_simulator_check_build.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_check_build.md b/ci-scripts/doc/vm_based_simulator_check_build.md
new file mode 100644
index 0000000000..d66b8ff2a0
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_check_build.md
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: checking the build result
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Detailed Description](#2-detailed-description)
+
+# 1. Introduction #
+
+Function is called:
+
+- when building in foreground
+- when waiting for the background build process is finished
+
+# 2. Detailed Description #
+
+Source file concerned: `ci-scripts/waitBuildOnVM.sh`
+
+## 2.1. check_on_vm_build function ##
+
+* Retrieve the build log files from the VM instance `ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt`
+* and copy them locally in the workspace at $ARCHIVES_LOC
+* List all log files that match the pattern. Each should have
+ * the `Built target` pattern (the library/executable SHALL link)
+* The number of patterned log files SHALL match $NB_PATTERN_FILES defined in `ci-scripts/oai-ci-vm-tool` script for the variant
+
+---
+
+Next step: [how to test a function](./vm_based_simulator_test.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_create.md b/ci-scripts/doc/vm_based_simulator_create.md
new file mode 100644
index 0000000000..c54d69ca14
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_create.md
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: create a VM instance
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Detailed Description](#2-detailed-description)
+3. [Typical Usage](#3-typical-usage)
+
+# 1. Introduction #
+
+```bash
+$ cd /tmp/CI-raphael
+$ ./ci-scripts/oai-ci-vm-tool create --help
+OAI CI VM script
+ Original Author: Raphael Defosseux
+ Requirements:
+ -- uvtool uvtool-libvirt apt-cacher
+ -- xenial image already synced
+ Default:
+ -- eNB with USRP
+
+Usage:
+------
+ oai-ci-vm-tool create [OPTIONS]
+
+Mandatory Options:
+--------
+ --job-name #### OR -jn ####
+ Specify the name of the Jenkins job.
+
+ --build-id #### OR -id ####
+ Specify the build ID of the Jenkins job.
+
+ # OpenAirInterface Build Variants
+ --variant enb-usrp OR -v1
+ --variant basic-sim OR -v2
+ --variant phy-sim OR -v3
+ --variant cppcheck OR -v4
+ --variant enb-ethernet OR -v7
+ --variant ue-ethernet OR -v8
+ # non-OSA Build Variants
+ --variant flexran-rtc OR -v10
+ # OpenAirInterface Test Variants
+ --variant l1-sim OR -v20
+ --variant rf-sim OR -v21
+ --variant l2-sim OR -v22
+ Specify the variant to build.
+
+ --help OR -h
+ Print this help message.
+```
+
+# 2. Detailed Description #
+
+Source file concerned: `ci-scripts/createVM.sh`
+
+## 2.1. create_vm function ##
+
+This is the function that is being called from the main oai-vm-tool script.
+
+The main purpose is to start a VM instance:
+
+```bash
+uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
+```
+
+Variables are set in the main script based on the options.
+
+`--unsafe-caching` option is used because our VM instances are throw-away's.
+
+`--template ci-scripts/template-host.xml` is used to duplicate the CPU properties to the VM instance. **VERY IMPORTANT to build OAI**
+
+## 2.2. Lock / Unlock functions ##
+
+There are `acquire_vm_create_lock` and `release_vm_create_lock` functions.
+
+Creating Virtual Machines instances in parallel **creates a lot of stress** on the host server HW. If you launch creations in parallel (Jenkins pipeline could do it) or you are several people working on the same host server, this mechanism atomizes the creation process and wait until the previous VM creation is finished.
+
+# 3. Typical Usage #
+
+```bash
+$ cd /tmp/CI-raphael
+$ ./ci-scripts/oai-ci-vm-tool create --job-name raphael --build-id 1 --variant phy-sim
+# or a more **unique approach**
+$ ./ci-scripts/oai-ci-vm-tool create -jn toto -id 1 -v2
+```
+
+The Jenkins pipeline uses the master job name as `job-name` option and the job-build ID.
+
+Try to be unique if you are several developers working on the same host server.
+
+Finally, typically I never use the `create` command. I use directly the build command that checks if VM is created and if not, will create it. See next step.
+
+---
+
+Next step: [how to build an OAI variant](./vm_based_simulator_build.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_destroy.md b/ci-scripts/doc/vm_based_simulator_destroy.md
new file mode 100644
index 0000000000..d69e82a005
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_destroy.md
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: Properly Destroy all VM instances
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Detailed Description](#2-detailed-description)
+3. [Typical Usage](#3-typical-usage)
+
+# 1. Introduction #
+
+```bash
+$ cd /tmp/CI-raphael
+$ ./ci-scripts/oai-ci-vm-tool destroy --help
+OAI CI VM script
+ Original Author: Raphael Defosseux
+ Requirements:
+ -- uvtool uvtool-libvirt apt-cacher
+
+Usage:
+------
+ oai-ci-vm-tool destroy [OPTIONS]
+
+Mandatory Options:
+--------
+ --job-name #### OR -jn ####
+ Specify the name of the Jenkins job.
+
+ --build-id #### OR -id ####
+ Specify the build ID of the Jenkins job.
+
+Options:
+--------
+ --help OR -h
+ Print this help message.
+```
+
+# 2. Detailed Description #
+
+Source file concerned: `ci-scripts/destroyAllRunningVM.sh`
+
+## 2.1. destroy_vm function ##
+
+This is the function that is being called from the main oai-vm-tool script.
+
+The main purpose is to destroy all VM instances whose name matches a pattern.
+
+It also cleans up the `.ssh/known_hosts` file.
+
+# 3. Typical Usage #
+
+```bash
+$ cd /tmp/CI-raphael
+$ ./ci-scripts/oai-ci-vm-tool destroy --job-name raphael --build-id 1
+```
+
+---
+
+You can go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_env.md b/ci-scripts/doc/vm_based_simulator_env.md
new file mode 100644
index 0000000000..5dbcfbd931
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_env.md
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Simulator Test Environment
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Prerequisites](#2-prerequisites)
+ 1. [uvtool installation](#21-uvtool-installation)
+ 2. [apt-cacher-server installation](#22-apt-cacher-server-installation)
+
+# 1. Introduction #
+
+This document explains how the master pipeline works and how any developer could contribute to add testing.
+
+It is an extension to the wiki [page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/ci/enb-master-job).
+
+The purpose of this master pipeline is to:
+
+* Validate that a Merge Request is mergeable
+* Validate that a Merge Request is following coding guidelines
+* Validate that a Merge Request is not breaking any typical build variant
+* Validate that a Merge Request is not breaking any legacy simulator-based test
+
+We will mainly focused on the 2 last items.
+
+Last point, this documentation is valid for all CI-supported branches:
+
+* `master`
+* `develop`
+* `develop-nr`
+
+But the feature set may not be aligned. **The principles still apply.**
+
+# 2. Prerequisites #
+
+Some details are available on this wiki [section](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/ci/enb-ci-architecture#22-pipeline-executor).
+
+Currently we have a host server (`bellatrix`) with the current parameters:
+
+* 40 x Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
+* 64 Gbytes RAM
+* Ubuntu 16.04.3 LTS (xenial)
+
+For you to replicate this environment, you need a strong server:
+
+* At least 16 cores
+* Ubuntu 16 (xenial) or higher (such as bionic, not tested)
+
+Also we are using a Virtual Machine (VM for the rest of document) based strategy for the moment.
+
+So you need to install 2 tools:
+
+* uvt-kvm
+* apt-cacher
+
+We are planning to also add:
+
+* A Red Hat Linux Entreprise 7.6 host environment
+* A Container-based strategy (such as Docket and Kubernetes)
+
+## 2.1. uvtool installation ##
+
+```bash
+$ sudo apt-get install uvtool
+# if you don't have already, create an ssh key
+$ ssh-keygen -b 2048
+# retrieve an image
+$ sudo uvt-simplestreams-libvirt sync arch=amd64 release=xenial
+# we might soon switch to an Ubuntu 18.04 version
+$ sudo uvt-simplestreams-libvirt sync arch=amd64 release=bionic
+$ uvt-simplestreams-libvirt query
+release=bionic arch=amd64 label=release (20190402)
+release=xenial arch=amd64 label=release (20190406)
+```
+
+On our server, I don't update (sync) that often (every 2-4 months).
+
+For more details:
+
+* uvtool syntax is [here](http://manpages.ubuntu.com/manpages/trusty/man1/uvt-kvm.1.html)
+* more readable tutorial is [here](https://help.ubuntu.com/lts/serverguide/cloud-images-and-uvtool.html)
+
+## 2.2. apt-cacher-server installation ##
+
+I recommend to follow to the letter this [tutorial](https://help.ubuntu.com/community/Apt-Cacher-Server).
+
+The reason: we are creating/using/destroying a lot of VM instances and we are always installing the same packages.
+This service allows to cache on the host and, doing so, **decreases the pressure on your internet bandwith usage**.
+It also optimizes time at build stage.
+
+```bash
+$ sudo apt-get install apt-cacher apache2
+$ sudo vi /etc/default/apt-cache
+$ sudo service apache2 restart
+
+# Server configuration
+$ sudo vi /etc/apt-cacher/apt-cacher.conf
+ --> allowed_hosts = *
+ --> fix the installer_files_regexp
+$ sudo vi /etc/apt/apt.conf.d/01proxy
+--> add `Acquire::http::Proxy "http://:3142";`
+$ sudo service apt-cacher restart
+```
+
+This last file (/etc/apt/apt.conf.d/01proxy) is very important since it is tested in any CI script.
+
+---
+
+We can now switch to the next step: [how to deal with oai sources](./vm_based_simulator_sources.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_main_scripts.md b/ci-scripts/doc/vm_based_simulator_main_scripts.md
new file mode 100644
index 0000000000..91aa88b7ec
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_main_scripts.md
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: the Main Script
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Sub BASH scripts](#2-sub-bash-scripts)
+3. [Main script features](#3-main-script-features)
+
+# 1. Introduction #
+
+The file name is `./ci-scripts/oai-ci-vm-tool` from the workspace root.
+
+```bash
+$ cd /tmp/CI-raphael
+$ ./ci-scripts/oai-ci-vm-tool --help
+OAI CI VM script
+ Original Author: Raphael Defosseux
+ Requirements:
+ -- uvtool uvtool-libvirt apt-cacher
+ -- xenial image already synced
+
+Usage:
+------
+ oai-ci-vm-tool (-h|--help) {create,destroy,build,wait,test,report-build,report-test} ...
+
+```
+
+This is a **BASH** script.
+
+
+# 2. Sub BASH scripts #
+
+The main script is including a bunch of sub BASH scripts.
+
+* ci-scripts/createVM.sh
+* ci-scripts/buildOnVM.sh
+* ci-scripts/waitBuildOnVM.sh
+* ci-scripts/destroyAllRunningVM.sh
+* ci-scripts/runTestOnVM.sh
+* ci-scripts/reportBuildLocally.sh
+* ci-scripts/reportTestLocally.sh
+
+**NOTE: ci-scripts/runTestOnVM.sh is getting big and will certainly be split to facilate maintenance. Start functions will be also factorized.**
+
+# 3. Main script features #
+
+The main purpose of the main script is decipher the options and launch the requested function.
+
+It is also **testing if uvtool and apt-cacher are installed.**
+
+It finally provides parameters to the requested functions. Parameter definition is centralized there.
+
+For example:
+
+for VM instance creation:
+
+* the instance name: VM_NAME
+* the RAM and number of CPUs: VM_MEMORY, VM_CPU
+
+for OAI variant build:
+
+* build options: BUILD_OPTIONS
+* build log file to parse: LOG_PATTERN
+* the number of log files to parse: NB_PATTERN_FILES
+
+These last 2 variables are very important if you change the build options or if you modify the build system and add more targets to build (especially true for physical simulator).
+
+There are many more variables.
+
+---
+
+Next step: [how to create one or several VM instances](./vm_based_simulator_create.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_sources.md b/ci-scripts/doc/vm_based_simulator_sources.md
new file mode 100644
index 0000000000..4bba6a8a09
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_sources.md
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Simulator OAI source management
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Centralized Workspace](#2-centralized-workspace)
+3. [Create the ZIP file](#3-create-the-zip-file)
+
+# 1. Introduction #
+
+The idea of this section is to optimize/uniform source management for several VM instances.
+
+If we were cloning the same repository in each VM we are creating, we would put so much pressure on the central GitLab repository.
+
+The solution:
+
+* clone/fetch on a given clean workspace and tar/zip only the source files without any artifacts.
+* we then copy the tar/zip file to each VM instance
+* and within each VM instance, unzip
+
+# 2. Centralized Workspace #
+
+You can create a brand new workspace by cloning:
+
+```bash
+$ mkdir /tmp/CI-raphael
+$ cd /tmp/CI-raphael
+$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git .
+$ git checkout develop
+```
+
+You can also use your current cloned workspace and any `develop`-based branch.
+
+```bash
+$ cd /home/raphael/openairinterface5g
+$ git fetch
+$ git checkout develop-improved-documentation
+# CAUTION: the following command will remove any file that has not already been added to GIT
+$ sudo git clean -x -d -ff
+$ git status
+On branch develop-improved-documentation
+Your branch is up-to-date with 'origin/develop-improved-documentation'.
+nothing to commit, working directory clean
+```
+
+You can also have modified files.
+
+**The main point is to have NO ARTIFACTS from a previous build in your workspace.**
+
+Last point, the workspace folder name is not necesseraly `openairinterface5g`. But all the following commands will be run for the root of the workspace.
+
+For clarity, I will always use `/tmp/CI-raphael` as $WORKSPACE.
+
+# 3. Create the ZIP file #
+
+```bash
+# go to root of workspace
+$ cd /tmp/CI-raphael
+$ zip -r -qq localZip.zip .
+```
+
+The **Jenkins Pipeline** performs automatically these operations.
+
+In addition, in case of a merge request, it tries to merge with the target branch and might create a dummy local commit.
+
+See [section](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/ci/enb-master-job#32-verify-guidelines-stage)
+
+---
+
+Next step: [the main scripts](./vm_based_simulator_main_scripts.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/doc/vm_based_simulator_test.md b/ci-scripts/doc/vm_based_simulator_test.md
new file mode 100644
index 0000000000..0be7ae5d3a
--- /dev/null
+++ b/ci-scripts/doc/vm_based_simulator_test.md
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+
+
+ OAI CI Virtual-Machine-based Test Environment: Testing an OAI variant
+
+
+
+
+## Table of Contents ##
+
+1. [Introduction](#1-introduction)
+2. [Detailed Description](#2-detailed-description)
+3. [Typical Usage](#3-typical-usage)
+ 1. [Testing the physical simulators](#31-testing-the-physicals-simulators)
+ 2. [Testing the basic simulator](#32-testing-the-basic-simulator)
+ 3. [Testing the RF simulator](#33-testing-the-rf-simulator)
+ 4. [Testing the L2-nFAPI simulator](#33-testing-the-l2-nfapi-simulator)
+
+# 1. Introduction #
+
+Currently 2 build variants can be directly tested:
+
+* Physical Simulators
+* Basic Simulator
+
+In addition, 2 build variants are used:
+
+* OAI eNB with ETHERNET transport
+* OAI UE with ETHERNET transport
+
+for the following scenarios:
+
+* L1 simulator w/ a channel simulator (NOT IMPLEMENTED)
+* RF simulator : (IMPLEMENTED but not working as of 2019.w15)
+* L2 nFAPI simulator
+
+Tests are run sequentially in the Jenkins pipeline because:
+
+* We want to mutualize the VM creation for an EPC
+* We have seen performance issues when running in parallel.
+
+
+```bash
+./ci-scripts/oai-ci-vm-tool test --help
+OAI CI VM script
+ Original Author: Raphael Defosseux
+ Requirements:
+ -- uvtool uvtool-libvirt apt-cacher
+ -- xenial image already synced
+ Default:
+ -- eNB with USRP
+
+Usage:
+------
+ oai-ci-vm-tool test [OPTIONS]
+
+Options:
+--------
+ --job-name #### OR -jn ####
+ Specify the name of the Jenkins job.
+
+ --build-id #### OR -id ####
+ Specify the build ID of the Jenkins job.
+
+ --workspace #### OR -ws ####
+ Specify the workspace.
+
+ # OpenAirInterface Build Variants
+ --variant enb-usrp OR -v1
+ --variant basic-sim OR -v2
+ --variant phy-sim OR -v3
+ --variant cppcheck OR -v4
+ --variant enb-ethernet OR -v7
+ --variant ue-ethernet OR -v8
+ # non-OSA Build Variants
+ --variant flexran-rtc OR -v10
+ # OpenAirInterface Test Variants
+ --variant l1-sim OR -v20
+ --variant rf-sim OR -v21
+ --variant l2-sim OR -v22
+ Specify the variant to build.
+
+ --keep-vm-alive OR -k
+ Keep the VM alive after the build.
+
+ --help OR -h
+ Print this help message.
+```
+
+# 2. Detailed Description #
+
+Source file concerned: `ci-scripts/run_test_on_vm.sh`
+
+**TBD when file is re-structured.**
+
+# 3. Typical Usage #
+
+## 3.1. Testing the physical simulators ##
+
+```bash
+$ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant phy-sim --job-name RAN-CI-develop --build-id 47
+12:54:29 ############################################################
+12:54:29 OAI CI VM script
+12:54:29 ############################################################
+12:54:29 VM_NAME = RAN-CI-develop-b47-phy-sim
+12:54:29 VM_CMD_FILE = RAN-CI-develop-b47-phy-sim_cmds.txt
+12:54:29 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+12:54:29 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/phy_sim/test
+12:54:29 ############################################################
+12:54:29 Waiting for VM to be started
+12:54:29 ############################################################
+12:54:29 Warning: Permanently added '192.168.122.220' (ECDSA) to the list of known hosts.
+12:54:30 RAN-CI-develop-b47-phy-sim has for IP addr = 192.168.122.220
+...
+13:04:48 Test Results are written to /home/ubuntu/tmp/cmake_targets/autotests/log/results_autotests.xml
+13:05:00 ############################################################
+13:05:00 Creating a tmp folder to store results and artifacts
+13:05:00 ############################################################
+13:05:00 /var/jenkins/workspace/RAN-CI-develop/archives/phy_sim/test /var/jenkins/workspace/RAN-CI-develop
+13:05:04 /var/jenkins/workspace/RAN-CI-develop
+13:05:04 ############################################################
+13:05:04 Destroying VM
+13:05:04 ############################################################
+13:05:06 # Host 192.168.122.220 found: line 21
+13:05:06 /home/eurecom/.ssh/known_hosts updated.
+13:05:06 Original contents retained as /home/eurecom/.ssh/known_hosts.old
+13:05:06 ############################################################
+13:05:06 Checking run status
+13:05:06 ############################################################
+13:05:06 NB_FOUND_FILES = 1
+13:05:06 NB_RUNS = 20
+13:05:06 NB_FAILURES = 0
+13:05:06 STATUS seems OK
+```
+
+Note that the VM instance is destroyed. You do that when you are sure your test is passing.
+
+## 3.2. Testing the basic simulator ##
+
+```bash
+$ ./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant basic-sim --job-name RAN-CI-develop --build-id 48
+15:11:13 ############################################################
+15:11:13 OAI CI VM script
+15:11:13 ############################################################
+15:11:13 VM_NAME = RAN-CI-develop-b48-basic-sim
+15:11:13 VM_CMD_FILE = RAN-CI-develop-b48-basic-sim_cmds.txt
+15:11:13 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+15:11:13 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/basic_sim/test
+15:11:13 ############################################################
+15:11:13 Waiting for VM to be started
+15:11:13 ############################################################
+15:11:14 Warning: Permanently added '192.168.122.29' (ECDSA) to the list of known hosts.
+15:11:15 RAN-CI-develop-b48-basic-sim has for IP addr = 192.168.122.29
+15:11:15 ############################################################
+15:11:15 Test EPC on VM (RAN-CI-develop-b48-epc) will be using ltebox
+15:11:15 ############################################################
+15:11:15 EPC_VM_CMD_FILE = RAN-CI-develop-b48-epc_cmds.txt
+15:11:15 ############################################################
+15:11:15 Creating test EPC VM (RAN-CI-develop-b48-epc) on Ubuntu Cloud Image base
+15:11:15 ############################################################
+15:11:18 Waiting for VM to be started
+15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts.
+15:13:25 RAN-CI-develop-b48-epc has for IP addr = 192.168.122.156
+15:13:25 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts.
+15:13:25 ls: cannot access '/opt/ltebox/tools/start_ltebox': No such file or directory
+15:13:25 ############################################################
+15:13:25 Copying ltebox archives into EPC VM (RAN-CI-develop-b48-epc)
+15:13:25 ############################################################
+15:13:25 ############################################################
+15:13:25 Install EPC on EPC VM (RAN-CI-develop-b48-epc)
+15:13:25 ############################################################
+....
+15:24:39 ############################################################
+15:24:39 Terminate EPC
+15:24:39 ############################################################
+15:24:39 cd /opt/ltebox/tools
+15:24:39 sudo ./stop_ltebox
+15:24:40 sudo daemon --name=simulated_hss --stop
+15:24:40 sudo killall --signal SIGKILL hss_sim
+15:24:40 ############################################################
+15:24:40 Destroying VMs
+15:24:40 ############################################################
+15:24:41 # Host 192.168.122.29 found: line 18
+15:24:41 /home/eurecom/.ssh/known_hosts updated.
+15:24:41 Original contents retained as /home/eurecom/.ssh/known_hosts.old
+15:24:43 # Host 192.168.122.60 found: line 20
+15:24:43 /home/eurecom/.ssh/known_hosts updated.
+15:24:43 Original contents retained as /home/eurecom/.ssh/known_hosts.old
+15:24:43 ############################################################
+15:24:43 Checking run status
+15:24:43 ############################################################
+15:24:43 STATUS seems OK
+```
+
+## 3.3. Test the RF simulator ##
+
+```bash
+./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant rf-sim --job-name RAN-CI-develop --build-id 48 --keep-vm-alive
+15:24:45 Currently RF-Simulator Testing is not implemented / enabled
+15:24:45 Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it
+15:24:45 STATUS seems OK
+```
+
+## 3.4. Testing the L2-nFAPI simulator
+
+```bash
+./ci-scripts/oai-ci-vm-tool test --workspace /var/jenkins/workspace/RAN-CI-develop --variant l2-sim --job-name RAN-CI-develop --build-id 48
+15:24:47 ############################################################
+15:24:47 OAI CI VM script
+15:24:47 ############################################################
+15:24:47 ENB_VM_NAME = RAN-CI-develop-b48-enb-ethernet
+15:24:47 ENB_VM_CMD_FILE = RAN-CI-develop-b48-enb-ethernet_cmds.txt
+15:24:47 UE_VM_NAME = RAN-CI-develop-b48-ue-ethernet
+15:24:47 UE_VM_CMD_FILE = RAN-CI-develop-b48-ue-ethernet_cmds.txt
+15:24:47 JENKINS_WKSP = /var/jenkins/workspace/RAN-CI-develop
+15:24:47 ARCHIVES_LOC = /var/jenkins/workspace/RAN-CI-develop/archives/l2_sim/test
+15:24:47 ############################################################
+15:24:47 Waiting for ENB VM to be started
+15:24:47 ############################################################
+15:24:47 Warning: Permanently added '192.168.122.110' (ECDSA) to the list of known hosts.
+15:24:48 RAN-CI-develop-b48-enb-ethernet has for IP addr = 192.168.122.110
+15:24:48 ############################################################
+15:24:48 Waiting for UE VM to be started
+15:24:48 ############################################################
+15:24:49 Warning: Permanently added '192.168.122.90' (ECDSA) to the list of known hosts.
+15:24:50 RAN-CI-develop-b48-ue-ethernet has for IP addr = 192.168.122.90
+15:24:50 ############################################################
+15:24:50 Test EPC on VM (RAN-CI-develop-b48-epc) will be using ltebox
+15:24:50 ############################################################
+15:24:50 EPC_VM_CMD_FILE = RAN-CI-develop-b48-epc_cmds.txt
+15:24:50 Waiting for VM to be started
+15:24:50 Warning: Permanently added '192.168.122.156' (ECDSA) to the list of known hosts.
+15:24:51 RAN-CI-develop-b48-epc has for IP addr = 192.168.122.156
+...
+15:42:44 ############################################################
+15:42:44 Destroying VMs
+15:42:44 ############################################################
+15:42:46 # Host 192.168.122.110 found: line 18
+15:42:46 /home/eurecom/.ssh/known_hosts updated.
+15:42:46 Original contents retained as /home/eurecom/.ssh/known_hosts.old
+15:42:47 # Host 192.168.122.90 found: line 18
+15:42:47 /home/eurecom/.ssh/known_hosts updated.
+15:42:47 Original contents retained as /home/eurecom/.ssh/known_hosts.old
+15:42:47 ############################################################
+15:42:47 Checking run status
+15:42:47 ############################################################
+15:42:47 STATUS failed?
+```
+---
+
+Final step: [how to properly destroy all VM instances](./vm_based_simulator_destroy.md)
+
+You can also go back to the [CI dev main page](./ci_dev_home.md)
+
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 62add8429b..9fb546f370 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -1,4 +1,3 @@
-#/*
# * 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.
@@ -50,6 +49,11 @@ MME_PROCESS_OK = +3
SPGW_PROCESS_FAILED = -4
SPGW_PROCESS_OK = +4
UE_IP_ADDRESS_ISSUE = -5
+OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE = -20
+OAI_UE_PROCESS_COULD_NOT_SYNC = -21
+OAI_UE_PROCESS_ASSERTION = -22
+OAI_UE_PROCESS_FAILED = -6
+OAI_UE_PROCESS_OK = +6
#-----------------------------------------------------------
# Import
@@ -59,6 +63,7 @@ import re # reg
import pexpect # pexpect
import time # sleep
import os
+import subprocess
import xml.etree.ElementTree as ET
import logging
import datetime
@@ -88,6 +93,7 @@ class SSHConnection():
self.EPCPassword = ''
self.EPCSourceCodePath = ''
self.EPCType = ''
+ self.EPC_PcapFileName = ''
self.ADBIPAddress = ''
self.ADBUserName = ''
self.ADBPassword = ''
@@ -99,6 +105,9 @@ class SSHConnection():
self.Initialize_eNB_args = ''
self.eNBLogFile = ''
self.eNB_instance = ''
+ self.eNBOptions = ''
+ self.rruOptions = ''
+ self.rruLogFile = ''
self.ping_args = ''
self.ping_packetloss_threshold = ''
self.iperf_args = ''
@@ -113,18 +122,28 @@ class SSHConnection():
self.htmlFooterCreated = False
self.htmlUEConnected = -1
self.htmleNBFailureMsg = ''
+ self.htmlUEFailureMsg = ''
self.picocom_closure = False
self.idle_sleep_time = 0
self.htmlTabRefs = []
self.htmlTabNames = []
self.htmlTabIcons = []
self.finalStatus = False
- self.eNBOsVersion = ''
- self.eNBKernelVersion = ''
- self.eNBUhdVersion = ''
- self.eNBCpuNb = ''
- self.eNBCpuModel = ''
- self.eNBCpuMHz = ''
+ self.OsVersion = ''
+ self.KernelVersion = ''
+ self.UhdVersion = ''
+ self.UsrpBoard = ''
+ self.CpuNb = ''
+ self.CpuModel = ''
+ self.CpuMHz = ''
+ self.UEIPAddress = ''
+ self.UEUserName = ''
+ self.UEPassword = ''
+ self.UE_instance = ''
+ self.UESourceCodePath = ''
+ self.UELogFile = ''
+ self.Build_OAI_UE_args = ''
+ self.Initialize_OAI_UE_args = ''
def open(self, ipaddress, username, password):
count = 0
@@ -316,14 +335,72 @@ class SSHConnection():
self.command('mkdir -p log', '\$', 5)
self.command('chmod 777 log', '\$', 5)
# no need to remove in log (git clean did the trick)
- self.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee -a compile_oai_enb.log', 'Bypassing the Tests', 600)
+ self.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee compile_oai_enb.log', 'Bypassing the Tests|build have failed', 600)
+ self.command('ls lte_build_oai/build', '\$', 3)
+ self.command('ls lte_build_oai/build', '\$', 3)
+ buildStatus = True
+ result = re.search('lte-softmodem', str(self.ssh.before))
+ if result is None:
+ buildStatus = False
self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
self.command('mv compile_oai_enb.log ' + 'build_log_' + self.testCase_id, '\$', 5)
- # Workaround to run with develop-nr
- self.command('if [ -e ran_build ]; then cp -rf ran_build lte_build_oai; fi', '\$', 30)
self.close()
- self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK)
+ if buildStatus:
+ self.CreateHtmlTestRow(self.Build_eNB_args, 'OK', ALL_PROCESSES_OK)
+ else:
+ logging.error('\u001B[1m Building OAI eNB Failed\u001B[0m')
+ self.CreateHtmlTestRow(self.Build_eNB_args, 'KO', ALL_PROCESSES_OK)
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+
+ def BuildOAIUE(self):
+ if self.UEIPAddress == '' or self.eNBRepository == '' or self.eNBBranch == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('mkdir -p ' + self.UESourceCodePath, '\$', 5)
+ self.command('cd ' + self.UESourceCodePath, '\$', 5)
+ self.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.eNBRepository + ' .; else stdbuf -o0 git fetch; fi', '\$', 600)
+ # here add a check if git clone or git fetch went smoothly
+ self.command('git config user.email "jenkins@openairinterface.org"', '\$', 5)
+ self.command('git config user.name "OAI Jenkins"', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S git clean -x -d -ff', '\$', 30)
+ # if the commit ID is provided use it to point to it
+ if self.eNBCommitID != '':
+ self.command('git checkout -f ' + self.eNBCommitID, '\$', 5)
+ # if the branch is not develop, then it is a merge request and we need to do
+ # the potential merge. Note that merge conflicts should already been checked earlier
+ if (self.eNB_AllowMerge):
+ if self.eNBTargetBranch == '':
+ if (self.eNBBranch != 'develop') and (self.eNBBranch != 'origin/develop'):
+ self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5)
+ else:
+ logging.debug('Merging with the target branch: ' + self.eNBTargetBranch)
+ self.command('git merge --ff origin/' + self.eNBTargetBranch + ' -m "Temporary merge for CI"', '\$', 5)
+ self.command('source oaienv', '\$', 5)
+ self.command('cd cmake_targets', '\$', 5)
+ self.command('mkdir -p log', '\$', 5)
+ self.command('chmod 777 log', '\$', 5)
+ # no need to remove in log (git clean did the trick)
+ self.command('stdbuf -o0 ./build_oai ' + self.Build_OAI_UE_args + ' 2>&1 | stdbuf -o0 tee compile_oai_ue.log', 'Bypassing the Tests|build have failed', 600)
+ self.command('ls lte_build_oai/build', '\$', 3)
+ self.command('ls lte_build_oai/build', '\$', 3)
+ buildStatus = True
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is None:
+ buildStatus = False
+ self.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
+ self.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
+ self.command('mv compile_oai_ue.log ' + 'build_log_' + self.testCase_id, '\$', 5)
+ self.close()
+ if buildStatus:
+ self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE')
+ else:
+ logging.error('\u001B[1m Building OAI UE Failed\u001B[0m')
+ self.CreateHtmlTestRow(self.Build_OAI_UE_args, 'KO', ALL_PROCESSES_OK, 'OAI UE')
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
def InitializeHSS(self):
if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '' or self.EPCType == '':
@@ -388,8 +465,9 @@ class SSHConnection():
if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.eNBSourceCodePath == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = True
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = False
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus)
self.CreateHtmlTabFooter(False)
@@ -403,13 +481,15 @@ class SSHConnection():
if result is not None:
eth_interface = result.group('eth_interface')
logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m')
- self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/enb_' + self.testCase_id + '_s1log.pcap', '\$', 5)
- self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + self.testCase_id + '_s1log.pcap > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5)
+ self.EPC_PcapFileName = 'enb_' + self.testCase_id + '_s1log.pcap'
+ self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f /tmp/' + self.EPC_PcapFileName, '\$', 5)
+ self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/' + self.EPC_PcapFileName + ' > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5)
self.close()
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
# Initialize_eNB_args usually start with -O and followed by the location in repository
full_config_file = self.Initialize_eNB_args.replace('-O ','')
+ extra_options = ''
extIdx = full_config_file.find('.conf')
if (extIdx > 0):
extra_options = full_config_file[extIdx + 5:]
@@ -427,9 +507,19 @@ class SSHConnection():
sys.exit('Insufficient Parameter')
ci_full_config_file = config_path + '/ci-' + config_file
rruCheck = False
- result = re.search('rru', str(config_file))
+ result = re.search('rru|du', str(config_file))
if result is not None:
rruCheck = True
+ # do not reset board twice in IF4.5 case
+ result = re.search('rru|enb|du', str(config_file))
+ if result is not None:
+ self.command('echo ' + self.eNBPassword + ' | sudo -S uhd_find_devices', '\$', 10)
+ result = re.search('type: b200', str(self.ssh.before))
+ if result is not None:
+ logging.debug('Found a B2xx device --> resetting it')
+ self.command('echo ' + self.eNBPassword + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10)
+ # Reloading FGPA bin firmware
+ self.command('echo ' + self.eNBPassword + ' | sudo -S uhd_find_devices', '\$', 15)
# Make a copy and adapt to EPC / eNB IP addresses
self.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
self.command('sed -i -e \'s/CI_MME_IP_ADDR/' + self.EPCIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
@@ -437,12 +527,17 @@ class SSHConnection():
# Launch eNB with the modified config file
self.command('source oaienv', '\$', 5)
self.command('cd cmake_targets', '\$', 5)
- self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5)
- self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh ', '\$', 5)
+ self.command('echo "ulimit -c unlimited && ./lte_build_oai/build/lte-softmodem -O ' + self.eNBSourceCodePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
+ self.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
self.command('echo ' + self.eNBPassword + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5)
self.command('echo ' + self.eNBPassword + ' | sudo -S -E daemon --inherit --unsafe --name=enb' + str(self.eNB_instance) + '_daemon --chdir=' + self.eNBSourceCodePath + '/cmake_targets -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + self.testCase_id + '.log ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
if not rruCheck:
self.eNBLogFile = 'enb_' + self.testCase_id + '.log'
+ if extra_options != '':
+ self.eNBOptions = extra_options
+ result = re.search('rru|du', str(config_file))
+ if result is not None:
+ self.rruLogFile = 'enb_' + self.testCase_id + '.log'
time.sleep(6)
doLoop = True
loopCounter = 10
@@ -464,25 +559,31 @@ class SSHConnection():
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
logging.debug('\u001B[1m Stopping tshark \u001B[0m')
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
+ if self.EPC_PcapFileName != '':
+ time.sleep(0.5)
+ self.command('echo ' + self.EPCPassword + ' | sudo -S chmod 666 /tmp/' + self.EPC_PcapFileName, '\$', 5)
self.close()
time.sleep(1)
- pcap_log_file = 'enb_' + self.testCase_id + '_s1log.pcap'
- copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
- if (copyin_res == 0):
- self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
+ if self.EPC_PcapFileName != '':
+ copyin_res = self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + self.EPC_PcapFileName, '.')
+ if (copyin_res == 0):
+ self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.EPC_PcapFileName, self.eNBSourceCodePath + '/cmake_targets/.')
sys.exit(1)
else:
- self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
+ self.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting"', '\$', 4)
if rruCheck:
result = re.search('wait RUs', str(self.ssh.before))
else:
- result = re.search('got sync', str(self.ssh.before))
+ result = re.search('got sync|Starting F1AP at CU', str(self.ssh.before))
if result is None:
time.sleep(6)
else:
doLoop = False
+ if rruCheck and extra_options != '':
+ self.rruOptions = extra_options
self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', ALL_PROCESSES_OK)
logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m')
+ time.sleep(10)
self.close()
@@ -516,6 +617,125 @@ class SSHConnection():
job.join()
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
+ def InitializeOAIUE(self):
+ if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
+ if result is None:
+ check_eNB = True
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
+ if (pStatus < 0):
+ self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'KO', pStatus)
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ # b2xx_fx3_utils reset procedure
+ self.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 10)
+ result = re.search('type: b200', str(self.ssh.before))
+ if result is not None:
+ logging.debug('Found a B2xx device --> resetting it')
+ self.command('echo ' + self.UEPassword + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10)
+ # Reloading FGPA bin firmware
+ self.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 15)
+ else:
+ logging.debug('Did not find any B2xx device')
+ self.command('cd ' + self.UESourceCodePath, '\$', 5)
+ self.command('source oaienv', '\$', 5)
+ self.command('cd cmake_targets/lte_build_oai/build', '\$', 5)
+ result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
+ # We may have to regenerate the .u* files
+ if result is None:
+ self.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf .u*', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf -o .', '\$', 5)
+ # Launch UE with the modified config file
+ self.command('echo "ulimit -c unlimited && ./lte-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+ self.command('chmod 775 ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+ self.UELogFile = 'ue_' + self.testCase_id + '.log'
+
+ # We are now looping several times to hope we really sync w/ an eNB
+ doOutterLoop = True
+ outterLoopCounter = 5
+ gotSyncStatus = True
+ fullSyncStatus = True
+ while (doOutterLoop):
+ self.command('cd ' + self.UESourceCodePath + '/cmake_targets/lte_build_oai/build', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S -E daemon --inherit --unsafe --name=ue' + str(self.UE_instance) + '_daemon --chdir=' + self.UESourceCodePath + '/cmake_targets/lte_build_oai/build -o ' + self.UESourceCodePath + '/cmake_targets/ue_' + self.testCase_id + '.log ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+ time.sleep(6)
+ self.command('cd ../..', '\$', 5)
+ doLoop = True
+ loopCounter = 10
+ gotSyncStatus = True
+ # the 'got sync' message is for the UE threads synchronization
+ while (doLoop):
+ loopCounter = loopCounter - 1
+ if (loopCounter == 0):
+ # Here should never occur
+ logging.error('"got sync" message never showed!')
+ gotSyncStatus = False
+ doLoop = False
+ continue
+ self.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
+ result = re.search('got sync', str(self.ssh.before))
+ if result is None:
+ time.sleep(6)
+ else:
+ doLoop = False
+ logging.debug('Found "got sync" message!')
+ if gotSyncStatus == False:
+ # we certainly need to stop the lte-uesoftmodem process if it is still running!
+ self.command('ps -aux | grep --text --color=never softmodem | grep -v grep', '\$', 4)
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is not None:
+ self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal=SIGINT lte-uesoftmodem', '\$', 4)
+ time.sleep(3)
+ # We are now checking if sync w/ eNB DOES NOT OCCUR
+ # Usually during the cell synchronization stage, the UE returns with No cell synchronization message
+ doLoop = True
+ loopCounter = 10
+ while (doLoop):
+ loopCounter = loopCounter - 1
+ if (loopCounter == 0):
+ # Here we do have a great chance that the UE did cell-sync w/ eNB
+ doLoop = False
+ doOutterLoop = False
+ fullSyncStatus = True
+ continue
+ self.command('stdbuf -o0 cat ue_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
+ result = re.search('No cell synchronization found', str(self.ssh.before))
+ if result is None:
+ time.sleep(6)
+ else:
+ doLoop = False
+ fullSyncStatus = False
+ logging.debug('Found: "No cell synchronization" message! --> try again')
+ time.sleep(6)
+ self.command('ps -aux | grep --text --color=never softmodem | grep -v grep', '\$', 4)
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is not None:
+ self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal=SIGINT lte-uesoftmodem', '\$', 4)
+ outterLoopCounter = outterLoopCounter - 1
+ if (outterLoopCounter == 0):
+ doOutterLoop = False
+
+ if fullSyncStatus and gotSyncStatus:
+ result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
+ if result is None:
+ self.command('ifconfig oaitun_ue1', '\$', 4)
+ result = re.search('inet addr', str(self.ssh.before))
+ if result is not None:
+ logging.debug('\u001B[1m oaitun_ue1 interface is mounted and configured\u001B[0m')
+ else:
+ logging.error('\u001B[1m oaitun_ue1 interface is either NOT mounted or NOT configured\u001B[0m')
+
+ self.close()
+ # For the moment we are always OK!!!
+ self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE')
+ logging.debug('\u001B[1m Initialize OAI UE Completed\u001B[0m')
+
def checkDevTTYisUnlocked(self):
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
count = 0
@@ -603,21 +823,155 @@ class SSHConnection():
time.sleep(4)
# We should check if we register
count = 0
- while count < 3:
+ attach_cnt = 0
+ attach_status = False
+ while count < 5:
self.command('AT+CEREG?', 'OK', 5)
- result = re.search('CEREG: 2,(?P[0-9\-]+)', str(self.ssh.before))
+ result = re.search('CEREG: 2,(?P[0-9\-]+),', str(self.ssh.before))
if result is not None:
mDataConnectionState = int(result.group('state'))
if mDataConnectionState is not None:
- logging.debug('+CEREG: 2,' + str(mDataConnectionState))
+ if mDataConnectionState == 1:
+ count = 10
+ attach_status = True
+ result = re.search('CEREG: 2,1,"(?P[0-9A-Z]+)","(?P[0-9A-Z]+)"', str(self.ssh.before))
+ if result is not None:
+ networky = result.group('networky')
+ networkz = result.group('networkz')
+ logging.debug('\u001B[1m CAT-M module attached to eNB (' + str(networky) + '/' + str(networkz) + ')\u001B[0m')
+ else:
+ logging.debug('\u001B[1m CAT-M module attached to eNB\u001B[0m')
+ else:
+ logging.debug('+CEREG: 2,' + str(mDataConnectionState))
+ attach_cnt = attach_cnt + 1
else:
logging.debug(str(self.ssh.before))
+ attach_cnt = attach_cnt + 1
count = count + 1
time.sleep(1)
+ if attach_status:
+ self.command('AT+CESQ', 'OK', 5)
+ result = re.search('CESQ: 99,99,255,255,(?P[0-9]+),(?P[0-9]+)', str(self.ssh.before))
+ if result is not None:
+ nRSRQ = int(result.group('rsrq'))
+ nRSRP = int(result.group('rsrp'))
+ if (nRSRQ is not None) and (nRSRP is not None):
+ logging.debug(' RSRQ = ' + str(-20+(nRSRQ/2)) + ' dB')
+ logging.debug(' RSRP = ' + str(-140+nRSRP) + ' dBm')
self.close()
self.picocom_closure = False
- self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
+ html_queue = SimpleQueue()
self.checkDevTTYisUnlocked()
+ if attach_status:
+ html_cell = 'CAT-M module\nAttachment Completed in ' + str(attach_cnt+4) + ' seconds'
+ if (nRSRQ is not None) and (nRSRP is not None):
+ html_cell += '\n RSRQ = ' + str(-20+(nRSRQ/2)) + ' dB'
+ html_cell += '\n RSRP = ' + str(-140+nRSRP) + ' dBm '
+ else:
+ html_cell += ''
+ html_queue.put(html_cell)
+ self.CreateHtmlTestRowQueue('N/A', 'OK', 1, html_queue)
+ else:
+ html_cell = 'CAT-M module\nAttachment Failed '
+ html_queue.put(html_cell)
+ self.CreateHtmlTestRowQueue('N/A', 'KO', 1, html_queue)
+
+ def PingCatM(self):
+ if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ check_eNB = True
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
+ if (pStatus < 0):
+ self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ try:
+ statusQueue = SimpleQueue()
+ lock = Lock()
+ self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
+ self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
+ self.command('cd scripts', '\$', 5)
+ if re.match('OAI', self.EPCType, re.IGNORECASE):
+ logging.debug('Using the OAI EPC HSS: not implemented yet')
+ self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ else:
+ self.command('egrep --color=never "Allocated ipv4 addr" /opt/ltebox/var/log/xGwLog.0', '\$', 5)
+ result = re.search('Allocated ipv4 addr: (?P[0-9\.]+) from Pool', str(self.ssh.before))
+ if result is not None:
+ moduleIPAddr = result.group('ipaddr')
+ else:
+ return
+ ping_time = re.findall("-c (\d+)",str(self.ping_args))
+ device_id = 'catm'
+ ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + str(moduleIPAddr) + ' 2>&1 | stdbuf -o0 tee ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
+ # TIMEOUT CASE
+ if ping_status < 0:
+ message = 'Ping with UE (' + str(moduleIPAddr) + ') crashed due to TIMEOUT!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
+ self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
+ return
+ result = re.search(', (?P[0-9\.]+)% packet loss, time [0-9\.]+ms', str(self.ssh.before))
+ if result is None:
+ message = 'Packet Loss Not Found!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
+ self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
+ return
+ packetloss = result.group('packetloss')
+ if float(packetloss) == 100:
+ message = 'Packet Loss is 100%'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
+ self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
+ return
+ result = re.search('rtt min\/avg\/max\/mdev = (?P[0-9\.]+)\/(?P[0-9\.]+)\/(?P[0-9\.]+)\/[0-9\.]+ ms', str(self.ssh.before))
+ if result is None:
+ message = 'Ping RTT_Min RTT_Avg RTT_Max Not Found!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
+ self.ping_iperf_wrong_exit(lock, moduleIPAddr, device_id, statusQueue, message)
+ return
+ rtt_min = result.group('rtt_min')
+ rtt_avg = result.group('rtt_avg')
+ rtt_max = result.group('rtt_max')
+ pal_msg = 'Packet Loss : ' + packetloss + '%'
+ min_msg = 'RTT(Min) : ' + rtt_min + ' ms'
+ avg_msg = 'RTT(Avg) : ' + rtt_avg + ' ms'
+ max_msg = 'RTT(Max) : ' + rtt_max + ' ms'
+ lock.acquire()
+ logging.debug('\u001B[1;37;44m ping result (' + moduleIPAddr + ') \u001B[0m')
+ logging.debug('\u001B[1;34m ' + pal_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + min_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + avg_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + max_msg + '\u001B[0m')
+ qMsg = pal_msg + '\n' + min_msg + '\n' + avg_msg + '\n' + max_msg
+ packetLossOK = True
+ if packetloss is not None:
+ if float(packetloss) > float(self.ping_packetloss_threshold):
+ qMsg += '\nPacket Loss too high'
+ logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
+ packetLossOK = False
+ elif float(packetloss) > 0:
+ qMsg += '\nPacket Loss is not 0%'
+ logging.debug('\u001B[1;30;43m Packet Loss is not 0% \u001B[0m')
+ lock.release()
+ self.close()
+ html_cell = 'CAT-M module\nIP Address : ' + moduleIPAddr + '\n' + qMsg + ' '
+ statusQueue.put(html_cell)
+ if (packetLossOK):
+ self.CreateHtmlTestRowQueue(self.ping_args, 'OK', 1, statusQueue)
+ else:
+ self.CreateHtmlTestRowQueue(self.ping_args, 'KO', 1, statusQueue)
+ self.AutoTerminateUEandeNB()
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ except:
+ os.kill(os.getppid(),signal.SIGUSR1)
def AttachUE_common(self, device_id, statusQueue, lock):
try:
@@ -670,8 +1024,9 @@ class SSHConnection():
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = False
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = True
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB()
@@ -735,8 +1090,9 @@ class SSHConnection():
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = False
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = True
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB()
@@ -799,8 +1155,9 @@ class SSHConnection():
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = False
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = True
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.CreateHtmlTabFooter(False)
@@ -847,6 +1204,18 @@ class SSHConnection():
sys.exit('Insufficient Parameter')
ue_ip_status = 0
self.UEIPAddresses = []
+ if (len(self.UEDevices) == 1) and (self.UEDevices[0] == 'OAI-UE'):
+ if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('ifconfig oaitun_ue1', '\$', 4)
+ result = re.search('inet addr:(?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', str(self.ssh.before))
+ UE_IPAddress = result.group('ueipaddress')
+ logging.debug('\u001B[1mUE (' + self.UEDevices[0] + ') IP Address is ' + UE_IPAddress + '\u001B[0m')
+ self.UEIPAddresses.append(UE_IPAddress)
+ self.close()
+ return ue_ip_status
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
for device_id in self.UEDevices:
count = 0
@@ -866,7 +1235,7 @@ class SSHConnection():
logging.debug('\u001B[1mUE (' + device_id + ') IP Address is ' + UE_IPAddress + '\u001B[0m')
for ueipaddress in self.UEIPAddresses:
if ueipaddress == UE_IPAddress:
- logging.debug('\u001B[1mUE (' + device_id + ') IP Address ' + UE_IPAddress + 'has been existed!' + '\u001B[0m')
+ logging.debug('\u001B[1mUE (' + device_id + ') IP Address ' + UE_IPAddress + ': has already been allocated to another device !' + '\u001B[0m')
ue_ip_status -= 1
continue
self.UEIPAddresses.append(UE_IPAddress)
@@ -887,29 +1256,33 @@ class SSHConnection():
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
self.command('cd scripts', '\$', 5)
ping_time = re.findall("-c (\d+)",str(self.ping_args))
- ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee -a ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
+ ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee ping_' + self.testCase_id + '_' + device_id + '.log', '\$', int(ping_time[0])*1.5)
# TIMEOUT CASE
if ping_status < 0:
message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!'
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
return
result = re.search(', (?P[0-9\.]+)% packet loss, time [0-9\.]+ms', str(self.ssh.before))
if result is None:
message = 'Packet Loss Not Found!'
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
return
packetloss = result.group('packetloss')
if float(packetloss) == 100:
message = 'Packet Loss is 100%'
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
return
result = re.search('rtt min\/avg\/max\/mdev = (?P[0-9\.]+)\/(?P[0-9\.]+)\/(?P[0-9\.]+)\/[0-9\.]+ ms', str(self.ssh.before))
if result is None:
message = 'Ping RTT_Min RTT_Avg RTT_Max Not Found!'
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
return
rtt_min = result.group('rtt_min')
@@ -947,19 +1320,119 @@ class SSHConnection():
except:
os.kill(os.getppid(),signal.SIGUSR1)
+ def PingNoS1(self):
+ check_eNB = True
+ check_OAI_UE = True
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
+ if (pStatus < 0):
+ self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
+ self.AutoTerminateUEandeNB()
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ ping_from_eNB = re.search('oaitun_enb1', str(self.ping_args))
+ if ping_from_eNB is not None:
+ if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ else:
+ if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ try:
+ if ping_from_eNB is not None:
+ self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
+ self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets/', '\$', 5)
+ else:
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('cd ' + self.UESourceCodePath + '/cmake_targets/', '\$', 5)
+ self.command('cd cmake_targets', '\$', 5)
+ ping_time = re.findall("-c (\d+)",str(self.ping_args))
+ ping_status = self.command('stdbuf -o0 ping ' + self.ping_args + ' 2>&1 | stdbuf -o0 tee ping_' + self.testCase_id + '.log', '\$', int(ping_time[0])*1.5)
+ # TIMEOUT CASE
+ if ping_status < 0:
+ message = 'Ping with OAI UE crashed due to TIMEOUT!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ return
+ result = re.search(', (?P[0-9\.]+)% packet loss, time [0-9\.]+ms', str(self.ssh.before))
+ if result is None:
+ message = 'Packet Loss Not Found!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ return
+ packetloss = result.group('packetloss')
+ if float(packetloss) == 100:
+ message = 'Packet Loss is 100%'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ return
+ result = re.search('rtt min\/avg\/max\/mdev = (?P[0-9\.]+)\/(?P[0-9\.]+)\/(?P[0-9\.]+)\/[0-9\.]+ ms', str(self.ssh.before))
+ if result is None:
+ message = 'Ping RTT_Min RTT_Avg RTT_Max Not Found!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ return
+ rtt_min = result.group('rtt_min')
+ rtt_avg = result.group('rtt_avg')
+ rtt_max = result.group('rtt_max')
+ pal_msg = 'Packet Loss : ' + packetloss + '%'
+ min_msg = 'RTT(Min) : ' + rtt_min + ' ms'
+ avg_msg = 'RTT(Avg) : ' + rtt_avg + ' ms'
+ max_msg = 'RTT(Max) : ' + rtt_max + ' ms'
+ logging.debug('\u001B[1;37;44m OAI UE ping result \u001B[0m')
+ logging.debug('\u001B[1;34m ' + pal_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + min_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + avg_msg + '\u001B[0m')
+ logging.debug('\u001B[1;34m ' + max_msg + '\u001B[0m')
+ qMsg = pal_msg + '\n' + min_msg + '\n' + avg_msg + '\n' + max_msg
+ packetLossOK = True
+ if packetloss is not None:
+ if float(packetloss) > float(self.ping_packetloss_threshold):
+ qMsg += '\nPacket Loss too high'
+ logging.debug('\u001B[1;37;41m Packet Loss too high \u001B[0m')
+ packetLossOK = False
+ elif float(packetloss) > 0:
+ qMsg += '\nPacket Loss is not 0%'
+ logging.debug('\u001B[1;30;43m Packet Loss is not 0% \u001B[0m')
+ self.close()
+ html_queue = SimpleQueue()
+ ip_addr = 'TBD'
+ html_cell = 'OAI UE ping result\n' + qMsg + ' '
+ html_queue.put(html_cell)
+ if packetLossOK:
+ self.CreateHtmlTestRowQueue(self.ping_args, 'OK', len(self.UEDevices), html_queue)
+ else:
+ self.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue)
+
+ # copying on the EPC server for logCollection
+ if ping_from_eNB is not None:
+ copyin_res = self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/ping_' + self.testCase_id + '.log', '.')
+ else:
+ copyin_res = self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/ping_' + self.testCase_id + '.log', '.')
+ if (copyin_res == 0):
+ self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'ping_' + self.testCase_id + '.log', self.EPCSourceCodePath + '/scripts')
+ except:
+ os.kill(os.getppid(),signal.SIGUSR1)
+
def Ping(self):
+ result = re.search('noS1', str(self.Initialize_eNB_args))
+ if result is not None:
+ self.PingNoS1()
+ return
if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = False
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = True
+ if (len(self.UEDevices) == 1) and (self.UEDevices[0] == 'OAI-UE'):
+ check_OAI_UE = True
+ else:
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
+ self.AutoTerminateUEandeNB()
self.CreateHtmlTabFooter(False)
sys.exit(1)
ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0):
self.CreateHtmlTestRow(self.ping_args, 'KO', UE_IP_ADDRESS_ISSUE)
+ self.AutoTerminateUEandeNB()
self.CreateHtmlTabFooter(False)
sys.exit(1)
multi_jobs = []
@@ -1300,8 +1773,12 @@ class SSHConnection():
self.close()
# Launch iperf client on UE
- self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
- self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
+ if (device_id == 'OAI-UE'):
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('cd ' + self.UESourceCodePath + '/cmake_targets', '\$', 5)
+ else:
+ self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
+ self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
iperf_time = self.Iperf_ComputeTime()
time.sleep(0.5)
@@ -1313,12 +1790,16 @@ class SSHConnection():
time.sleep(0.5)
self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
- iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
+ if (device_id == 'OAI-UE'):
+ iperf_status = self.command('iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + ' -B ' + UE_IPAddress + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
+ else:
+ iperf_status = self.command('stdbuf -o0 adb -s ' + device_id + ' shell "/data/local/tmp/iperf -c ' + EPC_Iperf_UE_IPAddress + ' ' + modified_options + ' -p ' + str(port) + '" 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
# TIMEOUT Case
if iperf_status < 0:
self.close()
message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !'
logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
return
clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options)
@@ -1335,6 +1816,10 @@ class SSHConnection():
os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log')
self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
+ # in case of OAI-UE
+ if (device_id == 'OAI-UE'):
+ self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_' + self.testCase_id + '_' + device_id + '.log', '.')
+ self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts')
def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue):
try:
@@ -1343,43 +1828,60 @@ class SSHConnection():
return
useIperf3 = False
udpIperf = True
- self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
- # if by chance ADB server and EPC are on the same remote host, at least log collection will take care of it
- self.command('if [ ! -d ' + self.EPCSourceCodePath + '/scripts ]; then mkdir -p ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5)
- self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
- # Checking if iperf / iperf3 are installed
- self.command('adb -s ' + device_id + ' shell "ls /data/local/tmp"', '\$', 5)
- result = re.search('iperf3', str(self.ssh.before))
- if result is None:
- result = re.search('iperf', str(self.ssh.before))
+ if (device_id != 'OAI-UE'):
+ self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
+ # if by chance ADB server and EPC are on the same remote host, at least log collection will take care of it
+ self.command('if [ ! -d ' + self.EPCSourceCodePath + '/scripts ]; then mkdir -p ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5)
+ self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
+ # Checking if iperf / iperf3 are installed
+ self.command('adb -s ' + device_id + ' shell "ls /data/local/tmp"', '\$', 5)
+ result = re.search('iperf3', str(self.ssh.before))
if result is None:
- message = 'Neither iperf nor iperf3 installed on UE!'
- logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
- self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
- return
- else:
- useIperf3 = True
+ result = re.search('iperf', str(self.ssh.before))
+ if result is None:
+ message = 'Neither iperf nor iperf3 installed on UE!'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ self.close()
+ self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message)
+ return
+ else:
+ useIperf3 = True
+ self.close()
# in case of iperf, UL has its own function
if (not useIperf3):
result = re.search('-R', str(self.iperf_args))
if result is not None:
- self.close()
self.Iperf_UL_common(lock, UE_IPAddress, device_id, idx, ue_num, statusQueue)
return
- if (useIperf3):
- self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5)
- else:
+ # Launch the IPERF server on the UE side for DL
+ if (device_id == 'OAI-UE'):
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('cd ' + self.UESourceCodePath + '/cmake_targets', '\$', 5)
self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
result = re.search('-u', str(self.iperf_args))
if result is None:
- self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
+ self.command('echo $USER; nohup iperf -B ' + UE_IPAddress + ' -s -i 1 > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.UEUserName, 5)
udpIperf = False
else:
- self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
+ self.command('echo $USER; nohup iperf -B ' + UE_IPAddress + ' -u -s -i 1 > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.UEUserName, 5)
+ else:
+ self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
+ self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
+ if (useIperf3):
+ self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5)
+ else:
+ self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
+ result = re.search('-u', str(self.iperf_args))
+ if result is None:
+ self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
+ udpIperf = False
+ else:
+ self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5)
time.sleep(0.5)
self.close()
+ # Launch the IPERF client on the EPC side for DL
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
iperf_time = self.Iperf_ComputeTime()
@@ -1393,12 +1895,12 @@ class SSHConnection():
self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5)
if (useIperf3):
- self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
+ self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
clientStatus = 0
self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue)
else:
- iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee -a iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
+ iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0)
if iperf_status < 0:
self.close()
message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !'
@@ -1408,28 +1910,154 @@ class SSHConnection():
clientStatus = self.Iperf_analyzeV2Output(lock, UE_IPAddress, device_id, statusQueue, modified_options)
self.close()
- self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
- self.command('stdbuf -o0 adb -s ' + device_id + ' shell ps | grep --color=never iperf | grep -v grep', '\$', 5)
- result = re.search('shell +(?P\d+)', str(self.ssh.before))
- if result is not None:
- pid_iperf = result.group('pid')
- self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5)
+ # Kill the IPERF server that runs in background
+ if (device_id == 'OAI-UE'):
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('killall iperf', '\$', 5)
+ else:
+ self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
+ self.command('stdbuf -o0 adb -s ' + device_id + ' shell ps | grep --color=never iperf | grep -v grep', '\$', 5)
+ result = re.search('shell +(?P\d+)', str(self.ssh.before))
+ if result is not None:
+ pid_iperf = result.group('pid')
+ self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5)
self.close()
+ # if the client report is absent, try to analyze the server log file
if (clientStatus == -1):
time.sleep(1)
if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log')
- self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
+ if (device_id == 'OAI-UE'):
+ self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
+ else:
+ self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options)
+
+ # in case of OAI UE:
+ if (device_id == 'OAI-UE'):
+ if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')):
+ pass
+ else:
+ self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.')
+ self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts')
except:
os.kill(os.getppid(),signal.SIGUSR1)
+ def IperfNoS1(self):
+ check_eNB = True
+ check_OAI_UE = True
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
+ if (pStatus < 0):
+ self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
+ self.AutoTerminateUEandeNB()
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '' or self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ server_on_enb = re.search('-R', str(self.iperf_args))
+ if server_on_enb is not None:
+ iServerIPAddr = self.eNBIPAddress
+ iServerUser = self.eNBUserName
+ iServerPasswd = self.eNBPassword
+ iClientIPAddr = self.UEIPAddress
+ iClientUser = self.UEUserName
+ iClientPasswd = self.UEPassword
+ else:
+ iServerIPAddr = self.UEIPAddress
+ iServerUser = self.UEUserName
+ iServerPasswd = self.UEPassword
+ iClientIPAddr = self.eNBIPAddress
+ iClientUser = self.eNBUserName
+ iClientPasswd = self.eNBPassword
+ # Starting the iperf server
+ self.open(iServerIPAddr, iServerUser, iServerPasswd)
+ # args SHALL be "-c client -u any"
+ # -c 10.0.1.2 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.1
+ # -B 10.0.1.1 -u -s -i 1 -fm
+ server_options = re.sub('-u.*$', '-u -s -i 1 -fm', str(self.iperf_args))
+ server_options = server_options.replace('-c','-B')
+ self.command('rm -f /tmp/tmp_iperf_server_' + self.testCase_id + '.log', '\$', 5)
+ self.command('echo $USER; nohup iperf ' + server_options + ' > /tmp/tmp_iperf_server_' + self.testCase_id + '.log 2>&1 &', iServerUser, 5)
+ time.sleep(0.5)
+ self.close()
+
+ # Starting the iperf client
+ modified_options = self.Iperf_ComputeModifiedBW(0, 1)
+ modified_options = modified_options.replace('-R','')
+ iperf_time = self.Iperf_ComputeTime()
+ self.open(iClientIPAddr, iClientUser, iClientPasswd)
+ self.command('rm -f /tmp/tmp_iperf_' + self.testCase_id + '.log', '\$', 5)
+ iperf_status = self.command('stdbuf -o0 iperf ' + modified_options + ' 2>&1 | stdbuf -o0 tee /tmp/tmp_iperf_' + self.testCase_id + '.log', '\$', int(iperf_time)*5.0)
+ status_queue = SimpleQueue()
+ lock = Lock()
+ if iperf_status < 0:
+ message = 'iperf on OAI UE crashed due to TIMEOUT !'
+ logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m')
+ clientStatus = -2
+ else:
+ clientStatus = self.Iperf_analyzeV2Output(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options)
+ self.close()
+
+ # Stopping the iperf server
+ self.open(iServerIPAddr, iServerUser, iServerPasswd)
+ self.command('killall --signal SIGKILL iperf', '\$', 5)
+ time.sleep(0.5)
+ self.close()
+ if (clientStatus == -1):
+ if (os.path.isfile('iperf_server_' + self.testCase_id + '.log')):
+ os.remove('iperf_server_' + self.testCase_id + '.log')
+ self.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log')
+ self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options)
+
+ # copying on the EPC server for logCollection
+ copyin_res = self.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log')
+ if (copyin_res == 0):
+ self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_server_' + self.testCase_id + '_OAI-UE.log', self.EPCSourceCodePath + '/scripts')
+ copyin_res = self.copyin(iClientIPAddr, iClientUser, iClientPasswd, '/tmp/tmp_iperf_' + self.testCase_id + '.log', 'iperf_' + self.testCase_id + '_OAI-UE.log')
+ if (copyin_res == 0):
+ self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_' + self.testCase_id + '_OAI-UE.log', self.EPCSourceCodePath + '/scripts')
+ iperf_noperf = False
+ if status_queue.empty():
+ iperf_status = False
+ else:
+ iperf_status = True
+ html_queue = SimpleQueue()
+ while (not status_queue.empty()):
+ count = status_queue.get()
+ if (count < 0):
+ iperf_status = False
+ if (count > 0):
+ iperf_noperf = True
+ device_id = status_queue.get()
+ ip_addr = status_queue.get()
+ message = status_queue.get()
+ html_cell = 'UE (' + device_id + ')\nIP Address : ' + ip_addr + '\n' + message + ' '
+ html_queue.put(html_cell)
+ if (iperf_noperf and iperf_status):
+ self.CreateHtmlTestRowQueue(self.iperf_args, 'PERF NOT MET', len(self.UEDevices), html_queue)
+ elif (iperf_status):
+ self.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue)
+ else:
+ self.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
+ self.AutoTerminateUEandeNB()
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+
def Iperf(self):
+ result = re.search('noS1', str(self.Initialize_eNB_args))
+ if result is not None:
+ self.IperfNoS1()
+ return
if self.EPCIPAddress == '' or self.EPCUserName == '' or self.EPCPassword == '' or self.EPCSourceCodePath == '' or self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
Usage()
sys.exit('Insufficient Parameter')
- initialize_eNB_flag = False
- pStatus = self.CheckProcessExist(initialize_eNB_flag)
+ check_eNB = True
+ if (len(self.UEDevices) == 1) and (self.UEDevices[0] == 'OAI-UE'):
+ check_OAI_UE = True
+ else:
+ check_OAI_UE = False
+ pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE)
if (pStatus < 0):
self.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
self.AutoTerminateUEandeNB()
@@ -1486,26 +2114,37 @@ class SSHConnection():
self.CreateHtmlTabFooter(False)
sys.exit(1)
- def CheckProcessExist(self, initialize_eNB_flag):
+ def CheckProcessExist(self, check_eNB, check_OAI_UE):
multi_jobs = []
status_queue = SimpleQueue()
- p = Process(target = SSH.CheckHSSProcess, args = (status_queue,))
- p.daemon = True
- p.start()
- multi_jobs.append(p)
- p = Process(target = SSH.CheckMMEProcess, args = (status_queue,))
- p.daemon = True
- p.start()
- multi_jobs.append(p)
- p = Process(target = SSH.CheckSPGWProcess, args = (status_queue,))
- p.daemon = True
- p.start()
- multi_jobs.append(p)
- if initialize_eNB_flag == False:
+ # in noS1 config, no need to check status from EPC
+ result = re.search('noS1', str(self.Initialize_eNB_args))
+ if result is None:
+ p = Process(target = SSH.CheckHSSProcess, args = (status_queue,))
+ p.daemon = True
+ p.start()
+ multi_jobs.append(p)
+ p = Process(target = SSH.CheckMMEProcess, args = (status_queue,))
+ p.daemon = True
+ p.start()
+ multi_jobs.append(p)
+ p = Process(target = SSH.CheckSPGWProcess, args = (status_queue,))
+ p.daemon = True
+ p.start()
+ multi_jobs.append(p)
+ else:
+ if (check_eNB == False) and (check_OAI_UE == False):
+ return 0
+ if check_eNB:
p = Process(target = SSH.CheckeNBProcess, args = (status_queue,))
p.daemon = True
p.start()
multi_jobs.append(p)
+ if check_OAI_UE:
+ p = Process(target = SSH.CheckOAIUEProcess, args = (status_queue,))
+ p.daemon = True
+ p.start()
+ multi_jobs.append(p)
for job in multi_jobs:
job.join()
@@ -1524,12 +2163,55 @@ class SSHConnection():
logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
if logStatus < 0:
result = logStatus
+ self.eNBLogFile = ''
return result
+ def CheckOAIUEProcessExist(self, initialize_OAI_UE_flag):
+ multi_jobs = []
+ status_queue = SimpleQueue()
+ if initialize_OAI_UE_flag == False:
+ p = Process(target = SSH.CheckOAIUEProcess, args = (status_queue,))
+ p.daemon = True
+ p.start()
+ multi_jobs.append(p)
+ for job in multi_jobs:
+ job.join()
+
+ if (status_queue.empty()):
+ return -15
+ else:
+ result = 0
+ while (not status_queue.empty()):
+ status = status_queue.get()
+ if (status < 0):
+ result = status
+ if result == OAI_UE_PROCESS_FAILED:
+ fileCheck = re.search('ue_', str(self.UELogFile))
+ if fileCheck is not None:
+ self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.')
+ logStatus = self.AnalyzeLogFile_UE(self.UELogFile)
+ if logStatus < 0:
+ result = logStatus
+ return result
+
+ def CheckOAIUEProcess(self, status_queue):
+ try:
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('stdbuf -o0 ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is None:
+ logging.debug('\u001B[1;37;41m OAI UE Process Not Found! \u001B[0m')
+ status_queue.put(OAI_UE_PROCESS_FAILED)
+ else:
+ status_queue.put(OAI_UE_PROCESS_OK)
+ self.close()
+ except:
+ os.kill(os.getppid(),signal.SIGUSR1)
+
def CheckeNBProcess(self, status_queue):
try:
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never lte-softmodem', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
result = re.search('lte-softmodem', str(self.ssh.before))
if result is None:
logging.debug('\u001B[1;37;41m eNB Process Not Found! \u001B[0m')
@@ -1543,7 +2225,7 @@ class SSHConnection():
def CheckHSSProcess(self, status_queue):
try:
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never hss', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never hss | grep -v grep', '\$', 5)
if re.match('OAI', self.EPCType, re.IGNORECASE):
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
else:
@@ -1560,7 +2242,7 @@ class SSHConnection():
def CheckMMEProcess(self, status_queue):
try:
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never mme', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never mme | grep -v grep', '\$', 5)
if re.match('OAI', self.EPCType, re.IGNORECASE):
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
else:
@@ -1578,10 +2260,10 @@ class SSHConnection():
try:
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
if re.match('OAI', self.EPCType, re.IGNORECASE):
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never spgw', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never spgw | grep -v grep', '\$', 5)
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
else:
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep --color=never xGw', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never xGw | grep -v grep', '\$', 5)
result = re.search('xGw', str(self.ssh.before))
if result is None:
logging.debug('\u001B[1;37;41m SPGW Process Not Found! \u001B[0m')
@@ -1596,12 +2278,12 @@ class SSHConnection():
if (not os.path.isfile('./' + eNBlogFile)):
return -1
enb_log_file = open('./' + eNBlogFile, 'r')
+ exitSignalReceived = False
foundAssertion = False
msgAssertion = ''
msgLine = 0
foundSegFault = False
foundRealTimeIssue = False
- rrcSetupRequest = 0
rrcSetupComplete = 0
rrcReleaseRequest = 0
rrcReconfigRequest = 0
@@ -1614,25 +2296,37 @@ class SSHConnection():
uciStatMsgCount = 0
pdcpFailure = 0
ulschFailure = 0
+ cdrxActivationMessageCount = 0
+ self.htmleNBFailureMsg = ''
for line in enb_log_file.readlines():
- result = re.search('[Ss]egmentation [Ff]ault', str(line))
+ if self.rruOptions != '':
+ res1 = re.search('max_rxgain (?P[0-9]+)', self.rruOptions)
+ res2 = re.search('max_rxgain (?P[0-9]+)', str(line))
+ if res1 is not None and res2 is not None:
+ requested_option = int(res1.group('requested_option'))
+ applied_option = int(res2.group('applied_option'))
+ if requested_option == applied_option:
+ self.htmleNBFailureMsg += ' Command line option(s) correctly applied ' + self.rruOptions + '\n\n'
+ else:
+ self.htmleNBFailureMsg += ' Command line option(s) NOT applied ' + self.rruOptions + '\n\n'
+ result = re.search('Exiting OAI softmodem', str(line))
if result is not None:
+ exitSignalReceived = True
+ result = re.search('[Ss]egmentation [Ff]ault', str(line))
+ if result is not None and not exitSignalReceived:
foundSegFault = True
result = re.search('[Cc]ore [dD]ump', str(line))
- if result is not None:
+ if result is not None and not exitSignalReceived:
foundSegFault = True
result = re.search('[Aa]ssertion', str(line))
- if result is not None:
+ if result is not None and not exitSignalReceived:
foundAssertion = True
result = re.search('LLL', str(line))
- if result is not None:
+ if result is not None and not exitSignalReceived:
foundRealTimeIssue = True
if foundAssertion and (msgLine < 3):
msgLine += 1
msgAssertion += str(line)
- result = re.search('Generating LTE_RRCConnectionSetup', str(line))
- if result is not None:
- rrcSetupRequest += 1
result = re.search('LTE_RRCConnectionSetupComplete from UE', str(line))
if result is not None:
rrcSetupComplete += 1
@@ -1654,6 +2348,9 @@ class SSHConnection():
result = re.search('LTE_RRCConnectionReestablishmentReject', str(line))
if result is not None:
rrcReestablishReject += 1
+ result = re.search('CDRX configuration activated after RRC Connection', str(line))
+ if result is not None:
+ cdrxActivationMessageCount += 1
result = re.search('uci->stat', str(line))
if result is not None:
uciStatMsgCount += 1
@@ -1670,7 +2367,7 @@ class SSHConnection():
if result is not None:
rachCanceledProcedure += 1
enb_log_file.close()
- self.htmleNBFailureMsg = ''
+ logging.debug(' File analysis completed')
if uciStatMsgCount > 0:
statMsg = 'eNB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
@@ -1683,11 +2380,8 @@ class SSHConnection():
statMsg = 'eNB showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
self.htmleNBFailureMsg += statMsg + '\n'
- if rrcSetupRequest > 0 or rrcSetupComplete > 0:
- rrcMsg = 'eNB requested ' + str(rrcSetupRequest) + ' RRC Connection Setup(s)'
- logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m')
- self.htmleNBFailureMsg += rrcMsg + '\n'
- rrcMsg = ' -- ' + str(rrcSetupComplete) + ' were completed'
+ if rrcSetupComplete > 0:
+ rrcMsg = 'eNB completed ' + str(rrcSetupComplete) + ' RRC Connection Setup(s)'
logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m')
self.htmleNBFailureMsg += rrcMsg + '\n'
if rrcReleaseRequest > 0:
@@ -1711,6 +2405,10 @@ class SSHConnection():
rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected'
logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m')
self.htmleNBFailureMsg += rrcMsg + '\n'
+ if cdrxActivationMessageCount > 0:
+ rrcMsg = 'eNB activated the CDRX Configuration for ' + str(cdrxActivationMessageCount) + ' time(s)'
+ logging.debug('\u001B[1;30;43m ' + rrcMsg + ' \u001B[0m')
+ self.htmleNBFailureMsg += rrcMsg + '\n'
if rachCanceledProcedure > 0:
rachMsg = 'eNB cancelled ' + str(rachCanceledProcedure) + ' RA procedure(s)'
logging.debug('\u001B[1;30;43m ' + rachMsg + ' \u001B[0m')
@@ -1733,18 +2431,186 @@ class SSHConnection():
return ENB_PROCESS_REALTIME_ISSUE
return 0
+ def AnalyzeLogFile_UE(self, UElogFile):
+ if (not os.path.isfile('./' + UElogFile)):
+ return -1
+ ue_log_file = open('./' + UElogFile, 'r')
+ exitSignalReceived = False
+ foundAssertion = False
+ msgAssertion = ''
+ msgLine = 0
+ foundSegFault = False
+ foundRealTimeIssue = False
+ uciStatMsgCount = 0
+ pdcpDataReqFailedCount = 0
+ badDciCount = 0
+ rrcConnectionRecfgComplete = 0
+ no_cell_sync_found = False
+ mib_found = False
+ frequency_found = False
+ plmn_found = False
+ self.htmlUEFailureMsg = ''
+ for line in ue_log_file.readlines():
+ result = re.search('Exiting OAI softmodem', str(line))
+ if result is not None:
+ exitSignalReceived = True
+ result = re.search('System error|[Ss]egmentation [Ff]ault|======= Backtrace: =========|======= Memory map: ========', str(line))
+ if result is not None and not exitSignalReceived:
+ foundSegFault = True
+ result = re.search('[Cc]ore [dD]ump', str(line))
+ if result is not None and not exitSignalReceived:
+ foundSegFault = True
+ result = re.search('[Aa]ssertion', str(line))
+ if result is not None and not exitSignalReceived:
+ foundAssertion = True
+ result = re.search('LLL', str(line))
+ if result is not None and not exitSignalReceived:
+ foundRealTimeIssue = True
+ if foundAssertion and (msgLine < 3):
+ msgLine += 1
+ msgAssertion += str(line)
+ result = re.search('uci->stat', str(line))
+ if result is not None and not exitSignalReceived:
+ uciStatMsgCount += 1
+ result = re.search('PDCP data request failed', str(line))
+ if result is not None and not exitSignalReceived:
+ pdcpDataReqFailedCount += 1
+ result = re.search('bad DCI 1A', str(line))
+ if result is not None and not exitSignalReceived:
+ badDciCount += 1
+ result = re.search('Generating RRCConnectionReconfigurationComplete', str(line))
+ if result is not None:
+ rrcConnectionRecfgComplete += 1
+ # No cell synchronization found, abandoning
+ result = re.search('No cell synchronization found, abandoning', str(line))
+ if result is not None:
+ no_cell_sync_found = True
+ result = re.search("MIB Information => ([a-zA-Z]{1,10}), ([a-zA-Z]{1,10}), NidCell (?P\d{1,3}), N_RB_DL (?P\d{1,3}), PHICH DURATION (?P\d), PHICH RESOURCE (?P.{1,4}), TX_ANT (?P\d)", str(line))
+ if result is not None and (not mib_found):
+ try:
+ mibMsg = "MIB Information: " + result.group(1) + ', ' + result.group(2)
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mibMsg = " nidcell = " + result.group('nidcell')
+ self.htmlUEFailureMsg += mibMsg
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mibMsg = " n_rb_dl = " + result.group('n_rb_dl')
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mibMsg = " phich_duration = " + result.group('phich_duration')
+ self.htmlUEFailureMsg += mibMsg
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mibMsg = " phich_resource = " + result.group('phich_resource')
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mibMsg = " tx_ant = " + result.group('tx_ant')
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ mib_found = True
+ except Exception as e:
+ logging.error('\033[91m' + "MIB marker was not found" + '\033[0m')
+ result = re.search("Measured Carrier Frequency (?P\d{1,15}) Hz", str(line))
+ if result is not None and (not frequency_found):
+ try:
+ mibMsg = "Measured Carrier Frequency = " + result.group('measured_carrier_frequency') + ' Hz'
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ frequency_found = True
+ except Exception as e:
+ logging.error('\033[91m' + "Measured Carrier Frequency not found" + '\033[0m')
+ result = re.search("PLMN MCC (?P\d{1,3}), MNC (?P\d{1,3}), TAC", str(line))
+ if result is not None and (not plmn_found):
+ try:
+ mibMsg = 'PLMN MCC = ' + result.group('mcc') + ' MNC = ' + result.group('mnc')
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ plmn_found = True
+ except Exception as e:
+ logging.error('\033[91m' + "PLMN not found" + '\033[0m')
+ result = re.search("Found (?P[\w,\s]{1,15}) \(name from internal table\)", str(line))
+ if result is not None:
+ try:
+ mibMsg = "The operator is: " + result.group('operator')
+ self.htmlUEFailureMsg += mibMsg + '\n'
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ except Exception as e:
+ logging.error('\033[91m' + "Operator name not found" + '\033[0m')
+ result = re.search("SIB5 InterFreqCarrierFreq element (.{1,4})/(.{1,4})", str(line))
+ if result is not None:
+ try:
+ mibMsg = "SIB5 InterFreqCarrierFreq element " + result.group(1) + '/' + result.group(2)
+ self.htmlUEFailureMsg += mibMsg + ' -> '
+ logging.debug('\033[94m' + mibMsg + '\033[0m')
+ except Exception as e:
+ logging.error('\033[91m' + "SIB5 InterFreqCarrierFreq element not found" + '\033[0m')
+ result = re.search("DL Carrier Frequency/ARFCN : (?P\d{1,15}/\d{1,4})", str(line))
+ if result is not None:
+ try:
+ freq = result.group('carrier_frequency')
+ new_freq = re.sub('/[0-9]+','',freq)
+ float_freq = float(new_freq) / 1000000
+ self.htmlUEFailureMsg += 'DL Freq: ' + ('%.1f' % float_freq) + ' MHz'
+ logging.debug('\033[94m' + " DL Carrier Frequency is: " + freq + '\033[0m')
+ except Exception as e:
+ logging.error('\033[91m' + " DL Carrier Frequency not found" + '\033[0m')
+ result = re.search("AllowedMeasBandwidth : (?P\d{1,7})", str(line))
+ if result is not None:
+ try:
+ prb = result.group('allowed_bandwidth')
+ self.htmlUEFailureMsg += ' -- PRB: ' + prb + '\n'
+ logging.debug('\033[94m' + " AllowedMeasBandwidth: " + prb + '\033[0m')
+ except Exception as e:
+ logging.error('\033[91m' + " AllowedMeasBandwidth not found" + '\033[0m')
+ ue_log_file.close()
+ if rrcConnectionRecfgComplete > 0:
+ statMsg = 'UE connected to eNB (' + str(rrcConnectionRecfgComplete) + ' RRCConnectionReconfigurationComplete message(s) generated)'
+ logging.debug('\033[94m' + statMsg + '\033[0m')
+ self.htmlUEFailureMsg += statMsg + '\n'
+ if uciStatMsgCount > 0:
+ statMsg = 'UE showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
+ logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
+ self.htmlUEFailureMsg += statMsg + '\n'
+ if pdcpDataReqFailedCount > 0:
+ statMsg = 'UE showed ' + str(pdcpDataReqFailedCount) + ' "PDCP data request failed" message(s)'
+ logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
+ self.htmlUEFailureMsg += statMsg + '\n'
+ if badDciCount > 0:
+ statMsg = 'UE showed ' + str(badDciCount) + ' "bad DCI 1A" message(s)'
+ logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
+ self.htmlUEFailureMsg += statMsg + '\n'
+ if foundSegFault:
+ logging.debug('\u001B[1;37;41m UE ended with a Segmentation Fault! \u001B[0m')
+ return ENB_PROCESS_SEG_FAULT
+ if foundAssertion:
+ logging.debug('\u001B[1;30;43m UE showed an assertion! \u001B[0m')
+ self.htmlUEFailureMsg += 'UE showed an assertion!\n'
+ if not mib_found or not frequency_found:
+ return OAI_UE_PROCESS_ASSERTION
+ if foundRealTimeIssue:
+ logging.debug('\u001B[1;37;41m UE faced real time issues! \u001B[0m')
+ self.htmlUEFailureMsg += 'UE faced real time issues!\n'
+ #return ENB_PROCESS_REALTIME_ISSUE
+ if no_cell_sync_found and not mib_found:
+ logging.debug('\u001B[1;37;41m UE could not synchronize ! \u001B[0m')
+ self.htmlUEFailureMsg += 'UE could not synchronize!\n'
+ return OAI_UE_PROCESS_COULD_NOT_SYNC
+ return 0
+
def TerminateeNB(self):
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
self.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5)
- self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5)
- self.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
- self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGINT lte-softmodem || true', '\$', 5)
- time.sleep(5)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep lte-softmodem', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
result = re.search('lte-softmodem', str(self.ssh.before))
if result is not None:
- self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGKILL lte-softmodem || true', '\$', 5)
+ self.command('echo ' + self.eNBPassword + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5)
+ self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGINT lte-softmodem || true', '\$', 5)
time.sleep(5)
+ self.command('stdbuf -o0 ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
+ result = re.search('lte-softmodem', str(self.ssh.before))
+ if result is not None:
+ self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGKILL lte-softmodem || true', '\$', 5)
+ time.sleep(2)
+ self.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
self.close()
# If tracer options is on, stopping tshark on EPC side
result = re.search('T_stdout', str(self.Initialize_eNB_args))
@@ -1753,10 +2619,10 @@ class SSHConnection():
logging.debug('\u001B[1m Stopping tshark \u001B[0m')
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
time.sleep(1)
- pcap_log_file = self.eNBLogFile.replace('.log', '_s1log.pcap')
- self.command('echo ' + self.EPCPassword + ' | sudo -S chmod 666 /tmp/' + pcap_log_file, '\$', 5)
- self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + pcap_log_file, '.')
- self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, pcap_log_file, self.eNBSourceCodePath + '/cmake_targets/.')
+ if self.EPC_PcapFileName != '':
+ self.command('echo ' + self.EPCPassword + ' | sudo -S chmod 666 /tmp/' + self.EPC_PcapFileName, '\$', 5)
+ self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, '/tmp/' + self.EPC_PcapFileName, '.')
+ self.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.EPC_PcapFileName, self.eNBSourceCodePath + '/cmake_targets/.')
self.close()
logging.debug('\u001B[1m Replaying RAW record file\u001B[0m')
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
@@ -1776,23 +2642,32 @@ class SSHConnection():
self.eNBLogFile = ''
else:
result = re.search('enb_', str(self.eNBLogFile))
+ analyzeFile = False
if result is not None:
- copyin_res = self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
+ analyzeFile = True
+ fileToAnalyze = str(self.eNBLogFile)
+ self.eNBLogFile = ''
+ else:
+ result = re.search('enb_', str(self.rruLogFile))
+ if result is not None:
+ analyzeFile = True
+ fileToAnalyze = str(self.rruLogFile)
+ self.rruLogFile = ''
+ if analyzeFile:
+ copyin_res = self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + fileToAnalyze, '.')
if (copyin_res == -1):
logging.debug('\u001B[1;37;41m Could not copy eNB logfile to analyze it! \u001B[0m')
self.htmleNBFailureMsg = 'Could not copy eNB logfile to analyze it!'
self.CreateHtmlTestRow('N/A', 'KO', ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
- self.eNBLogFile = ''
return
logging.debug('\u001B[1m Analyzing eNB logfile \u001B[0m')
- logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
+ logStatus = self.AnalyzeLogFile_eNB(fileToAnalyze)
if (logStatus < 0):
self.CreateHtmlTestRow('N/A', 'KO', logStatus)
self.CreateHtmlTabFooter(False)
sys.exit(1)
else:
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
- self.eNBLogFile = ''
else:
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
@@ -1801,14 +2676,13 @@ class SSHConnection():
if re.match('OAI', self.EPCType, re.IGNORECASE):
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_hss oai_hss || true', '\$', 5)
time.sleep(2)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep hss', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5)
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
if result is not None:
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_hss oai_hss || true', '\$', 5)
else:
self.command('cd ' + self.EPCSourceCodePath, '\$', 5)
self.command('cd scripts', '\$', 5)
- self.command('rm -f ./kill_hss.sh', '\$', 5)
self.command('echo ' + self.EPCPassword + ' | sudo -S daemon --name=simulated_hss --stop', '\$', 5)
time.sleep(1)
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5)
@@ -1820,7 +2694,7 @@ class SSHConnection():
if re.match('OAI', self.EPCType, re.IGNORECASE):
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_mme mme || true', '\$', 5)
time.sleep(2)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep mme', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep mme | grep -v grep', '\$', 5)
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
if result is not None:
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_mme mme || true', '\$', 5)
@@ -1835,7 +2709,7 @@ class SSHConnection():
if re.match('OAI', self.EPCType, re.IGNORECASE):
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_spgw spgw || true', '\$', 5)
time.sleep(2)
- self.command('stdbuf -o0 ps -aux | grep -v grep | grep spgw', '\$', 5)
+ self.command('stdbuf -o0 ps -aux | grep spgw | grep -v grep', '\$', 5)
result = re.search('\/bin\/bash .\/run_', str(self.ssh.before))
if result is not None:
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_spgw spgw || true', '\$', 5)
@@ -1873,28 +2747,99 @@ class SSHConnection():
job.join()
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
+ def TerminateOAIUE(self):
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('cd ' + self.UESourceCodePath + '/cmake_targets', '\$', 5)
+ self.command('ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is not None:
+ self.command('echo ' + self.UEPassword + ' | sudo -S daemon --name=ue' + str(self.UE_instance) + '_daemon --stop', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGINT lte-uesoftmodem || true', '\$', 5)
+ time.sleep(5)
+ self.command('ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5)
+ result = re.search('lte-uesoftmodem', str(self.ssh.before))
+ if result is not None:
+ self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGKILL lte-uesoftmodem || true', '\$', 5)
+ time.sleep(2)
+ self.command('rm -f my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5)
+ self.close()
+ result = re.search('ue_', str(self.UELogFile))
+ if result is not None:
+ copyin_res = self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/' + self.UELogFile, '.')
+ if (copyin_res == -1):
+ logging.debug('\u001B[1;37;41m Could not copy UE logfile to analyze it! \u001B[0m')
+ self.htmlUEFailureMsg = 'Could not copy UE logfile to analyze it!'
+ self.CreateHtmlTestRow('N/A', 'KO', OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE, 'UE')
+ self.UELogFile = ''
+ return
+ logging.debug('\u001B[1m Analyzing UE logfile \u001B[0m')
+ logStatus = self.AnalyzeLogFile_UE(self.UELogFile)
+ result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args))
+ if result is not None:
+ ueAction = 'Sniffing'
+ else:
+ ueAction = 'Connection'
+ if (logStatus < 0):
+ logging.debug('\u001B[1m' + ueAction + ' Failed \u001B[0m')
+ self.htmlUEFailureMsg = '' + ueAction + ' Failed \n' + self.htmlUEFailureMsg
+ self.CreateHtmlTestRow('N/A', 'KO', logStatus, 'UE')
+ # In case of sniffing on commercial eNBs we have random results
+ # Not an error then
+ if (logStatus != OAI_UE_PROCESS_COULD_NOT_SYNC) or (ueAction != 'Sniffing'):
+ self.Initialize_OAI_UE_args = ''
+ self.AutoTerminateUEandeNB()
+ self.CreateHtmlTabFooter(False)
+ sys.exit(1)
+ else:
+ logging.debug('\u001B[1m' + ueAction + ' Completed \u001B[0m')
+ self.htmlUEFailureMsg = '' + ueAction + ' Completed \n' + self.htmlUEFailureMsg
+ self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
+ self.UELogFile = ''
+ else:
+ self.htmlUEFailureMsg = 'No Log File to analyze!'
+ self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
+
def AutoTerminateUEandeNB(self):
- self.testCase_id = 'AUTO-KILL-UE'
- self.desc = 'Automatic Termination of UE'
- self.ShowTestID()
- self.TerminateUE()
- self.testCase_id = 'AUTO-KILL-eNB'
- self.desc = 'Automatic Termination of eNB'
- self.ShowTestID()
- self.eNB_instance = '0'
- self.TerminateeNB()
+ if (self.ADBIPAddress != 'none'):
+ self.testCase_id = 'AUTO-KILL-UE'
+ self.desc = 'Automatic Termination of UE'
+ self.ShowTestID()
+ self.TerminateUE()
+ if (self.Initialize_OAI_UE_args != ''):
+ self.testCase_id = 'AUTO-KILL-UE'
+ self.desc = 'Automatic Termination of UE'
+ self.ShowTestID()
+ self.TerminateOAIUE()
+ if (self.Initialize_eNB_args != ''):
+ self.testCase_id = 'AUTO-KILL-eNB'
+ self.desc = 'Automatic Termination of eNB'
+ self.ShowTestID()
+ self.eNB_instance = '0'
+ self.TerminateeNB()
def IdleSleep(self):
time.sleep(self.idle_sleep_time)
self.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', ALL_PROCESSES_OK)
def LogCollectBuild(self):
- self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
- self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
+ if (self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != ''):
+ IPAddress = self.eNBIPAddress
+ UserName = self.eNBUserName
+ Password = self.eNBPassword
+ SourceCodePath = self.eNBSourceCodePath
+ elif (self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != ''):
+ IPAddress = self.UEIPAddress
+ UserName = self.UEUserName
+ Password = self.UEPassword
+ SourceCodePath = self.UESourceCodePath
+ else:
+ sys.exit('Insufficient Parameter')
+ self.open(IPAddress, UserName, Password)
+ self.command('cd ' + SourceCodePath, '\$', 5)
self.command('cd cmake_targets', '\$', 5)
self.command('rm -f build.log.zip', '\$', 5)
self.command('zip build.log.zip build_log_*/*', '\$', 60)
- self.command('echo ' + self.eNBPassword + ' | sudo -S rm -rf build_log_*', '\$', 5)
+ self.command('echo ' + Password + ' | sudo -S rm -rf build_log_*', '\$', 5)
self.close()
def LogCollecteNB(self):
@@ -1962,35 +2907,71 @@ class SSHConnection():
self.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5)
self.command('zip spgw.log.zip xGwLog.0', '\$', 60)
self.close()
- def RetrieveSystemVersion(self):
- if self.eNBIPAddress == '' or self.eNBUserName == '' or self.eNBPassword == '':
- Usage()
- sys.exit('Insufficient Parameter')
- self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
+
+ def LogCollectOAIUE(self):
+ self.open(self.UEIPAddress, self.UEUserName, self.UEPassword)
+ self.command('cd ' + self.UESourceCodePath, '\$', 5)
+ self.command('cd cmake_targets', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S rm -f ue.log.zip', '\$', 5)
+ self.command('echo ' + self.UEPassword + ' | sudo -S zip ue.log.zip ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 60)
+ self.command('echo ' + self.UEPassword + ' | sudo -S rm ue*.log core* ue_*record.raw ue_*.pcap ue_*txt', '\$', 5)
+ self.close()
+
+ def RetrieveSystemVersion(self, machine):
+ if self.eNBIPAddress == 'none' or self.UEIPAddress == 'none':
+ self.OsVersion = 'Ubuntu 16.04.5 LTS'
+ self.KernelVersion = '4.15.0-45-generic'
+ self.UhdVersion = '3.13.0.1-0'
+ self.UsrpBoard = 'B210'
+ self.CpuNb = '4'
+ self.CpuModel = 'Intel(R) Core(TM) i5-6200U'
+ self.CpuMHz = '2399.996 MHz'
+ return 0
+ if machine == 'eNB':
+ if self.eNBIPAddress != '' and self.eNBUserName != '' and self.eNBPassword != '':
+ IPAddress = self.eNBIPAddress
+ UserName = self.eNBUserName
+ Password = self.eNBPassword
+ else:
+ return -1
+ if machine == 'UE':
+ if self.UEIPAddress != '' and self.UEUserName != '' and self.UEPassword != '':
+ IPAddress = self.UEIPAddress
+ UserName = self.UEUserName
+ Password = self.UEPassword
+ else:
+ return -1
+
+ self.open(IPAddress, UserName, Password)
self.command('lsb_release -a', '\$', 5)
result = re.search('Description:\\\\t(?P[a-zA-Z0-9\-\_\.\ ]+)', str(self.ssh.before))
if result is not None:
- self.eNBOsVersion = result.group('os_type')
- logging.debug('OS is: ' + self.eNBOsVersion)
+ self.OsVersion = result.group('os_type')
+ logging.debug('OS is: ' + self.OsVersion)
self.command('uname -r', '\$', 5)
result = re.search('uname -r\\\\r\\\\n(?P[a-zA-Z0-9\-\_\.]+)', str(self.ssh.before))
if result is not None:
- self.eNBKernelVersion = result.group('kernel_version')
- logging.debug('Kernel Version is: ' + self.eNBKernelVersion)
+ self.KernelVersion = result.group('kernel_version')
+ logging.debug('Kernel Version is: ' + self.KernelVersion)
self.command('dpkg --list | egrep --color=never libuhd003', '\$', 5)
result = re.search('libuhd003:amd64 *(?P[0-9\.]+)', str(self.ssh.before))
if result is not None:
- self.eNBUhdVersion = result.group('uhd_version')
- logging.debug('UHD Version is: ' + self.eNBUhdVersion)
+ self.UhdVersion = result.group('uhd_version')
+ logging.debug('UHD Version is: ' + self.UhdVersion)
+ self.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 15)
+ result = re.search('product: (?P[0-9A-Za-z]+)\\\\r\\\\n', str(self.ssh.before))
+ if result is not None:
+ self.UsrpBoard = result.group('usrp_board')
+ logging.debug('USRP Board is: ' + self.UsrpBoard)
self.command('lscpu', '\$', 5)
result = re.search('CPU\(s\): *(?P[0-9]+).*Model name: *(?P[a-zA-Z0-9\-\_\.\ \(\)]+).*CPU MHz: *(?P[0-9\.]+)', str(self.ssh.before))
if result is not None:
- self.eNBCpuNb = result.group('nb_cpus')
- logging.debug('nb_cpus: ' + self.eNBCpuNb)
- self.eNBCpuModel = result.group('model')
- logging.debug('model: ' + self.eNBCpuModel)
- self.eNBCpuMHz = result.group('cpu_mhz') + ' MHz'
- logging.debug('cpu_mhz: ' + self.eNBCpuMHz)
+ self.CpuNb = result.group('nb_cpus')
+ logging.debug('nb_cpus: ' + self.CpuNb)
+ self.CpuModel = result.group('model')
+ logging.debug('model: ' + self.CpuModel)
+ self.CpuMHz = result.group('cpu_mhz') + ' MHz'
+ logging.debug('cpu_mhz: ' + self.CpuMHz)
self.close()
#-----------------------------------------------------------
@@ -1998,6 +2979,9 @@ class SSHConnection():
#-----------------------------------------------------------
def CreateHtmlHeader(self):
if (not self.htmlHeaderCreated):
+ logging.debug('\u001B[1m----------------------------------------\u001B[0m')
+ logging.debug('\u001B[1m Creating HTML header \u001B[0m')
+ logging.debug('\u001B[1m----------------------------------------\u001B[0m')
self.htmlFile = open('test_results.html', 'w')
self.htmlFile.write('\n')
self.htmlFile.write('\n')
@@ -2055,6 +3039,16 @@ class SSHConnection():
self.htmlFile.write(' Commit ID \n')
self.htmlFile.write(' ' + self.eNBCommitID + ' \n')
self.htmlFile.write(' \n')
+ if self.eNB_AllowMerge != '':
+ commit_message = subprocess.check_output("git log -n1 --pretty=format:\"%s\" " + self.eNBCommitID, shell=True, universal_newlines=True)
+ commit_message = commit_message.strip()
+ self.htmlFile.write(' \n')
+ if (self.eNB_AllowMerge):
+ self.htmlFile.write(' Source Commit Message \n')
+ else:
+ self.htmlFile.write(' Commit Message \n')
+ self.htmlFile.write(' ' + commit_message + ' \n')
+ self.htmlFile.write(' \n')
if (self.eNB_AllowMerge):
self.htmlFile.write(' \n')
self.htmlFile.write(' Target Branch \n')
@@ -2065,18 +3059,17 @@ class SSHConnection():
self.htmlFile.write(' \n')
self.htmlFile.write(' \n')
- terminate_ue_flag = True
if (self.ADBIPAddress != 'none'):
+ terminate_ue_flag = True
self.GetAllUEDevices(terminate_ue_flag)
self.GetAllCatMDevices(terminate_ue_flag)
+ self.htmlUEConnected = len(self.UEDevices)
+ self.htmlFile.write(' ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server \n')
+ self.htmlFile.write(' ' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server \n')
else:
- self.UEDevices.append('doughq9rehg')
- self.UEDevices.append('dnsgiuahgia')
- self.UEDevices.append('uehgieng9')
- self.htmlUEConnected = len(self.UEDevices)
-
- self.htmlFile.write(' ' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server \n')
- self.htmlFile.write(' ' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server \n')
+ self.UEDevices.append('OAI-UE')
+ self.htmlUEConnected = len(self.UEDevices)
+ self.htmlFile.write(' ' + str(len(self.UEDevices)) + ' OAI UE(s) is(are) connected to CI bench \n')
self.htmlFile.write(' \n')
self.htmlFile.write(' \n')
count = 0
@@ -2116,9 +3109,7 @@ class SSHConnection():
self.GetAllUEDevices(terminate_ue_flag)
self.GetAllCatMDevices(terminate_ue_flag)
else:
- self.UEDevices.append('doughq9rehg')
- self.UEDevices.append('dnsgiuahgia')
- self.UEDevices.append('uehgieng9')
+ self.UEDevices.append('OAI-UE')
self.htmlUEConnected = len(self.UEDevices)
i = 0
@@ -2143,36 +3134,49 @@ class SSHConnection():
def CreateHtmlFooter(self, passStatus):
if (os.path.isfile('test_results.html')):
- self.RetrieveSystemVersion()
+ logging.debug('\u001B[1m----------------------------------------\u001B[0m')
+ logging.debug('\u001B[1m Creating HTML footer \u001B[0m')
+ logging.debug('\u001B[1m----------------------------------------\u001B[0m')
+
self.htmlFile = open('test_results.html', 'a')
self.htmlFile.write('\n')
self.htmlFile.write('
\n')
self.htmlFile.write(' \n')
+
+ machines = [ 'eNB', 'UE' ]
+ for machine in machines:
+ res = self.RetrieveSystemVersion(machine)
+ if res == -1:
+ continue
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ' + str(machine) + ' Server Characteristics \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' OS Version \n')
+ self.htmlFile.write(' ' + self.OsVersion + ' \n')
+ self.htmlFile.write(' Kernel Version \n')
+ self.htmlFile.write(' ' + self.KernelVersion + ' \n')
+ self.htmlFile.write(' UHD Version \n')
+ self.htmlFile.write(' ' + self.UhdVersion + ' \n')
+ self.htmlFile.write(' USRP Board \n')
+ self.htmlFile.write(' ' + self.UsrpBoard + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Nb CPUs \n')
+ self.htmlFile.write(' ' + self.CpuNb + ' \n')
+ self.htmlFile.write(' CPU Model Name \n')
+ self.htmlFile.write(' ' + self.CpuModel + ' \n')
+ self.htmlFile.write(' CPU Frequency \n')
+ self.htmlFile.write(' ' + self.CpuMHz + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
self.htmlFile.write(' \n')
- self.htmlFile.write(' eNB Server Characteristics \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' OS Version \n')
- self.htmlFile.write(' ' + self.eNBOsVersion + ' \n')
- self.htmlFile.write(' Kernel Version \n')
- self.htmlFile.write(' ' + self.eNBKernelVersion + ' \n')
- self.htmlFile.write(' UHD Version \n')
- self.htmlFile.write(' ' + self.eNBUhdVersion + ' \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' Nb CPUs \n')
- self.htmlFile.write(' ' + self.eNBCpuNb + ' \n')
- self.htmlFile.write(' CPU Model Name \n')
- self.htmlFile.write(' ' + self.eNBCpuModel + ' \n')
- self.htmlFile.write(' CPU Frequency \n')
- self.htmlFile.write(' ' + self.eNBCpuMHz + ' \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' \n')
- self.htmlFile.write(' Final Status \n')
+ self.htmlFile.write(' Final Status \n')
if passStatus:
- self.htmlFile.write(' PASS \n')
+ self.htmlFile.write(' PASS \n')
else:
- self.htmlFile.write(' FAIL \n')
+ self.htmlFile.write(' FAIL \n')
self.htmlFile.write(' \n')
self.htmlFile.write('
\n')
self.htmlFile.write('
\n')
@@ -2181,7 +3185,7 @@ class SSHConnection():
self.htmlFile.write('\n')
self.htmlFile.close()
- def CreateHtmlTestRow(self, options, status, processesStatus):
+ def CreateHtmlTestRow(self, options, status, processesStatus, machine='eNB'):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile.write(' \n')
self.htmlFile.write(' ' + self.testCase_id + ' \n')
@@ -2194,14 +3198,18 @@ class SSHConnection():
self.htmlFile.write(' ' + str(status) + ' \n')
elif (processesStatus == ENB_PROCESS_FAILED):
self.htmlFile.write(' KO - eNB process not found \n')
+ elif (processesStatus == OAI_UE_PROCESS_FAILED):
+ self.htmlFile.write(' KO - OAI UE process not found \n')
elif (processesStatus == ENB_PROCESS_SEG_FAULT):
- self.htmlFile.write(' KO - eNB process ended in Segmentation Fault \n')
- elif (processesStatus == ENB_PROCESS_ASSERTION):
- self.htmlFile.write(' KO - eNB process ended in Assertion \n')
+ self.htmlFile.write(' KO - ' + machine + ' process ended in Segmentation Fault \n')
+ elif (processesStatus == ENB_PROCESS_ASSERTION) or (processesStatus == OAI_UE_PROCESS_ASSERTION):
+ self.htmlFile.write(' KO - ' + machine + ' process ended in Assertion \n')
elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE):
- self.htmlFile.write(' KO - eNB process faced Real Time issue(s) \n')
- elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE):
- self.htmlFile.write(' OK \n')
+ self.htmlFile.write(' KO - ' + machine + ' process faced Real Time issue(s) \n')
+ elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE) or (processesStatus == OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE):
+ self.htmlFile.write(' OK? \n')
+ elif (processesStatus == OAI_UE_PROCESS_COULD_NOT_SYNC):
+ self.htmlFile.write(' KO - UE could not sync \n')
elif (processesStatus == HSS_PROCESS_FAILED):
self.htmlFile.write(' KO - HSS process not found \n')
elif (processesStatus == MME_PROCESS_FAILED):
@@ -2223,9 +3231,19 @@ class SSHConnection():
result = re.search('showed|Reestablishment|Could not copy eNB logfile', self.htmleNBFailureMsg)
if result is not None:
cellBgColor = 'orange'
- self.htmlFile.write(' ' + self.htmleNBFailureMsg + ' \n')
+ self.htmlFile.write(' ' + self.htmleNBFailureMsg + ' \n')
self.htmleNBFailureMsg = ''
+ elif (len(str(self.htmlUEFailureMsg)) > 2):
+ cellBgColor = 'white'
+ result = re.search('ended with|faced real time issues', self.htmlUEFailureMsg)
+ if result is not None:
+ cellBgColor = 'red'
+ else:
+ result = re.search('showed|Could not copy UE logfile|No Log File to analyze', self.htmlUEFailureMsg)
+ if result is not None:
+ cellBgColor = 'orange'
+ self.htmlFile.write(' ' + self.htmlUEFailureMsg + ' \n')
+ self.htmlUEFailureMsg = ''
else:
i = 0
while (i < self.htmlUEConnected):
@@ -2306,7 +3324,7 @@ def Usage():
print('------------------------------------------------------------')
def CheckClassValidity(action,id):
- if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'IdleSleep':
+ if action != 'Build_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep':
logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
return False
return True
@@ -2333,7 +3351,21 @@ def GetParametersFromXML(action):
else:
SSH.nbMaxUEtoAttach = int(nbMaxUEtoAttach)
- if action == 'Ping':
+ if action == 'Build_OAI_UE':
+ SSH.Build_OAI_UE_args = test.findtext('Build_OAI_UE_args')
+
+ if action == 'Initialize_OAI_UE':
+ SSH.Initialize_OAI_UE_args = test.findtext('Initialize_OAI_UE_args')
+ SSH.UE_instance = test.findtext('UE_instance')
+ if (SSH.UE_instance is None):
+ SSH.UE_instance = '0'
+
+ if action == 'Terminate_OAI_UE':
+ SSH.eNB_instance = test.findtext('UE_instance')
+ if (SSH.UE_instance is None):
+ SSH.UE_instance = '0'
+
+ if action == 'Ping' or action == 'Ping_CatM_module':
SSH.ping_args = test.findtext('ping_args')
SSH.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
@@ -2375,6 +3407,7 @@ SSH = SSHConnection()
argvs = sys.argv
argc = len(argvs)
+cwd = os.getcwd()
while len(argvs) > 1:
myArgv = argvs.pop(1) # 0th is this file's name
@@ -2447,6 +3480,18 @@ while len(argvs) > 1:
matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
SSH.testXMLfiles.append(matchReg.group(1))
SSH.nbTestXMLfiles += 1
+ elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE):
+ matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE)
+ SSH.UEIPAddress = matchReg.group(1)
+ elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE):
+ matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE)
+ SSH.UEUserName = matchReg.group(1)
+ elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE):
+ matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE)
+ SSH.UEPassword = matchReg.group(1)
+ elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE):
+ matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE)
+ SSH.UESourceCodePath = matchReg.group(1)
elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
finalStatus = matchReg.group(1)
@@ -2462,11 +3507,17 @@ if re.match('^TerminateeNB$', mode, re.IGNORECASE):
sys.exit('Insufficient Parameter')
SSH.TerminateeNB()
elif re.match('^TerminateUE$', mode, re.IGNORECASE):
- if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
+ if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == ''):
Usage()
sys.exit('Insufficient Parameter')
signal.signal(signal.SIGUSR1, receive_signal)
SSH.TerminateUE()
+elif re.match('^TerminateOAIUE$', mode, re.IGNORECASE):
+ if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ signal.signal(signal.SIGUSR1, receive_signal)
+ SSH.TerminateOAIUE()
elif re.match('^TerminateHSS$', mode, re.IGNORECASE):
if SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '':
Usage()
@@ -2483,7 +3534,7 @@ elif re.match('^TerminateSPGW$', mode, re.IGNORECASE):
sys.exit('Insufficient Parameter')
SSH.TerminateSPGW()
elif re.match('^LogCollectBuild$', mode, re.IGNORECASE):
- if SSH.eNBIPAddress == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '':
+ if (SSH.eNBIPAddress == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '') and (SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == ''):
Usage()
sys.exit('Insufficient Parameter')
SSH.LogCollectBuild()
@@ -2517,36 +3568,53 @@ elif re.match('^LogCollectIperf$', mode, re.IGNORECASE):
Usage()
sys.exit('Insufficient Parameter')
SSH.LogCollectIperf()
+elif re.match('^LogCollectOAIUE$', mode, re.IGNORECASE):
+ if SSH.UEIPAddress == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+ SSH.LogCollectOAIUE()
elif re.match('^InitiateHtml$', mode, re.IGNORECASE):
- if SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
+ if (SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == ''):
Usage()
sys.exit('Insufficient Parameter')
count = 0
+ foundCount = 0
while (count < SSH.nbTestXMLfiles):
+ xml_test_file = cwd + "/" + SSH.testXMLfiles[count]
xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[count]
- xmlTree = ET.parse(xml_test_file)
- xmlRoot = xmlTree.getroot()
- SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count)))
- SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count)))
- SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign'))
+ if (os.path.isfile(xml_test_file)):
+ xmlTree = ET.parse(xml_test_file)
+ xmlRoot = xmlTree.getroot()
+ SSH.htmlTabRefs.append(xmlRoot.findtext('htmlTabRef',default='test-tab-' + str(count)))
+ SSH.htmlTabNames.append(xmlRoot.findtext('htmlTabName',default='Test-' + str(count)))
+ SSH.htmlTabIcons.append(xmlRoot.findtext('htmlTabIcon',default='info-sign'))
+ foundCount += 1
count += 1
+ if foundCount != SSH.nbTestXMLfiles:
+ SSH.nbTestXMLfiles = foundCount
SSH.CreateHtmlHeader()
elif re.match('^FinalizeHtml$', mode, re.IGNORECASE):
SSH.CreateHtmlFooter(SSH.finalStatus)
-elif re.match('^TesteNB$', mode, re.IGNORECASE):
- if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
- Usage()
- sys.exit('Insufficient Parameter')
+elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re.IGNORECASE):
+ if re.match('^TesteNB$', mode, re.IGNORECASE):
+ if SSH.eNBIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.eNBUserName == '' or SSH.eNBPassword == '' or SSH.eNBSourceCodePath == '' or SSH.EPCIPAddress == '' or SSH.EPCUserName == '' or SSH.EPCPassword == '' or SSH.EPCType == '' or SSH.EPCSourceCodePath == '' or SSH.ADBIPAddress == '' or SSH.ADBUserName == '' or SSH.ADBPassword == '':
+ Usage()
+ sys.exit('Insufficient Parameter')
+
+ if (SSH.EPCIPAddress != ''):
+ SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, cwd + "/tcp_iperf_stats.awk", "/tmp")
+ SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, cwd + "/active_net_interfaces.awk", "/tmp")
+ else:
+ if SSH.UEIPAddress == '' or SSH.eNBRepository == '' or SSH.eNBBranch == '' or SSH.UEUserName == '' or SSH.UEPassword == '' or SSH.UESourceCodePath == '':
+ Usage()
+ sys.exit('UE: Insufficient Parameter')
- if (SSH.EPCIPAddress != 'none'):
- SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/tcp_iperf_stats.awk", "/tmp")
- SSH.copyout(SSH.EPCIPAddress, SSH.EPCUserName, SSH.EPCPassword, sys.path[0] + "/active_net_interfaces.awk", "/tmp")
#read test_case_list.xml file
# if no parameters for XML file, use default value
if (SSH.nbTestXMLfiles != 1):
- xml_test_file = sys.path[0] + "/test_case_list.xml"
+ xml_test_file = cwd + "/test_case_list.xml"
else:
- xml_test_file = sys.path[0] + "/" + SSH.testXMLfiles[0]
+ xml_test_file = cwd + "/" + SSH.testXMLfiles[0]
xmlTree = ET.parse(xml_test_file)
xmlRoot = xmlTree.getroot()
@@ -2607,8 +3675,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
SSH.ShowTestID()
GetParametersFromXML(action)
if action == 'Initialize_UE' or action == 'Attach_UE' or action == 'Detach_UE' or action == 'Ping' or action == 'Iperf' or action == 'Reboot_UE':
- terminate_ue_flag = False
- SSH.GetAllUEDevices(terminate_ue_flag)
+ if (SSH.ADBIPAddress != 'none'):
+ terminate_ue_flag = False
+ SSH.GetAllUEDevices(terminate_ue_flag)
if action == 'Build_eNB':
SSH.BuildeNB()
elif action == 'Initialize_eNB':
@@ -2623,6 +3692,12 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
SSH.AttachUE()
elif action == 'Detach_UE':
SSH.DetachUE()
+ elif action == 'Build_OAI_UE':
+ SSH.BuildOAIUE()
+ elif action == 'Initialize_OAI_UE':
+ SSH.InitializeOAIUE()
+ elif action == 'Terminate_OAI_UE':
+ SSH.TerminateOAIUE()
elif action == 'Initialize_CatM_module':
SSH.InitializeCatM()
elif action == 'Terminate_CatM_module':
@@ -2631,6 +3706,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
SSH.AttachCatM()
elif action == 'Detach_CatM_module':
SSH.TerminateCatM()
+ elif action == 'Ping_CatM_module':
+ SSH.PingCatM()
elif action == 'Ping':
SSH.Ping()
elif action == 'Iperf':
diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool
index 6e0a83e07d..c343e24d80 100755
--- a/ci-scripts/oai-ci-vm-tool
+++ b/ci-scripts/oai-ci-vm-tool
@@ -34,14 +34,19 @@ function top_usage {
}
function variant_usage {
+ echo " # OpenAirInterface Build Variants"
echo " --variant enb-usrp OR -v1"
echo " --variant basic-sim OR -v2"
echo " --variant phy-sim OR -v3"
echo " --variant cppcheck OR -v4"
echo " --variant enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8"
- echo " --variant l2-sim OR -v9"
+ echo " # non-OSA Build Variants"
echo " --variant flexran-rtc OR -v10"
+ echo " # OpenAirInterface Test Variants"
+ echo " --variant l1-sim OR -v20"
+ echo " --variant rf-sim OR -v21"
+ echo " --variant l2-sim OR -v22"
}
MY_DIR=$(dirname $(readlink -f $0))
@@ -69,7 +74,7 @@ VM_MEMORY=2048
VM_CPU=4
ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt
-NB_PATTERN_FILES=4
+NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP"
KEEP_VM_ALIVE=0
RUN_OPTIONS="none"
@@ -231,7 +236,7 @@ case $key in
VM_NAME=ci-enb-usrp
ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=4
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP --mu"
NBARGS=$[$NBARGS+256]
shift
@@ -264,37 +269,29 @@ case $key in
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
- BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
+ BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
shift
;;
-v7)
VM_NAME=ci-enb-ethernet
+ VM_MEMORY=4096
+ VM_CPU=4
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
- BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
+ BUILD_OPTIONS="--eNB -t ETHERNET"
NBARGS=$[$NBARGS+256]
shift
;;
-v8)
VM_NAME=ci-ue-ethernet
+ VM_MEMORY=4096
+ VM_CPU=4
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=6
- BUILD_OPTIONS="--UE -t ETHERNET --noS1"
- NBARGS=$[$NBARGS+256]
- shift
- ;;
- -v9)
- VM_NAME=ci-l2-sim
- VM_MEMORY=8192
- VM_CPU=8
- ARCHIVES_LOC=l2_sim
- LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=4
- BUILD_OPTIONS="--eNB -t ETHERNET"
- RUN_OPTIONS="complex"
+ NB_PATTERN_FILES=10
+ BUILD_OPTIONS="--UE -t ETHERNET"
NBARGS=$[$NBARGS+256]
shift
;;
@@ -307,6 +304,27 @@ case $key in
NBARGS=$[$NBARGS+256]
shift
;;
+ -v20)
+ VM_NAME=ci-l1-sim
+ ARCHIVES_LOC=l1_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ shift
+ ;;
+ -v21)
+ VM_NAME=ci-rf-sim
+ ARCHIVES_LOC=rf_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ shift
+ ;;
+ -v22)
+ VM_NAME=ci-l2-sim
+ ARCHIVES_LOC=l2_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ shift
+ ;;
--variant)
variant="$2"
case $variant in
@@ -314,7 +332,7 @@ case $key in
VM_NAME=ci-enb-usrp
ARCHIVES_LOC=enb_usrp
LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=4
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP --mu"
NBARGS=$[$NBARGS+256]
;;
@@ -340,38 +358,31 @@ case $key in
;;
cppcheck)
VM_NAME=ci-cppcheck
- VM_MEMORY=8192
+ VM_MEMORY=4096
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
- BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
+ BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
;;
enb-ethernet)
VM_NAME=ci-enb-ethernet
+ VM_MEMORY=4096
+ VM_CPU=4
ARCHIVES_LOC=enb_eth
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=6
- BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
+ BUILD_OPTIONS="--eNB -t ETHERNET"
NBARGS=$[$NBARGS+256]
;;
ue-ethernet)
VM_NAME=ci-ue-ethernet
+ VM_MEMORY=4096
+ VM_CPU=4
ARCHIVES_LOC=ue_eth
LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=6
- BUILD_OPTIONS="--UE -t ETHERNET --noS1"
- NBARGS=$[$NBARGS+256]
- ;;
- l2-sim)
- VM_NAME=ci-l2-sim
- VM_MEMORY=8192
- VM_CPU=8
- ARCHIVES_LOC=l2_sim
- LOG_PATTERN=.Rel14.txt
- NB_PATTERN_FILES=4
- BUILD_OPTIONS="--eNB -t ETHERNET"
- RUN_OPTIONS="complex"
+ NB_PATTERN_FILES=10
+ BUILD_OPTIONS="--UE -t ETHERNET"
NBARGS=$[$NBARGS+256]
;;
flexran-rtc)
@@ -382,6 +393,24 @@ case $key in
BUILD_OPTIONS="cmake . && make -j2"
NBARGS=$[$NBARGS+256]
;;
+ l1-sim)
+ VM_NAME=ci-l1-sim
+ ARCHIVES_LOC=l1_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ ;;
+ rf-sim)
+ VM_NAME=ci-rf-sim
+ ARCHIVES_LOC=rf_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ ;;
+ l2-sim)
+ VM_NAME=ci-l2-sim
+ ARCHIVES_LOC=l2_sim
+ RUN_OPTIONS="complex"
+ NBARGS=$[$NBARGS+256]
+ ;;
*)
echo ""
echo "Syntax Error: Invalid Variant option -> $variant"
@@ -510,13 +539,16 @@ else
fi
fi
-# Checking uvt-kvm is installed
-UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm`
-if [ $UVT_KVM_PATH -eq 0 ]
+if [ $REPORT_BUILD_CMD -ne 1 ] && [ $REPORT_TEST_CMD -ne 1 ]
then
- echo "Error: uvt-kvm is not installed"
- top_usage
- exit 1
+ # Checking uvt-kvm is installed
+ UVT_KVM_PATH=`which uvt-kvm | grep -c uvt-kvm`
+ if [ $UVT_KVM_PATH -eq 0 ]
+ then
+ echo "Error: uvt-kvm is not installed"
+ top_usage
+ exit 1
+ fi
fi
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
@@ -533,11 +565,23 @@ ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC}
STATUS=0
if [ $CREATE_CMD -eq 1 ]
then
- create_vm
+ if [[ $VM_NAME =~ .*-l2-sim.* ]]
+ then
+ echo "Selected variant is no more a build variant"
+ exit 0
+ else
+ create_vm
+ fi
fi
if [ $BUILD_CMD -eq 1 ]
then
- build_on_vm
+ if [[ $VM_NAME =~ .*-l2-sim.* ]]
+ then
+ echo "Selected variant is no more a build variant"
+ exit 0
+ else
+ build_on_vm
+ fi
if [ $DAEMON -eq 0 ] && [ $STATUS -eq 0 ]
then
check_on_vm_build
@@ -545,7 +589,13 @@ then
fi
if [ $WAIT_CMD -eq 1 ]
then
- wait_on_vm_build
+ if [[ $VM_NAME =~ .*-l2-sim.* ]]
+ then
+ echo "Selected variant is no more a build variant"
+ exit 0
+ else
+ wait_on_vm_build
+ fi
if [ $STATUS -eq 0 ]
then
check_on_vm_build
@@ -553,6 +603,24 @@ then
fi
if [ $TEST_CMD -eq 1 ]
then
+ # Comment out or delete the following lines if you want to run L1-simulator in your branch and/or merge request
+ if [[ $VM_NAME =~ .*-l1-sim.* ]]
+ then
+ echo "Currently L1-Simulator Testing is not implemented / enabled"
+ echo "Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it"
+ echo "STATUS seems OK"
+ exit $STATUS
+ fi
+ # end to comment out for L1-simulator
+ # Comment out or delete the following lines if you want to run RF-simulator in your branch and/or merge request
+ if [[ $VM_NAME =~ .*-rf-sim.* ]]
+ then
+ echo "Currently RF-Simulator Testing is not implemented / enabled"
+ echo "Comment out these lines in ./ci-scripts/oai-ci-vm-tool if you want to run it"
+ echo "STATUS seems OK"
+ exit $STATUS
+ fi
+ # end to comment out for RF-simulator
ARCHIVES_LOC=${ARCHIVES_LOC}/test
run_test_on_vm
fi
diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh
index bfce7acd8f..b0709db15a 100755
--- a/ci-scripts/reportBuildLocally.sh
+++ b/ci-scripts/reportBuildLocally.sh
@@ -143,13 +143,21 @@ function summary_table_header {
echo " $1 " >> ./build_results.html
if [ -f $2/build_final_status.log ]
then
+ if [ `grep -c COMMAND $2/build_final_status.log` -eq 1 ]
+ then
+ COMMAND=`grep COMMAND $2/build_final_status.log | sed -e "s#COMMAND: ##"`
+ else
+ COMMAND="Unknown"
+ fi
if [ `grep -c BUILD_OK $2/build_final_status.log` -eq 1 ]
then
echo " " >> ./build_results.html
+ echo " $COMMAND " >> ./build_results.html
echo " BUILD was SUCCESSFUL " >> ./build_results.html
echo "
" >> ./build_results.html
else
echo " " >> ./build_results.html
+ echo " $COMMAND " >> ./build_results.html
echo " BUILD was a FAILURE! " >> ./build_results.html
echo "
" >> ./build_results.html
fi
@@ -218,25 +226,89 @@ function sca_summary_table_header {
echo " $2 " >> ./build_results.html
NB_ERRORS=`egrep -c "severity=\"error\"" $1`
NB_WARNINGS=`egrep -c "severity=\"warning\"" $1`
+ ADDED_ERRORS="0"
+ ADDED_WARNINGS="0"
+ FINAL_LOG=`echo $1 | sed -e "s#cppcheck\.xml#build_final_status.log#"`
+ if [ `grep -c COMMAND $FINAL_LOG` -eq 1 ]
+ then
+ COMMAND=`grep COMMAND $FINAL_LOG | sed -e "s#COMMAND: ##"`
+ else
+ COMMAND="Unknown"
+ fi
+ if [ $MR_TRIG -eq 1 ]
+ then
+ if [ -d ../../cppcheck_archives ]
+ then
+ if [ -d ../../cppcheck_archives/$JOB_NAME ]
+ then
+ ADDED_ERRORS=`diff $1 ../../cppcheck_archives/$JOB_NAME/cppcheck.xml | egrep --color=never "^<" | egrep -c "severity=\"error"`
+ ADDED_WARNINGS=`diff $1 ../../cppcheck_archives/$JOB_NAME/cppcheck.xml | egrep --color=never "^<" | egrep -c "severity=\"warning"`
+ fi
+ fi
+ local TOTAL_NUMBER=$[$ADDED_ERRORS+$ADDED_WARNINGS]
+ if [ -f $JENKINS_WKSP/oai_cppcheck_added_errors.txt ]; then rm -f $JENKINS_WKSP/oai_cppcheck_added_errors.txt; fi
+ echo "$TOTAL_NUMBER" > $JENKINS_WKSP/oai_cppcheck_added_errors.txt
+ fi
if [ $NB_ERRORS -eq 0 ] && [ $NB_WARNINGS -eq 0 ]
then
echo " " >> ./build_results.html
+ echo " $COMMAND " >> ./build_results.html
echo " CPPCHECK found NO error and NO warning " >> ./build_results.html
echo "
" >> ./build_results.html
else
if [ $NB_ERRORS -eq 0 ]
then
echo " " >> ./build_results.html
- echo " CPPCHECK found NO error and $NB_WARNINGS warnings " >> ./build_results.html
+ echo " $COMMAND " >> ./build_results.html
+ if [ $PU_TRIG -eq 1 ]
+ then
+ echo " CPPCHECK found NO error and $NB_WARNINGS warnings " >> ./build_results.html
+ fi
+ if [ $MR_TRIG -eq 1 ]
+ then
+ if [ $ADDED_WARNINGS -eq 0 ]
+ then
+ echo " CPPCHECK found NO error and $NB_WARNINGS warnings " >> ./build_results.html
+ else
+ echo " CPPCHECK found NO error and $NB_WARNINGS warnings " >> ./build_results.html
+ fi
+ fi
echo "
" >> ./build_results.html
else
echo " " >> ./build_results.html
- echo " CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings " >> ./build_results.html
+ echo " $COMMAND " >> ./build_results.html
+ if [ $PU_TRIG -eq 1 ]
+ then
+ echo " CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings " >> ./build_results.html
+ fi
+ if [ $MR_TRIG -eq 1 ]
+ then
+ if [ $ADDED_ERRORS -eq 0 ] && [ $ADDED_WARNINGS -eq 0 ]
+ then
+ echo " CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings " >> ./build_results.html
+ else
+ echo " CPPCHECK found $NB_ERRORS errors and $NB_WARNINGS warnings " >> ./build_results.html
+ echo " " >> ./build_results.html
+ echo " " >> ./build_results.html
+ echo " This Merge Request may have introduced up to $ADDED_ERRORS errors and $ADDED_WARNINGS warnings. " >> ./build_results.html
+ fi
+ fi
echo "
" >> ./build_results.html
fi
fi
+ if [ $PU_TRIG -eq 1 ]
+ then
+ if [ -d ../../cppcheck_archives ]
+ then
+ if [ -d ../../cppcheck_archives/$JOB_NAME ]
+ then
+ cp $1 ../../cppcheck_archives/$JOB_NAME
+ fi
+ fi
+ fi
echo " More details on CPPCHECK results " >> ./build_results.html
echo " " >> ./build_results.html
+ echo "
" >> ./build_results.html
echo "
" >> ./build_results.html
echo " " >> ./build_results.html
echo " Error / Warning Type " >> ./build_results.html
@@ -301,6 +373,43 @@ function sca_summary_table_footer {
echo "
" >> ./build_results.html
echo "
Full details in zipped artifact (cppcheck/cppcheck.xml)
" >> ./build_results.html
echo "
Graphical Interface tool : cppcheck-gui -l cppcheck/cppcheck.xml
" >> ./build_results.html
+
+ if [ $MR_TRIG -eq 1 ]
+ then
+ if [ $ADDED_ERRORS -ne 0 ] || [ $ADDED_WARNINGS -ne 0 ]
+ then
+ echo "
" >> ./build_results.html
+ echo " " >> ./build_results.html
+ echo " Potential File(s) impacted by added errors/warnings " >> ./build_results.html
+ echo " Line Number " >> ./build_results.html
+ echo " Severity " >> ./build_results.html
+ echo " Message " >> ./build_results.html
+ echo " " >> ./build_results.html
+ SEVERITY="none"
+ POTENTIAL_FILES=`diff $1 ../../cppcheck_archives/$JOB_NAME/cppcheck.xml | egrep --color=never "^<" | egrep "location file|severity" | sed -e "s# #@#g"`
+ for POT_FILE in $POTENTIAL_FILES
+ do
+ if [ `echo $POT_FILE | grep -c location` -eq 1 ]
+ then
+ FILENAME=`echo $POT_FILE | sed -e "s#^.*file=\"##" -e "s#\"@line.*/>##"`
+ LINE=`echo $POT_FILE | sed -e "s#^.*line=\"##" -e "s#\"/>##"`
+ if [[ $SEVERITY != *"none" ]]
+ then
+ echo " " >> ./build_results.html
+ echo " $FILENAME " >> ./build_results.html
+ echo " $LINE " >> ./build_results.html
+ echo " $SEVERITY " >> ./build_results.html
+ echo " $MESSAGE " >> ./build_results.html
+ echo " " >> ./build_results.html
+ fi
+ else
+ SEVERITY=`echo $POT_FILE | sed -e "s#^.*severity=\"##" -e "s#\"@msg=.*##"`
+ MESSAGE=`echo $POT_FILE | sed -e "s#^.*msg=\"##" -e "s#\"@verbose=.*##" -e "s#@# #g"`
+ fi
+ done
+ echo "
" >> ./build_results.html
+ fi
+ fi
echo "
" >> ./build_results.html
}
@@ -363,6 +472,14 @@ function report_build {
echo " Commit ID " >> ./build_results.html
echo " $SOURCE_COMMIT_ID " >> ./build_results.html
echo " " >> ./build_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./build_results.html
+ echo " Commit Message " >> ./build_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./build_results.html
+ echo " " >> ./build_results.html
+ fi
fi
if [ $MR_TRIG -eq 1 ]
then
@@ -374,6 +491,14 @@ function report_build {
echo " Source Commit ID " >> ./build_results.html
echo " $SOURCE_COMMIT_ID " >> ./build_results.html
echo " " >> ./build_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./build_results.html
+ echo " Source Commit Message " >> ./build_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./build_results.html
+ echo " " >> ./build_results.html
+ fi
echo " " >> ./build_results.html
echo " Target Branch " >> ./build_results.html
echo " $TARGET_BRANCH " >> ./build_results.html
@@ -436,7 +561,8 @@ function report_build {
summary_table_row "LTE SoftModem - Release 14" ./archives/enb_usrp/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_row1.html
summary_table_row "Coding - Release 14" ./archives/enb_usrp/coding.Rel14.txt "Built target coding" ./enb_usrp_row2.html
summary_table_row "OAI USRP device if - Release 14" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html
- summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_row4.html
+ summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_usrp/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_usrp_row4.html
+ summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_row5.html
summary_table_footer
summary_table_header "OAI Build basic simulator option" ./archives/basic_sim
@@ -473,32 +599,37 @@ function report_build {
fi
summary_table_header "OAI Build eNB -- ETHERNET transport option" ./archives/enb_eth
- summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html
+ summary_table_row "LTE SoftModem - Release 14" ./archives/enb_eth/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html
summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html
summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_eth_row3.html
summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_eth_row4.html
- summary_table_row "RB Tools - Release 14" ./archives/enb_eth/rb_tool.Rel14.txt "Built target rb_tool" ./enb_eth_row5.html
- summary_table_row "NAS Mesh - Release 14" ./archives/enb_eth/nasmesh.Rel14.txt "Built target nasmesh" ./enb_eth_row6.html
+ summary_table_row "RF Simulator - Release 14" ./archives/enb_eth/rfsimulator.Rel14.txt "Built target rfsimulator" ./enb_eth_row5.html
+ summary_table_row "TCP OAI Bridge - Release 14" ./archives/enb_eth/tcp_bridge_oai.Rel14.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html
summary_table_footer
summary_table_header "OAI Build UE -- ETHERNET transport option" ./archives/ue_eth
- summary_table_row "LTE UE SoftModem w/o S1 - Release 14" ./archives/ue_eth/lte-uesoftmodem-nos1.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html
+ summary_table_row "LTE UE SoftModem - Release 14" ./archives/ue_eth/lte-uesoftmodem.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html
summary_table_row "Coding - Release 14" ./archives/ue_eth/coding.Rel14.txt "Built target coding" ./ue_eth_row2.html
summary_table_row "OAI ETHERNET transport - Release 14" ./archives/ue_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./ue_eth_row3.html
summary_table_row "Parameters Lib Config - Release 14" ./archives/ue_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./ue_eth_row4.html
- summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "Built target rb_tool" ./ue_eth_row5.html
- summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html
+ summary_table_row "RF Simulator - Release 14" ./archives/ue_eth/rfsimulator.Rel14.txt "Built target rfsimulator" ./ue_eth_row5.html
+ summary_table_row "TCP OAI Bridge - Release 14" ./archives/ue_eth/tcp_bridge_oai.Rel14.txt "Built target tcp_bridge_oai" ./ue_eth_row6.html
+ summary_table_row "Conf 2 UE Data - Release 14" ./archives/ue_eth/conf2uedata.Rel14.txt "Built target conf2uedata" ./ue_eth_row7.html
+ summary_table_row "NVRAM - Release 14" ./archives/ue_eth/nvram.Rel14.txt "Built target nvram" ./ue_eth_row8.html
+ summary_table_row "UE IP - Release 14" ./archives/ue_eth/ue_ip.Rel14.txt "Built target ue_ip" ./ue_eth_row9.html
+ summary_table_row "USIM - Release 14" ./archives/ue_eth/usim.Rel14.txt "Built target usim" ./ue_eth_row9a.html
summary_table_footer
if [ -e ./archives/red_hat ]
then
- echo " Red Hat (CentOS Linux release 7.4.1708) -- Summary " >> ./build_results.html
+ echo " Red Hat Enterprise Linux Server release 7.6) -- Summary " >> ./build_results.html
summary_table_header "Red Hat -- OAI Build eNB -- USRP option" ./archives/red_hat
summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html
summary_table_row "Coding - Release 14" ./archives/red_hat/coding.Rel14.txt "Built target coding" ./enb_usrp_rh_row2.html
summary_table_row "OAI USRP device if - Release 14" ./archives/red_hat/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_rh_row3.html
- summary_table_row "Parameters Lib Config - Release 14" ./archives/red_hat/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_rh_row4.html
+ summary_table_row "OAI ETHERNET transport - Release 14" ./archives/red_hat/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_usrp_rh_row4.html
+ summary_table_row "Parameters Lib Config - Release 14" ./archives/red_hat/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_rh_row5.html
summary_table_footer
fi
@@ -506,41 +637,61 @@ function report_build {
echo " Details for Compilation Errors and Warnings " >> ./build_results.html
echo " " >> ./build_results.html
- for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- for DETAILS_TABLE in `ls ./basic_sim_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- for DETAILS_TABLE in `ls ./phy_sim_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
-
- for DETAILS_TABLE in `ls ./gnb_usrp_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- for DETAILS_TABLE in `ls ./nrue_usrp_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- for DETAILS_TABLE in `ls ./enb_eth_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- for DETAILS_TABLE in `ls ./ue_eth_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- if [ -e ./archives/red_hat ]
+ if [ -f ./enb_usrp_row1.html ] || [ -f ./enb_usrp_row2.html ] || [ -f ./enb_usrp_row3.html ] || [ -f ./enb_usrp_row4.html ]
then
- for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
+ for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./basic_sim_row1.html ] || [ -f ./basic_sim_row2.html ] || [ -f ./basic_sim_row3.html ]
+ then
+ for DETAILS_TABLE in `ls ./basic_sim_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./phy_sim_row1.html ] || [ -f ./phy_sim_row2.html ] || [ -f ./phy_sim_row3.html ]
+ then
+ for DETAILS_TABLE in `ls ./phy_sim_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ]
+ then
+ for DETAILS_TABLE in `ls ./gnb_usrp_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./nrue_usrp_row1.html ] || [ -f ./nrue_usrp_row2.html ] || [ -f ./nrue_usrp_row3.html ] || [ -f ./nrue_usrp_row4.html ]
+ then
+ for DETAILS_TABLE in `ls ./nrue_usrp_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ]
+ then
+ for DETAILS_TABLE in `ls ./enb_eth_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./ue_eth_row1.html ] || [ -f ./ue_eth_row2.html ] || [ -f ./ue_eth_row3.html ] || [ -f ./ue_eth_row4.html ] || [ -f ./ue_eth_row5.html ] || [ -f ./ue_eth_row6.html ]
+ then
+ for DETAILS_TABLE in `ls ./ue_eth_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
+ fi
+ if [ -f ./enb_usrp_rh_row1.html ] || [ -f ./enb_usrp_rh_row2.html ] || [ -f ./enb_usrp_rh_row3.html ] || [ -f ./enb_usrp_rh_row4.html ]
+ then
+ for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
+ do
+ cat $DETAILS_TABLE >> ./build_results.html
+ done
fi
rm -f ./*_row*.html
diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh
index 004e021de1..e4195edde0 100755
--- a/ci-scripts/reportTestLocally.sh
+++ b/ci-scripts/reportTestLocally.sh
@@ -80,6 +80,121 @@ function report_test_usage {
echo ""
}
+function analyzePingFiles {
+ for PING_CASE in $PING_LOGS
+ do
+ echo "
" >> ./test_simulator_results.html
+ NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " $NAME " >> ./test_simulator_results.html
+ CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
+ echo " $CMD " >> ./test_simulator_results.html
+ FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
+ if [ $FILE_COMPLETE -eq 0 ]
+ then
+ echo " KO " >> ./test_simulator_results.html
+ echo " N/A " >> ./test_simulator_results.html
+ else
+ NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"`
+ NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"`
+ if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ]
+ then
+ echo " OK " >> ./test_simulator_results.html
+ else
+ echo " KO " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
+ echo "Packet Loss : $STATS" >> ./test_simulator_results.html
+ RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
+ echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
+ RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
+ echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
+ RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
+ echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ done
+}
+
+function analyzeIperfFiles {
+ for IPERF_CASE in $IPERF_TESTS
+ do
+ echo "
" >> ./test_simulator_results.html
+ NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " $NAME " >> ./test_simulator_results.html
+ CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
+ echo " $CMD " >> ./test_simulator_results.html
+ REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"`
+ if [[ $REQ_BITRATE =~ .*K.* ]]
+ then
+ REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"`
+ FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l`
+ fi
+ if [[ $REQ_BITRATE =~ .*M.* ]]
+ then
+ REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"`
+ FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l`
+ fi
+ if [[ $REQ_BITRATE =~ .*G.* ]]
+ then
+ REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"`
+ FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l`
+ fi
+ FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE`
+ if [ $FILE_COMPLETE -eq 0 ]
+ then
+ echo " KO " >> ./test_simulator_results.html
+ SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"`
+ FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'`
+ EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'`
+ PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
+ JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'`
+ PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'`
+ PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"`
+ else
+ EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
+ if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
+ then
+ EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
+ FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l`
+ fi
+ if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]]
+ then
+ EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"`
+ FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l`
+ fi
+ if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]]
+ then
+ EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"`
+ FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l`
+ fi
+ PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
+ PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'`
+ if [[ $PERF_INT -lt 70 ]]
+ then
+ echo " KO " >> ./test_simulator_results.html
+ else
+ echo " OK " >> ./test_simulator_results.html
+ fi
+ EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
+ JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"`
+ PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
+ fi
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo "Bitrate : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
+ echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
+ echo "Jitter : $JITTER" >> ./test_simulator_results.html
+ echo "Packet Loss : $PACKETLOSS" >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ done
+}
+
function report_test {
echo "############################################################"
echo "OAI CI VM script"
@@ -139,6 +254,14 @@ function report_test {
echo "
Commit ID " >> ./test_simulator_results.html
echo "
$SOURCE_COMMIT_ID " >> ./test_simulator_results.html
echo "
" >> ./test_simulator_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./test_simulator_results.html
+ echo " Commit Message " >> ./test_simulator_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
fi
if [ $MR_TRIG -eq 1 ]
then
@@ -150,6 +273,14 @@ function report_test {
echo " Source Commit ID " >> ./test_simulator_results.html
echo " $SOURCE_COMMIT_ID " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ if [ -e .git/CI_COMMIT_MSG ]
+ then
+ echo " " >> ./test_simulator_results.html
+ echo " Commit Message " >> ./test_simulator_results.html
+ MSG=`cat .git/CI_COMMIT_MSG`
+ echo " $MSG " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
echo " " >> ./test_simulator_results.html
echo " Target Branch " >> ./test_simulator_results.html
echo " $TARGET_BRANCH " >> ./test_simulator_results.html
@@ -199,6 +330,14 @@ function report_test {
BW_CASES=(05 10 20)
for TMODE in ${TRANS_MODES[@]}
do
+ echo " " >> ./test_simulator_results.html
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ echo " Test in FDD " >> ./test_simulator_results.html
+ else
+ echo " Test in TDD " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
for BW in ${BW_CASES[@]}
do
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
@@ -263,124 +402,11 @@ function report_test {
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
fi
- PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt
- if [ -f $PING_CASE ]
- then
- echo " " >> ./test_simulator_results.html
- NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
- echo " $NAME " >> ./test_simulator_results.html
- CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
- echo " $CMD " >> ./test_simulator_results.html
- FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
- if [ $FILE_COMPLETE -eq 0 ]
- then
- echo " KO " >> ./test_simulator_results.html
- echo " N/A " >> ./test_simulator_results.html
- else
- NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"`
- NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"`
- if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ]
- then
- echo " OK " >> ./test_simulator_results.html
- else
- echo " KO " >> ./test_simulator_results.html
- fi
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
- echo "Packet Loss : $STATS" >> ./test_simulator_results.html
- RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
- echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
- RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
- echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
- RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
- echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- fi
- echo " " >> ./test_simulator_results.html
- fi
+ PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt 2> /dev/null`
+ analyzePingFiles
- if [ -f $ARCHIVES_LOC/${TMODE}_${BW}*iperf*dl*client*txt ]
- then
- IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt`
- else
- echo "There are no iperf files"
- IPERF_TESTS=""
- fi
- for IPERF_CASE in $IPERF_TESTS
- do
- echo " " >> ./test_simulator_results.html
- NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
- echo " $NAME " >> ./test_simulator_results.html
- CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
- echo " $CMD " >> ./test_simulator_results.html
- REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"`
- if [[ $REQ_BITRATE =~ .*K.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l`
- fi
- if [[ $REQ_BITRATE =~ .*M.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l`
- fi
- if [[ $REQ_BITRATE =~ .*G.* ]]
- then
- REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"`
- FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l`
- fi
- FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE`
- if [ $FILE_COMPLETE -eq 0 ]
- then
- echo " KO " >> ./test_simulator_results.html
- SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"`
- FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'`
- EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}}'`
- PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
- JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'`
- PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'`
- PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"`
- else
- EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l`
- fi
- if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l`
- fi
- if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]]
- then
- EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"`
- FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l`
- fi
- PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
- PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'`
- if [[ $PERF_INT -lt 90 ]]
- then
- echo " KO " >> ./test_simulator_results.html
- else
- echo " OK " >> ./test_simulator_results.html
- fi
- EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"`
- PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
- fi
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo "Bitrate : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
- echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
- echo "Jitter : $JITTER" >> ./test_simulator_results.html
- echo "Packet Loss : $PACKETLOSS" >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- done
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt 2> /dev/null`
+ analyzeIperfFiles
done
done
@@ -450,13 +476,27 @@ function report_test {
echo " Statistics " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ EPC_CONFIGS=("wS1" "noS1")
TRANS_MODES=("fdd")
BW_CASES=(05)
- for TMODE in ${TRANS_MODES[@]}
+ NB_USERS=(01 04)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
do
+ for TMODE in ${TRANS_MODES[@]}
+ do
for BW in ${BW_CASES[@]}
do
- ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
+ for UES in ${NB_USERS[@]}
+ do
+ echo " " >> ./test_simulator_results.html
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s) " >> ./test_simulator_results.html
+ else
+ echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s) " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log
UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
then
@@ -496,45 +536,17 @@ function report_test {
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
fi
- PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_epc.txt
- if [ -f $PING_CASE ]
- then
- echo " " >> ./test_simulator_results.html
- NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
- echo " $NAME " >> ./test_simulator_results.html
- CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
- echo " $CMD " >> ./test_simulator_results.html
- FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
- if [ $FILE_COMPLETE -eq 0 ]
- then
- echo " KO " >> ./test_simulator_results.html
- echo " N/A " >> ./test_simulator_results.html
- else
- NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"`
- NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"`
- if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ]
- then
- echo " OK " >> ./test_simulator_results.html
- else
- echo " KO " >> ./test_simulator_results.html
- fi
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
- echo "Packet Loss : $STATS" >> ./test_simulator_results.html
- RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
- echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
- RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
- echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
- RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
- echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- echo " " >> ./test_simulator_results.html
- fi
- echo " " >> ./test_simulator_results.html
- fi
+ PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null`
+ analyzePingFiles
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
+ analyzeIperfFiles
+
+ IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
+ analyzeIperfFiles
+ done
done
+ done
done
echo " " >> ./test_simulator_results.html
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index 7ff04e23f8..9433167e54 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -90,9 +90,33 @@ function start_basic_sim_enb {
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/enb -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
- sleep 10
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
rm $1
+ sleep 5
+
+ local i="0"
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ sleep 5
+ i=$[$i+1]
+ fi
+ done
+ ENB_SYNC=0
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "Basic-Sim eNB: eNB did NOT got sync"
+ else
+ echo "Basic-Sim eNB: eNB GOT SYNC --> waiting for UE to connect"
+ fi
+ sleep 5
}
function start_basic_sim_ue {
@@ -108,15 +132,15 @@ function start_basic_sim_ue {
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE; fi" >> $1
echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/basic_simulator/ue -o /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ./my-lte-uesoftmodem-run.sh" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
local i="0"
- echo "ifconfig oip1 | egrep -c \"inet addr\"" > $1
+ echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
while [ $i -lt 10 ]
do
sleep 5
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
if [ $CONNECTED -eq 1 ]
then
i="100"
@@ -124,36 +148,96 @@ function start_basic_sim_ue {
i=$[$i+1]
fi
done
+ UE_SYNC=1
rm $1
if [ $i -lt 50 ]
then
UE_SYNC=0
+ echo "Basic-Sim UE: oaitun_ue1 is DOWN and/or NOT CONFIGURED"
else
- UE_SYNC=1
+ echo "Basic-Sim UE: oaitun_ue1 is UP and CONFIGURED"
+ fi
+ i="0"
+ echo "egrep -c \"Generating RRCConnectionReconfigurationComplete\" /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ sleep 5
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "Basic-Sim UE: UE did NOT complete RRC Connection"
+ else
+ echo "Basic-Sim UE: UE did COMPLETE RRC Connection"
fi
}
function get_ue_ip_addr {
- echo "ifconfig oip1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
- UE_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1`
- echo "UE IP Address for EPC is : $UE_IP_ADDR"
+ local LOC_IF_ID=$3
+ echo "ifconfig oaitun_ue${LOC_IF_ID} | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
+ UE_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ echo "Test UE${LOC_IF_ID} IP Address is : $UE_IP_ADDR"
+ rm $1
+}
+
+function get_enb_noS1_ip_addr {
+ echo "ifconfig oaitun_enb1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1
+ ENB_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1`
+ echo "Test eNB IP Address is : $ENB_IP_ADDR"
rm $1
}
function ping_ue_ip_addr {
- echo "echo \"ping -c 20 $3\"" > $1
+ local LOC_FG_OR_BG=$5
echo "echo \"COMMAND IS: ping -c 20 $3\" > $4" > $1
- echo "ping -c 20 $UE_IP_ADDR | tee -a $4" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ echo "echo \"ping -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -c 20 $UE_IP_ADDR >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -c 20 $UE_IP_ADDR >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
function ping_epc_ip_addr {
- echo "echo \"COMMAND IS: ping -I oip1 -c 20 $3\" > $4" > $1
- echo "rm -f $4" >> $1
- echo "ping -I oip1 -c 20 $3 | tee -a $4" >> $1
- cat $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ local LOC_IF_ID=$5
+ local LOC_FG_OR_BG=$6
+ echo "echo \"COMMAND IS: ping -I oaitun_ue${LOC_IF_ID} -c 20 $3\" > $4" > $1
+ echo "echo \"ping -I oaitun_ue${LOC_IF_ID} -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -I oaitun_ue${LOC_IF_ID} -c 20 $3 >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -I oaitun_ue${LOC_IF_ID} -c 20 $3 >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ rm -f $1
+}
+
+function ping_enb_ip_addr {
+ local LOC_FG_OR_BG=$5
+ echo "echo \"COMMAND IS: ping -I oaitun_enb1 -c 20 $3\" > $4" > $1
+ echo "echo \"ping -I oaitun_enb1 -c 20 $3\"" >> $1
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "ping -I oaitun_enb1 -c 20 $3 >> $4 2>&1" >> $1
+ echo "tail -3 $4" >> $1
+ else
+ echo "nohup ping -I oaitun_enb1 -c 20 $3 >> $4 &" >> $1
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
@@ -173,8 +257,15 @@ function check_ping_result {
then
echo "got all ping packets"
else
- echo "got NOT all ping packets"
- PING_STATUS=-1
+ LOC_NB_PINGS=$[$2-1]
+ ALL_PACKET_RECEIVED=`egrep -c "$LOC_NB_PINGS received" $LOC_PING_FILE`
+ if [ $ALL_PACKET_RECEIVED -eq 1 ]
+ then
+ echo "got almost all ping packets"
+ else
+ echo "got NOT all ping packets"
+ PING_STATUS=-1
+ fi
fi
fi
else
@@ -183,94 +274,141 @@ function check_ping_result {
fi
}
-function iperf_dl {
- local REQ_BANDWIDTH=$5
- local BASE_LOG_FILE=$6
- echo "echo \"iperf -u -s -i 1\"" > $1
- echo "echo \"COMMAND IS: iperf -u -s -i 1\" > tmp/cmake_targets/log/${BASE_LOG_FILE}_server.txt" > $1
- echo "nohup iperf -u -s -i 1 >> tmp/cmake_targets/log/${BASE_LOG_FILE}_server.txt &" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm $1
+# In DL: iperf server should be on UE side
+# -B oaitun_ue{j}-IP-Addr
+# iperf client should be on EPC (S1) or eNB (noS1) side
+# -c oaitun_ue{j}-IP-Addr -B oaitun_enb1-IP-Addr (in noS1)
+# In UL: iperf server should be on EPC (S1) or eNB (noS1) side
+# -B oaitun_enb1-IP-Addr
+# iperf client should be on UE side
+# -c oaitun_enb1-IP-Addr -B oaitun_ue{j}-IP-Addr (in noS1)
+function generic_iperf {
+ local LOC_ISERVER_CMD=$1
+ local LOC_ISERVER_IP=$2
+ local LOC_ISERVER_BOND_IP=$3
+ local LOC_ICLIENT_CMD=$4
+ local LOC_ICLIENT_IP=$5
+ local LOC_ICLIENT_BOND_IP=$6
+ local LOC_REQ_BANDWIDTH=$7
+ local LOC_BASE_LOG_FILE=$8
+ local LOC_PORT_ID=$[$9+5001]
+ local LOC_FG_OR_BG=${10}
+ # Starting Iperf Server
+ echo "iperf -B ${LOC_ISERVER_BOND_IP} -u -s -i 1 -fm -p ${LOC_PORT_ID}"
+ echo "nohup iperf -B ${LOC_ISERVER_BOND_IP} -u -s -i 1 -fm -p ${LOC_PORT_ID} > ${LOC_BASE_LOG_FILE}_server.txt 2>&1 &" > ${LOC_ISERVER_CMD}
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ISERVER_IP} < ${LOC_ISERVER_CMD}
+ rm ${LOC_ISERVER_CMD}
- echo "echo \"iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\"" > $3
- echo "echo \"COMMAND IS: iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\" > ${BASE_LOG_FILE}_client.txt" > $3
- echo "iperf -c $UE_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1 | tee -a ${BASE_LOG_FILE}_client.txt" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm -f $3
+ # Starting Iperf Client
+ echo "iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID}"
+ echo "echo \"COMMAND IS: iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID}\" > ${LOC_BASE_LOG_FILE}_client.txt" > ${LOC_ICLIENT_CMD}
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID} >> ${LOC_BASE_LOG_FILE}_client.txt 2>&1" >> ${LOC_ICLIENT_CMD}
+ echo "tail -3 ${LOC_BASE_LOG_FILE}_client.txt | grep -v datagram" >> ${LOC_ICLIENT_CMD}
+ else
+ echo "nohup iperf -c ${LOC_ISERVER_BOND_IP} -u -t 30 -b ${LOC_REQ_BANDWIDTH}M -i 1 -fm -B ${LOC_ICLIENT_BOND_IP} -p ${LOC_PORT_ID} >> ${LOC_BASE_LOG_FILE}_client.txt 2>&1 &" >> ${LOC_ICLIENT_CMD}
+ fi
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ICLIENT_IP} < ${LOC_ICLIENT_CMD}
+ rm -f ${LOC_ICLIENT_CMD}
- echo "killall --signal SIGKILL iperf" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm $1
-}
-
-function iperf_ul {
- local REQ_BANDWIDTH=$5
- local BASE_LOG_FILE=$6
- echo "echo \"iperf -u -s -i 1\"" > $3
- echo "echo \"COMMAND IS: iperf -u -s -i 1\" > ${BASE_LOG_FILE}_server.txt" > $3
- echo "nohup iperf -u -s -i 1 >> ${BASE_LOG_FILE}_server.txt &" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm $3
-
- echo "echo \"iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\"" > $1
- echo "echo \"COMMAND IS: iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1\" > /home/ubuntu/tmp/cmake_targets/log/${BASE_LOG_FILE}_client.txt" > $1
- echo "iperf -c $REAL_EPC_IP_ADDR -u -t 30 -b ${REQ_BANDWIDTH}M -i 1 | tee -a /home/ubuntu/tmp/cmake_targets/log/${BASE_LOG_FILE}_client.txt" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
- rm -f $1
-
- echo "killall --signal SIGKILL iperf" >> $3
- ssh -o StrictHostKeyChecking=no ubuntu@$4 < $3
- rm $3
+ # Stopping Iperf Server
+ if [ $LOC_FG_OR_BG -eq 0 ]
+ then
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > ${LOC_ISERVER_CMD}
+ ssh -T -o StrictHostKeyChecking=no ubuntu@${LOC_ISERVER_IP} < ${LOC_ISERVER_CMD}
+ rm ${LOC_ISERVER_CMD}
+ fi
}
function check_iperf {
local LOC_BASE_LOG=$1
local LOC_REQ_BW=$2
local LOC_REQ_BW_MINUS_ONE=`echo "$LOC_REQ_BW - 1" | bc -l`
+ local LOC_REQ_BW_MINUS_TWO=`echo "$LOC_REQ_BW - 2" | bc -l`
+ local LOC_REQ_BW_MINUS_THREE=`echo "$LOC_REQ_BW - 3" | bc -l`
+ local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl`
+ local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim`
if [ -f ${LOC_BASE_LOG}_client.txt ]
then
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
if [ $FILE_COMPLETE -eq 0 ]
then
IPERF_STATUS=-1
+ echo "File Report not found"
else
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
- if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
+ if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ]
then
- echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*Mbits.* ]]
+ then
+ echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ else
+ echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ IPERF_STATUS=-1
+ fi
else
- IPERF_STATUS=-1
+ if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
+ then
+ if [ $LOC_IS_DL -eq 1 ]
+ then
+ echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ else
+ echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH"
+ fi
+ else
+ echo "not basic-sim got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
+ IPERF_STATUS=-1
+ fi
fi
fi
else
IPERF_STATUS=-1
+ echo "File not found"
fi
}
function terminate_enb_ue_basic_sim {
+ # mode = 0 : eNB + UE
+ # mode = 1 : eNB
+ # mode = 2 : UE
+ local LOC_MODE=$3
echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" > $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=enb_daemon --stop\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=enb_daemon --stop; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=ue_daemon --stop\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=ue_daemon --stop; fi" >> $1
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 1 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=enb_daemon --stop\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=enb_daemon --stop; fi" >> $1
+ fi
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 2 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo daemon --name=ue_daemon --stop\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo daemon --name=ue_daemon --stop; fi" >> $1
+ fi
echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
echo "echo \"ps -aux | grep softmodem\"" >> $1
echo "ps -aux | grep softmodem | grep -v grep" >> $1
echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGINT lte-softmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGINT lte-softmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 1 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGINT lte-softmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGINT lte-softmodem; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ echo "echo \"ps -aux | grep softmodem\"" >> $1
+ echo "ps -aux | grep softmodem | grep -v grep" >> $1
+ echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-softmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-softmodem; fi" >> $1
+ fi
+ if [ $LOC_MODE -eq 0 ] || [ $LOC_MODE -eq 2 ]
+ then
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-uesoftmodem\"; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-uesoftmodem; fi" >> $1
+ echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
+ fi
echo "echo \"ps -aux | grep softmodem\"" >> $1
echo "ps -aux | grep softmodem | grep -v grep" >> $1
- echo "NB_OAI_PROCESSES=\`ps -aux | grep modem | grep -v grep | grep -c softmodem\`" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-softmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-softmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then echo \"sudo killall --signal SIGKILL lte-uesoftmodem\"; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sudo killall --signal SIGKILL lte-uesoftmodem; fi" >> $1
- echo "if [ \$NB_OAI_PROCESSES -ne 0 ]; then sleep 5; fi" >> $1
- echo "echo \"ps -aux | grep softmodem\"" >> $1
- echo "ps -aux | grep softmodem | grep -v grep" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
@@ -286,12 +424,39 @@ function recover_core_dump {
echo "sudo rm core" >> $1
echo "rm ci-lte-basic-sim.conf" >> $1
echo "sync" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/basic_simulator/enb/basic-simulator-enb-core-${TC}.bz2 $4
rm -f $1
fi
}
+function full_terminate {
+ echo "############################################################"
+ echo "Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ sleep 10
+}
+
+function full_basic_sim_destroy {
+ if [ $KEEP_VM_ALIVE -eq 0 ]
+ then
+ echo "############################################################"
+ echo "Destroying VMs"
+ echo "############################################################"
+ uvt-kvm destroy $VM_NAME
+ ssh-keygen -R $VM_IP_ADDR
+ if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
+ then
+ uvt-kvm destroy $FLEXRAN_CTL_VM_NAME
+ ssh-keygen -R $FLEXRAN_CTL_VM_IP_ADDR
+ fi
+ fi
+}
+
function install_epc_on_vm {
local LOC_EPC_VM_NAME=$1
local LOC_EPC_VM_CMDS=$2
@@ -299,7 +464,7 @@ function install_epc_on_vm {
if [ -d /opt/ltebox-archives/ ]
then
# Checking if all ltebox archives are available to run ltebx epc on a brand new VM
- if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ]
+ if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim-develop.zip ]
then
echo "############################################################"
echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox"
@@ -317,11 +482,18 @@ function install_epc_on_vm {
echo "############################################################"
echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base"
echo "############################################################"
+ acquire_vm_create_lock
uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $LOC_EPC_VM_NAME --insecure
+ release_vm_create_lock
+ else
+ echo "Waiting for VM to be started"
+ uvt-kvm wait $LOC_EPC_VM_NAME --insecure
fi
- uvt-kvm wait $LOC_EPC_VM_NAME --insecure
local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME`
+
echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR"
scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
@@ -330,7 +502,7 @@ function install_epc_on_vm {
if [ $LTEBOX -eq 1 ]
then
echo "ls -ls /opt/ltebox/tools/start_ltebox" > $LOC_EPC_VM_CMDS
- RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ RESPONSE=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
NB_EXES=`echo $RESPONSE | grep -c ltebox`
if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi
fi
@@ -342,7 +514,7 @@ function install_epc_on_vm {
echo "############################################################"
scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
- scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
+ scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim-develop.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu
echo "############################################################"
echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)"
@@ -356,8 +528,8 @@ function install_epc_on_vm {
# Installing HSS
echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS
echo "cd /opt" >> $LOC_EPC_VM_CMDS
- echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $LOC_EPC_VM_CMDS
- echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $LOC_EPC_VM_CMDS
+ echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim-develop.zip\"" >> $LOC_EPC_VM_CMDS
+ echo "sudo unzip -qq /home/ubuntu/hss-sim-develop.zip" >> $LOC_EPC_VM_CMDS
echo "echo \"cd /opt/hss_sim0609\"" >> $LOC_EPC_VM_CMDS
echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS
@@ -374,7 +546,29 @@ function install_epc_on_vm {
echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' gw.conf" >> $LOC_EPC_VM_CMDS
echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' mme.conf" >> $LOC_EPC_VM_CMDS
- ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ rm -f $LOC_EPC_VM_CMDS
+ fi
+}
+
+function add_user_to_epc_lists {
+ local LOC_EPC_VM_CMDS=$1
+ local LOC_EPC_VM_IP_ADDR=$2
+ local LOC_NB_USERS=$3
+ if [ $LTEBOX -eq 1 ]
+ then
+ scp -o StrictHostKeyChecking=no $JENKINS_WKSP/ci-scripts/add_user_to_subscriber_list.awk ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu/
+ echo "cd /opt/hss_sim0609" > $LOC_EPC_VM_CMDS
+ echo "if [ -e subscriber.data.orig ]; then sudo mv subscriber.data.orig subscriber.data; fi" >> $1
+ echo "if [ -e profile.data.orig ]; then sudo mv profile.data.orig profile.data; fi" >> $1
+ echo "sudo cp subscriber.data subscriber.data.orig" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp profile.data profile.data.orig" >> $LOC_EPC_VM_CMDS
+ echo "sudo awk -v num_ues=$LOC_NB_USERS -f /home/ubuntu/add_user_to_subscriber_list.awk subscriber.data.orig > /tmp/subscriber.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo awk -v num_ues=$LOC_NB_USERS -f /home/ubuntu/add_user_to_subscriber_list.awk profile.data.orig > /tmp/profile.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp /tmp/subscriber.data subscriber.data" >> $LOC_EPC_VM_CMDS
+ echo "sudo cp /tmp/profile.data profile.data" >> $LOC_EPC_VM_CMDS
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
rm -f $LOC_EPC_VM_CMDS
fi
}
@@ -398,8 +592,10 @@ function start_epc {
echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS
echo "echo \"sudo ./start_ltebox\"" >> $LOC_EPC_VM_CMDS
echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $LOC_EPC_VM_CMDS
+ echo "touch /home/ubuntu/try.txt" >> $LOC_EPC_VM_CMDS
+ echo "sudo rm -f /home/ubuntu/*.txt" >> $LOC_EPC_VM_CMDS
- ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS
rm -f $LOC_EPC_VM_CMDS
i="0"
@@ -407,7 +603,7 @@ function start_epc {
while [ $i -lt 10 ]
do
sleep 2
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
if [ $CONNECTED -eq 1 ]
then
i="100"
@@ -437,7 +633,7 @@ function retrieve_real_epc_ip_addr {
then
# in our configuration file, we are using pool 5
echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS
- REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
+ REAL_EPC_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS`
echo "EPC IP Address is : $REAL_EPC_IP_ADDR"
rm $LOC_EPC_VM_CMDS
fi
@@ -454,7 +650,7 @@ function terminate_epc {
echo "sudo daemon --name=simulated_hss --stop" >> $1
echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1
echo "sudo killall --signal SIGKILL hss_sim" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
fi
}
@@ -464,7 +660,7 @@ function start_flexran_ctrl {
echo "if [ -f cmake_targets/log/flexran_ctl_run.log ]; then rm -f cmake_targets/log/flexran_ctl_run.log cmake_targets/log/flexran_ctl_query*.log; fi" >> $1
echo "echo \" sudo build/rt_controller -c log_config/basic_log\"" >> $1
echo "nohup sudo build/rt_controller -c log_config/basic_log > cmake_targets/log/flexran_ctl_run.log 2>&1 &" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
sleep 10
}
@@ -472,7 +668,7 @@ function start_flexran_ctrl {
function stop_flexran_ctrl {
echo "echo \"sudo killall --signal SIGKILL rt_controller\"" > $1
echo "sudo killall --signal SIGKILL rt_controller" > $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
sleep 2
}
@@ -484,7 +680,7 @@ function query_flexran_ctrl_status {
echo "echo \"LOG_NAME: $LOC_MESSAGE\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
echo "echo \"------------------------------------------------------------\" >> cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
echo "curl http://localhost:9999/stats | jq '.' | tee -a cmake_targets/log/flexran_ctl_query_${LOC_MESSAGE}.log" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm $1
}
@@ -493,16 +689,6 @@ function build_ue_on_separate_folder {
echo "cd tmp-ue" >> $1
echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $1
echo "unzip -qq -DD ../localZip.zip" >> $1
-
- # We may have some adaptation to do
- if [ -f /opt/ltebox-archives/adapt_ue_l2_sim.txt ]
- then
- echo "############################################################"
- echo "Doing some adaptation on UE side"
- echo "############################################################"
- cat /opt/ltebox-archives/adapt_ue_l2_sim.txt >> $1
- fi
-
echo "echo \"source oaienv\"" >> $1
echo "source oaienv" >> $1
echo "cd cmake_targets/" >> $1
@@ -515,16 +701,19 @@ function build_ue_on_separate_folder {
echo "sudo chmod 666 /etc/iproute2/rt_tables" >> $1
echo "source init_nas_s1 UE" >> $1
echo "ifconfig" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1
rm -f $1
}
function start_l2_sim_enb {
- local LOC_VM_IP_ADDR=$2
+ local LOC_ENB_VM_IP_ADDR=$2
local LOC_EPC_IP_ADDR=$3
- local LOC_LOG_FILE=$4
- local LOC_NB_RBS=$5
- local LOC_CONF_FILE=$6
+ local LOC_UE_VM_IP_ADDR=$4
+ local LOC_LOG_FILE=$5
+ local LOC_NB_RBS=$6
+ local LOC_CONF_FILE=$7
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$8
echo "cd /home/ubuntu/tmp" > $1
echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
@@ -532,19 +721,24 @@ function start_l2_sim_enb {
echo "source oaienv" >> $1
echo "cd ci-scripts/conf_files/" >> $1
echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
- echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
- echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1
rm $1
local i="0"
@@ -552,7 +746,227 @@ function start_l2_sim_enb {
while [ $i -lt 10 ]
do
sleep 5
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1`
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ ENB_SYNC=1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "L2-SIM eNB is NOT sync'ed: process still alive?"
+ else
+ echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect"
+ fi
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_enb1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "L2-SIM eNB oaitun_enb1 is DOWN or NOT CONFIGURED"
+ else
+ echo "L2-SIM eNB oaitun_enb1 is UP and CONFIGURED"
+ fi
+ fi
+ sleep 10
+}
+
+function add_ue_l2_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_NB_UES=$3
+ echo "cd /home/ubuntu/tmp/" > $1
+ echo "source oaienv" >> $1
+ if [ $LOC_NB_UES -gt 1 ]
+ then
+ echo "echo \"cd openair3/NAS/TOOLS/\"" >> $1
+ echo "cd openair3/NAS/TOOLS/" >> $1
+ echo "echo \"awk -v num_ues=$LOC_NB_UES -f /home/ubuntu/tmp/ci-scripts/add_user_to_conf_file.awk ue_eurecom_test_sfr.conf > ue_eurecom_test_sfr_multi_ues.conf\"" >> $1
+ echo "awk -v num_ues=$LOC_NB_UES -f /home/ubuntu/tmp/ci-scripts/add_user_to_conf_file.awk ue_eurecom_test_sfr.conf > ue_eurecom_test_sfr_multi_ues.conf" >> $1
+ fi
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "sudo rm -f *.u*" >> $1
+ if [ $LOC_NB_UES -eq 1 ]
+ then
+ echo "echo \"sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .\"" >> $1
+ echo "sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o . > /home/ubuntu/tmp/cmake_targets/log/ue_adapt.txt 2>&1" >> $1
+ else
+ echo "echo \"sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr_multi_ues.conf -o .\"" >> $1
+ echo "sudo ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr_multi_ues.conf -o . > /home/ubuntu/tmp/cmake_targets/log/ue_adapt.txt 2>&1" >> $1
+ fi
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+}
+
+function start_l2_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_ENB_VM_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_CONF_FILE=$5
+ local LOC_NB_UES=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "cd /home/ubuntu/tmp/ci-scripts/conf_files/" >> $1
+ echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1 --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread $LOC_NB_UES --nokrnmod 1\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+
+ local i="0"
+ echo "egrep -c \"Received NFAPI_START_REQ\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ rm $1
+ UE_SYNC=1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "L2-SIM UE is NOT sync'ed w/ eNB"
+ return
+ else
+ echo "L2-SIM UE is sync'ed w/ eNB"
+ fi
+ local max_interfaces_to_check=1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]; then max_interfaces_to_check=$LOC_NB_UES; fi
+ local j="1"
+ while [ $j -le $max_interfaces_to_check ]
+ do
+ echo "ifconfig oaitun_ue${j} | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_ue1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "L2-SIM UE oaitun_ue${j} is DOWN or NOT CONFIGURED"
+ else
+ echo "L2-SIM UE oaitun_ue${j} is UP and CONFIGURED"
+ fi
+ j=$[$j+1]
+ done
+ sleep 10
+ # for debug
+ if [ $LOC_S1_CONFIGURATION -eq 1 ]
+ then
+ echo "ifconfig" > $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
+ fi
+}
+
+function full_l2_sim_destroy {
+ if [ $KEEP_VM_ALIVE -eq 0 ]
+ then
+ echo "############################################################"
+ echo "Destroying VMs"
+ echo "############################################################"
+ uvt-kvm destroy $ENB_VM_NAME
+ ssh-keygen -R $ENB_VM_IP_ADDR
+ uvt-kvm destroy $UE_VM_NAME
+ ssh-keygen -R $UE_VM_IP_ADDR
+ fi
+}
+
+function start_rf_sim_enb {
+ local LOC_ENB_VM_IP_ADDR=$2
+ local LOC_EPC_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_NB_RBS=$5
+ local LOC_CONF_FILE=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "cd /home/ubuntu/tmp" > $1
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "echo \"export RFSIMULATOR=enb\"" >> $1
+ echo "export RFSIMULATOR=enb" >> $1
+ echo "echo \"source oaienv\"" >> $1
+ echo "source oaienv" >> $1
+ echo "cd ci-scripts/conf_files/" >> $1
+ echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1
+ echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_ENB_VM_IP_ADDR#' -e 's#CI_UE_IP_ADDR#$LOC_UE_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1
+ echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1
+ echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
+ echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
+ echo "cat ./my-lte-softmodem-run.sh" >> $1
+ echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
+ echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
+
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1
+ rm $1
+
+ local i="0"
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
if [ $CONNECTED -ne 0 ]
then
i="100"
@@ -564,35 +978,98 @@ function start_l2_sim_enb {
if [ $i -lt 50 ]
then
ENB_SYNC=0
- echo "L2-SIM eNB is NOT sync'ed: process still alive?"
+ echo "RF-SIM eNB is NOT sync'ed: process still alive?"
else
ENB_SYNC=1
- echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect"
+ echo "RF-SIM eNB is sync'ed: waiting for UE(s) to connect"
fi
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
+ # Checking oaitun_enb1 interface has now an IP address
+ i="0"
+ while [ $i -lt 10 ]
+ do
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1`
+ if [ $CONNECTED -eq 1 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ sleep 5
+ fi
+ done
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ ENB_SYNC=0
+ echo "RF-SIM eNB oaitun_enb1 is DOWN or NOT CONFIGURED"
+ else
+ echo "RF-SIM eNB oaitun_enb1 is UP and CONFIGURED"
+ fi
+ fi
+ sleep 10
}
-function start_l2_sim_ue {
- local LOC_VM_IP_ADDR=$2
- local LOC_LOG_FILE=$3
- local LOC_CONF_FILE=$4
- echo "echo \"cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/\"" >> $1
- echo "sudo chmod 777 /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1
- echo "cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1
- echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp-ue/ci-scripts/conf_files/$LOC_CONF_FILE --L2-emul 3 --num-ues 1\" > ./my-lte-softmodem-run.sh " >> $1
+function start_rf_sim_ue {
+ local LOC_UE_VM_IP_ADDR=$2
+ local LOC_ENB_VM_IP_ADDR=$3
+ local LOC_LOG_FILE=$4
+ local LOC_PRB=$5
+ local LOC_FREQUENCY=$6
+ # 1 is with S1 and 0 without S1 aka noS1
+ local LOC_S1_CONFIGURATION=$7
+ echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
+ echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
+ echo "echo \"export RFSIMULATOR=${LOC_ENB_VM_IP_ADDR}\"" >> $1
+ echo "export RFSIMULATOR=${LOC_ENB_VM_IP_ADDR}" >> $1
+ echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1
+ echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1
+ if [ $LOC_S1_CONFIGURATION -eq 0 ]
+ then
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim --noS1\" > ./my-lte-softmodem-run.sh " >> $1
+ else
+ echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim\" > ./my-lte-softmodem-run.sh " >> $1
+ fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
- echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
+ echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1
- ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
rm $1
local i="0"
- echo "egrep -c \"Received NFAPI_START_REQ\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
+ echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
while [ $i -lt 10 ]
do
sleep 5
- CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1`
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
+ if [ $CONNECTED -ne 0 ]
+ then
+ i="100"
+ else
+ i=$[$i+1]
+ fi
+ done
+ UE_SYNC=1
+ rm $1
+ if [ $i -lt 50 ]
+ then
+ UE_SYNC=0
+ echo "RF-SIM UE is NOT sync'ed w/ eNB"
+ return
+ else
+ echo "RF-SIM UE is sync'ed w/ eNB"
+ fi
+ # Checking oaitun_ue1 interface has now an IP address
+ i="0"
+ echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
+ while [ $i -lt 10 ]
+ do
+ sleep 5
+ CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1`
if [ $CONNECTED -eq 1 ]
then
i="100"
@@ -604,35 +1081,66 @@ function start_l2_sim_ue {
if [ $i -lt 50 ]
then
UE_SYNC=0
- echo "L2-SIM UE is NOT sync'ed w/eNB"
+ echo "RF-SIM UE oaitun_ue1 is DOWN or NOT CONFIGURED"
else
- UE_SYNC=1
- echo "L2-SIM UE is sync'ed w/eNB"
+ echo "RF-SIM UE oaitun_ue1 is UP and CONFIGURED"
fi
sleep 10
}
+
function run_test_on_vm {
echo "############################################################"
echo "OAI CI VM script"
echo "############################################################"
- echo "VM_NAME = $VM_NAME"
- echo "VM_CMD_FILE = $VM_CMDS"
+ if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
+ then
+ ENB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#enb-ethernet#" -e "s#rf-sim#enb-ethernet#"`
+ ENB_VM_CMDS=${ENB_VM_NAME}_cmds.txt
+ echo "ENB_VM_NAME = $ENB_VM_NAME"
+ echo "ENB_VM_CMD_FILE = $ENB_VM_CMDS"
+ UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#ue-ethernet#" -e "s#rf-sim#ue-ethernet#"`
+ UE_VM_CMDS=${UE_VM_NAME}_cmds.txt
+ echo "UE_VM_NAME = $UE_VM_NAME"
+ echo "UE_VM_CMD_FILE = $UE_VM_CMDS"
+ else
+ echo "VM_NAME = $VM_NAME"
+ echo "VM_CMD_FILE = $VM_CMDS"
+ fi
echo "JENKINS_WKSP = $JENKINS_WKSP"
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
- echo "############################################################"
- echo "Waiting for VM to be started"
- echo "############################################################"
- uvt-kvm wait $VM_NAME --insecure
+ if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) || (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
+ then
+ echo "############################################################"
+ echo "Waiting for ENB VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $ENB_VM_NAME --insecure
- VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
- echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ ENB_VM_IP_ADDR=`uvt-kvm ip $ENB_VM_NAME`
+ echo "$ENB_VM_NAME has for IP addr = $ENB_VM_IP_ADDR"
+
+ echo "############################################################"
+ echo "Waiting for UE VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $UE_VM_NAME --insecure
+
+ UE_VM_IP_ADDR=`uvt-kvm ip $UE_VM_NAME`
+ echo "$UE_VM_NAME has for IP addr = $UE_VM_IP_ADDR"
+ else
+ echo "############################################################"
+ echo "Waiting for VM to be started"
+ echo "############################################################"
+ uvt-kvm wait $VM_NAME --insecure
+
+ VM_IP_ADDR=`uvt-kvm ip $VM_NAME`
+ echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
+ fi
if [ "$RUN_OPTIONS" == "none" ]
then
echo "No run on VM testing for this variant currently"
- exit $STATUS
+ return
fi
if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
@@ -656,7 +1164,7 @@ function run_test_on_vm {
echo "cd log" >> $VM_CMDS
echo "zip -r -qq tmp.zip *.* 0*" >> $VM_CMDS
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
echo "############################################################"
echo "Creating a tmp folder to store results and artifacts"
@@ -762,182 +1270,91 @@ function run_test_on_vm {
# Retrieve EPC real IP address
retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
- # We may have some adaptation to do
- if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ]
- then
- echo "############################################################"
- echo "Doing some adaptation on UE side"
- echo "############################################################"
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt
- fi
+ TRANS_MODES=("fdd" "tdd")
+ BW_CASES=(05 10 20)
- echo "############################################################"
- echo "Starting the eNB in FDD-5MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-fdd-basic-sim.conf none
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ # Not Running in TDD-10MHz and TDD-20MHz : too unstable
+ #if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then continue; fi
+ #if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then continue; fi
- echo "############################################################"
- echo "Starting the UE in FDD-5MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2680
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
+ if [[ $BW =~ .*05.* ]]; then PRB=25; fi
+ if [[ $BW =~ .*10.* ]]; then PRB=50; fi
+ if [[ $BW =~ .*20.* ]]; then PRB=100; fi
+ if [[ $TMODE =~ .*fdd.* ]]; then FREQUENCY=2680; else FREQUENCY=2350; fi
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_05MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ echo "############################################################"
+ echo "Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_enb.log
+ start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB lte-${TMODE}-basic-sim.conf none
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
+ echo "############################################################"
+ echo "Starting the UE in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_ue.log
+ start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ full_basic_sim_destroy
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+ get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
- echo "############################################################"
- echo "Iperf UL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_05MHz_iperf_ul
- iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2
+ echo "############################################################"
+ echo "Pinging the UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_ping_ue.txt
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
+ # Not more testing in any TDD : too unstable
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*05.* ]]; then full_terminate; continue; fi
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*10.* ]]; then full_terminate; continue; fi
+ if [[ $TMODE =~ .*tdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi
+ echo "############################################################"
+ echo "Iperf DL"
+ echo "############################################################"
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ if [[ $BW =~ .*20.* ]]; then THROUGHPUT=12; else THROUGHPUT=10; fi
+ else
+ THROUGHPUT=6
+ fi
+ CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_dl
+ generic_iperf $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
- echo "############################################################"
- echo "Starting the eNB in FDD-10MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_10MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-fdd-basic-sim.conf none
+ # Not more testing in FDD-20MHz : too unstable
+ if [[ $TMODE =~ .*fdd.* ]] && [[ $BW =~ .*20.* ]]; then full_terminate; continue; fi
+ echo "############################################################"
+ echo "Iperf UL"
+ echo "############################################################"
+ THROUGHPUT=2
+ CURR_IPERF_LOG_BASE=${TMODE}_${BW}MHz_iperf_ul
+ generic_iperf $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $VM_CMDS $VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 0 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
- echo "############################################################"
- echo "Starting the UE in FDD-10MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_10MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2680
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
+ full_terminate
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_10MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
-
- echo "############################################################"
- echo "Iperf UL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_10MHz_iperf_ul
- iperf_ul $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 2 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 2
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in FDD-20MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_20MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-fdd-basic-sim.conf none
-
- echo "############################################################"
- echo "Starting the UE in FDD-20MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_20MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2680
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_20MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=fdd_20MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 15 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 15
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
+ done
+ done
if [ -d $JENKINS_WKSP/flexran ]
then
@@ -961,7 +1378,8 @@ function run_test_on_vm {
echo "ERROR: compiling flexran controller on vm went wrong"
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
+ STATUS=-1
+ return
fi
FLEXRAN_CTL_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#flexran-rtc#"`
FLEXRAN_CTL_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#flexran-rtc-cmds#"`
@@ -970,8 +1388,10 @@ function run_test_on_vm {
then
echo "ERROR: Flexran Ctl VM is not alive"
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ full_basic_sim_destroy
echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
+ STATUS=-1
+ return
fi
uvt-kvm wait $FLEXRAN_CTL_VM_NAME --insecure
FLEXRAN_CTL_VM_IP_ADDR=`uvt-kvm ip $FLEXRAN_CTL_VM_NAME`
@@ -999,23 +1419,24 @@ function run_test_on_vm {
if [ $UE_SYNC -eq 0 ]
then
echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR
echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
+ STATUS=-1
+ return
fi
query_flexran_ctrl_status $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR 03_enb_ue_connected
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
+ get_ue_ip_addr $VM_CMDS $VM_IP_ADDR 1
sleep 30
echo "############################################################"
echo "Terminate enb/ue simulators"
echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
+ terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR 0
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
@@ -1028,179 +1449,13 @@ function run_test_on_vm {
scp -o StrictHostKeyChecking=no ubuntu@$FLEXRAN_CTL_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/flexran_ctl_*.log $ARCHIVES_LOC
fi
- echo "############################################################"
- echo "Starting the eNB in TDD-5MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=tdd_05MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 lte-tdd-basic-sim.conf none
-
- echo "############################################################"
- echo "Starting the UE in TDD-5MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=tdd_05MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 25 2350
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=tdd_05MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
-# Bug in TDD 5Mhz --- not running it
-# echo "############################################################"
-# echo "Iperf DL"
-# echo "############################################################"
-# CURR_IPERF_LOG_BASE=tdd_05MHz_iperf_dl
-# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
-# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
-# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
- echo "############################################################"
- echo "Starting the eNB in TDD-10MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=tdd_10MHz_enb.log
- start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 50 lte-tdd-basic-sim.conf none
-
- echo "############################################################"
- echo "Starting the UE in TDD-10MHz mode"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=tdd_10MHz_ue.log
- start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 50 2350
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
- get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-
- echo "############################################################"
- echo "Pinging the UE"
- echo "############################################################"
- PING_LOG_FILE=tdd_10MHz_ping_ue.txt
- ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-
- echo "############################################################"
- echo "Iperf DL"
- echo "############################################################"
- CURR_IPERF_LOG_BASE=tdd_10MHz_iperf_dl
- iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
- scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
- check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- sleep 10
-
-# Disabling TDD-20MHz in order to stop getting false negatives
-# echo "############################################################"
-# echo "Starting the eNB in TDD-20MHz mode"
-# echo "############################################################"
-# CURRENT_ENB_LOG_FILE=tdd_20MHz_enb.log
-# start_basic_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 100 lte-tdd-basic-sim.conf none
-#
-# echo "############################################################"
-# echo "Starting the UE in TDD-20MHz mode"
-# echo "############################################################"
-# CURRENT_UE_LOG_FILE=tdd_20MHz_ue.log
-# start_basic_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE 100 2350
-# if [ $UE_SYNC -eq 0 ]
-# then
-# echo "Problem w/ eNB and UE not syncing"
-# terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
-# recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-# terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
-# echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
-# exit -1
-# fi
-# get_ue_ip_addr $VM_CMDS $VM_IP_ADDR
-#
-# echo "############################################################"
-# echo "Pinging the UE"
-# echo "############################################################"
-# PING_LOG_FILE=tdd_20MHz_ping_ue.txt
-# ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE
-# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
-# check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
-#
-# echo "############################################################"
-# echo "Iperf DL"
-# echo "############################################################"
-# CURR_IPERF_LOG_BASE=tdd_20MHz_iperf_dl
-# iperf_dl $VM_CMDS $VM_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR 6 $CURR_IPERF_LOG_BASE
-# scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
-# check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE 6
-#
-# echo "############################################################"
-# echo "Terminate enb/ue simulators"
-# echo "############################################################"
-# terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-# scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
-# recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
-# sleep 10
-
echo "############################################################"
echo "Terminate EPC"
echo "############################################################"
terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- if [ $KEEP_VM_ALIVE -eq 0 ]
- then
- echo "############################################################"
- echo "Destroying VMs"
- echo "############################################################"
- uvt-kvm destroy $VM_NAME
- ssh-keygen -R $VM_IP_ADDR
- uvt-kvm destroy $EPC_VM_NAME
- ssh-keygen -R $EPC_VM_IP_ADDR
- if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
- then
- uvt-kvm destroy $FLEXRAN_CTL_VM_NAME
- ssh-keygen -R $FLEXRAN_CTL_VM_IP_ADDR
- fi
- fi
+ full_basic_sim_destroy
echo "############################################################"
echo "Checking run status"
@@ -1217,6 +1472,193 @@ function run_test_on_vm {
fi
fi
+ if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
+ then
+ PING_STATUS=0
+ IPERF_STATUS=0
+ if [ -d $ARCHIVES_LOC ]
+ then
+ rm -Rf $ARCHIVES_LOC
+ fi
+ mkdir --parents $ARCHIVES_LOC
+
+ # Creating a VM for EPC and installing SW
+ EPC_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#epc#"`
+ EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
+ LTEBOX=0
+ install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
+ EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
+
+ # withS1 configuration is not working
+ #EPC_CONFIGS=("wS1" "noS1")
+ #TRANS_MODES=("fdd" "tdd")
+ #BW_CASES=(05 10 20)
+ EPC_CONFIGS=("noS1")
+ TRANS_MODES=("fdd")
+ BW_CASES=(05)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo "############################################################"
+ echo "Start EPC for the wS1 configuration"
+ echo "############################################################"
+ start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ # Retrieve EPC real IP address
+ retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ S1_NOS1_CFG=1
+ else
+ echo "############################################################"
+ echo "Terminate EPC"
+ echo "############################################################"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "Running now in a no-S1 configuration"
+ echo "############################################################"
+ S1_NOS1_CFG=0
+ fi
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ CONF_FILE=enb.band7.tm1.50PRB.usrpb210.conf
+ FREQUENCY=2680
+ else
+ CONF_FILE=enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf
+ FREQUENCY=2350
+ fi
+ for BW in ${BW_CASES[@]}
+ do
+ if [[ $BW =~ .*05.* ]]; then PRB=25; fi
+ if [[ $BW =~ .*10.* ]]; then PRB=50; fi
+ if [[ $BW =~ .*20.* ]]; then PRB=100; fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_enb.log
+ start_rf_sim_enb $ENB_VM_CMDS $ENB_VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the UE"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ue.log
+ start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ fi
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the EPC from UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_epc.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the eNB from UE"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_enb_from_ue.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE from EPC"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_ue.log
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE from eNB"
+ echo "############################################################"
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ping_from_enb_ue.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ fi
+
+ if [ $S1_NOS1_CFG -eq 0 ]
+ then
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
+ echo "############################################################"
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ THROUGHPUT=4
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf UL -- eNB is server and UE is client"
+ echo "############################################################"
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul
+ THROUGHPUT=2
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+
+ done
+ done
+ done
+
+ full_l2_sim_destroy
+
+ echo "############################################################"
+ echo "Checking run status"
+ echo "############################################################"
+
+ if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $STATUS -eq 0 ]
+ then
+ echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
+ else
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ fi
+ fi
+
if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-l2-sim.* ]]
then
PING_STATUS=0
@@ -1228,80 +1670,298 @@ function run_test_on_vm {
mkdir --parents $ARCHIVES_LOC
# Building UE elsewhere in VM
- build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR
+ #build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR
# Creating a VM for EPC and installing SW
- EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#l2-epc#"`
+ EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#epc#"`
EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt
LTEBOX=0
install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS
EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME`
- # Starting EPC
- start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ # adding 16 users to EPC subscriber lists
+ add_user_to_epc_lists $EPC_VM_CMDS $EPC_VM_IP_ADDR 16
- # Retrieve EPC real IP address
- retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ EPC_CONFIGS=("wS1" "noS1")
+ TRANS_MODES=("fdd")
+ BW_CASES=(05)
+ NB_USERS=(01 04)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo "############################################################"
+ echo "Start EPC for the wS1 configuration"
+ echo "############################################################"
+ start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "############################################################"
- echo "Starting the eNB in FDD-5MHz mode"
- echo "############################################################"
- CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log
- start_l2_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf
+ # Retrieve EPC real IP address
+ retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ S1_NOS1_CFG=1
+ else
+ echo "############################################################"
+ echo "Terminate EPC"
+ echo "############################################################"
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "############################################################"
- echo "Starting the UEs"
- echo "############################################################"
- CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log
- start_l2_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf
- if [ $UE_SYNC -eq 0 ]
- then
- echo "Problem w/ eNB and UE not syncing"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
- echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
- exit -1
- fi
+ echo "############################################################"
+ echo "Running now in a no-S1 configuration"
+ echo "############################################################"
+ S1_NOS1_CFG=0
+ fi
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ for UES in ${NB_USERS[@]}
+ do
+ INT_NB_UES=`echo $UES | sed -e "s#^0*##"`
+ echo "############################################################"
+ echo "${CN_CONFIG} : Adding ${INT_NB_UES} UE(s) to conf file and recompile"
+ echo "############################################################"
+ add_ue_l2_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $INT_NB_UES
- echo "############################################################"
- echo "Pinging the EPC from UE"
- echo "############################################################"
- PING_LOG_FILE=fdd_05MHz_ping_epc.txt
- ping_epc_ip_addr $VM_CMDS $VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
- check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the eNB in ${TMODE}-${BW}MHz mode"
+ echo "############################################################"
+ CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log
+ start_l2_sim_enb $ENB_VM_CMDS $ENB_VM_IP_ADDR $EPC_VM_IP_ADDR $UE_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf $S1_NOS1_CFG
- echo "############################################################"
- echo "Terminate enb/ue simulators"
- echo "############################################################"
- terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
- scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the UE for ${INT_NB_UES} user(s)"
+ echo "############################################################"
+ CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ue.log
+ start_l2_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf $INT_NB_UES $S1_NOS1_CFG
+ if [ $UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ eNB and UE not syncing"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ fi
+ full_l2_sim_destroy
+ echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log
+ STATUS=-1
+ return
+ fi
- echo "############################################################"
- echo "Terminate EPC"
- echo "############################################################"
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1
- terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the EPC from UE(s)"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_epc.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $REAL_EPC_IP_ADDR $PING_LOG_FILE 1 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
- if [ $KEEP_VM_ALIVE -eq 0 ]
- then
- echo "############################################################"
- echo "Destroying VMs"
- echo "############################################################"
- uvt-kvm destroy $VM_NAME
- ssh-keygen -R $VM_IP_ADDR
- uvt-kvm destroy $EPC_VM_NAME
- ssh-keygen -R $EPC_VM_IP_ADDR
- fi
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the eNB from UE(s)"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_seq_from_ue${j}.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE ${j} 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_para_from_ue${j}.log
+ ping_epc_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE ${j} 1
+ j=$[$j+1]
+ done
+ sleep 25
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_enb_para_from_ue${j}.log
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ if [ $S1_NOS1_CFG -eq 1 ]
+ then
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE(s) from EPC"
+ echo "############################################################"
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_ue.log
+ ping_ue_ip_addr $EPC_VM_CMDS $EPC_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ else
+ echo "############################################################"
+ echo "${CN_CONFIG} : Pinging the UE(s) from eNB"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_seq_ue${j}.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_para_ue${j}.log
+ ping_enb_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 1
+ j=$[$j+1]
+ done
+ sleep 25
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ PING_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping_from_enb_para_ue${j}.log
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/$PING_LOG_FILE
+ check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ if [ $S1_NOS1_CFG -eq 0 ]
+ then
+ get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_seq_ue${j}
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ THROUGHPUT=3
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 0
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_para_ue${j}
+ THROUGHPUT=1
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 1
+ j=$[$j+1]
+ done
+ sleep 35
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > $UE_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR < $UE_VM_CMDS
+ rm $UE_VM_CMDS
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl_para_ue${j}
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/${IPERF_LOG_FILE}_client.txt | grep -v datagram
+ #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : iperf UL -- eNB is server and UE is client"
+ echo "############################################################"
+ echo " --- Sequentially ---"
+ local j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_seq_ue${j}
+ THROUGHPUT=2
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 0
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ if [ $INT_NB_UES -gt 1 ]
+ then
+ echo " --- In parallel ---"
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_para_ue${j}
+ THROUGHPUT=1
+ get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR $j
+ generic_iperf $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE $j 1
+ j=$[$j+1]
+ done
+ sleep 35
+ echo "killall --signal SIGKILL iperf"
+ echo "killall --signal SIGKILL iperf" > $UE_VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR < $UE_VM_CMDS
+ rm $UE_VM_CMDS
+ j="1"
+ while [ $j -le $INT_NB_UES ]
+ do
+ IPERF_LOG_FILE=${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul_para_ue${j}
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC
+ tail -3 $ARCHIVES_LOC/${IPERF_LOG_FILE}_client.txt | grep -v datagram
+ #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT
+ j=$[$j+1]
+ done
+ fi
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate enb/ue simulators"
+ echo "############################################################"
+ terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1
+ terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2
+ scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC
+
+ done
+ done
+ done
+ done
+
+ full_l2_sim_destroy
echo "############################################################"
echo "Checking run status"
echo "############################################################"
if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi
+ if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi
if [ $STATUS -eq 0 ]
then
echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log
diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh
index 2820b88647..6bf20a7f4d 100755
--- a/ci-scripts/waitBuildOnVM.sh
+++ b/ci-scripts/waitBuildOnVM.sh
@@ -98,7 +98,7 @@ function wait_on_vm_build {
echo "while [ \$(ps -aux | grep --color=never build_oai | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS
fi
- ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
rm -f $VM_CMDS
}
@@ -124,11 +124,16 @@ function check_on_vm_build {
if [ $KEEP_VM_ALIVE -eq 0 ]
then
+ if [[ "$VM_NAME" == *"-enb-ethernet"* ]] || [[ "$VM_NAME" == *"-ue-ethernet"* ]]
+ then
+ echo "Hack to not destroy in current pipeline"
+ else
echo "############################################################"
echo "Destroying VM"
echo "############################################################"
uvt-kvm destroy $VM_NAME
ssh-keygen -R $VM_IP_ADDR
+ fi
fi
rm -f $VM_CMDS
@@ -185,10 +190,16 @@ function check_on_vm_build {
fi
fi
+ if [[ "$VM_NAME" == *"-cppcheck"* ]]
+ then
+ echo "COMMAND: cppcheck $BUILD_OPTIONS . 2> cppcheck.xml" > $ARCHIVES_LOC/build_final_status.log
+ else
+ echo "COMMAND: build_oai -I $BUILD_OPTIONS" > $ARCHIVES_LOC/build_final_status.log
+ fi
if [[ $STATUS -eq 0 ]]
then
- echo "BUILD_OK" > $ARCHIVES_LOC/build_final_status.log
+ echo "BUILD_OK" >> $ARCHIVES_LOC/build_final_status.log
else
- echo "BUILD_KO" > $ARCHIVES_LOC/build_final_status.log
+ echo "BUILD_KO" >> $ARCHIVES_LOC/build_final_status.log
fi
}
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml
new file mode 100644
index 0000000000..8587db959d
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_closure.xml
@@ -0,0 +1,48 @@
+
+
+ epc-closure
+ EPC-Closure
+ log-out
+
+ 050201 060201 070201
+
+
+
+
+
+ Terminate_HSS
+ Terminate HSS
+
+
+
+ Terminate_MME
+ Terminate MME
+
+
+
+ Terminate_SPGW
+ Terminate SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml
new file mode 100644
index 0000000000..e22c5b4da2
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_epc_start.xml
@@ -0,0 +1,47 @@
+
+
+ epc-start
+ EPC-Start
+ log-in
+
+ 050101 060101 070101
+
+
+
+
+ Initialize_HSS
+ Initialize HSS
+
+
+
+ Initialize_MME
+ Initialize MME
+
+
+
+ Initialize_SPGW
+ Initialize SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml
new file mode 100644
index 0000000000..cded08284a
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml
@@ -0,0 +1,117 @@
+
+
+ test-05-tm1-nos1-tunnel
+ Test-05MHz-TM1-noS1-tunnel
+ tasks
+
+ 030201 090109
+ 030101 000001 090101 000002 040501 040502 000001 040601 040641 040642 000001 090109 030201
+
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 60
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --noS1
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE (FDD/Band7/5MHz)
+ -C 2680000000 -r 25 --ue-rxgain 120 --ue-txgain 0 --ue-max-power 0 --ue-scan-carrier --nokrnmod 1 --noS1
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)(from eNB to OAI UE)
+ -I oaitun_enb1 -c 20 10.0.1.2
+ 5
+
+
+
+ Ping
+ ping (5MHz - 20 sec)(from OAI UE to eNB)
+ -I oaitun_ue1 -c 20 10.0.1.1
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/1Mbps/UDP)(30 sec)
+ -c 10.0.1.2 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.1
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - DL/1.2Mbps/UDP)(30 sec)
+ -c 10.0.1.2 -u -b 1.2M -t 30 -i 1 -fm -B 10.0.1.1
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - UL/1Mbps/UDP)(30 sec)
+ -c 10.0.1.1 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.2 -R
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (5MHz - UL/8Mbps/UDP)(30 sec)
+ -c 10.0.1.1 -u -b 8M -t 30 -i 1 -fm -B 10.0.1.2 -R
+ 50
+ balanced
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml
new file mode 100644
index 0000000000..15735d94db
--- /dev/null
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml
@@ -0,0 +1,104 @@
+
+
+ test-05-tm1-tunnel
+ Test-05MHz-TM1-tunnel
+ tasks
+
+ 030201 090109
+ 030102 000001 090102 000002 040503 000001 040603 040643 040644 000001 090109 030201
+
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE (FDD/Band7/5MHz)
+ -C 2680000000 -r 25 --ue-rxgain 120 --ue-txgain 0 --ue-max-power 0 --ue-scan-carrier --nokrnmod 1
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/1Mbps/UDP)(30 sec)
+ -u -b 1M -t 30 -i 1 -fm
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - DL/1.2Mbps/UDP)(30 sec)
+ -b 1.2M -t 30 -i 1 -fm
+ 50
+
+
+
+ Iperf
+ iperf (5MHz - UL/1Mbps/UDP)(30 sec)
+ -u -b 1M -t 30 -i 1 -fm -R
+ 50
+ balanced
+
+
+
+ Iperf
+ iperf (5MHz - UL/8Mbps/UDP)(30 sec)
+ -u -b 8M -t 30 -i 1 -fm -R
+ 50
+ balanced
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_build.xml b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
new file mode 100644
index 0000000000..24283a52d0
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
@@ -0,0 +1,55 @@
+
+
+ build-tab
+ Build
+ wrench
+
+ 010101
+ 050101 060101 070101
+
+
+
+
+
+ Build_eNB
+ Build eNB (USRP)
+ -w USRP -c --eNB
+
+
+
+ Initialize_HSS
+ Initialize HSS
+
+
+
+ Initialize_MME
+ Initialize MME
+
+
+
+ Initialize_SPGW
+ Initialize SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml b/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml
new file mode 100644
index 0000000000..07fb6951f8
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_epc_closure.xml
@@ -0,0 +1,47 @@
+
+
+ epc-closure
+ EPC-Closure
+ log-out
+
+ 050201 060201 070201
+
+
+
+
+ Terminate_HSS
+ Terminate HSS
+
+
+
+ Terminate_MME
+ Terminate MME
+
+
+
+ Terminate_SPGW
+ Terminate SPGW
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml
new file mode 100644
index 0000000000..5425428bc2
--- /dev/null
+++ b/ci-scripts/xml_files/enb_usrp210_band13_test_10mhz_tm1.xml
@@ -0,0 +1,79 @@
+
+
+ test-10-tm1
+ Test-10MHz-TM1
+ tasks
+
+ 030201
+ 040102
+ 030121 000001 040302 000001 040502 000001 040402 040202 000001 030201
+
+
+
+
+
+ IdleSleep
+ Waiting for a moment...
+ 15
+
+
+
+ Initialize_eNB
+ Initialize eNB (FDD/Band13/10MHz)
+ -O ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf
+
+
+
+ Terminate_eNB
+ Terminate eNB
+
+
+
+ Initialize_CatM_module
+ Initialize CAT-M Module
+
+
+
+ Terminate_CatM_module
+ Terminate CAT-M Module
+
+
+
+ Attach_CatM_module
+ Attach CAT-M Module
+
+
+
+ Detach_CatM_module
+ Detach CAT-M Module
+
+
+
+ Ping_CatM_module
+ ping (10MHz - 20 sec)
+ -c 20
+ 5
+
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
index d5a25c7fa7..7fa7814238 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm1.xml
@@ -25,8 +25,9 @@
Test-05MHz-TM1
tasks
+ 030201
040101
- 030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201
+ 030104 040301 040501 040602 040601 040603 040604 040605 040642 040641 040643 040644 040645 040401 040201 030201
@@ -92,6 +93,21 @@
unbalanced
+
+ Iperf
+ iperf (5MHz - DL/TCP)(30 sec)(single-ue profile)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
Iperf
iperf (5MHz - UL/2Mbps/UDP)(30 sec)(balanced)
@@ -116,4 +132,19 @@
unbalanced
+
+ Iperf
+ iperf (5MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
index ef50933d4a..7c1b4dc85c 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_10mhz_tm1.xml
@@ -25,8 +25,9 @@
Test-10MHz-TM1
tasks
+ 030201
040101
- 030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201
+ 030114 040301 040511 040612 040611 040613 040614 040615 040652 040651 040653 040654 040655 040401 040201 030201
@@ -92,6 +93,21 @@
unbalanced
+
+ Iperf
+ iperf (10MHz - DL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
Iperf
iperf (10MHz - UL/2Mbps/UDP)(30 sec)(balanced)
@@ -116,4 +132,19 @@
unbalanced
+
+ Iperf
+ iperf (10MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
index 9a96baac3f..bcbf742ef7 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml
@@ -25,8 +25,9 @@
Test-20MHz-TM1
tasks
+ 030201
040101
- 030124 040301 040521 040622 040621 040623 040662 040661 040663 040401 040201 030201
+ 030124 040301 040521 040622 040621 040623 040624 040625 040662 040661 040663 040664 040665 040401 040201 030201
@@ -92,6 +93,21 @@
unbalanced
+
+ Iperf
+ iperf (20MHz - DL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - DL/TCP)(30 sec)
+ -t 30 -i 1 -fm
+ 50
+
+
Iperf
iperf (20MHz - UL/2Mbps/UDP)(30 sec)(balanced)
@@ -116,4 +132,19 @@
unbalanced
+
+ Iperf
+ iperf (20MHz - UL/TCP)(30 sec)(single-ue)
+ -t 30 -i 1 -fm -R
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/TCP)(30 sec)
+ -t 30 -i 1 -fm -R
+ 50
+
+
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
index 0057eaefa4..edc87c90ff 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-05MHz-TM1
tasks
+ 030201
040101
030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
index 92ec1efa6e..ccbe71cd14 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-10MHz-TM1
tasks
+ 030201
040101
030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
index b6c441b19a..03263bb86f 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_test_20mhz_tm1.xml
@@ -25,6 +25,7 @@
Test-20MHz-TM1
tasks
+ 030201
040101
030121 040301 040521 040623 040624 040625 040662 040401 040201 030201
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml
new file mode 100644
index 0000000000..fdf795fb30
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_05mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-05
+ Test-F1-CU/DU-05MHz
+ tasks
+
+ 030201
+ 040101
+ 030142 030141 040301 040541 040601 040641 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/5MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.25PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (5MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 9M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml
new file mode 100644
index 0000000000..3592759fc6
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_10mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-10
+ Test-F1-CU/DU-10MHz
+ tasks
+
+ 030201
+ 040101
+ 030152 030151 040301 040551 040611 040651 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/10MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/10MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.50PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (10MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (10MHz - DL/32Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 32M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (10MHz - UL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml
new file mode 100644
index 0000000000..f2cb155127
--- /dev/null
+++ b/ci-scripts/xml_files/f1_usrp210_band7_test_20mhz.xml
@@ -0,0 +1,104 @@
+
+
+ test-f1-20
+ Test-F1-CU/DU-20MHz
+ tasks
+
+ 030201
+ 040101
+ 030162 030161 040301 040561 040621 040661 040401 040201 030201 030202
+
+
+
+
+
+ Initialize_eNB
+ Initialize DU (FDD/Band7/20MHz)
+ -O ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf
+ 1
+
+
+
+ Initialize_eNB
+ Initialize CU (FDD/Band7/20MHz)
+ -O ci-scripts/conf_files/cu.band7.tm1.100PRB.conf
+ 0
+
+
+
+ Terminate_eNB
+ Terminate CU
+ 0
+
+
+
+ Terminate_eNB
+ Terminate DU
+ 1
+
+
+
+ Initialize_UE
+ Initialize UE
+
+
+
+ Terminate_UE
+ Terminate UE
+
+
+
+ Attach_UE
+ Attach UE
+
+
+
+ Detach_UE
+ Detach UE
+
+
+
+ Ping
+ ping (20MHz - 20 sec)
+ -c 20
+ 5
+
+
+
+ Iperf
+ iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 70M -t 30 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (20MHz - UL/15Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 15M -t 30 -i 1 -R
+ 60
+ single-ue
+
+
+
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
index 1de23d05d6..daa5c6fa43 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_05mhz.xml
@@ -25,6 +25,7 @@
Test-05MHz
tasks
+ 030201
040101
030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (TDD/Band40)
- -O ci-scripts/conf_files/rru.tdd.band40.conf
+ -O ci-scripts/conf_files/rru.tdd.band40.conf --RUs.[0].max_rxgain 125
0
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
index 6bc37db17a..2638814cf6 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml
@@ -25,6 +25,7 @@
Test-10MHz
tasks
+ 030201
040101
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (TDD/Band40)
- -O ci-scripts/conf_files/rru.tdd.band40.conf
+ -O ci-scripts/conf_files/rru.tdd.band40.conf --RUs.[0].max_rxgain 120
0
@@ -96,7 +97,7 @@
Iperf
iperf (10MHz - UL/2Mbps/UDP)(30 sec)(single-ue)
-u -b 2M -t 30 -i 1 -R
- 50
+ 60
single-ue
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml
index 512c958105..a2356891f1 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml
@@ -25,6 +25,7 @@
Test-20MHz
tasks
+ 030201
040101
030124 030125 040301 040521 040622 040662 040401 040201 030201 030202
@@ -37,7 +38,7 @@
-O ci-scripts/conf_files/rru.tdd.band40.conf
0
-
+
Initialize_eNB
Initialize RCC (TDD/Band40/20MHz/info)
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
index b0501e9875..1464a4a624 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_05mhz.xml
@@ -21,10 +21,11 @@
-->
- test-05
- Test-05MHz
+ test-if4p5-05
+ Test-IF4.5-05MHz
tasks
+ 030201
040101
030101 030102 040301 040501 040604 040642 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (FDD/Band7)
- -O ci-scripts/conf_files/rru.fdd.band7.conf
+ -O ci-scripts/conf_files/rru.fdd.band7.conf --RUs.[0].max_rxgain 125
1
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
index 88fb30b840..1649e91b3e 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_10mhz.xml
@@ -21,10 +21,11 @@
-->
- test-10
- Test-10MHz
+ test-if4p5-10
+ Test-IF4.5-10MHz
tasks
+ 030201
040101
030111 030112 040301 040511 040614 040652 040401 040201 030201 030202
@@ -34,7 +35,7 @@
Initialize_eNB
Initialize RRU (FDD/Band7)
- -O ci-scripts/conf_files/rru.fdd.band7.conf
+ -O ci-scripts/conf_files/rru.fdd.band7.conf --RUs.[0].max_rxgain 120
1
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
index 798fc1bc8f..d98fce2e83 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_test_20mhz.xml
@@ -21,10 +21,11 @@
-->
- test-20
- Test-20MHz
+ test-if4p5-20
+ Test-IF4.5-20MHz
tasks
+ 030201
040101
030121 030122 040301 040521 040624 040662 040401 040201 030201 030202
diff --git a/ci-scripts/xml_files/ue_band20_build.xml b/ci-scripts/xml_files/ue_band20_build.xml
new file mode 100644
index 0000000000..9ca1a2b234
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_build.xml
@@ -0,0 +1,38 @@
+
+
+ build-tab
+ Build
+ wrench
+
+090101
+
+
+
+
+ Build_OAI_UE
+ Build OAI UE
+ -w USRP --UE
+
+
+
diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml
new file mode 100644
index 0000000000..594ea7b923
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml
@@ -0,0 +1,50 @@
+
+
+ test-10mhz-orange
+ Test-10Mhz-Orange
+ tasks
+
+ 090109
+ 090110 000001 090109
+
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE -- sniffing Orange frequency
+ -C 816000000 -r 50 --ue-rxgain 135 --ue-scan-carrier --no-L2-connect --nokrnmod 1
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml
new file mode 100644
index 0000000000..89370be983
--- /dev/null
+++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml
@@ -0,0 +1,50 @@
+
+
+ test-10mHz-sfr
+ Test-10MHz-SFR
+ tasks
+
+ 090109
+ 090111 000001 090109
+
+
+
+
+ Initialize_OAI_UE
+ Initialize OAI UE -- sniffing SFR frequency
+ -C 806000000 -r 50 --ue-rxgain 130 --ue-scan-carrier --no-L2-connect --nokrnmod 1
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+ Terminate_OAI_UE
+ Terminate OAI UE
+
+
+
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index ecb9b314f2..7ff9e11297 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -21,7 +21,7 @@
# Author: laurent THOMAS, Lionel GAUTHIER
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.0)
#############################################
# Base directories, compatible with legacy OAI building
@@ -169,13 +169,13 @@ endif()
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
# add autotools definitions that were maybe used!
+set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
set(CMAKE_C_FLAGS
- "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
+ "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}"
)
set(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
+ "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 -D${MKVER}"
)
-add_definitions("-DASN_DISABLE_OER_SUPPORT")
#########################
@@ -227,7 +227,6 @@ add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_CO
add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
-
# Debug related options
#########################################
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
@@ -250,7 +249,7 @@ add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros")
add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode")
-add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko")
+#add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko")
add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
@@ -382,7 +381,7 @@ file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
add_custom_target (
s1ap_flag ALL
${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
)
add_library(S1AP_LIB
@@ -469,15 +468,62 @@ add_library(X2AP_ENB
${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_management_procedures.c
${X2AP_DIR}/x2ap_eNB_generate_messages.c
+ ${X2AP_DIR}/x2ap_ids.c
+ ${X2AP_DIR}/x2ap_timers.c
)
add_dependencies(X2AP_ENB rrc_flag x2_flag)
+# F1AP
+##############
+add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
+set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
+if (${F1AP_RELEASE} STREQUAL "R15")
+ make_version(F1AP_VERSION 15 2 1)
+ set (ASN1RELDIR R15.2.1)
+endif(${F1AP_RELEASE} STREQUAL "R15")
+add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
+set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
+set(F1AP_ASN_FILES
+ ${F1AP_ASN_DIR}/F1AP-CommonDataTypes.asn
+ ${F1AP_ASN_DIR}/F1AP-Constants.asn
+ ${F1AP_ASN_DIR}/F1AP-PDU-Descriptions.asn
+ ${F1AP_ASN_DIR}/F1AP-PDU-Contents.asn
+ ${F1AP_ASN_DIR}/F1AP-IEs.asn
+ ${F1AP_ASN_DIR}/F1AP-Containers.asn
+ )
+
+set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
+message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
+execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
+ COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ RESULT_VARIABLE ret
+ OUTPUT_QUIET
+ ERROR_QUIET)
+
+if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "asn1c: error")
+endif (NOT ${ret} STREQUAL 0)
+
+file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
+add_library(F1AP_LIB
+ ${F1AP_ASN_GENERATED_C_FILES}
+)
+
+include_directories ("${F1AP_ASN_GENERATED_C_DIR}")
+include_directories ("${F1AP_DIR}")
+
+file(GLOB F1AP_C_FILES ${F1AP_DIR}/*.c)
+add_library(F1AP
+ ${F1AP_C_FILES}
+)
+
# Hardware dependant options
###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
-add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
+add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR" "OAI_SIMU")
+
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
#NOKIA config enhancement
@@ -585,6 +631,8 @@ set(HWLIB_TCP_BRIDGE_OAI_SOURCE
add_library(tcp_bridge_oai MODULE ${HWLIB_TCP_BRIDGE_OAI_SOURCE} )
set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+add_library(rfsimulator MODULE ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c)
+
##########################################################
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
@@ -595,7 +643,6 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}")
##############################################################
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
-add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB")
add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
@@ -693,10 +740,10 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE
##########################
# PDCP LAYER OPTIONS
##########################
-add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
-add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
-add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
-add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
+#add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
+#add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
+#add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver")
+#add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")
##########################
# RRC LAYER OPTIONS
@@ -743,6 +790,8 @@ include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
include_directories("${OPENAIR1_DIR}")
include_directories("${OPENAIR2_DIR}")
+include_directories("${OPENAIR3_DIR}/NAS/TOOLS")
+include_directories("${OPENAIR2_DIR}/ENB_APP")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0")
@@ -765,19 +814,21 @@ include_directories("${OPENAIR3_DIR}/SECU")
include_directories("${OPENAIR3_DIR}/SCTP")
include_directories("${OPENAIR3_DIR}/S1AP")
include_directories("${OPENAIR2_DIR}/X2AP")
+include_directories("${OPENAIR2_DIR}/F1AP")
include_directories("${OPENAIR3_DIR}/UDP")
include_directories("${OPENAIR3_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
-include_directories("${OPENAIR2_DIR}/ENB_APP")
+include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP")
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
+include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT")
include_directories("${OPENAIR2_DIR}/UTIL/MEM")
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
@@ -819,7 +870,7 @@ set(FLPT_MSG_FILES
${FLPT_MSG_DIR}/control_delegation.proto
)
-set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
+set(FLPT_C_DIR ${protobuf_generated_dir}/FLPT_${FLPTDIR})
#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
@@ -862,6 +913,7 @@ add_library(FLEXRAN_AGENT
${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
+ ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
@@ -887,6 +939,63 @@ MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)
#set(PROTOBUF_LIB "protobuf") #for Cpp
+# set the version of protobuf messages, V3 not supported yet
+add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3)
+
+if (${FSPT_VERSION} STREQUAL "V2")
+ set (FSPTDIR V2)
+elseif (${FSPT_VERSION} STREQUAL "V3")
+ set (FSPTDIR V3)
+endif(${FSPT_VERSION} STREQUAL "V2")
+
+set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} )
+set(FSPT_MSG_FILES
+ ${FSPT_MSG_DIR}/flexsplit.proto
+ )
+
+set(FSPT_C_DIR ${protobuf_generated_dir}/FSPT_${FSPTDIR})
+message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_DIR=${FSPT_MSG_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}")
+execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES})
+file(GLOB FSPT_source ${FSPT_C_DIR}/*.c)
+set(FSPT_OAI_generated
+ ${FSPT_C_DIR}/flexsplit.pb-c.c
+ )
+
+file(GLOB fspt_h ${FSPT_C_DIR}/*.h)
+set(fspt_h ${fspt_h} )
+
+add_library(FSPT_MSG
+ ${FSPT_OAI_generated}
+ ${FSPT_source}
+ )
+set(FSPT_MSG_LIB FSPT_MSG)
+message("fspt c dir is : ${FSPT_C_DIR}")
+include_directories (${FSPT_C_DIR})
+
+# add_library(ASYNC_IF
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
+# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
+# )
+# set(ASYNC_IF_LIB ASYNC_IF)
+# include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
+
+add_library(PROTO_AGENT
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ )
+set(PROTO_AGENT_LIB PROTO_AGENT)
+include_directories(${OPENAIR2_DIR}/LAYER2/PROTO_AGENT)
+
+
+
+set(PROTOBUF_LIB "protobuf-c")
+
+#set(PROTOBUF_LIB "protobuf") #for Cpp
add_library(HASHTABLE
${OPENAIR_DIR}/common/utils/hashtable/hashtable.c
@@ -909,7 +1018,7 @@ set(UTIL_SRC
${OPENAIR_DIR}/common/utils/LOG/log.c
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c
- ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
+ #${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
# ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
@@ -1284,7 +1393,7 @@ set(L2_SRC
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
- ${RRC_DIR}/rrc_UE.c
+# ${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_S1AP.c
${RRC_DIR}/rrc_eNB_UE_context.c
@@ -1950,6 +2059,8 @@ add_executable(lte-softmodem
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.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
@@ -1967,11 +2078,39 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
target_link_libraries (lte-softmodem
-Wl,--start-group
- RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
- ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+ RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
+add_executable(cu_test
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ ${T_SOURCE}
+)
+target_link_libraries(cu_test
+ ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
+ ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
+)
+
+add_executable(du_test
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/du_test.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+ ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c
+ ${T_SOURCE}
+)
+target_link_libraries(du_test
+ ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB}
+ ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
+)
+
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
@@ -1994,26 +2133,29 @@ add_executable(lte-softmodem-nos1
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
+ ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${GTPU_need_ITTI}
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
+
add_dependencies(lte-softmodem-nos1 rrc_flag s1ap_flag x2_flag)
+
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
- RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${RAL_LIB} ${ITTI_LIB}
- ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
+ RRC_LIB F1AP F1AP_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
- -Wl,--end-group z dl )
+ -Wl,--end-group z dl)
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${T_LIB})
-
# lte-uesoftmodem is UE implementation
#######################################
@@ -2027,6 +2169,8 @@ add_executable(lte-uesoftmodem
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.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
@@ -2043,7 +2187,7 @@ add_executable(lte-uesoftmodem
add_dependencies(lte-uesoftmodem rrc_flag s1ap_flag x2_flag)
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
- RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
+ RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
@@ -2070,6 +2214,7 @@ add_executable(lte-uesoftmodem-nos1
${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/utils.c
${OPENAIR_DIR}/common/utils/system.c
${XFORMS_SOURCE}
@@ -2080,18 +2225,18 @@ add_executable(lte-uesoftmodem-nos1
)
add_dependencies(lte-uesoftmodem-nos1 rrc_flag s1ap_flag x2_flag)
+
target_link_libraries (lte-uesoftmodem-nos1
-Wl,--start-group
- RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU ${RAL_LIB} ${ITTI_LIB}
- ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
+ RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
- -Wl,--end-group z dl )
+ -Wl,--end-group z dl)
target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB})
-
# USIM process
#################
#add_executable(usim
@@ -2142,11 +2287,12 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
+ ${NFAPI_USER_DIR}/nfapi.c
)
target_link_libraries (${myExe}
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
- pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
+ pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
@@ -2159,7 +2305,7 @@ add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
+ -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
add_executable(test_epc_play_scenario
@@ -2178,7 +2324,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
+ -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
@@ -2212,15 +2358,15 @@ if (${T_TRACER})
#all "add_executable" definitions (except tests, rb_tool, updatefw)
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
- pdcchsim pucchsim prachsim syncsim ulsim
+ pdcchsim pucchsim prachsim syncsim ulsim cu_test du_test
#all "add_library" definitions
- ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB
+ ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP_LIB F1AP
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
- SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
- GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX
- coding)
+ SECU_CN SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY L2 default_sched
+ remote_sched RAL CN_UTILS GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS
+ LFDS7 SIMU OPENAIR0_LIB PHY_MEX coding)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index fc4567269e..bf3d57af0d 100644
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -990,11 +990,11 @@
$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash
$OPENAIR_DIR/targets/bin/ulsim.Rel14
- -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
- -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
+ -BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=100 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
ulsim.test1 ulsim.test2 ulsim.test3 ulsim.test4 ulsim.test5 ulsim.test6
"passed"
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
index 398b763888..d99ca88807 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
index 46b6484737..86c54a82f7 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
index 93b82773e6..dad0ab5a23 100644
--- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
index b412b00e52..369b6184fd 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
index f0d688903a..14ae99c80c 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
index 929c91fffb..9302ac7c58 100644
--- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
index 98358eb269..0ae9e659b4 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
index bc31e051e5..1d22c19ec8 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
index 2cfc227e67..3f35175ff4 100644
--- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
+++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
@@ -141,6 +141,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
index 9b135a9498..0a6a8cccc6 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
index 9f84057299..7ffdd063a6 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
index 7197e93322..409fa49910 100644
--- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
+++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
@@ -143,6 +143,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 2728cac9b1..9d8a609671 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -76,7 +76,7 @@ trap handle_ctrl_c INT
function print_help() {
echo_info "
This program installs OpenAirInterface Software
-You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
+You should have ubuntu 16.xx or 18.04 updated
Options
-h
This help
@@ -103,6 +103,8 @@ Options
Specify conf_nvram_path (default \"$conf_nvram_path\")
--UE-gen-nvram [output path]
Specify gen_nvram_path (default \"$gen_nvram_path\")
+-a | --agent
+ Enables agent for software-defined control of the eNB
-r | --3gpp-release
default is Rel14,
Rel8 limits the implementation to 3GPP Release 8 version
@@ -167,6 +169,9 @@ Options
--basic-simulator
Generates a basic [1 UE + 1 eNB + no channel] simulator.
See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation.
+--rfsimulator
+ Generate virtual RF driver
+ to use it, set the environement variable RFSIMULATOR to \"enb\" in the eNB and to the eNB IP address in the UEs
Usage (first build):
NI/ETTUS B201 + COTS UE : ./build_oai -I --eNB -x --install-system-files -w USRP
Usage (Regular):
@@ -234,25 +239,21 @@ function main() {
echo_info "Setting release to: $REL"
shift 2;;
-w | --hardware)
- HW="$2" #"${i#*=}"
# Use OAI_USRP as the key word USRP is used inside UHD driver
- if [ "$HW" != "BLADERF" -a "$HW" != "USRP" -a "$HW" != "LMSSDR" -a "$HW" != "None" -a "$HW" != "EXMIMO" -a "$HW" != "IRIS" ] ; then
- echo_fatal "Unknown HW type $HW will exit..."
- else
- if [ "$HW" == "USRP" ] ; then
- HW="OAI_USRP"
- fi
- if [ "$HW" == "BLADERF" ] ; then
- HW="OAI_BLADERF"
- fi
- if [ "$HW" == "LMSSDR" ] ; then
- HW="OAI_LMSSDR"
- fi
- if [ "$HW" == "IRIS" ] ; then
- HW="OAI_IRIS"
- fi
+ case "$2" in
+ "EXMIMO")
+ HW="EXMIMO"
+ ;;
+ "USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "SIMU")
+ HW="OAI_"$2
+ ;;
+ "None")
+ HW="None"
+ ;;
+ *)
+ echo_fatal "Unknown HW type $HW: exit..."
+ esac
echo_info "Setting hardware to: $HW"
- fi
shift 2;;
-t | --transport_protocol)
TP="$2" #"${i#*=}"
@@ -374,6 +375,10 @@ function main() {
BASIC_SIMULATOR=1
echo_info "Compiling the basic simulator"
shift 1;;
+ --rfsimulator)
+ RFSIMULATOR=true
+ echo_info "Compiling the RF simulator"
+ shift 1;;
-h | --help)
print_help
exit 1;;
@@ -386,11 +391,6 @@ function main() {
CMAKE_CMD="$CMAKE_CMD .."
echo_info "CMAKE_CMD=$CMAKE_CMD"
- if [ "$eNB" = "1" ] && [ "$UE" = "1" ]; then
- echo_error "Cannot build UE and eNB on one build_oai execution"
- echo_error "use 2 build_oai invocations"
- exit
- fi
#########################################################
# check validity of HW and TP parameters for eNB
#########################################################
@@ -409,33 +409,17 @@ function main() {
fi
echo_info "RF HW set to $HW"
- #Now we set flags to enable deadline scheduler settings
- #By default: USRP: disable,
- #By default: BLADERF: enable,
- #By default: EXMIMO: enable
- if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
- if [ "$HW" = "EXMIMO" ] ; then
+ # If the user doesn't specify the Linux scheduler to use, we set a value
+ if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
+ case "$HW" in
+ "EXMIMO")
DEADLINE_SCHEDULER_FLAG_USER="True"
- elif [ "$HW" = "ETHERNET" ] ; then
+ ;;
+ *)
DEADLINE_SCHEDULER_FLAG_USER="False"
- elif [ "$HW" = "OAI_USRP" ] ; then
- DEADLINE_SCHEDULER_FLAG_USER="False"
- elif [ "$HW" = "OAI_BLADERF" ] ; then
- DEADLINE_SCHEDULER_FLAG_USER="False"
- elif [ "$HW" = "OAI_LMSSDR" ] ; then
- DEADLINE_SCHEDULER_FLAG_USER="False"
- elif [ "$HW" = "OAI_IRIS" ] ; then
- DEADLINE_SCHEDULER_FLAG_USER="False"
- elif [ "$HW" = "None" ] ; then
- DEADLINE_SCHEDULER_FLAG_USER="False"
- else
- echo_error "Unknown HW type $HW. Exiting now..."
- exit
- fi
- else
- DEADLINE_SCHEDULER_FLAG_USER=$FORCE_DEADLINE_SCHEDULER_FLAG_USER
+ ;;
+ esac
fi
-
#Disable CPU Affinity for deadline scheduler
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
CPU_AFFINITY_FLAG_USER="False"
@@ -516,26 +500,19 @@ function main() {
echo_info "3. building the compilation directives ..."
DIR=$OPENAIR_DIR/cmake_targets
- if [ "$NOS1" = "1" ] ; then
- lte_build_dir=lte_noS1_build_oai
- if [ "$eNB" = "1" ] ; then
- lte_exec=lte-softmodem-nos1
- fi
- if [ "$UE" = "1" ] ; then
- lte_exec=lte-uesoftmodem-nos1
+
+ if [ "$T_TRACER" = "False" ] ; then
+ noLOGDirsuffix="_noLOG"
fi
+ if [ "$NOS1" = "1" ] ; then
+ noS1Dir="_noS1"
+ bin_suffix="-nos1"
else
lte_build_dir=lte_build_oai
- if [ "$eNB" = "1" ] ; then
- lte_exec=lte-softmodem
- fi
- if [ "$UE" = "1" ] ; then
- lte_exec=lte-uesoftmodem
- fi
- fi
- if [ "$T_TRACER" = "False" ] ; then
- lte_build_dir=${lte_build_dir}_noLOG
+ bin_suffix=""
fi
+
+ lte_build_dir="lte${noS1Dir}_build_oai${noLOGDirsuffix}"
# configuration module libraries, one currently available, using libconfig
config_libconfig_shlib=params_libconfig
@@ -547,9 +524,9 @@ function main() {
mkdir -p $DIR/$lte_build_dir/build
cmake_file=$DIR/$lte_build_dir/CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
- if [ "$NOS1" = "1" ] ; then
- cat $DIR/$lte_build_dir/CMakeLists.template >> $cmake_file
- fi
+# if [ "$NOS1" = "1" ] ; then
+# cat $DIR/$lte_build_dir/CMakeLists.template >> $cmake_file
+# fi
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file
@@ -580,8 +557,8 @@ function main() {
eval $CMAKE_CMD
fi
- if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
- echo_info "Compiling $lte_exec"
+ if [ "$eNB" = "1" ] ; then
+ lte_exec=lte-softmodem${bin_suffix}
compilations \
$lte_build_dir $lte_exec \
$lte_exec $dbin/$lte_exec.$REL
@@ -605,7 +582,29 @@ function main() {
fi
fi
- if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
+ if [ "$UE" = 1 ] ; then
+ lte_exec=lte-uesoftmodem${bin_suffix}
+ compilations \
+ $lte_build_dir $lte_exec \
+ $lte_exec $dbin/$lte_exec.$REL
+
+ # mandatory shared lib
+ compilations \
+ $lte_build_dir $config_libconfig_shlib \
+ lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
+ compilations \
+ $lte_build_dir coding \
+ libcoding.so $dbin/libcoding.so
+
+ if [ "$NOS1" = "1" ] ; then
+ compilations \
+ $lte_build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ compilations \
+ $lte_build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+ cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+ else
# ue_ip driver compilation
echo_info "Compiling UE specific part"
compilations \
@@ -645,6 +644,7 @@ function main() {
echo_warning "not generated UE NAS files: binaries not found"
fi
fi
+ fi
if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
cd $OPENAIR_DIR/cmake_targets/lte-simulators
@@ -709,23 +709,19 @@ function main() {
cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
fi
-
-
# Telnet server compilation
#####################
if [ "$BUILD_TELNETSRV" = "1" ] ; then
- build_dir=$lte_build_dir
compilations \
- $build_dir telnetsrv \
+ $lte_build_dir telnetsrv \
libtelnetsrv.so $dbin/libtelnetsrv.so
fi
- # Telnet server compilation
+ # msc library compilation
#####################
if [ "$MSC_GEN" = "1" ] ; then
- build_dir=$lte_build_dir
compilations \
- $build_dir msc \
+ $lte_build_dir msc \
libmsc.so $dbin/libmsc.so
fi
@@ -733,8 +729,6 @@ function main() {
#####################################
if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
- build_dir=$lte_build_dir
-
# build RF device libraries
if [ "$HW" != "None" ] ; then
rm -f liboai_device.so
@@ -743,7 +737,7 @@ function main() {
# link liboai_device.so with the selected RF device library
if [ "$HW" == "EXMIMO" ] ; then
compilations \
- $build_dir oai_exmimodevif \
+ $lte_build_dir oai_exmimodevif \
liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
ln -sf liboai_exmimodevif.so liboai_device.so
@@ -751,7 +745,7 @@ function main() {
echo_info "liboai_device.so is linked to EXMIMO device library"
elif [ "$HW" == "OAI_USRP" ] ; then
compilations \
- $build_dir oai_usrpdevif \
+ $lte_build_dir oai_usrpdevif \
liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
ln -sf liboai_usrpdevif.so liboai_device.so
@@ -760,7 +754,7 @@ function main() {
elif [ "$HW" == "OAI_BLADERF" ] ; then
if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_bladerfdevif \
+ $lte_build_dir oai_bladerfdevif \
liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
fi
@@ -768,18 +762,18 @@ function main() {
ln -sf $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to BLADERF device library"
elif [ "$HW" == "OAI_LMSSDR" ] ; then
-# if [ -f "/usr/include/libbladeRF.h" ] ; then
+ # if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_lmssdrdevif \
+ $lte_build_dir oai_lmssdrdevif \
liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
-# fi
+ # fi
ln -sf liboai_lmssdrdevif.so liboai_device.so
ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
echo_info "liboai_device.so is linked to LMSSDR device library"
elif [ "$HW" == "OAI_IRIS" ] ; then
compilations \
- $build_dir oai_irisdevif \
+ $lte_build_dir oai_irisdevif \
liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
ln -s liboai_irisdevif.so liboai_device.so
@@ -790,22 +784,33 @@ function main() {
fi
fi
- # build trasport protocol libraries (currently only ETHERNET is available)
- if [ "$TP" != "None" ] ; then
+ # build simulators devices
+ echo_info "Compiling rfsimulator"
+ compilations \
+ $lte_build_dir rfsimulator \
+ librfsimulator.so $dbin/librfsimulator.so.$REL
+ echo_info "Compiling basicsimulator"
+ compilations \
+ $lte_build_dir tcp_bridge_oai \
+ libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
+ # build transport protocol libraries (currently only ETHERNET is available)
+
rm -f liboai_transpro.so
rm -f $dbin/liboai_transpro.so
-
- if [ "$TP" == "ETHERNET" ] ; then
compilations \
- $build_dir oai_eth_transpro \
+ $lte_build_dir oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -sf liboai_eth_transpro.so liboai_transpro.so
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
- echo_info "liboai_transpro.so is linked with ETHERNET library"
- fi
+ echo_info "liboai_transpro.so is linked to ETHERNET transport"
fi
-fi
+ if [ "$RFSIMULATOR" == "true" -o "$HW" == "OAI_SIMU" ] ; then
+ echo_info "Compiling rfsimulator"
+ compilations \
+ $lte_build_dir rfsimulator \
+ librfsimulator.so $dbin/librfsimulator.so.$REL
+ fi
# Doxygen Support
#####################
@@ -936,7 +941,7 @@ fi
echo "set (LINUX True )" >> $cmake_file
echo "set (PDCP_USE_NETLINK True )" >> $cmake_file
echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file
- echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file
+# echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file
echo_info "Build UE"
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
index e046bb7539..7a097fffb0 100644
--- a/cmake_targets/epc_test/CMakeLists.template
+++ b/cmake_targets/epc_test/CMakeLists.template
@@ -9,7 +9,6 @@ set ( EMIT_ASN_DEBUG False )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index 22faac75b5..cffbddc93c 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -8,7 +8,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
index b18b23ee9a..eac29006da 100644
--- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
@@ -8,7 +8,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME False )
set ( ENABLE_USE_MME False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index bc416cff55..343e928090 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -7,7 +7,6 @@ set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME False )
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
index 9f1ff3e360..e62df04bc6 100644
--- a/cmake_targets/s1c_mme_test/CMakeLists.template
+++ b/cmake_targets/s1c_mme_test/CMakeLists.template
@@ -9,7 +9,6 @@ set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_RAL False )
-set ( ENABLE_SECURITY True )
set ( ENABLE_STANDALONE_EPC False)
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set ( ENABLE_USE_MME True )
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index acfb75b1a8..0021b673f2 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -102,6 +102,7 @@ check_supported_distribution() {
"ubuntu14.04") return 0 ;;
"fedora24") return 0 ;;
"rhel7") return 0 ;;
+ "rhel7.6") return 0 ;;
"centos7") return 0 ;;
esac
return 1
@@ -310,10 +311,20 @@ install_usrp_uhd_driver() {
# On newer kernels, it fails to install
$SUDO apt-get -y install uhd-host
fi
+ # quick workaround for RHE7.6
+ local distribution=$(get_distribution_release)
if [ -z $1 ]; then
- $SUDO uhd_images_downloader
+ if [[ "$distribution" == "rhel7.6" ]]; then
+ $SUDO /usr/local/bin/uhd_images_downloader
+ else
+ $SUDO uhd_images_downloader
+ fi
else
- $SUDO uhd_images_downloader -i $1
+ if [[ "$distribution" == "rhel7.6" ]]; then
+ $SUDO /usr/local/bin/uhd_images_downloader -i $1
+ else
+ $SUDO uhd_images_downloader -i $1
+ fi
fi
}
@@ -628,8 +639,6 @@ check_install_oai_software() {
libidn2-0-dev \
libidn11-dev \
libmysqlclient-dev \
- liboctave-dev \
- libpgm-dev \
libpython2.7-dev \
libsctp1 \
libsctp-dev \
@@ -640,7 +649,6 @@ check_install_oai_software() {
libxml2-dev \
libxslt1-dev \
mscgen \
- octave \
octave-signal \
openssh-client \
openssh-server \
@@ -652,7 +660,8 @@ check_install_oai_software() {
pydb \
libyaml-dev \
wget \
- libxpm-dev
+ libxpm-dev \
+ libboost-all-dev
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
@@ -700,8 +709,6 @@ check_install_oai_software() {
libidn2-devel \
libidn-devel \
mariadb-devel \
- octave-devel \
- openpgm-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
@@ -711,8 +718,6 @@ check_install_oai_software() {
libxml2 \
libxml2-devel \
libxslt-devel \
- octave \
- octave-signal \
openssh-clients \
openssh-server \
openssl \
@@ -735,7 +740,7 @@ check_install_oai_software() {
libyaml-devel
fi
- install_asn1c_from_source
+ install_asn1c_from_source $1
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
}
diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1
index fe819c2716..1486589a0c 100755
--- a/cmake_targets/tools/fix_asn1
+++ b/cmake_targets/tools/fix_asn1
@@ -23,7 +23,7 @@ reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
- exit 1
+# exit 1
}
function check_sha1()
@@ -56,11 +56,11 @@ function patch_file()
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
- patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
- if [ $? -ne 0 ]
- then
- error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
- fi
+# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
+# if [ $? -ne 0 ]
+# then
+# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
+# fi
}
function apply_patches()
@@ -140,6 +140,22 @@ function patch_s1ap()
esac
}
+function patch_f1ap()
+{
+ local directory="$1"
+ local version="$2"
+
+ case "$version" in
+ R15 )
+ #nothing to do anymore (fixes went to asn1c)
+ ;;
+ * )
+ error unknwon/unhandled F1AP version \'"$version"\'
+ ;;
+ esac
+}
+
+
function main()
{
if [ $# -ne 3 ]
@@ -167,6 +183,9 @@ function main()
S1AP )
patch_s1ap "$directory" "$version"
;;
+ F1AP )
+ patch_f1ap "$directory" "$version"
+ ;;
* )
error unknown module "$module"
;;
diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1
index 79becbf288..b382730c6a 100755
--- a/cmake_targets/tools/generate_asn1
+++ b/cmake_targets/tools/generate_asn1
@@ -2,23 +2,29 @@
function main()
{
-mkdir -p $1
-cd $1
+PROTOCOL_DIR=$1
+mkdir -p ${PROTOCOL_DIR}
+cd ${PROTOCOL_DIR}
+
+# Because use $* also include directory, so we need shift
shift
-#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
-#(there may be a better way...)
-if [ $# -eq 1 ]; then
+# There are three types parameter for asn1c
+# One is for RRC
+# and one is for F1AP
+# another is for other protocols
-#asn1c does not work well with extension groups, we need the following fix:
-# replace [[ by ' SEQUENCE {'
-# and ]] by '} OPTIONAL'
-# is ext with N starting from 1 and incremented at each new [[ ]] just
-#following another [[ ]]
-#
-#this is what the following C program does
+if echo ${PROTOCOL_DIR} | grep -q "RRC"; then
-echo generate asnfix.c
+ #asn1c does not work well with extension groups, we need the following fix:
+ # replace [[ by ' SEQUENCE {'
+ # and ]] by '} OPTIONAL'
+ # is ext with N starting from 1 and incremented at each new [[ ]] just
+ #following another [[ ]]
+ #
+ #this is what the following C program does
+
+ echo generate asnfix.c
cat << EOF > asnfix.c
/* transforms:
@@ -85,30 +91,34 @@ int main(void)
}
EOF
-echo compile asnfix.c
+ echo compile asnfix.c
-gcc -Wall -o asnfix asnfix.c
+ gcc -Wall -o asnfix asnfix.c
-echo run asnfix on $1
+ echo run asnfix on $1
-./asnfix < $1 > fixed_grammar.asn
+ ./asnfix < $1 > fixed_grammar.asn
-rm -f asnfix asnfix.c
+ rm -f asnfix asnfix.c
-echo done with asnfix
+ echo done with asnfix
-echo running asn1c
+ echo running asn1c
-asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+ asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
-rm -f fixed_grammar.asn
+ rm -f fixed_grammar.asn
-echo asn1c done
+ echo asn1c done
+elif echo ${PROTOCOL_DIR} | grep -q "F1AP"; then
+
+ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+
else
-
-asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
-
+
+ asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+
fi
awk '
diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh
index bd4254c938..a7f480f90f 100755
--- a/cmake_targets/tools/make_asn1c_includes.sh
+++ b/cmake_targets/tools/make_asn1c_includes.sh
@@ -3,11 +3,11 @@ GENERATED_FULL_DIR=$1
shift
ASN1_SOURCE_DIR=$1
shift
-export ASN1C_PREFIX=$1
+export ASN1C_PREFIX=$1
shift
options=$*
done_flag="$GENERATED_FULL_DIR"/done
-if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
+if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
diff --git a/common/config/DOC/config/arch.md b/common/config/DOC/config/arch.md
index 170241500b..f888724c41 100644
--- a/common/config/DOC/config/arch.md
+++ b/common/config/DOC/config/arch.md
@@ -1,7 +1,7 @@
# config module source files
-
+
# config module components

-[Configuration module home](../config.md)
\ No newline at end of file
+[Configuration module home](../config.md)
diff --git a/common/config/DOC/config/devusage.md b/common/config/DOC/config/devusage.md
index bfc1180ab8..151ffeafa8 100644
--- a/common/config/DOC/config/devusage.md
+++ b/common/config/DOC/config/devusage.md
@@ -1,17 +1,17 @@
-The configuration module objectives are
+The configuration module objectives are
1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem.
1. Use a common configuration API in all oai modules
-1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
+1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
As a developer you may need to look at these sections:
* [add parameters in an existing section](devusage/addaparam.md)
* [add a parameter set, in a new section](devusage/addparamset.md)
-* [configuration module API](devusage/api.md)
-* [configuration module public structures](devusage/struct.md)
+* [configuration module API](devusage/api.md)
+* [configuration module public structures](devusage/struct.md)
-Whatever your need is, configuration module usage examples can be found in oai sources:
-* complex example, using all the configuration module functionalities, including parameter checking:
+Whatever your need is, configuration module usage examples can be found in oai sources:
+* complex example, using all the configuration module functionalities, including parameter checking:
[NB-IoT configuration code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_config.c) and [NB-IoT configuration include file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_paramdef.h)
* very simple example, just reading a parameter set corresponding to a dedicated section: the telnetsrv_autoinit function in [common/utils/telnetsrv/telnetsrv.c, around line 726](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv.c#L726)
* an example with run-time definition of parameters, in the logging sub-system: the log_getconfig function at the top of [openair2/UTIL/LOG/log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/UTIL/LOG/log.c)
diff --git a/common/config/DOC/config/devusage/addaparam.md b/common/config/DOC/config/devusage/addaparam.md
index b7bb8a73b9..246c494526 100644
--- a/common/config/DOC/config/devusage/addaparam.md
+++ b/common/config/DOC/config/devusage/addaparam.md
@@ -1,6 +1,6 @@
-To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument.
+To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument.
-existing code:
+existing code:
```c
unsigned int varopt1;
paramdef_t someoptions[] = {
@@ -11,10 +11,10 @@ paramdef_t someoptions[] = {
{"opt1", "", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
};
-config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
+config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
```
-new code:
+new code:
```c
unsigned int varopt1;
@@ -31,7 +31,7 @@ paramdef_t someoptions[] = {
{"opt2", "", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
};
-config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
+config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
```
@@ -57,10 +57,10 @@ The configuration module provides a mechanism to check the parameter value read
A `checkedparam_t` structure array provides the parameter verification procedures:
```c
-/*
+/*
definition of the verification to be done on param opt1 and opt2.
opt1 is an integer option we must be set to 0,2,3,4 or 7 in the
- config source.
+ config source.
if opt1 is set to 0 in the config file, it will be set to 1, etc
opt2 is C string option with the authorize values "zero","oneThird","twoThird","one"
*/
@@ -82,5 +82,5 @@ for(int i=0 ; i < sizeof(someoptions)/sizeof(paramdesc_t) ; i ++) {
```
When you need a specific verification algorithm, you can provide your own verification function and use it in place of the available ones, in the `checkedparam_t` union. If no existing structure definition match your need, you can enhance the configuration module. You then have to add a new verification function in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_userapi.c and add a new structure definition in the `checkedparam_t` type defined in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h
-[Configuration module developer main page](../../config/devusage.md)
+[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/addparamset.md b/common/config/DOC/config/devusage/addparamset.md
index 130a7eda74..49448e11da 100644
--- a/common/config/DOC/config/devusage/addparamset.md
+++ b/common/config/DOC/config/devusage/addparamset.md
@@ -1,7 +1,7 @@
The configuration module maps a configuration file section to a `paramdef_t` structure array. One `config_get` call can be used to return the values of all the parameters described in the `paramdef_t` array.
Retrieving a single occurence of a parameter set ( a group in the libconfig terminology) is just a two steps task:
1. describe the parameters in a `paramdef_t` array
-1. call the `config_get` function
+1. call the `config_get` function
[config_get example](../../config/devusage/addaparam.md)
@@ -30,19 +30,19 @@ NB-IoT_MACRLCs =
);
```
-The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call.
+The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call.
```c
/* name of section containing the list */
#define NBIOT_MACRLCLIST_CONFIG_STRING "NB-IoT_MACRLCs"
-/*
+/*
The following macro define the parameters names, as used in the
configuration file
-*/
-#define CONFIG_STRING_MACRLC_CC "num_cc"
+*/
+#define CONFIG_STRING_MACRLC_CC "num_cc"
.....
-#define CONFIG_MACRLC_S_PORTD "remote_s_portd"
+#define CONFIG_MACRLC_S_PORTD "remote_s_portd"
/*
now define a macro which will be used to initialize the NbIoT_MacRLC_Params
@@ -51,16 +51,16 @@ configuration file
module allocate the memory for the parameters values.
*/
/*------------------------------------------------------------------------------------------------------------*/
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------*/
#define MACRLCPARAMS_DESC { \
{CONFIG_STRING_MACRLC_CC, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
............. \
{CONFIG_MACRLC_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
-}
+}
-/*
+/*
the following macros define the indexes used to access the NbIoT_MacRLC_Params array
items. They must be maintained consistent with the previous MACRLCPARAMS_DESC macro
which is used to initialize the NbIoT_MacRLC_Params variable
@@ -72,60 +72,60 @@ which is used to initialize the NbIoT_MacRLC_Params variable
void RCconfig_NbIoTmacrlc(void) {
-
+
/*
define and initialize the array of paramdef_t structures describing the groups of
- parameters we want to read. It will be passed as the second argument of the
+ parameters we want to read. It will be passed as the second argument of the
config_getlist call, which will use it as an input only argument.
*/
paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC;
-/*
+/*
now define and initialize a paramlist_def_t structure which will be passed
to the config_getlist call. The first field is the only one to be initialized
- it contains the name of the section to be read.
+ it contains the name of the section to be read.
that section contains the list of group of parameters.
The two other fields are output parameters used to return respectively
- a pointer to a two dimensional array of paramdef_t structures pointers, and the
+ a pointer to a two dimensional array of paramdef_t structures pointers, and the
number of items in the list of groups (size of first dimension, the second one
being the number of parameters in each group.
-*/
+*/
paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
- /*
- the config_getlist will allocate the second field of the paramlist_def_t structure, a
-two dimensional array of paramdef_t pointers. In each param_def item it will allocate
+ /*
+ the config_getlist will allocate the second field of the paramlist_def_t structure, a
+two dimensional array of paramdef_t pointers. In each param_def item it will allocate
the value pointer and set the value to what it will get from the config source. The
numelt field of the paramlist_def_t structure will be set to the number of groups of
parameters in the list.
in this example the last argument of config_getlist is unused, it may contain a
character string, used as a prefix for the section name. It has to be specified when the
list to be read is under another section.
-*/
+*/
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,
- sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
+ sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
NULL);
-
-/*
+
+/*
start a loop in the nuber of groups in the list, the numelt field of the
paramlist_def_t structure has been set in the config_getlist call
*/
for (j=0 ; jeth_params_s.remote_portd =
+ RC.nb_iot_mac[j]->eth_params_s.remote_portd =
*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
............
-
+
} // MacRLC_ParamList.numelt > 0
}
-```
+```
-[Configuration module developer main page](../../config/devusage.md)
+[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/api.md b/common/config/DOC/config/devusage/api.md
index 050abc5315..06c22dba6f 100644
--- a/common/config/DOC/config/devusage/api.md
+++ b/common/config/DOC/config/devusage/api.md
@@ -25,14 +25,14 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
- `PARAMFLAG_DISABLECMDLINE`: parameter cannot be modified via the command line
- `PARAMFLAG_DONOTREAD`: ignore the parameter, can be used at run-time, to alter a pre-defined `paramdef_t` array which is used in several `config_get` or/and `config_getlist` calls.
- `PARAMFLAG_NOFREE`: do not free the memory possibly allocated by the config module to store the value of the parameter. Default behavior is for the config module to free the memory it has allocated when the `config_end` function is called.
- - `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
+ - `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
* `params` is also used as an output parameter, `< XXX >ptr >` field is used by the config module to store the value it has read. The following bits can possibly be set in the `paramflags` mask after the call:
- `PARAMFLAG_MALLOCINCONFIG`: memory has been allocated for the ` < XXX >ptr > ` field
- `PARAMFLAG_PARAMSET`: parameter has been found in the config source, it is not set to default value.
- `PARAMFLAG_PARAMSET`: parameter has been set to its default value
* `numparams` is the number of entries in the params array
-* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
+* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured
```c
@@ -42,8 +42,8 @@ int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int
* Calls the `config__get` function for each list occurrence
* `params` points to an array of `paramdef_t` structures which describes the parameters in each occurrence of the list
* `ParamList` points to a structure, where `paramarray` field points to an array of `paramdef_t` structure, allocated by the function. It is used to return the values of the parameters.
-* The returned value is the number of occurrences in the list or -1 in case of severe error
+* The returned value is the number of occurrences in the list or -1 in case of severe error
-[Configuration module developer main page](../../config/devusage.md)
+[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/devusage/struct.md b/common/config/DOC/config/devusage/struct.md
index 236c1b4e03..e8b15fc0f1 100644
--- a/common/config/DOC/config/devusage/struct.md
+++ b/common/config/DOC/config/devusage/struct.md
@@ -10,11 +10,11 @@ It is defined in include file [ common/config/config_paramdesc.h ](https://gitla
| `type` | Supported parameter types are defined as integer macros. Supported simple types are `TYPE_STRING`, parameter value is returned in `strptr` field, `TYPE_INT8` `TYPE_UINT8` `TYPE_INT16` `TYPE_UINT16` `TYPE_INT32` `TYPE_UINT32` `TYPE_INT64` `TYPE_UINT64`, parameter value is returned in the corresponding uXptr or iXptr, `TYPE_MASK`, value is returned in `u32ptr`, `TYPE_DOUBLE` value is returned in `dblptr`, `TYPE_IPV4ADDR` value is returned in binary, network bytes order in `u32ptr` field. `TYPE_STRINGLIST`, `TYPE_INTARRAY` and `TYPE_UINTARRAY` are multiple values types. Multiple values are returned in respectively, `strlistptr`, `iptr` and `uptr` fields which then point to arrays. The `numelt` field gives the number of item in the array. | I |
| `numelt` | For `TYPE_STRING` where `strptr` points to a preallocated string, this field must contain the size in bytes of the available memory. For all multiple values types, this field contains the number of values in the value field.| I/O |
| `chkPptr` | possible pointer to the structure containing the info used to check parameter values | I |
-| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
-
+| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
+
# `paramlist_def_t`structure
-It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
-It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
+It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
+It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
| Fields | Description | I/O |
|:-----------|:------------------------------------------------------------------|----:|
@@ -23,11 +23,11 @@ It is used as an argument to `config_getlist` calls, to get values of multiple o
| `numelt` | Number of items in the `paramarray` field | O |
# `checkedparam_t` union
-It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62).
+It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62).
This union of structures is used to provide a parameter checking mechanism. Each `paramdef_t` instance may include a pointer to a `checkedparam_t`structure which is then used by the configuration module to check the value it got from the config source.
Each structure in the union provides one parameter verification method, which returns `-1` when the verification fails. Currently the following structures are defined in the `checkedparam_t` union:
-| structure name | Description |
+| structure name | Description |
|:-----------|:------------------------------------------------------------------|----:|
| `s1` | check an integer against a list of authorized values |
| `s1a` | check an integer against a list of authorized values and set the parameter value to another integer depending on the read value|
@@ -40,14 +40,14 @@ each of these structures provide the required fields to perform the specified pa
The configuration module provides an implementation of the functions to be used to check parameters, qs described below.
## `s1` structure
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f1` | pointer to the checking function. Initialize to `config_check_intval` to use the config module implementation |
| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
| `num_okintval` | number of used values in `okintval` |
## `s1a` structure
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f1a` | pointer to the checking function. Initialize to `config_check_modify_integer` to use the config module implementation |
| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
@@ -55,13 +55,13 @@ The configuration module provides an implementation of the functions to be used
| `num_okintval` | number of used values in `okintval` and `setintval` |
## `s2` structure
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f2` | pointer to the checking function. Initialize to `config_check_intrange` to use the config module implementation |
| `okintrange` | array of 2 integers containing the min and max values for the parameter |
## `s3` structure
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f3` | pointer to the checking function. Initialize to `config_check_strval` to use the config module implementation |
| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
@@ -69,7 +69,7 @@ The configuration module provides an implementation of the functions to be used
## `s3a` structure
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f3a` | pointer to the checking function. Initialize to `config_checkstr_assign_integer` to use the config module implementation |
| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
@@ -77,9 +77,9 @@ The configuration module provides an implementation of the functions to be used
| `num_okstrval` | number of used values in `okintval` and `setintval` |
## `s4` and `s5` structures
-| field | Description |
+| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f4` or `f5` | pointer to the checking function. they are generic structures to be used when no existing structure provides the required parameter verification. `f4` takes one argument, the `paramdef_t` structure corresponding to the parameter to be checked (`int (*f4)(paramdef_t *param)`), `f5` taxes no argument (`void (*checkfunc)(void)`) |
-[Configuration module developer main page](../../config/devusage.md)
+[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
diff --git a/common/config/DOC/config/rtusage.md b/common/config/DOC/config/rtusage.md
index 109ba84bba..10cbee2495 100644
--- a/common/config/DOC/config/rtusage.md
+++ b/common/config/DOC/config/rtusage.md
@@ -1,34 +1,34 @@
-
- -O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters:
+
+ -O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters:
```bash
$ ./lte-softmodem -O :::...
```
- The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim)
+ The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim)
Currently the available config sources are:
-- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module.
+- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module.
```bash
$ ./lte-softmodem -O libconfig::dbgl
```
- **cmdlineonly**: command line only, the default mode for lte-uesoftmodem and the phy simiulators. In this case -O may be used to specify the config module debug level.
-The debug level is a mask:
-* bit 1: print parameters values
+The debug level is a mask:
+* bit 1: print parameters values
* bit 2: print memory allocation/free performed by the config module
* bit 3: print command line processing messages
* bit 4: disable execution abort when parameters checking fails
-As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages).
+As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages).
```bash
-$ ./lte-softmodem -O libconfig::dbgl1
+$ ./lte-softmodem -O libconfig::dbgl1
```
```bash
$ ./lte-uesoftmodem -O cmdlineonly:dbgl1
```
To get help on supported parameters you can use specific options:
-* ---help: print help for command line only parameters and for parameters not defined in a specific section
+* ---help: print help for command line only parameters and for parameters not defined in a specific section
* ---help_< prefix > : print help for parameters defined under the section < prefix >
```
@@ -49,23 +49,23 @@ To get help on supported parameters you can use specific options:
-C: Set the downlink frequency for all component carriers
-a: Channel id offset
-d: Enable soft scope and L1 and L2 stats (Xforms)
- -q: Enable processing timing measurement of lte softmodem on per subframe basis
- -S: Skip the missed slots/subframes
+ -q: Enable processing timing measurement of lte softmodem on per subframe basis
+ -S: Skip the missed slots/subframes
--numerology: adding numerology for 5G
--parallel-config: three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'
--worker-config: two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'
--nbiot-disable: disable nb-iot, even if defined in config
--noS1: Disable s1 interface
- --nokrnmod: (noS1 only): Use tun instead of namesh module
+ --nokrnmod: (noS1 only): Use tun instead of namesh module
--------------------------------------------------------------------
[LIBCONFIG] (root): 4/4 parameters successfully set, (4 to default value)
-----Help for section (root section) : 004 entries------
- -R: Enable online log
+ -R: Enable online log
-g: Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))
- --telnetsrv: Start embedded telnet server
- --msc: Enable the MSC tracing utility
+ --telnetsrv: Start embedded telnet server
+ --msc: Enable the MSC tracing utility
--------------------------------------------------------------------
[LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value)
@@ -84,13 +84,13 @@ Getting ENBSParams
```
-For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
+For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
```bash
$ ./lte-softmodem -O
```
-Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
+Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
```
config:
@@ -102,8 +102,8 @@ Configuration files examples can be found in the targets/PROJECTS/GENERIC-LTE-EP
```bash
$ ./lte-softmodem -O --eNBs.[0].component_carriers.[0].N_RB_DL 100
-```
+```
As specified earlier, use the dbgl1 debug level to get the full name of a parameter you would like to modify on the command line.
-[Configuration module home](../config.md)
\ No newline at end of file
+[Configuration module home](../config.md)
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 4d32e9726f..0083c2e66b 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -166,13 +166,14 @@ int config_check_unknown_cmdlineopt(char *prefix) {
int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0;
+ memset(testprefix,0,sizeof(testprefix));
memset(testprefix,0,sizeof(testprefix));
if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1;
else if (strlen(prefix) > 0) {
- sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-1,prefix);
+ sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-4,prefix);
}
}
diff --git a/common/ngran_types.h b/common/ngran_types.h
new file mode 100644
index 0000000000..224a85def5
--- /dev/null
+++ b/common/ngran_types.h
@@ -0,0 +1,51 @@
+/*
+ * 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
+ */
+
+/*! \file common/ngran_types.h
+* \brief Definitions for NGRAN node types
+* \author R. Knopp
+* \date 2018
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr
+* \note
+* \warning
+*/
+
+#ifndef __NGRAN_TYPES_H__
+#define __NGRAN_TYPES_H__
+
+typedef enum {
+ ngran_eNB = 0,
+ ngran_ng_eNB = 1,
+ ngran_gNB = 2,
+ ngran_eNB_CU = 3,
+ ngran_ng_eNB_CU = 4,
+ ngran_gNB_CU = 5,
+ ngran_eNB_DU = 6,
+ ngran_gNB_DU = 7
+} ngran_node_t;
+
+#define NODE_IS_MONOLITHIC(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB || (nOdE_TyPe) == ngran_ng_eNB || (nOdE_TyPe) == ngran_gNB)
+#define NODE_IS_CU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_CU || (nOdE_TyPe) == ngran_ng_eNB_CU || (nOdE_TyPe) == ngran_gNB_CU)
+#define NODE_IS_DU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_DU || (nOdE_TyPe) == ngran_gNB_DU)
+
+#endif
diff --git a/common/ran_context.h b/common/ran_context.h
index 08c05411c9..c0b58d2af2 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -39,6 +39,8 @@
#include "PHY/types.h"
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_lte.h"
+
+#include "ENB_APP/enb_config.h"
#include "RRC/LTE/rrc_defs.h"
#include "flexran_agent_defs.h"
@@ -49,7 +51,11 @@
#include "gtpv1u_eNB_defs.h"
#include "PHY/defs_L1_NB_IoT.h"
+
#include "RRC/LTE/defs_NB_IoT.h"
+
+
+
typedef struct {
/// RAN context config file name
char *config_file_name;
diff --git a/common/utils/DOC/loader/arch.md b/common/utils/DOC/loader/arch.md
index 6fd1f47e7b..52ffd428dd 100644
--- a/common/utils/DOC/loader/arch.md
+++ b/common/utils/DOC/loader/arch.md
@@ -2,6 +2,6 @@
The oai shared library loader is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils)
1. [load_module_shlib.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.c) contains the loader implementation
-1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes.
+1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes.
-[loader home page](../loader.md)
\ No newline at end of file
+[loader home page](../loader.md)
diff --git a/common/utils/DOC/loader/devusage.md b/common/utils/DOC/loader/devusage.md
index 915075c361..bd45c88a85 100644
--- a/common/utils/DOC/loader/devusage.md
+++ b/common/utils/DOC/loader/devusage.md
@@ -1,16 +1,16 @@
-The loader objectives are
+The loader objectives are
1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code
1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code
As a developer you may need to look at these sections:
* [loading a shared library](devusage/loading.md)
-* [loader API](devusage/api.md)
-* [loader public structures](devusage/struct.md)
+* [loader API](devusage/api.md)
+* [loader public structures](devusage/struct.md)
-Loader usage examples can be found in oai sources:
+Loader usage examples can be found in oai sources:
-* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91)
+* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91)
* turbo encoder and decoder initialization: [function `load_codinglib`in *openair1/PHY/CODING/__coding_load.c__*](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c#L113)
[loader home page](../loader.md)
diff --git a/common/utils/DOC/loader/devusage/api.md b/common/utils/DOC/loader/devusage/api.md
index 21c2a1d253..a6e59c5938 100644
--- a/common/utils/DOC/loader/devusage/api.md
+++ b/common/utils/DOC/loader/devusage/api.md
@@ -1,12 +1,12 @@
- Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file.
+ Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file.
```c
int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
```
-* possibly initializes the loader, if it has not been already initialized
-* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters.
+* possibly initializes the loader, if it has not been already initialized
+* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters.
* loads the shared library, using the dlopen system call
* looks for `< modname >_autoinit` symbol, using the `dlsym` system call and possibly call the corresponding function.
-* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function.
+* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function.
* If the farray pointer is null, looks for `< modname >_getfarray` symbol, calls the corresponding function when the symbol is found. `< modname >_getfarray` takes one argument, a pointer to a `loader_shlibfunc_t` array, and returns the number of items in this array, as defined by the `getfarrayfunc_t` type. The `loader_shlibfunc_t` array returned by the shared library must be fully filled (both `fname` and `fptr` fields).
* looks for the `numf` function symbols listed in the `farray[i].fname` arguments and set the corresponding `farray[i].fptr`function pointers
@@ -14,7 +14,7 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
```c
void * get_shlibmodule_fptr(char *modname, char *fname)
```
-Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found.
+Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found.
-[loader home page](../../loader.md)
-[loader developer home page](../devusage.md)
\ No newline at end of file
+[loader home page](../../loader.md)
+[loader developer home page](../devusage.md)
diff --git a/common/utils/DOC/loader/devusage/loading.md b/common/utils/DOC/loader/devusage/loading.md
index 766bf85462..b34782ecd3 100644
--- a/common/utils/DOC/loader/devusage/loading.md
+++ b/common/utils/DOC/loader/devusage/loading.md
@@ -10,16 +10,16 @@ Typical loader usage looks like:
/* shared library loader include file */
#include "common/utils/load_module_shlib.h"
.............
-/*
- define and initialize the array, describing the list of functions
+/*
+ define and initialize the array, describing the list of functions
implemented in "mymodule"
*/
loader_shlibfunc_t mymodule_fdesc[2];
- mymodule_fdesc[0].fname="mymodule_f1";
- mymodule_fdesc[1].fname="mymodule_f2";
+ mymodule_fdesc[0].fname="mymodule_f1";
+ mymodule_fdesc[1].fname="mymodule_f2";
/*
- load the library, it's name must be libmymod.so. Configuration can be
+ load the library, it's name must be libmymod.so. Configuration can be
used to specify a specific path to look for libmymod.so. Configuration
can also specify a version, for example "V1", in this case the loader
will look for libmymodV1.so
@@ -28,13 +28,13 @@ Typical loader usage looks like:
if (ret < 0) {
fprintf(stderr,"Library couldn't be loaded\n");
} else {
-/*
+/*
library has been loaded, we probably want to call some functions...
*/
ret=((funcf1_t)mymodule_fdesc[0].fptr)();
..................
-/*
+/*
later and/or somewhere else in the code you may want to call function "mymodule_f2"
You can use the loader get_shlibmodule_fptr(char *modname, char *fname) function
to retrieve the pointer to that function
@@ -50,7 +50,7 @@ if (f2 != NULL) {
}
...............
```
-When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested.
+When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested.
-[loader home page](../loader.md)
-[loader developer home page](../../loader/devusage.md)
\ No newline at end of file
+[loader home page](../loader.md)
+[loader developer home page](../../loader/devusage.md)
diff --git a/common/utils/DOC/loader/devusage/struct.md b/common/utils/DOC/loader/devusage/struct.md
index 17504f3866..08d4ce9558 100644
--- a/common/utils/DOC/loader/devusage/struct.md
+++ b/common/utils/DOC/loader/devusage/struct.md
@@ -6,5 +6,5 @@ It is defined in include file [ common/util/load_module_shlib.h ](https://gitlab
| `fname` | symbol name, is passed to the [`dlsym`](http://man7.org/linux/man-pages/man3/dlsym.3.html) system call performed by the loader to get a pointer to the symbol | I |
| `fptr` | pointer to the symbol name, set by the loader. `fptr` is defined as a `int (*fptr)(void)` function type | O |
-[loader home page](../../loader.md)
-[loader developer home page](../devusage.md)
\ No newline at end of file
+[loader home page](../../loader.md)
+[loader developer home page](../devusage.md)
diff --git a/common/utils/DOC/loader/rtusage.md b/common/utils/DOC/loader/rtusage.md
index bf87316e13..0bcdf6429f 100644
--- a/common/utils/DOC/loader/rtusage.md
+++ b/common/utils/DOC/loader/rtusage.md
@@ -6,7 +6,7 @@ Shared library full names are built by the loader using the format:
1. the < *module version* > and < *path* > optional parameters, are defined at run-time, depending on the configuration.
## loader parameters
-The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters.
+The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters.
### Global loader parameters
| name | type | default | description |
|:---:|:---:|:---:|:----|
@@ -39,7 +39,7 @@ If you want to load a device called *liboai_device_USRP.so* without writting a s
With this latest example, nn the softmodem logs, you can check that the right device library has been loaded:
```bash
-[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf
+[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf
[LIBCONFIG] loader.oai_device.shlibversion set to default value ""
[LIBCONFIG] loader.oai_device: 1/2 parameters successfully set, (1 to default value)
[CONFIG] shlibversion set to _USRP from command line
@@ -47,4 +47,4 @@ With this latest example, nn the softmodem logs, you can check that the right de
```
-[loader home page](../loader.md)
\ No newline at end of file
+[loader home page](../loader.md)
diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md
index d850ac1036..9ab90cf120 100644
--- a/common/utils/LOG/DOC/addconsoletrace.md
+++ b/common/utils/LOG/DOC/addconsoletrace.md
@@ -12,11 +12,11 @@ these macros are used in place of the printf C function. The additionnal ***comp
| macro | level letter | level value | level name |
|:---------|:---------------|:---------------|----------------:|
-| LOG_E | E | 0 | error |
+| LOG_E | E | 0 | error |
| LOG_W | W | 1 | warning |
| LOG_I | I | 2 | informational |
| LOG_D | D | 3 | debug |
-| LOG_T | T | 4 | trace |
+| LOG_T | T | 4 | trace |
component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt).
@@ -27,18 +27,18 @@ Most oai sources are including LOG macros.
```C
LOG_DEBUGFLAG()
```
-this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
+this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
```C
if ( LOG_DEBUGFLAG() {
-/*
+/*
the code below is only executed if the corresponding
_debug option is set.
- */
+ */
......................
......................
}
```
-[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
#### memory dump macros
```C
@@ -47,16 +47,16 @@ LOG_DUMPFLAG()
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals.
```C
if ( LOG_DUMPFLAG() {
-/*
+/*
the code below is only executed if the corresponding
_dump option is set.
- */
+ */
LOG_M(.............
LOG_M(.............
log_dump(...
}
-[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### matlab format dump
```C
LOG_M(file, vector, data, len, dec, format)
@@ -71,13 +71,13 @@ LOG_M(file, vector, data, len, dec, format)
|format| int | defines the type of data to be dumped|
This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)**
-[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### hexadecimal format dump
```C
LOG_DUMPMSG(c, f, b, s, x...)
```
-dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
+dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
|argument| type| description |
|:-----------|:-------|-----------------:|
@@ -88,12 +88,12 @@ dumps a memory region if the corresponding debug flag `f` is set as explained he
| x...| printf format and arguments| text string to be printed at the top of the dump|
This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form.
-[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181)
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181)
This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro
```C
-LOG_UDUMPMSG(c, b, s, f, x...)
+LOG_UDUMPMSG(c, b, s, f, x...)
```
|argument| type| description |
|:-----------|:-------|-----------------:|
@@ -103,8 +103,8 @@ LOG_UDUMPMSG(c, b, s, f, x...)
|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE|
| x...| printf format and arguments| text string to be printed at the top of the dump|
-[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974)
+[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974)
-[logging facility developer main page](devusage.md)
-[logging facility main page](log.md)
-[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
+[logging facility developer main page](devusage.md)
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md
index b9302927be..1d6aeae6aa 100644
--- a/common/utils/LOG/DOC/arch.md
+++ b/common/utils/LOG/DOC/arch.md
@@ -2,11 +2,11 @@
The oai logging facility is implemented in two source files, located in [common/utils/LOG](LOG)
1. [log.c](../log.c) contains logging implementation
-1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes.
+1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes.
The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_` are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call to the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack.
Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function.
-[logging facility main page](log.md)
-[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/configurelog.md b/common/utils/LOG/DOC/configurelog.md
index c671c043bd..862c02162b 100644
--- a/common/utils/LOG/DOC/configurelog.md
+++ b/common/utils/LOG/DOC/configurelog.md
@@ -4,7 +4,7 @@
```C
int logInit (void);
```
-Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
+Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
```C
void logClean (void)
@@ -30,9 +30,9 @@ void close_component_filelog(int comp)
Redirect or reset to stdout the output stream used by the logging facility. When the output stream is redirected to a file, it is created under /tmp with a hard-coded filename including the componemt name.
```C
-SET_LOG_DEBUG(flag)
+SET_LOG_DEBUG(flag)
CLEAR_LOG_DEBUG(flag)
-SET_LOG_DUMP(flag)
+SET_LOG_DUMP(flag)
CLEAR_LOG_DUMP(flag)
```
These macros are used to set or clear the corresponding bit flag, trigerring the activation or un-activation of conditional code or memory dumps generation.
@@ -42,8 +42,8 @@ Example of using the logging utility APIs can be found, for initialization and c
#### components and debug flags definitions
Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt).
-To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h).
+To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h).
-[logging facility developer main page](devusage.md)
-[logging facility main page](log.md)
-[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
+[logging facility developer main page](devusage.md)
+[logging facility main page](log.md)
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md
index d7790917fc..61d25734e0 100644
--- a/common/utils/LOG/DOC/devusage.md
+++ b/common/utils/LOG/DOC/devusage.md
@@ -1,14 +1,14 @@
### logging facility developer usage
-The logging facility objectives are
-1. provide a common console tracing mechanism
+The logging facility objectives are
+1. provide a common console tracing mechanism
1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running.
-Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration.
+Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration.
-[Adding console traces in oaicode](addconsoletrace.md)
+[Adding console traces in oaicode](addconsoletrace.md)
-[Configuring the logging facility](configurelog.md)
+[Configuring the logging facility](configurelog.md)
-[logging facility main page](log.md)
+[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md
index 121e227f3d..4b3e5981e1 100644
--- a/common/utils/LOG/DOC/log.md
+++ b/common/utils/LOG/DOC/log.md
@@ -1,6 +1,6 @@
# OAI console logging facility
-oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream.
+oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream.
By default, this facility is included at build-time and activated at run-time. The T Tracer and the Logging facility share common options for activation:
- To disable the logging facility (and T Tracer) at build-time use the *--disable-T-Tracer* switch:
diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md
index 60835bafaf..445f335725 100644
--- a/common/utils/LOG/DOC/rtusage.md
+++ b/common/utils/LOG/DOC/rtusage.md
@@ -1,5 +1,5 @@
## configuring the logging facility
-The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior
+The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior
All logging facility parameters are defined in the log_config section. Some parameters are global to the logging facility, they modify the way messages are printed to stdout. Conversely, some parameters are specific to a component and only modify the behavior for messages issued by a given component. A third type of parameters can be used to activate conditional debug code or dump messages or buffers.
@@ -14,7 +14,7 @@ All logging facility parameters are defined in the log_config section. Some para
### Component specific parameters
| name | type | default | description |
|:---:|:---:|:---:|:----|
-| `_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
+| `_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
| `_log_infile` | `boolean` | 0 = false| Triggers the redirection of log messages printed by the specified component in a file. The file path and name is /tmp/.[extension] the extension is optional and component dependant, it can be `log `, `dat `, `txt `|
The list of components defined within oai can be retrieved from the [config module](../../../config/config.md) traces, when asking for config module debugging info on the command line:
@@ -215,7 +215,7 @@ The list of components defined within oai can be retrieved from the [config mod
log init done
```
-It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility)
+It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility)
### parameters to activate conditional code
| name | type | default | description |
@@ -238,15 +238,15 @@ The following example sets all components log level to info, exept for hw,phy,ma
};
```
### Using the command line to configure the logging facility
-Command line parameter values supersedes values specified in the configuration file.
+Command line parameter values supersedes values specified in the configuration file.
```bash
-./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug
+./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug
```
In this example to get all the debug PRACH messages it is necessary to also set the PRACH_debug flag. This is a choice from the developper.
The log messages will be printed whithout color and the header will include the lmessage evel and the thread name:
```bash
-[PHY]I ru thread Time in secs now: 104652566
-[PHY]I ru thread Time in secs last pps: 91827117
+[PHY]I ru thread Time in secs now: 104652566
+[PHY]I ru thread Time in secs last pps: 91827117
[PHY]I ru thread RU 0 rf device ready
[PHY]I ru thread RU 0 no asynch_south interface
[MAC]E rxtx processing SCHED_MODE=0
@@ -256,10 +256,10 @@ The log messages will be printed whithout color and the header will include the
[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
```
-
+
### Using the telnet server to configure the logging facility
The telnet server includes a `log` command which can be used to dymically modify the logging facility configuration parameters.
-[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md)
+[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md)
-[logging facility main page](log.md)
+[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c
index 7a2f2b99f4..87150650db 100644
--- a/common/utils/LOG/log.c
+++ b/common/utils/LOG/log.c
@@ -303,8 +303,8 @@ void log_getconfig(log_t *g_log) {
logparams_dump[i].numelt = 0;
}
- config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
- config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
+ config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
+ config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */
@@ -385,7 +385,6 @@ int logInit (void) {
register_log_component("OCG","",OCG);
register_log_component("PERF","",PERF);
register_log_component("OIP","",OIP);
- register_log_component("CLI","",CLI);
register_log_component("MSC","log",MSC);
register_log_component("OCM","log",OCM);
register_log_component("HW","",HW);
@@ -394,20 +393,25 @@ int logInit (void) {
register_log_component("mRAL","",RAL_UE);
register_log_component("ENB_APP","log",ENB_APP);
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
+ register_log_component("PROTO_AGENT","log",PROTO_AGENT);
register_log_component("TMR","",TMR);
register_log_component("USIM","txt",USIM);
register_log_component("SIM","txt",SIM);
/* following log component are used for the localization*/
+ /* following log component are used for the localization*/
register_log_component("LOCALIZE","log",LOCALIZE);
register_log_component("NAS","log",NAS);
register_log_component("UDP","",UDP_);
register_log_component("GTPV1U","",GTPU);
register_log_component("S1AP","",S1AP);
+ register_log_component("F1AP","",F1AP);
register_log_component("X2AP","",X2AP);
register_log_component("SCTP","",SCTP);
register_log_component("X2AP","",X2AP);
register_log_component("LOADER","log",LOADER);
register_log_component("ASN","log",ASN);
+ register_log_component("NFAPI_PNF","log",NFAPI_PNF);
+ register_log_component("NFAPI_VNF","log",NFAPI_VNF);
for (int i=0 ; log_level_names[i].name != NULL ; i++)
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
@@ -438,7 +442,7 @@ char *log_getthreadname(char *threadname, int bufsize) {
static int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
char threadname[PR_SET_NAME];
- return snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s%s",
+ return snprintf(log_buffer, buffsize, "%s%s[%s]%c %s %s%s",
log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name,
@@ -452,11 +456,17 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
char log_buffer[MAX_LOG_TOTAL];
va_list args;
va_start(args, format);
- log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format);
+ log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
va_end(args);
}
+void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args ) {
+ char log_buffer[MAX_LOG_TOTAL];
+ log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
+ g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
+}
+
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) {
va_list args;
char *wbuf;
@@ -474,7 +484,7 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
if (wbuf != NULL) {
va_start(args, format);
- int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,"");
+ int pos=log_header(wbuf,MAX_LOG_TOTAL,component, OAILOG_INFO,"");
int pos2=vsprintf(wbuf+pos,format, args);
pos=pos+pos2;
va_end(args);
diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index 5d8ad06bec..dea756a3ac 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -198,13 +198,13 @@ typedef enum {
NAS,
PERF,
OIP,
- CLI,
MSC,
OCM,
UDP_,
GTPU,
SPGW,
S1AP,
+ F1AP,
SCTP,
HW,
OSA,
@@ -215,9 +215,13 @@ typedef enum {
TMR,
USIM,
LOCALIZE,
+ PROTO_AGENT,
+ F1U,
X2AP,
LOADER,
ASN,
+ NFAPI_VNF,
+ NFAPI_PNF,
MAX_LOG_PREDEF_COMPONENTS,
}
comp_name_t;
@@ -286,6 +290,7 @@ extern "C" {
int logInit (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
+void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
int set_log(int component, int level);
void set_glog(int level);
@@ -365,9 +370,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
+# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
-# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c
index d7f439f351..db2385ea85 100644
--- a/common/utils/LOG/vcd_signal_dumper.c
+++ b/common/utils/LOG/vcd_signal_dumper.c
@@ -189,7 +189,15 @@ const char* eurecomVariablesNames[] = {
"ue0_trx_write_ns_missing",
"enb_thread_rxtx_CPUID",
"ru_thread_CPUID",
- "ru_thread_tx_CPUID"
+ "ru_thread_tx_CPUID",
+ "ue0_on_duration_timer",
+ "ue0_drx_inactivity",
+ "ue0_drx_short_cycle",
+ "ue0_short_drx_cycle_number",
+ "ue0_drx_long_cycle",
+ "ue0_drx_retransmission_harq0",
+ "ue0_drx_active_time",
+ "ue0_drx_active_time_condition"
};
const char* eurecomFunctionsNames[] = {
diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h
index d77722f581..fca1aa40bd 100644
--- a/common/utils/LOG/vcd_signal_dumper.h
+++ b/common/utils/LOG/vcd_signal_dumper.h
@@ -167,6 +167,14 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,
+ VCD_SIGNAL_DUMPER_VARIABLES_ON_DURATION_TIMER,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_INACTIVITY,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_SHORT_CYCLE,
+ VCD_SIGNAL_DUMPER_VARIABLES_SHORT_DRX_CYCLE_NUMBER,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_LONG_CYCLE,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_RETRANSMISSION_HARQ0,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_ACTIVE_TIME,
+ VCD_SIGNAL_DUMPER_VARIABLES_DRX_ACTIVE_TIME_CONDITION,
VCD_SIGNAL_DUMPER_VARIABLES_END
} vcd_signal_dump_variables;
diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h
index 95440337a7..ecb6f9389d 100644
--- a/common/utils/T/T_defs.h
+++ b/common/utils/T/T_defs.h
@@ -44,7 +44,7 @@ typedef struct {
#define VCD_NUM_FUNCTIONS 195
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_VARIABLES 128
+#define VCD_NUM_VARIABLES 136
/* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index ea4b6b8476..68dcc24e44 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -629,7 +629,7 @@ ID = LEGACY_OCM_DEBUG
FORMAT = string,log
ID = LEGACY_OCM_TRACE
DESC = OCM legacy logs - trace level
- GROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
+ OGROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_OIP_INFO
@@ -800,6 +800,47 @@ ID = LEGACY_SIM_TRACE
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_INFO
+ DESC = NFAPI_VNF legacy logs - info level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_ERROR
+ DESC = NFAPI_VNF legacy logs - error level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_WARNING
+ DESC = NFAPI_VNF legacy logs - warning level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_DEBUG
+ DESC = NFAPI_VNF legacy logs - debug level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_VNF_TRACE
+ DESC = NFAPI_VNF legacy logs - trace level
+ GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_NFAPI_PNF_INFO
+ DESC = NFAPI_PNF legacy logs - info level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_ERROR
+ DESC = NFAPI_PNF legacy logs - error level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_WARNING
+ DESC = NFAPI_PNF legacy logs - warning level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_DEBUG
+ DESC = NFAPI_PNF legacy logs - debug level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_NFAPI_PNF_TRACE
+ DESC = NFAPI_PNF legacy logs - trace level
+ GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor
@@ -845,26 +886,62 @@ ID = LEGACY_componentP_TRACE
GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
-#needed?
-ID = LEGACY_CLI_INFO
- DESC = CLI legacy logs - info level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_INFO:LEGACY
+
+
+ID = LEGACY_PROTO_AGENT_DEBUG
+ DESC = PROTO AGENT DEBUG LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_ERROR
- DESC = CLI legacy logs - error level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_ERROR:LEGACY
+
+ID = LEGACY_PROTO_AGENT_INFO
+ DESC = PROTO AGENT INFO LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_WARNING
- DESC = CLI legacy logs - warning level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_WARNING:LEGACY
+
+ID = LEGACY_PROTO_AGENT_WARNING
+ DESC = PROTO AGENT WARNING LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_DEBUG
- DESC = CLI legacy logs - debug level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_DEBUG:LEGACY
+
+ID = LEGACY_PROTO_AGENT_ERROR
+ DESC = PROTO AGENT ERROR LEVEL
+ GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
-ID = LEGACY_CLI_TRACE
- DESC = CLI legacy logs - trace level
- GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY
+
+ID = LEGACY_F1U_DEBUG
+ DESC = F1U DEBUG LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1U_INFO
+ DESC = F1U INFO LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1U_ERROR
+ DESC = F1U ERROR LEVEL
+ GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY
+ FORMAT = string,log
+
+ID = LEGACY_F1AP_TRACE
+ DESC = F1AP TRACE LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_TRACE:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_DEBUG
+ DESC = F1AP DEBUG LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_INFO
+ DESC = F1AP INFO LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_WARNING
+ DESC = F1AP WARNING LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_WARNING:LEGACY
+ FORMAT = string,log
+ID = LEGACY_F1AP_ERROR
+ DESC = F1AP ERROR LEVEL
+ GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
#################
@@ -1599,6 +1676,46 @@ ID = VCD_VARIABLE_CPUID_RU_THREAD_TX
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = ru_thread_tx_CPUID
+ID = VCD_VARIABLE_ON_DURATION_TIMER
+ DESC = VCD variable ON_DURATION_TIMER
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_on_duration_timer
+ID = VCD_VARIABLE_DRX_INACTIVITY
+ DESC = VCD variable DRX_INACTIVITY
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_inactivity
+ID = VCD_VARIABLE_DRX_SHORT_CYCLE
+ DESC = VCD variable DRX_SHORT_CYCLE
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_short_cycle
+ID = VCD_VARIABLE_SHORT_DRX_CYCLE_NUMBER
+ DESC = VCD variable SHORT_DRX_CYCLE_NUMBER
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_short_drx_cycle_number
+ID = VCD_VARIABLE_DRX_LONG_CYCLE
+ DESC = VCD variable DRX_LONG_CYCLE
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_long_cycle
+ID = VCD_VARIABLE_DRX_RETRANSMISSION_HARQ0
+ DESC = VCD variable DRX_RETRANSMISSION_HARQ0
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_retransmission_harq0
+ID = VCD_VARIABLE_DRX_ACTIVE_TIME
+ DESC = VCD variable DRX_ACTIVE_TIME
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_active_time
+ID = VCD_VARIABLE_DRX_ACTIVE_TIME_CONDITION
+ DESC = VCD variable DRX_ACTIVE_TIME_CONDITION
+ GROUP = ALL:VCD:ENB:VCD_VARIABLE
+ FORMAT = ulong,value
+ VCD_NAME = ue0_drx_active_time_condition
#functions
diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c
index f8e92881a9..4be0b35d16 100644
--- a/common/utils/T/local_tracer.c
+++ b/common/utils/T/local_tracer.c
@@ -31,7 +31,7 @@ typedef struct {
int remote_port;
pthread_mutex_t lock;
pthread_cond_t cond;
- databuf * volatile head, *tail;
+ databuf *volatile head, *tail;
uint64_t memusage;
uint64_t last_warning_memusage;
} forward_data;
@@ -40,80 +40,115 @@ typedef struct {
/* utility functions */
/****************************************************************************/
-static void new_thread(void *(*f)(void *), void *data)
-{
+static void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
- if (pthread_attr_init(&att))
- { fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
- if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
- { fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
- if (pthread_attr_setstacksize(&att, 10000000))
- { fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); }
- if (pthread_create(&t, &att, f, data))
- { fprintf(stderr, "pthread_create err\n"); exit(1); }
- if (pthread_attr_destroy(&att))
- { fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
+ if (pthread_attr_init(&att)) {
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setstacksize(&att, 10000000)) {
+ fprintf(stderr, "pthread_attr_setstacksize err\n");
+ exit(1);
+ }
+
+ if (pthread_create(&t, &att, f, data)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
}
-static int get_connection(char *addr, int port)
-{
+static int get_connection(char *addr, int port) {
struct sockaddr_in a;
socklen_t alen;
int s, t;
-
printf("T tracer: waiting for connection on %s:%d\n", addr, port);
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
+
t = 1;
- if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)))
- { perror("setsockopt"); exit(1); }
+
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int))) {
+ perror("setsockopt");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
- if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
- if (listen(s, 5)) { perror("bind"); exit(1); }
+ if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
+ perror("bind");
+ exit(1);
+ }
+
+ if (listen(s, 5)) {
+ perror("bind");
+ exit(1);
+ }
+
alen = sizeof(a);
t = accept(s, (struct sockaddr *)&a, &alen);
- if (t == -1) { perror("accept"); exit(1); }
+
+ if (t == -1) {
+ perror("accept");
+ exit(1);
+ }
+
close(s);
-
printf("T tracer: connected\n");
-
return t;
}
static void forward(void *_forwarder, char *buf, int size);
-void send_T_messages_txt(void *forwarder)
-{
+void send_T_messages_txt(void *forwarder) {
char buf[T_BUFFER_MAX];
char *T_LOCAL_buf = buf;
int T_LOCAL_size;
unsigned char *src;
int src_len;
-
/* trace T_message.txt
* Send several messages -1 with content followed by message -2.
*/
src = T_messages_txt;
src_len = T_messages_txt_len;
+
while (src_len) {
int send_size = src_len;
+
if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int))
send_size = T_PAYLOAD_MAXSIZE - sizeof(int);
+
/* TODO: be careful, we use internal T stuff, to rewrite? */
T_LOCAL_size = 0;
T_HEADER(T_ID(-1));
- T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)}));
+ T_PUT_buffer(1, ((T_buffer) {
+addr:
+(src), length:
+ (send_size)
+ }));
forward(forwarder, buf, T_LOCAL_size);
src += send_size;
src_len -= send_size;
}
+
T_LOCAL_size = 0;
T_HEADER(T_ID(-2));
forward(forwarder, buf, T_LOCAL_size);
@@ -123,49 +158,54 @@ void send_T_messages_txt(void *forwarder)
/* forward functions */
/****************************************************************************/
-static void *data_sender(void *_f)
-{
+static void *data_sender(void *_f) {
forward_data *f = _f;
databuf *cur;
char *buf, *b;
int size;
-
wait:
+
if (pthread_mutex_lock(&f->lock)) abort();
+
while (f->head == NULL)
if (pthread_cond_wait(&f->cond, &f->lock)) abort();
+
cur = f->head;
buf = cur->d;
size = cur->l;
f->head = cur->next;
f->memusage -= size;
+
if (f->head == NULL) f->tail = NULL;
+
if (pthread_mutex_unlock(&f->lock)) abort();
+
free(cur);
goto process;
-
process:
b = buf;
+
if (f->socket_remote != -1)
- while (size) {
- int l = write(f->socket_remote, b, size);
- if (l <= 0) {
- printf("T tracer: forward error\n");
- close(f->socket_remote);
- f->socket_remote = -1;
- break;
+ while (size) {
+ int l = write(f->socket_remote, b, size);
+
+ if (l <= 0) {
+ printf("T tracer: forward error\n");
+ close(f->socket_remote);
+ f->socket_remote = -1;
+ break;
+ }
+
+ size -= l;
+ b += l;
}
- size -= l;
- b += l;
- }
free(buf);
-
goto wait;
}
-static void *forward_remote_messages(void *_f)
-{
+
+static void *forward_remote_messages(void *_f) {
#define PUT(x) do { \
if (bufsize == bufmaxsize) { \
bufmaxsize += 4096; \
@@ -180,7 +220,6 @@ static void *forward_remote_messages(void *_f)
int len = l; \
while (len) { PUT(*zz); zz++; len--; } \
} while (0)
-
forward_data *f = _f;
int from;
int to;
@@ -190,43 +229,53 @@ static void *forward_remote_messages(void *_f)
int bufsize = 0;
int bufmaxsize = 0;
char t;
-
again:
while (1) {
from = f->socket_remote;
to = f->socket_local;
-
bufsize = 0;
-
/* let's read and process messages */
- len = read(from, &t, 1); if (len <= 0) goto dead;
+ len = read(from, &t, 1);
+
+ if (len <= 0) goto dead;
+
PUT(t);
switch (t) {
- case 0:
- case 1:
- /* message 0 and 1: get a length and then 'length' numbers */
- if (read(from, &len, sizeof(int)) != sizeof(int)) goto dead;
- PUT_BUF(&len, 4);
- while (len) {
- if (read(from, &l, sizeof(int)) != sizeof(int)) goto dead;
- PUT_BUF(&l, 4);
- len--;
- }
- break;
+ case 0:
+ case 1:
- case 2: break;
- default:
- printf("%s:%d:%s: unhandled message type %d\n",
- __FILE__, __LINE__, __FUNCTION__, t);
- abort();
+ /* message 0 and 1: get a length and then 'length' numbers */
+ if (read(from, &len, sizeof(int)) != sizeof(int)) goto dead;
+
+ PUT_BUF(&len, 4);
+
+ while (len) {
+ if (read(from, &l, sizeof(int)) != sizeof(int)) goto dead;
+
+ PUT_BUF(&l, 4);
+ len--;
+ }
+
+ break;
+
+ case 2:
+ break;
+
+ default:
+ printf("%s:%d:%s: unhandled message type %d\n",
+ __FILE__, __LINE__, __FUNCTION__, t);
+ abort();
}
b = buf;
+
while (bufsize) {
l = write(to, b, bufsize);
+
if (l <= 0) abort();
+
bufsize -= l;
b += l;
}
@@ -236,71 +285,80 @@ dead:
/* socket died, let's stop all traces and wait for another tracer */
/* TODO: be careful with those write, they might write less than wanted */
buf[0] = 1;
+
if (write(to, buf, 1) != 1) abort();
+
len = T_NUMBER_OF_IDS;
+
if (write(to, &len, sizeof(int)) != sizeof(int)) abort();
+
l = 0;
+
while (len) {
if (write(to, &l, sizeof(int)) != sizeof(int)) abort();
+
len--;
};
close(f->socket_remote);
+
f->socket_remote = get_connection("0.0.0.0", f->remote_port);
+
send_T_messages_txt(f);
+
goto again;
return NULL;
}
-static void *forwarder(int port, int s)
-{
+static void *forwarder(int port, int s) {
forward_data *f;
+ f = malloc(sizeof(*f));
- f = malloc(sizeof(*f)); if (f == NULL) abort();
+ if (f == NULL) abort();
pthread_mutex_init(&f->lock, NULL);
pthread_cond_init(&f->cond, NULL);
-
f->socket_local = s;
f->head = f->tail = NULL;
-
f->memusage = 0;
f->last_warning_memusage = 0;
-
printf("T tracer: waiting for remote tracer on port %d\n", port);
-
f->remote_port = port;
f->socket_remote = get_connection("0.0.0.0", port);
send_T_messages_txt(f);
-
new_thread(data_sender, f);
new_thread(forward_remote_messages, f);
-
return f;
}
-static void forward(void *_forwarder, char *buf, int size)
-{
+static void forward(void *_forwarder, char *buf, int size) {
forward_data *f = _forwarder;
int32_t ssize = size;
databuf *new;
+ new = malloc(sizeof(*new));
- new = malloc(sizeof(*new)); if (new == NULL) abort();
+ if (new == NULL) abort();
if (pthread_mutex_lock(&f->lock)) abort();
- new->d = malloc(size + 4); if (new->d == NULL) abort();
+ new->d = malloc(size + 4);
+
+ if (new->d == NULL) abort();
+
/* put the size of the message at the head */
memcpy(new->d, &ssize, 4);
memcpy(new->d+4, buf, size);
new->l = size+4;
new->next = NULL;
- if (f->head == NULL) f->head = new;
- if (f->tail != NULL) f->tail->next = new;
- f->tail = new;
+ if (f->head == NULL) f->head = new;
+
+ if (f->tail != NULL) f->tail->next = new;
+
+ f->tail = new;
#if BASIC_SIMULATOR
+
/* When runnng the basic simulator, the tracer may be too slow.
* Let's not take too much memory in the tracee and
* wait if there is too much data to send. 200MB is
@@ -308,26 +366,30 @@ static void forward(void *_forwarder, char *buf, int size)
*/
while (f->memusage > 200 * 1024 * 1024) {
if (pthread_cond_signal(&f->cond)) abort();
+
if (pthread_mutex_unlock(&f->lock)) abort();
+
usleep(1000);
+
if (pthread_mutex_lock(&f->lock)) abort();
}
-#endif /* BASIC_SIMULATOR */
+#endif /* BASIC_SIMULATOR */
f->memusage += size+4;
+
/* warn every 100MB */
if (f->memusage > f->last_warning_memusage &&
f->memusage - f->last_warning_memusage > 100000000) {
f->last_warning_memusage += 100000000;
printf("T tracer: WARNING: memory usage is over %"PRIu64"MB\n",
f->last_warning_memusage / 1000000);
- } else
- if (f->memusage < f->last_warning_memusage &&
- f->last_warning_memusage - f->memusage > 100000000) {
+ } else if (f->memusage < f->last_warning_memusage &&
+ f->last_warning_memusage - f->memusage > 100000000) {
f->last_warning_memusage = (f->memusage/100000000) * 100000000;
}
if (pthread_cond_signal(&f->cond)) abort();
+
if (pthread_mutex_unlock(&f->lock)) abort();
}
@@ -335,14 +397,12 @@ static void forward(void *_forwarder, char *buf, int size)
/* local functions */
/****************************************************************************/
-static void wait_message(void)
-{
+static void wait_message(void) {
while ((T_local_cache[T_busylist_head].busy & 0x02) == 0) usleep(1000);
}
void T_local_tracer_main(int remote_port, int wait_for_tracer,
- int local_socket, void *shm_array)
-{
+ int local_socket, void *shm_array) {
int s;
int port = remote_port;
int dont_wait = wait_for_tracer ? 0 : 1;
@@ -350,16 +410,16 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
- printf("local tracer received SIGPIPE\n");
- abort();
+ printf("local tracer received SIGPIPE\n");
+ abort();
}
T_local_cache = shm_array;
-
s = local_socket;
if (dont_wait) {
char t = 2;
+
if (write(s, &t, 1) != 1) abort();
}
diff --git a/common/utils/T/tracer/gui/notify.c b/common/utils/T/tracer/gui/notify.c
index 7ff4006941..5798a01219 100644
--- a/common/utils/T/tracer/gui/notify.c
+++ b/common/utils/T/tracer/gui/notify.c
@@ -5,62 +5,56 @@
#include
unsigned long register_notifier(gui *_g, char *notification, widget *w,
- notifier handler, void *private)
-{
+ notifier handler, void *private) {
struct gui *g = _g;
unsigned long ret;
-
glock(g);
if (g->next_notifier_id == 2UL * 1024 * 1024 * 1024)
ERR("%s:%d: report a bug\n", __FILE__, __LINE__);
g->notifiers = realloc(g->notifiers,
- (g->notifiers_count+1) * sizeof(struct notifier));
+ (g->notifiers_count+1) * sizeof(struct notifier));
+
if (g->notifiers == NULL) abort();
ret = g->next_notifier_id;
-
g->notifiers[g->notifiers_count].handler = handler;
g->notifiers[g->notifiers_count].id = g->next_notifier_id;
g->next_notifier_id++;
g->notifiers[g->notifiers_count].notification = strdup(notification);
+
if (g->notifiers[g->notifiers_count].notification == NULL) abort();
+
g->notifiers[g->notifiers_count].w = w;
g->notifiers[g->notifiers_count].private = private;
/* initialize done to 1 so as not to call the handler if it's created
* by the call of another one that is in progress
*/
g->notifiers[g->notifiers_count].done = 1;
-
g->notifiers_count++;
-
gunlock(g);
-
return ret;
}
-void unregister_notifier(gui *_g, unsigned long notifier_id)
-{
+void unregister_notifier(gui *_g, unsigned long notifier_id) {
struct gui *g = _g;
int i;
-
glock(g);
for (i = 0; i < g->notifiers_count; i++)
if (g->notifiers[i].id == notifier_id) break;
if (i == g->notifiers_count)
- ERR("%s:%d: notifier_id %ld not found\n", __FILE__,__LINE__,notifier_id);
+ ERR("%s:%d: notifier_id %lu not found\n", __FILE__,__LINE__,notifier_id);
free(g->notifiers[i].notification);
-
memmove(g->notifiers + i, g->notifiers + i + 1,
- (g->notifiers_count-1 - i) * sizeof(struct notifier));
-
+ (g->notifiers_count-1 - i) * sizeof(struct notifier));
g->notifiers_count--;
g->notifiers = realloc(g->notifiers,
- g->notifiers_count * sizeof(struct notifier));
+ g->notifiers_count * sizeof(struct notifier));
+
if (g->notifiers == NULL) abort();
gunlock(g);
@@ -68,19 +62,19 @@ void unregister_notifier(gui *_g, unsigned long notifier_id)
/* called with lock ON */
void gui_notify(struct gui *g, char *notification, widget *w,
- void *notification_data)
-{
+ void *notification_data) {
void *private;
notifier handler;
int i;
-
/* this function is not re-entrant, for the moment keep as is
* and if the need is there, we'll make a new thread to handle
* notifications (or something)
* for now let's crash in case of recursive call
*/
static int inside = 0;
+
if (inside) ERR("%s:%d: BUG! contact the authors\n", __FILE__, __LINE__);
+
inside = 1;
/* clear all handlers */
@@ -91,26 +85,25 @@ void gui_notify(struct gui *g, char *notification, widget *w,
* need to be careful here
*/
loop:
+
for (i = 0; i < g->notifiers_count; i++) {
if (g->notifiers[i].done == 1 ||
g->notifiers[i].w != w ||
strcmp(g->notifiers[i].notification, notification) != 0)
continue;
+
break;
}
+
if (i == g->notifiers_count) goto done;
g->notifiers[i].done = 1;
-
handler = g->notifiers[i].handler;
private = g->notifiers[i].private;
-
gunlock(g);
handler(private, g, notification, w, notification_data);
glock(g);
-
goto loop;
-
done:
inside = 0;
}
diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c
index 0f15f4862a..c10b76c6ee 100644
--- a/common/utils/T/tracer/gui/xy_plot.c
+++ b/common/utils/T/tracer/gui/xy_plot.c
@@ -130,9 +130,13 @@ static void paint(gui *_gui, widget *_this)
this->common.y + FLIP(y),
this->common.x + this->vrule_width + 5,
this->common.y + FLIP(y));
+ /* do not print out of the widget (take care of top) */
+ y = FLIP(y)-this->label_height/2+this->label_baseline;
+ if (y - this->label_baseline < 0)
+ y = this->label_baseline;
x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
this->common.x + this->vrule_width - vwidth - 2,
- this->common.y + FLIP(y)-this->label_height/2+this->label_baseline,
+ this->common.y + y,
v);
}
break;
diff --git a/common/utils/T/tracer/hacks/Makefile b/common/utils/T/tracer/hacks/Makefile
index f49e437bf5..af2663e48f 100644
--- a/common/utils/T/tracer/hacks/Makefile
+++ b/common/utils/T/tracer/hacks/Makefile
@@ -3,7 +3,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I..
LIBS=-lX11 -lm -lpng -lXft
-all: dump_nack_signal time_meas timeplot
+all: dump_nack_signal time_meas timeplot multi-rru-clean
dump_nack_signal: ../utils.o ../database.o ../config.o ../event.o \
dump_nack_signal.o
@@ -16,6 +16,9 @@ time_meas: ../utils.o ../database.o ../config.o ../event.o \
timplot: timeplot.o
$(CC) $(CFLAGS) -o timeplot $^ $(LIBS)
+multi-rru-clean: ../utils.o ../database.o ../event.o ../config.o multi-rru-clean.o
+ $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
.PHONY: all
%.o: %.c
diff --git a/common/utils/T/tracer/hacks/dump_nack_signal.c b/common/utils/T/tracer/hacks/dump_nack_signal.c
index bb8f1a9477..02825202fb 100644
--- a/common/utils/T/tracer/hacks/dump_nack_signal.c
+++ b/common/utils/T/tracer/hacks/dump_nack_signal.c
@@ -7,21 +7,19 @@
#include "config.h"
#include "../T_defs.h"
-void usage(void)
-{
+void usage(void) {
printf(
-"options:\n"
-" -d this option is mandatory\n"
-" -ip connect to given IP address (default %s)\n"
-" -p connect to given port (default %d)\n",
- DEFAULT_REMOTE_IP,
- DEFAULT_REMOTE_PORT
+ "options:\n"
+ " -d this option is mandatory\n"
+ " -ip connect to given IP address (default %s)\n"
+ " -p connect to given port (default %d)\n",
+ DEFAULT_REMOTE_IP,
+ DEFAULT_REMOTE_PORT
);
exit(1);
}
-int main(int n, char **v)
-{
+int main(int n, char **v) {
char *database_filename = NULL;
void *database;
char *ip = DEFAULT_REMOTE_IP;
@@ -36,11 +34,28 @@ int main(int n, char **v)
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
- if (!strcmp(v[i], "-d"))
- { if (i > n-2) usage(); database_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
- if (!strcmp(v[i], "-p"))
- { if (i > n-2) usage(); port = atoi(v[++i]); continue; }
+
+ if (!strcmp(v[i], "-d")) {
+ if (i > n-2) usage();
+
+ database_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-ip")) {
+ if (i > n-2) usage();
+
+ ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-p")) {
+ if (i > n-2) usage();
+
+ port = atoi(v[++i]);
+ continue;
+ }
+
usage();
}
@@ -50,71 +65,92 @@ int main(int n, char **v)
}
database = parse_database(database_filename);
-
load_config_file(database_filename);
-
number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int));
+
if (is_on == NULL) abort();
on_off(database, "ENB_PHY_INPUT_SIGNAL", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_NACK", is_on, 1);
on_off(database, "ENB_PHY_ULSCH_UE_ACK", is_on, 1);
-
ev_input = event_id_from_name(database, "ENB_PHY_INPUT_SIGNAL");
ev_nack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_NACK");
ev_ack = event_id_from_name(database, "ENB_PHY_ULSCH_UE_ACK");
-
socket = connect_to(ip, port);
-
t = 1;
+
if (socket_send(socket, &t, 1) == -1 ||
socket_send(socket, &number_of_events, sizeof(int)) == -1 ||
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort();
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
-
char dump[10][T_BUFFER_MAX];
event dump_ev[10];
-FILE *z = fopen("/tmp/dd", "w"); if (z == NULL) abort();
+ FILE *z = fopen("/tmp/dd", "w");
+
+ if (z == NULL) abort();
+
while (1) {
char *v;
event e;
e = get_event(socket, &ebuf, database);
v = ebuf.obuf;
+
if (e.type == -1) break;
+
if (e.type == ev_input) {
int sf = e.e[2].i;
- if (ebuf.osize > T_BUFFER_MAX)
- { printf("event size too big\n"); exit(1); }
+
+ if (ebuf.osize > T_BUFFER_MAX) {
+ printf("event size too big\n");
+ exit(1);
+ }
+
memcpy(dump[sf], ebuf.obuf, ebuf.osize);
dump_ev[sf] = e;
printf("input %d/%d\n", e.e[1].i, sf);
-if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
-fflush(z);
+
+ if (fwrite(dump_ev[sf].e[4].b, dump_ev[sf].e[4].bsize, 1, z) != 1) abort();
+
+ fflush(z);
}
+
if (e.type == ev_nack) {
int sf = e.e[2].i;
printf("nack %d/%d\n", e.e[1].i, sf);
- FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort();
+ FILE *f = fopen("/tmp/dump.raw", "w");
+
+ if (f == NULL) abort();
+
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
- dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+ dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+
if (fclose(f)) abort();
+
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
-// getchar();
+ // getchar();
}
+
if (e.type == ev_ack) {
int sf = e.e[2].i;
printf("ack %d/%d\n", e.e[1].i, sf);
- FILE *f = fopen("/tmp/dump.raw", "w"); if (f == NULL) abort();
+ FILE *f = fopen("/tmp/dump.raw", "w");
+
+ if (f == NULL) abort();
+
if (fwrite(dump[sf] + ((char *)dump_ev[sf].e[4].b - v),
- dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+ dump_ev[sf].e[4].bsize, 1, f) != 1) abort();
+
if (fclose(f)) abort();
+
printf("dumped... press enter (delta %d)\n", (int)((char *)dump_ev[sf].e[4].b - v));
-// getchar();
+ // getchar();
}
}
+ if (z)
+ fclose(z);
return 0;
}
diff --git a/common/utils/T/tracer/hacks/multi-rru-clean.c b/common/utils/T/tracer/hacks/multi-rru-clean.c
new file mode 100644
index 0000000000..c85dc0de7f
--- /dev/null
+++ b/common/utils/T/tracer/hacks/multi-rru-clean.c
@@ -0,0 +1,230 @@
+#include
+#include
+#include
+#include "database.h"
+#include "utils.h"
+#include "event.h"
+#include "../T_defs.h"
+
+void usage(void)
+{
+ printf(
+ "usage: \n"
+ "options:\n"
+ " -d this option is mandatory\n"
+ );
+ exit(1);
+}
+
+#define ERR printf("ERROR: read file %s failed\n", input_filename)
+
+typedef struct {
+ OBUF b;
+ struct timespec t;
+ int filled;
+ int error;
+} cache_t;
+
+void clear_cache(int n, cache_t *c)
+{
+ int i;
+ for (i = 0; i < n; i++) {
+ c[i].filled = 0;
+ c[i].error = 0;
+ c[i].b.osize = 0;
+ }
+}
+
+void store_in_cache(cache_t *c, int pos, OBUF *b)
+{
+ int i;
+ for (i = 0; i < b->osize; i++)
+ PUTC(&c[pos].b, b->obuf[i]);
+}
+
+int get_field(database_event_format *f, char *field, char *type)
+{
+ int i;
+ for (i = 0; i < f->count; i++)
+ if (!strcmp(f->name[i], field)) {
+ if (strcmp(f->type[i], type)) break;
+ return i;
+ }
+ printf("bad field %s, check that it exists and has type '%s'\n",field,type);
+ exit(1);
+}
+
+void process_cache(FILE *out, cache_t *c, int n, int frame, int subframe)
+{
+ int i;
+ struct tm *t;
+
+ for (i = 0; i < n; i++)
+ if (c[i].filled == 0 || c[i].error == 1)
+ goto error;
+
+ for (i = 0; i < n; i++)
+ fwrite(c[i].b.obuf, c[i].b.osize, 1, out);
+
+ clear_cache(n, c);
+ return;
+
+error:
+ printf("ERROR: incorrect data at frame %d subframe %d", frame, subframe);
+ for (i = 0; i < n; i++) if (c[i].filled) {
+ t = localtime(&c[i].t.tv_sec);
+ printf(" [tag %d time %2.2d:%2.2d:%2.2d.%9.9ld]", i,
+ t->tm_hour, t->tm_min, t->tm_sec, c[i].t.tv_nsec);
+ }
+ printf("\n");
+ clear_cache(n, c);
+}
+
+int main(int n, char **v)
+{
+ char *database_filename = NULL;
+ void *database;
+ int channel_estimate_id;
+ int number_of_tags = -1;
+ char *input_filename = NULL;
+ char *output_filename = NULL;
+ int i;
+ FILE *in;
+ FILE *out;
+ database_event_format f;
+ int frame_arg;
+ int subframe_arg;
+ int tag_arg;
+
+ cache_t *cache;
+ int cur_frame = -1;
+ int cur_subframe = -1;
+ int frame;
+ int subframe;
+ int tag;
+
+ for (i = 1; i < n; i++) {
+ if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
+ if (!strcmp(v[i], "-d")) { if (i > n-2) usage();
+ database_filename = v[++i]; continue; }
+ if (number_of_tags == -1) { number_of_tags = atoi(v[i]);
+ if (number_of_tags <= 0) {usage();} continue; }
+ if (input_filename == NULL) { input_filename = v[i]; continue; }
+ if (output_filename == NULL) { output_filename = v[i]; continue; }
+ usage();
+ }
+
+ if (database_filename == NULL) {
+ printf("ERROR: provide a database file (-d)\n");
+ exit(1);
+ }
+
+ if (output_filename == NULL || input_filename == NULL || number_of_tags == -1)
+ usage();
+
+ database = parse_database(database_filename);
+
+ channel_estimate_id = event_id_from_name(database, "CALIBRATION_CHANNEL_ESTIMATES");
+ f = get_format(database, channel_estimate_id);
+
+ frame_arg = get_field(&f, "frame", "int");
+ subframe_arg = get_field(&f, "subframe", "int");
+ tag_arg = get_field(&f, "tag", "int");
+
+ in = fopen(input_filename, "r");
+ if (in == NULL) { perror(input_filename); abort(); }
+ out = fopen(output_filename, "w");
+ if (out == NULL) { perror(output_filename); abort(); }
+
+ cache = calloc(number_of_tags, sizeof(cache_t));
+ if (cache == NULL) { perror("malloc"); exit(1); }
+
+ clear_cache(number_of_tags, cache);
+
+ OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
+
+ while (1) {
+ int type;
+ int32_t length;
+ char *v;
+ int vpos = 0;
+ struct timespec t;
+ char *buf;
+
+ /* read event from file */
+ if (fread(&length, 4, 1, in) != 1) break;
+ if (ebuf.omaxsize < length) {
+ ebuf.omaxsize = (length + 65535) & ~65535;
+ ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
+ if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
+ }
+ v = ebuf.obuf;
+ memcpy(v+vpos, &length, 4);
+ vpos += 4;
+#ifdef T_SEND_TIME
+ if (length < sizeof(struct timespec)) { ERR; break; }
+ if (fread(&t, sizeof(struct timespec), 1, in) != 1) { ERR; break; }
+ memcpy(v+vpos, &t, sizeof(struct timespec));
+ vpos += sizeof(struct timespec);
+ length -= sizeof(struct timespec);
+#endif
+ if (length < sizeof(int)) { ERR; break; }
+ if (fread(&type, sizeof(int), 1, in) != 1) { ERR; break; }
+ memcpy(v+vpos, &type, sizeof(int));
+ vpos += sizeof(int);
+ length -= sizeof(int);
+ if (length) if (fread(v+vpos, length, 1, in) != 1) { ERR; break; }
+ buf = v + vpos;
+ vpos += length;
+ ebuf.osize = vpos;
+
+ if (type != channel_estimate_id) continue;
+
+ event e;
+#ifdef T_SEND_TIME
+ e = new_event(t, type, length, buf, database);
+#else
+ e = new_event(type, length, buf, database);
+#endif
+
+ frame = e.e[frame_arg].i;
+ subframe = e.e[subframe_arg].i;
+ tag = e.e[tag_arg].i;
+
+ if (tag < 0 || tag >= number_of_tags) {
+ struct tm *tt;
+ tt = localtime(&t.tv_sec);
+ printf("ERROR: invalid tag (%d), skipping event for frame %d subframe %d (time %2.2d:%2.2d:%2.2d.%9.9ld)\n",
+ tag, frame, subframe,
+ tt->tm_hour, tt->tm_min, tt->tm_sec, t.tv_nsec);
+ continue;
+ }
+
+ if (cur_frame != frame || cur_subframe != subframe)
+ if (cur_frame != -1)
+ process_cache(out, cache, number_of_tags, cur_frame, cur_subframe);
+
+ cur_frame = frame;
+ cur_subframe = subframe;
+
+ if (cache[tag].filled) {
+ struct tm *tt;
+ tt = localtime(&t.tv_sec);
+ printf("ERROR: tag %d present twice at frame %d subframe %d (time %2.2d:%2.2d:%2.2d.%9.9ld)\n",
+ tag, frame, subframe,
+ tt->tm_hour, tt->tm_min, tt->tm_sec, t.tv_nsec);
+ cache[tag].error = 1;
+ continue;
+ }
+
+ store_in_cache(cache, tag, &ebuf);
+ cache[tag].filled = 1;
+ cache[tag].t = t;
+ }
+
+ if (fclose(in)) perror(input_filename);
+ if (fclose(out)) perror(output_filename);
+ free(cache);
+
+ return 0;
+}
diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c
index d9bcb8b7f5..8720efd8c0 100644
--- a/common/utils/T/tracer/macpdu2wireshark.c
+++ b/common/utils/T/tracer/macpdu2wireshark.c
@@ -58,14 +58,11 @@ typedef struct {
} ev_data;
void trace(ev_data *d, int direction, int rnti_type, int rnti,
- int frame, int subframe, void *buf, int bufsize, int preamble)
-{
+ int frame, int subframe, void *buf, int bufsize, int preamble) {
ssize_t ret;
int fsf;
int i;
-
d->buf.osize = 0;
-
PUTS(&d->buf, MAC_LTE_START_STRING);
PUTC(&d->buf, FDD_RADIO);
PUTC(&d->buf, direction);
@@ -92,16 +89,17 @@ void trace(ev_data *d, int direction, int rnti_type, int rnti,
}
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
+
for (i = 0; i < bufsize; i++)
- PUTC(&d->buf, ((char*)buf)[i]);
+ PUTC(&d->buf, ((char *)buf)[i]);
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
- (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+ (struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
+
if (ret != d->buf.osize) abort();
}
-void ul(void *_d, event e)
-{
+void ul(void *_d, event e) {
ev_data *d = _d;
trace(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
@@ -109,13 +107,14 @@ void ul(void *_d, event e)
NO_PREAMBLE);
}
-void dl(void *_d, event e)
-{
+void dl(void *_d, event e) {
ev_data *d = _d;
if (e.e[d->dl_rnti].i == 0xffff) {
if (d->no_sib) return;
+
if (d->max_sib && d->cur_sib == d->max_sib) return;
+
d->cur_sib++;
}
@@ -126,22 +125,21 @@ void dl(void *_d, event e)
NO_PREAMBLE);
}
-void mib(void *_d, event e)
-{
+void mib(void *_d, event e) {
ev_data *d = _d;
if (d->no_mib) return;
- if (d->max_mib && d->cur_mib == d->max_mib) return;
- d->cur_mib++;
+ if (d->max_mib && d->cur_mib == d->max_mib) return;
+
+ d->cur_mib++;
trace(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
e.e[d->mib_data].b, e.e[d->mib_data].bsize,
NO_PREAMBLE);
}
-void preamble(void *_d, event e)
-{
+void preamble(void *_d, event e) {
ev_data *d = _d;
trace(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
@@ -149,8 +147,7 @@ void preamble(void *_d, event e)
e.e[d->preamble_preamble].i);
}
-void rar(void *_d, event e)
-{
+void rar(void *_d, event e) {
ev_data *d = _d;
trace(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
@@ -159,114 +156,118 @@ void rar(void *_d, event e)
}
void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
- int preamble_id, int rar_id)
-{
+ int preamble_id, int rar_id) {
database_event_format f;
int i;
-
d->ul_rnti = -1;
d->ul_frame = -1;
d->ul_subframe = -1;
d->ul_data = -1;
-
d->dl_rnti = -1;
d->dl_frame = -1;
d->dl_subframe = -1;
d->dl_data = -1;
-
d->mib_frame = -1;
d->mib_subframe = -1;
d->mib_data = -1;
-
d->preamble_frame = -1;
d->preamble_subframe = -1;
d->preamble_preamble = -1;
-
d->rar_rnti = -1;
d->rar_frame = -1;
d->rar_subframe = -1;
d->rar_data = -1;
-
#define G(var_name, var_type, var) \
if (!strcmp(f.name[i], var_name)) { \
if (strcmp(f.type[i], var_type)) goto error; \
var = i; \
continue; \
}
-
/* ul: rnti, frame, subframe, data */
f = get_format(database, ul_id);
+
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->ul_rnti);
G("frame", "int", d->ul_frame);
G("subframe", "int", d->ul_subframe);
G("data", "buffer", d->ul_data);
}
+
if (d->ul_rnti == -1 || d->ul_frame == -1 || d->ul_subframe == -1 ||
d->ul_data == -1) goto error;
/* dl: rnti, frame, subframe, data */
f = get_format(database, dl_id);
+
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->dl_rnti);
G("frame", "int", d->dl_frame);
G("subframe", "int", d->dl_subframe);
G("data", "buffer", d->dl_data);
}
+
if (d->dl_rnti == -1 || d->dl_frame == -1 || d->dl_subframe == -1 ||
d->dl_data == -1) goto error;
/* MIB: frame, subframe, data */
f = get_format(database, mib_id);
+
for (i = 0; i < f.count; i++) {
G("frame", "int", d->mib_frame);
G("subframe", "int", d->mib_subframe);
G("data", "buffer", d->mib_data);
}
+
if (d->mib_frame == -1 || d->mib_subframe == -1 || d->mib_data == -1)
goto error;
/* preamble: frame, subframe, preamble */
f = get_format(database, preamble_id);
+
for (i = 0; i < f.count; i++) {
G("frame", "int", d->preamble_frame);
G("subframe", "int", d->preamble_subframe);
G("preamble", "int", d->preamble_preamble);
}
+
if (d->preamble_frame == -1 || d->preamble_subframe == -1 ||
d->preamble_preamble == -1) goto error;
/* rar: rnti, frame, subframe, data */
f = get_format(database, rar_id);
+
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->rar_rnti);
G("frame", "int", d->rar_frame);
G("subframe", "int", d->rar_subframe);
G("data", "buffer", d->rar_data);
}
+
if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 ||
d->rar_data == -1) goto error;
#undef G
-
return;
-
error:
printf("bad T_messages.txt\n");
abort();
}
-void *receiver(void *_d)
-{
+void *receiver(void *_d) {
ev_data *d = _d;
int s;
char buf[100000];
-
s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s == -1) { perror("socket"); abort(); }
- if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1)
- { perror("bind"); abort(); }
+ if (s == -1) {
+ perror("socket");
+ abort();
+ }
+
+ if (bind(s, (struct sockaddr *)&d->to, sizeof(struct sockaddr_in)) == -1) {
+ perror("bind");
+ abort();
+ }
while (1) {
if (recv(s, buf, 100000, 0) <= 0) abort();
@@ -275,33 +276,31 @@ void *receiver(void *_d)
return 0;
}
-void usage(void)
-{
+void usage(void) {
printf(
-"options:\n"
-" -d this option is mandatory\n"
-" -i read events from this dump file\n"
-" -ip send packets to this IP address (default %s)\n"
-" -p send packets to this port (default %d)\n"
-" -no-mib do not report MIB\n"
-" -no-sib do not report SIBs\n"
-" -max-mib report at maximum n MIB\n"
-" -max-sib report at maximum n SIBs\n"
-" -live run live\n"
-" -live-ip tracee's IP address (default %p)\n"
-" -live-port tracee's port (default %d)\n"
-"-i and -live are mutually exclusive options. One of them must be provided\n"
-"but not both.\n",
- DEFAULT_IP,
- DEFAULT_PORT,
- DEFAULT_LIVE_IP,
- DEFAULT_LIVE_PORT
+ "options:\n"
+ " -d this option is mandatory\n"
+ " -i read events from this dump file\n"
+ " -ip send packets to this IP address (default %s)\n"
+ " -p send packets to this port (default %d)\n"
+ " -no-mib do not report MIB\n"
+ " -no-sib do not report SIBs\n"
+ " -max-mib report at maximum n MIB\n"
+ " -max-sib report at maximum n SIBs\n"
+ " -live run live\n"
+ " -live-ip tracee's IP address (default %s)\n"
+ " -live-port tracee's port (default %d)\n"
+ "-i and -live are mutually exclusive options. One of them must be provided\n"
+ "but not both.\n",
+ DEFAULT_IP,
+ DEFAULT_PORT,
+ DEFAULT_LIVE_IP,
+ DEFAULT_LIVE_PORT
);
exit(1);
}
-int main(int n, char **v)
-{
+int main(int n, char **v) {
char *database_filename = NULL;
char *input_filename = NULL;
void *database;
@@ -315,28 +314,82 @@ int main(int n, char **v)
char *live_ip = DEFAULT_LIVE_IP;
int live_port = DEFAULT_LIVE_PORT;
int live = 0;
-
memset(&d, 0, sizeof(ev_data));
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
- if (!strcmp(v[i], "-d"))
- { if (i > n-2) usage(); database_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-i"))
- { if (i > n-2) usage(); input_filename = v[++i]; continue; }
- if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
- if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
- if (!strcmp(v[i], "-no-mib")) { d.no_mib = 1; continue; }
- if (!strcmp(v[i], "-no-sib")) { d.no_sib = 1; continue; }
- if (!strcmp(v[i], "-max-mib"))
- { if (i > n-2) usage(); d.max_mib = atoi(v[++i]); continue; }
- if (!strcmp(v[i], "-max-sib"))
- { if (i > n-2) usage(); d.max_sib = atoi(v[++i]); continue; }
- if (!strcmp(v[i], "-live")) { live = 1; continue; }
- if (!strcmp(v[i], "-live-ip"))
- { if (i > n-2) usage(); live_ip = v[++i]; continue; }
- if (!strcmp(v[i], "-live-port"))
- { if (i > n-2) usage(); live_port = atoi(v[++i]); continue; }
+
+ if (!strcmp(v[i], "-d")) {
+ if (i > n-2) usage();
+
+ database_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-i")) {
+ if (i > n-2) usage();
+
+ input_filename = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-ip")) {
+ if (i > n-2) usage();
+
+ ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-p")) {
+ if(i>n-2)usage();
+
+ port=atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-no-mib")) {
+ d.no_mib = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-no-sib")) {
+ d.no_sib = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-max-mib")) {
+ if (i > n-2) usage();
+
+ d.max_mib = atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-max-sib")) {
+ if (i > n-2) usage();
+
+ d.max_sib = atoi(v[++i]);
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live")) {
+ live = 1;
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live-ip")) {
+ if (i > n-2) usage();
+
+ live_ip = v[++i];
+ continue;
+ }
+
+ if (!strcmp(v[i], "-live-port")) {
+ if (i > n-2) usage();
+
+ live_port = atoi(v[++i]);
+ continue;
+ }
+
usage();
}
@@ -357,25 +410,34 @@ int main(int n, char **v)
if (live == 0) {
in = open(input_filename, O_RDONLY);
- if (in == -1) { perror(input_filename); return 1; }
+
+ if (in == -1) {
+ perror(input_filename);
+ return 1;
+ }
} else
in = connect_to(live_ip, live_port);
database = parse_database(database_filename);
load_config_file(database_filename);
-
h = new_handler(database);
if (live) {
char mt = 1;
int number_of_events = number_of_ids(database);
int *is_on = calloc(number_of_events, sizeof(int));
- if (is_on == NULL) { printf("ERROR: out of memory\n"); exit(1); }
+
+ if (is_on == NULL) {
+ printf("ERROR: out of memory\n");
+ exit(1);
+ }
+
on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 1);
on_off(database, "ENB_MAC_UE_DL_PDU_WITH_DATA", is_on, 1);
on_off(database, "ENB_PHY_MIB", is_on, 1);
on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1);
on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1);
+
/* activate selected traces */
if (socket_send(in, &mt, 1) == -1 ||
socket_send(in, &number_of_events, sizeof(int)) == -1 ||
@@ -383,6 +445,7 @@ int main(int n, char **v)
printf("ERROR: socket_send failed\n");
exit(1);
}
+
free(is_on);
}
@@ -392,31 +455,34 @@ int main(int n, char **v)
preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE");
rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id);
-
register_handler_function(h, ul_id, ul, &d);
register_handler_function(h, dl_id, dl, &d);
register_handler_function(h, mib_id, mib, &d);
register_handler_function(h, preamble_id, preamble, &d);
register_handler_function(h, rar_id, rar, &d);
-
d.socket = socket(AF_INET, SOCK_DGRAM, 0);
- if (d.socket == -1) { perror("socket"); exit(1); }
+
+ if (d.socket == -1) {
+ perror("socket");
+ exit(1);
+ }
d.to.sin_family = AF_INET;
d.to.sin_port = htons(port);
d.to.sin_addr.s_addr = inet_addr(ip);
-
new_thread(receiver, &d);
-
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
/* read messages */
while (1) {
event e;
e = get_event(in, &ebuf, database);
+
if (e.type == -1) break;
+
if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
e.type == preamble_id || e.type == rar_id)) continue;
+
handle_event(h, e);
}
diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c
index a123bf9bf5..f83cc7efd3 100644
--- a/common/utils/T/tracer/textlog.c
+++ b/common/utils/T/tracer/textlog.c
@@ -195,5 +195,8 @@ int main(int n, char **v)
handle_event(h, e);
}
+ free(on_off_name);
+ free(on_off_action);
+
return 0;
}
diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c
index 7b03210cd2..bafa0384f2 100644
--- a/common/utils/T/tracer/ue.c
+++ b/common/utils/T/tracer/ue.c
@@ -23,9 +23,6 @@ typedef struct {
view *pdcpview;
view *rrcview;
view *legacy;
- widget *current_ue_label;
- widget *prev_ue_button;
- widget *next_ue_button;
widget *pdsch_iq_ue_xy_plot;
widget *dl_estimate_ue_xy_plot;
widget *pdcch_energy_ue_xy_plot;
@@ -121,15 +118,14 @@ static void *gui_thread(void *_g)
return NULL;
}
-static filter *ticktime_filter(void *database, char *event, int i, int ue)
+static filter *ticktime_filter(void *database, char *event, int i)
{
- /* filter is "harq_pid == i && UE_id == 0 && eNB_id == 0" */
+ /* filter is "harq_pid == i and eNB_id == 0" */
return
filter_and(
filter_eq(filter_evarg(database, event, "harq_pid"), filter_int(i)),
- filter_and(
- filter_eq(filter_evarg(database, event, "UE_id"), filter_int(ue)),
- filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0))));
+ filter_eq(filter_evarg(database, event, "eNB_ID"), filter_int(0)));
+
}
static void set_current_ue(gui *g, ue_data *e, int ue)
@@ -137,8 +133,6 @@ static void set_current_ue(gui *g, ue_data *e, int ue)
int i;
char s[256];
- sprintf(s, "[UE %d] ", ue);
- label_set_text(g, e->e->current_ue_label, s);
sprintf(s, "PDSCH IQ [UE %d]", ue);
xy_plot_set_title(g, e->e->pdsch_iq_ue_xy_plot, s);
sprintf(s, "DL estimated channel [UE %d]", ue);
@@ -161,97 +155,24 @@ static void set_current_ue(gui *g, ue_data *e, int ue)
xy_plot_set_title(g, e->e->pucch_power_xy_plot, s);
sprintf(s, "PHY Measurements [UE %d]", ue);
xy_plot_set_title(g, e->e->phy_meas_xy_plot, s);
-
- logger_set_filter(e->e->pdsch_iq_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDSCH_IQ", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->dl_estimate_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_DL_CHANNEL_ESTIMATE", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->pdcch_energy_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDCCH_ENERGY", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->pdsch_energy_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDSCH_ENERGY", "UE_ID"),
- filter_int(ue)));
- logger_set_filter(e->e->phy_meas_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_MEAS", "UE_ID"),
- filter_int(ue)));
- /*logger_set_filter(e->pucch1_energy_ue_energy_logger,
- filter_eq(
- filter_evarg(e->database, "ENB_PHY_PUCCH_1_ENERGY", "UE_ID"),
- filter_int(ue)));*/
- /*logger_set_filter(e->e->pdcch_iq_ue_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PDCCH_IQ", "UE_ID"),
- filter_int(ue)));*/
+
for (i = 0; i < 8; i++) {
logger_set_filter(e->e->dl_dci_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_DCI", i));
logger_set_filter(e->e->dl_ack_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_ACK", i));
logger_set_filter(e->e->dl_nack_logger[i],
- ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_DLSCH_UE_NACK", i));
logger_set_filter(e->e->ul_dci_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_DCI", i));
/*logger_set_filter(e->ul_dci_retransmission_logger[i],
ticktime_filter(e->database,
- "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i, ue));*/
+ "ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", i));*/
logger_set_filter(e->e->ul_ack_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_ACK", i));
logger_set_filter(e->e->ul_nack_logger[i],
- ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i, ue));
+ ticktime_filter(e->database, "UE_PHY_ULSCH_UE_NACK", i));
}
- logger_set_filter(e->e->dl_mcs_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_DLSCH_UE_DCI", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->ul_mcs_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_ULSCH_UE_DCI", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pusch_power_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pusch_ampl_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUSCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pucch_power_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
- filter_int(ue)));
- logger_set_filter(e->e->pucch_ampl_logger,
- filter_eq(
- filter_evarg(e->database, "UE_PHY_PUCCH_TX_POWER", "UE_id"),
- filter_int(ue)));
-}
-
-static void click(void *private, gui *g,
- char *notification, widget *w, void *notification_data)
-{
- int *d = notification_data;
- int button = d[0];
- ue_data *ed = private;
- ue_gui *e = ed->e;
- int ue = ed->ue;
-
- if (button != 1) return;
- if (w == e->prev_ue_button) { ue--; if (ue < 0) ue = 0; }
- if (w == e->next_ue_button) ue++;
-
- if (pthread_mutex_lock(&ed->lock)) abort();
- if (ue != ed->ue) {
- set_current_ue(g, ed, ue);
- ed->ue = ue;
- }
- if (pthread_mutex_unlock(&ed->lock)) abort();
}
static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
@@ -271,7 +192,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
widget *text;
view *textview;
int i;
- widget *w, *w2;
+ widget *w;
view *v;
logger *l;
@@ -283,24 +204,8 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
widget_add_child(g, top_container, line, -1);
logo = new_image(g, openair_logo_png, openair_logo_png_len);
- /* logo + prev/next UE buttons */
- col = new_container(g, VERTICAL);
- widget_add_child(g, col, logo, -1);
- w = new_container(g, HORIZONTAL);
- widget_add_child(g, col, w, -1);
- w2 = new_label(g, "");
- widget_add_child(g, w, w2, -1);
- e->current_ue_label = w2;
- /* TODO: use button widget, not label widget */
- w2 = new_label(g, " [prev UE] ");
- widget_add_child(g, w, w2, -1);
- label_set_clickable(g, w2, 1);
- e->prev_ue_button = w2;
- w2 = new_label(g, " [next UE] ");
- widget_add_child(g, w, w2, -1);
- label_set_clickable(g, w2, 1);
- e->next_ue_button = w2;
- widget_add_child(g, line, col, -1);
+ /* logo */
+ widget_add_child(g, line, logo, -1);
input_signal_plot = new_xy_plot(g, 256, 55, "input signal", 20);
widget_add_child(g, line, input_signal_plot, -1);
@@ -356,80 +261,13 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#0c720c"));
logger_add_view(l, v);
e->phy_meas_logger = l;
-
- /* UE x PDSCH energy */
- w = new_xy_plot(g, 128, 55, "", 50);
- e->pdsch_energy_ue_xy_plot = w;
+
+ /* a bit of space */
+ line = new_container(g, HORIZONTAL);
+ widget_add_child(g, top_container, line, -1);
+ w = new_space(g, 1, 10);
widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
- v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
- v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
- logger_add_view(l, v);
- e->pdsch_energy_logger = l;
-
- /* UE x PDCCH energy */
- w = new_xy_plot(g, 128, 55, "", 50);
- e->pdcch_energy_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
- v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
- v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
- l = new_ttilog(h, database,
- "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
- v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
- logger_add_view(l, v);
- e->pdcch_energy_logger = l;
-
- /* UE x PDCCH IQ data */
- w = new_xy_plot(g, 55, 55, "", 50);
- e->pdcch_iq_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, -100, 100, -100, 100);
- l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
- "NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
- v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
- logger_add_view(l, v);
- e->pdcch_iq_ue_logger = l;
-
- /* UE x PDCCH IQ data */
- /*w = new_xy_plot(g, 55, 55, "", 50);
- e->pdcch_iq_ue_xy_plot = w;
- widget_add_child(g, line, w, -1);
- xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
- l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
- v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
- logger_add_view(l, v);
- e->pdcch_iq_ue_logger = l;*/
-
+
/* UE x DL mcs */
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
@@ -448,7 +286,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
xy_plot_set_range(g, w, 0, 1024*10, -2, 30);
e->ul_mcs_xy_plot = w;
widget_add_child(g, line, w, -1);
- l = new_ticked_ttilog(h, database, "UE_PHY_UL_TICK", "frame", "subframe",
+ l = new_ticked_ttilog(h, database, "UE_PHY_DL_TICK", "frame", "subframe",
"UE_PHY_ULSCH_UE_DCI", "mcs", 0, -1);
v = new_view_tti(10, g, w, new_color(g, "#0c0c72"));
logger_add_view(l, v);
@@ -471,7 +309,7 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pusch_ampl_logger = l;
-
+
/* UE x PUCCH TX Power */
// line = new_container(g, HORIZONTAL);
// widget_add_child(g, top_container, line, -1);
@@ -489,8 +327,81 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
v = new_view_tti(10, g, w, new_color(g, "#720c0c"));
logger_add_view(l, v);
e->pucch_ampl_logger = l;
-
-
+
+ /* UE x PDSCH energy */
+ w = new_xy_plot(g, 128, 55, "", 50);
+ e->pdsch_energy_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level00", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level01", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level10", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDSCH_ENERGY", "frame", "subframe", "pdsch_ch_level11", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+ logger_add_view(l, v);
+ e->pdsch_energy_logger = l;
+
+ /* UE x PDCCH energy */
+ w = new_xy_plot(g, 128, 55, "", 50);
+ e->pdcch_energy_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, 0, 1024*10, -10, 80);
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level00", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#ff0000"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level01", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#00ff00"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level10", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0f0f0f"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+ l = new_ttilog(h, database,
+ "UE_PHY_PDCCH_ENERGY", "frame", "subframe", "pdcch_ch_level11", 1);
+ v = new_view_tti(10, g, w, new_color(g, "#0000ff"));
+ logger_add_view(l, v);
+ e->pdcch_energy_logger = l;
+
+ /* UE x PDCCH IQ data */
+ w = new_xy_plot(g, 55, 55, "", 50);
+ e->pdcch_iq_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, -100, 100, -100, 100);
+ l = new_iqlog(h, database, "UE_PHY_PDCCH_IQ", "nb_rb",
+ "NB_RB_DL", "symbols_per_tti", "rxdataF_comp");
+ v = new_view_xy(100*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
+ logger_add_view(l, v);
+ e->pdcch_iq_ue_logger = l;
+
+ /* UE x PDCCH IQ data */
+ /*w = new_xy_plot(g, 55, 55, "", 50);
+ e->pdcch_iq_ue_xy_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, -2000, 2000, -2000, 2000);
+ l = new_iqdotlog(h, database, "UE_PHY_PDCCH_IQ", "I", "Q");
+ v = new_view_xy(500, 10, g, w, new_color(g,"#000"), XY_LOOP_MODE);
+ logger_add_view(l, v);
+ e->pdcch_iq_ue_logger = l;*/
+
+
/* downlink/uplink UE DCIs */
widget_add_child(g, top_container,
new_label(g,"DL/UL TICK/DCI/ACK/NACK [all UEs]"), -1);
@@ -600,14 +511,14 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
logger_add_view(timelog, subview);
e->ul_dci_logger[i] = timelog;
/* retransmission */
-
+
timelog = new_ticklog(h, database,
"ENB_PHY_ULSCH_UE_NO_DCI_RETRANSMISSION", "frame", "subframe");
subview = new_subview_ticktime(timeview, i+9+1,
new_color(g,"#99f"), 3600*1000);
logger_add_view(timelog, subview);
e->ul_dci_retransmission_logger[i] = timelog;
-
+
}
/* UL ACK */
@@ -707,8 +618,6 @@ static void ue_main_gui(ue_gui *e, gui *g, event_handler *h, void *database,
#endif
set_current_ue(g, ed, 0);
- register_notifier(g, "click", e->prev_ue_button, click, ed);
- register_notifier(g, "click", e->next_ue_button, click, ed);
}
void view_add_log(view *v, char *log, event_handler *h, void *database,
@@ -824,13 +733,11 @@ int main(int n, char **v)
on_off(database, "UE_PHY_PUSCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_PUCCH_TX_POWER", is_on, 1);
on_off(database, "UE_PHY_MEAS", is_on, 1);
-
+
on_off(database, "LEGACY_GROUP_INFO", is_on, 1);
on_off(database, "LEGACY_GROUP_ERROR", is_on, 1);
on_off(database, "LEGACY_GROUP_WARNING", is_on, 1);
-
- view_add_log(eg.phyview, "UE_PHY_UL_TICK", h, database, is_on);
- view_add_log(eg.phyview, "UE_PHY_DL_TICK", h, database, is_on);
+
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_DCI", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_DLSCH_UE_NACK",h, database, is_on);
@@ -838,8 +745,6 @@ int main(int n, char **v)
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_ACK", h, database, is_on);
view_add_log(eg.phyview, "UE_PHY_ULSCH_UE_NACK", h, database, is_on);
-
-
/* deactivate those two by default, they are a bit heavy */
//on_off(database, "ENB_MAC_UE_UL_SDU_WITH_DATA", is_on, 0);
//on_off(database, "ENB_MAC_UE_UL_PDU_WITH_DATA", is_on, 0);
diff --git a/common/utils/T/tracer/utils.c b/common/utils/T/tracer/utils.c
index 7f58b6f5aa..39e04fb973 100644
--- a/common/utils/T/tracer/utils.c
+++ b/common/utils/T/tracer/utils.c
@@ -9,27 +9,38 @@
#include
#include
-void new_thread(void *(*f)(void *), void *data)
-{
+void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
- if (pthread_attr_init(&att))
- { fprintf(stderr, "pthread_attr_init err\n"); exit(1); }
- if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED))
- { fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); }
- if (pthread_attr_setstacksize(&att, 10000000))
- { fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); }
- if (pthread_create(&t, &att, f, data))
- { fprintf(stderr, "pthread_create err\n"); exit(1); }
- if (pthread_attr_destroy(&att))
- { fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
+ if (pthread_attr_init(&att)) {
+ fprintf(stderr, "pthread_attr_init err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
+ fprintf(stderr, "pthread_attr_setdetachstate err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_setstacksize(&att, 10000000)) {
+ fprintf(stderr, "pthread_attr_setstacksize err\n");
+ exit(1);
+ }
+
+ if (pthread_create(&t, &att, f, data)) {
+ fprintf(stderr, "pthread_create err\n");
+ exit(1);
+ }
+
+ if (pthread_attr_destroy(&att)) {
+ fprintf(stderr, "pthread_attr_destroy err\n");
+ exit(1);
+ }
}
-void sleepms(int ms)
-{
+void sleepms(int ms) {
struct timespec t;
-
t.tv_sec = ms / 1000;
t.tv_nsec = (ms % 1000) * 1000000L;
@@ -37,12 +48,15 @@ void sleepms(int ms)
if (nanosleep(&t, NULL)) abort();
}
-void bps(char *out, float v, char *suffix)
-{
+void bps(char *out, float v, char *suffix) {
static char *bps_unit[4] = { "", "k", "M", "G" };
int flog;
- if (v < 1000) flog = 0; else flog = floor(floor(log10(v)) / 3);
+
+ if (v < 1000) flog = 0;
+ else flog = floor(floor(log10(v)) / 3);
+
if (flog > 3) flog = 3;
+
v /= pow(10, flog*3);
sprintf(out, "%g%s%s", round(v*100)/100, bps_unit[flog], suffix);
}
@@ -51,25 +65,31 @@ void bps(char *out, float v, char *suffix)
/* list */
/****************************************************************************/
-list *list_remove_head(list *l)
-{
+list *list_remove_head(list *l) {
list *ret;
+
if (l == NULL) return NULL;
+
ret = l->next;
+
if (ret != NULL) ret->last = l->last;
+
free(l);
return ret;
}
-list *list_append(list *l, void *data)
-{
+list *list_append(list *l, void *data) {
list *new = calloc(1, sizeof(list));
+
if (new == NULL) abort();
+
new->data = data;
+
if (l == NULL) {
new->last = new;
return new;
}
+
l->last->next = new;
l->last = new;
return l;
@@ -79,88 +99,107 @@ list *list_append(list *l, void *data)
/* socket */
/****************************************************************************/
-int create_listen_socket(char *addr, int port)
-{
+int create_listen_socket(char *addr, int port) {
struct sockaddr_in a;
int s;
int v;
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
+
v = 1;
- if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int)))
- { perror("setsockopt"); exit(1); }
+
+ if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int))) {
+ perror("setsockopt");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
- if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
- if (listen(s, 5)) { perror("listen"); exit(1); }
+ if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
+ perror("bind");
+ exit(1);
+ }
+
+ if (listen(s, 5)) {
+ perror("listen");
+ exit(1);
+ }
return s;
}
-int socket_accept(int s)
-{
+int socket_accept(int s) {
struct sockaddr_in a;
socklen_t alen;
alen = sizeof(a);
return accept(s, (struct sockaddr *)&a, &alen);
}
-int socket_send(int socket, void *buffer, int size)
-{
+int socket_send(int socket, void *buffer, int size) {
char *x = buffer;
int ret;
+
while (size) {
ret = write(socket, x, size);
+
if (ret <= 0) return -1;
+
size -= ret;
x += ret;
}
+
return 0;
}
-int get_connection(char *addr, int port)
-{
+int get_connection(char *addr, int port) {
int s, t;
-
printf("waiting for connection on %s:%d\n", addr, port);
-
s = create_listen_socket(addr, port);
-
t = socket_accept(s);
- if (t == -1) { perror("accept"); exit(1); }
+
+ if (t == -1) {
+ perror("accept");
+ exit(1);
+ }
+
close(s);
-
printf("connected\n");
-
return t;
}
-int fullread(int fd, void *_buf, int count)
-{
+int fullread(int fd, void *_buf, int count) {
char *buf = _buf;
int ret = 0;
int l;
+
while (count) {
l = read(fd, buf, count);
+
if (l <= 0) return -1;
+
count -= l;
buf += l;
ret += l;
}
+
return ret;
}
-int try_connect_to(char *addr, int port)
-{
+int try_connect_to(char *addr, int port) {
int s;
struct sockaddr_in a;
-
s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1) { perror("socket"); exit(1); }
+
+ if (s == -1) {
+ perror("socket");
+ exit(1);
+ }
a.sin_family = AF_INET;
a.sin_port = htons(port);
@@ -175,14 +214,12 @@ int try_connect_to(char *addr, int port)
return s;
}
-int connect_to(char *addr, int port)
-{
+int connect_to(char *addr, int port) {
int s;
-
printf("connecting to %s:%d\n", addr, port);
-
again:
s = try_connect_to(addr, port);
+
if (s == -1) {
printf("trying again in 1s\n");
sleep(1);
@@ -196,50 +233,46 @@ again:
/* buffer */
/****************************************************************************/
-void PUTC(OBUF *o, char c)
-{
+void PUTC(OBUF *o, char c) {
if (o->osize == o->omaxsize) {
o->omaxsize += 512;
o->obuf = realloc(o->obuf, o->omaxsize);
+
if (o->obuf == NULL) abort();
}
+
o->obuf[o->osize] = c;
o->osize++;
}
-void PUTS(OBUF *o, char *s)
-{
+void PUTS(OBUF *o, char *s) {
while (*s) PUTC(o, *s++);
}
-static int clean(char c)
-{
+static int clean(char c) {
if (!isprint(c)) c = ' ';
+
return c;
}
-void PUTS_CLEAN(OBUF *o, char *s)
-{
+void PUTS_CLEAN(OBUF *o, char *s) {
while (*s) PUTC(o, clean(*s++));
}
-void PUTI(OBUF *o, int i)
-{
+void PUTI(OBUF *o, int i) {
char s[64];
sprintf(s, "%d", i);
PUTS(o, s);
}
-void PUTX2(OBUF *o, int i)
-{
+void PUTX2(OBUF *o, int i) {
char s[64];
sprintf(s, "%2.2x", i);
PUTS(o, s);
}
-void PUTUL(OBUF *o, unsigned long l)
-{
+void PUTUL(OBUF *o, unsigned long l) {
char s[128];
- sprintf(s, "%ld", l);
+ sprintf(s, "%lu", l);
PUTS(o, s);
}
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index 77e939affe..97f1866274 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -35,13 +35,11 @@
void output_log_mem(void);
#define _Assert_Exit_ \
-{ \
fprintf(stderr, "\nExiting execution\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
-}
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c
index 889e0d84d1..f6de74f156 100644
--- a/common/utils/backtrace.c
+++ b/common/utils/backtrace.c
@@ -31,18 +31,18 @@
#include "backtrace.h"
/* Obtain a backtrace and print it to stdout. */
-void display_backtrace(void)
-{
+void display_backtrace(void) {
void *array[10];
size_t size;
char **strings;
size_t i;
- char* test=getenv("NO_BACKTRACE");
- if (test!=0) *((int*)0)=0;
+ char *test=getenv("NO_BACKTRACE");
+
+ if (test!=0) *((int *)0)=0;
+
size = backtrace(array, 10);
strings = backtrace_symbols(array, size);
-
- printf("Obtained %zd stack frames.\n", size);
+ printf("Obtained %u stack frames.\n", (unsigned int)size);
for (i = 0; i < size; i++)
printf("%s\n", strings[i]);
@@ -50,8 +50,7 @@ void display_backtrace(void)
free(strings);
}
-void backtrace_handle_signal(siginfo_t *info)
-{
+void backtrace_handle_signal(siginfo_t *info) {
display_backtrace();
//exit(EXIT_FAILURE);
}
diff --git a/common/utils/hashtable/hashtable.c b/common/utils/hashtable/hashtable.c
index 2c7b35744c..7b0fc42213 100644
--- a/common/utils/hashtable/hashtable.c
+++ b/common/utils/hashtable/hashtable.c
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -28,17 +28,33 @@
//-------------------------------------------------------------------------------------------------------------------------------
-char* hashtable_rc_code2string(hashtable_rc_t rcP)
+char *hashtable_rc_code2string(hashtable_rc_t rcP)
//-------------------------------------------------------------------------------------------------------------------------------
{
- switch (rcP) {
- case HASH_TABLE_OK: return "HASH_TABLE_OK";break;
- case HASH_TABLE_INSERT_OVERWRITTEN_DATA: return "HASH_TABLE_INSERT_OVERWRITTEN_DATA";break;
- case HASH_TABLE_KEY_NOT_EXISTS: return "HASH_TABLE_KEY_NOT_EXISTS";break;
- case HASH_TABLE_KEY_ALREADY_EXISTS: return "HASH_TABLE_KEY_ALREADY_EXISTS";break;
- case HASH_TABLE_BAD_PARAMETER_HASHTABLE: return "HASH_TABLE_BAD_PARAMETER_HASHTABLE";break;
- default: return "UNKNOWN hashtable_rc_t";
- }
+ switch (rcP) {
+ case HASH_TABLE_OK:
+ return "HASH_TABLE_OK";
+ break;
+
+ case HASH_TABLE_INSERT_OVERWRITTEN_DATA:
+ return "HASH_TABLE_INSERT_OVERWRITTEN_DATA";
+ break;
+
+ case HASH_TABLE_KEY_NOT_EXISTS:
+ return "HASH_TABLE_KEY_NOT_EXISTS";
+ break;
+
+ case HASH_TABLE_KEY_ALREADY_EXISTS:
+ return "HASH_TABLE_KEY_ALREADY_EXISTS";
+ break;
+
+ case HASH_TABLE_BAD_PARAMETER_HASHTABLE:
+ return "HASH_TABLE_BAD_PARAMETER_HASHTABLE";
+ break;
+
+ default:
+ return "UNKNOWN hashtable_rc_t";
+ }
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -46,7 +62,7 @@ char* hashtable_rc_code2string(hashtable_rc_t rcP)
* hash_free_int_func() is used when this hashtable is used to store int values as data (pointer = value).
*/
-void hash_free_int_func(void* memoryP){}
+void hash_free_int_func(void *memoryP) {}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -55,9 +71,8 @@ void hash_free_int_func(void* memoryP){}
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
-static hash_size_t def_hashfunc(const uint64_t keyP)
-{
- return (hash_size_t)keyP;
+static hash_size_t def_hashfunc(const uint64_t keyP) {
+ return (hash_size_t)keyP;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -67,132 +82,147 @@ static hash_size_t def_hashfunc(const uint64_t keyP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned hash_table_t pointer should be released with hashtable_destroy().
*/
-hash_table_t *hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)(const hash_key_t ), void (*freefuncP)(void*))
-{
- hash_table_t *hashtbl = NULL;
+hash_table_t *hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)(const hash_key_t ), void (*freefuncP)(void *)) {
+ hash_table_t *hashtbl = NULL;
- if(!(hashtbl=malloc(sizeof(hash_table_t)))) {
- return NULL;
- }
+ if(!(hashtbl=malloc(sizeof(hash_table_t)))) {
+ return NULL;
+ }
- if(!(hashtbl->nodes=calloc(sizeP, sizeof(hash_node_t*)))) {
- free(hashtbl);
- return NULL;
- }
+ if(!(hashtbl->nodes=calloc(sizeP, sizeof(hash_node_t *)))) {
+ free(hashtbl);
+ return NULL;
+ }
- hashtbl->size=sizeP;
+ hashtbl->size=sizeP;
- if(hashfuncP) hashtbl->hashfunc=hashfuncP;
- else hashtbl->hashfunc=def_hashfunc;
+ if(hashfuncP) hashtbl->hashfunc=hashfuncP;
+ else hashtbl->hashfunc=def_hashfunc;
- if(freefuncP) hashtbl->freefunc=freefuncP;
- else hashtbl->freefunc=free;
+ if(freefuncP) hashtbl->freefunc=freefuncP;
+ else hashtbl->freefunc=free;
- return hashtbl;
+ return hashtbl;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the hash_table_t.
*/
-hashtable_rc_t hashtable_destroy(hash_table_t * hashtblP)
-{
- hash_size_t n;
- hash_node_t *node, *oldnode;
+hashtable_rc_t hashtable_destroy(hash_table_t **hashtblP) {
+ hash_size_t n;
+ hash_node_t *node, *oldnode;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
+ if (*hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
- for(n=0; nsize; ++n) {
- node=hashtblP->nodes[n];
- while(node) {
- oldnode=node;
- node=node->next;
- if (oldnode->data) {
- hashtblP->freefunc(oldnode->data);
- }
- free(oldnode);
- }
- }
- free(hashtblP->nodes);
- free(hashtblP);
- hashtblP=NULL;
- return HASH_TABLE_OK;
-}
-//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_is_key_exists (const hash_table_t * const hashtblP, const hash_key_t keyP)
-//-------------------------------------------------------------------------------------------------------------------------------
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
+ for(n=0; n<(*hashtblP)->size; ++n) {
+ node=(*hashtblP)->nodes[n];
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
-
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
- node=hashtblP->nodes[hash];
while(node) {
- if(node->key == keyP) {
- return HASH_TABLE_OK;
- }
+ oldnode=node;
+ node=node->next;
+
+ if (oldnode->data) {
+ (*hashtblP)->freefunc(oldnode->data);
+ }
+
+ free(oldnode);
+ }
+ }
+
+ free((*hashtblP)->nodes);
+ free((*hashtblP));
+ *hashtblP=NULL;
+ return HASH_TABLE_OK;
+}
+//-------------------------------------------------------------------------------------------------------------------------------
+hashtable_rc_t hashtable_is_key_exists (const hash_table_t *const hashtblP, const hash_key_t keyP)
+//-------------------------------------------------------------------------------------------------------------------------------
+{
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
+
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ return HASH_TABLE_OK;
+ }
+
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
+}
+//-------------------------------------------------------------------------------------------------------------------------------
+hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void functP(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP)
+//-------------------------------------------------------------------------------------------------------------------------------
+{
+ hash_node_t *node = NULL;
+ unsigned int i = 0;
+ unsigned int num_elements = 0;
+
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ while ((num_elements < hashtblP->num_elements) && (i < hashtblP->size)) {
+ if (hashtblP->nodes[i] != NULL) {
+ node=hashtblP->nodes[i];
+
+ while(node) {
+ num_elements += 1;
+ functP(node->key, node->data, parameterP);
node=node->next;
+ }
}
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ i += 1;
+ }
+
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void functP(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP)
+hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP )
//-------------------------------------------------------------------------------------------------------------------------------
{
- hash_node_t *node = NULL;
- unsigned int i = 0;
- unsigned int num_elements = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- while ((num_elements < hashtblP->num_elements) && (i < hashtblP->size)) {
- if (hashtblP->nodes[i] != NULL) {
- node=hashtblP->nodes[i];
- while(node) {
- num_elements += 1;
- functP(node->key, node->data, parameterP);
- node=node->next;
- }
- }
- i += 1;
- }
- return HASH_TABLE_OK;
-}
-//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP )
-//-------------------------------------------------------------------------------------------------------------------------------
-{
- hash_node_t *node = NULL;
- unsigned int i = 0;
- if (hashtblP == NULL) {
+ hash_node_t *node = NULL;
+ unsigned int i = 0;
+
+ if (hashtblP == NULL) {
+ *remaining_bytes_in_buffer_pP = snprintf(
+ buffer_pP,
+ *remaining_bytes_in_buffer_pP,
+ "HASH_TABLE_BAD_PARAMETER_HASHTABLE");
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ while ((i < hashtblP->size) && (*remaining_bytes_in_buffer_pP > 0)) {
+ if (hashtblP->nodes[i] != NULL) {
+ node=hashtblP->nodes[i];
+
+ while(node) {
*remaining_bytes_in_buffer_pP = snprintf(
- buffer_pP,
- *remaining_bytes_in_buffer_pP,
- "HASH_TABLE_BAD_PARAMETER_HASHTABLE");
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ buffer_pP,
+ *remaining_bytes_in_buffer_pP,
+ "Key 0x%"PRIx64" Element %p\n",
+ node->key,
+ node->data);
+ node=node->next;
+ }
}
- while ((i < hashtblP->size) && (*remaining_bytes_in_buffer_pP > 0)) {
- if (hashtblP->nodes[i] != NULL) {
- node=hashtblP->nodes[i];
- while(node) {
- *remaining_bytes_in_buffer_pP = snprintf(
- buffer_pP,
- *remaining_bytes_in_buffer_pP,
- "Key 0x%"PRIx64" Element %p\n",
- node->key,
- node->data);
- node=node->next;
- }
- }
- i += 1;
- }
- return HASH_TABLE_OK;
+
+ i += 1;
+ }
+
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -200,97 +230,110 @@ hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
-hashtable_rc_t hashtable_insert(hash_table_t * const hashtblP, const hash_key_t keyP, void *dataP)
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t keyP, void *dataP) {
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if (node->data) {
- hashtblP->freefunc(node->data);
- }
- node->data=dataP;
- return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
- }
- node=node->next;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if (node->data) {
+ hashtblP->freefunc(node->data);
+ }
+
+ node->data=dataP;
+ return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
- if(!(node=malloc(sizeof(hash_node_t)))) return -1;
- node->key=keyP;
- node->data=dataP;
- if (hashtblP->nodes[hash]) {
- node->next=hashtblP->nodes[hash];
- } else {
- node->next = NULL;
- }
- hashtblP->nodes[hash]=node;
- hashtblP->num_elements += 1;
- return HASH_TABLE_OK;
+
+ node=node->next;
+ }
+
+ if(!(node=malloc(sizeof(hash_node_t)))) return -1;
+
+ node->key=keyP;
+ node->data=dataP;
+
+ if (hashtblP->nodes[hash]) {
+ node->next=hashtblP->nodes[hash];
+ } else {
+ node->next = NULL;
+ }
+
+ hashtblP->nodes[hash]=node;
+ hashtblP->num_elements += 1;
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
-hashtable_rc_t hashtable_remove(hash_table_t * const hashtblP, const hash_key_t keyP)
-{
- hash_node_t *node, *prevnode=NULL;
- hash_size_t hash = 0;
+hashtable_rc_t hashtable_remove(hash_table_t *const hashtblP, const hash_key_t keyP) {
+ hash_node_t *node, *prevnode=NULL;
+ hash_size_t hash = 0;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if(prevnode) prevnode->next=node->next;
+ else hashtblP->nodes[hash]=node->next;
+
+ if (node->data) {
+ hashtblP->freefunc(node->data);
+ }
+
+ free(node);
+ hashtblP->num_elements -= 1;
+ return HASH_TABLE_OK;
}
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if(prevnode) prevnode->next=node->next;
- else hashtblP->nodes[hash]=node->next;
- if (node->data) {
- hashtblP->freefunc(node->data);
- }
- free(node);
- hashtblP->num_elements -= 1;
- return HASH_TABLE_OK;
- }
- prevnode=node;
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ prevnode=node;
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
-hashtable_rc_t hashtable_get(const hash_table_t * const hashtblP, const hash_key_t keyP, void** dataP)
-{
- hash_node_t *node = NULL;
- hash_size_t hash = 0;
+hashtable_rc_t hashtable_get(const hash_table_t *const hashtblP, const hash_key_t keyP, void **dataP) {
+ hash_node_t *node = NULL;
+ hash_size_t hash = 0;
- if (hashtblP == NULL) {
- *dataP = NULL;
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP)%hashtblP->size;
-/* fprintf(stderr, "hashtable_get() key=%s, hash=%d\n", key, hash);*/
-
- node=hashtblP->nodes[hash];
-
- while(node) {
- if(node->key == keyP) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- }
- node=node->next;
- }
+ if (hashtblP == NULL) {
*dataP = NULL;
- return HASH_TABLE_KEY_NOT_EXISTS;
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP)%hashtblP->size;
+ /* fprintf(stderr, "hashtable_get() key=%s, hash=%d\n", key, hash);*/
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ }
+
+ node=node->next;
+ }
+
+ *dataP = NULL;
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -304,36 +347,33 @@ hashtable_rc_t hashtable_get(const hash_table_t * const hashtblP, const hash_key
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
-hashtable_rc_t hashtable_resize(hash_table_t * const hashtblP, const hash_size_t sizeP)
-{
- hash_table_t newtbl;
- hash_size_t n;
- hash_node_t *node,*next;
+hashtable_rc_t hashtable_resize(hash_table_t *const hashtblP, const hash_size_t sizeP) {
+ hash_table_t newtbl;
+ hash_size_t n;
+ hash_node_t *node,*next;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ newtbl.size = sizeP;
+ newtbl.hashfunc = hashtblP->hashfunc;
+
+ if(!(newtbl.nodes=calloc(sizeP, sizeof(hash_node_t *)))) return -1;
+
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ next = node->next;
+ hashtable_insert(&newtbl, node->key, node->data);
+ // Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
+ hashtable_remove(hashtblP, node->key);
}
+ }
- newtbl.size = sizeP;
- newtbl.hashfunc = hashtblP->hashfunc;
-
- if(!(newtbl.nodes=calloc(sizeP, sizeof(hash_node_t*)))) return -1;
-
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- next = node->next;
- hashtable_insert(&newtbl, node->key, node->data);
- // Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
- hashtable_remove(hashtblP, node->key);
-
- }
- }
-
- free(hashtblP->nodes);
- hashtblP->size=newtbl.size;
- hashtblP->nodes=newtbl.nodes;
-
- return HASH_TABLE_OK;
+ free(hashtblP->nodes);
+ hashtblP->size=newtbl.size;
+ hashtblP->nodes=newtbl.nodes;
+ return HASH_TABLE_OK;
}
diff --git a/common/utils/hashtable/hashtable.h b/common/utils/hashtable/hashtable.h
index 62002fb60f..3f770684fa 100644
--- a/common/utils/hashtable/hashtable.h
+++ b/common/utils/hashtable/hashtable.h
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -31,41 +31,41 @@ typedef uint64_t hash_key_t;
#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
typedef enum hashtable_return_code_e {
- HASH_TABLE_OK = 0,
- HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1,
- HASH_TABLE_KEY_NOT_EXISTS = 2,
- HASH_TABLE_KEY_ALREADY_EXISTS = 3,
- HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4,
- HASH_TABLE_SYSTEM_ERROR = 5,
- HASH_TABLE_CODE_MAX
+ HASH_TABLE_OK = 0,
+ HASH_TABLE_INSERT_OVERWRITTEN_DATA = 1,
+ HASH_TABLE_KEY_NOT_EXISTS = 2,
+ HASH_TABLE_KEY_ALREADY_EXISTS = 3,
+ HASH_TABLE_BAD_PARAMETER_HASHTABLE = 4,
+ HASH_TABLE_SYSTEM_ERROR = 5,
+ HASH_TABLE_CODE_MAX
} hashtable_rc_t;
typedef struct hash_node_s {
- hash_key_t key;
- void *data;
- struct hash_node_s *next;
+ hash_key_t key;
+ void *data;
+ struct hash_node_s *next;
} hash_node_t;
typedef struct hash_table_s {
- hash_size_t size;
- hash_size_t num_elements;
- struct hash_node_s **nodes;
- hash_size_t (*hashfunc)(const hash_key_t);
- void (*freefunc)(void*);
+ hash_size_t size;
+ hash_size_t num_elements;
+ struct hash_node_s **nodes;
+ hash_size_t (*hashfunc)(const hash_key_t);
+ void (*freefunc)(void *);
} hash_table_t;
-char* hashtable_rc_code2string(hashtable_rc_t rcP);
-void hash_free_int_func(void* memoryP);
-hash_table_t *hashtable_create (const hash_size_t size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void*));
-hashtable_rc_t hashtable_destroy(hash_table_t * const hashtbl);
-hashtable_rc_t hashtable_is_key_exists (const hash_table_t * const hashtbl, const uint64_t key);
-hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t * const hashtblP, void funct(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP);
-hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP );
-hashtable_rc_t hashtable_insert (hash_table_t * const hashtbl, const hash_key_t key, void *data);
-hashtable_rc_t hashtable_remove (hash_table_t * const hashtbl, const hash_key_t key);
-hashtable_rc_t hashtable_get (const hash_table_t * const hashtbl, const hash_key_t key, void **dataP);
-hashtable_rc_t hashtable_resize (hash_table_t * const hashtbl, const hash_size_t size);
+char *hashtable_rc_code2string(hashtable_rc_t rcP);
+void hash_free_int_func(void *memoryP);
+hash_table_t *hashtable_create (const hash_size_t size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void *));
+hashtable_rc_t hashtable_destroy(hash_table_t **hashtbl);
+hashtable_rc_t hashtable_is_key_exists (const hash_table_t *const hashtbl, const uint64_t key);
+hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void funct(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP);
+hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP );
+hashtable_rc_t hashtable_insert (hash_table_t *const hashtbl, const hash_key_t key, void *data);
+hashtable_rc_t hashtable_remove (hash_table_t *const hashtbl, const hash_key_t key);
+hashtable_rc_t hashtable_get (const hash_table_t *const hashtbl, const hash_key_t key, void **dataP);
+hashtable_rc_t hashtable_resize (hash_table_t *const hashtbl, const hash_size_t size);
diff --git a/common/utils/hashtable/obj_hashtable.c b/common/utils/hashtable/obj_hashtable.c
index 7fb68d1681..643dcce552 100644
--- a/common/utils/hashtable/obj_hashtable.c
+++ b/common/utils/hashtable/obj_hashtable.c
@@ -2,9 +2,9 @@
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
+ * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
+ * except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
@@ -30,13 +30,12 @@
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
*/
-static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
-{
- hash_size_t hash=0;
+static hash_size_t def_hashfunc(const void *keyP, int key_sizeP) {
+ hash_size_t hash=0;
- while(key_sizeP) hash^=((unsigned char*)keyP)[key_sizeP --];
+ while(key_sizeP) hash^=((unsigned char *)keyP)[key_sizeP --];
- return hash;
+ return hash;
}
//-------------------------------------------------------------------------------------------------------------------------------
@@ -46,201 +45,221 @@ static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
*/
-obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int ), void (*freekeyfuncP)(void*), void (*freedatafuncP)(void*))
-{
- obj_hash_table_t *hashtbl;
+obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void *, int ), void (*freekeyfuncP)(void *), void (*freedatafuncP)(void *)) {
+ obj_hash_table_t *hashtbl;
- if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL;
+ if(!(hashtbl=malloc(sizeof(obj_hash_table_t)))) return NULL;
- if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) {
- free(hashtbl);
- return NULL;
- }
+ if(!(hashtbl->nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) {
+ free(hashtbl);
+ return NULL;
+ }
- hashtbl->size=sizeP;
+ hashtbl->size=sizeP;
- if(hashfuncP) hashtbl->hashfunc=hashfuncP;
- else hashtbl->hashfunc=def_hashfunc;
+ if(hashfuncP) hashtbl->hashfunc=hashfuncP;
+ else hashtbl->hashfunc=def_hashfunc;
- if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
- else hashtbl->freekeyfunc=free;
+ if(freekeyfuncP) hashtbl->freekeyfunc=freekeyfuncP;
+ else hashtbl->freekeyfunc=free;
- if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
- else hashtbl->freedatafunc=free;
+ if(freedatafuncP) hashtbl->freedatafunc=freedatafuncP;
+ else hashtbl->freedatafunc=free;
- return hashtbl;
+ return hashtbl;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Cleanup
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
*/
-hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
-{
- hash_size_t n;
- obj_hash_node_t *node, *oldnode;
+hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP) {
+ hash_size_t n;
+ obj_hash_node_t *node, *oldnode;
- for(n=0; nsize; ++n) {
- node=hashtblP->nodes[n];
- while(node) {
- oldnode=node;
- node=node->next;
- hashtblP->freekeyfunc(oldnode->key);
- hashtblP->freedatafunc(oldnode->data);
- free(oldnode);
- }
+ for(n=0; nsize; ++n) {
+ node=hashtblP->nodes[n];
+
+ while(node) {
+ oldnode=node;
+ node=node->next;
+ hashtblP->freekeyfunc(oldnode->key);
+ hashtblP->freedatafunc(oldnode->data);
+ free(oldnode);
}
- free(hashtblP->nodes);
- free(hashtblP);
- return HASH_TABLE_OK;
+ }
+
+ free(hashtblP->nodes);
+ free(hashtblP);
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP)
+hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void *keyP, int key_sizeP)
//-------------------------------------------------------------------------------------------------------------------------------
{
- obj_hash_node_t *node;
- hash_size_t hash;
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ return HASH_TABLE_OK;
+ } else if (node->key_size == key_sizeP) {
+ if (memcmp(node->key, keyP, key_sizeP) == 0) {
+ return HASH_TABLE_OK;
+ }
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- return HASH_TABLE_OK;
- } else if (node->key_size == key_sizeP) {
- if (memcmp(node->key, keyP, key_sizeP) == 0) {
- return HASH_TABLE_OK;
- }
- }
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Adding a new element
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
*/
-hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP)
-{
- obj_hash_node_t *node;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void *keyP, int key_sizeP, void *dataP) {
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ if (node->data) {
+ hashtblP->freedatafunc(node->data);
+ }
+
+ node->data=dataP;
+ // waste of memory here (keyP is lost) we should free it now
+ return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- if (node->data) {
- hashtblP->freedatafunc(node->data);
- }
- node->data=dataP;
- // waste of memory here (keyP is lost) we should free it now
- return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
- }
- node=node->next;
- }
- if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
- node->key=keyP;
- node->data=dataP;
- if (hashtblP->nodes[hash]) {
- node->next=hashtblP->nodes[hash];
- } else {
- node->next = NULL;
- }
- hashtblP->nodes[hash]=node;
- return HASH_TABLE_OK;
+
+ node=node->next;
+ }
+
+ if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
+
+ node->key=keyP;
+ node->data=dataP;
+
+ if (hashtblP->nodes[hash]) {
+ node->next=hashtblP->nodes[hash];
+ } else {
+ node->next = NULL;
+ }
+
+ hashtblP->nodes[hash]=node;
+ return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
*/
-hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP)
-{
- obj_hash_node_t *node, *prevnode=NULL;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP) {
+ obj_hash_node_t *node, *prevnode=NULL;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))) {
+ if(prevnode) {
+ prevnode->next=node->next;
+ } else {
+ hashtblP->nodes[hash]=node->next;
+ }
+
+ hashtblP->freekeyfunc(node->key);
+ hashtblP->freedatafunc(node->data);
+ free(node);
+ return HASH_TABLE_OK;
}
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))){
- if(prevnode) {
- prevnode->next=node->next;
- } else {
- hashtblP->nodes[hash]=node->next;
- }
- hashtblP->freekeyfunc(node->key);
- hashtblP->freedatafunc(node->data);
- free(node);
- return HASH_TABLE_OK;
- }
- prevnode=node;
- node=node->next;
- }
- return HASH_TABLE_KEY_NOT_EXISTS;
+ prevnode=node;
+ node=node->next;
+ }
+
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
* NULL is returned if we didn't find it.
*/
-hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void** dataP)
-{
- obj_hash_node_t *node;
- hash_size_t hash;
+hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void *keyP, int key_sizeP, void **dataP) {
+ obj_hash_node_t *node;
+ hash_size_t hash;
- if (hashtblP == NULL) {
- *dataP = NULL;
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
- }
- hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
- node=hashtblP->nodes[hash];
- while(node) {
- if(node->key == keyP) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- } else if (node->key_size == key_sizeP) {
- if (memcmp(node->key, keyP, key_sizeP) == 0) {
- *dataP = node->data;
- return HASH_TABLE_OK;
- }
- }
- node=node->next;
- }
+ if (hashtblP == NULL) {
*dataP = NULL;
- return HASH_TABLE_KEY_NOT_EXISTS;
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
+ node=hashtblP->nodes[hash];
+
+ while(node) {
+ if(node->key == keyP) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ } else if (node->key_size == key_sizeP) {
+ if (memcmp(node->key, keyP, key_sizeP) == 0) {
+ *dataP = node->data;
+ return HASH_TABLE_OK;
+ }
+ }
+
+ node=node->next;
+ }
+
+ *dataP = NULL;
+ return HASH_TABLE_KEY_NOT_EXISTS;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
* Function to return all keys of an object hash table
*/
-hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP)
-{
- size_t n = 0;
- obj_hash_node_t *node = NULL;
- obj_hash_node_t *next = NULL;
- *sizeP = 0;
- keysP = calloc(hashtblP->num_elements, sizeof(void *));
- if (keysP) {
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- keysP[*sizeP++] = node->key;
- next = node->next;
- }
- }
- return HASH_TABLE_OK;
+hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void **keysP, unsigned int *sizeP) {
+ size_t n = 0;
+ obj_hash_node_t *node = NULL;
+ obj_hash_node_t *next = NULL;
+ *sizeP = 0;
+ keysP = calloc(hashtblP->num_elements, sizeof(void *));
+
+ if (keysP) {
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ keysP[*sizeP++] = node->key;
+ next = node->next;
+ }
}
- return HASH_TABLE_SYSTEM_ERROR;
+
+ // cppcheck-suppress memleak
+ return HASH_TABLE_OK;
+ }
+
+ return HASH_TABLE_SYSTEM_ERROR;
}
//-------------------------------------------------------------------------------------------------------------------------------
/*
@@ -253,34 +272,32 @@ hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP,
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
*/
-hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP)
-{
- obj_hash_table_t newtbl;
- hash_size_t n;
- obj_hash_node_t *node,*next;
+hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP) {
+ obj_hash_table_t newtbl;
+ hash_size_t n;
+ obj_hash_node_t *node,*next;
- if (hashtblP == NULL) {
- return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ if (hashtblP == NULL) {
+ return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
+ }
+
+ newtbl.size = sizeP;
+ newtbl.hashfunc = hashtblP->hashfunc;
+
+ if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t *)))) return HASH_TABLE_SYSTEM_ERROR;
+
+ for(n=0; nsize; ++n) {
+ for(node=hashtblP->nodes[n]; node; node=next) {
+ next = node->next;
+ obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
+ obj_hashtable_remove(hashtblP, node->key, node->key_size);
}
+ }
- newtbl.size = sizeP;
- newtbl.hashfunc = hashtblP->hashfunc;
-
- if(!(newtbl.nodes=calloc(sizeP, sizeof(obj_hash_node_t*)))) return HASH_TABLE_SYSTEM_ERROR;
-
- for(n=0; nsize; ++n) {
- for(node=hashtblP->nodes[n]; node; node=next) {
- next = node->next;
- obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
- obj_hashtable_remove(hashtblP, node->key, node->key_size);
- }
- }
-
- free(hashtblP->nodes);
- hashtblP->size=newtbl.size;
- hashtblP->nodes=newtbl.nodes;
-
- return HASH_TABLE_OK;
+ free(hashtblP->nodes);
+ hashtblP->size=newtbl.size;
+ hashtblP->nodes=newtbl.nodes;
+ return HASH_TABLE_OK;
}
diff --git a/common/utils/memory_pools.c b/common/utils/memory_pools.c
index 78b6923dc8..9f37e47080 100644
--- a/common/utils/memory_pools.c
+++ b/common/utils/memory_pools.c
@@ -23,19 +23,19 @@
#include "memory_pools.h"
#if T_TRACER
-#include
-#include "T.h"
+ #include
+ #include "T.h"
#endif
/*------------------------------------------------------------------------------*/
const static int mp_debug = 0;
# define MP_DEBUG(x, args...) do { if (mp_debug) fprintf(stdout, "[MP][D]"x, ##args); fflush (stdout); } \
- while(0)
+ while(0)
/*------------------------------------------------------------------------------*/
#ifndef CHARS_TO_UINT32
-#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
+ #define CHARS_TO_UINT32(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
#endif
#define MEMORY_POOL_ITEM_INFO_NUMBER 2
@@ -129,33 +129,25 @@ static const pool_start_mark_t POOL_START_MARK = CHARS_TO_UINT32 ('P'
static const pools_start_mark_t POOLS_START_MARK = CHARS_TO_UINT32 ('P', 'S', 's', 't');
/*------------------------------------------------------------------------------*/
-static inline uint32_t items_group_number_items (items_group_t *items_group)
-{
+static inline uint32_t items_group_number_items (items_group_t *items_group) {
return items_group->number_plus_one - 1;
}
-static inline uint32_t items_group_free_items (items_group_t *items_group)
-{
+static inline uint32_t items_group_free_items (items_group_t *items_group) {
items_group_positions_t positions;
uint32_t free_items;
-
positions.all = items_group->positions.all;
-
free_items = items_group->number_plus_one + positions.ind.put - positions.ind.get;
free_items %= items_group->number_plus_one;
-
return free_items;
}
-static inline items_group_index_t items_group_get_free_item (items_group_t *items_group)
-{
+static inline items_group_index_t items_group_get_free_item (items_group_t *items_group) {
items_group_position_t get_raw;
items_group_position_t put;
items_group_position_t get;
items_group_position_t free_items;
-
items_group_index_t index = ITEMS_GROUP_INDEX_INVALID;
-
/* Get current put position */
put = items_group->positions.ind.put % items_group->number_plus_one;
/* Get current get position and increase it */
@@ -193,11 +185,9 @@ static inline items_group_index_t items_group_get_free_item (items_group_t *item
return (index);
}
-static inline int items_group_put_free_item (items_group_t *items_group, items_group_index_t index)
-{
+static inline int items_group_put_free_item (items_group_t *items_group, items_group_index_t index) {
items_group_position_t put_raw;
items_group_position_t put;
-
/* Get current put position and increase it */
put_raw = __sync_fetch_and_add (&items_group->positions.ind.put, 1);
put = put_raw % items_group->number_plus_one;
@@ -209,70 +199,54 @@ static inline int items_group_put_free_item (items_group_t *items_group, items_g
AssertError (items_group->indexes[put] <= ITEMS_GROUP_INDEX_INVALID, return (EXIT_FAILURE),
"Index at current put position (%d) is not marked as free (%d)!\n", put, items_group->number_plus_one);
-
/* Save freed item index at current put position */
items_group->indexes[put] = index;
return (EXIT_SUCCESS);
}
/*------------------------------------------------------------------------------*/
-static inline memory_pools_t *memory_pools_from_handler (memory_pools_handle_t memory_pools_handle)
-{
+static inline memory_pools_t *memory_pools_from_handler (memory_pools_handle_t memory_pools_handle) {
memory_pools_t *memory_pools;
-
/* Recover memory_pools */
memory_pools = (memory_pools_t *) memory_pools_handle;
/* Sanity check on passed handle */
AssertError (memory_pools->start_mark == POOLS_START_MARK, memory_pools = NULL,
"Handle %p is not a valid memory pools handle, start mark is missing!\n", memory_pools_handle);
-
return (memory_pools);
}
-static inline memory_pool_item_t *memory_pool_item_from_handler (memory_pool_item_handle_t memory_pool_item_handle)
-{
+static inline memory_pool_item_t *memory_pool_item_from_handler (memory_pool_item_handle_t memory_pool_item_handle) {
void *address;
memory_pool_item_t *memory_pool_item;
-
/* Recover memory_pools */
address = memory_pool_item_handle - sizeof(memory_pool_item_start_t);
memory_pool_item = (memory_pool_item_t *) address;
-
/* Sanity check on passed handle */
AssertError (memory_pool_item->start.start_mark == POOL_ITEM_START_MARK, memory_pool_item = NULL,
"Handle %p is not a valid memory pool item handle, start mark is missing!\n", memory_pool_item);
-
return (memory_pool_item);
}
-static inline memory_pool_item_t *memory_pool_item_from_index (memory_pool_t *memory_pool, items_group_index_t index)
-{
+static inline memory_pool_item_t *memory_pool_item_from_index (memory_pool_t *memory_pool, items_group_index_t index) {
void *address;
-
address = (void *) memory_pool->items;
address += index * memory_pool->pool_item_size;
-
return (address);
}
/*------------------------------------------------------------------------------*/
-memory_pools_handle_t memory_pools_create (uint32_t pools_number)
-{
+memory_pools_handle_t memory_pools_create (uint32_t pools_number) {
memory_pools_t *memory_pools;
pool_id_t pool;
-
AssertFatal (pools_number <= MAX_POOLS_NUMBER, "Too many memory pools requested (%d/%d)!\n", pools_number, MAX_POOLS_NUMBER); /* Limit to a reasonable number of pools */
-
/* Allocate memory_pools */
memory_pools = malloc (sizeof(memory_pools_t));
AssertFatal (memory_pools != NULL, "Memory pools structure allocation failed!\n");
-
/* Initialize memory_pools */
{
memory_pools->start_mark = POOLS_START_MARK;
memory_pools->pools_number = pools_number;
memory_pools->pools_defined = 0;
-
/* Allocate pools */
memory_pools->pools = calloc (pools_number, sizeof(memory_pool_t));
AssertFatal (memory_pools->pools != NULL, "Memory pools allocation failed!\n");
@@ -282,12 +256,10 @@ memory_pools_handle_t memory_pools_create (uint32_t pools_number)
memory_pools->pools[pool].start_mark = POOL_START_MARK;
}
}
-
return ((memory_pools_handle_t) memory_pools);
}
-char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
-{
+char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle) {
memory_pools_t *memory_pools;
pool_id_t pool;
char *statistics;
@@ -296,13 +268,10 @@ char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
uint32_t allocated_pools_memory = 0;
items_group_t *items_group;
uint32_t pool_items_size;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
statistics = malloc(memory_pools->pools_defined * 200);
-
printed_chars = sprintf (&statistics[0], "Pool: size, number, minimum, free, address space and memory used in Kbytes\n");
for (pool = 0; pool < memory_pools->pools_defined; pool++) {
@@ -321,32 +290,25 @@ char *memory_pools_statistics(memory_pools_handle_t memory_pools_handle)
}
printed_chars = sprintf (&statistics[printed_chars], "Pools memory %u Kbytes\n", allocated_pools_memory / (1024));
-
return (statistics);
}
-int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size)
-{
+int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t pool_items_number, uint32_t pool_item_size) {
memory_pools_t *memory_pools;
memory_pool_t *memory_pool;
pool_id_t pool;
items_group_index_t item_index;
memory_pool_item_t *memory_pool_item;
-
AssertFatal (pool_items_number <= MAX_POOL_ITEMS_NUMBER, "Too many items for a memory pool (%u/%d)!\n", pool_items_number, MAX_POOL_ITEMS_NUMBER); /* Limit to a reasonable number of items */
AssertFatal (pool_item_size <= MAX_POOL_ITEM_SIZE, "Item size is too big for memory pool items (%u/%d)!\n", pool_item_size, MAX_POOL_ITEM_SIZE); /* Limit to a reasonable item size */
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
/* Check number of already created pools */
AssertFatal (memory_pools->pools_defined < memory_pools->pools_number, "Can not allocate more memory pool (%d)!\n", memory_pools->pools_number);
-
/* Select pool */
pool = memory_pools->pools_defined;
memory_pool = &memory_pools->pools[pool];
-
/* Initialize pool */
{
memory_pool->pool_id = pool;
@@ -357,7 +319,6 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
memory_pool->items_group_free.minimum = pool_items_number;
memory_pool->items_group_free.positions.ind.put = pool_items_number;
memory_pool->items_group_free.positions.ind.get = 0;
-
/* Allocate free indexes */
memory_pool->items_group_free.indexes = malloc(memory_pool->items_group_free.number_plus_one * sizeof(items_group_index_t));
AssertFatal (memory_pool->items_group_free.indexes != NULL, "Memory pool indexes allocation failed!\n");
@@ -369,7 +330,6 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
/* Last index is not allocated */
memory_pool->items_group_free.indexes[item_index] = ITEMS_GROUP_INDEX_INVALID;
-
/* Allocate items */
memory_pool->items = calloc (pool_items_number, memory_pool->pool_item_size);
AssertFatal (memory_pool->items != NULL, "Memory pool items allocation failed!\n");
@@ -383,20 +343,16 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
memory_pool_item->data[memory_pool->item_data_number] = POOL_ITEM_END_MARK;
}
}
-
memory_pools->pools_defined ++;
-
return (0);
}
-memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1)
-{
+memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
memory_pool_item_handle_t memory_pool_item_handle = NULL;
pool_id_t pool;
items_group_index_t item_index = ITEMS_GROUP_INDEX_INVALID;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertError (memory_pools != NULL, {}, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
@@ -424,12 +380,10 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
/* Sanity check on item status, must be free */
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_FREE, "Item status is not set to free (%d) in pool %u, item %d!\n",
memory_pool_item->start.item_status, pool, item_index);
-
memory_pool_item->start.item_status = ITEM_STATUS_ALLOCATED;
memory_pool_item->start.info[0] = info_0;
memory_pool_item->start.info[1] = info_1;
memory_pool_item_handle = memory_pool_item->data;
-
MP_DEBUG(" Alloc [%2u][%6d]{%6d}, %3u %3u, %6u, %p, %p, %p\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
@@ -445,8 +399,7 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
return memory_pool_item_handle;
}
-int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0)
-{
+int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
pool_id_t pool;
@@ -455,36 +408,29 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
uint32_t pool_item_size;
uint16_t info_1;
int result;
-
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertError (memory_pools != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pools for handle %p!\n", memory_pools_handle);
-
/* Recover memory pool item */
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
AssertError (memory_pool_item != NULL, return (EXIT_FAILURE), "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
-
info_1 = memory_pool_item->start.info[1];
-
/* Recover pool index */
pool = memory_pool_item->start.pool_id;
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
-
item_size = memory_pools->pools[pool].item_data_number;
pool_item_size = memory_pools->pools[pool].pool_item_size;
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
-
MP_DEBUG(" Free [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
memory_pool_item->start.info[0], info_1,
memory_pool_item_handle, memory_pool_item,
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
-
/* Sanity check on calculated item index */
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
- memory_pool_item, memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
+ memory_pool_item,(void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
/* Sanity check on end marker, must still be present (no write overflow) */
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
@@ -492,31 +438,23 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
AssertFatal (memory_pool_item->start.item_status == ITEM_STATUS_ALLOCATED,
"Trying to free a non allocated (%x) memory pool item (pool %u, item %d)!\n",
memory_pool_item->start.item_status, pool, item_index);
-
memory_pool_item->start.item_status = ITEM_STATUS_FREE;
-
result = items_group_put_free_item(&memory_pools->pools[pool].items_group_free, item_index);
-
AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory pool item (pool %u, item %d)!\n", pool, item_index);
-
return (result);
}
-void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info)
-{
+void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info) {
memory_pools_t *memory_pools;
memory_pool_item_t *memory_pool_item;
pool_id_t pool;
items_group_index_t item_index;
uint32_t item_size;
uint32_t pool_item_size;
-
AssertFatal (index < MEMORY_POOL_ITEM_INFO_NUMBER, "Incorrect info index (%d/%d)!\n", index, MEMORY_POOL_ITEM_INFO_NUMBER);
-
/* Recover memory pool item */
memory_pool_item = memory_pool_item_from_handler (memory_pool_item_handle);
AssertFatal (memory_pool_item != NULL, "Failed to retrieve memory pool item for handle %p!\n", memory_pool_item_handle);
-
/* Set info[1] */
memory_pool_item->start.info[index] = info;
@@ -525,26 +463,22 @@ void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_po
/* Recover memory_pools */
memory_pools = memory_pools_from_handler (memory_pools_handle);
AssertFatal (memory_pools != NULL, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
-
/* Recover pool index */
pool = memory_pool_item->start.pool_id;
AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
-
item_size = memory_pools->pools[pool].item_data_number;
pool_item_size = memory_pools->pools[pool].pool_item_size;
item_index = (((void *) memory_pool_item) - ((void *) memory_pools->pools[pool].items)) / pool_item_size;
-
MP_DEBUG(" Info [%2u][%6d]{%6d}, %3u %3u, %p, %p, %p, %u\n",
pool, item_index,
items_group_free_items (&memory_pools->pools[pool].items_group_free),
memory_pool_item->start.info[0], memory_pool_item->start.info[1],
memory_pool_item_handle, memory_pool_item,
memory_pools->pools[pool].items, ((uint32_t) (item_size * sizeof(memory_pool_data_t))));
-
/* Sanity check on calculated item index */
AssertFatal (memory_pool_item == memory_pool_item_from_index(&memory_pools->pools[pool], item_index),
"Incorrect memory pool item address (%p, %p) for pool %u, item %d!\n",
- memory_pool_item, memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
+ memory_pool_item, (void *)memory_pool_item_from_index(&memory_pools->pools[pool], item_index), pool, item_index);
/* Sanity check on end marker, must still be present (no write overflow) */
AssertFatal (memory_pool_item->data[item_size] == POOL_ITEM_END_MARK,
"Memory pool item is corrupted, end mark is not present for pool %u, item %d!\n", pool, item_index);
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 7cb6da21b5..ae87a8e326 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -150,7 +150,7 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
AssertFatal (pointer_p, "malloc failed!\n");
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
- AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
+ AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %d\n", i);
}
for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) {
@@ -476,7 +476,20 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
}
break;
-
+ case MSC_F1AP_CU:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_CU");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ //}
+ break;
+ case MSC_F1AP_DU:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_DU");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ //}
+ break;
default:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index 4a71d52ffa..49c99abb56 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -62,9 +62,11 @@ typedef enum {
MSC_S11_MME,
MSC_S6A_MME,
MSC_HSS,
- MAX_MSC_PROTOS,
+ MSC_F1AP_CU,
+ MSC_F1AP_DU,
MSC_X2AP_SRC_ENB,
MSC_X2AP_TARGET_ENB,
+ MAX_MSC_PROTOS,
} msc_proto_t;
diff --git a/common/utils/ocp_itti/all_msg.h b/common/utils/ocp_itti/all_msg.h
index f439572400..bbbe576e1b 100644
--- a/common/utils/ocp_itti/all_msg.h
+++ b/common/utils/ocp_itti/all_msg.h
@@ -13,3 +13,4 @@
#include "openair2/COMMON/udp_messages_def.h"
#include "openair2/COMMON/gtpv1_u_messages_def.h"
#include "openair2/COMMON/flexran_messages_def.h"
+#include "openair2/COMMON/f1ap_messages_def.h"
diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp
index 5b8d1a430e..3d0bd0e1a3 100644
--- a/common/utils/ocp_itti/intertask_interface.cpp
+++ b/common/utils/ocp_itti/intertask_interface.cpp
@@ -1,6 +1,6 @@
/*
Author: Laurent THOMAS, Open Cells
- copyleft: OpenAirInterface Software Alliance and it's licence
+ copyleft: OpenAirInterface Software Alliance and it's licence
*/
#include
#include
@@ -122,7 +122,7 @@ extern "C" {
pthread_mutex_unlock (&t->queue_cond_lock);
t->admin.func(NULL);
pthread_mutex_lock (&t->queue_cond_lock);
- }
+ }
pthread_mutex_unlock (&t->queue_cond_lock);
return ret;
}
@@ -290,12 +290,12 @@ extern "C" {
struct sched_param sparam;
memset(&sparam, 0, sizeof(sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO)-10;
- policy = SCHED_FIFO ;
+ policy = SCHED_FIFO ;
if (pthread_setschedparam(t->thread, policy, &sparam) != 0) {
LOG_E(TMR,"task %s : Failed to set pthread priority\n", itti_get_task_name(task_id) );
}
}
-#endif
+#endif
return 0;
}
diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h
index 227e9b0b3e..159265c6a8 100644
--- a/common/utils/ocp_itti/intertask_interface.h
+++ b/common/utils/ocp_itti/intertask_interface.h
@@ -1,6 +1,6 @@
/*
Author: Laurent THOMAS, Open Cells
- Copyleft: OpenAirInterface software alliance and it's licence
+ Copyleft: OpenAirInterface software alliance and it's licence
*/
#ifndef INTERTASK_INTERFACE_H_
#define INTERTASK_INTERFACE_H_
@@ -300,6 +300,8 @@ typedef struct {
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
+ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
+ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
diff --git a/common/utils/telnetsrv/DOC/telnetaddcmd.md b/common/utils/telnetsrv/DOC/telnetaddcmd.md
index ef5af3fb7e..c759128254 100644
--- a/common/utils/telnetsrv/DOC/telnetaddcmd.md
+++ b/common/utils/telnetsrv/DOC/telnetaddcmd.md
@@ -3,15 +3,15 @@
The following example is extracted from [the oai `openair1/PHY/CODING/coding_load.c` file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c).
```c
-/*
+/*
include the telnet server data structures and API definitions
*/
-#include "common/utils/telnetsrv/telnetsrv.h"
+#include "common/utils/telnetsrv/telnetsrv.h"
/*
define the null terminated array of telnetshell_cmddef_t structures
-which map each sub-command string to a function implementing it.
+which map each sub-command string to a function implementing it.
you may also provide a help string which will be printed when
the global help command is used. The prototype for the function
implementing sub commands must match the `cmdfunc_t` type defined
@@ -25,7 +25,7 @@ static telnetshell_cmddef_t coding_cmdarray[] = {
/*
define the null terminated list of telnetshell_vardef_t structures defining the
-variables that can be set and get using the pre-defined get and set command
+variables that can be set and get using the pre-defined get and set command
of the telnet server
*/
telnetshell_vardef_t coding_vardef[] = {
@@ -34,7 +34,7 @@ telnetshell_vardef_t coding_vardef[] = {
};
.................
/*
- look for telnet server, if it is loaded, add the coding commands to it
+ look for telnet server, if it is loaded, add the coding commands to it
we use the shared library loader API to check the telnet server availibility
The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
1. The name of the telnet command to be added, here "coding"
@@ -43,9 +43,9 @@ The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
*/
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
if (addcmd != NULL) {
- addcmd("coding",coding_vardef,coding_cmdarray);
+ addcmd("coding",coding_vardef,coding_cmdarray);
.......
-/*
+/*
functions implementing the "coding mode" sub command, as defined in
the `coding_cmdarray` passed earlier to the TELNET_ADDCMD_FNAME function.
This function will be called by the telnet server, when the `coding_cmdarray`
@@ -53,15 +53,15 @@ The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
*/
int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
- /*
+ /*
1. buff argument is an input argument, pointer to the string received
from the telnet client, the command and sub-command parts are removed
In this case it points after "coding setmod" and is of no use as
- we don't have second level sub-commands.
+ we don't have second level sub-commands.
1. debug argument is an input argument set by the telnet server
- 1. prnt arguments is also an input argument, a function pointer, to be used
+ 1. prnt arguments is also an input argument, a function pointer, to be used
in place of printf to print messages on the telnet client interface. As this function
- is called by the telnet server stdout points to the main executable console,
+ is called by the telnet server stdout points to the main executable console,
*/
if (debug > 0)
prnt( "coding_setmod_cmd received %s\n",buff);
@@ -89,28 +89,28 @@ int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
```c
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd)
```
-Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings.
-Also adds the list of variables described in the `var` array to the list of variable which can be set and read.
-The function returns -1 if one argument is NULL.
-The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server).
+Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings.
+Also adds the list of variables described in the `var` array to the list of variable which can be set and read.
+The function returns -1 if one argument is NULL.
+The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server).
# telnet server public data types
-## `telnetshell_vardef_t`structure
+## `telnetshell_vardef_t`structure
This structure is used by developers to describe the variables that can be set or read using the get,set and getall sub-commands.
-| Fields | type |Description |
+| Fields | type |Description |
|:-----------|:------:|:-----------------------|
| `varname` | `char[TELNET_CMD_MAXSIZE]` | variable name, as specified when using the get and set commands. |
| `vartype` | `char` | Defines the type of the variable pointed by the `varvalptr`field. Supported values: TELNET_VARTYPE_INT32 TELNET_VARTYPE_INT16 TELNET_VARTYPE_INT64 TELNET_VARTYPE_STRING TELNET_VARTYPE_DOUBLE |
| `varvalptr` | `void*` | Defines the type of the variable pointed by the `varvalptr`field |
-## `telnetshell_cmddef_t`structure
+## `telnetshell_cmddef_t`structure
This structure is used by developers to describe the first level sub-commands to be added to the telnet server.
-| Fields | type |Description |
+| Fields | type |Description |
|:-----------|:------:|:-----------------------|
| `cmdname` | `char[TELNET_CMD_MAXSIZE]` | command name, as tested by the telnet server to check it should call the `cmdfunc` function |
| `helpstr` | `char[TELNET_HELPSTR_SIZE]` | character string to print when the elp`command is received from the telnet client |
| `cmdfunc` | `cmdfunc_t` | pointer to the function implementing the `cmdname` sub command. |
-[oai telnet server home](telnetsrv.md)
\ No newline at end of file
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/DOC/telnetarch.md b/common/utils/telnetsrv/DOC/telnetarch.md
index f31a51b352..ebb2342c22 100644
--- a/common/utils/telnetsrv/DOC/telnetarch.md
+++ b/common/utils/telnetsrv/DOC/telnetarch.md
@@ -4,18 +4,18 @@ The oai telnet server is implemented in a shared library to be loaded by the [oa
Currently the telnet server only supports one user connection. The same dedicated thread is used to wait for a user connection and process the input received from this connection.
-The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables.
+The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables.
+
-
# telnet server source files
telnet server source files are located in [common/utils/telnetsrv](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv)
-1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
+1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
1. [telnetsrv.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.h) is the telnet server include file containing both private and public data type definitions. It also contains API prototypes for functions that are used to register a new command in the server.
1. `telnetsrv\_\.c`: implementation of \ CLI command which are delivered with the telnet server.
1. `telnetsrv\_\.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
1. [telnetsrv_CMakeLists.txt](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv_CMakeLists.txt): CMakelists file containing the cmake instructions to build the telnet server. this file is included in the [global oai CMakelists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt).
-[oai telnet server home](telnetsrv.md)
\ No newline at end of file
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/DOC/telnetgetset.md b/common/utils/telnetsrv/DOC/telnetgetset.md
index e0b2c90d79..d851e90a8f 100644
--- a/common/utils/telnetsrv/DOC/telnetgetset.md
+++ b/common/utils/telnetsrv/DOC/telnetgetset.md
@@ -10,12 +10,12 @@ telnet, phypb = 65000
telnet, hsize = 50
telnet, hfile = "oaitelnet.history"
softmodem> telnet set loopc 100
-telnet, loopc set to
+telnet, loopc set to
100
softmodem> telnet get loopc
telnet, loopc = 100
-softmodem>
+softmodem>
```
-[oai telnetserver home](telnetsrv.md)
-[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnethelp.md b/common/utils/telnetsrv/DOC/telnethelp.md
index 63183fb611..b18f5caae7 100644
--- a/common/utils/telnetsrv/DOC/telnethelp.md
+++ b/common/utils/telnetsrv/DOC/telnethelp.md
@@ -22,7 +22,7 @@ softmodem> help
softmodem show loglvl|thread|config
softmodem log (enter help for details)
softmodem thread (enter help for details)
- softmodem exit
+ softmodem exit
module 2 = phy:
phy disp [phycnt,uedump,uestat UE]
module 3 = loader:
@@ -34,24 +34,24 @@ softmodem> help
module 4 = coding:
coding [get set] maxiter
coding mode [sse,avx2,stdc,none]
-softmodem>
-```
+softmodem>
+```
-# oai telnet server, specific commands help
+# oai telnet server, specific commands help
``` bash
softmodem> softmodem log help
- log sub commands:
- show: display current log configuration
- online, noonline: enable or disable console logs
- enable, disable id1-id2: enable or disable logs for components index id1 to id2
- level_ id1-id2: set log level to for components index id1 to id2
- level_ id1-id2: set log verbosity to for components index id1 to id2
-use the show command to get the values for , and the list of component indexes that can be used for id1 and id2
+ log sub commands:
+ show: display current log configuration
+ online, noonline: enable or disable console logs
+ enable, disable id1-id2: enable or disable logs for components index id1 to id2
+ level_ id1-id2: set log level to for components index id1 to id2
+ level_ id1-id2: set log verbosity to for components index id1 to id2
+use the show command to get the values for , and the list of component indexes that can be used for id1 and id2
softmodem>
```
-[oai telnetserver home](telnetsrv.md)
-[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnethist.md b/common/utils/telnetsrv/DOC/telnethist.md
index d938435a24..b7cf152502 100644
--- a/common/utils/telnetsrv/DOC/telnethist.md
+++ b/common/utils/telnetsrv/DOC/telnethist.md
@@ -40,5 +40,5 @@ softmodem>
```
-[oai telnetserver home](telnetsrv.md)
-[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetloader.md b/common/utils/telnetsrv/DOC/telnetloader.md
index 9250524989..d6a0f158c6 100644
--- a/common/utils/telnetsrv/DOC/telnetloader.md
+++ b/common/utils/telnetsrv/DOC/telnetloader.md
@@ -43,5 +43,5 @@ softmodem> loader show modules
softmodem>
```
-[oai telnetserver home](telnetsrv.md)
-[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md
index 0faaf9c02e..36c5cfb348 100644
--- a/common/utils/telnetsrv/DOC/telnetlog.md
+++ b/common/utils/telnetsrv/DOC/telnetlog.md
@@ -38,10 +38,10 @@ log level/verbosity comp 33 USIM set to info / medium (disabled)
log level/verbosity comp 34 LOCALIZE set to info / medium (disabled)
log level/verbosity comp 35 RRH set to info / medium (disabled)
softmodem> softmodem log show
-Available log levels:
- emerg alert crit error warn notice info debug file trace
-Available verbosity:
- none low medium high full
+Available log levels:
+ emerg alert crit error warn notice info debug file trace
+Available verbosity:
+ none low medium high full
component verbosity level enabled
00 PHY: medium info N
01 MAC: medium info N
@@ -89,8 +89,8 @@ log level/verbosity comp 3 OCG set to error / medium (enabled)
log level/verbosity comp 4 OMG set to error / medium (enabled)
softmodem> exit
Connection closed by foreign host.
-```
+```
-[oai telnetserver home](telnetsrv.md)
+[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
-[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/telnetsrv/DOC/telnetloop.md b/common/utils/telnetsrv/DOC/telnetloop.md
index f045e8a716..a86baad6eb 100644
--- a/common/utils/telnetsrv/DOC/telnetloop.md
+++ b/common/utils/telnetsrv/DOC/telnetloop.md
@@ -1,4 +1,4 @@
-The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example:
+The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example:
```bash
softmodem> telnet get loopc
@@ -6,35 +6,35 @@ telnet, loopc = 10
softmodem> telnet get loopd
telnet, loopd = 2000
softmodem> telnet set loopd 1000
-telnet, loopd set to
+telnet, loopd set to
1000
softmodem> loop softmodem show thread
2018-03-27 17:58:49.000 2/10
- id name state USRmod KRNmod prio nice vsize proc pol
+ id name state USRmod KRNmod prio nice vsize proc pol
- 3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other
+ 3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other
- 3946 lte-softmodem S 7 95 20 0 236560384 2 0 other
- 3948 telnet R 0 0 20 0 236560384 2 0 other
- 3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other
- 3951 ITTI 12 S 2 2 20 0 236560384 7 0 other
- 3952 ITTI 11 S 0 0 20 0 236560384 0 0 other
- 3953 ITTI 9 S 0 0 20 0 236560384 1 0 other
- 3954 ITTI 7 S 0 0 20 0 236560384 7 0 other
- 3955 ITTI 8 S 0 0 20 0 236560384 7 0 other
- 3956 ITTI 4 S 35 0 20 0 236560384 2 0 other
- 3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr
- 3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo
- 3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo
- 3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo
- 3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr
- 3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr
- 3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr
- 3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo
- 3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo
+ 3946 lte-softmodem S 7 95 20 0 236560384 2 0 other
+ 3948 telnet R 0 0 20 0 236560384 2 0 other
+ 3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other
+ 3951 ITTI 12 S 2 2 20 0 236560384 7 0 other
+ 3952 ITTI 11 S 0 0 20 0 236560384 0 0 other
+ 3953 ITTI 9 S 0 0 20 0 236560384 1 0 other
+ 3954 ITTI 7 S 0 0 20 0 236560384 7 0 other
+ 3955 ITTI 8 S 0 0 20 0 236560384 7 0 other
+ 3956 ITTI 4 S 35 0 20 0 236560384 2 0 other
+ 3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr
+ 3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo
+ 3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo
+ 3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo
+ 3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr
+ 3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr
+ 3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr
+ 3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo
+ 3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo
-```
-A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt.
+```
+A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt.
-[oai telnetserver home](telnetsrv.md)
-[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
+[oai telnetserver home](telnetsrv.md)
+[oai telnetserver usage home](telnetusage.md)
diff --git a/common/utils/telnetsrv/DOC/telnetsrv.md b/common/utils/telnetsrv/DOC/telnetsrv.md
index e8909595d9..11c6cf071f 100644
--- a/common/utils/telnetsrv/DOC/telnetsrv.md
+++ b/common/utils/telnetsrv/DOC/telnetsrv.md
@@ -3,5 +3,5 @@ The oai embedded telnet server is an optional monitoring and debugging tool. It
* [Using the telnet server](telnetusage.md)
* [Adding commands to the oai telnet server](telnetaddcmd.md)
* [telnet server architecture ](telnetarch.md)
-
-[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/common/utils/telnetsrv/DOC/telnetusage.md b/common/utils/telnetsrv/DOC/telnetusage.md
index f8319d5ef2..0356143226 100644
--- a/common/utils/telnetsrv/DOC/telnetusage.md
+++ b/common/utils/telnetsrv/DOC/telnetusage.md
@@ -1,28 +1,28 @@
-# starting the softmodem with the telnet server
+# starting the softmodem with the telnet server
By default the embedded telnet server, which is implemented in a shared library, is not built. It can be built after compiling the softmodem executable using the `build_oai` script:
```bash
- cd \/openairinterface5g
- source oaienv
- cd cmake_targets
- ./build_oai --build-telnetsrv
+ cd \/openairinterface5g
+ source oaienv
+ cd cmake_targets
+ ./build_oai --build-telnetsrv
```
This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/lte_build_oai/build` sub directories of the oai repository.
When starting the softmodem, you must specify the **_\-\-telnetsrv_** option to load and start the telnet server. The telnet server is loaded via the [oai shared library loader](loader).
-# using the Command Line Interface
-By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters.
+# using the Command Line Interface
+By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters.
The telnet server includes a basic help, listing available commands and some commands also provide a specific detailed help sub-command.
-Below are examples of telnet sessions:
+Below are examples of telnet sessions:
* [getting help](telnethelp.md)
* [using the history](telnethist.md)
* [using the get and set commands](telnetgetset.md)
* [using the loop command](telnetloop.md)
* [loader command](telnetloader.md)
-* [log command](telnetlog.md)
+* [log command](telnetlog.md)
# telnet server parameters
The telnet server is using the [oai configuration module](Config/Rtusage). Telnet parameters must be specified in the `telnetsrv` section. Some parameters can be modified via the telnet telnet server command, as specified in the last column of the following table.
@@ -36,4 +36,4 @@ The telnet server is using the [oai configuration module](Config/Rtusage). Telne
| `histfile` | `character string` | "oaitelnet.history" | file used for command history persistency | Y |
| `histfsize` | `integer` | 50 | maximum number of commands saved in the history | Y |
-[oai telnet server home](telnetsrv.md)
\ No newline at end of file
+[oai telnet server home](telnetsrv.md)
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index 4e8e2c7c7f..7f8645be02 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -58,7 +58,7 @@
#include "telnetsrv_phycmd.h"
#include "telnetsrv_proccmd.h"
-static char *telnet_defstatmod[] = {"softmodem","phy","loader"};
+static char *telnet_defstatmod[] = {"softmodem","phy","loader","measur"};
static telnetsrv_params_t telnetparams;
#define TELNETSRV_LISTENADDR 0
#define TELNETSRV_LISTENPORT 1
@@ -355,7 +355,7 @@ int setgetvar(int moduleindex,char getorset,char *params) {
char varname[TELNET_CMD_MAXSIZE];
char *varval=NULL;
memset(varname,0,sizeof(varname));
- n = sscanf(params,"%s %ms",varname,&varval);
+ n = sscanf(params,"%9s %ms",varname,&varval);
for ( i=0 ; telnetparams.CmdParsers[moduleindex].var[i].varvalptr != NULL ; i++) {
if ( strncasecmp(telnetparams.CmdParsers[moduleindex].var[i].varname,varname,strlen(telnetparams.CmdParsers[moduleindex].var[i].varname)) == 0) {
@@ -475,7 +475,7 @@ int process_command(char *buf) {
memset(cmdb,0,sizeof(cmdb));
bufbck=strdup(buf);
rt=CMDSTATUS_NOTFOUND;
- j = sscanf(buf,"%9s %9s %[^\t\n]",modulename,cmd,cmdb);
+ j = sscanf(buf,"%9s %9s %9[^\t\n]",modulename,cmd,cmdb);
if (telnetparams.telnetdbg > 0)
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
@@ -500,23 +500,32 @@ int process_command(char *buf) {
}/* else */
}/* strncmp: module name test */
else if (strncasecmp(modulename,"loop",4) == 0 ) {
- int lc;
int f = fcntl(telnetparams.new_socket,F_GETFL);
- fcntl (telnetparams.new_socket, F_SETFL, O_NONBLOCK | f);
+ int f1=fcntl (telnetparams.new_socket, F_SETFL, O_NONBLOCK | f);
- for(lc=0; lc 0 ) {
+ if (telnetparams.telnetdbg > 0)
+ client_printf("Received \"%s\" status %d, errno %s while running loop\n",dummybuff,rs,strerror(errno));
+
+ if ( errno != EAGAIN && errno != EWOULDBLOCK) {
+ client_printf( STDFMT " Loop canceled, iteration %i/%i\n",lc,telnetparams.loopcount );
+ lc=telnetparams.loopcount;
break;
}
+
+ usleep(telnetparams.loopdelay * 1000);
}
fcntl (telnetparams.new_socket, F_SETFL, f);
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index 2d3ef531ae..89f6a8dda1 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -69,7 +69,8 @@ typedef struct cmddef {
#define TELNET_VARTYPE_INT64 3
#define TELNET_VARTYPE_STRING 4
#define TELNET_VARTYPE_DOUBLE 5
-//#define TELNET_VARTYPE_PTR 6
+#define TELNET_VARTYPE_INT8 6
+#define TELNET_VARTYPE_UINT 7
typedef struct variabledef {
char varname[TELNET_CMD_MAXSIZE];
char vartype;
diff --git a/common/utils/telnetsrv/telnetsrv_CMakeLists.txt b/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
index 5dee7db4c4..3a07632bfe 100644
--- a/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
+++ b/common/utils/telnetsrv/telnetsrv_CMakeLists.txt
@@ -9,6 +9,7 @@ set(TELNETSRV_SOURCE
${TELNETROOT}/telnetsrv_phycmd.c
${TELNETROOT}/telnetsrv_proccmd.c
${TELNETROOT}/telnetsrv_loader.c
+ ${TELNETROOT}/telnetsrv_measurements.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
diff --git a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
new file mode 100644
index 0000000000..89ced509a4
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
@@ -0,0 +1,99 @@
+/*
+ * 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
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
+ * \brief: definitions of macro used to initialize the telnet_ltemeasurdef_t
+ * \ strucures arrays which are then used by the display functions
+ * \ in telnetsrv_measurements.c.
+ * \author Francois TABURET
+ * \date 2019
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+
+
+#define CPU_PHYENB_MEASURE \
+{ \
+ {"phy_proc_tx", &(phyvars->phy_proc_tx),0},\
+ {"phy_proc_rx", &(phyvars->phy_proc_rx),0},\
+ {"rx_prach", &(phyvars->rx_prach),0},\
+ {"ofdm_mod", &(phyvars->ofdm_mod_stats),0},\
+ {"dlsch_common_and_dci", &(phyvars->dlsch_common_and_dci),0},\
+ {"dlsch_ue_specific", &(phyvars->dlsch_ue_specific),0},\
+ {"dlsch_encoding", &(phyvars->dlsch_encoding_stats),0},\
+ {"dlsch_modulation", &(phyvars->dlsch_modulation_stats),0},\
+ {"dlsch_scrambling", &(phyvars->dlsch_scrambling_stats),0},\
+ {"dlsch_rate_matching", &(phyvars->dlsch_rate_matching_stats),0},\
+ {"dlsch_turbo_encod_prep", &(phyvars->dlsch_turbo_encoding_preperation_stats),0},\
+ {"dlsch_turbo_encod_segm", &(phyvars->dlsch_turbo_encoding_segmentation_stats),0},\
+ {"dlsch_turbo_encod", &(phyvars->dlsch_turbo_encoding_stats),0},\
+ {"dlsch_turbo_encod_waiting", &(phyvars->dlsch_turbo_encoding_waiting_stats),0},\
+ {"dlsch_turbo_encod_signal", &(phyvars->dlsch_turbo_encoding_signal_stats),0},\
+ {"dlsch_turbo_encod_main", &(phyvars->dlsch_turbo_encoding_main_stats),0},\
+ {"dlsch_turbo_encod_wakeup0", &(phyvars->dlsch_turbo_encoding_wakeup_stats0),0},\
+ {"dlsch_turbo_encod_wakeup1", &(phyvars->dlsch_turbo_encoding_wakeup_stats1),0},\
+ {"dlsch_interleaving", &(phyvars->dlsch_interleaving_stats),0},\
+ {"rx_dft", &(phyvars->rx_dft_stats),0},\
+ {"ulsch_channel_estimation", &(phyvars->ulsch_channel_estimation_stats),0},\
+ {"ulsch_freq_offset_estimation", &(phyvars->ulsch_freq_offset_estimation_stats),0},\
+ {"ulsch_decoding", &(phyvars->ulsch_decoding_stats),0},\
+ {"ulsch_demodulation", &(phyvars->ulsch_demodulation_stats),0},\
+ {"ulsch_rate_unmatching", &(phyvars->ulsch_rate_unmatching_stats),0},\
+ {"ulsch_turbo_decoding", &(phyvars->ulsch_turbo_decoding_stats),0},\
+ {"ulsch_deinterleaving", &(phyvars->ulsch_deinterleaving_stats),0},\
+ {"ulsch_demultiplexing", &(phyvars->ulsch_demultiplexing_stats),0},\
+ {"ulsch_llr", &(phyvars->ulsch_llr_stats),0},\
+ {"ulsch_tc_init", &(phyvars->ulsch_tc_init_stats),0},\
+ {"ulsch_tc_alpha", &(phyvars->ulsch_tc_alpha_stats),0},\
+ {"ulsch_tc_beta", &(phyvars->ulsch_tc_beta_stats),0},\
+ {"ulsch_tc_gamma", &(phyvars->ulsch_tc_gamma_stats),0},\
+ {"ulsch_tc_ext", &(phyvars->ulsch_tc_ext_stats),0},\
+ {"ulsch_tc_intl1", &(phyvars->ulsch_tc_intl1_stats),0},\
+ {"ulsch_tc_intl2", &(phyvars->ulsch_tc_intl2_stats),0},\
+}
+
+#define CPU_MACENB_MEASURE \
+{ \
+ {"eNB_scheduler", &(macvars->eNB_scheduler),0},\
+ {"schedule_si", &(macvars->schedule_si),0},\
+ {"schedule_ra", &(macvars->schedule_ra),0},\
+ {"schedule_ulsch", &(macvars->schedule_ulsch),0},\
+ {"fill_DLSCH_dci", &(macvars->fill_DLSCH_dci),0},\
+ {"schedule_dlsch_pre", &(macvars->schedule_dlsch_preprocessor),0},\
+ {"schedule_dlsch", &(macvars->schedule_dlsch),0},\
+ {"schedule_mch", &(macvars->schedule_mch),0},\
+ {"rx_ulsch_sdu", &(macvars->rx_ulsch_sdu),0},\
+ {"schedule_pch", &(macvars->schedule_pch),0},\
+}
+
+#define CPU_PDCPENB_MEASURE \
+{ \
+ {"pdcp_run", &(pdcpvars->pdcp_run),0},\
+ {"data_req", &(pdcpvars->data_req),0},\
+ {"data_ind", &(pdcpvars->data_ind),0},\
+ {"apply_security", &(pdcpvars->apply_security),0},\
+ {"validate_security", &(pdcpvars->validate_security),0},\
+ {"pdcp_ip", &(pdcpvars->pdcp_ip),0},\
+ {"ip_pdcp", &(pdcpvars->ip_pdcp),0},\
+}
diff --git a/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h b/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h
new file mode 100644
index 0000000000..2f479d8ee6
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_ltemeasur_def.h
@@ -0,0 +1,127 @@
+/*
+ * 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
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_ltemeasur_def.h
+ * \brief: definitions of macro used to initialize the telnet_ltemeasurdef_t
+ * \ strucures arrays which are then used by the display functions
+ * \ in telnetsrv_measurements.c.
+ * \author Francois TABURET
+ * \date 2019
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+
+
+#define LTEMAC_MEASURE \
+{ \
+ {"total_num_bcch_pdu", &(macstatptr->total_num_bcch_pdu),TELNET_VARTYPE_INT32,0},\
+ {"bcch_buffer", &(macstatptr->bcch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"total_bcch_buffer", &(macstatptr->total_bcch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"bcch_mcs", &(macstatptr->bcch_mcs),TELNET_VARTYPE_INT32,0},\
+ {"total_num_ccch_pdu", &(macstatptr->total_num_ccch_pdu),TELNET_VARTYPE_INT32,0},\
+ {"ccch_buffer", &(macstatptr->ccch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"total_ccch_buffer", &(macstatptr->total_ccch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"ccch_mcs", &(macstatptr->ccch_mcs),TELNET_VARTYPE_INT32,0},\
+ {"total_num_pcch_pdu", &(macstatptr->total_num_pcch_pdu),TELNET_VARTYPE_INT32,0},\
+ {"pcch_buffer", &(macstatptr->pcch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"total_pcch_buffer", &(macstatptr->total_pcch_buffer),TELNET_VARTYPE_INT32,0},\
+ {"pcch_mcs", &(macstatptr->pcch_mcs),TELNET_VARTYPE_INT32,0},\
+ {"num_dlactive_UEs", &(macstatptr->num_dlactive_UEs),TELNET_VARTYPE_INT16,0},\
+ {"available_prbs", &(macstatptr->available_prbs),TELNET_VARTYPE_INT16,0},\
+ {"total_available_prbs", &(macstatptr->total_available_prbs),TELNET_VARTYPE_INT32,0},\
+ {"available_ncces", &(macstatptr->available_ncces),TELNET_VARTYPE_INT16,0},\
+ {"dlsch_bitrate", &(macstatptr->dlsch_bitrate),TELNET_VARTYPE_INT32,0},\
+ {"dlsch_bytes_tx", &(macstatptr->dlsch_bytes_tx),TELNET_VARTYPE_INT32,0},\
+ {"dlsch_pdus_tx", &(macstatptr->dlsch_pdus_tx),TELNET_VARTYPE_INT32,0},\
+ {"total_dlsch_bitrate", &(macstatptr->total_dlsch_bitrate),TELNET_VARTYPE_INT32,0},\
+ {"total_dlsch_bytes_tx", &(macstatptr->total_dlsch_bytes_tx),TELNET_VARTYPE_INT32,0},\
+ {"total_dlsch_pdus_tx", &(macstatptr->total_dlsch_pdus_tx),TELNET_VARTYPE_INT32,0},\
+ {"ulsch_bitrate", &(macstatptr->ulsch_bitrate),TELNET_VARTYPE_INT32,0},\
+ {"ulsch_bytes_rx", &(macstatptr->ulsch_bytes_rx),TELNET_VARTYPE_INT32,0},\
+ {"ulsch_pdus_rx", &(macstatptr->ulsch_pdus_rx),TELNET_VARTYPE_INT32,0},\
+ {"total_ulsch_bitrate", &(macstatptr->total_ulsch_bitrate),TELNET_VARTYPE_INT32,0},\
+ {"total_ulsch_bytes_rx", &(macstatptr->total_ulsch_bytes_rx),TELNET_VARTYPE_INT32,0},\
+ {"total_ulsch_pdus_rx", &(macstatptr->total_ulsch_pdus_rx),TELNET_VARTYPE_INT32,0},\
+ {"sched_decisions", &(macstatptr->sched_decisions),TELNET_VARTYPE_INT32,0},\
+ {"missed_deadlines", &(macstatptr->missed_deadlines),TELNET_VARTYPE_INT32,0},\
+}
+
+#define LTEMAC_UEMEASURE \
+{ \
+ {"dlsch_mcs1", &(macuestatptr->dlsch_mcs1),TELNET_VARTYPE_INT8,0},\
+ {"dlsch_mcs2", &(macuestatptr->dlsch_mcs2),TELNET_VARTYPE_INT8,0},\
+ {"rbs_used", &(macuestatptr->rbs_used),TELNET_VARTYPE_INT32,0},\
+ {"rbs_used_retx", &(macuestatptr->rbs_used_retx),TELNET_VARTYPE_INT16,0},\
+ {"total_rbs_used", &(macuestatptr->total_rbs_used),TELNET_VARTYPE_INT16,0},\
+ {"ncce_used", &(macuestatptr->ncce_used),TELNET_VARTYPE_INT16,0},\
+ {"ncce_used_retx", &(macuestatptr->ncce_used_retx),TELNET_VARTYPE_INT16,0},\
+ {"TBS", &(macuestatptr->TBS),TELNET_VARTYPE_INT32,0},\
+ {"total_pdu_bytes", &(macuestatptr->total_pdu_bytes),TELNET_VARTYPE_INT64,0},\
+ {"total_num_pdus", &(macuestatptr->total_num_pdus),TELNET_VARTYPE_INT32,0},\
+ {"overhead_bytes", &(macuestatptr->overhead_bytes),TELNET_VARTYPE_INT64,0},\
+ {"crnti", &(macuestatptr->crnti),TELNET_VARTYPE_INT16,0},\
+ {"normalized_rx_power", &(macuestatptr->normalized_rx_power),TELNET_VARTYPE_INT32,0},\
+ {"target_rx_power", &(macuestatptr->target_rx_power),TELNET_VARTYPE_INT32,0},\
+ {"ulsch_mcs1", &(macuestatptr->ulsch_mcs1),TELNET_VARTYPE_INT8,0},\
+ {"ulsch_mcs2", &(macuestatptr->ulsch_mcs2),TELNET_VARTYPE_INT8,0},\
+ {"rbs_used_rx", &(macuestatptr->rbs_used_rx),TELNET_VARTYPE_INT32,0},\
+ {"rbs_used_retx_rx", &(macuestatptr->rbs_used_retx_rx),TELNET_VARTYPE_INT32,0},\
+ {"total_rbs_used_rx", &(macuestatptr->total_rbs_used_rx),TELNET_VARTYPE_INT32,0},\
+ {"ulsch_TBS", &(macuestatptr->ulsch_TBS),TELNET_VARTYPE_INT32,0},\
+ {"total_pdu_bytes_rx", &(macuestatptr->total_pdu_bytes_rx),TELNET_VARTYPE_INT64,0},\
+ {"total_num_pdus_rx", &(macuestatptr->total_num_pdus_rx),TELNET_VARTYPE_INT32,0},\
+ {"num_errors_rx", &(macuestatptr->num_errors_rx),TELNET_VARTYPE_INT32,0},\
+}
+
+#define LTE_RLCMEASURE \
+{ \
+ {"rlc_mode", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_pdcp_sdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_pdcp_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_pdcp_sdu_discarded", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_pdcp_bytes_discarded", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_data_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_data_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_retransmit_pdu_by_status", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_retransmit_bytes_by_status", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_retransmit_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_retransmit_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_control_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"tx_control_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_pdcp_sdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_pdcp_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_pdus_duplicate", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_bytes_duplicate", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_pdu_dropped", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_bytes_dropped", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_pdu_out_of_window", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_data_bytes_out_of_window", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_control_pdu", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"rx_control_bytes", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"timer_reorder_tout", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"timer_poll_retrans_tout", NULL, TELNET_VARTYPE_UINT, 0},\
+ {"timer_status_prohibit_tout", NULL, TELNET_VARTYPE_UINT, 0},\
+}
diff --git a/common/utils/telnetsrv/telnetsrv_measurements.c b/common/utils/telnetsrv/telnetsrv_measurements.c
new file mode 100644
index 0000000000..7cfc656225
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_measurements.c
@@ -0,0 +1,316 @@
+/*
+ * 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
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
+ * \brief: implementation of telnet commands related to measurments
+ * \author Francois TABURET
+ * \date 2019
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+
+#define TELNETSERVERCODE
+#include "telnetsrv.h"
+#define TELNETSRV_MEASURMENTS_MAIN
+#include "common/utils/LOG/log.h"
+#include "common/config/config_userapi.h"
+#include "telnetsrv_measurements.h"
+#include "telnetsrv_ltemeasur_def.h"
+#include "telnetsrv_cpumeasur_def.h"
+#include "openair2/LAYER2/MAC/mac.h"
+#include "openair1/PHY/phy_extern.h"
+
+void measurcmd_display_macstats(telnet_printfunc_t prnt);
+void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
+void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
+void measurcmd_display_phycpu(telnet_printfunc_t prnt);
+void measurcmd_display_maccpu(telnet_printfunc_t prnt);
+void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
+
+
+static telnet_measurgroupdef_t measurgroups[] = {
+ {"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
+ {"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
+ {"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
+ {"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
+ {"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
+ {"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
+};
+#define TELNET_NUM_MEASURGROUPS (sizeof(measurgroups)/sizeof(telnet_measurgroupdef_t))
+
+static int eNB_id =0;
+static char *grouptypes[] = {"ltestats","cpustats"};
+static double cpufreq;
+#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
+
+#define HDR "---------------------------------"
+
+void measurcmd_display_groups(telnet_printfunc_t prnt) {
+ prnt(" %*s %10s %s\n",TELNET_MAXMEASURNAME_LEN-1,"name","type","nombre de mesures");
+
+ for(int i=0; istatname,
+ ((cpumeasure+i)->astatptr->trials!=0)?(((cpumeasure+i)->astatptr->diff)/((cpumeasure+i)->astatptr->trials))/cpufreq/1000:0,
+ (cpumeasure+i)->astatptr->trials, ((i%2)==1)?"|\n":" | " );
+ }
+
+ prnt("\n\n");
+} /* measurcmd_display_measures */
+
+#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
+void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
+ PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
+ telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYENB_MEASURE;
+ prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
+ PRINT_CPUMEAS_STATE,HDR);
+ measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+
+void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
+ eNB_MAC_INST *macvars = RC.mac[eNB_id];
+ telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
+ prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
+ PRINT_CPUMEAS_STATE,HDR);
+ measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+
+void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
+ pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
+ telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
+ prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
+ PRINT_CPUMEAS_STATE,HDR);
+ measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+/*----------------------------------------------------------------------------------------------------*/
+/* lte measurements functions */
+uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt) {
+ uint64_t val;
+
+ switch(measur->vtyp) {
+ case TELNET_VARTYPE_INT64:
+ val = (uint64_t)(*((uint64_t *)(measur->vptr)));
+ break;
+
+ case TELNET_VARTYPE_INT32:
+ val = (uint64_t)(*((uint32_t *)(measur->vptr)));
+ break;
+
+ case TELNET_VARTYPE_INT16:
+ val = (uint64_t)(*((uint16_t *)(measur->vptr)));
+ break;
+
+ case TELNET_VARTYPE_INT8:
+ val = (uint64_t)(*((uint8_t *)(measur->vptr)));
+ break;
+
+ case TELNET_VARTYPE_UINT:
+ val = (uint64_t)(*((unsigned int *)(measur->vptr)));
+ break;
+
+ default:
+ prnt("%s %i: unknown type \n",measur->statname,measur->vtyp);
+ val = (uint64_t)(*((uint64_t *)(measur->vptr)));
+ break;
+ }
+
+ return val;
+} /* measurcmd_getstatvalue */
+
+void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t *statsptr, int stats_size) {
+ for (int i=0; iUE_list);
+
+ for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+ for (int i=0; inumactiveCCs[UE_id]; i++) {
+ int CC_id = UE_list->ordered_CCids[i][UE_id];
+ prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
+ eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
+ telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
+ measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
+ }
+ }
+} /* measurcmd_display_macstats_ue */
+
+void measurcmd_display_macstats(telnet_printfunc_t prnt) {
+ for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
+ eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
+ telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
+ prnt("%s eNB %i mac stats CC %i frame %u %s\n",
+ HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
+ measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
+ }
+} /* measurcmd_display_macstats */
+
+
+void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
+ char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
+
+{
+ int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
+ rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
+ rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
+ rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
+ rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
+ rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
+
+ if (rlc_status == RLC_OP_STATUS_OK) {
+ prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
+ (rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
+ measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
+ }
+} /* status measurcmd_rlc_stat_req */
+
+
+void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
+ protocol_ctxt_t ctxt;
+ UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
+ telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
+ int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
+ unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
+ eNB_MAC_INST *eNB = RC.mac[eNB_id];
+
+ for(int i=0; i head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+#define NB_eNB_INST 1
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
+ eNB->frame,eNB->subframe,eNB_id);
+ measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
+ measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
+ }
+} /* measurcmd_display_macstats_ue */
+
+/*------------------------------------------------------------------------------------------------------------------------*/
+/* function called by the telnet server when measur command is entered */
+int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
+ char *subcmd=NULL;
+ int idx1, idx2;
+ int badcmd=1;
+
+ if (debug > 0)
+ prnt(" measurcmd_show received %s\n",buf);
+
+ // char tmp[20480];
+ // dump_eNB_l2_stats(tmp, 0);
+ // prnt("%s\n",tmp);
+ int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
+
+ if (s>0) {
+ if ( strcmp(subcmd,"groups") == 0) {
+ measurcmd_display_groups(prnt);
+ badcmd=0;
+ } else {
+ for (int i=0; i0 */
+
+ if (badcmd) {
+ prnt("%s: unknown measur command\n",buf);
+ }
+
+ return CMDSTATUS_FOUND;
+}
+
+
+int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt) {
+ char *subcmd=NULL;
+ int idx1, idx2;
+ int badcmd=1;
+
+ if (debug > 0)
+ prnt(" measurcmd_show received %s\n",buf);
+
+ int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
+
+ if (s>0) {
+ if ( strcmp(subcmd,"enable") == 0) {
+ cpumeas(CPUMEAS_ENABLE);
+ badcmd=0;
+ } else if ( strcmp(subcmd,"disable") == 0) {
+ cpumeas(CPUMEAS_DISABLE);
+ badcmd=0;
+ }
+ }
+
+ if (badcmd) {
+ prnt("Cpu measurments state: %s\n",PRINT_CPUMEAS_STATE);
+ }
+
+ free(subcmd);
+ return CMDSTATUS_FOUND;
+}
+/*-------------------------------------------------------------------------------------*/
+
+/* function called at telnet server init to add the measur command */
+void add_measur_cmds(void) {
+ add_telnetcmd("measur",measur_vardef,measur_cmdarray);
+ cpufreq = get_cpu_freq_GHz();
+}
diff --git a/common/utils/telnetsrv/telnetsrv_measurements.h b/common/utils/telnetsrv/telnetsrv_measurements.h
new file mode 100644
index 0000000000..46f25da4c5
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_measurements.h
@@ -0,0 +1,88 @@
+/*
+ * 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
+ */
+
+
+/*! \file common/utils/telnetsrv/telnetsrv_measurements.h
+ * \brief: Include file defining constants, structures and function prototypes
+ * \ used to implement the measurements functionality of the telnet server
+ * \author Francois TABURET
+ * \date 2019
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#include
+#include "telnetsrv.h"
+#include "openair1/PHY/defs_eNB.h"
+#ifdef TELNETSRV_MEASURMENTS_MAIN
+
+
+#define TELNET_MAXMEASURNAME_LEN 30
+#define TELNET_MAXMEASURGROUPS 10
+
+telnetshell_vardef_t measur_vardef[] = {
+ {"",0,NULL}
+};
+
+typedef struct cpumeasurdef {
+ char statname[TELNET_MAXMEASURNAME_LEN];
+ time_stats_t *astatptr;
+ unsigned int statemask;
+} telnet_cpumeasurdef_t;
+
+typedef struct ltemeasurdef {
+ char statname[TELNET_MAXMEASURNAME_LEN];
+ void *vptr;
+ char vtyp;
+ unsigned int statemask;
+} telnet_ltemeasurdef_t;
+
+#define GROUP_LTESTATS 0
+#define GROUP_CPUSTATS 1
+typedef void(*measur_dislayfunc_t)(telnet_printfunc_t prnt);
+typedef struct mesurgroupdef {
+ char groupname[TELNET_MAXMEASURNAME_LEN];
+ unsigned char type;
+ unsigned char size;
+ measur_dislayfunc_t displayfunc;
+ union {
+ telnet_cpumeasurdef_t *cpustats;
+ telnet_ltemeasurdef_t *ltestats;
+ };
+} telnet_measurgroupdef_t;
+
+#define MACSTATS_NAME(valptr) #valptr
+#define LTEMAC_MEASURGROUP_NAME "ltemac"
+#define PHYCPU_MEASURGROUP_NAME "phycpu"
+
+int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt);
+int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt);
+telnetshell_cmddef_t measur_cmdarray[] = {
+ {"show", "groups | " , measurcmd_show},
+ {"cpustats","[enable | disable]",measurcmd_cpustats},
+ {"","",NULL}
+};
+
+#else
+extern void add_measur_cmds(void);
+#endif /* TELNETSRV_MEASURCMD_MAIN */
diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.c b/common/utils/telnetsrv/telnetsrv_proccmd.c
index 3b423bd465..9dd512091d 100644
--- a/common/utils/telnetsrv/telnetsrv_proccmd.c
+++ b/common/utils/telnetsrv/telnetsrv_proccmd.c
@@ -183,7 +183,7 @@ struct dirent *entry;
{
if(entry->d_name[0] == '.')
continue;
- snprintf(aname, sizeof(aname), "/proc/%d/task/%s/stat", getpid(),entry->d_name);
+ snprintf(aname, sizeof(aname), "/proc/%d/task/%.*s/stat", getpid(),(int)(sizeof(aname)-24),entry->d_name);
read_statfile(aname,debug,prnt);
} /* while entry != NULL */
closedir(proc_dir);
diff --git a/common/utils/threadPool/Makefile b/common/utils/threadPool/Makefile
new file mode 100644
index 0000000000..6f0e884886
--- /dev/null
+++ b/common/utils/threadPool/Makefile
@@ -0,0 +1,8 @@
+all: measurement_display thread-pool-test
+
+measurement_display: measurement_display.c thread-pool.h
+ gcc measurement_display.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o measurement_display
+
+thread-pool-test: thread-pool.c thread-pool.h
+ gcc -g thread-pool.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o thread-pool-test
+
diff --git a/common/utils/threadPool/measurement_display.c b/common/utils/threadPool/measurement_display.c
new file mode 100644
index 0000000000..ac7beca1fe
--- /dev/null
+++ b/common/utils/threadPool/measurement_display.c
@@ -0,0 +1,61 @@
+/*
+ Author: Laurent THOMAS, Open Cells
+ copyleft: OpenAirInterface Software Alliance and it's licence
+*/
+
+#define __USE_GNU
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "thread-pool.h"
+
+#define SEP "\t"
+
+uint64_t cpuCyclesMicroSec;
+
+int main(int argc, char *argv[]) {
+ if(argc != 2) {
+ printf("Need one paramter: the trace Linux pipe (fifo)");
+ exit(1);
+ }
+
+ mkfifo(argv[1],0666);
+ int fd=open(argv[1], O_RDONLY);
+
+ if ( fd == -1 ) {
+ perror("open read mode trace file:");
+ exit(1);
+ }
+
+ uint64_t deb=rdtsc();
+ usleep(100000);
+ cpuCyclesMicroSec=(rdtsc()-deb)/100000;
+ printf("Cycles per µs: %lu\n",cpuCyclesMicroSec);
+ printf("Key" SEP "delay to process" SEP "processing time" SEP "delay to be read answer\n");
+ notifiedFIFO_elt_t doneRequest;
+
+ while ( 1 ) {
+ if ( read(fd,&doneRequest, sizeof(doneRequest)) == sizeof(doneRequest)) {
+ printf("%lu" SEP "%lu" SEP "%lu" SEP "%lu" "\n",
+ doneRequest.key,
+ (doneRequest.startProcessingTime-doneRequest.creationTime)/cpuCyclesMicroSec,
+ (doneRequest.endProcessingTime-doneRequest.startProcessingTime)/cpuCyclesMicroSec,
+ (doneRequest.returnTime-doneRequest.endProcessingTime)/cpuCyclesMicroSec
+ );
+ } else {
+ printf("no measurements\n");
+ sleep(1);
+ }
+ }
+}
diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c
new file mode 100644
index 0000000000..4cc56fc9b8
--- /dev/null
+++ b/common/utils/threadPool/thread-pool.c
@@ -0,0 +1,230 @@
+/*
+ Author: Laurent THOMAS, Open Cells
+ copyleft: OpenAirInterface Software Alliance and it's licence
+*/
+
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+void displayList(notifiedFIFO_t *nf) {
+ int n=0;
+ notifiedFIFO_elt_t *ptr=nf->outF;
+
+ while(ptr) {
+ printf("element: %d, key: %lu\n",++n,ptr->key);
+ ptr=ptr->next;
+ }
+
+ printf("End of list: %d elements\n",n);
+}
+
+static inline notifiedFIFO_elt_t *pullNotifiedFifoRemember( notifiedFIFO_t *nf, struct one_thread *thr) {
+ mutexlock(nf->lockF);
+
+ while(!nf->outF)
+ condwait(nf->notifF, nf->lockF);
+
+ notifiedFIFO_elt_t *ret=nf->outF;
+ nf->outF=nf->outF->next;
+
+ if (nf->outF==NULL)
+ nf->inF=NULL;
+
+ // For abort feature
+ thr->runningOnKey=ret->key;
+ thr->abortFlag=false;
+ mutexunlock(nf->lockF);
+ return ret;
+}
+
+void *one_thread(void *arg) {
+ struct one_thread *myThread=(struct one_thread *) arg;
+ struct thread_pool *tp=myThread->pool;
+
+ // configure the thread core assignment
+ // TBD: reserve the core for us exclusively
+ if ( myThread->coreID >= 0 && myThread->coreID < get_nprocs_conf()) {
+ cpu_set_t cpuset;
+ CPU_ZERO(&cpuset);
+ CPU_SET(myThread->coreID, &cpuset);
+ pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
+ }
+
+ //Configure the thread scheduler policy for Linux
+ struct sched_param sparam= {0};
+ sparam.sched_priority = sched_get_priority_max(SCHED_RR);
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
+ // set the thread name for debugging
+ sprintf(myThread->name,"Tpool_%d",myThread->coreID);
+ pthread_setname_np(pthread_self(), myThread->name );
+
+ // Infinite loop to process requests
+ do {
+ notifiedFIFO_elt_t *elt=pullNotifiedFifoRemember(&tp->incomingFifo, myThread);
+
+ if (tp->measurePerf) elt->startProcessingTime=rdtsc();
+
+ elt->processingFunc(NotifiedFifoData(elt));
+
+ if (tp->measurePerf) elt->endProcessingTime=rdtsc();
+
+ if (elt->reponseFifo) {
+ // Check if the job is still alive, else it has been aborted
+ mutexlock(tp->incomingFifo.lockF);
+
+ if (myThread->abortFlag)
+ delNotifiedFIFO_elt(elt);
+ else
+ pushNotifiedFIFO(elt->reponseFifo, elt);
+
+ mutexunlock(tp->incomingFifo.lockF);
+ }
+ } while (true);
+}
+
+void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
+ memset(pool,0,sizeof(*pool));
+ char *measr=getenv("threadPoolMeasurements");
+ pool->measurePerf=performanceMeas;
+ // force measurement if the output is defined
+ pool->measurePerf=measr!=NULL;
+
+ if (measr) {
+ mkfifo(measr,0666);
+ AssertFatal(-1 != (pool->dummyTraceFd=
+ open(measr, O_RDONLY| O_NONBLOCK)),"");
+ AssertFatal(-1 != (pool->traceFd=
+ open(measr, O_WRONLY|O_APPEND|O_NOATIME|O_NONBLOCK)),"");
+ } else
+ pool->traceFd=-1;
+
+ //Configure the thread scheduler policy for Linux
+ struct sched_param sparam= {0};
+ sparam.sched_priority = sched_get_priority_max(SCHED_RR)-1;
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
+ pool->activated=true;
+ initNotifiedFIFO(&pool->incomingFifo);
+ char *saveptr, * curptr;
+ pool->nbThreads=0;
+ pool->restrictRNTI=false;
+ curptr=strtok_r(params,",",&saveptr);
+
+ while ( curptr!=NULL ) {
+ int c=toupper(curptr[0]);
+
+ switch (c) {
+ case 'U':
+ pool->restrictRNTI=true;
+ break;
+
+ case 'N':
+ pool->activated=false;
+ break;
+
+ default:
+ pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread));
+ pool->allthreads->next=pool->allthreads;
+ printf("create a thread for core %d\n", atoi(curptr));
+ pool->allthreads->coreID=atoi(curptr);
+ pool->allthreads->id=pool->nbThreads;
+ pool->allthreads->pool=pool;
+ pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads);
+ pool->nbThreads++;
+ }
+
+ curptr=strtok_r(NULL,",",&saveptr);
+ }
+
+ if (pool->activated && pool->nbThreads==0) {
+ printf("No servers created in the thread pool, exit\n");
+ exit(1);
+ }
+}
+
+#ifdef TEST_THREAD_POOL
+
+struct testData {
+ int id;
+ char txt[30];
+};
+
+void processing(void *arg) {
+ struct testData *in=(struct testData *)arg;
+ printf("doing: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() );
+ sprintf(in->txt,"Done by %ld, job %d", pthread_self(), in->id);
+ usleep(rand()%100);
+ printf("done: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() );
+}
+
+int main() {
+ notifiedFIFO_t myFifo;
+ initNotifiedFIFO(&myFifo);
+ pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1234,NULL,NULL));
+
+ for(int i=10; i>1; i--) {
+ pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1000+i,NULL,NULL));
+ }
+
+ displayList(&myFifo);
+ notifiedFIFO_elt_t *tmp=pullNotifiedFIFO(&myFifo);
+ printf("pulled: %lu\n", tmp->key);
+ displayList(&myFifo);
+ tmp=pullNotifiedFIFO(&myFifo);
+ printf("pulled: %lu\n", tmp->key);
+ displayList(&myFifo);
+ abortNotifiedFIFO(&myFifo,1005);
+ printf("aborted 1005\n");
+ displayList(&myFifo);
+ pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 12345678, NULL, NULL));
+ displayList(&myFifo);
+ abortNotifiedFIFO(&myFifo,12345678);
+ printf("aborted 12345678\n");
+ displayList(&myFifo);
+
+ do {
+ tmp=pollNotifiedFIFO(&myFifo);
+
+ if (tmp) {
+ printf("pulled: %lu\n", tmp->key);
+ displayList(&myFifo);
+ } else
+ printf("Empty list \n");
+ } while(tmp);
+
+ tpool_t pool;
+ char params[]="1,2,3,u";
+ initTpool(params,&pool, true);
+ notifiedFIFO_t worker_back;
+ initNotifiedFIFO(&worker_back);
+
+ for (int i=0; i <1000 ; i++) {
+ notifiedFIFO_elt_t *work=newNotifiedFIFO_elt(sizeof(struct testData), i, &worker_back, processing);
+ struct testData *x=(struct testData *)NotifiedFifoData(work);
+ x->id=i;
+ pushTpool(&pool, work);
+ }
+
+ do {
+ tmp=pullTpool(&worker_back,&pool);
+
+ if (tmp) {
+ struct testData *dd=NotifiedFifoData(tmp);
+ printf("Result: %s\n",dd->txt);
+ delNotifiedFIFO_elt(tmp);
+ } else
+ printf("Empty list \n");
+
+ abortTpool(&pool,510);
+ } while(tmp);
+
+ return 0;
+}
+#endif
diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h
new file mode 100644
index 0000000000..6f34508c5a
--- /dev/null
+++ b/common/utils/threadPool/thread-pool.h
@@ -0,0 +1,244 @@
+/*
+ Author: Laurent THOMAS, Open Cells
+ copyleft: OpenAirInterface Software Alliance and it's licence
+*/
+
+#ifndef THREAD_POOL_H
+#define THREAD_POOL_H
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef DEBUG
+ #define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+#else
+ #define THREADINIT PTHREAD_MUTEX_INITIALIZER
+#endif
+#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,"");
+#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,"");
+#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,"");
+#define mutextrylock(mutex) pthread_mutex_trylock(&mutex)
+#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,"");
+#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
+#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
+#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
+
+typedef struct notifiedFIFO_elt_s {
+ struct notifiedFIFO_elt_s *next;
+ uint64_t key; //To filter out elements
+ struct notifiedFIFO_s *reponseFifo;
+ void (*processingFunc)(void *);
+ bool malloced;
+ uint64_t creationTime;
+ uint64_t startProcessingTime;
+ uint64_t endProcessingTime;
+ uint64_t returnTime;
+ void *msgData;
+} notifiedFIFO_elt_t;
+
+typedef struct notifiedFIFO_s {
+ notifiedFIFO_elt_t *outF;
+ notifiedFIFO_elt_t *inF;
+ pthread_mutex_t lockF;
+ pthread_cond_t notifF;
+} notifiedFIFO_t;
+
+// You can use this allocator or use any piece of memory
+static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size,
+ uint64_t key,
+ notifiedFIFO_t *reponseFifo,
+ void (*processingFunc)(void *)) {
+ notifiedFIFO_elt_t *ret;
+ AssertFatal( NULL != (ret=(notifiedFIFO_elt_t *) malloc(sizeof(notifiedFIFO_elt_t)+size+32)), "");
+ ret->next=NULL;
+ ret->key=key;
+ ret->reponseFifo=reponseFifo;
+ ret->processingFunc=processingFunc;
+ // We set user data piece aligend 32 bytes to be able to process it with SIMD
+ ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32;
+ ret->malloced=true;
+ return ret;
+}
+
+static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) {
+ return elt->msgData;
+}
+
+static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) {
+ if (elt->malloced) {
+ elt->malloced=false;
+ free(elt);
+ } else
+ printf("delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
+
+ //LOG_W(UTIL,"delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
+}
+
+static inline void initNotifiedFIFO(notifiedFIFO_t *nf) {
+ mutexinit(nf->lockF);
+ condinit (nf->notifF);
+ nf->inF=NULL;
+ nf->outF=NULL;
+ // No delete function: the creator has only to free the memory
+}
+
+static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg) {
+ mutexlock(nf->lockF);
+ msg->next=NULL;
+
+ if (nf->outF == NULL)
+ nf->outF = msg;
+
+ if (nf->inF)
+ nf->inF->next = msg;
+
+ nf->inF = msg;
+ condbroadcast(nf->notifF);
+ mutexunlock(nf->lockF);
+}
+
+static inline notifiedFIFO_elt_t *pullNotifiedFIFO(notifiedFIFO_t *nf) {
+ mutexlock(nf->lockF);
+
+ while(!nf->outF)
+ condwait(nf->notifF, nf->lockF);
+
+ notifiedFIFO_elt_t *ret=nf->outF;
+ nf->outF=nf->outF->next;
+
+ if (nf->outF==NULL)
+ nf->inF=NULL;
+
+ mutexunlock(nf->lockF);
+ return ret;
+}
+
+static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
+ int tmp=mutextrylock(nf->lockF);
+
+ if (tmp != 0 )
+ return NULL;
+
+ notifiedFIFO_elt_t *ret=nf->outF;
+
+ if (ret!=NULL)
+ nf->outF=nf->outF->next;
+
+ if (nf->outF==NULL)
+ nf->inF=NULL;
+
+ mutexunlock(nf->lockF);
+ return ret;
+}
+
+// This function aborts all messages matching the key
+// If the queue is used in thread pools, it doesn't cancels already running processing
+// because the message has already been picked
+static inline void abortNotifiedFIFO(notifiedFIFO_t *nf, uint64_t key) {
+ mutexlock(nf->lockF);
+ notifiedFIFO_elt_t **start=&nf->outF;
+
+ while(*start!=NULL) {
+ if ( (*start)->key == key ) {
+ notifiedFIFO_elt_t *request=*start;
+ *start=(*start)->next;
+ delNotifiedFIFO_elt(request);
+ }
+
+ if (*start != NULL)
+ start=&(*start)->next;
+ }
+
+ mutexunlock(nf->lockF);
+}
+
+struct one_thread {
+ pthread_t threadID;
+ int id;
+ int coreID;
+ char name[256];
+ uint64_t runningOnKey;
+ bool abortFlag;
+ struct thread_pool *pool;
+ struct one_thread *next;
+};
+
+typedef struct thread_pool {
+ int activated;
+ bool measurePerf;
+ int traceFd;
+ int dummyTraceFd;
+ uint64_t cpuCyclesMicroSec;
+ uint64_t startProcessingUE;
+ int nbThreads;
+ bool restrictRNTI;
+ notifiedFIFO_t incomingFifo;
+ struct one_thread *allthreads;
+} tpool_t;
+
+static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) {
+ if (t->measurePerf) msg->creationTime=rdtsc();
+
+ pushNotifiedFIFO(&t->incomingFifo, msg);
+}
+
+static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) {
+ notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo);
+
+ if (t->measurePerf)
+ msg->returnTime=rdtsc();
+
+ if (t->traceFd)
+ if(write(t->traceFd, msg, sizeof(*msg)));
+
+ return msg;
+}
+
+static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) {
+ notifiedFIFO_elt_t *msg= pollNotifiedFIFO(responseFifo);
+
+ if (msg == NULL)
+ return NULL;
+
+ if (t->measurePerf)
+ msg->returnTime=rdtsc();
+
+ if (t->traceFd)
+ if(write(t->traceFd, msg, sizeof(*msg)));
+
+ return msg;
+}
+
+static inline void abortTpool(tpool_t *t, uint64_t key) {
+ notifiedFIFO_t *nf=&t->incomingFifo;
+ mutexlock(nf->lockF);
+ notifiedFIFO_elt_t **start=&nf->outF;
+
+ while(*start!=NULL) {
+ if ( (*start)->key == key ) {
+ notifiedFIFO_elt_t *request=*start;
+ *start=(*start)->next;
+ delNotifiedFIFO_elt(request);
+ }
+
+ if (*start != NULL)
+ start=&(*start)->next;
+ }
+
+ struct one_thread *ptr=t->allthreads;
+
+ while(ptr!=NULL) {
+ if (ptr->runningOnKey==key)
+ ptr->abortFlag=true;
+
+ ptr=ptr->next;
+ }
+
+ mutexunlock(nf->lockF);
+}
+void initTpool(char *params,tpool_t *pool, bool performanceMeas);
+
+#endif
diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md
new file mode 100644
index 0000000000..2b6336fb60
--- /dev/null
+++ b/common/utils/threadPool/thread-pool.md
@@ -0,0 +1,71 @@
+# Thread pool
+
+The thread pool is a working server, made of a set of worker threads that can be mapped on CPU cores.
+
+Each worker loop on pick from the same input queue jobs to do.
+When a job is done, the worker sends a return if a return is defined.
+
+A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, but from a response of one job, the other linked jobs becomes useless).
+
+All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client, so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter.
+
+## license
+Author: Laurent Thomas, Open cells project
+The owner share this piece code to Openairsoftware alliance as per OSA license terms
+
+# jobs
+
+A job is a message (notifiedFIFO_elt_t):
+next: internal FIFO chain, do not set it
+key: a long int that the client can use to identify a message or a group of messages
+responseFifo: if the client defines a response FIFO, the message will be posted back after processing
+processingFunc: any funtion (type void processingFunc(void *)) that the worker will launch
+msgData: the data passed to processingFunc. It can be added automatically, or you can set it to a buffer you are managing
+malloced: a boolean that enable internal free in these cases: no return Fifo or Abort feature
+
+The job messages can be created with newNotifiedFIFO_elt() and delNotifiedFIFO_elt() or managed by the client.
+
+# Queues of jobs
+
+Queues are type of: notifiedFIFO_t that must be initialized by init_notifiedFIFO()
+No delete function is required, the creator has only to free the data of type notifiedFIFO_t
+
+push_notifiedFIFO() add a job in the queue
+pull_notifiedFIFO() is blocking, poll_notifiedFIFO() is non blocking
+
+abort_notifiedFIFO() allows the customer to delete all waiting jobs that match with the key (see key in jobs definition)
+
+# Thread pools
+
+## initialization
+The clients can create one or more thread pools with init_tpool()
+the params string structure: describes a list of cores, separated by "," that run a worker thread
+
+If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
+
+The threads are all Linux real time scheduler, their name is set automatically is "Tpool_"
+
+## adding jobs
+The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO())
+
+If they need a return, they have to create response queues with init_notifiedFIFO() and set this FIFO pointer in the notifiedFIFO_elt_t before pushing the job.
+
+## abort
+
+A abort service abortTpool() allows to abort all jobs that match a key (see jobs "key"). When the abort returns, it garanties no job (matching the key) response will be posted on response queues.
+
+Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
+
+## Performance measurements
+
+A performance measurement is integrated: the pool will automacillay fill timestamps:
+
+* creationTime: time the request is push to the pool;
+* startProcessingTime: time a worker start to run on the job
+* endProcessingTime: time the worker finished the job
+* returnTime: time the client reads the result
+
+if you set the environement variable: thread-pool-measurements to a valid file name
+These measurements will be wrote to this Linux pipe.
+
+A tool to read the linux fifo and display it in ascii is provided: see the local directory Makefile for this tool and to compile the thread pool unitary tests.
diff --git a/configuration/bladeRF/enb-band7-5mhz.conf b/configuration/bladeRF/enb-band7-5mhz.conf
index 6e07b8d949..127c865422 100644
--- a/configuration/bladeRF/enb-band7-5mhz.conf
+++ b/configuration/bladeRF/enb-band7-5mhz.conf
@@ -181,6 +181,11 @@ eNBs =
}
);
+ ///X2
+ enable_x2 = "no";
+ t_reloc_prep = 1000; /* unit: millisecond */
+ tx2_reloc_overall = 2000; /* unit: millisecond */
+
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1";
diff --git a/doc/BUILD.md b/doc/BUILD.md
new file mode 100644
index 0000000000..1f971b7776
--- /dev/null
+++ b/doc/BUILD.md
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+ OAI Build Procedures
+
+
+
+
+This page is valid on tags starting from **`2019.w09`**.
+
+# Soft Modem Build Script
+
+oai EPC is developed in a distinct project with it's own [documentation](https://github.com/OPENAIRINTERFACE/openair-cn/wiki) , it is not described here.
+
+OAI UE and eNodeB sources can be downloaded from the Eurecom [gitlab repository](./GET_SOURCES.md).
+
+Sources come with a build script [build_oai](../cmake_targets/build_oai) located at the root of the `openairinterface5g/cmake_targets` directory. This script is developed to build the oai binaries (executables,shared libraries) for different hardware platforms, and use cases.
+
+The main oai binaries, which are tested by the Continuous Integration process are:
+
+- The LTE UE: `lte-uesoftmodem`
+- The LTE eNodeB: `lte-softmodem`
+- The PHY simulators: `dlsim` and `ulsim`
+
+The build system for OAI uses [cmake](https://cmake.org/) which is a tool to generate makefiles. The `build_oai` script is a wrapper using cmake, make and standard linux shell commands to ease the oai build and use . The file describing how to build the executables from source files is the [CMakeLists.txt](../cmake_targets/CMakeLists.txt), it is used as input by cmake to generate the makefiles.
+
+The oai softmodem supports many use cases, and new ones are regularly added. Most of them are accessible using the configuration file or the command line options and continuous effort is done to avoid introducing build options as it makes tests and usage more complicated than run-time options. The following functionalities, originally requiring a specific build are now accessible by configuration or command line options:
+
+- s1, noS1
+- all simulators, with exception of PHY simulators, which are distinct executables.
+
+
+Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the
+
+[table]: BUILD.md "`build_oai` options"
+
+At the end of this page to know the status of `buid_oai` options which are not described hereafter.
+
+# Building PHY Simulators
+
+Detailed information about these simulators can be found [in this dedicated page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirLTEPhySimul)
+
+# Building UE and eNodeB Executables
+
+After downloading the source files, a single build command can be used to get the binaries supporting all the oai softmodem use cases (UE and eNodeB):
+
+```
+cd /openairinterface5g/
+source oaienv
+cd ../cmake_targets/
+./build_oai -I -w USRP --eNB --UE
+```
+
+- The `-I` option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed.
+- The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process.
+- `--eNB` is to build the `lte-softmodem` executable and all required shared libraries
+- `--UE` is to build the `lte-uesoftmodem` executable and all required shared libraries
+
+You can build the eNodeB and the UE separately, you may not need both of them depending on your oai usage.
+
+After completing the build, the binaries are available in the `cmake_targets/lte_build_oai/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel14 by default. It must be noticed that the option for building for a specific 3GPP release number is not tested by the CI and may be removed in the future.
+
+# Building Optional Binaries
+
+## Telnet Server
+
+The telnet server can be built with the --build-telnet option, after building the softmodem or while building it.
+
+`./build_oai -I -w USRP --eNB --UE --build-telnetsrv`
+
+or
+
+`./build_oai --build-telnetsrv`
+
+## USRP record player
+
+The USRP record player today needs a specific build. Work to make it available as a run time option is under consideration
+
+# `build_oai` options
+
+| Option | Status | Description |
+| ----------------------------------------------------------- | ------------------------------------------- | :----------------------------------------------------------- |
+| -h | maintained | get help |
+| -c | maintained | erase all previously built files for this target before starting the new build. |
+| -C | maintained, needs improvement | erase all previously built files for any target before starting the new build. |
+| --verbose-compile | maintained | |
+| --cflags_processor | maintained | used to pass options to the compiler |
+| --clean-kernel | unknown | no code in the script corresponding to this option |
+| --install-system-files | maintained | install oai built binaries in linux system files repositories |
+| -w | maintained and tested in CI for USRP device | build corresponding oai device and create the soft link to enforce this device usage at run-time |
+| -t | maintained | build the specified transport library, which is used in some simulators and in non monolithic eNodeB deployments. Now of little interest as transport library build is enforced when building the eNodeB. |
+| --phy_simulators | maintained, tested in CI | build all PHY simulators, a set of executables allowing unitary tests of LTE channel implementation within oai. |
+| --core_simulators | | |
+| -s | | |
+| --run-group | | |
+| -I | maintained, tested in CI | install external dependencies before starting the build |
+| --install-optional-packages | maintained | install optional packages, useful for developing and testing. look at the |
+| | | check_install_additional_tools function in cmake_targets/tools/build_helper script to get the list |
+| -g | maintained | build binaries with gdb support. |
+| --eNB | maintained and tested in CI | build `lte-softmodem` the LTE eNodeB |
+| --UE | maintained and tested in CI | build `lte-uesoftmodem` the LTE UE |
+| --usrp-recplay | maintained | build with support for the record player. Implementation will be soon reviewed to switch to a run-time option. |
+| --build-telnet | maintained | build the telnet server shared library, which can then be loaded at run time via the --telnetsrv command line option. |
+| --build-msc | unknown | build the msc shared library, which can then be loaded at run time via the --msc command line option. msc is a tracing utility which status is unknown. |
+| --UE-conf-nvram | | |
+| --UE-gen-nvram | | |
+| -r | unknown, to be removed | specifies which 3GPP release to build for. Only the default (today rel14) is tested in CI and it is likely that future oai release will remove this option |
+| -V | deprecated | Used to build with support for synchronization diagram utility. This is now available via the T-Tracer and is included if T-Tracer is not disabled. |
+| -x | deprecated | Used to build with support for embedded signal analyzer. This is now available via the T-Tracer and is included if T-Tracer is not disabled. |
+| --noS1 | deprecated, to be removed | build noS1 version of oai softmodem binaries. noS1 allows running oai eNodeB and UE without an LTE core network (EPC). This functionality is now available via a run-time option. |
+| --build-doxygen | unknown | build doxygen documentation, many oai source files do not include doxygen comments |
+| --disable-deadline --enable-deadline --disable-cpu-affinity | deprecated | These options were used to activate or de-activate specific code depending on the choice of a specific linux scheduling mode. This has not been tested for a while and should be implemented as configuration options |
+| --disable-T-Tracer | maintained, to be tested | Remove T_Tracer and console LOG messages except error messages. |
+| --disable-hardware-dependency | | |
+| --ue-autotest-trace --ue-timing --ue-trace | deprecated | Were used to enable conditional code implementing debugging messages or debugging statistics. These functionalities are now either available from run-time options or not maintained. |
+| --disable-log | deprecated, to be removed | Was used to disable LOG messages, replaced by `--disable-T-Tracer` build option to remove tracing code from the build or `--T-stdout 0` run time option to redirect LOG messages to T-Tracer client interface. |
+| --ue-nas-use-tun | deprecated to be removed | Usage of tun in place of specific kernel modules is now a run time option. `--nokrnmod 0` option disable the default behavior which is to use tun to send or receive ip packets to/from the linux ip stack. |
+| --build-eclipse | unknown | |
+| --basic-simulator | deprecated tested in CI | builds the basic simulator device. Now of little interest as this device build is enforced when building the eNodeB and it can be used at run time with the `--basicsim` option. More over the rf simulator is an enhanced basic simulator. |
+| --rfsimulator | maintained | builds the rf simulator device. Now of little interest as this device build is enforced when building the eNodeB and it can be used at run time with the `--rfsim` option. |
+| | | |
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem features](FEATURE_SET.md)
+
+[running the oai softmodem ](RUNMODEM.md)
+
diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md
index fef47d9c27..deb4fec994 100644
--- a/doc/FEATURE_SET.md
+++ b/doc/FEATURE_SET.md
@@ -18,7 +18,7 @@
# OpenAirInterface Block diagram #
-
+
# OpenAirInterface eNB Feature Set #
@@ -43,22 +43,26 @@ The Physical layer implements **3GPP 36.211**, **36.212**, **36.213** and provid
**Transmission Mode, Bandwidth** | **Expected Throughput** | **Measured Throughput** | **Measurement Conditions**
-------------------------------- | ----------------------- | ------------------------| ----------------:
FDD DL: 5 MHz, 25 PRBS/ MCS 28 | 16 - 17 Mbit/s | TM1: 17.0 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-FDD DL: 10 MHz, 50 PRBS/ MCS 28 | 34 - 35 Mbit/s | TM1: 32.8 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+FDD DL: 10 MHz, 50 PRBS/ MCS 28 | 34 - 35 Mbit/s | TM1: 34.0 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
FDD DL: 20 MHz, 100 PRBS/ MCS 28 | 70 Mbit/s | TM1: 69.9 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
| | |
FDD UL: 5 MHz, 25 PRBS/ MCS 20 | 9 Mbit/s | TM1: 8.28 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-FDD UL: 10 MHz, 50 PRBS/ MCS 20 | 17 Mbit/s | TM1: 15.2 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+FDD UL: 10 MHz, 50 PRBS/ MCS 20 | 17 Mbit/s | TM1: 18.3 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
FDD UL: 20 MHz, 100 PRBS/ MCS 20 | 35 Mbit/s | TM1: 18.6 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
| |
-TDD DL: 5 MHz, 25 PRBS/ MCS **XX** | **TBC** Mbit/s | 3.33 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-TDD DL: 10 MHz, 50 PRBS/ MCS **XX** | **TBC** Mbit/s | 8.90 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-TDD DL: 20 MHz, 100 PRBS/ MCS **XX** | **TBC** Mbit/s | N/A | COTS-UE Cat 4 (150/50 Mbps)
+TDD DL: 5 MHz, 25 PRBS/ MCS **XX** | 6.5 Mbit/s | TM1: 6.71 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+TDD DL: 10 MHz, 50 PRBS/ MCS **XX** | 13.5 Mbit/s | TM1: 13.6 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+TDD DL: 20 MHz, 100 PRBS/ MCS **XX** | 28.0 Mbit/s | TM1: 27.2 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
| | |
-TDD UL: 5 MHz, 25 PRBS/ MCS **XX** | **TBC** Mbit/s | 1.66 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-TDD UL: 10 MHz, 50 PRBS/ MCS **XX** | **TBC** Mbit/s | 1.89 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-TDD UL: 20 MHz, 100 PRBS/ MCS **XX** | **TBC** Mbit/s | N/A | COTS-UE Cat 4 (150/50 Mbps)
+TDD UL: 5 MHz, 25 PRBS/ MCS **XX** | 2.0 Mbit/s | TM1: 3.31 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+TDD UL: 10 MHz, 50 PRBS/ MCS **XX** | 2.0 Mbit/s | TM1: 7.25 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
+TDD UL: 20 MHz, 100 PRBS/ MCS **XX** | 3.0 Mbit/s | TM1: 4.21 Mbits/s | COTS-UE Cat 4 (150/50 Mbps)
-- Number of supported UEs: **To Be Completed**
+### Number of supported UEs ###
+
+* 16 by default
+* up to 256 when compiling with dedicated compile flag
+* was tested with 40 COTS-UE
## eNB MAC Layer ##
@@ -72,6 +76,7 @@ The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support
- RLC interface (AM, UM)
- UL power control
- Link adaptation
+- Connected DRX (CDRX) support for FDD LTE UE. Compatible with R13 from 3GPP. Support for Cat-M1 UE comming soon.
## eNB RLC Layer ##
@@ -124,6 +129,12 @@ The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following
- X2 Setup Request
- X2 Setup Response
+ - X2 Setup Failure
+ - Handover Request
+ - Handover Request Acknowledge
+ - UE Context Release
+ - X2 timers (t_reloc_prep, tx2_reloc_overall)
+ - Handover Cancel
## eNB Advanced Features ##
@@ -135,7 +146,7 @@ The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following
- RAU: Radio-Access Unit
- RRU: Remote Radio-Unit
-
+
- IF4.5 / IF5 : similar to IEEE P1914.1
- FAPI (IF2) : specified by Small Cell Forum (open-nFAPI implementation)
@@ -189,3 +200,10 @@ The NAS layer is based on **3GPP 24.301** and implements the following functions
- EMM attach/detach, authentication, tracking area update, and more
- ESM default/dedicated bearer, PDN connectivity, and more
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem build procedure](BUILD.md)
+
+[running the oai softmodem ](RUNMODEM.md)
+
diff --git a/doc/GET_SOURCES.md b/doc/GET_SOURCES.md
new file mode 100644
index 0000000000..e27e9dbb74
--- /dev/null
+++ b/doc/GET_SOURCES.md
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+ The OpenAirInterface repository: the sources
+
+
+
+
+The OpenAirInterface software can be obtained from our gitLab
+server. You will need a git client to get the sources. The repository
+is currently used for main developments.
+
+# Prerequisites
+
+You need to install the subversion/git using the following commands:
+
+```shell
+sudo apt-get update
+sudo apt-get install subversion git
+```
+
+# Using EURECOM Gitlab
+
+The [openairinterface5g repository](https://gitlab.eurecom.fr/oai/openairinterface5g.git)
+holds the source code for (eNB RAN + UE RAN).
+
+For legal issues (licenses), the core network (EPC) source code is now moved away from
+the above openairinterface5g git repository.
+
+* A very old version of the EPC is located under the same GitLab Eurecom server (splitted into 2 Git repos):
+ * [openair-cn](https://gitlab.eurecom.fr/oai/openair-cn.git) with apache license
+ * [xtables-addons-oai](https://gitlab.eurecom.fr/oai/xtables-addons-oai.git) with GPL license
+ * **These repositories are no more maintained.**
+* A more recent version is available under our GitHub domain:
+ * [OAI GitHub openair-cn](https://github.com/OPENAIRINTERFACE/openair-cn)
+ * Check its wiki pages for more details
+
+Configure git with your name/email address (only important if you are developer and want to contribute/push code to Git Repository):
+
+```shell
+git config --global user.name "Your Name"
+git config --global user.email "Your email address"
+```
+
+- Add a certificate from gitlab.eurecom.fr to your Ubuntu 14.04 installation:
+
+```shell
+echo -n | openssl s_client -showcerts -connect gitlab.eurecom.fr:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
+```
+
+- Disable certificate check completely if you do not have root access to /etc/ssl directory
+
+```shell
+git config --global http.sslverify false
+```
+
+## In order to clone the Git repository (for OAI Users without login to gitlab server)
+
+Cloning RAN repository (eNB RAN + UE RAN):
+
+```shell
+git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
+```
+
+## In order to contribute to the Git RAN repository (for OAI Developers/admins with login to gitlab server)
+
+Please send email to [contact@openairinterface.org](mailto:contact@openairinterface.org) to be added to the repository
+as a developer (only important for users who want to commit code to the repository). If
+you do not have account on gitlab.eurecom.fr, please register yourself to gitlab.eurecom.fr and provide the identifiant in the email.
+
+* Clone with using ssh keys:
+ * You will need to put your ssh keys in https://gitlab.eurecom.fr/profile/keys
+ to access to the git repo. Once that is done, clone the git repository using:
+ * `git clone git@gitlab.eurecom.fr:oai/openairinterface5g.git`
+* Clone with user name/password prompt:
+ * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openairinterface5g.git`
+ * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openair-cn.git`
+ * `git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/xtables-addons-oai.git` (optional, openair-cn build script can do it for you)
+
+# Which branch to checkout?
+
+On the RAN side:
+
+* **master**: This branch is targeted for the user community. Since January 2019, it is also subject to a Continuous Integration process. The update frequency is about once every 2-3 months. We are also performing bug fixes on this branch.
+* **develop**: This branch contains recent commits that are tested on our CI test bench. The update frequency is about once a week.
+
+Please see the work flow and policies page :
+
+https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/oai-policies-home
+
+you can find the latest stable tag release here :
+
+https://gitlab.eurecom.fr/oai/openairinterface5g/tags
+
+The tag naming conventions are :
+
+- On `master` branch: **v1.`x`.`y`** where
+ * `x` is the minor release number, incremented every 2-3 months when we are merging `develop` into `master` branch.
+ * `y` is the maintenance number, starting at 0 when we do a minor release and being incremented when a bug fix is incorporated into `master` branch.
+- On `develop` branch **`yyyy`.w`xx`**
+ * `yyyy` is the calendar year
+ * `xx` the week number within the year
+
diff --git a/doc/L1SIM.md b/doc/L1SIM.md
new file mode 100644
index 0000000000..d63c0e5a34
--- /dev/null
+++ b/doc/L1SIM.md
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+ Open Air LTE Emulation
+
+
+
+
+This page is valid for the develop branch
+
+# Table of Contents: #
+
+* [How to build the eNB and the UE](#build)
+* [How to run an eNB built with the noS1 option](#run-noS1-eNB)
+* [How to run a UE built with the noS1 option](#run-noS1-UE)
+* [Continuous Integration notes](#CInote)
+* [How to ping an eNB from a UE and vice versa (with the noS1 option)](#noS1-pinging)
+
+The old oaisim is dead! Long live oaisim! :)
+
+If you are looking for a description of the old oaisim (which is still available in some branches/tags), please see [here](OpenAirLTEEmulation) and [here](how-to-run-oaisim-with-multiple-ue).
+
+oaisim has been scraped and replaced by the same programs that are used for the real-time operation, `lte-softmodem` and `lte-uesoftmodem`. The latter also now includes an optional channel model, just like oaisim did.
+
+# [How to build the eNB and the UE](BUILD.md)
+
+The following paragraph explains how to run the L1 simulator in noS1 mode and using the oai kernel modules.
+
+# How to run an eNB with the noS1 option
+
+Modify the configuration file for IF4p5 fronthaul, `/openairinterface5g/ci-scripts/conf_files/rcc.band7.nos1.simulator.conf`, and replace the loopback interface with a physical ethernet interface and the IP addresses to work on your network. Copy your modifications to a new file, let's call YYY.conf the resulting configuration file.
+
+Run lte-softmodem as usual with this configuration.
+
+```bash
+$ source oaienv
+$ cd cmake_targets/tools
+$ sudo -E ./init_nas_nos1 eNB
+$ cd ../lte_build_oai/build
+$ sudo -E ./lte-softmodem -O YYY.conf --noS1 --nokrnmod 0
+```
+
+# How to run a UE with the noS1 option
+
+Similarly modify the example configuration file in `/openairinterface5g/ci-scripts/conf_files/rru.band7.nos1.simulator.conf` and replace loopback interface and IP addresses. Copy your modifications to a new file, let's call XXX.conf the resulting configuration file.
+
+Run it like:
+
+```bash
+$ source oaienv
+$ cd cmake_targets/tools
+$ sudo -E ./init_nas_nos1 UE
+$ cd ../lte_build_oai/build
+$ sudo ./lte-uesoftmodem -O XXX.conf -r 25 --siml1 --noS1 --nokrnmod 0
+```
+
+That should give you equivalent functionality to what you had with oaisim including noise and RF channel emulation (path loss / fading, etc.). You should also be able to run multiple UEs.
+
+# Continuous Integration notes
+The CI currently tests the noS1 build option with one eNB and one UE in the following scenarios:
+* pinging one UE from one eNB
+* pinging one eNB from one UE
+* iperf download between one eNB and one UE
+* iperf upload between one eNB and one UE
+* all the above tests are done in FDD 5Mhz mode.
+
+# How to ping an eNB from a UE and vice versa (with the noS1 option)
+
+Once your eNB and UE (built with the noS1 option) are running and synchronised, you can ping the eNB from the UE with the following command:
+
+```bash
+ping -I oai0 -c 20 $eNB_ip_addr
+```
+where $eNB_ip_addr is the IP address of your eNB.
+
+Similarly, you can ping the UE from the eNB.
+
+The IP adresses of the eNB and the UE are set up by the init_nas_nos1 program and should have the following values:
+* eNB_ip_addr set to 20 10.0.1.1
+* ue_ip_addr set to 20 10.0.1.2
+
+
+
+
+
+
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem features](FEATURE_SET.md)
+
+[oai softmodem build procedure](BUILD.md)
+
diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md
new file mode 100644
index 0000000000..4dcaaef3bc
--- /dev/null
+++ b/doc/L2NFAPI.md
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+ L2 nFAPI Simulator Usage
+
+
+
+
+This simulator allows to test L2 and above Layers using the nFAPI interface.
+
+**This simulator is available starting the `v1.0.0` release on the `master` branch.**
+
+Currently the only validated deployment by CI and developers is *with S1 interface and eNB / UEs are on the same machine*.
+
+Others deployments will be supported later after bug fixes and validation in the CI process.
+
+1. [With S1 -- eNB and UE on same machine](L2NFAPI_S1.md)
+
+
+
+
+
+
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem features](FEATURE_SET.md)
+
+[oai softmodem build procedure](BUILD.md)
+
diff --git a/doc/L2NFAPI_S1.md b/doc/L2NFAPI_S1.md
new file mode 100644
index 0000000000..c1c83211e1
--- /dev/null
+++ b/doc/L2NFAPI_S1.md
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+
+
+
+ L2 nFAPI Simulator (with S1 / same machine deployment)
+
+
+
+
+## Table of Contents ##
+
+1. [Environment](#1-environment)
+2. [Prepare the EPC](#2-prepare-the-epc)
+3. [Retrieve the OAI eNB-UE source code](#3-retrieve-the-oai-enb-ue-source-code)
+4. [Setup of the USIM information in UE folder](#4-setup-of-the-usim-information-in-ue-folder)
+5. [Setup of the Configuration files](#5-setup-of-the-configuration-files)
+ 1. [The eNB Configuration file](#51-the-enb-configuration-file)
+ 2. [The UE Configuration file](#52-the-ue-configuration-file)
+6. [Bring Up a second loopback interface](#6-bring-up-a-second-loopback-interface)
+7. [Build the eNB](#7-build-the-enb)
+8. [Build the UE](#8-build-the-ue)
+9. [Initialize the NAS UE Layer](#9-initialize-the-nas-ue-layer)
+10. [Start the eNB](#10-start-the-enb)
+11. [Start the UE](#11-start-the-ue)
+12. [Test with ping](#12-test-with-ping)
+13. [Limitations](#13-limitations)
+
+# 1. Environment #
+
+2 servers are used in this deployment. You can use Virtual Machines instead of each server; like it is done in the CI process.
+
+* Machine A contains the EPC.
+* Machine B contains the OAI eNB and the OAI UE(s)
+
+Example of L2 nFAPI Simulator testing environment:
+
+
+
+Note that the IP addresses are indicative and need to be adapted to your environment.
+
+# 2. Prepare the EPC #
+
+Create the environment for the EPC and register all **USIM** information into the **HSS** database.
+
+If you are using OAI-EPC ([see on GitHub](https://github.com/OPENAIRINTERFACE/openair-cn)), build **HSS/MME/SPGW** and create config files.
+
+# 3. Retrieve the OAI eNB-UE source code #
+
+The eNB and the UE executables will compiled into 2 separate folders on the same machine `B`.
+
+```bash
+$ ssh sudousername@machineB
+$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g/ enb_folder
+$ cd enb_folder
+$ git checkout -f v1.0.0
+$ cd ..
+$ cp -Rf enb_folder ue_folder
+```
+
+# 4. Setup of the USIM information in UE folder #
+
+```bash
+$ ssh sudousername@machineB
+$ cd ue_folder
+# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf with your preferred editor
+```
+
+Edit the USIM information within this file in order to match the HSS database. They **HAVE TO** match:
+
+* PLMN+MSIN and IMSI of users table of HSS database **SHALL** be the same.
+* OPC of this file and OPC of users table of HSS database **SHALL** be the same.
+* USIM_API_K of this file and the key of users table of HSS database **SHALL** be the same.
+
+When testing multiple UEs, it is necessary to add other UEs information like described below for 2 Users. Only UE0 (first UE) information is written in the original file.
+
+```
+UE0:
+{
+ USER: {
+ IMEI="356113022094149";
+ MANUFACTURER="EURECOM";
+ MODEL="LTE Android PC";
+ PIN="0000";
+ };
+
+ SIM: {
+ MSIN="0000000001"; // <-- Modify here
+ USIM_API_K="8baf473f2f8fd09487cccbd7097c6862";
+ OPC="e734f8734007d6c5ce7a0508809e7e9c";
+ MSISDN="33611123456";
+ };
+...
+};
+// Copy the UE0 and edit
+UE1: // <- Edit here
+{
+ USER: {
+ IMEI="356113022094149";
+ MANUFACTURER="EURECOM";
+ MODEL="LTE Android PC";
+ PIN="0000";
+ };
+
+ SIM: {
+ MSIN="0000000002"; // <-- Modify here
+ USIM_API_K="8baf473f2f8fd09487cccbd7097c6862";
+ OPC="e734f8734007d6c5ce7a0508809e7e9c";
+ MSISDN="33611123456";
+ };
+...
+};
+```
+
+You can repeat the operation for as many users you want to test with.
+
+# 5. Setup of the Configuration files #
+
+**CAUTION: both proposed configuration files resides in the ci-scripts realm. You can copy them but you CANNOT push any modification on these 2 files as part of an MR without informing the CI team.**
+
+## 5.1. The eNB Configuration file ##
+
+```bash
+$ ssh sudousername@machineB
+$ cd enb_folder
+# Edit ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf with your preferred editor
+```
+
+First verify the nFAPI interface setup on the 2nd loopback interface.
+
+```
+MACRLCs = (
+ {
+ num_cc = 1;
+ local_s_if_name = "lo:"; // <-- HERE
+ remote_s_address = "127.0.0.1"; // <-- HERE
+ local_s_address = "127.0.0.2"; // <-- HERE
+ local_s_portc = 50001;
+ remote_s_portc = 50000;
+ local_s_portd = 50011;
+ remote_s_portd = 50010;
+ tr_s_preference = "nfapi";
+ tr_n_preference = "local_RRC";
+ }
+);
+```
+
+If you are testing more than 16 UEs, a proper setting on the RUs is necessary. **Note that this part is NOT present in the original configuration file**.
+
+```
+RUs = (
+ {
+ local_rf = "yes"
+ nb_tx = 1
+ nb_rx = 1
+ att_tx = 20
+ att_rx = 0;
+ bands = [38];
+ max_pdschReferenceSignalPower = -23;
+ max_rxgain = 116;
+ eNB_instances = [0];
+ }
+);
+```
+
+Last, the S1 interface shall be properly set.
+
+```
+ ////////// MME parameters:
+ mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; // replace with 192.168.10.20
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES :
+ {
+ ENB_INTERFACE_NAME_FOR_S1_MME = "ens3"; // replace with the proper interface name
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10
+ ENB_INTERFACE_NAME_FOR_S1U = "ens3"; // replace with the proper interface name
+ ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+ ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; // replace with 192.168.10.10
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+
+ };
+```
+
+## 5.2. The UE Configuration file ##
+
+```bash
+$ ssh sudousername@machineB
+$ cd ue_folder
+# Edit ci-scripts/conf_files/ue.nfapi.conf with your preferred editor
+```
+
+Verify the nFAPI interface setup on the loopback interface.
+
+```
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "nfapi";
+ local_n_if_name = "lo"; // <- HERE
+ remote_n_address = "127.0.0.2"; // <- HERE
+ local_n_address = "127.0.0.1"; // <- HERE
+ local_n_portc = 50000;
+ remote_n_portc = 50001;
+ local_n_portd = 50010;
+ remote_n_portd = 50011;
+ }
+);
+```
+
+# 6. Bring Up a second loopback interface #
+
+A second loopback interface is used to connect the eNB and the UEs.
+
+```bash
+$ ssh sudousername@machineB
+$ sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
+```
+
+# 7. [Build OAI UE and eNodeB](BUILD.md) #
+
+
+
+# 8. Initialize the NAS UE Layer #
+
+Start the EPC on machine `A`.
+
+```bash
+$ ssh sudousername@machineA
+# Start the EPC
+```
+
+# 9. Start the eNB #
+
+In the first terminal (the one you used to build the eNB):
+
+```bash
+$ ssh sudousername@machineB
+$ cd enb_folder/cmake_targets
+$ sudo -E ./lte_build_oai/build/lte-softmodem -O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf > enb.log 2>&1
+```
+
+If you don't use redirection, you can test but many logs are printed on the console and this may affect performance of the L2-nFAPI simulator.
+
+We do recommend the redirection in steady mode once your setup is correct.
+
+# 10. Start the UE #
+
+In the second terminal (the one you used to build the UE):
+
+```bash
+$ ssh sudousername@machineB
+$ cd ue_folder/cmake_targets
+# Test 64 UEs, 64 threads in FDD mode
+$ sudo -E ./lte_build_oai/build/lte-uesoftmodem -O ../ci-scripts/conf_files/ue.nfapi.conf --L2-emul 3 --num-ues 64 --nums-ue-thread 64 > ue.log 2>&1
+# Test 64 UEs, 64 threads in TDD mode
+$ sudo -E ./lte_build_oai/build/lte-uesoftmodem -O ../ci-scripts/conf_files/ue.nfapi.conf --L2-emul 3 --num-ues 64 --nums-ue-thread 64 -T 1 > ue.log 2>&1
+# The "-T 1" option means TDD config
+```
+
+- The number of UEs can set by using `--num-ues` option and the maximum UE number is 255 (with the `--mu*` options, otherwise 16).
+- The umber of threads can set with the `--nums-ue-thread`. This number **SHALL NOT** be greater than the number of UEs.
+- How many UE that can be tested depends on hardware (server , PC, etc) performance in your environment.
+
+# 11. Test with ping #
+
+In a third terminal, after around 10 seconds, the UE(s) shall be connected to the eNB:
+
+```bash
+$ ssh sudousername@machineA
+# Ping UE0 IP address based on the EPC pool used: in this example:
+$ ping -c 20 192.168.200.2
+# Ping UE1 IP address based on the EPC pool used: in this example:
+$ ping -c 20 192.168.200.4
+```
+
+# 12. Limitations #
+
+Testing on the CI process is currently limited at time of writing. Improvements will be made soon.
+
+
+
+
+
+
+
+
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem features](FEATURE_SET.md)
+
+[oai softmodem build procedure](BUILD.md)
+
+[L2 nfapi simulator](L2NFAPI.md)
diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md
new file mode 100644
index 0000000000..314c2cc78b
--- /dev/null
+++ b/doc/RUNMODEM.md
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+ Running OAI Softmodem
+
+
+
+
+After you have [built the softmodem executables](BUILD.md) you can set your default directory to the build directory `cmake_targets/lte_build_oai/build/` and start testing some use cases. Below, the description of the different oai functionalities should help you choose the oai configuration that suits your need.
+
+# RF Simulator
+
+The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation.
+
+It is planned to enhance this simulator with the following functionalities:
+
+- Support for multiple UE connections,each UE being a `lte-uesoftmodem` instance.
+- Support for multiple eNodeB for hand-over tests
+- Support for channel modeling
+
+ This is an easy use-case to setup and test, as no specific hardware is required. The [rfsimulator page](../targets/ARCH/rfsimulator/README.md ) contains the detailed documentation.
+
+# L2 nFAPI Simulator
+
+This simulator connects a eNodeB and UEs through a nfapi interface, short-cutting the L1 layer. The objective of this simulator is to allow multi UEs simulation, with a large number of UEs (ideally up to 255 ) .Here to ease the platform setup, UEs are simulated via a single `lte-uesoftmodem` instance. Today the CI tests just with one UE and architecture has to be reviewed to allow a number of UE above about 16. This work is on-going.
+
+As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](L2NFAPI.md) contains the detailed documentation.
+
+# L1 Simulator
+
+The L1 simulator is using the ethernet fronthaul protocol, as used to connect a RRU and a RAU to connect UEs and a eNodeB. UEs are simulated in a single `lte-uesoftmodem` process, as for the nfapi simulator.
+
+The [L1 simulator page](L1SIM.md) contains the detailed documentation.
+
+## noS1 mode
+
+The noS1 mode is now available via the `--noS1`command line option. It can be used with simulators, described above, or when using oai with true RF boards. Only the oai UE can be connected to the oai eNodeB in noS1 mode.
+
+By default the noS1 mode is using linux tun interfaces to send or receive ip packets to/from the linux ip stack. using the `--nokrnmod 0`option you can enforce kernel modules instead of tun.
+
+noS1 code has been revisited, it has been tested with the rf simulator, and tun interfaces. More tests are on going and CI will soon include noS1 tests.
+
+# Running with a true radio head
+
+oai supports [number of deployment](FEATURE_SET.md) model, the following are tested in the CI:
+
+1. [Monolithic eNodeB](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/HowToConnectCOTSUEwithOAIeNBNew) where the whole signal processing is performed in a single process
+2. if4p5 mode, where frequency domain samples are carried over ethernet, from the RRU which implement part of L1(FFT,IFFT,part of PRACH), to a RAU
+
+
+
+
+
+
+
+[oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
+
+[oai softmodem features](FEATURE_SET.md)
+
+[oai softmodem build procedure](BUILD.md)
+
diff --git a/doc/images/L2-sim-single-server-deployment.png b/doc/images/L2-sim-single-server-deployment.png
new file mode 100644
index 0000000000..d59efb73f3
Binary files /dev/null and b/doc/images/L2-sim-single-server-deployment.png differ
diff --git a/doc/oai_enb_block_diagram.png b/doc/images/oai_enb_block_diagram.png
similarity index 100%
rename from doc/oai_enb_block_diagram.png
rename to doc/images/oai_enb_block_diagram.png
diff --git a/doc/images/oai_final_logo.png b/doc/images/oai_final_logo.png
new file mode 100644
index 0000000000..d2cc79f71f
Binary files /dev/null and b/doc/images/oai_final_logo.png differ
diff --git a/doc/oai_lte_enb_func_split_arch.png b/doc/images/oai_lte_enb_func_split_arch.png
similarity index 100%
rename from doc/oai_lte_enb_func_split_arch.png
rename to doc/images/oai_lte_enb_func_split_arch.png
diff --git a/nfapi/oai_integration/nfapi.c b/nfapi/oai_integration/nfapi.c
index 5a3bc804c1..4fc35fd951 100644
--- a/nfapi/oai_integration/nfapi.c
+++ b/nfapi/oai_integration/nfapi.c
@@ -21,31 +21,55 @@
#include
#include
+#include "nfapi/oai_integration/vendor_ext.h"
+#include "common/utils/LOG/log.h"
+static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET",""};
-void set_thread_priority(int priority)
-{
+typedef struct {
+ nfapi_mode_t nfapi_mode;
+} nfapi_params_t;
+
+static nfapi_params_t nfapi_params;
+
+void set_thread_priority(int priority) {
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
-
pthread_attr_t ptAttr;
-
struct sched_param schedParam;
schedParam.__sched_priority = priority; //79;
- if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
- {
+
+ if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
printf("Failed to set scheduler to SCHED_RR\n");
}
- if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
- {
+ if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
printf("Failed to set pthread sched policy SCHED_RR\n");
}
pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
-
struct sched_param thread_params;
thread_params.sched_priority = 20;
- if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
- {
+
+ if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0) {
printf("failed to set sched param\n");
}
}
+
+char *nfapi_get_strmode(void) {
+ if (nfapi_params.nfapi_mode > NFAPI_MODE_UNKNOWN)
+ return nfapi_str_mode[NFAPI_MODE_UNKNOWN];
+
+ return nfapi_str_mode[nfapi_params.nfapi_mode];
+}
+
+void nfapi_logmode() {
+ LOG_I(ENB_APP,"nfapi running mode: %s\n",nfapi_get_strmode());
+}
+
+nfapi_mode_t nfapi_getmode(void) {
+ return nfapi_params.nfapi_mode;
+}
+
+void nfapi_setmode(nfapi_mode_t nfapi_mode) {
+ nfapi_params.nfapi_mode = nfapi_mode;
+ nfapi_logmode();
+}
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
index 78c058ad00..a4b83e613b 100644
--- a/nfapi/oai_integration/nfapi_pnf.c
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -28,6 +28,7 @@
#include
#include "debug.h"
+#include "nfapi/oai_integration/vendor_ext.h"
#include "nfapi_pnf_interface.h"
#include "nfapi.h"
#include "nfapi_pnf.h"
@@ -57,7 +58,7 @@ extern RAN_CONTEXT_t RC;
#define _GNU_SOURCE
-extern void phy_init_RU(RU_t*);
+extern void phy_init_RU(RU_t *);
extern int config_sync_var;
extern pthread_cond_t nfapi_sync_cond;
@@ -76,9 +77,9 @@ extern void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,int frame, int subfra
extern void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,int frame, int subframe, L1_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu);
extern void handle_nfapi_bch_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, nfapi_dl_config_request_pdu_t *dl_config_pdu, uint8_t *sdu);
-extern uint8_t nfapi_mode;
-nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; // [frame][subframe][max_num_pdus]
+
+nfapi_tx_request_pdu_t *tx_request_pdu[1023][10][10]; // [frame][subframe][max_num_pdus]
uint8_t tx_pdus[32][8][4096];
@@ -90,11 +91,11 @@ nfapi_pnf_param_response_t g_pnf_param_resp;
nfapi_pnf_p7_config_t *p7_config_g = NULL;
-void* pnf_allocate(size_t size) {
+void *pnf_allocate(size_t size) {
return malloc(size);
}
-void pnf_deallocate(void* ptr) {
+void pnf_deallocate(void *ptr) {
free(ptr);
}
@@ -109,36 +110,36 @@ typedef struct {
} udp_data;
typedef struct {
- uint16_t index;
- uint16_t id;
- uint8_t rfs[2];
- uint8_t excluded_rfs[2];
+ uint16_t index;
+ uint16_t id;
+ uint8_t rfs[2];
+ uint8_t excluded_rfs[2];
- udp_data udp;
+ udp_data udp;
- char local_addr[80];
- int local_port;
+ char local_addr[80];
+ int local_port;
- char* remote_addr;
- int remote_port;
+ char *remote_addr;
+ int remote_port;
- uint8_t duplex_mode;
- uint16_t dl_channel_bw_support;
- uint16_t ul_channel_bw_support;
- uint8_t num_dl_layers_supported;
- uint8_t num_ul_layers_supported;
- uint16_t release_supported;
- uint8_t nmm_modes_supported;
+ uint8_t duplex_mode;
+ uint16_t dl_channel_bw_support;
+ uint16_t ul_channel_bw_support;
+ uint8_t num_dl_layers_supported;
+ uint8_t num_ul_layers_supported;
+ uint16_t release_supported;
+ uint8_t nmm_modes_supported;
- uint8_t dl_ues_per_subframe;
- uint8_t ul_ues_per_subframe;
+ uint8_t dl_ues_per_subframe;
+ uint8_t ul_ues_per_subframe;
- uint8_t first_subframe_ind;
+ uint8_t first_subframe_ind;
- // timing information recevied from the vnf
- uint8_t timing_window;
- uint8_t timing_info_mode;
- uint8_t timing_info_period;
+ // timing information recevied from the vnf
+ uint8_t timing_window;
+ uint8_t timing_info_mode;
+ uint8_t timing_info_period;
} phy_info;
@@ -158,36 +159,36 @@ typedef struct {
typedef struct {
- int release;
- phy_info phys[2];
- rf_info rfs[2];
+ int release;
+ phy_info phys[2];
+ rf_info rfs[2];
- uint8_t sync_mode;
- uint8_t location_mode;
- uint8_t location_coordinates[6];
- uint32_t dl_config_timing;
- uint32_t ul_config_timing;
- uint32_t tx_timing;
- uint32_t hi_dci0_timing;
+ uint8_t sync_mode;
+ uint8_t location_mode;
+ uint8_t location_coordinates[6];
+ uint32_t dl_config_timing;
+ uint32_t ul_config_timing;
+ uint32_t tx_timing;
+ uint32_t hi_dci0_timing;
- uint16_t max_phys;
- uint16_t max_total_bw;
- uint16_t max_total_dl_layers;
- uint16_t max_total_ul_layers;
- uint8_t shared_bands;
- uint8_t shared_pa;
- int16_t max_total_power;
- uint8_t oui;
+ uint16_t max_phys;
+ uint16_t max_total_bw;
+ uint16_t max_total_dl_layers;
+ uint16_t max_total_ul_layers;
+ uint8_t shared_bands;
+ uint8_t shared_pa;
+ int16_t max_total_power;
+ uint8_t oui;
- uint8_t wireshark_test_mode;
+ uint8_t wireshark_test_mode;
} pnf_info;
typedef struct {
uint16_t phy_id;
- nfapi_pnf_config_t* config;
- phy_info* phy;
- nfapi_pnf_p7_config_t* p7_config;
+ nfapi_pnf_config_t *config;
+ phy_info *phy;
+ nfapi_pnf_p7_config_t *p7_config;
} pnf_phy_user_data_t;
static pnf_info pnf;
@@ -195,32 +196,34 @@ static pthread_t pnf_start_pthread;
int nfapitooai_level(int nfapi_level) {
switch(nfapi_level) {
- case NFAPI_TRACE_ERROR:
- return LOG_ERR;
- case NFAPI_TRACE_WARN:
- return LOG_WARNING;
+ case NFAPI_TRACE_ERROR:
+ return LOG_ERR;
+
+ case NFAPI_TRACE_WARN:
+ return LOG_WARNING;
+
case NFAPI_TRACE_NOTE:
- return LOG_INFO;
- case NFAPI_TRACE_INFO:
- return LOG_DEBUG;
- }
+ return LOG_INFO;
+
+ case NFAPI_TRACE_INFO:
+ return LOG_DEBUG;
+ }
+
return LOG_ERR;
}
-void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
+void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
va_list args;
-
va_start(args, message);
- nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
+ VLOG( NFAPI_PNF, nfapitooai_level(nfapi_level), message, args);
va_end(args);
}
void pnf_set_thread_priority(int priority) {
-
pthread_attr_t ptAttr;
-
struct sched_param schedParam;
schedParam.__sched_priority = priority;
+
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
printf("failed to set SCHED_RR\n");
}
@@ -230,36 +233,29 @@ void pnf_set_thread_priority(int priority) {
}
pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
-
struct sched_param thread_params;
thread_params.sched_priority = 20;
+
if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0) {
printf("failed to set sched param\n");
}
}
-void* pnf_p7_thread_start(void* ptr) {
+void *pnf_p7_thread_start(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P7 THREAD %s\n", __FUNCTION__);
-
pnf_set_thread_priority(79);
-
- nfapi_pnf_p7_config_t* config = (nfapi_pnf_p7_config_t*)ptr;
+ nfapi_pnf_p7_config_t *config = (nfapi_pnf_p7_config_t *)ptr;
nfapi_pnf_p7_start(config);
-
return 0;
}
-int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req) {
-
+int pnf_param_request(nfapi_pnf_config_t *config, nfapi_pnf_param_request_t *req) {
printf("[PNF] pnf param request\n");
-
nfapi_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
-
+ pnf_info *pnf = (pnf_info *)(config->user_data);
resp.pnf_param_general.tl.tag = NFAPI_PNF_PARAM_GENERAL_TAG;
resp.pnf_param_general.nfapi_sync_mode = pnf->sync_mode;
resp.pnf_param_general.location_mode = pnf->location_mode;
@@ -274,25 +270,25 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_param_general.shared_bands = pnf->shared_bands;
resp.pnf_param_general.shared_pa = pnf->shared_pa;
resp.pnf_param_general.maximum_total_power = pnf->max_total_power;
-
resp.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
resp.pnf_phy.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
- resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index;
+ resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy.phy[i].downlink_channel_bandwidth_supported = pnf->phys[i].dl_channel_bw_support;
resp.pnf_phy.phy[i].uplink_channel_bandwidth_supported = pnf->phys[i].ul_channel_bw_support;
resp.pnf_phy.phy[i].number_of_dl_layers_supported = pnf->phys[i].num_dl_layers_supported;
resp.pnf_phy.phy[i].number_of_ul_layers_supported = pnf->phys[i].num_ul_layers_supported;
resp.pnf_phy.phy[i].maximum_3gpp_release_supported = pnf->phys[i].release_supported;
resp.pnf_phy.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
-
resp.pnf_phy.phy[i].number_of_rfs = 2;
+
for(int j = 0; j < 1; ++j) {
resp.pnf_phy.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
}
resp.pnf_phy.phy[i].number_of_rf_exclusions = 0;
+
for(int j = 0; j < 0; ++j) {
resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
@@ -302,9 +298,9 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_rf.number_of_rfs = 2;
for(int i = 0; i < 2; ++i) {
- resp.pnf_rf.rf[i].rf_config_index = pnf->rfs[i].index;
+ resp.pnf_rf.rf[i].rf_config_index = pnf->rfs[i].index;
resp.pnf_rf.rf[i].band = pnf->rfs[i].band;
- resp.pnf_rf.rf[i].maximum_transmit_power = pnf->rfs[i].max_transmit_power;
+ resp.pnf_rf.rf[i].maximum_transmit_power = pnf->rfs[i].max_transmit_power;
resp.pnf_rf.rf[i].minimum_transmit_power = pnf->rfs[i].min_transmit_power;
resp.pnf_rf.rf[i].number_of_antennas_suppported = pnf->rfs[i].num_antennas_supported;
resp.pnf_rf.rf[i].minimum_downlink_frequency = pnf->rfs[i].min_downlink_frequency;
@@ -317,9 +313,8 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_phy_rel10.tl.tag = NFAPI_PNF_PHY_REL10_TAG;
resp.pnf_phy_rel10.number_of_phys = 1;
- for(int i = 0; i < 1; ++i)
- {
- resp.pnf_phy_rel10.phy[i].phy_config_index = pnf->phys[i].index;
+ for(int i = 0; i < 1; ++i) {
+ resp.pnf_phy_rel10.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel10.phy[i].transmission_mode_7_supported = 0;
resp.pnf_phy_rel10.phy[i].transmission_mode_8_supported = 1;
resp.pnf_phy_rel10.phy[i].two_antenna_ports_for_pucch = 0;
@@ -334,7 +329,7 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_phy_rel11.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
- resp.pnf_phy_rel11.phy[i].phy_config_index = pnf->phys[i].index;
+ resp.pnf_phy_rel11.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel11.phy[i].edpcch_supported = 0;
resp.pnf_phy_rel11.phy[i].multi_ack_csi_reporting = 1;
resp.pnf_phy_rel11.phy[i].pucch_tx_diversity = 0;
@@ -348,7 +343,7 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_phy_rel12.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
- resp.pnf_phy_rel12.phy[i].phy_config_index = pnf->phys[i].index;
+ resp.pnf_phy_rel12.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel12.phy[i].csi_subframe_set = 0;
resp.pnf_phy_rel12.phy[i].enhanced_4tx_codebook = 2;
resp.pnf_phy_rel12.phy[i].drs_supported = 0;
@@ -363,7 +358,7 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_phy_rel13.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
- resp.pnf_phy_rel13.phy[i].phy_config_index = pnf->phys[i].index;
+ resp.pnf_phy_rel13.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel13.phy[i].pucch_format4_supported = 0;
resp.pnf_phy_rel13.phy[i].pucch_format5_supported = 1;
resp.pnf_phy_rel13.phy[i].more_than_5_ca_support = 0;
@@ -380,14 +375,15 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
resp.pnf_phy_rel13_nb_iot.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
- resp.pnf_phy_rel13_nb_iot.phy[i].phy_config_index = pnf->phys[i].index;
-
+ resp.pnf_phy_rel13_nb_iot.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rfs = 1;
+
for(int j = 0; j < 1; ++j) {
resp.pnf_phy_rel13_nb_iot.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
}
resp.pnf_phy_rel13_nb_iot.phy[i].number_of_rf_exclusions = 1;
+
for(int j = 0; j < 1; ++j) {
resp.pnf_phy_rel13_nb_iot.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
@@ -400,51 +396,39 @@ int pnf_param_request(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req
}
nfapi_pnf_pnf_param_resp(config, &resp);
-
return 0;
}
-int pnf_config_request(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req) {
-
+int pnf_config_request(nfapi_pnf_config_t *config, nfapi_pnf_config_request_t *req) {
printf("[PNF] pnf config request\n");
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
-
+ pnf_info *pnf = (pnf_info *)(config->user_data);
phy_info *phy = pnf->phys;
phy->id = req->pnf_phy_rf_config.phy_rf_config[0].phy_id;
printf("[PNF] pnf config request assigned phy_id %d to phy_config_index %d\n", phy->id, req->pnf_phy_rf_config.phy_rf_config[0].phy_config_index);
-
nfapi_pnf_config_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_pnf_config_resp(config, &resp);
printf("[PNF] Sent pnf_config_resp\n");
-
return 0;
}
-void nfapi_send_pnf_start_resp(nfapi_pnf_config_t* config, uint16_t phy_id) {
-
+void nfapi_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) {
printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id);
-
nfapi_start_response_t start_resp;
memset(&start_resp, 0, sizeof(start_resp));
start_resp.header.message_id = NFAPI_START_RESPONSE;
start_resp.header.phy_id = phy_id;
start_resp.error_code = NFAPI_MSG_OK;
-
nfapi_pnf_start_resp(config, &start_resp);
}
-int pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req) {
-
+int pnf_start_request(nfapi_pnf_config_t *config, nfapi_pnf_start_request_t *req) {
printf("Received NFAPI_PNF_START_REQUEST\n");
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
-
+ pnf_info *pnf = (pnf_info *)(config->user_data);
// start all phys that have been configured
- phy_info* phy = pnf->phys;
+ phy_info *phy = pnf->phys;
if(phy->id != 0) {
nfapi_pnf_start_response_t resp;
@@ -454,79 +438,62 @@ int pnf_start_request(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req
nfapi_pnf_pnf_start_resp(config, &resp);
printf("[PNF] Sent NFAPI_PNF_START_RESP\n");
}
+
return 0;
}
-int pnf_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_stop_request_t* req) {
-
+int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req) {
printf("[PNF] Received NFAPI_PNF_STOP_REQ\n");
-
nfapi_pnf_stop_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_STOP_RESPONSE;
resp.error_code = NFAPI_MSG_OK;
nfapi_pnf_pnf_stop_resp(config, &resp);
printf("[PNF] Sent NFAPI_PNF_STOP_REQ\n");
-
return 0;
}
-int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req) {
-
+int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_param_request_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
-
//pnf_info* pnf = (pnf_info*)(config->user_data);
-
nfapi_param_response_t nfapi_resp;
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
-
+ pnf_info *pnf = (pnf_info *)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id;
nfapi_resp.error_code = 0; // DJP - what value???
-
struct sockaddr_in pnf_p7_sockaddr;
-
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4);
nfapi_resp.num_tlv++;
-
// P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.num_tlv++;
-
nfapi_pnf_param_resp(config, &nfapi_resp);
-
printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
-
printf("[PNF] param request .. exit\n");
-
return 0;
}
-int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req) {
-
+int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_config_request_t *req) {
printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id);
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
+ pnf_info *pnf = (pnf_info *)(config->user_data);
uint8_t num_tlv = 0;
//struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
// In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
LTE_DL_FRAME_PARMS *fp;
- if (nfapi_mode!=3) {
- struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
- fp = &eNB->frame_parms;
- }
- else{
- fp = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
+
+ if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
+ struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
+ fp = &eNB->frame_parms;
+ } else {
+ fp = (LTE_DL_FRAME_PARMS *) malloc(sizeof(LTE_DL_FRAME_PARMS));
}
- phy_info* phy_info = pnf->phys;
+ phy_info *phy_info = pnf->phys;
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) {
phy_info->timing_window = req->nfapi_config.timing_window.value;
@@ -576,9 +543,8 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
fp->dl_CarrierFreq = from_earfcn(fp->eutra_band, req->nfapi_config.earfcn.value);
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(fp->eutra_band) * 1e5);
num_tlv++;
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() earfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n",
- __FUNCTION__, req->nfapi_config.earfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() earfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n",
+ __FUNCTION__, req->nfapi_config.earfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
}
if (req->subframe_config.duplex_mode.tl.tag == NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG) {
@@ -682,29 +648,23 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
num_tlv++;
}
- if(nfapi_mode!=3) {
- printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
-
- printf("[PNF] Simulating PHY CONFIG - DJP\n");
- PHY_Config_t phy_config;
- phy_config.Mod_id = 0;
- phy_config.CC_id=0;
- phy_config.cfg = req;
-
- phy_config_request(&phy_config);
-
- dump_frame_parms(fp);
+ if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
+ printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
+ printf("[PNF] Simulating PHY CONFIG - DJP\n");
+ PHY_Config_t phy_config;
+ phy_config.Mod_id = 0;
+ phy_config.CC_id=0;
+ phy_config.cfg = req;
+ phy_config_request(&phy_config);
+ dump_frame_parms(fp);
}
phy_info->remote_port = req->nfapi_config.p7_vnf_port.value;
-
struct sockaddr_in vnf_p7_sockaddr;
memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
phy_info->remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
-
- printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port,
- phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
-
+ printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port,
+ phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
nfapi_config_response_t nfapi_resp;
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
@@ -712,71 +672,54 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap
nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
- if(nfapi_mode ==3)
- free(fp);
+
+ if(NFAPI_MODE==NFAPI_UE_STUB_PNF)
+ free(fp);
return 0;
}
-nfapi_p7_message_header_t* pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
-
+nfapi_p7_message_header_t *pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
if(message_id == P7_VENDOR_EXT_REQ) {
(*msg_size) = sizeof(vendor_ext_p7_req);
- return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_req));
+ return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_req));
}
return 0;
}
-void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header) {
-
+void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header) {
free(header);
}
-int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req) {
-
+int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_hi_dci0_request_t *req) {
if (req->hi_dci0_request_body.number_of_dci == 0 && req->hi_dci0_request_body.number_of_hi == 0)
LOG_D(PHY,"[PNF] HI_DCI0_REQUEST SFN/SF:%05d dci:%d hi:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), req->hi_dci0_request_body.number_of_dci, req->hi_dci0_request_body.number_of_hi);
//phy_info* phy = (phy_info*)(pnf_p7->user_data);
-
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
L1_rxtx_proc_t *proc = &eNB->proc.L1_proc;
for (int i=0; ihi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi; i++) {
-
//LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d]\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
-
if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) {
-
//LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_DCI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
-
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
-
handle_nfapi_hi_dci0_dci_pdu(eNB,NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf),proc,hi_dci0_req_pdu);
-
eNB->pdcch_vars[NFAPI_SFNSF2SF(req->sfn_sf)&1].num_dci++;
-
} else if (req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE) {
-
LOG_D(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
-
nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu = &req->hi_dci0_request_body.hi_dci0_pdu_list[i];
-
handle_nfapi_hi_dci0_hi_pdu(eNB, NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf), proc, hi_dci0_req_pdu);
-
} else {
-
LOG_E(PHY,"[PNF] HI_DCI0_REQ sfn_sf:%d PDU[%d] - unknown pdu type:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
-
}
}
return 0;
}
-int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req) {
-
+int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) {
if (RC.ru == 0) {
return -1;
}
@@ -789,65 +732,51 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
return -3;
}
- if (sync_var != 0) {
+ if (sync_var != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
return -4;
}
int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
int sf = NFAPI_SFNSF2SF(req->sfn_sf);
-
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
L1_rxtx_proc_t *proc = &eNB->proc.L1_proc;
- nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
+ nfapi_dl_config_request_pdu_t *dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list;
LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[sf&1];
-
pdcch_vars->num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols;
pdcch_vars->num_dci = 0;
- if (req->dl_config_request_body.number_dci ||
+ if (req->dl_config_request_body.number_dci ||
req->dl_config_request_body.number_pdu ||
req->dl_config_request_body.number_pdsch_rnti)
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d pdcch:%u dl_cfg[dci:%u pdus:%d pdsch_rnti:%d] pcfich:%u\n",
- __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx,
- NFAPI_SFNSF2DEC(req->sfn_sf),
- req->dl_config_request_body.number_pdcch_ofdm_symbols,
- req->dl_config_request_body.number_dci,
- req->dl_config_request_body.number_pdu,
- req->dl_config_request_body.number_pdsch_rnti,
- req->dl_config_request_body.transmission_power_pcfich);
-
- for (int i=0;idl_config_request_body.number_pdu;i++) {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d pdcch:%u dl_cfg[dci:%u pdus:%d pdsch_rnti:%d] pcfich:%u\n",
+ __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx,
+ NFAPI_SFNSF2DEC(req->sfn_sf),
+ req->dl_config_request_body.number_pdcch_ofdm_symbols,
+ req->dl_config_request_body.number_dci,
+ req->dl_config_request_body.number_pdu,
+ req->dl_config_request_body.number_pdsch_rnti,
+ req->dl_config_request_body.transmission_power_pcfich);
+ for (int i=0; idl_config_request_body.number_pdu; i++) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
-
handle_nfapi_dci_dl_pdu(eNB,NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf),proc,&dl_config_pdu_list[i]);
-
pdcch_vars->num_dci++; // Is actually number of DCI PDUs
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
-
} else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
-
nfapi_dl_config_bch_pdu *bch_pdu = &dl_config_pdu_list[i].bch_pdu;
uint16_t pdu_index = bch_pdu->bch_pdu_rel8.pdu_index;
if (tx_request_pdu[sfn][sf][pdu_index] != NULL) {
-
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
-
handle_nfapi_bch_pdu(eNB, proc, &dl_config_pdu_list[i], tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_data);
-
eNB->pbch_configured=1;
-
} else {
-
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() BCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pdu_index);
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() BCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pdu_index);
}
} else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
-
nfapi_dl_config_dlsch_pdu *dlsch_pdu = &dl_config_pdu_list[i].dlsch_pdu;
nfapi_dl_config_dlsch_pdu_rel8_t *rel8_pdu = &dlsch_pdu->dlsch_pdu_rel8;
nfapi_tx_request_pdu_t *tx_pdu = tx_request_pdu[sfn][sf][rel8_pdu->pdu_index];
@@ -859,23 +788,19 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0];
//LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1];
int harq_pid = dlsch0->harq_ids[sfn%2][sf];
+
if(harq_pid >= dlsch0->Mdlharq) {
LOG_E(PHY,"pnf_phy_dl_config_req illegal harq_pid %d\n", harq_pid);
return(-1);
}
+
uint8_t *dlsch_sdu = tx_pdus[UE_id][harq_pid];
-
memcpy(dlsch_sdu, tx_pdu->segments[0].segment_data, tx_pdu->segments[0].segment_length);
-
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
-
handle_nfapi_dlsch_pdu( eNB, sfn,sf, &eNB->proc.L1_proc, &dl_config_pdu_list[i], rel8_pdu->transport_blocks-1, dlsch_sdu);
-
} else {
-
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() DLSCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), rel8_pdu->pdu_index);
}
-
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type);
}
@@ -887,8 +812,7 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
return 0;
}
-int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) {
-
+int pnf_phy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
uint16_t sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(req->sfn_sf);
@@ -898,15 +822,14 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) {
if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG) {
for (int i=0; itx_request_body.number_of_pdus; i++) {
LOG_D(PHY,"%s() SFN/SF:%d%d number_of_pdus:%d [PDU:%d] pdu_length:%d pdu_index:%d num_segments:%d\n",
- __FUNCTION__,
- sfn, sf,
- req->tx_request_body.number_of_pdus,
- i,
- req->tx_request_body.tx_pdu_list[i].pdu_length,
- req->tx_request_body.tx_pdu_list[i].pdu_index,
- req->tx_request_body.tx_pdu_list[i].num_segments
- );
-
+ __FUNCTION__,
+ sfn, sf,
+ req->tx_request_body.number_of_pdus,
+ i,
+ req->tx_request_body.tx_pdu_list[i].pdu_length,
+ req->tx_request_body.tx_pdu_list[i].pdu_index,
+ req->tx_request_body.tx_pdu_list[i].num_segments
+ );
tx_request_pdu[sfn][sf][i] = &req->tx_request_body.tx_pdu_list[i];
}
}
@@ -914,15 +837,14 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) {
return 0;
}
-int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) {
-
- if (0)LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n",
- __FUNCTION__,
- NFAPI_SFNSF2DEC(req->sfn_sf),
- req->ul_config_request_body.number_of_pdus,
- req->ul_config_request_body.rach_prach_frequency_resources,
- req->ul_config_request_body.srs_present
- );
+int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_ul_config_request_t *req) {
+ if (0)LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n",
+ __FUNCTION__,
+ NFAPI_SFNSF2DEC(req->sfn_sf),
+ req->ul_config_request_body.number_of_pdus,
+ req->ul_config_request_body.rach_prach_frequency_resources,
+ req->ul_config_request_body.srs_present
+ );
if (RC.ru == 0) {
return -1;
@@ -936,32 +858,29 @@ int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
return -3;
}
- if (sync_var != 0) {
+ if (sync_var != 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Main system not up - is this a dummy subframe?\n", __FUNCTION__);
return -4;
}
uint16_t curr_sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
uint16_t curr_sf = NFAPI_SFNSF2SF(req->sfn_sf);
-
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
L1_rxtx_proc_t *proc = &eNB->proc.L1_proc;
- nfapi_ul_config_request_pdu_t* ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list;
+ nfapi_ul_config_request_pdu_t *ul_config_pdu_list = req->ul_config_request_body.ul_config_pdu_list;
- for (int i=0;iul_config_request_body.number_of_pdus;i++) {
+ for (int i=0; iul_config_request_body.number_of_pdus; i++) {
//LOG_D(PHY, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, ul_config_pdu_list[i].pdu_size);
-
if (
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
- ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
- ) {
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE ||
+ ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE
+ ) {
//LOG_D(PHY, "%s() handle_nfapi_ul_pdu() for PDU:%d\n", __FUNCTION__, i);
-
handle_nfapi_ul_pdu(eNB,proc,&ul_config_pdu_list[i],curr_sfn,curr_sf,req->ul_config_request_body.srs_present);
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() PDU:%i UNKNOWN type :%d\n", __FUNCTION__, i, ul_config_pdu_list[i].pdu_type);
@@ -971,54 +890,59 @@ int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
return 0;
}
-int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req) {
+int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t *config, nfapi_lbt_dl_config_request_t *req) {
//printf("[PNF] lbt dl config request\n");
return 0;
}
-int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg) {
+int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t *config, nfapi_p7_message_header_t *msg) {
if(msg->message_id == P7_VENDOR_EXT_REQ) {
//vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
//printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
} else {
printf("[PNF] unknown vendor ext\n");
}
+
return 0;
}
-int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codex) {
+int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codex) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_IND) {
- vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)(header);
+ vendor_ext_p7_ind *ind = (vendor_ext_p7_ind *)(header);
+
if(!push16(ind->error_code, ppWritePackedMsg, end))
return 0;
return 1;
}
+
return -1;
}
-int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* codec) {
+int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *codec) {
if(header->message_id == P7_VENDOR_EXT_REQ) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+ vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
+
if(!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
- pull16(ppReadPackedMessage, &req->dummy2, end)))
+ pull16(ppReadPackedMessage, &req->dummy2, end)))
return 0;
+
return 1;
}
+
return -1;
}
-int pnf_phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t* end, void** ve, nfapi_p7_codec_config_t* config) {
+int pnf_phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p7_codec_config_t *config) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_phy_unpack_vendor_extension_tlv\n");
-
- switch(tl->tag)
- {
+ switch(tl->tag) {
case VENDOR_EXT_TLV_1_TAG:
*ve = malloc(sizeof(vendor_ext_tlv_1));
- if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1*)(*ve))->dummy, end))
- return 0;
+
+ if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1 *)(*ve))->dummy, end))
+ return 0;
return 1;
break;
@@ -1027,22 +951,21 @@ int pnf_phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMe
return -1;
}
-int pnf_phy_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p7_codec_config_t* config) {
+int pnf_phy_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
//printf("%s\n", __FUNCTION__);
(void)ve;
(void)ppWritePackedMsg;
return -1;
}
-int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* config) {
+int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *config) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
-
- switch(tl->tag)
- {
+ switch(tl->tag) {
case VENDOR_EXT_TLV_2_TAG:
*ve = malloc(sizeof(vendor_ext_tlv_2));
- if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2*)(*ve))->dummy, end))
- return 0;
+
+ if(!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2 *)(*ve))->dummy, end))
+ return 0;
return 1;
break;
@@ -1051,7 +974,7 @@ int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMe
return -1;
}
-int pnf_sim_pack_vendor_extention_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config) {
+int pnf_sim_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
//printf("%s\n", __FUNCTION__);
(void)ve;
(void)ppWritePackedMsg;
@@ -1063,41 +986,29 @@ nfapi_tx_request_t dummy_tx_req;
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
-int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req) {
-
+int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_start_request_t *req) {
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
-
nfapi_set_trace_level(NFAPI_TRACE_INFO);
-
- pnf_info* pnf = (pnf_info*)(config->user_data);
-
- phy_info* phy_info = pnf->phys;
-
- nfapi_pnf_p7_config_t* p7_config = nfapi_pnf_p7_config_create();
-
+ pnf_info *pnf = (pnf_info *)(config->user_data);
+ phy_info *phy_info = pnf->phys;
+ nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
p7_config->phy_id = phy->phy_id;
-
p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr;
p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
//DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
p7_config->local_p7_addr = phy_info->local_addr;
-
printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
-
p7_config->user_data = phy_info;
-
p7_config->malloc = &pnf_allocate;
p7_config->free = &pnf_deallocate;
p7_config->codec_config.allocate = &pnf_allocate;
p7_config->codec_config.deallocate = &pnf_deallocate;
-
p7_config->trace = &pnf_nfapi_trace;
-
phy->user_data = p7_config;
-
p7_config->subframe_buffer_size = phy_info->timing_window;
printf("subframe_buffer_size configured using phy_info->timing_window:%d\n", phy_info->timing_window);
+
if(phy_info->timing_info_mode & 0x1) {
p7_config->timing_info_mode_periodic = 1;
p7_config->timing_info_period = phy_info->timing_info_period;
@@ -1113,107 +1024,89 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
p7_config->tx_req = &pnf_phy_tx_req;
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
- if (nfapi_mode==3) {
- p7_config->dl_config_req = &memcpy_dl_config_req;
- p7_config->ul_config_req = &memcpy_ul_config_req;
- p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
- p7_config->tx_req = &memcpy_tx_req;
- }
- else {
- p7_config->dl_config_req = &pnf_phy_dl_config_req;
- p7_config->ul_config_req = &pnf_phy_ul_config_req;
- p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
- p7_config->tx_req = &pnf_phy_tx_req;
- }
- p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
+ if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
+ p7_config->dl_config_req = &memcpy_dl_config_req;
+ p7_config->ul_config_req = &memcpy_ul_config_req;
+ p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
+ p7_config->tx_req = &memcpy_tx_req;
+ } else {
+ p7_config->dl_config_req = &pnf_phy_dl_config_req;
+ p7_config->ul_config_req = &pnf_phy_ul_config_req;
+ p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
+ p7_config->tx_req = &pnf_phy_tx_req;
+ }
- memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
- dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
- dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
- dummy_dl_config_req.dl_config_request_body.number_dci=0;
- dummy_dl_config_req.dl_config_request_body.number_pdu=0;
- dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
- dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
- dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
+ p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
+ memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
+ dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+ dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
+ dummy_dl_config_req.dl_config_request_body.number_dci=0;
+ dummy_dl_config_req.dl_config_request_body.number_pdu=0;
+ dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
+ dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
+ dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
+ memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
+ dummy_tx_req.tx_request_body.number_of_pdus=0;
+ dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
+ dummy_subframe.dl_config_req = &dummy_dl_config_req;
+ dummy_subframe.tx_req = 0;//&dummy_tx_req;
+ dummy_subframe.ul_config_req=0;
+ dummy_subframe.hi_dci0_req=0;
+ dummy_subframe.lbt_dl_config_req=0;
+ p7_config->dummy_subframe = dummy_subframe;
+ p7_config->vendor_ext = &pnf_phy_vendor_ext;
+ p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
+ p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
+ p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
+ p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
+ p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
+ p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
+ pthread_t p7_thread;
+ pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
+ //((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
+ l1_north_init_eNB();
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
+ p7_config_g = p7_config;
- memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
- dummy_tx_req.tx_request_body.number_of_pdus=0;
- dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
+ // Need to wait for main thread to create RU structures
+ while(config_sync_var<0) {
+ usleep(5000000);
+ printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
+ }
- dummy_subframe.dl_config_req = &dummy_dl_config_req;
- dummy_subframe.tx_req = 0;//&dummy_tx_req;
+ printf("[PNF] OAI eNB/RU configured\n");
+ //printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
+ //phy_init_RU(RC.ru[0]);
+ printf("[PNF] About to call init_eNB_afterRU()\n");
- dummy_subframe.ul_config_req=0;
- dummy_subframe.hi_dci0_req=0;
- dummy_subframe.lbt_dl_config_req=0;
+ if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
+ init_eNB_afterRU();
+ }
- p7_config->dummy_subframe = dummy_subframe;
+ // Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
+ {
+ pthread_mutex_lock(&nfapi_sync_mutex);
+ nfapi_sync_var=0;
+ pthread_cond_broadcast(&nfapi_sync_cond);
+ pthread_mutex_unlock(&nfapi_sync_mutex);
+ }
- p7_config->vendor_ext = &pnf_phy_vendor_ext;
-
- p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
- p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
-
- p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
- p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
- p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
- p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
- pthread_t p7_thread;
- pthread_create(&p7_thread, NULL, &pnf_p7_thread_start, p7_config);
-
- //((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
- l1_north_init_eNB();
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
- p7_config_g = p7_config;
-
- // Need to wait for main thread to create RU structures
- while(config_sync_var<0)
- {
- usleep(5000000);
- printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
- }
- printf("[PNF] OAI eNB/RU configured\n");
-
- //printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
- //phy_init_RU(RC.ru[0]);
-
- printf("[PNF] About to call init_eNB_afterRU()\n");
-
- if (nfapi_mode != 3) {
- init_eNB_afterRU();
- }
-
- // Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
- {
- pthread_mutex_lock(&nfapi_sync_mutex);
- nfapi_sync_var=0;
- pthread_cond_broadcast(&nfapi_sync_cond);
- pthread_mutex_unlock(&nfapi_sync_mutex);
- }
-
- while(sync_var<0)
- {
- usleep(5000000);
- printf("[PNF] waiting for OAI to be started\n");
- }
-
- printf("[PNF] Sending PNF_START_RESP\n");
- nfapi_send_pnf_start_resp(config, p7_config->phy_id);
-
- printf("[PNF] Sending first P7 subframe ind\n");
- nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
- printf("[PNF] Sent first P7 subframe ind\n");
+ while(sync_var<0) {
+ usleep(5000000);
+ printf("[PNF] waiting for OAI to be started\n");
+ }
+ printf("[PNF] Sending PNF_START_RESP\n");
+ nfapi_send_pnf_start_resp(config, p7_config->phy_id);
+ printf("[PNF] Sending first P7 subframe ind\n");
+ nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
+ printf("[PNF] Sent first P7 subframe ind\n");
return 0;
}
-int measurement_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_measurement_request_t* req) {
-
+int measurement_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_measurement_request_t *req) {
nfapi_measurement_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_MEASUREMENT_RESPONSE;
@@ -1223,15 +1116,13 @@ int measurement_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy,
return 0;
}
-int rssi_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_rssi_request_t* req) {
-
+int rssi_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_rssi_request_t *req) {
nfapi_rssi_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_RSSI_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_rssi_resp(config, &resp);
-
nfapi_rssi_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_RSSI_INDICATION;
@@ -1241,19 +1132,16 @@ int rssi_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_
ind.rssi_indication_body.number_of_rssi = 1;
ind.rssi_indication_body.rssi[0] = -42;
nfapi_pnf_rssi_ind(config, &ind);
-
return 0;
}
-int cell_search_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_cell_search_request_t* req) {
-
+int cell_search_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_cell_search_request_t *req) {
nfapi_cell_search_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_CELL_SEARCH_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_cell_search_resp(config, &resp);
-
nfapi_cell_search_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_CELL_SEARCH_INDICATION;
@@ -1269,160 +1157,135 @@ int cell_search_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy,
ind.lte_cell_search_indication.lte_found_cells[0].rsrq = 123;
ind.lte_cell_search_indication.lte_found_cells[0].frequency_offset = 123;
break;
- case NFAPI_RAT_TYPE_UTRAN:
- {
- ind.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
- ind.utran_cell_search_indication.number_of_utran_cells_found = 1;
- ind.utran_cell_search_indication.utran_found_cells[0].psc = 89;
- ind.utran_cell_search_indication.utran_found_cells[0].rscp = 89;
- ind.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
- ind.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -89;
- }
- break;
- case NFAPI_RAT_TYPE_GERAN:
- {
- ind.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
- ind.geran_cell_search_indication.number_of_gsm_cells_found = 1;
- ind.geran_cell_search_indication.gsm_found_cells[0].bsic = 23;
- ind.geran_cell_search_indication.gsm_found_cells[0].rxlev = 23;
- ind.geran_cell_search_indication.gsm_found_cells[0].rxqual = 23;
- ind.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = -23;
- ind.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 230;
+ case NFAPI_RAT_TYPE_UTRAN: {
+ ind.utran_cell_search_indication.tl.tag = NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG;
+ ind.utran_cell_search_indication.number_of_utran_cells_found = 1;
+ ind.utran_cell_search_indication.utran_found_cells[0].psc = 89;
+ ind.utran_cell_search_indication.utran_found_cells[0].rscp = 89;
+ ind.utran_cell_search_indication.utran_found_cells[0].ecno = 89;
+ ind.utran_cell_search_indication.utran_found_cells[0].frequency_offset = -89;
+ }
+ break;
- }
- break;
+ case NFAPI_RAT_TYPE_GERAN: {
+ ind.geran_cell_search_indication.tl.tag = NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG;
+ ind.geran_cell_search_indication.number_of_gsm_cells_found = 1;
+ ind.geran_cell_search_indication.gsm_found_cells[0].bsic = 23;
+ ind.geran_cell_search_indication.gsm_found_cells[0].rxlev = 23;
+ ind.geran_cell_search_indication.gsm_found_cells[0].rxqual = 23;
+ ind.geran_cell_search_indication.gsm_found_cells[0].frequency_offset = -23;
+ ind.geran_cell_search_indication.gsm_found_cells[0].sfn_offset = 230;
+ }
+ break;
}
ind.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
ind.pnf_cell_search_state.length = 3;
-
- nfapi_pnf_cell_search_ind(config, &ind);
-
+ nfapi_pnf_cell_search_ind(config, &ind);
return 0;
}
-int broadcast_detect_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_broadcast_detect_request_t* req)
-{
+int broadcast_detect_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_broadcast_detect_request_t *req) {
nfapi_broadcast_detect_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_BROADCAST_DETECT_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_broadcast_detect_resp(config, &resp);
-
nfapi_broadcast_detect_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_BROADCAST_DETECT_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
- switch(req->rat_type)
- {
- case NFAPI_RAT_TYPE_LTE:
- {
- ind.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
- ind.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
- ind.lte_broadcast_detect_indication.mib_length = 4;
- //ind.lte_broadcast_detect_indication.mib...
- ind.lte_broadcast_detect_indication.sfn_offset = 77;
+ switch(req->rat_type) {
+ case NFAPI_RAT_TYPE_LTE: {
+ ind.lte_broadcast_detect_indication.tl.tag = NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG;
+ ind.lte_broadcast_detect_indication.number_of_tx_antenna = 1;
+ ind.lte_broadcast_detect_indication.mib_length = 4;
+ //ind.lte_broadcast_detect_indication.mib...
+ ind.lte_broadcast_detect_indication.sfn_offset = 77;
+ }
+ break;
- }
- break;
- case NFAPI_RAT_TYPE_UTRAN:
- {
- ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
- ind.utran_broadcast_detect_indication.mib_length = 4;
- //ind.utran_broadcast_detect_indication.mib...
- // ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
-
- }
- break;
+ case NFAPI_RAT_TYPE_UTRAN: {
+ ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
+ ind.utran_broadcast_detect_indication.mib_length = 4;
+ //ind.utran_broadcast_detect_indication.mib...
+ // ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
+ }
+ break;
}
ind.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
ind.pnf_cell_broadcast_state.length = 3;
-
- nfapi_pnf_broadcast_detect_ind(config, &ind);
-
+ nfapi_pnf_broadcast_detect_ind(config, &ind);
return 0;
}
-int system_information_schedule_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_schedule_request_t* req)
-{
+int system_information_schedule_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_system_information_schedule_request_t *req) {
nfapi_system_information_schedule_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_system_information_schedule_resp(config, &resp);
-
nfapi_system_information_schedule_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
-
ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
ind.lte_system_information_indication.sib_type = 3;
ind.lte_system_information_indication.sib_length = 5;
//ind.lte_system_information_indication.sib...
-
- nfapi_pnf_system_information_schedule_ind(config, &ind);
-
+ nfapi_pnf_system_information_schedule_ind(config, &ind);
return 0;
}
-int system_information_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_system_information_request_t* req)
-{
+int system_information_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_system_information_request_t *req) {
nfapi_system_information_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_SYSTEM_INFORMATION_RESPONSE;
resp.header.phy_id = req->header.phy_id;
resp.error_code = NFAPI_P4_MSG_OK;
nfapi_pnf_system_information_resp(config, &resp);
-
nfapi_system_information_indication_t ind;
memset(&ind, 0, sizeof(ind));
ind.header.message_id = NFAPI_SYSTEM_INFORMATION_INDICATION;
ind.header.phy_id = req->header.phy_id;
ind.error_code = NFAPI_P4_MSG_OK;
- switch(req->rat_type)
- {
- case NFAPI_RAT_TYPE_LTE:
- {
- ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
- ind.lte_system_information_indication.sib_type = 1;
- ind.lte_system_information_indication.sib_length = 3;
- //ind.lte_system_information_indication.sib...
- }
- break;
- case NFAPI_RAT_TYPE_UTRAN:
- {
- ind.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
- ind.utran_system_information_indication.sib_length = 3;
- //ind.utran_system_information_indication.sib...
+ switch(req->rat_type) {
+ case NFAPI_RAT_TYPE_LTE: {
+ ind.lte_system_information_indication.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG;
+ ind.lte_system_information_indication.sib_type = 1;
+ ind.lte_system_information_indication.sib_length = 3;
+ //ind.lte_system_information_indication.sib...
+ }
+ break;
- }
- break;
- case NFAPI_RAT_TYPE_GERAN:
- {
- ind.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
- ind.geran_system_information_indication.si_length = 3;
- //ind.geran_system_information_indication.si...
+ case NFAPI_RAT_TYPE_UTRAN: {
+ ind.utran_system_information_indication.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG;
+ ind.utran_system_information_indication.sib_length = 3;
+ //ind.utran_system_information_indication.sib...
+ }
+ break;
- }
- break;
+ case NFAPI_RAT_TYPE_GERAN: {
+ ind.geran_system_information_indication.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG;
+ ind.geran_system_information_indication.si_length = 3;
+ //ind.geran_system_information_indication.si...
+ }
+ break;
}
- nfapi_pnf_system_information_ind(config, &ind);
-
+ nfapi_pnf_system_information_ind(config, &ind);
return 0;
}
-int nmm_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nmm_stop_request_t* req)
-{
+int nmm_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nmm_stop_request_t *req) {
nfapi_nmm_stop_response_t resp;
memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NMM_STOP_RESPONSE;
@@ -1432,108 +1295,94 @@ int nmm_stop_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nf
return 0;
}
-int vendor_ext(nfapi_pnf_config_t* config, nfapi_p4_p5_message_header_t* msg)
-{
+int vendor_ext(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 %s %p\n", __FUNCTION__, msg);
- switch(msg->message_id)
- {
- case P5_VENDOR_EXT_REQ:
- {
- vendor_ext_p5_req* req = (vendor_ext_p5_req*)msg;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
- // send back the P5_VENDOR_EXT_RSP
- vendor_ext_p5_rsp rsp;
- memset(&rsp, 0, sizeof(rsp));
- rsp.header.message_id = P5_VENDOR_EXT_RSP;
- rsp.error_code = NFAPI_MSG_OK;
- nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
- }
- break;
+ switch(msg->message_id) {
+ case P5_VENDOR_EXT_REQ: {
+ vendor_ext_p5_req *req = (vendor_ext_p5_req *)msg;
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
+ // send back the P5_VENDOR_EXT_RSP
+ vendor_ext_p5_rsp rsp;
+ memset(&rsp, 0, sizeof(rsp));
+ rsp.header.message_id = P5_VENDOR_EXT_RSP;
+ rsp.error_code = NFAPI_MSG_OK;
+ nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
+ }
+ break;
}
return 0;
}
-nfapi_p4_p5_message_header_t* pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
-
+nfapi_p4_p5_message_header_t *pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
if(message_id == P5_VENDOR_EXT_REQ) {
(*msg_size) = sizeof(vendor_ext_p5_req);
- return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_req));
+ return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_req));
}
return 0;
}
-void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header) {
+void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
free(header);
}
-int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config) {
+int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_RSP) {
- vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)(header);
+ vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)(header);
return (!push16(rsp->error_code, ppWritePackedMsg, end));
}
+
return 0;
}
-int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_REQ) {
- vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+ vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
return (!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
- pull16(ppReadPackedMessage, &req->dummy2, end)));
-
+ pull16(ppReadPackedMessage, &req->dummy2, end)));
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
}
+
return 0;
}
/*------------------------------------------------------------------------------*/
-void* pnf_start_thread(void* ptr) {
-
+void *pnf_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
-
- nfapi_pnf_config_t *config = (nfapi_pnf_config_t*)ptr;
-
+ nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
struct sched_param sp;
sp.sched_priority = 20;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp);
-
nfapi_pnf_start(config);
-
- return (void*)0;
+ return (void *)0;
}
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
-
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
- if(nfapi_mode!=3) {
- nfapi_mode = 1; // PNF!
+ if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
+ nfapi_setmode(NFAPI_PNF); // PNF!
}
- nfapi_pnf_config_t* config = nfapi_pnf_config_create();
-
+ nfapi_pnf_config_t *config = nfapi_pnf_config_create();
config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port;
-
pnf.phys[0].udp.enabled = 1;
pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
-
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
-
- printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
- __FUNCTION__,
- config->vnf_ip_addr, config->vnf_p5_port,
- pnf.phys[0].local_addr,
- pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
- pnf.phys[0].udp.rx_port);
-
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
+ __FUNCTION__,
+ config->vnf_ip_addr, config->vnf_p5_port,
+ pnf.phys[0].local_addr,
+ pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
+ pnf.phys[0].udp.rx_port);
config->pnf_param_req = &pnf_param_request;
config->pnf_config_req = &pnf_config_request;
config->pnf_start_req = &pnf_start_request;
@@ -1541,7 +1390,6 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->param_req = ¶m_request;
config->config_req = &config_request;
config->start_req = &start_request;
-
config->measurement_req = &measurement_request;
config->rssi_req = &rssi_request;
config->cell_search_req = &cell_search_request;
@@ -1549,45 +1397,31 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->system_information_schedule_req = &system_information_schedule_request;
config->system_information_req = &system_information_request;
config->nmm_stop_req = &nmm_stop_request;
-
config->vendor_ext = &vendor_ext;
-
config->trace = &pnf_nfapi_trace;
-
config->user_data = &pnf;
-
// To allow custom vendor extentions to be added to nfapi
config->codec_config.unpack_vendor_extension_tlv = &pnf_sim_unpack_vendor_extension_tlv;
config->codec_config.pack_vendor_extension_tlv = &pnf_sim_pack_vendor_extention_tlv;
-
config->allocate_p4_p5_vendor_ext = &pnf_sim_allocate_p4_p5_vendor_ext;
config->deallocate_p4_p5_vendor_ext = &pnf_sim_deallocate_p4_p5_vendor_ext;
-
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&pnf_start_pthread, NULL, &pnf_start_thread, config);
-
pthread_setname_np(pnf_start_pthread, "NFAPI_PNF");
}
void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
-
//LOG_D(PHY,"%s(sfn:%d, sf:%d)\n", __FUNCTION__, sfn, sf);
- //TODO FIXME - HACK - DJP - using a global to bodge it in
-
+ //TODO FIXME - HACK - DJP - using a global to bodge it in
if (p7_config_g != NULL && sync_var==0) {
-
uint16_t sfn_sf_tx = sfn<<4 | sf;
- if ((sfn % 100 == 0) && sf==0)
- {
+ if ((sfn % 100 == 0) && sf==0) {
struct timespec ts;
-
clock_gettime(CLOCK_MONOTONIC, &ts);
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u sf:%u) SFN/SF(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
}
@@ -1603,21 +1437,15 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
}
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
-
rach_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
LOG_D(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles);
-
return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind);
}
int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
-
harq_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
harq_ind->header.message_id = NFAPI_HARQ_INDICATION;
-
LOG_D(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs);
-
int retval = nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind);
if (retval != 0)
@@ -1627,48 +1455,32 @@ int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
}
int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind) {
-
crc_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
crc_ind->header.message_id = NFAPI_CRC_INDICATION;
-
//LOG_D(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs);
-
return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind);
}
int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind) {
-
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_CQI_INDICATION;
-
//LOG_D(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
-
return nfapi_pnf_p7_cqi_ind(p7_config_g, ind);
}
int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
-
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_ULSCH_INDICATION;
-
int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
-
//LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval);
-
//free(ind.rx_indication_body.rx_pdu_list);
-
return retval;
}
int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
-
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
-
int retval = nfapi_pnf_p7_sr_ind(p7_config_g, ind);
-
//LOG_D(PHY,"%s() SFN/SF:%d srs:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs, retval);
-
//free(ind.rx_indication_body.rx_pdu_list);
-
return retval;
}
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
index 3da2059ba7..2752df3435 100644
--- a/nfapi/oai_integration/nfapi_vnf.c
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -61,7 +61,7 @@ typedef struct {
char local_addr[80];
int local_port;
- char* remote_addr;
+ char *remote_addr;
int remote_port;
uint8_t duplex_mode;
@@ -127,12 +127,12 @@ typedef struct mac mac_t;
typedef struct mac {
- void* user_data;
+ void *user_data;
- void (*dl_config_req)(mac_t* mac, nfapi_dl_config_request_t* req);
- void (*ul_config_req)(mac_t* mac, nfapi_ul_config_request_t* req);
- void (*hi_dci0_req)(mac_t* mac, nfapi_hi_dci0_request_t* req);
- void (*tx_req)(mac_t* mac, nfapi_tx_request_t* req);
+ void (*dl_config_req)(mac_t *mac, nfapi_dl_config_request_t *req);
+ void (*ul_config_req)(mac_t *mac, nfapi_ul_config_request_t *req);
+ void (*hi_dci0_req)(mac_t *mac, nfapi_hi_dci0_request_t *req);
+ void (*tx_req)(mac_t *mac, nfapi_tx_request_t *req);
} mac_t;
typedef struct {
@@ -145,15 +145,15 @@ typedef struct {
unsigned aperiodic_timing_enabled;
unsigned periodic_timing_period;
- // This is not really the right place if we have multiple PHY,
+ // This is not really the right place if we have multiple PHY,
// should be part of the phy struct
udp_data udp;
uint8_t thread_started;
- nfapi_vnf_p7_config_t* config;
+ nfapi_vnf_p7_config_t *config;
- mac_t* mac;
+ mac_t *mac;
} vnf_p7_info;
@@ -165,24 +165,27 @@ typedef struct {
} vnf_info;
-int vnf_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
+int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
- nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
+ nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
+
switch(tlv->tag) {
- case VENDOR_EXT_TLV_2_TAG:
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
- vendor_ext_tlv_2* ve = (vendor_ext_tlv_2*)tlv;
- if(!push32(ve->dummy, ppWritePackedMsg, end))
- return 0;
- return 1;
- }
- break;
+ case VENDOR_EXT_TLV_2_TAG: {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
+ vendor_ext_tlv_2 *ve = (vendor_ext_tlv_2 *)tlv;
+
+ if(!push32(ve->dummy, ppWritePackedMsg, end))
+ return 0;
+
+ return 1;
+ }
+ break;
}
+
return -1;
}
-int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* codec) {
+int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
return -1;
}
@@ -192,17 +195,14 @@ extern void init_eNB_afterRU(void);
extern uint16_t sf_ahead;
void oai_create_enb(void) {
-
int bodge_counter=0;
PHY_VARS_eNB *eNB = RC.eNB[0][0];
-
- printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->if_inst);
-
+ printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag,
+ eNB->single_thread_flag, eNB->if_inst);
eNB->Mod_id = bodge_counter;
eNB->CC_id = bodge_counter;
eNB->abstraction_flag = 0;
eNB->single_thread_flag = 0;//single_thread_flag;
-
RC.nb_CC[bodge_counter] = 1;
if (eNB->if_inst==0) {
@@ -213,7 +213,6 @@ void oai_create_enb(void) {
// that will result in eNB->configured being set to TRUE.
// See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
if (RC.eNB[0][0]->if_inst==0 || RC.eNB[0][0]->if_inst->PHY_config_req==0 || RC.eNB[0][0]->if_inst->schedule_response==0) {
-
printf("RC.eNB[0][0]->if_inst->PHY_config_req is not installed - install it\n");
install_schedule_handlers(RC.eNB[0][0]->if_inst);
}
@@ -227,17 +226,13 @@ void oai_create_enb(void) {
}
void oai_enb_init(void) {
-
printf("%s() About to call init_eNB_afterRU()\n", __FUNCTION__);
init_eNB_afterRU();
}
-int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) {
-
+int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
-
oai_create_enb();
-
nfapi_pnf_param_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
@@ -245,40 +240,29 @@ int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) {
return 0;
}
-int pnf_disconnection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) {
+int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
-
+ vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
-
- vnf_p7_info* p7_vnf = vnf->p7_vnfs;
+ vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_del_pnf((p7_vnf->config), phy->id);
-
return 0;
}
-int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp) {
-
+int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_response_t *resp) {
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
-
+ vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs;
- for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
- {
+ for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) {
phy_info phy;
memset(&phy,0,sizeof(phy));
phy.index = resp->pnf_phy.phy[i].phy_config_index;
-
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
-
nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
- for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j)
- {
+ for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j) {
printf("[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
}
@@ -290,16 +274,13 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
rf_info rf;
memset(&rf,0,sizeof(rf));
rf.index = resp->pnf_rf.rf[i].rf_config_index;
-
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
-
pnf->rfs[0] = rf;
}
nfapi_pnf_config_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
-
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
printf("DJP:Hard coded num phy rf to 2\n");
@@ -311,25 +292,22 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
}
nfapi_vnf_pnf_config_req(config, p5_idx, &req);
-
return 0;
}
-int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp) {
-
+int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_response_t *resp) {
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
if(1) {
- nfapi_pnf_start_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.phy_id = resp->header.phy_id;
- req.header.message_id = NFAPI_PNF_START_REQUEST;
- nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+ nfapi_pnf_start_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.phy_id = resp->header.phy_id;
+ req.header.message_id = NFAPI_PNF_START_REQUEST;
+ nfapi_vnf_pnf_start_req(config, p5_idx, &req);
} else {
// Rather than send the pnf_start_request we will demonstrate
// sending a vendor extention message. The start request will be
- // send when the vendor extension response is received
-
+ // send when the vendor extension response is received
//vnf_info* vnf = (vnf_info*)(config->user_data);
vendor_ext_p5_req req;
memset(&req, 0, sizeof(req));
@@ -338,22 +316,17 @@ int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_
req.dummy2 = 1977;
nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
}
+
return 0;
}
int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
-
L1_proc_t *proc=&eNB->proc;
-
L1_rxtx_proc_t *L1_proc= (sf&1)? &proc->L1_proc : &proc->L1_proc_tx;
-
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
-
//printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
-
//int i;
struct timespec wait;
-
wait.tv_sec=0;
wait.tv_nsec=5000000L;
@@ -368,10 +341,8 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
{
static uint16_t old_sf = 0;
static uint16_t old_sfn = 0;
-
proc->subframe_rx = old_sf;
proc->frame_rx = old_sfn;
-
// Try to be 1 frame back
old_sf = sf;
old_sfn = sfn;
@@ -380,9 +351,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
}
++L1_proc->instance_cnt;
-
//LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx);
-
// We have just received and processed the common part of a subframe, say n.
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
// transmitted timestamp of the next TX slot (first).
@@ -407,7 +376,6 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
//LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
pthread_mutex_unlock( &L1_proc->mutex );
//LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
-
return(0);
}
@@ -415,12 +383,10 @@ extern pthread_cond_t nfapi_sync_cond;
extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
-int phy_sync_indication(struct nfapi_vnf_p7_config* config, uint8_t sync) {
-
+int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
-
- if (sync==1 && nfapi_sync_var!=0) {
+ if (sync==1 && nfapi_sync_var!=0) {
printf("[VNF] Signal to OAI main code that it can go\n");
pthread_mutex_lock(&nfapi_sync_mutex);
nfapi_sync_var=0;
@@ -431,9 +397,9 @@ int phy_sync_indication(struct nfapi_vnf_p7_config* config, uint8_t sync) {
return(0);
}
-int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf) {
-
+int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn_sf) {
static uint8_t first_time = 1;
+
if (first_time) {
printf("[VNF] subframe indication %d\n", NFAPI_SFNSF2DEC(sfn_sf));
first_time = 0;
@@ -442,40 +408,33 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id,
if (RC.eNB && RC.eNB[0][0]->configured) {
uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
-
//LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
-
wake_eNB_rxtx(RC.eNB[0][0], sfn, sf);
} else {
printf("[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
+
if (RC.eNB) printf("RC.eNB[0][0]->configured:%d\n", RC.eNB[0][0]->configured);
}
return 0;
}
-int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind) {
-
+int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indication_t *ind) {
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
-
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
-
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
eNB->UL_INFO.rach_ind = *ind;
eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = eNB->preamble_list;
- for (int i=0;irach_indication_body.number_of_preambles;i++) {
+ for (int i=0; irach_indication_body.number_of_preambles; i++) {
if (ind->rach_indication_body.preamble_list[i].preamble_rel8.tl.tag == NFAPI_PREAMBLE_REL8_TAG) {
-
- printf("preamble[%d]: rnti:%02x preamble:%d timing_advance:%d\n",
- i,
- ind->rach_indication_body.preamble_list[i].preamble_rel8.rnti,
- ind->rach_indication_body.preamble_list[i].preamble_rel8.preamble,
- ind->rach_indication_body.preamble_list[i].preamble_rel8.timing_advance
- );
+ printf("preamble[%d]: rnti:%02x preamble:%d timing_advance:%d\n",
+ i,
+ ind->rach_indication_body.preamble_list[i].preamble_rel8.rnti,
+ ind->rach_indication_body.preamble_list[i].preamble_rel8.preamble,
+ ind->rach_indication_body.preamble_list[i].preamble_rel8.timing_advance
+ );
}
if(ind->rach_indication_body.preamble_list[i].preamble_rel13.tl.tag == NFAPI_PREAMBLE_REL13_TAG) {
@@ -484,21 +443,17 @@ int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indicatio
eNB->preamble_list[i] = ind->rach_indication_body.preamble_list[i];
}
- pthread_mutex_unlock(&eNB->UL_INFO_mutex);
+ pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rach_ind(p7_vnf->mac, ind);
return 1;
}
-int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind) {
-
+int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
-
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
eNB->UL_INFO.harq_ind = *ind;
eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
@@ -507,51 +462,41 @@ int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indicatio
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_harq_ind(p7_vnf->mac, ind);
-
return 1;
}
-int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind) {
-
+int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
eNB->UL_INFO.crc_ind = *ind;
-
nfapi_crc_indication_t *dest_ind = &eNB->UL_INFO.crc_ind;
nfapi_crc_indication_pdu_t *dest_pdu_list = eNB->crc_pdu_list;
-
*dest_ind = *ind;
dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
if (ind->crc_indication_body.number_of_crcs==0)
- LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
+ LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs,
+ eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
for (int i=0; icrc_indication_body.number_of_crcs; i++) {
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
-
- LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
- __FUNCTION__,
- NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
- i,
- ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
- eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
+ LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
+ __FUNCTION__,
+ NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
+ i,
+ ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
+ eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_crc_ind(p7_vnf->mac, ind);
-
return 1;
}
-int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind) {
-
+int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
if (ind->rx_indication_body.number_of_pdus==0) {
@@ -559,198 +504,170 @@ int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t*
}
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
nfapi_rx_indication_t *dest_ind = &eNB->UL_INFO.rx_ind;
nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->rx_pdu_list;
-
*dest_ind = *ind;
dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list;
for(int i=0; irx_indication_body.number_of_pdus; i++) {
nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i];
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
-
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
-
// DJP - TODO FIXME - intentional memory leak
dest_pdu->data = malloc(dest_pdu->rx_indication_rel8.length);
-
memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
-
LOG_D(PHY, "%s() NFAPI SFN/SF:%d PDUs:%d [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
- __FUNCTION__,
- NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i,
- dest_pdu->rx_ue_information.handle,
- dest_pdu->rx_ue_information.rnti,
- dest_pdu->rx_indication_rel8.length,
- dest_pdu->rx_indication_rel8.offset,
- dest_pdu->rx_indication_rel8.ul_cqi,
- dest_pdu->rx_indication_rel8.timing_advance,
- dest_pdu->data
- );
+ __FUNCTION__,
+ NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i,
+ dest_pdu->rx_ue_information.handle,
+ dest_pdu->rx_ue_information.rnti,
+ dest_pdu->rx_indication_rel8.length,
+ dest_pdu->rx_indication_rel8.offset,
+ dest_pdu->rx_indication_rel8.ul_cqi,
+ dest_pdu->rx_indication_rel8.timing_advance,
+ dest_pdu->data
+ );
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rx_ind(p7_vnf->mac, ind);
return 1;
}
-int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind) {
+int phy_srs_indication(struct nfapi_vnf_p7_config *config, nfapi_srs_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_srs_ind(p7_vnf->mac, ind);
return 1;
}
-int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind) {
-
+int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
-
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
nfapi_sr_indication_t *dest_ind = &eNB->UL_INFO.sr_ind;
nfapi_sr_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
-
*dest_ind = *ind;
dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list;
-
LOG_D(MAC,"%s() eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
- for (int i=0;iUL_INFO.sr_ind.sr_indication_body.number_of_srs;i++) {
+ for (int i=0; iUL_INFO.sr_ind.sr_indication_body.number_of_srs; i++) {
nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i];
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
-
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti, src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
-
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_sr_ind(p7_vnf->mac, ind);
-
return 1;
}
-int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind) {
-
+int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
-
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
-
pthread_mutex_lock(&eNB->UL_INFO_mutex);
-
eNB->UL_INFO.cqi_ind = ind->cqi_indication_body;
-
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
-
return 1;
}
-int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind) {
+int phy_lbt_dl_indication(struct nfapi_vnf_p7_config *config, nfapi_lbt_dl_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_lbt_dl_ind(p7_vnf->mac, ind);
return 1;
}
-int phy_nb_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind) {
+int phy_nb_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_nb_harq_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_nb_harq_ind(p7_vnf->mac, ind);
return 1;
}
-int phy_nrach_indication(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind) {
+int phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_nrach_ind(p7_vnf->mac, ind);
return 1;
}
-void* vnf_allocate(size_t size) {
+void *vnf_allocate(size_t size) {
//return (void*)memory_pool::allocate(size);
- return (void*)malloc(size);
+ return (void *)malloc(size);
}
-void vnf_deallocate(void* ptr) {
+void vnf_deallocate(void *ptr) {
//memory_pool::deallocate((uint8_t*)ptr);
free(ptr);
}
-void vnf_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
-
+void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
va_list args;
-
va_start(args, message);
- nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
+ VLOG( NFAPI_VNF, nfapitooai_level(nfapi_level), message, args);
va_end(args);
}
-int phy_vendor_ext(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg) {
-
- if(msg->message_id == P7_VENDOR_EXT_IND)
- {
+int phy_vendor_ext(struct nfapi_vnf_p7_config *config, nfapi_p7_message_header_t *msg) {
+ if(msg->message_id == P7_VENDOR_EXT_IND) {
//vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
//printf("[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
- }
- else
- {
+ } else {
printf("[VNF] unknown %02x\n", msg->message_id);
}
+
return 0;
}
-nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
- if(message_id == P7_VENDOR_EXT_IND)
- {
+nfapi_p7_message_header_t *phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
+ if(message_id == P7_VENDOR_EXT_IND) {
*msg_size = sizeof(vendor_ext_p7_ind);
- return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_ind));
+ return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
}
+
return 0;
}
-void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header) {
+void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header) {
free(header);
}
-int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p7_codec_config_t* codec) {
-
+int phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p7_codec_config_t *codec) {
(void)tl;
(void)ppReadPackedMessage;
(void)ve;
return -1;
}
-int phy_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codec) {
-
+int phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
+ nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
- nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
switch(tlv->tag) {
- case VENDOR_EXT_TLV_1_TAG:
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
- vendor_ext_tlv_1* ve = (vendor_ext_tlv_1*)tlv;
- if(!push32(ve->dummy, ppWritePackedMsg, end))
- return 0;
- return 1;
- }
- break;
+ case VENDOR_EXT_TLV_1_TAG: {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
+ vendor_ext_tlv_1 *ve = (vendor_ext_tlv_1 *)tlv;
+
+ if(!push32(ve->dummy, ppWritePackedMsg, end))
+ return 0;
+
+ return 1;
+ }
+ break;
+
default:
return -1;
break;
}
}
-int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* config) {
-
+int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *config) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_IND) {
- vendor_ext_p7_ind* req = (vendor_ext_p7_ind*)(header);
+ vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
+
if(!pull16(ppReadPackedMessage, &req->error_code, end))
return 0;
}
@@ -758,54 +675,48 @@ int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t**
return 1;
}
-int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) {
+int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P7_VENDOR_EXT_REQ) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
+ vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
+
if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
- push16(req->dummy2, ppWritePackedMsg, end)))
+ push16(req->dummy2, ppWritePackedMsg, end)))
return 0;
}
+
return 1;
}
-int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
-
+int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
if(header->message_id == P5_VENDOR_EXT_REQ) {
- vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
+ vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
- push16(req->dummy2, ppWritePackedMsg, end)));
+ push16(req->dummy2, ppWritePackedMsg, end)));
}
+
return 0;
}
static pthread_t vnf_start_pthread;
static pthread_t vnf_p7_start_pthread;
-void* vnf_p7_start_thread(void *ptr) {
-
+void *vnf_p7_start_thread(void *ptr) {
printf("%s()\n", __FUNCTION__);
-
pthread_setname_np(pthread_self(), "VNF_P7");
-
- nfapi_vnf_p7_config_t* config = (nfapi_vnf_p7_config_t*)ptr;
-
+ nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
nfapi_vnf_p7_start(config);
-
return config;
}
void set_thread_priority(int priority);
-void* vnf_p7_thread_start(void* ptr) {
-
+void *vnf_p7_thread_start(void *ptr) {
set_thread_priority(79);
-
- vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
-
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
p7_vnf->config->port = p7_vnf->local_port;
p7_vnf->config->sync_indication = &phy_sync_indication;
p7_vnf->config->subframe_indication = &phy_subframe_indication;
@@ -821,117 +732,87 @@ void* vnf_p7_thread_start(void* ptr) {
p7_vnf->config->nrach_indication = &phy_nrach_indication;
p7_vnf->config->malloc = &vnf_allocate;
p7_vnf->config->free = &vnf_deallocate;
-
p7_vnf->config->trace = &vnf_trace;
-
p7_vnf->config->vendor_ext = &phy_vendor_ext;
p7_vnf->config->user_data = p7_vnf;
-
p7_vnf->mac->user_data = p7_vnf;
-
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
p7_vnf->config->codec_config.allocate = &vnf_allocate;
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
-
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
-
return 0;
}
-int pnf_start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp) {
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
+int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_response_t *resp) {
+ vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs;
nfapi_param_request_t req;
-
printf("[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n", p5_idx, config, config->user_data, vnf->p7_vnfs[0].config, vnf->p7_vnfs[0].thread_started);
if(p7_vnf->thread_started == 0) {
-
pthread_t vnf_p7_thread;
pthread_create(&vnf_p7_thread, NULL, &vnf_p7_thread_start, p7_vnf);
p7_vnf->thread_started = 1;
- }
- else
- {
- // P7 thread already running.
+ } else {
+ // P7 thread already running.
}
// start all the phys in the pnf.
printf("[VNF] Sending NFAPI_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
-
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PARAM_REQUEST;
req.header.phy_id = pnf->phys[0].id;
-
nfapi_vnf_param_req(config, p5_idx, &req);
-
return 0;
}
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
-int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp) {
-
+int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) {
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
-
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr;
nfapi_config_request_t *req = &RC.mac[0]->config[0];
-
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
-
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
-
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
-
// for now just 1
-
- printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
-
+ printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled,
+ p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id;
-
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
-
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
-
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
-
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++;
printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
-
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
-
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled) {
-
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
req->num_tlv++;
@@ -943,142 +824,110 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
ve2.dummy = 2016;
req->vendor_extension = &ve2.tl;
-
nfapi_vnf_config_req(config, p5_idx, req);
printf("[VNF] Sent NFAPI_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
-
return 0;
}
-int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp) {
-
+int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
nfapi_start_request_t req;
-
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
-
printf("[VNF] Calling oai_enb_init()\n");
oai_enb_init();
-
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_START_REQUEST;
req.header.phy_id = resp->header.phy_id;
nfapi_vnf_start_req(config, p5_idx, &req);
-
printf("[VNF] Send NFAPI_START_REQUEST idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
-
return 0;
}
-int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp) {
-
+int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) {
printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
-
+ vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
-
return 0;
}
-int vendor_ext_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg) {
-
+int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
printf("[VNF] %s\n", __FUNCTION__);
switch(msg->message_id) {
- case P5_VENDOR_EXT_RSP:
- {
- vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)msg;
- printf("[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
-
- // send the start request
-
- nfapi_pnf_start_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_PNF_START_REQUEST;
- nfapi_vnf_pnf_start_req(config, p5_idx, &req);
- }
- break;
+ case P5_VENDOR_EXT_RSP: {
+ vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
+ printf("[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
+ // send the start request
+ nfapi_pnf_start_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PNF_START_REQUEST;
+ nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+ }
+ break;
}
return 0;
}
-int vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec) {
-
+int vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- if(header->message_id == P5_VENDOR_EXT_RSP)
- {
- vendor_ext_p5_rsp* req = (vendor_ext_p5_rsp*)(header);
+ if(header->message_id == P5_VENDOR_EXT_RSP) {
+ vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
return(!pull16(ppReadPackedMessage, &req->error_code, end));
}
+
return 0;
}
-nfapi_p4_p5_message_header_t* vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size) {
-
+nfapi_p4_p5_message_header_t *vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
if(message_id == P5_VENDOR_EXT_RSP) {
*msg_size = sizeof(vendor_ext_p5_rsp);
- return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_rsp));
+ return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_rsp));
}
+
return 0;
}
-void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header) {
+void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
free(header);
}
nfapi_vnf_config_t *config = 0;
-void vnf_start_thread(void* ptr) {
-
+void vnf_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
-
pthread_setname_np(pthread_self(), "VNF");
-
- config = (nfapi_vnf_config_t*)ptr;
-
+ config = (nfapi_vnf_config_t *)ptr;
nfapi_vnf_start(config);
}
static vnf_info vnf;
-extern uint8_t nfapi_mode;
+
/*------------------------------------------------------------------------------*/
-void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
-{
- nfapi_mode = 2;
-
+void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
+ nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf));
-
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
-
vnf.p7_vnfs[0].timing_window = 32;
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
vnf.p7_vnfs[0].periodic_timing_period = 10;
-
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
-
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
vnf.p7_vnfs[0].local_port = 50001;
- vnf.p7_vnfs[0].mac = (mac_t*)malloc(sizeof(mac_t));
-
- nfapi_vnf_config_t* config = nfapi_vnf_config_create();
-
+ vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
+ nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
config->free = free;
config->trace = &vnf_trace;
-
config->vnf_p5_port = vnf_p5_port;
config->vnf_ipv4 = 1;
config->vnf_ipv6 = 0;
-
config->pnf_list = 0;
config->phy_list = 0;
-
config->pnf_connection_indication = &pnf_connection_indication_cb;
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
config->pnf_param_resp = &pnf_param_resp_cb;
@@ -1088,33 +937,26 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
config->config_resp = &config_resp_cb;
config->start_resp = &start_resp_cb;
config->vendor_ext = &vendor_ext_cb;
-
config->user_data = &vnf;
-
// To allow custom vendor extentions to be added to nfapi
config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
-
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
config->codec_config.allocate = &vnf_allocate;
config->codec_config.deallocate = &vnf_deallocate;
-
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
- pthread_create(&vnf_start_pthread, NULL, (void*)&vnf_start_thread, config);
+ pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_start_thread, config);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
}
-int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
-{
+int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
-
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
-
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
dl_config_req->dl_config_request_body.number_dci = 0;
dl_config_req->dl_config_request_body.number_pdu = 0;
@@ -1123,35 +965,31 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req)
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
+
return retval;
}
-int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
-{
+int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
-
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
-
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
-
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_req->tx_request_body.number_of_pdus = 0;
}
+
return retval;
}
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
-
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
-
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
if (retval!=0) {
@@ -1160,19 +998,16 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
hi_dci0_req->hi_dci0_request_body.number_of_hi = 0;
hi_dci0_req->hi_dci0_request_body.number_of_dci = 0;
}
+
return retval;
}
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
-
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
-
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
-
//LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
-
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
if (retval!=0) {
@@ -1183,5 +1018,6 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
ul_config_req->ul_config_request_body.rach_prach_frequency_resources = 0;
ul_config_req->ul_config_request_body.srs_present = 0;
}
+
return retval;
}
diff --git a/nfapi/oai_integration/vendor_ext.h b/nfapi/oai_integration/vendor_ext.h
index 0622432260..f25aa703cc 100644
--- a/nfapi/oai_integration/vendor_ext.h
+++ b/nfapi/oai_integration/vendor_ext.h
@@ -1,12 +1,12 @@
/*
* Copyright 2017 Cisco Systems, Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,48 +20,62 @@
#include "nfapi_interface.h"
typedef enum {
- P5_VENDOR_EXT_REQ = NFAPI_VENDOR_EXT_MSG_MIN,
- P5_VENDOR_EXT_RSP,
+ P5_VENDOR_EXT_REQ = NFAPI_VENDOR_EXT_MSG_MIN,
+ P5_VENDOR_EXT_RSP,
- P7_VENDOR_EXT_REQ,
- P7_VENDOR_EXT_IND
+ P7_VENDOR_EXT_REQ,
+ P7_VENDOR_EXT_IND
} vendor_ext_message_id_e;
typedef struct {
- nfapi_p4_p5_message_header_t header;
- uint16_t dummy1;
- uint16_t dummy2;
+ nfapi_p4_p5_message_header_t header;
+ uint16_t dummy1;
+ uint16_t dummy2;
} vendor_ext_p5_req;
typedef struct {
- nfapi_p4_p5_message_header_t header;
- uint16_t error_code;
+ nfapi_p4_p5_message_header_t header;
+ uint16_t error_code;
} vendor_ext_p5_rsp;
typedef struct {
- nfapi_p7_message_header_t header;
- uint16_t dummy1;
- uint16_t dummy2;
+ nfapi_p7_message_header_t header;
+ uint16_t dummy1;
+ uint16_t dummy2;
} vendor_ext_p7_req;
typedef struct {
- nfapi_p7_message_header_t header;
- uint16_t error_code;
+ nfapi_p7_message_header_t header;
+ uint16_t error_code;
} vendor_ext_p7_ind;
typedef struct {
- nfapi_tl_t tl;
- uint32_t dummy;
+ nfapi_tl_t tl;
+ uint32_t dummy;
} vendor_ext_tlv_1;
#define VENDOR_EXT_TLV_1_TAG 0xF001
typedef struct {
- nfapi_tl_t tl;
- uint32_t dummy;
+ nfapi_tl_t tl;
+ uint32_t dummy;
} vendor_ext_tlv_2;
#define VENDOR_EXT_TLV_2_TAG 0xF002
+typedef enum {
+ NFAPI_MONOLITHIC=0,
+ NFAPI_MODE_PNF,
+ NFAPI_MODE_VNF,
+ NFAPI_UE_STUB_PNF,
+ NFAPI_UE_STUB_OFFNET,
+ NFAPI_MODE_UNKNOWN
+} nfapi_mode_t;
+
+char *nfapi_get_strmode(void);
+void nfapi_logmode(void);
+nfapi_mode_t nfapi_getmode(void);
+void nfapi_setmode(nfapi_mode_t nfapi_mode);
+#define NFAPI_MODE (nfapi_getmode())
#endif // _VENDOR_EXT_
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
index c180b5b0f9..2daf1450c8 100644
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -1545,7 +1545,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
// DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
- if (0 && pdu->segments[j].segment_length == 3)
+ if (pdu->segments[j].segment_length == 3)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[j].segment_data[0],
@@ -4429,40 +4429,43 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
for(i = 0; i < totalNumPdus; ++i)
{
nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
+ if (pdu) {
+ uint16_t length = 0;
+ uint16_t index = 0;
- uint16_t length = 0;
- uint16_t index = 0;
-
- if(!(pull16(ppReadPackedMsg, &length, end) &&
+ if(!(pull16(ppReadPackedMsg, &length, end) &&
pull16(ppReadPackedMsg, &index, end)))
- return 0;
+ return 0;
- pdu->pdu_length = length;
- pdu->pdu_index = index;
+ pdu->pdu_length = length;
+ pdu->pdu_index = index;
// TODO : May need to rethink this bit
- pdu->num_segments = 1;
- pdu->segments[0].segment_length = pdu->pdu_length;
- pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
+ pdu->num_segments = 1;
+ pdu->segments[0].segment_length = pdu->pdu_length;
+ pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
- if(pdu->segments[0].segment_data)
- {
- if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
+ if(pdu->segments[0].segment_data)
+ {
+ if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
return 0;
- if (0 && pdu->segments[0].segment_length == 3)
- {
+ if (pdu->segments[0].segment_length == 3)
+ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[0].segment_data[0],
pdu->segments[0].segment_data[1],
pdu->segments[0].segment_data[2]
);
- }
- }
- else
- {
+ }
+ }
+ else
+ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
- }
+ }
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
+ }
}
}
break;
diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
index df0ca12305..1c2f0bef80 100644
--- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
+++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
@@ -1,12 +1,12 @@
/*
* Copyright 2017 Cisco Systems, Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,609 +34,510 @@
#include
#include
-struct phy_pdu
-{
- phy_pdu() : buffer_len(1500), buffer(0), len(0)
- {
- buffer = (char*) malloc(buffer_len);
- }
-
- virtual ~phy_pdu()
- {
- free(buffer);
- }
+struct phy_pdu {
+ phy_pdu() : buffer_len(1500), buffer(0), len(0) {
+ buffer = (char *) malloc(buffer_len);
+ }
+
+ virtual ~phy_pdu() {
+ free(buffer);
+ }
- unsigned buffer_len;
- char* buffer;
- unsigned len;
+ unsigned buffer_len;
+ char *buffer;
+ unsigned len;
};
-class fapi_private
-{
- std::mutex mutex;
- std::queue rx_buffer;
+class fapi_private {
+ std::mutex mutex;
+ std::queue rx_buffer;
- std::queue free_store;
- public:
+ std::queue free_store;
+ public:
- fapi_private()
- : byte_count(0), tick(0), first_dl_config(false)
- {
- }
+ fapi_private()
+ : byte_count(0), tick(0), first_dl_config(false) {
+ }
- phy_pdu* allocate_phy_pdu()
- {
- phy_pdu* pdu = 0;
- mutex.lock();
- if(free_store.empty())
- {
- pdu = new phy_pdu();
- }
- else
- {
- pdu = free_store.front();
- free_store.pop();
- }
- mutex.unlock();
- return pdu;
- }
+ phy_pdu *allocate_phy_pdu() {
+ phy_pdu *pdu = 0;
+ mutex.lock();
- void release_phy_pdu(phy_pdu* pdu)
- {
- mutex.lock();
- free_store.push(pdu);
- mutex.unlock();
- }
+ if(free_store.empty()) {
+ pdu = new phy_pdu();
+ } else {
+ pdu = free_store.front();
+ free_store.pop();
+ }
- bool rx_buffer_empty()
- {
- bool empty;
- mutex.lock();
- empty = rx_buffer.empty();
- mutex.unlock();
+ mutex.unlock();
+ return pdu;
+ }
- return empty;
- }
-
+ void release_phy_pdu(phy_pdu *pdu) {
+ mutex.lock();
+ free_store.push(pdu);
+ mutex.unlock();
+ }
- void push_rx_buffer(phy_pdu* buff)
- {
- mutex.lock();
- rx_buffer.push(buff);
- mutex.unlock();
- }
+ bool rx_buffer_empty() {
+ bool empty;
+ mutex.lock();
+ empty = rx_buffer.empty();
+ mutex.unlock();
+ return empty;
+ }
- phy_pdu* pop_rx_buffer()
- {
- phy_pdu* buff = 0;
- mutex.lock();
- if(!rx_buffer.empty())
- {
- buff = rx_buffer.front();
- rx_buffer.pop();
- }
- mutex.unlock();
- return buff;
- }
- uint32_t byte_count;
- uint32_t tick;
- bool first_dl_config;
+ void push_rx_buffer(phy_pdu *buff) {
+ mutex.lock();
+ rx_buffer.push(buff);
+ mutex.unlock();
+ }
+
+ phy_pdu *pop_rx_buffer() {
+ phy_pdu *buff = 0;
+ mutex.lock();
+
+ if(!rx_buffer.empty()) {
+ buff = rx_buffer.front();
+ rx_buffer.pop();
+ }
+
+ mutex.unlock();
+ return buff;
+ }
+
+ uint32_t byte_count;
+ uint32_t tick;
+ bool first_dl_config;
};
extern "C"
{
- typedef struct fapi_internal
- {
- fapi_t _public;
+ typedef struct fapi_internal {
+ fapi_t _public;
- fapi_cb_t callbacks;
+ fapi_cb_t callbacks;
- uint8_t state;
- fapi_config_t config;
+ uint8_t state;
+ fapi_config_t config;
- int rx_sock;
- int tx_sock;
- struct sockaddr_in tx_addr;
+ int rx_sock;
+ int tx_sock;
+ struct sockaddr_in tx_addr;
- uint32_t tx_byte_count;
- uint32_t tick;
-
- fapi_private* fapi;
+ uint32_t tx_byte_count;
+ uint32_t tick;
- } fapi_internal_t;
+ fapi_private *fapi;
+
+ } fapi_internal_t;
}
extern void set_thread_priority(int);
/*
{
- pthread_attr_t ptAttr;
-
- struct sched_param schedParam;
- schedParam.__sched_priority = 79;
- sched_setscheduler(0, SCHED_RR, &schedParam);
+ pthread_attr_t ptAttr;
- pthread_attr_setschedpolicy(&ptAttr, SCHED_RR);
+ struct sched_param schedParam;
+ schedParam.__sched_priority = 79;
+ sched_setscheduler(0, SCHED_RR, &schedParam);
- pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+ pthread_attr_setschedpolicy(&ptAttr, SCHED_RR);
- struct sched_param thread_params;
- thread_params.sched_priority = 20;
- pthread_attr_setschedparam(&ptAttr, &thread_params);
+ pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+
+ struct sched_param thread_params;
+ thread_params.sched_priority = 20;
+ pthread_attr_setschedparam(&ptAttr, &thread_params);
}
*/
-void send_uplink_indications(fapi_internal_t* instance, uint16_t sfn_sf)
-{
- fapi_harq_ind_t harq_ind;
- (instance->callbacks.fapi_harq_ind)(&(instance->_public), &harq_ind);
+void send_uplink_indications(fapi_internal_t *instance, uint16_t sfn_sf) {
+ fapi_harq_ind_t harq_ind;
+ (instance->callbacks.fapi_harq_ind)(&(instance->_public), &harq_ind);
+ fapi_crc_ind_t crc_ind;
+ crc_ind.header.message_id = FAPI_CRC_INDICATION;
+ crc_ind.header.length = 0; //??;
+ crc_ind.sfn_sf = sfn_sf;
+ crc_ind.body.number_of_crcs = 1;
+ crc_ind.body.pdus[0].rx_ue_info.handle = 0; //??
+ crc_ind.body.pdus[0].rx_ue_info.rnti = 0; //??
+ crc_ind.body.pdus[0].rel8_pdu.crc_flag = 1;
+ (instance->callbacks.fapi_crc_ind)(&(instance->_public), &crc_ind);
- fapi_crc_ind_t crc_ind;
- crc_ind.header.message_id = FAPI_CRC_INDICATION;
- crc_ind.header.length = 0; //??;
- crc_ind.sfn_sf = sfn_sf;
- crc_ind.body.number_of_crcs = 1;
- crc_ind.body.pdus[0].rx_ue_info.handle = 0; //??
- crc_ind.body.pdus[0].rx_ue_info.rnti = 0; //??
- crc_ind.body.pdus[0].rel8_pdu.crc_flag = 1;
+ if(!instance->fapi->rx_buffer_empty()) {
+ fapi_rx_ulsch_ind_t rx_ind;
+ memset(&rx_ind, 0, sizeof(rx_ind));
+ rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
+ rx_ind.sfn_sf = sfn_sf;
+ phy_pdu *buff = 0;
+ int i = 0;
+ std::list free_list;
- (instance->callbacks.fapi_crc_ind)(&(instance->_public), &crc_ind);
+ do {
+ buff = instance->fapi->pop_rx_buffer();
- if(!instance->fapi->rx_buffer_empty())
- {
- fapi_rx_ulsch_ind_t rx_ind;
- memset(&rx_ind, 0, sizeof(rx_ind));
- rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
- rx_ind.sfn_sf = sfn_sf;
+ if(buff != 0) {
+ if(buff->len == 0) {
+ printf("[FAPI] Buffer length = 0\n");
+ }
+ rx_ind.body.pdus[i].rx_ue_info.handle = 0xDEADBEEF;
+ rx_ind.body.pdus[i].rx_ue_info.rnti = 0x4242;
+ rx_ind.body.pdus[i].rel8_pdu.length = buff->len;
+ //rx_ind.pdus[i].rel8_pdu.data_offset;
+ //rx_ind.pdus[i].rel8_pdu.ul_cqi;
+ //rx_ind.pdus[i].rel8_pdu.timing_advance;
+ rx_ind.body.data[i] = buff->buffer;
+ rx_ind.body.number_of_pdus++;
+ i++;
+ instance->fapi->byte_count += buff->len;
+ free_list.push_back(buff);
+ }
+ } while(buff != 0 && i < 8);
- phy_pdu* buff = 0;
- int i = 0;
- std::list free_list;
- do
- {
- buff = instance->fapi->pop_rx_buffer();
- if(buff != 0)
- {
- if(buff->len == 0)
- {
- printf("[FAPI] Buffer length = 0\n");
- }
+ (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
- rx_ind.body.pdus[i].rx_ue_info.handle = 0xDEADBEEF;
- rx_ind.body.pdus[i].rx_ue_info.rnti = 0x4242;
+ for(phy_pdu *pdu : free_list) {
+ instance->fapi->release_phy_pdu(pdu);
+ //free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
+ }
+ } else {
+ fapi_rx_ulsch_ind_t rx_ind;
+ memset(&rx_ind, 0, sizeof(rx_ind));
+ rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
+ rx_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
+ }
- rx_ind.body.pdus[i].rel8_pdu.length = buff->len;
- //rx_ind.pdus[i].rel8_pdu.data_offset;
- //rx_ind.pdus[i].rel8_pdu.ul_cqi;
- //rx_ind.pdus[i].rel8_pdu.timing_advance;
-
- rx_ind.body.data[i] = buff->buffer;
-
- rx_ind.body.number_of_pdus++;
- i++;
-
- instance->fapi->byte_count += buff->len;
-
- free_list.push_back(buff);
- }
- }while(buff != 0 && i < 8);
-
- (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
-
- for(phy_pdu* pdu : free_list)
- {
- instance->fapi->release_phy_pdu(pdu);
- //free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
- }
- }
- else
- {
- fapi_rx_ulsch_ind_t rx_ind;
- memset(&rx_ind, 0, sizeof(rx_ind));
- rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
- rx_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
- }
-
-
- fapi_rx_cqi_ind_t cqi_ind;
- cqi_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_rx_cqi_ind)(&(instance->_public), &cqi_ind);
-
- fapi_rx_sr_ind_t sr_ind;
- sr_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_rx_sr_ind)(&(instance->_public), &sr_ind);
-
- fapi_rach_ind_t rach_ind;
- rach_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_rach_ind)(&(instance->_public), &rach_ind);
-
- fapi_srs_ind_t srs_ind;
- srs_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_srs_ind)(&(instance->_public), &srs_ind);
- /*
- nfapi_lbt_dl_indication_t lbt_ind;
- memset(&lbt_ind, 0, sizeof(lbt_ind));
- lbt_ind.header.message_id = NFAPI_LBT_DL_INDICATION;
- lbt_ind.header.phy_id = config->phy_id;
- lbt_ind.sfn_sf = sfn_sf;
- nfapi_pnf_p7_lbt_dl_ind(config, &lbt_ind);
-
- vendor_ext_p7_ind ve_p7_ind;
- memset(&ve_p7_ind, 0, sizeof(ve_p7_ind));
- ve_p7_ind.header.message_id = P7_VENDOR_EXT_IND;
- ve_p7_ind.header.phy_id = config->phy_id;
- ve_p7_ind.error_code = NFAPI_MSG_OK;
- nfapi_pnf_p7_vendor_extension(config, &(ve_p7_ind.header));
- */
-
- fapi_nb_harq_ind_t nb_harq_ind;
- nb_harq_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_nb_harq_ind)(&(instance->_public), &nb_harq_ind);
-
- fapi_nrach_ind_t nrach_ind;
- nrach_ind.sfn_sf = sfn_sf;
- (instance->callbacks.fapi_nrach_ind)(&(instance->_public), &nrach_ind);
+ fapi_rx_cqi_ind_t cqi_ind;
+ cqi_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_rx_cqi_ind)(&(instance->_public), &cqi_ind);
+ fapi_rx_sr_ind_t sr_ind;
+ sr_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_rx_sr_ind)(&(instance->_public), &sr_ind);
+ fapi_rach_ind_t rach_ind;
+ rach_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_rach_ind)(&(instance->_public), &rach_ind);
+ fapi_srs_ind_t srs_ind;
+ srs_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_srs_ind)(&(instance->_public), &srs_ind);
+ /*
+ nfapi_lbt_dl_indication_t lbt_ind;
+ memset(&lbt_ind, 0, sizeof(lbt_ind));
+ lbt_ind.header.message_id = NFAPI_LBT_DL_INDICATION;
+ lbt_ind.header.phy_id = config->phy_id;
+ lbt_ind.sfn_sf = sfn_sf;
+ nfapi_pnf_p7_lbt_dl_ind(config, &lbt_ind);
+ vendor_ext_p7_ind ve_p7_ind;
+ memset(&ve_p7_ind, 0, sizeof(ve_p7_ind));
+ ve_p7_ind.header.message_id = P7_VENDOR_EXT_IND;
+ ve_p7_ind.header.phy_id = config->phy_id;
+ ve_p7_ind.error_code = NFAPI_MSG_OK;
+ nfapi_pnf_p7_vendor_extension(config, &(ve_p7_ind.header));
+ */
+ fapi_nb_harq_ind_t nb_harq_ind;
+ nb_harq_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_nb_harq_ind)(&(instance->_public), &nb_harq_ind);
+ fapi_nrach_ind_t nrach_ind;
+ nrach_ind.sfn_sf = sfn_sf;
+ (instance->callbacks.fapi_nrach_ind)(&(instance->_public), &nrach_ind);
}
-void* fapi_thread_start(void* ptr)
-{
- set_thread_priority(81);
+void *fapi_thread_start(void *ptr) {
+ set_thread_priority(81);
+ fapi_internal_t *instance = (fapi_internal_t *)ptr;
+ uint16_t sfn_sf_dec = 0;
+ uint32_t last_tv_usec = 0;
+ uint32_t last_tv_sec = 0;
+ uint32_t millisec;
+ uint32_t last_millisec = -1;
+ uint16_t catchup = 0;
- fapi_internal_t* instance = (fapi_internal_t*)ptr;
- uint16_t sfn_sf_dec = 0;
- uint32_t last_tv_usec = 0;
- uint32_t last_tv_sec = 0;
+ while(1) {
+ // get the time
+ struct timeval sf_start;
+ (void)gettimeofday(&sf_start, NULL);
+ uint16_t sfn_sf = ((((sfn_sf_dec) / 10) << 4) | (((sfn_sf_dec) - (((sfn_sf_dec) / 10) * 10)) & 0xF));
+ // increment the sfn/sf - for the next subframe
+ sfn_sf_dec++;
- uint32_t millisec;
- uint32_t last_millisec = -1;
- uint16_t catchup = 0;
+ if(sfn_sf_dec > 10239)
+ sfn_sf_dec = 0;
- while(1)
- {
- // get the time
- struct timeval sf_start;
- (void)gettimeofday(&sf_start, NULL);
-
- uint16_t sfn_sf = ((((sfn_sf_dec) / 10) << 4) | (((sfn_sf_dec) - (((sfn_sf_dec) / 10) * 10)) & 0xF));
- // increment the sfn/sf - for the next subframe
- sfn_sf_dec++;
- if(sfn_sf_dec > 10239)
- sfn_sf_dec = 0;
+ fapi_subframe_ind_t ind;
+ ind.sfn_sf = sfn_sf;
-
- fapi_subframe_ind_t ind;
- ind.sfn_sf = sfn_sf;
+ if(instance->fapi->first_dl_config)
+ send_uplink_indications(instance, sfn_sf);
- if(instance->fapi->first_dl_config)
- send_uplink_indications(instance, sfn_sf);
+ if(instance->tick == 1000) {
+ if(instance->tx_byte_count > 0) {
+ printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
+ instance->tx_byte_count = 0;
+ }
- if(instance->tick == 1000)
- {
- if(instance->tx_byte_count > 0)
- {
- printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
- instance->tx_byte_count = 0;
- }
-
- instance->tick = 0;
- }
+ instance->tick = 0;
+ }
- instance->tick++;
+ instance->tick++;
+ (instance->callbacks.fapi_subframe_ind)(&(instance->_public), &ind);
+ {
+ phy_pdu *pdu = instance->fapi->allocate_phy_pdu();
+ int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, MSG_DONTWAIT, 0, 0);
- (instance->callbacks.fapi_subframe_ind)(&(instance->_public), &ind);
+ if(len > 0) {
+ pdu->len = len;
+ instance->fapi->push_rx_buffer(pdu);
+ } else {
+ instance->fapi->release_phy_pdu(pdu);
+ }
+ }
- {
- phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
- int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, MSG_DONTWAIT, 0, 0);
- if(len > 0)
- {
- pdu->len = len;
- instance->fapi->push_rx_buffer(pdu);
- }
- else
- {
- instance->fapi->release_phy_pdu(pdu);
- }
- }
-
+ if(catchup) {
+ catchup--;
+ } else {
+ struct timespec now_ts;
+ struct timespec sleep_ts;
+ struct timespec sleep_rem_ts;
+ // get the current time
+ clock_gettime(CLOCK_MONOTONIC, &now_ts);
+ // determine how long to sleep before the start of the next 1ms
+ sleep_ts.tv_sec = 0;
+ sleep_ts.tv_nsec = 1e6 - (now_ts.tv_nsec % 1000000);
+ int nanosleep_result = nanosleep(&sleep_ts, &sleep_rem_ts);
- if(catchup)
- {
- catchup--;
- }
- else
- {
- struct timespec now_ts;
- struct timespec sleep_ts;
- struct timespec sleep_rem_ts;
+ if(nanosleep_result != 0)
+ printf("*** nanosleep failed or was interrupted\n");
- // get the current time
- clock_gettime(CLOCK_MONOTONIC, &now_ts);
+ clock_gettime(CLOCK_MONOTONIC, &now_ts);
+ millisec = now_ts.tv_nsec / 1e6;
+ if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
+ printf("*** missing millisec %d %d\n", last_millisec, millisec);
+ catchup = millisec - last_millisec - 1;
+ }
- // determine how long to sleep before the start of the next 1ms
- sleep_ts.tv_sec = 0;
- sleep_ts.tv_nsec = 1e6 - (now_ts.tv_nsec % 1000000);
-
- int nanosleep_result = nanosleep(&sleep_ts, &sleep_rem_ts);
-
- if(nanosleep_result != 0)
- printf("*** nanosleep failed or was interrupted\n");
-
-
- clock_gettime(CLOCK_MONOTONIC, &now_ts);
- millisec = now_ts.tv_nsec / 1e6;
-
- if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec)
- {
- printf("*** missing millisec %d %d\n", last_millisec, millisec);
- catchup = millisec - last_millisec - 1;
- }
-
- last_millisec = millisec;
- }
- }
+ last_millisec = millisec;
+ }
+ }
}
extern "C"
{
- fapi_t* fapi_create(fapi_cb_t* callbacks, fapi_config_t* config)
- {
- fapi_internal_t* instance = (fapi_internal*)calloc(1, sizeof(fapi_internal_t));
- instance->callbacks = *callbacks;
- instance->config = *config;
- instance->state = 0;
+ fapi_t *fapi_create(fapi_cb_t *callbacks, fapi_config_t *config) {
+ fapi_internal_t *instance = (fapi_internal *)calloc(1, sizeof(fapi_internal_t));
+ instance->callbacks = *callbacks;
+ instance->config = *config;
+ instance->state = 0;
+ instance->fapi = new fapi_private();
+ return (fapi_t *)instance;
+ }
- instance->fapi = new fapi_private();
+ void fapi_destroy(fapi_t *fapi) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ delete instance->fapi;
+ free(instance);
+ }
- return (fapi_t*)instance;
- }
-
- void fapi_destroy(fapi_t* fapi)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
-
- delete instance->fapi;
- free(instance);
- }
+ void *fapi_rx_thread_start(void *ptr) {
+ set_thread_priority(60);
+ fapi_internal_t *instance = (fapi_internal_t *)ptr;
- void* fapi_rx_thread_start(void* ptr)
- {
- set_thread_priority(60);
+ while(1) {
+ phy_pdu *pdu = instance->fapi->allocate_phy_pdu();
+ int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
- fapi_internal_t* instance = (fapi_internal_t*)ptr;
+ if(len > 0) {
+ pdu->len = len;
+ instance->fapi->push_rx_buffer(pdu);
+ } else {
+ instance->fapi->release_phy_pdu(pdu);
+ }
+ }
+ }
- while(1)
- {
- phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
- int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
- if(len > 0)
- {
- pdu->len = len;
- instance->fapi->push_rx_buffer(pdu);
- }
- else
- {
- instance->fapi->release_phy_pdu(pdu);
- }
+ void fapi_start_data(fapi_t *fapi, unsigned rx_port, const char *tx_address, unsigned tx_port) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ printf("[FAPI] Rx Data from %u\n", rx_port);
+ printf("[FAPI] Tx Data to %s:%u\n", tx_address, tx_port);
+ instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
- }
- }
+ if(instance->rx_sock < 0) {
+ printf("[FAPI] Failed to create socket\n");
+ return;
+ }
- void fapi_start_data(fapi_t* fapi, unsigned rx_port, const char* tx_address, unsigned tx_port)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
+ struct sockaddr_in addr;
- printf("[FAPI] Rx Data from %d\n", rx_port);
- printf("[FAPI] Tx Data to %s:%d\n", tx_address, tx_port);
+ memset(&addr, 0, sizeof(addr));
- instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
-
- if(instance->rx_sock < 0)
- {
- printf("[FAPI] Failed to create socket\n");
- return;
- }
+ addr.sin_family = AF_INET;
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(rx_port);
- addr.sin_addr.s_addr = INADDR_ANY;
-
- int bind_result = bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
-
- if(bind_result == -1)
- {
- printf("[FAPI] Failed to bind to port %d\n", rx_port);
- close(instance->rx_sock);
- return ;
- }
+ addr.sin_port = htons(rx_port);
- instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
- instance->tx_addr.sin_family = AF_INET;
- instance->tx_addr.sin_port = htons(tx_port);
- instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
+ addr.sin_addr.s_addr = INADDR_ANY;
- }
+ int bind_result = bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
+
+ if(bind_result == -1) {
+ printf("[FAPI] Failed to bind to port %u\n", rx_port);
+ close(instance->rx_sock);
+ return ;
+ }
+
+ instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+ instance->tx_addr.sin_family = AF_INET;
+ instance->tx_addr.sin_port = htons(tx_port);
+ instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
+ }
- void fill_tlv(fapi_tlv_t tlvs[], uint8_t count, uint8_t tag, uint8_t len, uint16_t value)
- {
- tlvs[count].tag = tag;
- tlvs[count].value = value;
- tlvs[count].length = len;
-
- }
+ void fill_tlv(fapi_tlv_t tlvs[], uint8_t count, uint8_t tag, uint8_t len, uint16_t value) {
+ tlvs[count].tag = tag;
+ tlvs[count].value = value;
+ tlvs[count].length = len;
+ }
- int fapi_param_request(fapi_t* fapi, fapi_param_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
-
- fapi_param_resp_t resp;
- resp.header.message_id = FAPI_PARAM_RESPONSE;
+ int fapi_param_request(fapi_t *fapi, fapi_param_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ fapi_param_resp_t resp;
+ resp.header.message_id = FAPI_PARAM_RESPONSE;
+ resp.error_code = FAPI_MSG_OK;
+ resp.number_of_tlvs = 0;
+ fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_STATE_TAG, 2, instance->state);
- resp.error_code = FAPI_MSG_OK;
+ if(instance->state == 0) {
+ if(instance->config.duplex_mode == 0) {
+ // -- TDD
+ // Downlink Bandwidth Support
+ // Uplink Bandwidth Support
+ // Downlink Modulation Support
+ // Uplink Modulation Support
+ // PHY Antenna Capability
+ // Release Capability
+ // MBSFN Capability
+ } else if(instance->config.duplex_mode == 1) {
+ // -- FDD
+ // Downlink Bandwidth Support
+ fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.dl_channel_bw_support);
+ // Uplink Bandwidth Support
+ fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.ul_channel_bw_support);
+ // Downlink Modulation Support
+ // Uplink Modulation Support
+ // PHY Antenna Capability
+ // Release Capability
+ // MBSFN Capability
+ // LAA Capability
+ }
+ } else {
+ if(instance->config.duplex_mode == 0) {
+ // -- TDD
+ // Downlink Bandwidth Support
+ // Uplink Bandwidth Support
+ // Downlink Modulation Support
+ // Uplink Modulation Support
+ // PHY Antenna Capability
+ // Release Capability
+ // MBSFN Capability
+ // Duplexing Mode
+ // PCFICH Power Offset
+ // P-B
+ // DL Cyclic Prefix Type
+ // UL Cyclic Prefix Type
+ // RF Config
+ // PHICH Config
+ // SCH Config
+ // PRACH Config
+ // PUSCH Config
+ // PUCCH Config
+ // SRS Config
+ // Uplink Reference Signal Config
+ // TDD Frame Structure Config
+ // Data Report Mode
+ } else if(instance->config.duplex_mode == 1) {
+ // FDD
+ // Downlink Bandwidth Support
+ // Uplink Bandwidth Support
+ // Downlink Modulation Support
+ // Uplink Modulation Support
+ // PHY Antenna Capability
+ // Release Capability
+ // MBSFN Capability
+ // LAA Capability
+ // Duplexing Mode
+ // PCFICH Power Offset
+ // P-B
+ // DL Cyclic Prefix Type
+ // UL Cyclic Prefix Type
+ // RF Config
+ // PHICH Config
+ // SCH Config
+ // PRACH Config
+ // PUSCH Config
+ // PUCCH Config
+ // SRS Config
+ // Uplink Reference Signal Config
+ // Data Report Mode
+ }
+ }
- resp.number_of_tlvs = 0;
- fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_STATE_TAG, 2, instance->state);
+ //todo fill
+ (instance->callbacks.fapi_param_response)(fapi, &resp);
+ return 0;
+ }
+ int fapi_config_request(fapi_t *fapi, fapi_config_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ fapi_config_resp_t resp;
+ resp.header.message_id = FAPI_CONFIG_RESPONSE;
+ resp.error_code = FAPI_MSG_OK;
+ (instance->callbacks.fapi_config_response)(fapi, &resp);
+ return 0;
+ }
- if(instance->state == 0)
- {
- if(instance->config.duplex_mode == 0)
- {
- // -- TDD
- // Downlink Bandwidth Support
- // Uplink Bandwidth Support
- // Downlink Modulation Support
- // Uplink Modulation Support
- // PHY Antenna Capability
- // Release Capability
- // MBSFN Capability
- }
- else if(instance->config.duplex_mode == 1)
- {
- // -- FDD
- // Downlink Bandwidth Support
- fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.dl_channel_bw_support);
- // Uplink Bandwidth Support
- fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.ul_channel_bw_support);
- // Downlink Modulation Support
- // Uplink Modulation Support
- // PHY Antenna Capability
- // Release Capability
- // MBSFN Capability
- // LAA Capability
- }
- }
- else
- {
- if(instance->config.duplex_mode == 0)
- {
- // -- TDD
- // Downlink Bandwidth Support
- // Uplink Bandwidth Support
- // Downlink Modulation Support
- // Uplink Modulation Support
- // PHY Antenna Capability
- // Release Capability
- // MBSFN Capability
- // Duplexing Mode
- // PCFICH Power Offset
- // P-B
- // DL Cyclic Prefix Type
- // UL Cyclic Prefix Type
- // RF Config
- // PHICH Config
- // SCH Config
- // PRACH Config
- // PUSCH Config
- // PUCCH Config
- // SRS Config
- // Uplink Reference Signal Config
- // TDD Frame Structure Config
- // Data Report Mode
- }
- else if(instance->config.duplex_mode == 1)
- {
- // FDD
- // Downlink Bandwidth Support
- // Uplink Bandwidth Support
- // Downlink Modulation Support
- // Uplink Modulation Support
- // PHY Antenna Capability
- // Release Capability
- // MBSFN Capability
- // LAA Capability
- // Duplexing Mode
- // PCFICH Power Offset
- // P-B
- // DL Cyclic Prefix Type
- // UL Cyclic Prefix Type
- // RF Config
- // PHICH Config
- // SCH Config
- // PRACH Config
- // PUSCH Config
- // PUCCH Config
- // SRS Config
- // Uplink Reference Signal Config
- // Data Report Mode
- }
- }
+ int fapi_start_request(fapi_t *fapi, fapi_start_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ pthread_t fapi_thread;
+ pthread_create(&fapi_thread, NULL, &fapi_thread_start, instance);
+ return 0;
+ }
+ int fapi_dl_config_request(fapi_t *fapi, fapi_dl_config_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ instance->fapi->first_dl_config = true;
+ return 0;
+ }
+ int fapi_ul_config_request(fapi_t *fapi, fapi_ul_config_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ return 0;
+ }
+ int fapi_hi_dci0_request(fapi_t *fapi, fapi_hi_dci0_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
+ return 0;
+ }
+ int fapi_tx_request(fapi_t *fapi, fapi_tx_req_t *req) {
+ fapi_internal_t *instance = (fapi_internal_t *)fapi;
- //todo fill
- (instance->callbacks.fapi_param_response)(fapi, &resp);
+ for(int i = 0; i < req->body.number_of_pdus; ++i) {
+ uint16_t len = req->body.pdus[i].pdu_length;
+ uint32_t *data = req->body.pdus[i].tlvs[0].value;
+ //printf("[FAPI] sfnsf:%d len:%d\n", req->sfn_sf,len);
+ //
+ instance->tx_byte_count += len;
+ int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr *)&(instance->tx_addr), sizeof(instance->tx_addr));
- return 0;
- }
+ if(sendto_result == -1) {
+ // error
+ }
+ }
- int fapi_config_request(fapi_t* fapi, fapi_config_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
-
- fapi_config_resp_t resp;
- resp.header.message_id = FAPI_CONFIG_RESPONSE;
- resp.error_code = FAPI_MSG_OK;
-
- (instance->callbacks.fapi_config_response)(fapi, &resp);
- return 0;
- }
-
- int fapi_start_request(fapi_t* fapi, fapi_start_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
-
- pthread_t fapi_thread;
- pthread_create(&fapi_thread, NULL, &fapi_thread_start, instance);
-
- return 0;
- }
-
- int fapi_dl_config_request(fapi_t* fapi, fapi_dl_config_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
- instance->fapi->first_dl_config = true;
- return 0;
- }
- int fapi_ul_config_request(fapi_t* fapi, fapi_ul_config_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
- return 0;
- }
- int fapi_hi_dci0_request(fapi_t* fapi, fapi_hi_dci0_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
- return 0;
- }
- int fapi_tx_request(fapi_t* fapi, fapi_tx_req_t* req)
- {
- fapi_internal_t* instance = (fapi_internal_t*)fapi;
-
- for(int i = 0; i < req->body.number_of_pdus; ++i)
- {
- uint16_t len = req->body.pdus[i].pdu_length;
- uint32_t* data = req->body.pdus[i].tlvs[0].value;
- //printf("[FAPI] sfnsf:%d len:%d\n", req->sfn_sf,len);
- //
- instance->tx_byte_count += len;
-
- int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr*)&(instance->tx_addr), sizeof(instance->tx_addr));
-
- if(sendto_result == -1)
- {
- // error
- }
- }
-
- return 0;
- }
+ return 0;
+ }
}
diff --git a/nfapi/open-nFAPI/pnf_sim/src/main.cpp b/nfapi/open-nFAPI/pnf_sim/src/main.cpp
index e2622cf3c3..251e2a48cb 100644
--- a/nfapi/open-nFAPI/pnf_sim/src/main.cpp
+++ b/nfapi/open-nFAPI/pnf_sim/src/main.cpp
@@ -101,7 +101,7 @@ class phy_info
{
index = 0;
id = 0;
-
+ udp = 0;
local_port = 0;
remote_addr = 0;
remote_port = 0;
@@ -178,6 +178,7 @@ class pnf_info
sync_mode = 0;
location_mode = 0;
+ location_coordinates = 0;
dl_config_timing = 0;
ul_config_timing = 0;
tx_timing = 0;
diff --git a/nfapi/open-nFAPI/vnf_sim/src/mac.cpp b/nfapi/open-nFAPI/vnf_sim/src/mac.cpp
index fa6f487be8..88898afc74 100644
--- a/nfapi/open-nFAPI/vnf_sim/src/mac.cpp
+++ b/nfapi/open-nFAPI/vnf_sim/src/mac.cpp
@@ -1,12 +1,12 @@
/*
* Copyright 2017 Cisco Systems, Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,1297 +31,1130 @@
#include
#include
-uint32_t rand_range(uint32_t min, uint32_t max)
-{
- return ((rand() % (max + 1 - min)) + min);
+uint32_t rand_range(uint32_t min, uint32_t max) {
+ return ((rand() % (max + 1 - min)) + min);
}
-struct mac_pdu
-{
- mac_pdu() : buffer_len(1500), buffer(0), len(0)
- {
- buffer = (char*) malloc(buffer_len);
- }
-
- virtual ~mac_pdu()
- {
- free(buffer);
- }
+struct mac_pdu {
+ mac_pdu() : buffer_len(1500), buffer(0), len(0) {
+ buffer = (char *) malloc(buffer_len);
+ }
- unsigned buffer_len;
- char* buffer;
- unsigned len;
+ virtual ~mac_pdu() {
+ free(buffer);
+ }
+
+ unsigned buffer_len;
+ char *buffer;
+ unsigned len;
};
-class mac_private
-{
- std::mutex mutex;
- std::queue rx_buffer;
+class mac_private {
+ std::mutex mutex;
+ std::queue rx_buffer;
- std::queue free_store;
- public:
+ std::queue free_store;
+ public:
- mac_private(bool _wireshark_test_mode)
- : byte_count(0), tick(0), wireshark_test_mode(_wireshark_test_mode)
- {
+ mac_private(bool _wireshark_test_mode)
+ : byte_count(0), tick(0), wireshark_test_mode(_wireshark_test_mode) {
+ }
- }
+ mac_pdu *allocate_mac_pdu() {
+ mac_pdu *pdu = 0;
+ mutex.lock();
- mac_pdu* allocate_mac_pdu()
- {
- mac_pdu* pdu = 0;
- mutex.lock();
- if(free_store.empty())
- {
- pdu = new mac_pdu();
- }
- else
- {
- pdu = free_store.front();
- free_store.pop();
- }
- mutex.unlock();
- return pdu;
- }
+ if(free_store.empty()) {
+ pdu = new mac_pdu();
+ } else {
+ pdu = free_store.front();
+ free_store.pop();
+ }
- void release_mac_pdu(mac_pdu* pdu)
- {
- mutex.lock();
- free_store.push(pdu);
- mutex.unlock();
- }
+ mutex.unlock();
+ return pdu;
+ }
-
+ void release_mac_pdu(mac_pdu *pdu) {
+ mutex.lock();
+ free_store.push(pdu);
+ mutex.unlock();
+ }
- void push_rx_buffer(mac_pdu* buff)
- {
- mutex.lock();
- rx_buffer.push(buff);
- mutex.unlock();
- }
- mac_pdu* pop_rx_buffer()
- {
- mac_pdu* buff = 0;
- mutex.lock();
- if(!rx_buffer.empty())
- {
- buff = rx_buffer.front();
- rx_buffer.pop();
- }
- mutex.unlock();
- return buff;
- }
- uint32_t byte_count;
- uint32_t tick;
-
- bool wireshark_test_mode;
+ void push_rx_buffer(mac_pdu *buff) {
+ mutex.lock();
+ rx_buffer.push(buff);
+ mutex.unlock();
+ }
+
+ mac_pdu *pop_rx_buffer() {
+ mac_pdu *buff = 0;
+ mutex.lock();
+
+ if(!rx_buffer.empty()) {
+ buff = rx_buffer.front();
+ rx_buffer.pop();
+ }
+
+ mutex.unlock();
+ return buff;
+ }
+
+ uint32_t byte_count;
+ uint32_t tick;
+
+ bool wireshark_test_mode;
};
extern "C"
{
- typedef struct {
- mac_t _public;
+ typedef struct {
+ mac_t _public;
- int rx_sock;
- int tx_sock;
- struct sockaddr_in tx_addr;
+ int rx_sock;
+ int tx_sock;
+ struct sockaddr_in tx_addr;
- uint32_t tx_byte_count;
+ uint32_t tx_byte_count;
- mac_private* mac;
-
- } mac_internal_t;
+ mac_private *mac;
- mac_t* mac_create(uint8_t wireshark_test_mode)
- {
- mac_internal_t* instance = (mac_internal_t*)malloc(sizeof(mac_internal_t));
- instance->mac = new mac_private((wireshark_test_mode >= 1));
- return (mac_t*)instance;
- }
-
- void mac_destroy(mac_t* mac)
- {
- mac_internal_t* instance = (mac_internal_t*)mac;
- delete instance->mac;
- free(instance);
- }
-
- void* mac_rx_thread_start(void* ptr)
- {
- mac_internal_t* instance = (mac_internal_t*)ptr;
+ } mac_internal_t;
- while(1)
- {
- mac_pdu* pdu = instance->mac->allocate_mac_pdu();
- int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
- if(len > 0)
- {
- pdu->len = len;
- instance->mac->push_rx_buffer(pdu);
- }
- else
- {
- instance->mac->release_mac_pdu(pdu);
- }
- }
- return 0;
- }
+ mac_t *mac_create(uint8_t wireshark_test_mode) {
+ mac_internal_t *instance = (mac_internal_t *)malloc(sizeof(mac_internal_t));
+ instance->mac = new mac_private((wireshark_test_mode >= 1));
+ return (mac_t *)instance;
+ }
- void mac_start_data(mac_t* mac, unsigned rx_port, const char* tx_address, unsigned tx_port)
- {
- mac_internal_t* instance = (mac_internal_t*)mac;
+ void mac_destroy(mac_t *mac) {
+ mac_internal_t *instance = (mac_internal_t *)mac;
+ delete instance->mac;
+ free(instance);
+ }
- printf("[MAC] Rx Data from %d\n", rx_port);
- printf("[MAC] Tx Data to %s.%d\n", tx_address, tx_port);
+ void *mac_rx_thread_start(void *ptr) {
+ mac_internal_t *instance = (mac_internal_t *)ptr;
- instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
-
- if(instance->rx_sock < 0)
- {
- printf("[MAC] Failed to create socket\n");
- return;
- }
+ while(1) {
+ mac_pdu *pdu = instance->mac->allocate_mac_pdu();
+ int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(0));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(rx_port);
- addr.sin_addr.s_addr = INADDR_ANY;
-
- if(bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
- {
- printf("[MAC] Failed to bind to %d\n", rx_port);
- close(instance->rx_sock);
- return;
- }
+ if(len > 0) {
+ pdu->len = len;
+ instance->mac->push_rx_buffer(pdu);
+ } else {
+ instance->mac->release_mac_pdu(pdu);
+ }
+ }
- pthread_t mac_rx_thread;
- pthread_create(&mac_rx_thread, NULL, &mac_rx_thread_start, instance);
+ return 0;
+ }
- instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
- instance->tx_addr.sin_family = AF_INET;
- instance->tx_addr.sin_port = htons(tx_port);
- instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
- }
+ void mac_start_data(mac_t *mac, unsigned rx_port, const char *tx_address, unsigned tx_port) {
+ mac_internal_t *instance = (mac_internal_t *)mac;
+ printf("[MAC] Rx Data from %u\n", rx_port);
+ printf("[MAC] Tx Data to %s.%u\n", tx_address, tx_port);
+ instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+ if(instance->rx_sock < 0) {
+ printf("[MAC] Failed to create socket\n");
+ return;
+ }
-
- void generate_test_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)
- {
- //mac_internal_t* instance = (mac_internal_t*)mac;
-
- uint8_t max_num_dl_pdus = 50;
- nfapi_dl_config_request_pdu_t dl_config_pdus[max_num_dl_pdus];
- memset(&dl_config_pdus, 0, sizeof(dl_config_pdus));
-
- nfapi_dl_config_request_t dl_config_req;
- memset(&dl_config_req, 0, sizeof(dl_config_req));
- dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
- dl_config_req.header.phy_id = phy_id;
- dl_config_req.sfn_sf = sfn_sf;
- dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
-
- dl_config_req.dl_config_request_body.number_pdu = rand_range(4, max_num_dl_pdus);
-
- uint16_t i = 0;
- for(i = 0; i < dl_config_req.dl_config_request_body.number_pdu; ++i)
- {
- dl_config_pdus[i].pdu_type = rand_range(0, 11);
-
- switch(dl_config_pdus[i].pdu_type)
- {
- case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
- {
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.dci_format = rand_range(0, 9);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = rand_range(0, 255);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = rand_range(0, 32);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = rand_range(0, 320000);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = rand_range(0, 31);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = rand_range(0, 31);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.harq_process = rand_range(0, 31);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpmi = rand_range(0, 15);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.pmi = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.precoding_information = rand_range(0, 63);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpc = rand_range(0, 3);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.ngap = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_size_index = rand_range(0, 31);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_power_offset = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.preamble_index = rand_range(0, 63);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.prach_mask_index = rand_range(0, 15);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = rand_range(0, 3);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = rand_range(0, 10000);
-
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_change_notification = rand_range(0, 255);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.scrambling_identity = rand_range(0, 1);
-
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.carrier_indicator = rand_range(0, 7);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_request = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.n_dl_rb = rand_range(0, 100);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
-
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.primary_cell_type = rand_range(0, 2);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations = 2;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
-
-
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.codebook_size_determination = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.drms_table_flag = rand_range(0, 1);
-
- // if the tpm extention is present of not.
- if(rand_range(0, 1))
- {
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = rand_range(0, 1);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_prb_per_subband = rand_range(0, 8);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands = rand_range(0, 13);
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas = 1; // rand_range(0, 8);
-
- for(int j = 0; j < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands; ++j)
- {
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].subband_index = j;
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues = 1; //rand_range(1, 4);
-
- for(int k = 0; k < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas; ++k)
- for(int l = 0; l < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues; ++l)
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].precoding_value[k][l] = rand_range(0, 65535);
- }
- }
- else
- {
- dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = 0;
- }
-
- }
- break;
-
- case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
- {
- dl_config_pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
- dl_config_pdus[i].bch_pdu.bch_pdu_rel8.length = rand_range(0, 42);
- dl_config_pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = rand_range(0, 10000);
- }
- break;
-
- case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
- {
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG;
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.length = rand_range(0, 42);
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.rnti = 0xFFFD;
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_allocation_type = 0;
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_block_coding = 0;
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.modulation = rand_range(0, 8);
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].mch_pdu.mch_pdu_rel8.mbsfn_area_id = rand_range(0, 255);
- }
- break;
-
- case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
- {
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.length = rand_range(0, 42);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.rnti = rand_range(1, 65535);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = rand_range(0, 5);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = rand_range(0, 32000);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.modulation = rand_range(2, 8);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rand_range(0, 3);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_blocks = rand_range(1, 2);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = rand_range(0, 13);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_layers = rand_range(1, 8);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 2; //rand_range(0, 13);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[0] = rand_range(0, 15);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[1] = rand_range(0, 15);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pa = rand_range(0, 7);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ngap = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.nprb = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_mode = rand_range(1, 10);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 2; //rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 2; //rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].subband_index = rand_range(0, 4);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].num_antennas = 1;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].bf_value[0] = rand_range(0, 128);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].subband_index = rand_range(0, 4);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].num_antennas = 1;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].bf_value[0] = rand_range(0, 128);
-
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.nscid = rand_range(0, 1);
-
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config_r10 = 0;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 65535);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_number_nzp_configuration = 1;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.pdsch_start = rand_range(0, 4);
-
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_config_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_scrambling = rand_range(0, 503);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_config_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_scrambling = rand_range(0, 503);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_flag = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_atenna_ports = rand_range(1,4);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_freq_shift = rand_range(0, 5);
-
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG;
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.altcqi_table_r12 = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.maxlayers = rand_range(1, 8);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.n_dl_harq = rand_range(0, 255);
-
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.dwpts_symbols = rand_range(3, 14);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.ue_type = rand_range(0, 2);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = rand_range(0, 2);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
- dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = rand_range(0, 1);
- }
- break;
-
- case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
- {
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.length = rand_range(0, 42);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.p_rnti = 0xFFFE;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_allocation_type = rand_range(2, 6);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_block_coding = rand_range(0, 34000);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.mcs = 0;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.redundancy_version = 0;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_transport_blocks = 1;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_scheme = rand_range(1, 6);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_layers = rand_range(1, 4);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.codebook_index = 0;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pa = rand_range(0, 7);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.nprb = rand_range(0, 1);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ngap = rand_range(0, 1);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG;
- dl_config_pdus[i].pch_pdu.pch_pdu_rel13.ue_mode = rand_range(0, 1);
- dl_config_pdus[i].pch_pdu.pch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
- }
- break;
-
- case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
- {
- dl_config_pdus[i].prs_pdu.prs_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG;
- dl_config_pdus[i].prs_pdu.prs_pdu_rel9.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_bandwidth = rand_range(6, 100);
- dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_cyclic_prefix_type = rand_range(0, 1);
- dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_muting = rand_range(0, 1);
- }
- break;
-
- case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
- {
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG;
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_antenna_port_count_r10 = rand_range(1, 16);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config_r10 = 0;
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 8);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_number_of_nzp_configuration = 2;
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[1] = rand_range(0, 31);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG;
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.csi_rs_class = rand_range(0, 2);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.cdm_type = rand_range(0, 1);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.num_bf_vector = 0; // set to zero as not clear how to handle bf value array
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].csi_rs_resource_index = rand_range(0, 7);
- dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].bf_value[0] = 42;
- }
- break;
-
- case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
- {
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.dci_format = rand_range(0, 9);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.cce_idx = rand_range(0, 255);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.aggregation_level = rand_range(0, 32);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_allocation_type = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_block_coding = rand_range(0, 320000);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_1 = rand_range(0, 31);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_2 = rand_range(0, 31);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.harq_process = rand_range(0, 31);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpmi = rand_range(0, 15);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.pmi = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.precoding_information = rand_range(0, 63);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpc = rand_range(0, 3);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.ngap = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_size_index = rand_range(0, 31);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_power_offset = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.preamble_index = rand_range(0, 63);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.prach_mask_index = rand_range(0, 15);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti_type = rand_range(0, 3);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transmission_power = rand_range(0, 10000);
-
-
-
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_change_notification = rand_range(0, 255);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.scrambling_identity = rand_range(0, 1);
-
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.carrier_indicator = rand_range(0, 7);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_request = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.n_dl_rb = rand_range(0, 100);
-
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
-
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.primary_cell_type = rand_range(0, 2);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.number_ul_dl_configurations = 2;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
-
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.codebook_size_determination = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.drms_table_flag = rand_range(0, 1);
+ struct sockaddr_in addr;
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_resource_assignment_flag = rand_range(0, 1);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_id = rand_range(0, 503);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_start_symbol = rand_range(1, 4);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb = rand_range(2, 8);
- for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_prb_index[j] = rand_range(0, 99);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.subband_index = rand_range(0, 25);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.num_antennas= rand_range(1, 4);
- for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.bf_value[j] = rand_range(0, 65535);
-
-
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG;
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.dwpts_symbols = rand_range(3, 14);
- dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.initial_lbt_sf = rand_range(0, 1);
- }
- break;
-
- case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
- {
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = rand_range(2, 6);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = rand_range(0, 14);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = rand_range(1, 4);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = rand_range(0, 22);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = rand_range(2, 24);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = rand_range(0, 4);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti = rand_range(1, 65535);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = rand_range(1, 2);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = rand_range(0, 503);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_format = rand_range(10, 12);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = rand_range(0, 0xFFFF);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mcs = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = rand_range(1, 8);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = rand_range(0, 3);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_process = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = rand_range(0, 4);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = rand_range(0, 3);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rand_range(1, 4);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpc = rand_range(0, 3);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = rand_range(0, 4);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = rand_range(0, 63);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = rand_range(0, 15);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = rand_range(0, 3);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.srs_request = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = rand_range(0, 3);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = rand_range(0, 255);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 1);
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = rand_range(0, 8);
- for(int j = 0 ; j < dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports; ++j)
- dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.precoding_value[j] = rand_range(0, 65535);
- }
- break;
-
- case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
- {
- dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG;
- dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.length = rand_range(0, 5555);
- dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.transmission_power = rand_range(0, 10000);
- dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs = rand_range(0, 3);
- }
- break;
-
- case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
- {
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG;
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.length = rand_range(0, 5555);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.ncce_index = rand_range(0, 1);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.aggregation_level = rand_range(1, 2);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.start_symbol = rand_range(0, 4);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti_type = rand_range(0, 3);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti = rand_range(1, 65535);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_format = rand_range(0, 1);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay = rand_range(0, 7);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.resource_assignment = rand_range(0, 7);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.repetition_number = rand_range(0, 15);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.mcs = rand_range(0, 13);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = rand_range(0, 15);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = rand_range(0, 1);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.starting_number_of_nprach_repetitions = rand_range(0, 3);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.subcarrier_indication_of_nprach = rand_range(0, 63);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.paging_direct_indication_differentation_flag = rand_range(0, 1);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.direct_indication = rand_range(0, 255);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = rand_range(0, 7);
- dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 255);
- }
- break;
-
- case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
- {
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG;
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.length = rand_range(0, 5555);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = rand_range(0, 65535);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.start_symbol = rand_range(0, 4);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = rand_range(0, 1);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti = rand_range(1, 65535);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment = rand_range(0, 7);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = rand_range(0, 15);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = rand_range(1, 10);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.sf_idx = rand_range(1, 10240);
- dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
- }
- break;
-
- };
- }
+ memset(&addr, 0, sizeof(sockaddr_in));
+ addr.sin_family = AF_INET;
- dl_config_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdus;
- mac->dl_config_req(mac, &dl_config_req);
-
- uint8_t num_ul_pdus = 18;
- nfapi_ul_config_request_pdu_t ul_config_pdus[num_ul_pdus];
- memset(&ul_config_pdus, 0, sizeof(ul_config_pdus));
-
- nfapi_ul_config_request_t ul_config_req;
- memset(&ul_config_req, 0, sizeof(ul_config_req));
- ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
- ul_config_req.header.phy_id = phy_id;
- ul_config_req.sfn_sf = sfn_sf;
- ul_config_req.ul_config_request_body.tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
- ul_config_req.ul_config_request_body.number_of_pdus = num_ul_pdus;
- ul_config_req.ul_config_request_body.rach_prach_frequency_resources = rand_range(0, 255);
- ul_config_req.ul_config_request_body.srs_present = rand_range(0, 1);
-
- auto ul_config_ulsch_pdu_test_gen = [](nfapi_ul_config_ulsch_pdu& ulsch_pdu)
- {
- ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
- ulsch_pdu.ulsch_pdu_rel8.handle = rand_range(0, 50000);
- ulsch_pdu.ulsch_pdu_rel8.size = rand_range(0, 32000);
- ulsch_pdu.ulsch_pdu_rel8.rnti = rand_range(1, 65535);
- ulsch_pdu.ulsch_pdu_rel8.resource_block_start = rand_range(0, 99);
- ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = rand_range(1, 100);
- ulsch_pdu.ulsch_pdu_rel8.modulation_type = rand_range(2, 6);
- ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
- ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
- ulsch_pdu.ulsch_pdu_rel8.new_data_indication = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel8.redundancy_version = rand_range(0, 3);
- ulsch_pdu.ulsch_pdu_rel8.harq_process_number = rand_range(0, 15);
- ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = rand_range(0, 5);
- ulsch_pdu.ulsch_pdu_rel8.n_srs = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG;
- ulsch_pdu.ulsch_pdu_rel10.resource_allocation_type = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel10.resource_block_coding = rand_range(0, 35000);
- ulsch_pdu.ulsch_pdu_rel10.transport_blocks = rand_range(1, 2);
- ulsch_pdu.ulsch_pdu_rel10.transmission_scheme = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel10.number_of_layers = rand_range(1, 4);
- ulsch_pdu.ulsch_pdu_rel10.codebook_index = rand_range(0, 23);
- ulsch_pdu.ulsch_pdu_rel10.disable_sequence_hopping_flag = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG;
- ulsch_pdu.ulsch_pdu_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel11.npusch_identity = rand_range(0, 509);
- ulsch_pdu.ulsch_pdu_rel11.dmrs_config_flag = rand_range(0, 1);
- ulsch_pdu.ulsch_pdu_rel11.ndmrs_csh_identity = rand_range(0, 509);
- ulsch_pdu.ulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
- ulsch_pdu.ulsch_pdu_rel13.ue_type = rand_range(0, 2);
- ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = rand_range(1, 2048);
- ulsch_pdu.ulsch_pdu_rel13.repetition_number = rand_range(1, 2048);
- ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
- ulsch_pdu.ulsch_pdu_rel13.empty_symbols_due_to_re_tunning = rand_range(0, 8);
- };
-
- auto ul_config_cqi_ri_info_test_gen = [](nfapi_ul_config_cqi_ri_information& cqi_ri_information)
- {
- cqi_ri_information.cqi_ri_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG;
- cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_1 = rand_range(0, 255);
- cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_greater_1 = rand_range(0, 255);
- cqi_ri_information.cqi_ri_information_rel8.ri_size = rand_range(0, 3);
- cqi_ri_information.cqi_ri_information_rel8.delta_offset_cqi = rand_range(0, 15);
- cqi_ri_information.cqi_ri_information_rel8.delta_offset_ri = rand_range(0, 15);
+ addr.sin_port = htons(rx_port);
- cqi_ri_information.cqi_ri_information_rel9.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG;
- cqi_ri_information.cqi_ri_information_rel9.report_type = 1; // rand_range(0, 1);
- cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = rand_range(0, 15);
- cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = rand_range(0, 15);
-
- if(cqi_ri_information.cqi_ri_information_rel9.report_type == 0)
- {
- cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size = rand_range(0, 255);
- cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.control_type = rand_range(0, 1);
- }
- else
- {
- cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
- cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = rand_range(0, 3);
- cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[0] = rand_range(0, 255);
- }
-
- cqi_ri_information.cqi_ri_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG;
- cqi_ri_information.cqi_ri_information_rel13.report_type = rand_range(0, 1);
-
- if(cqi_ri_information.cqi_ri_information_rel13.report_type == 0)
- {
- cqi_ri_information.cqi_ri_information_rel13.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2 = rand_range(255, 10000);
- }
- };
-
- auto ul_config_init_tx_params_test_gen = [](nfapi_ul_config_initial_transmission_parameters& initial_transmission_parameters)
- {
- initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
- initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = rand_range(0, 1);
- initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rand_range(1, 100);
- };
-
- auto ul_config_harqinfo_test_gen = [](nfapi_ul_config_ulsch_harq_information& harq_information)
- {
- harq_information.harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
- harq_information.harq_information_rel10.harq_size = rand_range(0, 21);
- harq_information.harq_information_rel10.delta_offset_harq = rand_range(0, 15);
- harq_information.harq_information_rel10.ack_nack_mode = rand_range(0, 5);
- harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG;
- harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 21);
- harq_information.harq_information_rel13.delta_offset_harq_2 = rand_range(0, 15);
- };
+ addr.sin_addr.s_addr = INADDR_ANY;
- auto ul_config_sr_info_test_gen = [](nfapi_ul_config_sr_information& sr_info)
- {
- sr_info.sr_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG;
- sr_info.sr_information_rel8.pucch_index = rand_range(0, 2047);
- sr_info.sr_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG;
- sr_info.sr_information_rel10.number_of_pucch_resources = rand_range(1, 2);
- sr_info.sr_information_rel10.pucch_index_p1 = rand_range(0, 2047);
- };
-
- auto ul_config_ue_info_test_gen = [](nfapi_ul_config_ue_information& ue_information)
- {
- ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
- ue_information.ue_information_rel8.handle = rand_range(0, 99999);
- ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
- ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
- ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
- ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
- ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
- ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
- ue_information.ue_information_rel13.empty_symbols = rand_range(0, 2);
- ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
- ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
- };
-
- auto ul_config_cqi_info_test_gen = [](nfapi_ul_config_cqi_information& cqi_information)
- {
- cqi_information.cqi_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG;
- cqi_information.cqi_information_rel8.pucch_index = rand_range(0, 1184);
- cqi_information.cqi_information_rel8.dl_cqi_pmi_size = rand_range(0, 255);
- cqi_information.cqi_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG;
- cqi_information.cqi_information_rel10.number_of_pucch_resource = rand_range(1, 2);
- cqi_information.cqi_information_rel10.pucch_index_p1 = rand_range(0, 1184);
- cqi_information.cqi_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG;
- cqi_information.cqi_information_rel13.csi_mode = rand_range(0, 2);
- cqi_information.cqi_information_rel13.dl_cqi_pmi_size_2 = rand_range(0, 999);
- cqi_information.cqi_information_rel13.starting_prb = rand_range(0, 109);
- cqi_information.cqi_information_rel13.n_prb = rand_range(0, 7);
- cqi_information.cqi_information_rel13.cdm_index = rand_range(0, 1);
- cqi_information.cqi_information_rel13.n_srs = rand_range(0, 1);
- };
-
- auto ul_config_harq_info_test_gen = [](nfapi_ul_config_harq_information& harq_information)
- {
- harq_information.harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
- harq_information.harq_information_rel10_tdd.harq_size = rand_range(0, 21);
- harq_information.harq_information_rel10_tdd.ack_nack_mode = rand_range(0, 5);
- harq_information.harq_information_rel10_tdd.number_of_pucch_resources = rand_range(0, 4);
- harq_information.harq_information_rel10_tdd.n_pucch_1_0 = rand_range(0, 2047);
- harq_information.harq_information_rel10_tdd.n_pucch_1_1 = rand_range(0, 2047);
- harq_information.harq_information_rel10_tdd.n_pucch_1_2 = rand_range(0, 2047);
- harq_information.harq_information_rel10_tdd.n_pucch_1_3 = rand_range(0, 2047);
- harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
- harq_information.harq_information_rel8_fdd.n_pucch_1_0 = rand_range(0, 2047);
- harq_information.harq_information_rel8_fdd.harq_size = rand_range(1, 2);
- harq_information.harq_information_rel9_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
- harq_information.harq_information_rel9_fdd.harq_size = rand_range(1, 10);
- harq_information.harq_information_rel9_fdd.ack_nack_mode = rand_range(0, 4);
- harq_information.harq_information_rel9_fdd.number_of_pucch_resources = rand_range(0, 4);
- harq_information.harq_information_rel9_fdd.n_pucch_1_0 = rand_range(0, 2047);
- harq_information.harq_information_rel9_fdd.n_pucch_1_1 = rand_range(0, 2047);
- harq_information.harq_information_rel9_fdd.n_pucch_1_2 = rand_range(0, 2047);
- harq_information.harq_information_rel9_fdd.n_pucch_1_3 = rand_range(0, 2047);
- harq_information.harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
- harq_information.harq_information_rel11.num_ant_ports = rand_range(1, 2);
- harq_information.harq_information_rel11.n_pucch_2_0 = rand_range(0, 2047);
- harq_information.harq_information_rel11.n_pucch_2_1 = rand_range(0, 2047);
- harq_information.harq_information_rel11.n_pucch_2_2 = rand_range(0, 2047);
- harq_information.harq_information_rel11.n_pucch_2_3 = rand_range(0, 2047);
- harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG;
- harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 999);
- harq_information.harq_information_rel13.starting_prb = rand_range(0, 109);
- harq_information.harq_information_rel13.n_prb = rand_range(0, 7);
- harq_information.harq_information_rel13.cdm_index = rand_range(0, 1);
- harq_information.harq_information_rel13.n_srs = rand_range(0, 1);
- };
-
-
- ul_config_pdus[0].pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[0].ulsch_pdu);
+ if(bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0) {
+ printf("[MAC] Failed to bind to %u\n", rx_port);
+ close(instance->rx_sock);
+ return;
+ }
- ul_config_pdus[1].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.ulsch_pdu);
- ul_config_cqi_ri_info_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.cqi_ri_information);
- ul_config_init_tx_params_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.initial_transmission_parameters);
-
- ul_config_pdus[2].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[2].ulsch_harq_pdu.ulsch_pdu);
- ul_config_harqinfo_test_gen(ul_config_pdus[2].ulsch_harq_pdu.harq_information);
- ul_config_init_tx_params_test_gen(ul_config_pdus[2].ulsch_harq_pdu.initial_transmission_parameters);
-
- ul_config_pdus[3].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.ulsch_pdu);
- ul_config_cqi_ri_info_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.cqi_ri_information);
- ul_config_harqinfo_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.harq_information);
- ul_config_init_tx_params_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters);
-
-
- ul_config_pdus[4].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.ue_information);
- ul_config_cqi_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.cqi_information);
-
- ul_config_pdus[5].pdu_type = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[5].uci_sr_pdu.ue_information);
- ul_config_sr_info_test_gen(ul_config_pdus[5].uci_sr_pdu.sr_information);
-
-
- ul_config_pdus[6].pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[6].uci_harq_pdu.ue_information);
- ul_config_harq_info_test_gen(ul_config_pdus[6].uci_harq_pdu.harq_information);
-
-
- ul_config_pdus[7].pdu_type = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.ue_information);
- ul_config_sr_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.sr_information);
- ul_config_harq_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.harq_information);
-
- ul_config_pdus[8].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.ue_information);
- ul_config_cqi_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.cqi_information);
- ul_config_harq_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.harq_information);
-
- ul_config_pdus[9].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.ue_information);
- ul_config_cqi_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.cqi_information);
- ul_config_sr_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.sr_information);
-
- ul_config_pdus[10].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.ue_information);
- ul_config_cqi_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.cqi_information);
- ul_config_sr_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.sr_information);
- ul_config_harq_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.harq_information);
-
- ul_config_pdus[11].pdu_type = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG;
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.handle = rand_range(0, 9999);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.size = rand_range(1, 999);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.rnti = rand_range(1, 65535);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_bandwidth = rand_range(0, 3);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.frequency_domain_position = rand_range(0, 23);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth = rand_range(0, 3);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.transmission_comb = rand_range(0, 3);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.i_srs = rand_range(0, 1023);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = rand_range(0, 11);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG;
- ul_config_pdus[11].srs_pdu.srs_pdu_rel10.antenna_port = rand_range(0, 2);
- ul_config_pdus[11].srs_pdu.srs_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG;
- ul_config_pdus[11].srs_pdu.srs_pdu_rel13.number_of_combs = rand_range(0, 1);
-
- ul_config_pdus[12].pdu_type = NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE;
- ul_config_ue_info_test_gen(ul_config_pdus[12].harq_buffer_pdu.ue_information);
-
- ul_config_pdus[13].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.ulsch_pdu);
- ul_config_cqi_info_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.csi_information);
-
- ul_config_pdus[14].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.ulsch_pdu);
- ul_config_harq_info_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.harq_information);
-
- ul_config_pdus[15].pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE;
- ul_config_ulsch_pdu_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.ulsch_pdu);
- ul_config_cqi_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.csi_information);
- ul_config_harq_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.harq_information);
-
- ul_config_pdus[16].pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nulsch_format = rand_range(0, 1);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.handle = rand_range(0, 0xFFFF);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.size = rand_range(0, 65535);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.rnti = rand_range(1, 65535);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = rand_range(0, 47);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.resource_assignment = rand_range(0, 7);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.mcs = rand_range(0, 12);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.redudancy_version = rand_range(0, 1);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.repetition_number = rand_range(0, 7);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.new_data_indication = rand_range(0, 1);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.n_srs = rand_range(0, 1);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.sf_idx = rand_range(0, 40960);
-
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.handle = rand_range(0, 0xFF);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.empty_symbols = rand_range(0, 0x3);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
-
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG;
- ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource = rand_range(0, 15);
-
- ul_config_pdus[17].pdu_type = NFAPI_UL_CONFIG_NRACH_PDU_TYPE;
- ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG;
- ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_0 = rand_range(0, 1);
- ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_1 = rand_range(0, 1);
- ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_2 = rand_range(0, 1);
-
- ul_config_req.ul_config_request_body.ul_config_pdu_list = ul_config_pdus;
- mac->ul_config_req(mac, &ul_config_req);
-
-
- uint8_t num_dci_pdus = 4;
- uint8_t num_hi_pdus = 1;
- nfapi_hi_dci0_request_pdu_t hi_dci0_pdus[num_dci_pdus + num_hi_pdus];
- memset(&hi_dci0_pdus, 0, sizeof(hi_dci0_pdus));
-
- nfapi_hi_dci0_request_t hi_dci0_req;
- memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
- hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
- hi_dci0_req.header.phy_id = phy_id;
- hi_dci0_req.sfn_sf = sfn_sf;
-
- hi_dci0_req.hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
- hi_dci0_req.hi_dci0_request_body.sfnsf = sfn_sf;
- hi_dci0_req.hi_dci0_request_body.number_of_dci = num_dci_pdus;
- hi_dci0_req.hi_dci0_request_body.number_of_hi = num_hi_pdus;
-
- hi_dci0_pdus[0].pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.resource_block_start = rand_range(0, 100);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.hi_value = rand_range(0, 1);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.i_phich = rand_range(0, 1);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.transmission_power = rand_range(0, 10000);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG;
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.flag_tb2 = rand_range(0, 1);
- hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.hi_value_2 = rand_range(0, 1);
-
- hi_dci0_pdus[1].pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dci_format = rand_range(0, 4);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cce_index = rand_range(0, 88);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.aggregation_level = rand_range(1, 8);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.rnti = rand_range(1, 65535);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.resource_block_start = rand_range(0, 100);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.mcs_1 = rand_range(0, 31);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc = rand_range(0, 3);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ul_index = rand_range(0, 3);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.transmission_power = rand_range(0, 10000);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG;
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_flag = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_request = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.mcs_2 = rand_range(0, 31);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tpmi = rand_range(0, 63);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.n_ul_rb = rand_range(6, 100);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG;
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.pscch_resource = rand_range(0, 16);
- hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.time_resource_pattern = rand_range(0, 32);
-
-
- hi_dci0_pdus[2].pdu_type = NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE;
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG;
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dci_format = rand_range(0, 4);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cce_index = rand_range(0, 88);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.aggregation_level = rand_range(1, 8);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.rnti = rand_range(1, 65535);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.resource_block_start = rand_range(0, 100);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.mcs_1 = rand_range(0, 31);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc = rand_range(0, 3);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ul_index = rand_range(0, 3);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.transmission_power = rand_range(0, 10000);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG;
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_flag = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_request = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.mcs_2 = rand_range(0, 31);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tpmi = rand_range(0, 63);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.n_ul_rb = rand_range(6, 100);
- hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_parameters_rel11.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG;
-
- hi_dci0_pdus[3].pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
- hi_dci0_pdus[3].mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG;
-
- hi_dci0_pdus[4].pdu_type = NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE;
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG;
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.ncce_index = rand_range(0, 1);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level = rand_range(1, 2);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol = rand_range(0, 4);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti = rand_range(1, 65535);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication = rand_range(0, 63);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.resource_assignment = rand_range(0, 7);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay = rand_range(0, 3);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs = rand_range(0, 12);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version = rand_range(0, 1);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number = rand_range(0, 7);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator = rand_range(0, 1);
- hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number = rand_range(0, 3);
-
- hi_dci0_req.hi_dci0_request_body.hi_dci0_pdu_list = hi_dci0_pdus;
- mac->hi_dci0_req(mac, &hi_dci0_req);
-
- uint8_t num_tx_pdus = 2;
- nfapi_tx_request_pdu_t tx_pdus[num_tx_pdus];
- memset(&tx_pdus, 0, sizeof(tx_pdus));
-
- nfapi_tx_request_t tx_req;
- memset(&tx_req, 0, sizeof(tx_req));
- tx_req.header.message_id = NFAPI_TX_REQUEST;
- tx_req.header.phy_id = phy_id;
- tx_req.sfn_sf = sfn_sf;
-
- tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
- tx_req.tx_request_body.number_of_pdus = num_tx_pdus;
-
- uint32_t data[2];
- data[0] = 0x11223344;
- data[1] = 0x55667788;
-
- tx_pdus[0].pdu_length = 8;
- tx_pdus[0].pdu_index = 1;
- tx_pdus[0].num_segments = 2;
- tx_pdus[0].segments[0].segment_length = 4;
- tx_pdus[0].segments[0].segment_data = (uint8_t*)&data[0];
- tx_pdus[0].segments[1].segment_length = 4;
- tx_pdus[0].segments[1].segment_data = (uint8_t*)&data[1];
-
- tx_pdus[1].pdu_length = 8;
- tx_pdus[1].pdu_index = 2;
- tx_pdus[1].num_segments = 2;
- tx_pdus[1].segments[0].segment_length = 4;
- tx_pdus[1].segments[0].segment_data = (uint8_t*)&data[0];
- tx_pdus[1].segments[1].segment_length = 4;
- tx_pdus[1].segments[1].segment_data = (uint8_t*)&data[1];
-
-
- tx_req.tx_request_body.tx_pdu_list = tx_pdus;
- mac->tx_req(mac, &tx_req);
- }
-
- void generate_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)
- {
- mac_internal_t* instance = (mac_internal_t*)mac;
-
- nfapi_dl_config_request_t dl_config_req;
- memset(&dl_config_req, 0, sizeof(dl_config_req));
- dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
- dl_config_req.header.phy_id = phy_id;
- dl_config_req.sfn_sf = sfn_sf;
-
- dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
- dl_config_req.dl_config_request_body.number_pdu = 8;
-
- nfapi_dl_config_request_pdu_t pdus[8];
- memset(&pdus, 0, sizeof(pdus));
- for(int i = 0; i < 8; i++)
- {
- pdus[i].pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE;
-
- pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
- pdus[i].bch_pdu.bch_pdu_rel8.length = 42;
- pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = i;
- pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = 56;
-
- }
-
- dl_config_req.dl_config_request_body.dl_config_pdu_list = pdus;
-
- /*
- vendor_ext_tlv_1 ve;
- ve.tl.tag = VENDOR_EXT_TLV_1_TAG;
- ve.dummy = 999;
- dl_config_req.vendor_extension = &ve.tl;
- */
-
- mac->dl_config_req(mac, &dl_config_req);
-
-
- nfapi_ul_config_request_t ul_config_req;
- memset(&ul_config_req, 0, sizeof(ul_config_req));
- ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
- ul_config_req.header.phy_id = phy_id;
- ul_config_req.sfn_sf = sfn_sf;
- mac->ul_config_req(mac, &ul_config_req);
-
- nfapi_hi_dci0_request_t hi_dci0_req;
- memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
- hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
- hi_dci0_req.header.phy_id = phy_id;
- hi_dci0_req.sfn_sf = sfn_sf;
- mac->hi_dci0_req(mac, &hi_dci0_req);
+ pthread_t mac_rx_thread;
+ pthread_create(&mac_rx_thread, NULL, &mac_rx_thread_start, instance);
+ instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
+ instance->tx_addr.sin_family = AF_INET;
+ instance->tx_addr.sin_port = htons(tx_port);
+ instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
+ }
- nfapi_tx_request_t tx_req;
- memset(&tx_req, 0, sizeof(tx_req));
- tx_req.header.message_id = NFAPI_TX_REQUEST;
- tx_req.header.phy_id = phy_id;
- tx_req.sfn_sf = sfn_sf;
+ void generate_test_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf) {
+ //mac_internal_t* instance = (mac_internal_t*)mac;
+ uint8_t max_num_dl_pdus = 50;
+ nfapi_dl_config_request_pdu_t dl_config_pdus[max_num_dl_pdus];
+ memset(&dl_config_pdus, 0, sizeof(dl_config_pdus));
+ nfapi_dl_config_request_t dl_config_req;
+ memset(&dl_config_req, 0, sizeof(dl_config_req));
+ dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+ dl_config_req.header.phy_id = phy_id;
+ dl_config_req.sfn_sf = sfn_sf;
+ dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+ dl_config_req.dl_config_request_body.number_pdu = rand_range(4, max_num_dl_pdus);
+ uint16_t i = 0;
- nfapi_tx_request_pdu_t tx_pdus[8];
+ for(i = 0; i < dl_config_req.dl_config_request_body.number_pdu; ++i) {
+ dl_config_pdus[i].pdu_type = rand_range(0, 11);
- tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
- tx_req.tx_request_body.number_of_pdus = 0;
- tx_req.tx_request_body.tx_pdu_list = &tx_pdus[0];
+ switch(dl_config_pdus[i].pdu_type) {
+ case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: {
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.dci_format = rand_range(0, 9);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx = rand_range(0, 255);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = rand_range(0, 32);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_allocation_type = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = rand_range(0, 320000);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = rand_range(0, 31);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = rand_range(0, 31);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.harq_process = rand_range(0, 31);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpmi = rand_range(0, 15);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.pmi = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.precoding_information = rand_range(0, 63);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.tpc = rand_range(0, 3);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.ngap = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transport_block_size_index = rand_range(0, 31);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.downlink_power_offset = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.preamble_index = rand_range(0, 63);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.prach_mask_index = rand_range(0, 15);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = rand_range(0, 3);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.mcch_change_notification = rand_range(0, 255);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel9.scrambling_identity = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.carrier_indicator = rand_range(0, 7);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.srs_request = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel10.n_dl_rb = rand_range(0, 100);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.primary_cell_type = rand_range(0, 2);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.number_ul_dl_configurations = 2;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.codebook_size_determination = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.drms_table_flag = rand_range(0, 1);
- mac_pdu* buff = 0;
- int i = 0;
- std::list free_list;
- do
- {
- buff = instance->mac->pop_rx_buffer();
- if(buff != 0)
- {
- if(buff->len == 0)
- {
- printf("[MAC] Buffer length = 0\n");
- }
+ // if the tpm extention is present of not.
+ if(rand_range(0, 1)) {
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = rand_range(0, 1);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_prb_per_subband = rand_range(0, 8);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands = rand_range(0, 13);
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas = 1; // rand_range(0, 8);
- tx_req.tx_request_body.tx_pdu_list[i].pdu_length = buff->len;
- tx_req.tx_request_body.tx_pdu_list[i].pdu_index = i;
- tx_req.tx_request_body.tx_pdu_list[i].num_segments = 1;
- tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = buff->len;
- tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_data = (uint8_t*)buff->buffer;
+ for(int j = 0; j < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.number_of_subbands; ++j) {
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].subband_index = j;
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues = 1; //rand_range(1, 4);
- tx_req.tx_request_body.number_of_pdus++;
- i++;
+ for(int k = 0; k < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.num_antennas; ++k)
+ for(int l = 0; l < dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].scheduled_ues; ++l)
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm.subband_info[j].precoding_value[k][l] = rand_range(0, 65535);
+ }
+ } else {
+ dl_config_pdus[i].dci_dl_pdu.dci_dl_pdu_rel13.tpm_struct_flag = 0;
+ }
+ }
+ break;
- instance->mac->byte_count += buff->len;
+ case NFAPI_DL_CONFIG_BCH_PDU_TYPE: {
+ dl_config_pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+ dl_config_pdus[i].bch_pdu.bch_pdu_rel8.length = rand_range(0, 42);
+ dl_config_pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = rand_range(0, 10000);
+ }
+ break;
- free_list.push_back(buff);
- }
- }while(buff != 0 && i < 8);
+ case NFAPI_DL_CONFIG_MCH_PDU_TYPE: {
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG;
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.length = rand_range(0, 42);
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.rnti = 0xFFFD;
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_allocation_type = 0;
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.resource_block_coding = 0;
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.modulation = rand_range(0, 8);
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].mch_pdu.mch_pdu_rel8.mbsfn_area_id = rand_range(0, 255);
+ }
+ break;
- mac->tx_req(mac, &tx_req);
+ case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: {
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.length = rand_range(0, 42);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.rnti = rand_range(1, 65535);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = rand_range(0, 5);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = rand_range(0, 32000);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.modulation = rand_range(2, 8);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rand_range(0, 3);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_blocks = rand_range(1, 2);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = rand_range(0, 13);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_layers = rand_range(1, 8);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 2; //rand_range(0, 13);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[0] = rand_range(0, 15);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.codebook_index[1] = rand_range(0, 15);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.pa = rand_range(0, 7);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.ngap = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.nprb = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.transmission_mode = rand_range(1, 10);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 2; //rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 2; //rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].subband_index = rand_range(0, 4);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].num_antennas = 1;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[0].bf_value[0] = rand_range(0, 128);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].subband_index = rand_range(0, 4);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].num_antennas = 1;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel8.bf_vector[1].bf_value[0] = rand_range(0, 128);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel9.nscid = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config_r10 = 0;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 65535);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_number_nzp_configuration = 1;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel10.pdsch_start = rand_range(0, 4);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_config_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.drms_scrambling = rand_range(0, 503);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_config_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.csi_scrambling = rand_range(0, 503);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_flag = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_atenna_ports = rand_range(1,4);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel11.pdsch_re_mapping_freq_shift = rand_range(0, 5);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG;
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.altcqi_table_r12 = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.maxlayers = rand_range(1, 8);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel12.n_dl_harq = rand_range(0, 255);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.dwpts_symbols = rand_range(3, 14);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.ue_type = rand_range(0, 2);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = rand_range(0, 2);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+ dl_config_pdus[i].dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = rand_range(0, 1);
+ }
+ break;
- //for(int j = 0; j < tx_req.tx_request_body.number_of_pdus; ++j)
- for(mac_pdu* pdu : free_list)
- {
- instance->mac->release_mac_pdu(pdu);
- //free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
- }
- }
-
- void mac_subframe_ind(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf)
- {
+ case NFAPI_DL_CONFIG_PCH_PDU_TYPE: {
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.length = rand_range(0, 42);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.p_rnti = 0xFFFE;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_allocation_type = rand_range(2, 6);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.resource_block_coding = rand_range(0, 34000);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.mcs = 0;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_transport_blocks = 1;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_scheme = rand_range(1, 6);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.number_of_layers = rand_range(1, 4);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.codebook_index = 0;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ue_category_capacity = rand_range(0, 14);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.pa = rand_range(0, 7);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.nprb = rand_range(0, 1);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel8.ngap = rand_range(0, 1);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG;
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel13.ue_mode = rand_range(0, 1);
+ dl_config_pdus[i].pch_pdu.pch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+ }
+ break;
-
- //printf("[MAC] subframe indication phyid:%d sfnsf:%d\n", phy_id, sfn_sf);
- mac_internal_t* instance = (mac_internal_t*)mac;
+ case NFAPI_DL_CONFIG_PRS_PDU_TYPE: {
+ dl_config_pdus[i].prs_pdu.prs_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG;
+ dl_config_pdus[i].prs_pdu.prs_pdu_rel9.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_bandwidth = rand_range(6, 100);
+ dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_cyclic_prefix_type = rand_range(0, 1);
+ dl_config_pdus[i].prs_pdu.prs_pdu_rel9.prs_muting = rand_range(0, 1);
+ }
+ break;
- if(instance->mac->tick == 1000)
- {
- if(instance->mac->byte_count > 0)
- {
- printf("[MAC] Rx rate %d bytes/sec\n", instance->mac->byte_count);
- instance->mac->byte_count = 0;
- }
- instance->mac->tick = 0;
- }
- instance->mac->tick++;
-
- if(instance->mac->wireshark_test_mode)
- {
- generate_test_subframe(mac, phy_id, sfn_sf);
- }
- else
- {
- generate_subframe(mac, phy_id, sfn_sf);
- }
- }
-
- void mac_harq_ind(mac_t* mac, nfapi_harq_indication_t* ind)
- {
- }
- void mac_crc_ind(mac_t* mac, nfapi_crc_indication_t* ind)
- {
- }
- void mac_rx_ind(mac_t* mac, nfapi_rx_indication_t* ind)
- {
- mac_internal_t* instance = (mac_internal_t*)mac;
+ case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: {
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG;
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_antenna_port_count_r10 = rand_range(1, 16);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config_r10 = 0;
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_zero_tx_power_resource_config_bitmap_r10 = rand_range(0, 8);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_number_of_nzp_configuration = 2;
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[0] = rand_range(0, 31);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel10.csi_rs_resource_config[1] = rand_range(0, 31);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG;
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.csi_rs_class = rand_range(0, 2);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.cdm_type = rand_range(0, 1);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.num_bf_vector = 0; // set to zero as not clear how to handle bf value array
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].csi_rs_resource_index = rand_range(0, 7);
+ dl_config_pdus[i].csi_rs_pdu.csi_rs_pdu_rel13.bf_vector[0].bf_value[0] = 42;
+ }
+ break;
- for(int i = 0; i < ind->rx_indication_body.number_of_pdus; ++i)
- {
- uint16_t len = ind->rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length;
- uint8_t* data = ind->rx_indication_body.rx_pdu_list[i].data;
- //printf("[MAC] sfnsf:%d len:%d\n", ind->sfn_sf,len);
- //
- instance->tx_byte_count += len;
+ case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: {
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.dci_format = rand_range(0, 9);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.cce_idx = rand_range(0, 255);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.aggregation_level = rand_range(0, 32);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti = rand_range(0, (uint16_t)-1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_allocation_type = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.virtual_resource_block_assignment_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.resource_block_coding = rand_range(0, 320000);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_1 = rand_range(0, 31);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_1 = rand_range(0, 3);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_1 = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_to_codeword_swap_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.mcs_2 = rand_range(0, 31);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.redundancy_version_2 = rand_range(0, 31);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.new_data_indicator_2 = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.harq_process = rand_range(0, 31);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpmi = rand_range(0, 15);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.pmi = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.precoding_information = rand_range(0, 63);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.tpc = rand_range(0, 3);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_assignment_index = rand_range(0, 15);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.ngap = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transport_block_size_index = rand_range(0, 31);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.downlink_power_offset = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.allocate_prach_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.preamble_index = rand_range(0, 63);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.prach_mask_index = rand_range(0, 15);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.rnti_type = rand_range(0, 3);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel8.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.mcch_change_notification = rand_range(0, 255);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel9.scrambling_identity = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.carrier_indicator = rand_range(0, 7);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.srs_request = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.antenna_ports_scrambling_and_layers = rand_range(0, 15);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel10.n_dl_rb = rand_range(0, 100);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.harq_ack_resource_offset = rand_range(0, 3);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel11.pdsch_re_mapping_quasi_co_location_indicator = rand_range(0, 3);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.primary_cell_type = rand_range(0, 2);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.number_ul_dl_configurations = 2;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[0] = rand_range(1, 5);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel12.ul_dl_configuration_indication[1] = rand_range(1, 5);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.laa_end_partial_sf_configuration = rand_range(0, 255);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.initial_lbt_sf = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.codebook_size_determination = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_pdu_rel13.drms_table_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_resource_assignment_flag = rand_range(0, 1);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_id = rand_range(0, 503);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_start_symbol = rand_range(1, 4);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb = rand_range(2, 8);
- int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr*)&(instance->tx_addr), sizeof(instance->tx_addr));
-
- if(sendto_result < 0)
- {
- // error
- }
- }
+ for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_prb_index[j] = rand_range(0, 99);
- }
- void mac_rach_ind(mac_t* mac, nfapi_rach_indication_t* ind)
- {
- }
- void mac_srs_ind(mac_t* mac, nfapi_srs_indication_t* ind)
- {
- }
- void mac_sr_ind(mac_t* mac, nfapi_sr_indication_t* ind)
- {
- }
- void mac_cqi_ind(mac_t* mac, nfapi_cqi_indication_t* ind)
- {
- }
- void mac_lbt_dl_ind(mac_t* mac, nfapi_lbt_dl_indication_t* ind)
- {
- }
- void mac_nb_harq_ind(mac_t* mac, nfapi_nb_harq_indication_t* ind)
- {
- }
- void mac_nrach_ind(mac_t* mac, nfapi_nrach_indication_t* ind)
- {
- }
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.subband_index = rand_range(0, 25);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.num_antennas= rand_range(1, 4);
+
+ for(int j = 0; j < dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.epdcch_num_prb; ++j)
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel11.bf_vector.bf_value[j] = rand_range(0, 65535);
+
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG;
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.dwpts_symbols = rand_range(3, 14);
+ dl_config_pdus[i].epdcch_pdu.epdcch_params_rel13.initial_lbt_sf = rand_range(0, 1);
+ }
+ break;
+
+ case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: {
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = rand_range(2, 6);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = rand_range(0, 14);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = rand_range(1, 4);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = rand_range(0, 22);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = rand_range(2, 24);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = rand_range(0, 4);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.rnti = rand_range(1, 65535);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = rand_range(1, 2);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = rand_range(0, 503);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_format = rand_range(10, 12);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = rand_range(0, 0xFFFF);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.mcs = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = rand_range(1, 8);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = rand_range(0, 3);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_process = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = rand_range(0, 4);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpmi = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.pmi = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = rand_range(0, 3);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rand_range(1, 4);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.tpc = rand_range(0, 3);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = rand_range(0, 4);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = rand_range(0, 63);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = rand_range(0, 15);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = rand_range(0, 3);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.srs_request = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = rand_range(0, 3);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = rand_range(0, 255);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 1);
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = rand_range(0, 8);
+
+ for(int j = 0 ; j < dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports; ++j)
+ dl_config_pdus[i].mpdcch_pdu.mpdcch_pdu_rel13.precoding_value[j] = rand_range(0, 65535);
+ }
+ break;
+
+ case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: {
+ dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG;
+ dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.length = rand_range(0, 5555);
+ dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.transmission_power = rand_range(0, 10000);
+ dl_config_pdus[i].nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs = rand_range(0, 3);
+ }
+ break;
+
+ case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: {
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG;
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.length = rand_range(0, 5555);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.ncce_index = rand_range(0, 1);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.aggregation_level = rand_range(1, 2);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.start_symbol = rand_range(0, 4);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti_type = rand_range(0, 3);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.rnti = rand_range(1, 65535);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_format = rand_range(0, 1);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay = rand_range(0, 7);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.resource_assignment = rand_range(0, 7);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.repetition_number = rand_range(0, 15);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.mcs = rand_range(0, 13);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator = rand_range(0, 1);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = rand_range(0, 15);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = rand_range(0, 1);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.starting_number_of_nprach_repetitions = rand_range(0, 3);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.subcarrier_indication_of_nprach = rand_range(0, 63);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.paging_direct_indication_differentation_flag = rand_range(0, 1);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.direct_indication = rand_range(0, 255);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = rand_range(0, 7);
+ dl_config_pdus[i].npdcch_pdu.npdcch_pdu_rel13.total_dci_length_including_padding = rand_range(0, 255);
+ }
+ break;
+
+ case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: {
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG;
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.length = rand_range(0, 5555);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.pdu_index = rand_range(0, 65535);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.start_symbol = rand_range(0, 4);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti_type = rand_range(0, 1);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.rnti = rand_range(1, 65535);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.resource_assignment = rand_range(0, 7);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.repetition_number = rand_range(0, 15);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment = rand_range(1, 10);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.sf_idx = rand_range(1, 10240);
+ dl_config_pdus[i].ndlsch_pdu.ndlsch_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+ }
+ break;
+ };
+ }
+
+ dl_config_req.dl_config_request_body.dl_config_pdu_list = dl_config_pdus;
+ mac->dl_config_req(mac, &dl_config_req);
+ uint8_t num_ul_pdus = 18;
+ nfapi_ul_config_request_pdu_t ul_config_pdus[num_ul_pdus];
+ memset(&ul_config_pdus, 0, sizeof(ul_config_pdus));
+ nfapi_ul_config_request_t ul_config_req;
+ memset(&ul_config_req, 0, sizeof(ul_config_req));
+ ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+ ul_config_req.header.phy_id = phy_id;
+ ul_config_req.sfn_sf = sfn_sf;
+ ul_config_req.ul_config_request_body.tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
+ ul_config_req.ul_config_request_body.number_of_pdus = num_ul_pdus;
+ ul_config_req.ul_config_request_body.rach_prach_frequency_resources = rand_range(0, 255);
+ ul_config_req.ul_config_request_body.srs_present = rand_range(0, 1);
+ auto ul_config_ulsch_pdu_test_gen = [](nfapi_ul_config_ulsch_pdu& ulsch_pdu) {
+ ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
+ ulsch_pdu.ulsch_pdu_rel8.handle = rand_range(0, 50000);
+ ulsch_pdu.ulsch_pdu_rel8.size = rand_range(0, 32000);
+ ulsch_pdu.ulsch_pdu_rel8.rnti = rand_range(1, 65535);
+ ulsch_pdu.ulsch_pdu_rel8.resource_block_start = rand_range(0, 99);
+ ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = rand_range(1, 100);
+ ulsch_pdu.ulsch_pdu_rel8.modulation_type = rand_range(2, 6);
+ ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+ ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+ ulsch_pdu.ulsch_pdu_rel8.new_data_indication = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel8.redundancy_version = rand_range(0, 3);
+ ulsch_pdu.ulsch_pdu_rel8.harq_process_number = rand_range(0, 15);
+ ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = rand_range(0, 5);
+ ulsch_pdu.ulsch_pdu_rel8.n_srs = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG;
+ ulsch_pdu.ulsch_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel10.resource_block_coding = rand_range(0, 35000);
+ ulsch_pdu.ulsch_pdu_rel10.transport_blocks = rand_range(1, 2);
+ ulsch_pdu.ulsch_pdu_rel10.transmission_scheme = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel10.number_of_layers = rand_range(1, 4);
+ ulsch_pdu.ulsch_pdu_rel10.codebook_index = rand_range(0, 23);
+ ulsch_pdu.ulsch_pdu_rel10.disable_sequence_hopping_flag = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG;
+ ulsch_pdu.ulsch_pdu_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel11.npusch_identity = rand_range(0, 509);
+ ulsch_pdu.ulsch_pdu_rel11.dmrs_config_flag = rand_range(0, 1);
+ ulsch_pdu.ulsch_pdu_rel11.ndmrs_csh_identity = rand_range(0, 509);
+ ulsch_pdu.ulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
+ ulsch_pdu.ulsch_pdu_rel13.ue_type = rand_range(0, 2);
+ ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = rand_range(1, 2048);
+ ulsch_pdu.ulsch_pdu_rel13.repetition_number = rand_range(1, 2048);
+ ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = rand_range(0, 10239);
+ ulsch_pdu.ulsch_pdu_rel13.empty_symbols_due_to_re_tunning = rand_range(0, 8);
+ };
+ auto ul_config_cqi_ri_info_test_gen = [](nfapi_ul_config_cqi_ri_information& cqi_ri_information) {
+ cqi_ri_information.cqi_ri_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG;
+ cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_1 = rand_range(0, 255);
+ cqi_ri_information.cqi_ri_information_rel8.dl_cqi_pmi_size_rank_greater_1 = rand_range(0, 255);
+ cqi_ri_information.cqi_ri_information_rel8.ri_size = rand_range(0, 3);
+ cqi_ri_information.cqi_ri_information_rel8.delta_offset_cqi = rand_range(0, 15);
+ cqi_ri_information.cqi_ri_information_rel8.delta_offset_ri = rand_range(0, 15);
+ cqi_ri_information.cqi_ri_information_rel9.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG;
+ cqi_ri_information.cqi_ri_information_rel9.report_type = 1; // rand_range(0, 1);
+ cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = rand_range(0, 15);
+ cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = rand_range(0, 15);
+
+ if(cqi_ri_information.cqi_ri_information_rel9.report_type == 0) {
+ cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size = rand_range(0, 255);
+ cqi_ri_information.cqi_ri_information_rel9.periodic_cqi_pmi_ri_report.control_type = rand_range(0, 1);
+ } else {
+ cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1;
+ cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = rand_range(0, 3);
+ cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[0] = rand_range(0, 255);
+ }
+
+ cqi_ri_information.cqi_ri_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG;
+ cqi_ri_information.cqi_ri_information_rel13.report_type = rand_range(0, 1);
+
+ if(cqi_ri_information.cqi_ri_information_rel13.report_type == 0) {
+ cqi_ri_information.cqi_ri_information_rel13.periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2 = rand_range(255, 10000);
+ }
+ };
+ auto ul_config_init_tx_params_test_gen = [](nfapi_ul_config_initial_transmission_parameters& initial_transmission_parameters) {
+ initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
+ initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = rand_range(0, 1);
+ initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rand_range(1, 100);
+ };
+ auto ul_config_harqinfo_test_gen = [](nfapi_ul_config_ulsch_harq_information& harq_information) {
+ harq_information.harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
+ harq_information.harq_information_rel10.harq_size = rand_range(0, 21);
+ harq_information.harq_information_rel10.delta_offset_harq = rand_range(0, 15);
+ harq_information.harq_information_rel10.ack_nack_mode = rand_range(0, 5);
+ harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG;
+ harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 21);
+ harq_information.harq_information_rel13.delta_offset_harq_2 = rand_range(0, 15);
+ };
+ auto ul_config_sr_info_test_gen = [](nfapi_ul_config_sr_information& sr_info) {
+ sr_info.sr_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG;
+ sr_info.sr_information_rel8.pucch_index = rand_range(0, 2047);
+ sr_info.sr_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG;
+ sr_info.sr_information_rel10.number_of_pucch_resources = rand_range(1, 2);
+ sr_info.sr_information_rel10.pucch_index_p1 = rand_range(0, 2047);
+ };
+ auto ul_config_ue_info_test_gen = [](nfapi_ul_config_ue_information& ue_information) {
+ ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+ ue_information.ue_information_rel8.handle = rand_range(0, 99999);
+ ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
+ ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
+ ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+ ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
+ ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+ ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
+ ue_information.ue_information_rel13.empty_symbols = rand_range(0, 2);
+ ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
+ ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
+ };
+ auto ul_config_cqi_info_test_gen = [](nfapi_ul_config_cqi_information& cqi_information) {
+ cqi_information.cqi_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG;
+ cqi_information.cqi_information_rel8.pucch_index = rand_range(0, 1184);
+ cqi_information.cqi_information_rel8.dl_cqi_pmi_size = rand_range(0, 255);
+ cqi_information.cqi_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG;
+ cqi_information.cqi_information_rel10.number_of_pucch_resource = rand_range(1, 2);
+ cqi_information.cqi_information_rel10.pucch_index_p1 = rand_range(0, 1184);
+ cqi_information.cqi_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG;
+ cqi_information.cqi_information_rel13.csi_mode = rand_range(0, 2);
+ cqi_information.cqi_information_rel13.dl_cqi_pmi_size_2 = rand_range(0, 999);
+ cqi_information.cqi_information_rel13.starting_prb = rand_range(0, 109);
+ cqi_information.cqi_information_rel13.n_prb = rand_range(0, 7);
+ cqi_information.cqi_information_rel13.cdm_index = rand_range(0, 1);
+ cqi_information.cqi_information_rel13.n_srs = rand_range(0, 1);
+ };
+ auto ul_config_harq_info_test_gen = [](nfapi_ul_config_harq_information& harq_information) {
+ harq_information.harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
+ harq_information.harq_information_rel10_tdd.harq_size = rand_range(0, 21);
+ harq_information.harq_information_rel10_tdd.ack_nack_mode = rand_range(0, 5);
+ harq_information.harq_information_rel10_tdd.number_of_pucch_resources = rand_range(0, 4);
+ harq_information.harq_information_rel10_tdd.n_pucch_1_0 = rand_range(0, 2047);
+ harq_information.harq_information_rel10_tdd.n_pucch_1_1 = rand_range(0, 2047);
+ harq_information.harq_information_rel10_tdd.n_pucch_1_2 = rand_range(0, 2047);
+ harq_information.harq_information_rel10_tdd.n_pucch_1_3 = rand_range(0, 2047);
+ harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
+ harq_information.harq_information_rel8_fdd.n_pucch_1_0 = rand_range(0, 2047);
+ harq_information.harq_information_rel8_fdd.harq_size = rand_range(1, 2);
+ harq_information.harq_information_rel9_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG;
+ harq_information.harq_information_rel9_fdd.harq_size = rand_range(1, 10);
+ harq_information.harq_information_rel9_fdd.ack_nack_mode = rand_range(0, 4);
+ harq_information.harq_information_rel9_fdd.number_of_pucch_resources = rand_range(0, 4);
+ harq_information.harq_information_rel9_fdd.n_pucch_1_0 = rand_range(0, 2047);
+ harq_information.harq_information_rel9_fdd.n_pucch_1_1 = rand_range(0, 2047);
+ harq_information.harq_information_rel9_fdd.n_pucch_1_2 = rand_range(0, 2047);
+ harq_information.harq_information_rel9_fdd.n_pucch_1_3 = rand_range(0, 2047);
+ harq_information.harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
+ harq_information.harq_information_rel11.num_ant_ports = rand_range(1, 2);
+ harq_information.harq_information_rel11.n_pucch_2_0 = rand_range(0, 2047);
+ harq_information.harq_information_rel11.n_pucch_2_1 = rand_range(0, 2047);
+ harq_information.harq_information_rel11.n_pucch_2_2 = rand_range(0, 2047);
+ harq_information.harq_information_rel11.n_pucch_2_3 = rand_range(0, 2047);
+ harq_information.harq_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG;
+ harq_information.harq_information_rel13.harq_size_2 = rand_range(0, 999);
+ harq_information.harq_information_rel13.starting_prb = rand_range(0, 109);
+ harq_information.harq_information_rel13.n_prb = rand_range(0, 7);
+ harq_information.harq_information_rel13.cdm_index = rand_range(0, 1);
+ harq_information.harq_information_rel13.n_srs = rand_range(0, 1);
+ };
+ ul_config_pdus[0].pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[0].ulsch_pdu);
+ ul_config_pdus[1].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.ulsch_pdu);
+ ul_config_cqi_ri_info_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.cqi_ri_information);
+ ul_config_init_tx_params_test_gen(ul_config_pdus[1].ulsch_cqi_ri_pdu.initial_transmission_parameters);
+ ul_config_pdus[2].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[2].ulsch_harq_pdu.ulsch_pdu);
+ ul_config_harqinfo_test_gen(ul_config_pdus[2].ulsch_harq_pdu.harq_information);
+ ul_config_init_tx_params_test_gen(ul_config_pdus[2].ulsch_harq_pdu.initial_transmission_parameters);
+ ul_config_pdus[3].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.ulsch_pdu);
+ ul_config_cqi_ri_info_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.cqi_ri_information);
+ ul_config_harqinfo_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.harq_information);
+ ul_config_init_tx_params_test_gen(ul_config_pdus[3].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters);
+ ul_config_pdus[4].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.ue_information);
+ ul_config_cqi_info_test_gen(ul_config_pdus[4].uci_cqi_pdu.cqi_information);
+ ul_config_pdus[5].pdu_type = NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[5].uci_sr_pdu.ue_information);
+ ul_config_sr_info_test_gen(ul_config_pdus[5].uci_sr_pdu.sr_information);
+ ul_config_pdus[6].pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[6].uci_harq_pdu.ue_information);
+ ul_config_harq_info_test_gen(ul_config_pdus[6].uci_harq_pdu.harq_information);
+ ul_config_pdus[7].pdu_type = NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.ue_information);
+ ul_config_sr_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.sr_information);
+ ul_config_harq_info_test_gen(ul_config_pdus[7].uci_sr_harq_pdu.harq_information);
+ ul_config_pdus[8].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.ue_information);
+ ul_config_cqi_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.cqi_information);
+ ul_config_harq_info_test_gen(ul_config_pdus[8].uci_cqi_harq_pdu.harq_information);
+ ul_config_pdus[9].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.ue_information);
+ ul_config_cqi_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.cqi_information);
+ ul_config_sr_info_test_gen(ul_config_pdus[9].uci_cqi_sr_pdu.sr_information);
+ ul_config_pdus[10].pdu_type = NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.ue_information);
+ ul_config_cqi_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.cqi_information);
+ ul_config_sr_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.sr_information);
+ ul_config_harq_info_test_gen(ul_config_pdus[10].uci_cqi_sr_harq_pdu.harq_information);
+ ul_config_pdus[11].pdu_type = NFAPI_UL_CONFIG_SRS_PDU_TYPE;
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG;
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.handle = rand_range(0, 9999);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.size = rand_range(1, 999);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.rnti = rand_range(1, 65535);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_bandwidth = rand_range(0, 3);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.frequency_domain_position = rand_range(0, 23);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.srs_hopping_bandwidth = rand_range(0, 3);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.transmission_comb = rand_range(0, 3);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.i_srs = rand_range(0, 1023);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel8.sounding_reference_cyclic_shift = rand_range(0, 11);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG;
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel10.antenna_port = rand_range(0, 2);
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG;
+ ul_config_pdus[11].srs_pdu.srs_pdu_rel13.number_of_combs = rand_range(0, 1);
+ ul_config_pdus[12].pdu_type = NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE;
+ ul_config_ue_info_test_gen(ul_config_pdus[12].harq_buffer_pdu.ue_information);
+ ul_config_pdus[13].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.ulsch_pdu);
+ ul_config_cqi_info_test_gen(ul_config_pdus[13].ulsch_uci_csi_pdu.csi_information);
+ ul_config_pdus[14].pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.ulsch_pdu);
+ ul_config_harq_info_test_gen(ul_config_pdus[14].ulsch_uci_harq_pdu.harq_information);
+ ul_config_pdus[15].pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE;
+ ul_config_ulsch_pdu_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.ulsch_pdu);
+ ul_config_cqi_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.csi_information);
+ ul_config_harq_info_test_gen(ul_config_pdus[15].ulsch_csi_uci_harq_pdu.harq_information);
+ ul_config_pdus[16].pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nulsch_format = rand_range(0, 1);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.handle = rand_range(0, 0xFFFF);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.size = rand_range(0, 65535);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.rnti = rand_range(1, 65535);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = rand_range(0, 47);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.resource_assignment = rand_range(0, 7);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.mcs = rand_range(0, 12);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.redudancy_version = rand_range(0, 1);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.repetition_number = rand_range(0, 7);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.new_data_indication = rand_range(0, 1);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.n_srs = rand_range(0, 1);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.scrambling_sequence_initialization_cinit = rand_range(0, 65535);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.sf_idx = rand_range(0, 40960);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.handle = rand_range(0, 0xFF);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel8.rnti = rand_range(1, 65535);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.virtual_cell_id_enabled_flag = rand_range(0, 1);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel11.npusch_identity = rand_range(0, 503);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.ue_type = rand_range(0, 2);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.empty_symbols = rand_range(0, 0x3);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.total_number_of_repetitions = rand_range(1, 32);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.ue_information.ue_information_rel13.repetition_number = rand_range(1, 32);
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG;
+ ul_config_pdus[16].nulsch_pdu.nulsch_pdu_rel13.nb_harq_information.nb_harq_information_rel13_fdd.harq_ack_resource = rand_range(0, 15);
+ ul_config_pdus[17].pdu_type = NFAPI_UL_CONFIG_NRACH_PDU_TYPE;
+ ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG;
+ ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_0 = rand_range(0, 1);
+ ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_1 = rand_range(0, 1);
+ ul_config_pdus[17].nrach_pdu.nrach_pdu_rel13.nprach_config_2 = rand_range(0, 1);
+ ul_config_req.ul_config_request_body.ul_config_pdu_list = ul_config_pdus;
+ mac->ul_config_req(mac, &ul_config_req);
+ uint8_t num_dci_pdus = 4;
+ uint8_t num_hi_pdus = 1;
+ nfapi_hi_dci0_request_pdu_t hi_dci0_pdus[num_dci_pdus + num_hi_pdus];
+ memset(&hi_dci0_pdus, 0, sizeof(hi_dci0_pdus));
+ nfapi_hi_dci0_request_t hi_dci0_req;
+ memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
+ hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+ hi_dci0_req.header.phy_id = phy_id;
+ hi_dci0_req.sfn_sf = sfn_sf;
+ hi_dci0_req.hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
+ hi_dci0_req.hi_dci0_request_body.sfnsf = sfn_sf;
+ hi_dci0_req.hi_dci0_request_body.number_of_dci = num_dci_pdus;
+ hi_dci0_req.hi_dci0_request_body.number_of_hi = num_hi_pdus;
+ hi_dci0_pdus[0].pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.resource_block_start = rand_range(0, 100);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.hi_value = rand_range(0, 1);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.i_phich = rand_range(0, 1);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel8.transmission_power = rand_range(0, 10000);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG;
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.flag_tb2 = rand_range(0, 1);
+ hi_dci0_pdus[0].hi_pdu.hi_pdu_rel10.hi_value_2 = rand_range(0, 1);
+ hi_dci0_pdus[1].pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG;
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dci_format = rand_range(0, 4);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cce_index = rand_range(0, 88);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.aggregation_level = rand_range(1, 8);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.rnti = rand_range(1, 65535);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.resource_block_start = rand_range(0, 100);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.mcs_1 = rand_range(0, 31);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc = rand_range(0, 3);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.ul_index = rand_range(0, 3);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel8.transmission_power = rand_range(0, 10000);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG;
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_flag = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.srs_request = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.mcs_2 = rand_range(0, 31);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.tpmi = rand_range(0, 63);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel10.n_ul_rb = rand_range(6, 100);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.tl.tag = NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG;
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.pscch_resource = rand_range(0, 16);
+ hi_dci0_pdus[1].dci_pdu.dci_pdu_rel12.time_resource_pattern = rand_range(0, 32);
+ hi_dci0_pdus[2].pdu_type = NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG;
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dci_format = rand_range(0, 4);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cce_index = rand_range(0, 88);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.aggregation_level = rand_range(1, 8);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.rnti = rand_range(1, 65535);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.resource_block_start = rand_range(0, 100);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.number_of_resource_block = rand_range(0, 100);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.mcs_1 = rand_range(0, 31);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cyclic_shift_2_for_drms = rand_range(0, 7);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_enabled_flag = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.frequency_hopping_bits = rand_range(0, 3);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.new_data_indication_1 = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ue_tx_antenna_seleciton = rand_range(0, 2);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc = rand_range(0, 3);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.cqi_csi_request = rand_range(0, 7);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.ul_index = rand_range(0, 3);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.dl_assignment_index = rand_range(1, 4);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.tpc_bitmap = rand_range(0, 9999);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel8.transmission_power = rand_range(0, 10000);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG;
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.cross_carrier_scheduling_flag = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.carrier_indicator = rand_range(0, 7);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.size_of_cqi_csi_feild = rand_range(0, 2);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_flag = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.srs_request = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_flag = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_allocation_type = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.resource_block_coding = rand_range(0, 9999);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.mcs_2 = rand_range(0, 31);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.new_data_indication_2 = rand_range(0, 1);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.number_of_antenna_ports = rand_range(0, 2);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.tpmi = rand_range(0, 63);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.total_dci_length_including_padding = rand_range(0, 255);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_dci_pdu_rel10.n_ul_rb = rand_range(6, 100);
+ hi_dci0_pdus[2].epdcch_dci_pdu.epdcch_parameters_rel11.tl.tag = NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG;
+ hi_dci0_pdus[3].pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdus[3].mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG;
+ hi_dci0_pdus[4].pdu_type = NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.tl.tag = NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG;
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.ncce_index = rand_range(0, 1);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level = rand_range(1, 2);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol = rand_range(0, 4);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti = rand_range(1, 65535);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scrambling_reinitialization_batch_index = rand_range(1, 4);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.nrs_antenna_ports_assumed_by_the_ue = rand_range(1, 2);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication = rand_range(0, 63);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.resource_assignment = rand_range(0, 7);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay = rand_range(0, 3);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs = rand_range(0, 12);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version = rand_range(0, 1);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number = rand_range(0, 7);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator = rand_range(0, 1);
+ hi_dci0_pdus[4].npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number = rand_range(0, 3);
+ hi_dci0_req.hi_dci0_request_body.hi_dci0_pdu_list = hi_dci0_pdus;
+ mac->hi_dci0_req(mac, &hi_dci0_req);
+ uint8_t num_tx_pdus = 2;
+ nfapi_tx_request_pdu_t tx_pdus[num_tx_pdus];
+ memset(&tx_pdus, 0, sizeof(tx_pdus));
+ nfapi_tx_request_t tx_req;
+ memset(&tx_req, 0, sizeof(tx_req));
+ tx_req.header.message_id = NFAPI_TX_REQUEST;
+ tx_req.header.phy_id = phy_id;
+ tx_req.sfn_sf = sfn_sf;
+ tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+ tx_req.tx_request_body.number_of_pdus = num_tx_pdus;
+ uint32_t data[2];
+ data[0] = 0x11223344;
+ data[1] = 0x55667788;
+ tx_pdus[0].pdu_length = 8;
+ tx_pdus[0].pdu_index = 1;
+ tx_pdus[0].num_segments = 2;
+ tx_pdus[0].segments[0].segment_length = 4;
+ tx_pdus[0].segments[0].segment_data = (uint8_t *)&data[0];
+ tx_pdus[0].segments[1].segment_length = 4;
+ tx_pdus[0].segments[1].segment_data = (uint8_t *)&data[1];
+ tx_pdus[1].pdu_length = 8;
+ tx_pdus[1].pdu_index = 2;
+ tx_pdus[1].num_segments = 2;
+ tx_pdus[1].segments[0].segment_length = 4;
+ tx_pdus[1].segments[0].segment_data = (uint8_t *)&data[0];
+ tx_pdus[1].segments[1].segment_length = 4;
+ tx_pdus[1].segments[1].segment_data = (uint8_t *)&data[1];
+ tx_req.tx_request_body.tx_pdu_list = tx_pdus;
+ mac->tx_req(mac, &tx_req);
+ }
+
+ void generate_subframe(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf) {
+ mac_internal_t *instance = (mac_internal_t *)mac;
+ nfapi_dl_config_request_t dl_config_req;
+ memset(&dl_config_req, 0, sizeof(dl_config_req));
+ dl_config_req.header.message_id = NFAPI_DL_CONFIG_REQUEST;
+ dl_config_req.header.phy_id = phy_id;
+ dl_config_req.sfn_sf = sfn_sf;
+ dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+ dl_config_req.dl_config_request_body.number_pdu = 8;
+ nfapi_dl_config_request_pdu_t pdus[8];
+ memset(&pdus, 0, sizeof(pdus));
+
+ for(int i = 0; i < 8; i++) {
+ pdus[i].pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE;
+ pdus[i].bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
+ pdus[i].bch_pdu.bch_pdu_rel8.length = 42;
+ pdus[i].bch_pdu.bch_pdu_rel8.pdu_index = i;
+ pdus[i].bch_pdu.bch_pdu_rel8.transmission_power = 56;
+ }
+
+ dl_config_req.dl_config_request_body.dl_config_pdu_list = pdus;
+ /*
+ vendor_ext_tlv_1 ve;
+ ve.tl.tag = VENDOR_EXT_TLV_1_TAG;
+ ve.dummy = 999;
+ dl_config_req.vendor_extension = &ve.tl;
+ */
+ mac->dl_config_req(mac, &dl_config_req);
+ nfapi_ul_config_request_t ul_config_req;
+ memset(&ul_config_req, 0, sizeof(ul_config_req));
+ ul_config_req.header.message_id = NFAPI_UL_CONFIG_REQUEST;
+ ul_config_req.header.phy_id = phy_id;
+ ul_config_req.sfn_sf = sfn_sf;
+ mac->ul_config_req(mac, &ul_config_req);
+ nfapi_hi_dci0_request_t hi_dci0_req;
+ memset(&hi_dci0_req, 0, sizeof(hi_dci0_req));
+ hi_dci0_req.header.message_id = NFAPI_HI_DCI0_REQUEST;
+ hi_dci0_req.header.phy_id = phy_id;
+ hi_dci0_req.sfn_sf = sfn_sf;
+ mac->hi_dci0_req(mac, &hi_dci0_req);
+ nfapi_tx_request_t tx_req;
+ memset(&tx_req, 0, sizeof(tx_req));
+ tx_req.header.message_id = NFAPI_TX_REQUEST;
+ tx_req.header.phy_id = phy_id;
+ tx_req.sfn_sf = sfn_sf;
+ nfapi_tx_request_pdu_t tx_pdus[8];
+ tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
+ tx_req.tx_request_body.number_of_pdus = 0;
+ tx_req.tx_request_body.tx_pdu_list = &tx_pdus[0];
+ mac_pdu *buff = 0;
+ int i = 0;
+ std::list free_list;
+
+ do {
+ buff = instance->mac->pop_rx_buffer();
+
+ if(buff != 0) {
+ if(buff->len == 0) {
+ printf("[MAC] Buffer length = 0\n");
+ }
+
+ tx_req.tx_request_body.tx_pdu_list[i].pdu_length = buff->len;
+ tx_req.tx_request_body.tx_pdu_list[i].pdu_index = i;
+ tx_req.tx_request_body.tx_pdu_list[i].num_segments = 1;
+ tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_length = buff->len;
+ tx_req.tx_request_body.tx_pdu_list[i].segments[0].segment_data = (uint8_t *)buff->buffer;
+ tx_req.tx_request_body.number_of_pdus++;
+ i++;
+ instance->mac->byte_count += buff->len;
+ free_list.push_back(buff);
+ }
+ } while(buff != 0 && i < 8);
+
+ mac->tx_req(mac, &tx_req);
+
+ //for(int j = 0; j < tx_req.tx_request_body.number_of_pdus; ++j)
+ for(mac_pdu *pdu : free_list) {
+ instance->mac->release_mac_pdu(pdu);
+ //free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
+ }
+ }
+
+ void mac_subframe_ind(mac_t *mac, uint16_t phy_id, uint16_t sfn_sf) {
+ //printf("[MAC] subframe indication phyid:%d sfnsf:%d\n", phy_id, sfn_sf);
+ mac_internal_t *instance = (mac_internal_t *)mac;
+
+ if(instance->mac->tick == 1000) {
+ if(instance->mac->byte_count > 0) {
+ printf("[MAC] Rx rate %d bytes/sec\n", instance->mac->byte_count);
+ instance->mac->byte_count = 0;
+ }
+
+ instance->mac->tick = 0;
+ }
+
+ instance->mac->tick++;
+
+ if(instance->mac->wireshark_test_mode) {
+ generate_test_subframe(mac, phy_id, sfn_sf);
+ } else {
+ generate_subframe(mac, phy_id, sfn_sf);
+ }
+ }
+
+ void mac_harq_ind(mac_t *mac, nfapi_harq_indication_t *ind) {
+ }
+ void mac_crc_ind(mac_t *mac, nfapi_crc_indication_t *ind) {
+ }
+ void mac_rx_ind(mac_t *mac, nfapi_rx_indication_t *ind) {
+ mac_internal_t *instance = (mac_internal_t *)mac;
+
+ for(int i = 0; i < ind->rx_indication_body.number_of_pdus; ++i) {
+ uint16_t len = ind->rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length;
+ uint8_t *data = ind->rx_indication_body.rx_pdu_list[i].data;
+ //printf("[MAC] sfnsf:%d len:%d\n", ind->sfn_sf,len);
+ //
+ instance->tx_byte_count += len;
+ int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr *)&(instance->tx_addr), sizeof(instance->tx_addr));
+
+ if(sendto_result < 0) {
+ // error
+ }
+ }
+ }
+ void mac_rach_ind(mac_t *mac, nfapi_rach_indication_t *ind) {
+ }
+ void mac_srs_ind(mac_t *mac, nfapi_srs_indication_t *ind) {
+ }
+ void mac_sr_ind(mac_t *mac, nfapi_sr_indication_t *ind) {
+ }
+ void mac_cqi_ind(mac_t *mac, nfapi_cqi_indication_t *ind) {
+ }
+ void mac_lbt_dl_ind(mac_t *mac, nfapi_lbt_dl_indication_t *ind) {
+ }
+ void mac_nb_harq_ind(mac_t *mac, nfapi_nb_harq_indication_t *ind) {
+ }
+ void mac_nrach_ind(mac_t *mac, nfapi_nrach_indication_t *ind) {
+ }
}
diff --git a/nfapi/open-nFAPI/vnf_sim/src/main.cpp b/nfapi/open-nFAPI/vnf_sim/src/main.cpp
index 5dc7161157..dedf06174f 100644
--- a/nfapi/open-nFAPI/vnf_sim/src/main.cpp
+++ b/nfapi/open-nFAPI/vnf_sim/src/main.cpp
@@ -1,12 +1,12 @@
/*
* Copyright 2017 Cisco Systems, Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,8 +38,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
extern "C" {
#include
@@ -48,606 +48,486 @@ extern "C" {
#include
-//int vnf_main(int iPortP5, int, int);
-int start_simulated_mac(int*, int*);
-int read_xml(const char *xml_file);
+ //int vnf_main(int iPortP5, int, int);
+ int start_simulated_mac(int *, int *);
+ int read_xml(const char *xml_file);
}
-static uint32_t rand_range(uint32_t min, uint32_t max)
-{
- return ((rand() % (max + 1 - min)) + min);
+static uint32_t rand_range(uint32_t min, uint32_t max) {
+ return ((rand() % (max + 1 - min)) + min);
}
-void* vnf_allocate(size_t size)
-{
- return (void*)memory_pool::allocate(size);
+void *vnf_allocate(size_t size) {
+ return (void *)memory_pool::allocate(size);
}
-void vnf_deallocate(void* ptr)
-{
- memory_pool::deallocate((uint8_t*)ptr);
+void vnf_deallocate(void *ptr) {
+ memory_pool::deallocate((uint8_t *)ptr);
}
-class udp_data
-{
- public:
- bool enabled;
- uint32_t rx_port;
- uint32_t tx_port;
- std::string tx_addr;
+class udp_data {
+ public:
+ bool enabled;
+ uint32_t rx_port;
+ uint32_t tx_port;
+ std::string tx_addr;
};
-class phy_info
-{
- public:
+class phy_info {
+ public:
- uint16_t index;
- uint16_t id;
+ uint16_t index;
+ uint16_t id;
- std::vector rfs;
- std::vector excluded_rfs;
+ std::vector rfs;
+ std::vector excluded_rfs;
- int remote_port;
- std::string remote_addr;
+ int remote_port;
+ std::string remote_addr;
- uint16_t earfcn;
+ uint16_t earfcn;
};
-class rf_info
-{
- public:
+class rf_info {
+ public:
- uint16_t index;
- uint16_t band;
+ uint16_t index;
+ uint16_t band;
};
-class pnf_info
-{
- public:
+class pnf_info {
+ public:
- std::vector phys;
- std::vector rfs;
+ std::vector phys;
+ std::vector rfs;
};
-class vnf_p7_info
-{
- public:
- vnf_p7_info()
- : thread_started(false),
- config(nfapi_vnf_p7_config_create(),
- [] (nfapi_vnf_p7_config_t* f) { nfapi_vnf_p7_config_destory(f); }),
- mac(0)
- {
- local_port = 0;
-
- timing_window = 0;
- periodic_timing_enabled = 0;
- aperiodic_timing_enabled = 0;
- periodic_timing_period = 0;
-
- //config = nfapi_vnf_p7_config_create();
- }
-
- vnf_p7_info(const vnf_p7_info& other) = default;
-
- vnf_p7_info(vnf_p7_info&& other) = default;
-
- vnf_p7_info& operator=(const vnf_p7_info&) = default;
-
- vnf_p7_info& operator=(vnf_p7_info&&) = default;
-
-
-
- virtual ~vnf_p7_info()
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "*** vnf_p7_info delete ***\n");
-
- //nfapi_vnf_p7_config_destory(config);
-
- // should we delete the mac?
- }
-
+class vnf_p7_info {
+ public:
- int local_port;
- std::string local_addr;
+ vnf_p7_info()
+ : thread_started(false),
+ config(nfapi_vnf_p7_config_create(),
+ [] (nfapi_vnf_p7_config_t *f) {
+ nfapi_vnf_p7_config_destory(f);
+ }),
+ mac(0) {
+ local_port = 0;
+ udp=0;
+ timing_window = 0;
+ periodic_timing_enabled = 0;
+ aperiodic_timing_enabled = 0;
+ periodic_timing_period = 0;
+ //config = nfapi_vnf_p7_config_create();
+ }
- unsigned timing_window;
- unsigned periodic_timing_enabled;
- unsigned aperiodic_timing_enabled;
- unsigned periodic_timing_period;
+ vnf_p7_info(const vnf_p7_info &other) = default;
- // This is not really the right place if we have multiple PHY,
- // should be part of the phy struct
- udp_data udp;
+ vnf_p7_info(vnf_p7_info &&other) = default;
- bool thread_started;
+ vnf_p7_info &operator=(const vnf_p7_info &) = default;
- //nfapi_vnf_p7_config_t* config;
- std::shared_ptr config;
+ vnf_p7_info &operator=(vnf_p7_info &&) = default;
- mac_t* mac;
+ virtual ~vnf_p7_info() {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "*** vnf_p7_info delete ***\n");
+ //nfapi_vnf_p7_config_destory(config);
+ // should we delete the mac?
+ }
+
+
+ int local_port;
+ std::string local_addr;
+
+ unsigned timing_window;
+ unsigned periodic_timing_enabled;
+ unsigned aperiodic_timing_enabled;
+ unsigned periodic_timing_period;
+
+ // This is not really the right place if we have multiple PHY,
+ // should be part of the phy struct
+ udp_data udp;
+
+ bool thread_started;
+
+ //nfapi_vnf_p7_config_t* config;
+ std::shared_ptr config;
+
+ mac_t *mac;
+
};
-class vnf_info
-{
- public:
-
- uint8_t wireshark_test_mode;
+class vnf_info {
+ public:
- std::map pnfs;
+ uint8_t wireshark_test_mode;
+
+ std::map pnfs;
+
+ std::vector p7_vnfs;
- std::vector p7_vnfs;
-
};
/// maybe these should be in the mac file...
-int phy_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p7_codec_config_t* codec)
-{
- (void)tl;
- (void)ppReadPackedMessage;
- (void)ve;
- return -1;
+int phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p7_codec_config_t *codec) {
+ (void)tl;
+ (void)ppReadPackedMessage;
+ (void)ve;
+ return -1;
}
-int phy_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* codec)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
+int phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
+ nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
- nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
- switch(tlv->tag)
- {
- case VENDOR_EXT_TLV_1_TAG:
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
- vendor_ext_tlv_1* ve = (vendor_ext_tlv_1*)tlv;
- if(!push32(ve->dummy, ppWritePackedMsg, end))
- return 0;
- return 1;
- }
- break;
- default:
- return -1;
- break;
- }
+ switch(tlv->tag) {
+ case VENDOR_EXT_TLV_1_TAG: {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
+ vendor_ext_tlv_1 *ve = (vendor_ext_tlv_1 *)tlv;
+
+ if(!push32(ve->dummy, ppWritePackedMsg, end))
+ return 0;
+
+ return 1;
+ }
+ break;
+
+ default:
+ return -1;
+ break;
+ }
}
-int vnf_sim_pack_vendor_extension_tlv(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_pack_vendor_extension_tlv\n");
- nfapi_tl_t* tlv = (nfapi_tl_t*)ve;
- switch(tlv->tag)
- {
- case VENDOR_EXT_TLV_2_TAG:
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
- vendor_ext_tlv_2* ve = (vendor_ext_tlv_2*)tlv;
- if(!push32(ve->dummy, ppWritePackedMsg, end))
- return 0;
- return 1;
- }
- break;
- }
- return -1;
+int vnf_sim_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_pack_vendor_extension_tlv\n");
+ nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
+
+ switch(tlv->tag) {
+ case VENDOR_EXT_TLV_2_TAG: {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
+ vendor_ext_tlv_2 *ve = (vendor_ext_tlv_2 *)tlv;
+
+ if(!push32(ve->dummy, ppWritePackedMsg, end))
+ return 0;
+
+ return 1;
+ }
+ break;
+ }
+
+ return -1;
}
-int vnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessage, uint8_t *end, void** ve, nfapi_p4_p5_codec_config_t* codec)
-{
- return -1;
+int vnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
+ return -1;
}
-int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- if(header->message_id == P7_VENDOR_EXT_IND)
- {
- vendor_ext_p7_ind* req = (vendor_ext_p7_ind*)(header);
- if(!pull16(ppReadPackedMessage, &req->error_code, end))
- return 0;
- }
- return 1;
+int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *config) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+ if(header->message_id == P7_VENDOR_EXT_IND) {
+ vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
+
+ if(!pull16(ppReadPackedMessage, &req->error_code, end))
+ return 0;
+ }
+
+ return 1;
}
-int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- if(header->message_id == P7_VENDOR_EXT_REQ)
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header);
- if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
- push16(req->dummy2, ppWritePackedMsg, end)))
- return 0;
- }
- return 1;
+int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+ if(header->message_id == P7_VENDOR_EXT_REQ) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+ vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
+
+ if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
+ push16(req->dummy2, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
}
-int vnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- if(header->message_id == P5_VENDOR_EXT_RSP)
- {
- vendor_ext_p5_rsp* req = (vendor_ext_p5_rsp*)(header);
- return(!pull16(ppReadPackedMessage, &req->error_code, end));
- }
- return 0;
-}
-
-int vnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t* header, uint8_t** ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* codec)
-{
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
- if(header->message_id == P5_VENDOR_EXT_REQ)
- {
- vendor_ext_p5_req* req = (vendor_ext_p5_req*)(header);
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
- return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
- push16(req->dummy2, ppWritePackedMsg, end)));
- }
- return 0;
-}
-
-void vnf_sim_trace(nfapi_trace_level_t level, const char* message, ...)
-{
- va_list args;
- va_start(args, message);
- vprintf(message, args);
- va_end(args);
-}
-
-void mac_dl_config_req(mac_t* mac, nfapi_dl_config_request_t* req)
-{
- vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
-
- nfapi_vnf_p7_dl_config_req(info->config.get(), req);
-}
-
-void mac_ul_config_req(mac_t* mac, nfapi_ul_config_request_t* req)
-{
- vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
-
- nfapi_vnf_p7_ul_config_req(info->config.get(), req);
-}
-
-void mac_hi_dci0_req(mac_t* mac, nfapi_hi_dci0_request_t* req)
-{
- vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
-
- nfapi_vnf_p7_hi_dci0_req(info->config.get(), req);
-}
-
-void mac_tx_req(mac_t* mac, nfapi_tx_request_t* req)
-{
- vnf_p7_info* info = (vnf_p7_info*)(mac->user_data);
-
- nfapi_vnf_p7_tx_req(info->config.get(), req);
-}
-
-int phy_subframe_indication(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf)
-{
- //printf("[VNF_SIM] subframe indication %d\n", sfn_sf);
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_subframe_ind(p7_vnf->mac, phy_id, sfn_sf);
- return 0;
-}
-int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_harq_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_crc_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_rx_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_rach_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_srs_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_sr_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_cqi_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_lbt_dl_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_nb_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_nb_harq_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_nrach_indication(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind)
-{
- vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
- mac_nrach_ind(p7_vnf->mac, ind);
- return 1;
-}
-int phy_vendor_ext(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg)
-{
- if(msg->message_id == P7_VENDOR_EXT_IND)
- {
- //vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
- //printf("[VNF_SIM] vendor_ext (error_code:%d)\n", ind->error_code);
- }
- else
- {
- printf("[VNF_SIM] unknown %d\n", msg->message_id);
- }
- return 0;
-}
-nfapi_p7_message_header_t* phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t* msg_size)
-{
- if(message_id == P7_VENDOR_EXT_IND)
- {
- *msg_size = sizeof(vendor_ext_p7_ind);
- return (nfapi_p7_message_header_t*)malloc(sizeof(vendor_ext_p7_ind));
- }
- return 0;
-}
-void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header)
-{
- free(header);
-}
-
-//static pthread_t vnf_start_pthread;
-static pthread_t vnf_p7_start_pthread;
-void* vnf_p7_start_thread(void *ptr)
-{
- printf("%s()\n", __FUNCTION__);
-
- //std::shared_ptr config = std::shared_ptr(ptr);
- nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
-
- nfapi_vnf_p7_start(config);
+int vnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+ if(header->message_id == P5_VENDOR_EXT_RSP) {
+ vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
+ return(!pull16(ppReadPackedMessage, &req->error_code, end));
+ }
return 0;
}
-void set_thread_priority(int priority)
-{
- //printf("%s(priority:%d)\n", __FUNCTION__, priority);
-
- pthread_attr_t ptAttr;
-
- struct sched_param schedParam;
- schedParam.__sched_priority = priority; //79;
- if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0)
- {
- printf("Failed to set scheduler to SCHED_RR\n");
- }
+int vnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
+ if(header->message_id == P5_VENDOR_EXT_REQ) {
+ vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
+ return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
+ push16(req->dummy2, ppWritePackedMsg, end)));
+ }
- if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0)
- {
- printf("Failed to set pthread sched policy SCHED_RR\n");
- }
-
- pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
-
- struct sched_param thread_params;
- thread_params.sched_priority = 20;
- if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0)
- {
- printf("failed to set sched param\n");
- }
+ return 0;
}
-void* vnf_p7_thread_start(void* ptr)
-{
+void vnf_sim_trace(nfapi_trace_level_t level, const char *message, ...) {
+ va_list args;
+ va_start(args, message);
+ vprintf(message, args);
+ va_end(args);
+}
+
+void mac_dl_config_req(mac_t *mac, nfapi_dl_config_request_t *req) {
+ vnf_p7_info *info = (vnf_p7_info *)(mac->user_data);
+ nfapi_vnf_p7_dl_config_req(info->config.get(), req);
+}
+
+void mac_ul_config_req(mac_t *mac, nfapi_ul_config_request_t *req) {
+ vnf_p7_info *info = (vnf_p7_info *)(mac->user_data);
+ nfapi_vnf_p7_ul_config_req(info->config.get(), req);
+}
+
+void mac_hi_dci0_req(mac_t *mac, nfapi_hi_dci0_request_t *req) {
+ vnf_p7_info *info = (vnf_p7_info *)(mac->user_data);
+ nfapi_vnf_p7_hi_dci0_req(info->config.get(), req);
+}
+
+void mac_tx_req(mac_t *mac, nfapi_tx_request_t *req) {
+ vnf_p7_info *info = (vnf_p7_info *)(mac->user_data);
+ nfapi_vnf_p7_tx_req(info->config.get(), req);
+}
+
+int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn_sf) {
+ //printf("[VNF_SIM] subframe indication %d\n", sfn_sf);
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_subframe_ind(p7_vnf->mac, phy_id, sfn_sf);
+ return 0;
+}
+int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_harq_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_crc_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_rx_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_rach_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_srs_indication(struct nfapi_vnf_p7_config *config, nfapi_srs_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_srs_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_sr_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_cqi_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_lbt_dl_indication(struct nfapi_vnf_p7_config *config, nfapi_lbt_dl_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_lbt_dl_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_nb_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_nb_harq_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_nb_harq_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indication_t *ind) {
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)(config->user_data);
+ mac_nrach_ind(p7_vnf->mac, ind);
+ return 1;
+}
+int phy_vendor_ext(struct nfapi_vnf_p7_config *config, nfapi_p7_message_header_t *msg) {
+ if(msg->message_id == P7_VENDOR_EXT_IND) {
+ //vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
+ //printf("[VNF_SIM] vendor_ext (error_code:%d)\n", ind->error_code);
+ } else {
+ printf("[VNF_SIM] unknown %d\n", msg->message_id);
+ }
+
+ return 0;
+}
+nfapi_p7_message_header_t *phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
+ if(message_id == P7_VENDOR_EXT_IND) {
+ *msg_size = sizeof(vendor_ext_p7_ind);
+ return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
+ }
+
+ return 0;
+}
+void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header) {
+ free(header);
+}
+
+//static pthread_t vnf_start_pthread;
+static pthread_t vnf_p7_start_pthread;
+void *vnf_p7_start_thread(void *ptr) {
printf("%s()\n", __FUNCTION__);
-
- set_thread_priority(79);
-
- vnf_p7_info* p7_vnf = (vnf_p7_info*)ptr;
-
- p7_vnf->config->port = p7_vnf->local_port;
- p7_vnf->config->subframe_indication = &phy_subframe_indication;
- p7_vnf->config->harq_indication = &phy_harq_indication;
- p7_vnf->config->crc_indication = &phy_crc_indication;
- p7_vnf->config->rx_indication = &phy_rx_indication;
- p7_vnf->config->rach_indication = &phy_rach_indication;
- p7_vnf->config->srs_indication = &phy_srs_indication;
- p7_vnf->config->sr_indication = &phy_sr_indication;
- p7_vnf->config->cqi_indication = &phy_cqi_indication;
- p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
- p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
- p7_vnf->config->nrach_indication = &phy_nrach_indication;
- p7_vnf->config->malloc = &vnf_allocate;
- p7_vnf->config->free = &vnf_deallocate;
-
- p7_vnf->config->trace = &vnf_sim_trace;
-
- p7_vnf->config->vendor_ext = &phy_vendor_ext;
- p7_vnf->config->user_data = p7_vnf;
-
- p7_vnf->mac->user_data = p7_vnf;
-
- p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
- p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
- p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
- p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
- p7_vnf->config->codec_config.allocate = &vnf_allocate;
- p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
-
- p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
- p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
-
- printf("[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
- pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config.get());
-
- return 0;
+ //std::shared_ptr config = std::shared_ptr(ptr);
+ nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
+ nfapi_vnf_p7_start(config);
+ return 0;
}
-int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
-{
- printf("[VNF_SIM] pnf connection indication idx:%d\n", p5_idx);
+void set_thread_priority(int priority) {
+ //printf("%s(priority:%d)\n", __FUNCTION__, priority);
+ pthread_attr_t ptAttr;
+ struct sched_param schedParam;
+ schedParam.__sched_priority = priority; //79;
- pnf_info pnf;
- vnf_info* vnf = (vnf_info*)(config->user_data);
- vnf->pnfs.insert(std::pair(p5_idx, pnf));
+ if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
+ printf("Failed to set scheduler to SCHED_RR\n");
+ }
- nfapi_pnf_param_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
- nfapi_vnf_pnf_param_req(config, p5_idx, &req);
- return 0;
-}
-int pnf_disconnection_indication_cb(nfapi_vnf_config_t* config, int p5_idx)
-{
- printf("[VNF_SIM] pnf disconnection indication idx:%d\n", p5_idx);
+ if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
+ printf("Failed to set pthread sched policy SCHED_RR\n");
+ }
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
- auto find_result = vnf->pnfs.find(p5_idx);
-
- if(find_result != vnf->pnfs.end())
- {
- pnf_info& pnf = find_result->second;
+ pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
+ struct sched_param thread_params;
+ thread_params.sched_priority = 20;
- for(phy_info& phy : pnf.phys)
- {
- vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
- nfapi_vnf_p7_del_pnf((p7_vnf.config.get()), phy.id);
- }
- }
-
- return 0;
+ if(pthread_attr_setschedparam(&ptAttr, &thread_params) != 0) {
+ printf("failed to set sched param\n");
+ }
}
-int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp)
-{
- printf("[VNF_SIM] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
-
- vnf_info* vnf = (vnf_info*)(config->user_data);
-
- auto find_result = vnf->pnfs.find(p5_idx);
- if(find_result != vnf->pnfs.end())
- {
- pnf_info& pnf = find_result->second;
-
- for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
- {
- phy_info phy;
- phy.index = resp->pnf_phy.phy[i].phy_config_index;
-
- printf("[VNF_SIM] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
-
- nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
-
-
-
- for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j)
- {
- printf("[VNF_SIM] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
- phy.rfs.push_back(resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
- }
-
-
- pnf.phys.push_back(phy);
- }
- for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i)
- {
- rf_info rf;
- rf.index = resp->pnf_rf.rf[i].rf_config_index;
-
- printf("[VNF_SIM] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
-
- pnf.rfs.push_back(rf);
- }
-
- nfapi_pnf_config_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
-
- req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
- req.pnf_phy_rf_config.number_phy_rf_config_info = pnf.phys.size();
-
- for(unsigned i = 0; i < pnf.phys.size(); ++i)
- {
- req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf.phys[i].id;
- req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf.phys[i].index;
- req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf.phys[i].rfs[0];
- }
-
-
- nfapi_vnf_pnf_config_req(config, p5_idx, &req);
- }
- return 0;
+void *vnf_p7_thread_start(void *ptr) {
+ printf("%s()\n", __FUNCTION__);
+ set_thread_priority(79);
+ vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
+ p7_vnf->config->port = p7_vnf->local_port;
+ p7_vnf->config->subframe_indication = &phy_subframe_indication;
+ p7_vnf->config->harq_indication = &phy_harq_indication;
+ p7_vnf->config->crc_indication = &phy_crc_indication;
+ p7_vnf->config->rx_indication = &phy_rx_indication;
+ p7_vnf->config->rach_indication = &phy_rach_indication;
+ p7_vnf->config->srs_indication = &phy_srs_indication;
+ p7_vnf->config->sr_indication = &phy_sr_indication;
+ p7_vnf->config->cqi_indication = &phy_cqi_indication;
+ p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
+ p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
+ p7_vnf->config->nrach_indication = &phy_nrach_indication;
+ p7_vnf->config->malloc = &vnf_allocate;
+ p7_vnf->config->free = &vnf_deallocate;
+ p7_vnf->config->trace = &vnf_sim_trace;
+ p7_vnf->config->vendor_ext = &phy_vendor_ext;
+ p7_vnf->config->user_data = p7_vnf;
+ p7_vnf->mac->user_data = p7_vnf;
+ p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
+ p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
+ p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
+ p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
+ p7_vnf->config->codec_config.allocate = &vnf_allocate;
+ p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
+ p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
+ p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
+ printf("[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
+ pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config.get());
+ return 0;
}
-int pnf_config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp)
-{
- printf("[VNF_SIM] pnf config response idx:%d\n", p5_idx);
-
- if(1)
- {
- vnf_info* vnf = (vnf_info*)(config->user_data);
- auto find_result = vnf->pnfs.find(p5_idx);
- if(find_result != vnf->pnfs.end())
- {
- //pnf_info& pnf = find_result->second;
+int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
+ printf("[VNF_SIM] pnf connection indication idx:%d\n", p5_idx);
+ pnf_info pnf;
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ vnf->pnfs.insert(std::pair(p5_idx, pnf));
+ nfapi_pnf_param_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PNF_PARAM_REQUEST;
+ nfapi_vnf_pnf_param_req(config, p5_idx, &req);
+ return 0;
+}
+int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
+ printf("[VNF_SIM] pnf disconnection indication idx:%d\n", p5_idx);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ auto find_result = vnf->pnfs.find(p5_idx);
- nfapi_pnf_start_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_PNF_START_REQUEST;
- nfapi_vnf_pnf_start_req(config, p5_idx, &req);
- }
- }
- else
- {
- // Rather than send the pnf_start_request we will demonstrate
- // sending a vendor extention message. The start request will be
- // send when the vendor extension response is received
+ if(find_result != vnf->pnfs.end()) {
+ pnf_info &pnf = find_result->second;
- //vnf_info* vnf = (vnf_info*)(config->user_data);
- vendor_ext_p5_req req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = P5_VENDOR_EXT_REQ;
- req.dummy1 = 45;
- req.dummy2 = 1977;
- nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
- }
- return 0;
+ for(phy_info &phy : pnf.phys) {
+ vnf_p7_info &p7_vnf = vnf->p7_vnfs[0];
+ nfapi_vnf_p7_del_pnf((p7_vnf.config.get()), phy.id);
+ }
+ }
+
+ return 0;
}
+int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_response_t *resp) {
+ printf("[VNF_SIM] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ auto find_result = vnf->pnfs.find(p5_idx);
+
+ if(find_result != vnf->pnfs.end()) {
+ pnf_info &pnf = find_result->second;
+
+ for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) {
+ phy_info phy;
+ phy.index = resp->pnf_phy.phy[i].phy_config_index;
+ printf("[VNF_SIM] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
+ nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
+
+ for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j) {
+ printf("[VNF_SIM] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
+ phy.rfs.push_back(resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
+ }
+
+ pnf.phys.push_back(phy);
+ }
+
+ for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
+ rf_info rf;
+ rf.index = resp->pnf_rf.rf[i].rf_config_index;
+ printf("[VNF_SIM] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
+ pnf.rfs.push_back(rf);
+ }
+
+ nfapi_pnf_config_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
+ req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
+ req.pnf_phy_rf_config.number_phy_rf_config_info = pnf.phys.size();
+
+ for(unsigned i = 0; i < pnf.phys.size(); ++i) {
+ req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf.phys[i].id;
+ req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf.phys[i].index;
+ req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf.phys[i].rfs[0];
+ }
+
+ nfapi_vnf_pnf_config_req(config, p5_idx, &req);
+ }
+}
int pnf_start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp)
{
printf("[VNF_SIM] pnf start response idx:%d\n", p5_idx);
@@ -716,7 +596,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
// for now just 1
vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
- printf("[VNF_SIM] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy.id, phy.remote_addr.c_str(), phy.remote_port, p7_vnf.timing_window, p7_vnf.periodic_timing_period, p7_vnf.aperiodic_timing_enabled, p7_vnf.periodic_timing_period);
+ printf("[VNF_SIM] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy.id, phy.remote_addr.c_str(), phy.remote_port, p7_vnf.timing_window, p7_vnf.periodic_timing_period, p7_vnf.aperiodic_timing_enabled, p7_vnf.periodic_timing_period);
nfapi_config_request_t req;
@@ -1065,461 +945,768 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
return 0;
}
-int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp)
-{
- printf("[VNF_SIM] config response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_response_t *resp) {
+ printf("[VNF_SIM] pnf config response idx:%d\n", p5_idx);
+ if(1) {
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ auto find_result = vnf->pnfs.find(p5_idx);
- nfapi_start_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_START_REQUEST;
- req.header.phy_id = resp->header.phy_id;
- nfapi_vnf_start_req(config, p5_idx, &req);
+ if(find_result != vnf->pnfs.end()) {
+ //pnf_info& pnf = find_result->second;
+ nfapi_pnf_start_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PNF_START_REQUEST;
+ nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+ }
+ } else {
+ // Rather than send the pnf_start_request we will demonstrate
+ // sending a vendor extention message. The start request will be
+ // send when the vendor extension response is received
+ //vnf_info* vnf = (vnf_info*)(config->user_data);
+ vendor_ext_p5_req req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = P5_VENDOR_EXT_REQ;
+ req.dummy1 = 45;
+ req.dummy2 = 1977;
+ nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
+ }
- return 0;
+ return 0;
}
-void test_p4_requests(nfapi_vnf_config_t* config, int p5_idx, int phy_id)
-{
- {
- nfapi_measurement_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_MEASUREMENT_REQUEST;
- req.header.phy_id = phy_id;
-
- req.dl_rs_tx_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG;
- req.dl_rs_tx_power.value = 42;
- req.received_interference_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG;
- req.received_interference_power.value = 42;
- req.thermal_noise_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG;
- req.thermal_noise_power.value = 42;
-
- nfapi_vnf_measurement_req(config, p5_idx, &req);
- }
- {
- nfapi_rssi_request_t lte_req;
- memset(<e_req, 0, sizeof(lte_req));
- lte_req.header.message_id = NFAPI_RSSI_REQUEST;
- lte_req.header.phy_id = phy_id;
-
- lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
- lte_req.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG;
- lte_req.lte_rssi_request.frequency_band_indicator = 2;
- lte_req.lte_rssi_request.measurement_period = 1000;
- lte_req.lte_rssi_request.bandwidth = 50;
- lte_req.lte_rssi_request.timeout = 0;
- lte_req.lte_rssi_request.number_of_earfcns = 2;
- lte_req.lte_rssi_request.earfcn[0] = 389;
- lte_req.lte_rssi_request.earfcn[1] = 123;
-
- nfapi_vnf_rssi_request(config, p5_idx, <e_req);
-
- nfapi_rssi_request_t utran_req;
- memset(&utran_req, 0, sizeof(utran_req));
- utran_req.header.message_id = NFAPI_RSSI_REQUEST;
- utran_req.header.phy_id = phy_id;
-
- utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
- utran_req.utran_rssi_request.tl.tag = NFAPI_UTRAN_RSSI_REQUEST_TAG;
- utran_req.utran_rssi_request.frequency_band_indicator = 2;
- utran_req.utran_rssi_request.measurement_period = 1000;
- utran_req.utran_rssi_request.timeout = 0;
- utran_req.utran_rssi_request.number_of_uarfcns = 2;
- utran_req.utran_rssi_request.uarfcn[0] = 2348;
- utran_req.utran_rssi_request.uarfcn[1] = 52;
-
- nfapi_vnf_rssi_request(config, p5_idx, &utran_req);
-
-
- nfapi_rssi_request_t geran_req;
- memset(&geran_req, 0, sizeof(geran_req));
- geran_req.header.message_id = NFAPI_RSSI_REQUEST;
- geran_req.header.phy_id = phy_id;
-
- geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
- geran_req.geran_rssi_request.tl.tag = NFAPI_GERAN_RSSI_REQUEST_TAG;
- geran_req.geran_rssi_request.frequency_band_indicator = 2;
- geran_req.geran_rssi_request.measurement_period = 1000;
- geran_req.geran_rssi_request.timeout = 0;
- geran_req.geran_rssi_request.number_of_arfcns = 1;
- geran_req.geran_rssi_request.arfcn[0].arfcn = 34;
- geran_req.geran_rssi_request.arfcn[0].direction = 0;
-
- nfapi_vnf_rssi_request(config, p5_idx, &geran_req);
- }
- {
- nfapi_cell_search_request_t lte_req;
- memset(<e_req, 0, sizeof(lte_req));
- lte_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
- lte_req.header.phy_id = phy_id;
-
- lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
- lte_req.lte_cell_search_request.tl.tag = NFAPI_LTE_CELL_SEARCH_REQUEST_TAG;
- lte_req.lte_cell_search_request.earfcn = 1234;
- lte_req.lte_cell_search_request.measurement_bandwidth = 50;
- lte_req.lte_cell_search_request.exhaustive_search = 1;
- lte_req.lte_cell_search_request.timeout = 1000;
- lte_req.lte_cell_search_request.number_of_pci = 1;
- lte_req.lte_cell_search_request.pci[0] = 234;
-
- nfapi_vnf_cell_search_request(config, p5_idx, <e_req);
-
- nfapi_cell_search_request_t utran_req;
- memset(&utran_req, 0, sizeof(utran_req));
- utran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
- utran_req.header.phy_id = phy_id;
-
- utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
- utran_req.utran_cell_search_request.tl.tag = NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG;
- utran_req.utran_cell_search_request.uarfcn = 1234;
- utran_req.utran_cell_search_request.exhaustive_search = 0;
- utran_req.utran_cell_search_request.timeout = 1000;
- utran_req.utran_cell_search_request.number_of_psc = 1;
- utran_req.utran_cell_search_request.psc[0] = 234;
-
- nfapi_vnf_cell_search_request(config, p5_idx, &utran_req);
-
- nfapi_cell_search_request_t geran_req;
- memset(&geran_req, 0, sizeof(geran_req));
- geran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
- geran_req.header.phy_id = phy_id;
-
- geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
- geran_req.geran_cell_search_request.tl.tag = NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG;
- geran_req.geran_cell_search_request.timeout = 1000;
- geran_req.geran_cell_search_request.number_of_arfcn = 1;
- geran_req.geran_cell_search_request.arfcn[0] = 8765;
-
- nfapi_vnf_cell_search_request(config, p5_idx, &geran_req);
- }
- {
- nfapi_broadcast_detect_request_t lte_req;
- memset(<e_req, 0, sizeof(lte_req));
- lte_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
- lte_req.header.phy_id = phy_id;
-
- lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
- lte_req.lte_broadcast_detect_request.tl.tag = NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG;
- lte_req.lte_broadcast_detect_request.earfcn = 1234;
- lte_req.lte_broadcast_detect_request.pci = 50;
- lte_req.lte_broadcast_detect_request.timeout = 1000;
-
- lte_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
- lte_req.pnf_cell_search_state.length = 3;
-
- nfapi_vnf_broadcast_detect_request(config, p5_idx, <e_req);
-
- nfapi_broadcast_detect_request_t utran_req;
- memset(&utran_req, 0, sizeof(utran_req));
- utran_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
- utran_req.header.phy_id = phy_id;
-
- utran_req.rat_type = NFAPI_RAT_TYPE_LTE;
- utran_req.utran_broadcast_detect_request.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG;
- utran_req.utran_broadcast_detect_request.uarfcn = 1234;
- utran_req.utran_broadcast_detect_request.psc = 50;
- utran_req.utran_broadcast_detect_request.timeout = 1000;
-
- utran_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
- utran_req.pnf_cell_search_state.length = 3;
-
- nfapi_vnf_broadcast_detect_request(config, p5_idx, &utran_req);
- }
- {
- nfapi_system_information_schedule_request_t lte_req;
- memset(<e_req, 0, sizeof(lte_req));
- lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST;
- lte_req.header.phy_id = phy_id;
-
- lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
- lte_req.lte_system_information_schedule_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG;
- lte_req.lte_system_information_schedule_request.earfcn = 1234;
- lte_req.lte_system_information_schedule_request.pci = 50;
- lte_req.lte_system_information_schedule_request.downlink_channel_bandwidth = 100;
- lte_req.lte_system_information_schedule_request.phich_configuration = 3;
- lte_req.lte_system_information_schedule_request.number_of_tx_antenna = 2;
- lte_req.lte_system_information_schedule_request.retry_count = 4;
- lte_req.lte_system_information_schedule_request.timeout = 1000;
-
- lte_req.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
- lte_req.pnf_cell_broadcast_state.length = 3;
-
- nfapi_vnf_system_information_schedule_request(config, p5_idx, <e_req);
- }
- {
- nfapi_system_information_request_t lte_req;
- memset(<e_req, 0, sizeof(lte_req));
- lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
- lte_req.header.phy_id = phy_id;
-
- lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
- lte_req.lte_system_information_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG;
- lte_req.lte_system_information_request.earfcn = 1234;
- lte_req.lte_system_information_request.pci= 456;
- lte_req.lte_system_information_request.downlink_channel_bandwidth = 5;
- lte_req.lte_system_information_request.phich_configuration = 2;
- lte_req.lte_system_information_request.number_of_tx_antenna = 2;
- lte_req.lte_system_information_request.number_of_si_periodicity = 1;
- lte_req.lte_system_information_request.si_periodicity[0].si_periodicity = 3;
- lte_req.lte_system_information_request.si_periodicity[0].si_index = 3;
- lte_req.lte_system_information_request.si_window_length = 15;
- lte_req.lte_system_information_request.timeout = 1000;
-
- nfapi_vnf_system_information_request(config, p5_idx, <e_req);
-
- nfapi_system_information_request_t utran_req;
- memset(&utran_req, 0, sizeof(utran_req));
- utran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
- utran_req.header.phy_id = phy_id;
-
- utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
- utran_req.utran_system_information_request.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG;
- utran_req.utran_system_information_request.uarfcn = 1234;
- utran_req.utran_system_information_request.psc = 456;
- utran_req.utran_system_information_request.timeout = 1000;
-
- nfapi_vnf_system_information_request(config, p5_idx, &utran_req);
-
- nfapi_system_information_request_t geran_req;
- memset(&geran_req, 0, sizeof(geran_req));
- geran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
- geran_req.header.phy_id = phy_id;
-
- geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
- geran_req.geran_system_information_request.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG;
- geran_req.geran_system_information_request.arfcn = 1234;
- geran_req.geran_system_information_request.bsic = 21;
- geran_req.geran_system_information_request.timeout = 1000;
-
- nfapi_vnf_system_information_request(config, p5_idx, &geran_req);
- }
- {
- nfapi_nmm_stop_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_NMM_STOP_REQUEST;
- req.header.phy_id = phy_id;
- nfapi_vnf_nmm_stop_request(config, p5_idx, &req);
- }
+int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_response_t *resp) {
+ printf("[VNF_SIM] pnf start response idx:%d\n", p5_idx);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ vnf_p7_info &p7_vnf = vnf->p7_vnfs[0];
+
+ if(p7_vnf.thread_started == false) {
+ pthread_t vnf_p7_thread;
+ pthread_create(&vnf_p7_thread, NULL, &vnf_p7_thread_start, &p7_vnf);
+ p7_vnf.thread_started = true;
+ } else {
+ // P7 thread already running.
+ }
+
+ // start all the phys in the pnf.
+ auto find_result = vnf->pnfs.find(p5_idx);
+
+ if(find_result != vnf->pnfs.end()) {
+ pnf_info &pnf = find_result->second;
+
+ for(unsigned i = 0; i < pnf.phys.size(); ++i) {
+ pnf_info &pnf = find_result->second;
+ nfapi_param_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PARAM_REQUEST;
+ req.header.phy_id = pnf.phys[i].id;
+ nfapi_vnf_param_req(config, p5_idx, &req);
+ }
+ }
+
+ return 0;
+}
+int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) {
+ printf("[VNF_SIM] param response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
+ auto find_result = vnf->pnfs.find(p5_idx);
+
+ if(find_result != vnf->pnfs.end()) {
+ pnf_info &pnf = find_result->second;
+ auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item) {
+ return item.id == resp->header.phy_id;
+ });
+
+ if(found != pnf.phys.end()) {
+ phy_info &phy = (*found);
+ phy.remote_port = resp->nfapi_config.p7_pnf_port.value;
+ struct sockaddr_in pnf_p7_sockaddr;
+ memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
+ phy.remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
+ // for now just 1
+ vnf_p7_info &p7_vnf = vnf->p7_vnfs[0];
+ printf("[VNF_SIM] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy.id, phy.remote_addr.c_str(), phy.remote_port, p7_vnf.timing_window, p7_vnf.periodic_timing_period,
+ p7_vnf.aperiodic_timing_enabled, p7_vnf.periodic_timing_period);
+ nfapi_config_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_CONFIG_REQUEST;
+ req.header.phy_id = phy.id;
+ req.nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
+ req.nfapi_config.p7_vnf_port.value = p7_vnf.local_port;
+ req.num_tlv++;
+ req.nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
+ struct sockaddr_in vnf_p7_sockaddr;
+ vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf.local_addr.c_str());
+ memcpy(&(req.nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
+ req.num_tlv++;
+ req.nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
+ req.nfapi_config.timing_window.value = p7_vnf.timing_window;
+ req.num_tlv++;
+
+ if(p7_vnf.periodic_timing_enabled || p7_vnf.aperiodic_timing_enabled) {
+ req.nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG;
+ req.nfapi_config.timing_info_mode.value = (p7_vnf.aperiodic_timing_enabled << 1) | (p7_vnf.periodic_timing_enabled);
+ req.num_tlv++;
+
+ if(p7_vnf.periodic_timing_enabled) {
+ req.nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG;
+ req.nfapi_config.timing_info_period.value = p7_vnf.periodic_timing_period;
+ req.num_tlv++;
+ }
+ }
+
+ req.nfapi_config.earfcn.tl.tag = NFAPI_NFAPI_EARFCN_TAG;
+ req.nfapi_config.earfcn.value = phy.earfcn;
+ req.num_tlv++;
+
+ if(1) {
+ // Poplate all tlv for wireshark testing
+ req.subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG;
+ req.num_tlv++;
+ req.subframe_config.pcfich_power_offset.tl.tag = NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG;
+ req.num_tlv++;
+ req.subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG;
+ req.num_tlv++;
+ req.subframe_config.dl_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG;
+ req.num_tlv++;
+ req.subframe_config.ul_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG;
+ req.num_tlv++;
+ req.rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
+ req.num_tlv++;
+ req.rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
+ req.num_tlv++;
+ req.rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG;
+ req.num_tlv++;
+ req.rf_config.tx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG;
+ req.num_tlv++;
+ req.rf_config.rx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG;
+ req.num_tlv++;
+ req.phich_config.phich_resource.tl.tag = NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG;
+ req.num_tlv++;
+ req.phich_config.phich_duration.tl.tag = NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG;
+ req.num_tlv++;
+ req.phich_config.phich_power_offset.tl.tag = NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG;
+ req.num_tlv++;
+ req.sch_config.primary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+ req.num_tlv++;
+ req.sch_config.secondary_synchronization_signal_epre_eprers.tl.tag = NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG;
+ req.num_tlv++;
+ req.sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG;
+ req.num_tlv++;
+ req.prach_config.configuration_index.tl.tag = NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG;
+ req.num_tlv++;
+ req.prach_config.root_sequence_index.tl.tag = NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG;
+ req.num_tlv++;
+ req.prach_config.zero_correlation_zone_configuration.tl.tag = NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+ req.num_tlv++;
+ req.prach_config.high_speed_flag.tl.tag = NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG;
+ req.num_tlv++;
+ req.prach_config.frequency_offset.tl.tag = NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG;
+ req.num_tlv++;
+ req.pusch_config.hopping_mode.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG;
+ req.num_tlv++;
+ req.pusch_config.hopping_offset.tl.tag = NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG;
+ req.num_tlv++;
+ req.pusch_config.number_of_subbands.tl.tag = NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG;
+ req.num_tlv++;
+ req.pucch_config.delta_pucch_shift.tl.tag = NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG;
+ req.num_tlv++;
+ req.pucch_config.n_cqi_rb.tl.tag = NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG;
+ req.num_tlv++;
+ req.pucch_config.n_an_cs.tl.tag = NFAPI_PUCCH_CONFIG_N_AN_CS_TAG;
+ req.num_tlv++;
+ req.pucch_config.n1_pucch_an.tl.tag = NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG;
+ req.num_tlv++;
+ req.srs_config.bandwidth_configuration.tl.tag = NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG;
+ req.num_tlv++;
+ req.srs_config.max_up_pts.tl.tag = NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG;
+ req.num_tlv++;
+ req.srs_config.srs_subframe_configuration.tl.tag = NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG;
+ req.num_tlv++;
+ req.srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG;
+ req.num_tlv++;
+ req.uplink_reference_signal_config.uplink_rs_hopping.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG;
+ req.num_tlv++;
+ req.uplink_reference_signal_config.group_assignment.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG;
+ req.num_tlv++;
+ req.uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG;
+ req.num_tlv++;
+ req.laa_config.ed_threshold_lbt_pdsch.tl.tag = NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG;
+ req.num_tlv++;
+ req.laa_config.ed_threshold_lbt_drs.tl.tag = NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG;
+ req.num_tlv++;
+ req.laa_config.pd_threshold.tl.tag = NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG;
+ req.num_tlv++;
+ req.laa_config.multi_carrier_type.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG;
+ req.num_tlv++;
+ req.laa_config.multi_carrier_tx.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG;
+ req.num_tlv++;
+ req.laa_config.multi_carrier_freeze.tl.tag = NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG;
+ req.num_tlv++;
+ req.laa_config.tx_antenna_ports_drs.tl.tag = NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG;
+ req.num_tlv++;
+ req.laa_config.tx_power_drs.tl.tag = NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG;
+ req.num_tlv++;
+ req.emtc_config.pbch_repetitions_enable_r13.tl.tag = NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_catm_root_sequence_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_catm_zero_correlation_zone_configuration.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_catm_high_speed_flag.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_0_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_1_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_2_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG;
+ req.num_tlv++;
+ req.emtc_config.prach_ce_level_3_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG;
+ req.num_tlv++;
+ req.emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
+ req.num_tlv++;
+ req.emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;
+ req.num_tlv++;
+ req.nb_iot_config.operating_mode.tl.tag = NFAPI_NB_IOT_CONFIG_OPERATING_MODE_TAG;
+ req.nb_iot_config.operating_mode.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.anchor.tl.tag = NFAPI_NB_IOT_CONFIG_ANCHOR_TAG;
+ req.nb_iot_config.anchor.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.prb_index.tl.tag = NFAPI_NB_IOT_CONFIG_PRB_INDEX_TAG;
+ req.nb_iot_config.prb_index.value = rand_range(0, 0x1F);
+ req.num_tlv++;
+ req.nb_iot_config.control_region_size.tl.tag = NFAPI_NB_IOT_CONFIG_CONTROL_REGION_SIZE_TAG;
+ req.nb_iot_config.control_region_size.value = rand_range(1, 4);
+ req.num_tlv++;
+ req.nb_iot_config.assumed_crs_aps.tl.tag = NFAPI_NB_IOT_CONFIG_ASSUMED_CRS_APS_TAG;
+ req.nb_iot_config.assumed_crs_aps.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_ENABLED_TAG;
+ req.nb_iot_config.nprach_config_0_enabled.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SF_PERIODICITY_TAG;
+ req.nb_iot_config.nprach_config_0_sf_periodicity.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_START_TIME_TAG;
+ req.nb_iot_config.nprach_config_0_start_time.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SUBCARRIER_OFFSET_TAG;
+ req.nb_iot_config.nprach_config_0_subcarrier_offset.value = rand_range(0, 6);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_SUBCARRIERS_TAG;
+ req.nb_iot_config.nprach_config_0_number_of_subcarriers.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_CP_LENGTH_TAG;
+ req.nb_iot_config.nprach_config_0_cp_length.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_ENABLED_TAG;
+ req.nb_iot_config.nprach_config_1_enabled.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SF_PERIODICITY_TAG;
+ req.nb_iot_config.nprach_config_1_sf_periodicity.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_START_TIME_TAG;
+ req.nb_iot_config.nprach_config_1_start_time.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SUBCARRIER_OFFSET_TAG;
+ req.nb_iot_config.nprach_config_1_subcarrier_offset.value = rand_range(0, 6);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_SUBCARRIERS_TAG;
+ req.nb_iot_config.nprach_config_1_number_of_subcarriers.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_CP_LENGTH_TAG;
+ req.nb_iot_config.nprach_config_1_cp_length.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_enabled.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_ENABLED_TAG;
+ req.nb_iot_config.nprach_config_2_enabled.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_sf_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SF_PERIODICITY_TAG;
+ req.nb_iot_config.nprach_config_2_sf_periodicity.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_start_time.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_START_TIME_TAG;
+ req.nb_iot_config.nprach_config_2_start_time.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_subcarrier_offset.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SUBCARRIER_OFFSET_TAG;
+ req.nb_iot_config.nprach_config_2_subcarrier_offset.value = rand_range(0, 6);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_number_of_subcarriers.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_SUBCARRIERS_TAG;
+ req.nb_iot_config.nprach_config_2_number_of_subcarriers.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_cp_length.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_CP_LENGTH_TAG;
+ req.nb_iot_config.nprach_config_2_cp_length.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
+ req.nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.value = rand_range(0, 7);
+ req.num_tlv++;
+ req.nb_iot_config.three_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_THREE_TONE_BASE_SEQUENCE_TAG;
+ req.nb_iot_config.three_tone_base_sequence.value = rand_range(0, 0x0F);
+ req.num_tlv++;
+ req.nb_iot_config.six_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_SIX_TONE_BASE_SEQUENCE_TAG;
+ req.nb_iot_config.six_tone_base_sequence.value = rand_range(0, 0x03);
+ req.num_tlv++;
+ req.nb_iot_config.twelve_tone_base_sequence.tl.tag = NFAPI_NB_IOT_CONFIG_TWELVE_TONE_BASE_SEQUENCE_TAG;
+ req.nb_iot_config.twelve_tone_base_sequence.value = rand_range(0, 0x1F);
+ req.num_tlv++;
+ req.nb_iot_config.three_tone_cyclic_shift.tl.tag = NFAPI_NB_IOT_CONFIG_THREE_TONE_CYCLIC_SHIFT_TAG;
+ req.nb_iot_config.three_tone_cyclic_shift.value = rand_range(0, 5); // what is the max
+ req.num_tlv++;
+ req.nb_iot_config.six_tone_cyclic_shift.tl.tag = NFAPI_NB_IOT_CONFIG_SIX_TONE_CYCLIC_SHIFT_TAG;
+ req.nb_iot_config.six_tone_cyclic_shift.value = rand_range(0, 5); // what is the max
+ req.num_tlv++;
+ req.nb_iot_config.dl_gap_config_enable.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_CONFIG_ENABLE_TAG;
+ req.nb_iot_config.dl_gap_config_enable.value = rand_range(0, 1);
+ req.num_tlv++;
+ req.nb_iot_config.dl_gap_threshold.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_THRESHOLD_TAG;
+ req.nb_iot_config.dl_gap_threshold.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.dl_gap_periodicity.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_PERIODICITY_TAG;
+ req.nb_iot_config.dl_gap_periodicity.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.nb_iot_config.dl_gap_duration_coefficient.tl.tag = NFAPI_NB_IOT_CONFIG_DL_GAP_DURATION_COEFFICIENT_TAG;
+ req.nb_iot_config.dl_gap_duration_coefficient.value = rand_range(0, 3);
+ req.num_tlv++;
+ req.tdd_frame_structure_config.subframe_assignment.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG;
+ req.num_tlv++;
+ req.tdd_frame_structure_config.special_subframe_patterns.tl.tag = NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG;
+ req.num_tlv++;
+ req.l23_config.data_report_mode.tl.tag = NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG;
+ req.num_tlv++;
+ req.l23_config.sfnsf.tl.tag = NFAPI_L23_CONFIG_SFNSF_TAG;
+ req.num_tlv++;
+ }
+
+ vendor_ext_tlv_2 ve2;
+ memset(&ve2, 0, sizeof(ve2));
+ ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
+ ve2.dummy = 2016;
+ req.vendor_extension = &ve2.tl;
+ nfapi_vnf_config_req(config, p5_idx, &req);
+ } else {
+ printf("[VNF_SIM] param response failed to find pnf %d phy %d\n", p5_idx, resp->header.phy_id);
+ }
+ } else {
+ printf("[VNF_SIM] param response failed to find pnf %d\n", p5_idx);
+ }
+
+ return 0;
+}
+
+int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
+ printf("[VNF_SIM] config response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+ nfapi_start_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_START_REQUEST;
+ req.header.phy_id = resp->header.phy_id;
+ nfapi_vnf_start_req(config, p5_idx, &req);
+ return 0;
+}
+
+void test_p4_requests(nfapi_vnf_config_t *config, int p5_idx, int phy_id) {
+ {
+ nfapi_measurement_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_MEASUREMENT_REQUEST;
+ req.header.phy_id = phy_id;
+ req.dl_rs_tx_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG;
+ req.dl_rs_tx_power.value = 42;
+ req.received_interference_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG;
+ req.received_interference_power.value = 42;
+ req.thermal_noise_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG;
+ req.thermal_noise_power.value = 42;
+ nfapi_vnf_measurement_req(config, p5_idx, &req);
+ }
+ {
+ nfapi_rssi_request_t lte_req;
+ memset(<e_req, 0, sizeof(lte_req));
+ lte_req.header.message_id = NFAPI_RSSI_REQUEST;
+ lte_req.header.phy_id = phy_id;
+ lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ lte_req.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG;
+ lte_req.lte_rssi_request.frequency_band_indicator = 2;
+ lte_req.lte_rssi_request.measurement_period = 1000;
+ lte_req.lte_rssi_request.bandwidth = 50;
+ lte_req.lte_rssi_request.timeout = 0;
+ lte_req.lte_rssi_request.number_of_earfcns = 2;
+ lte_req.lte_rssi_request.earfcn[0] = 389;
+ lte_req.lte_rssi_request.earfcn[1] = 123;
+ nfapi_vnf_rssi_request(config, p5_idx, <e_req);
+ nfapi_rssi_request_t utran_req;
+ memset(&utran_req, 0, sizeof(utran_req));
+ utran_req.header.message_id = NFAPI_RSSI_REQUEST;
+ utran_req.header.phy_id = phy_id;
+ utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+ utran_req.utran_rssi_request.tl.tag = NFAPI_UTRAN_RSSI_REQUEST_TAG;
+ utran_req.utran_rssi_request.frequency_band_indicator = 2;
+ utran_req.utran_rssi_request.measurement_period = 1000;
+ utran_req.utran_rssi_request.timeout = 0;
+ utran_req.utran_rssi_request.number_of_uarfcns = 2;
+ utran_req.utran_rssi_request.uarfcn[0] = 2348;
+ utran_req.utran_rssi_request.uarfcn[1] = 52;
+ nfapi_vnf_rssi_request(config, p5_idx, &utran_req);
+ nfapi_rssi_request_t geran_req;
+ memset(&geran_req, 0, sizeof(geran_req));
+ geran_req.header.message_id = NFAPI_RSSI_REQUEST;
+ geran_req.header.phy_id = phy_id;
+ geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+ geran_req.geran_rssi_request.tl.tag = NFAPI_GERAN_RSSI_REQUEST_TAG;
+ geran_req.geran_rssi_request.frequency_band_indicator = 2;
+ geran_req.geran_rssi_request.measurement_period = 1000;
+ geran_req.geran_rssi_request.timeout = 0;
+ geran_req.geran_rssi_request.number_of_arfcns = 1;
+ geran_req.geran_rssi_request.arfcn[0].arfcn = 34;
+ geran_req.geran_rssi_request.arfcn[0].direction = 0;
+ nfapi_vnf_rssi_request(config, p5_idx, &geran_req);
+ }
+ {
+ nfapi_cell_search_request_t lte_req;
+ memset(<e_req, 0, sizeof(lte_req));
+ lte_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+ lte_req.header.phy_id = phy_id;
+ lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ lte_req.lte_cell_search_request.tl.tag = NFAPI_LTE_CELL_SEARCH_REQUEST_TAG;
+ lte_req.lte_cell_search_request.earfcn = 1234;
+ lte_req.lte_cell_search_request.measurement_bandwidth = 50;
+ lte_req.lte_cell_search_request.exhaustive_search = 1;
+ lte_req.lte_cell_search_request.timeout = 1000;
+ lte_req.lte_cell_search_request.number_of_pci = 1;
+ lte_req.lte_cell_search_request.pci[0] = 234;
+ nfapi_vnf_cell_search_request(config, p5_idx, <e_req);
+ nfapi_cell_search_request_t utran_req;
+ memset(&utran_req, 0, sizeof(utran_req));
+ utran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+ utran_req.header.phy_id = phy_id;
+ utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+ utran_req.utran_cell_search_request.tl.tag = NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG;
+ utran_req.utran_cell_search_request.uarfcn = 1234;
+ utran_req.utran_cell_search_request.exhaustive_search = 0;
+ utran_req.utran_cell_search_request.timeout = 1000;
+ utran_req.utran_cell_search_request.number_of_psc = 1;
+ utran_req.utran_cell_search_request.psc[0] = 234;
+ nfapi_vnf_cell_search_request(config, p5_idx, &utran_req);
+ nfapi_cell_search_request_t geran_req;
+ memset(&geran_req, 0, sizeof(geran_req));
+ geran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST;
+ geran_req.header.phy_id = phy_id;
+ geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+ geran_req.geran_cell_search_request.tl.tag = NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG;
+ geran_req.geran_cell_search_request.timeout = 1000;
+ geran_req.geran_cell_search_request.number_of_arfcn = 1;
+ geran_req.geran_cell_search_request.arfcn[0] = 8765;
+ nfapi_vnf_cell_search_request(config, p5_idx, &geran_req);
+ }
+ {
+ nfapi_broadcast_detect_request_t lte_req;
+ memset(<e_req, 0, sizeof(lte_req));
+ lte_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+ lte_req.header.phy_id = phy_id;
+ lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ lte_req.lte_broadcast_detect_request.tl.tag = NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG;
+ lte_req.lte_broadcast_detect_request.earfcn = 1234;
+ lte_req.lte_broadcast_detect_request.pci = 50;
+ lte_req.lte_broadcast_detect_request.timeout = 1000;
+ lte_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+ lte_req.pnf_cell_search_state.length = 3;
+ nfapi_vnf_broadcast_detect_request(config, p5_idx, <e_req);
+ nfapi_broadcast_detect_request_t utran_req;
+ memset(&utran_req, 0, sizeof(utran_req));
+ utran_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST;
+ utran_req.header.phy_id = phy_id;
+ utran_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ utran_req.utran_broadcast_detect_request.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG;
+ utran_req.utran_broadcast_detect_request.uarfcn = 1234;
+ utran_req.utran_broadcast_detect_request.psc = 50;
+ utran_req.utran_broadcast_detect_request.timeout = 1000;
+ utran_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG;
+ utran_req.pnf_cell_search_state.length = 3;
+ nfapi_vnf_broadcast_detect_request(config, p5_idx, &utran_req);
+ }
+ {
+ nfapi_system_information_schedule_request_t lte_req;
+ memset(<e_req, 0, sizeof(lte_req));
+ lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST;
+ lte_req.header.phy_id = phy_id;
+ lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ lte_req.lte_system_information_schedule_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG;
+ lte_req.lte_system_information_schedule_request.earfcn = 1234;
+ lte_req.lte_system_information_schedule_request.pci = 50;
+ lte_req.lte_system_information_schedule_request.downlink_channel_bandwidth = 100;
+ lte_req.lte_system_information_schedule_request.phich_configuration = 3;
+ lte_req.lte_system_information_schedule_request.number_of_tx_antenna = 2;
+ lte_req.lte_system_information_schedule_request.retry_count = 4;
+ lte_req.lte_system_information_schedule_request.timeout = 1000;
+ lte_req.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG;
+ lte_req.pnf_cell_broadcast_state.length = 3;
+ nfapi_vnf_system_information_schedule_request(config, p5_idx, <e_req);
+ }
+ {
+ nfapi_system_information_request_t lte_req;
+ memset(<e_req, 0, sizeof(lte_req));
+ lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+ lte_req.header.phy_id = phy_id;
+ lte_req.rat_type = NFAPI_RAT_TYPE_LTE;
+ lte_req.lte_system_information_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG;
+ lte_req.lte_system_information_request.earfcn = 1234;
+ lte_req.lte_system_information_request.pci= 456;
+ lte_req.lte_system_information_request.downlink_channel_bandwidth = 5;
+ lte_req.lte_system_information_request.phich_configuration = 2;
+ lte_req.lte_system_information_request.number_of_tx_antenna = 2;
+ lte_req.lte_system_information_request.number_of_si_periodicity = 1;
+ lte_req.lte_system_information_request.si_periodicity[0].si_periodicity = 3;
+ lte_req.lte_system_information_request.si_periodicity[0].si_index = 3;
+ lte_req.lte_system_information_request.si_window_length = 15;
+ lte_req.lte_system_information_request.timeout = 1000;
+ nfapi_vnf_system_information_request(config, p5_idx, <e_req);
+ nfapi_system_information_request_t utran_req;
+ memset(&utran_req, 0, sizeof(utran_req));
+ utran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+ utran_req.header.phy_id = phy_id;
+ utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN;
+ utran_req.utran_system_information_request.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG;
+ utran_req.utran_system_information_request.uarfcn = 1234;
+ utran_req.utran_system_information_request.psc = 456;
+ utran_req.utran_system_information_request.timeout = 1000;
+ nfapi_vnf_system_information_request(config, p5_idx, &utran_req);
+ nfapi_system_information_request_t geran_req;
+ memset(&geran_req, 0, sizeof(geran_req));
+ geran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST;
+ geran_req.header.phy_id = phy_id;
+ geran_req.rat_type = NFAPI_RAT_TYPE_GERAN;
+ geran_req.geran_system_information_request.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG;
+ geran_req.geran_system_information_request.arfcn = 1234;
+ geran_req.geran_system_information_request.bsic = 21;
+ geran_req.geran_system_information_request.timeout = 1000;
+ nfapi_vnf_system_information_request(config, p5_idx, &geran_req);
+ }
+ {
+ nfapi_nmm_stop_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_NMM_STOP_REQUEST;
+ req.header.phy_id = phy_id;
+ nfapi_vnf_nmm_stop_request(config, p5_idx, &req);
+ }
}
-int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp)
-{
- printf("[VNF_SIM] start response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) {
+ printf("[VNF_SIM] start response idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
+ vnf_info *vnf = (vnf_info *)(config->user_data);
- vnf_info* vnf = (vnf_info*)(config->user_data);
-
- if(vnf->wireshark_test_mode)
- test_p4_requests(config, p5_idx, resp->header.phy_id);
+ if(vnf->wireshark_test_mode)
+ test_p4_requests(config, p5_idx, resp->header.phy_id);
- auto find_result = vnf->pnfs.find(p5_idx);
- if(find_result != vnf->pnfs.end())
- {
- pnf_info& pnf = find_result->second;
-
-
- auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item)
- { return item.id == resp->header.phy_id; });
+ auto find_result = vnf->pnfs.find(p5_idx);
- if(found != pnf.phys.end())
- {
- phy_info& phy = (*found);
+ if(find_result != vnf->pnfs.end()) {
+ pnf_info &pnf = find_result->second;
+ auto found = std::find_if(pnf.phys.begin(), pnf.phys.end(), [&](phy_info& item) {
+ return item.id == resp->header.phy_id;
+ });
- vnf_p7_info& p7_vnf = vnf->p7_vnfs[0];
+ if(found != pnf.phys.end()) {
+ phy_info &phy = (*found);
+ vnf_p7_info &p7_vnf = vnf->p7_vnfs[0];
+ nfapi_vnf_p7_add_pnf((p7_vnf.config.get()), phy.remote_addr.c_str(), phy.remote_port, phy.id);
+ }
+ }
- nfapi_vnf_p7_add_pnf((p7_vnf.config.get()), phy.remote_addr.c_str(), phy.remote_port, phy.id);
-
-
- }
-
-
- }
- return 0;
+ return 0;
}
-nfapi_p4_p5_message_header_t* vnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t* msg_size)
-{
- if(message_id == P5_VENDOR_EXT_RSP)
- {
- *msg_size = sizeof(vendor_ext_p5_rsp);
- return (nfapi_p4_p5_message_header_t*)malloc(sizeof(vendor_ext_p5_rsp));
- }
- return 0;
+nfapi_p4_p5_message_header_t *vnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
+ if(message_id == P5_VENDOR_EXT_RSP) {
+ *msg_size = sizeof(vendor_ext_p5_rsp);
+ return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_rsp));
+ }
+
+ return 0;
}
-void vnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t* header)
-{
- free(header);
+void vnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
+ free(header);
}
-int vendor_ext_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg)
-{
- printf("[VNF_SIM] %s\n", __FUNCTION__);
+int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
+ printf("[VNF_SIM] %s\n", __FUNCTION__);
- switch(msg->message_id)
- {
- case P5_VENDOR_EXT_RSP:
- {
- vendor_ext_p5_rsp* rsp = (vendor_ext_p5_rsp*)msg;
- printf("[VNF_SIM] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
+ switch(msg->message_id) {
+ case P5_VENDOR_EXT_RSP: {
+ vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
+ printf("[VNF_SIM] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
+ // send the start request
+ nfapi_pnf_start_request_t req;
+ memset(&req, 0, sizeof(req));
+ req.header.message_id = NFAPI_PNF_START_REQUEST;
+ nfapi_vnf_pnf_start_req(config, p5_idx, &req);
+ }
+ break;
+ }
- // send the start request
-
- nfapi_pnf_start_request_t req;
- memset(&req, 0, sizeof(req));
- req.header.message_id = NFAPI_PNF_START_REQUEST;
- nfapi_vnf_pnf_start_req(config, p5_idx, &req);
- }
- break;
-
- }
-
- return 0;
+ return 0;
}
-int read_vnf_xml(vnf_info& vnf, const char* xml_file)
-{
- try
- {
-
- std::ifstream input(xml_file);
-
- using boost::property_tree::ptree;
- ptree pt;
-
- read_xml(input, pt);
-
-
-
- for(const auto& v : pt.get_child("vnf.vnf_p7_list"))
- {
- if(v.first == "vnf_p7")
- {
- vnf_p7_info vnf_p7;
- vnf_p7.local_port = v.second.get("port");
- vnf_p7.local_addr = v.second.get("address");
-
- vnf_p7.timing_window = v.second.get("timing_window");
- vnf_p7.periodic_timing_enabled = v.second.get("periodic_timing_enabled");
- vnf_p7.aperiodic_timing_enabled = v.second.get("aperiodic_timing_enabled");
- vnf_p7.periodic_timing_period = v.second.get