mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-16 06:00:28 +00:00
Compare commits
153 Commits
develop-Fe
...
2018.w48
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb5739dcf7 | ||
|
|
84d66914f0 | ||
|
|
f88a43ca60 | ||
|
|
5d0fe4cea7 | ||
|
|
0db0249057 | ||
|
|
d109ffa112 | ||
|
|
0d67854ce0 | ||
|
|
f14023ec16 | ||
|
|
15314aebff | ||
|
|
c7e611ead1 | ||
|
|
4d934dacfb | ||
|
|
fb5201ba97 | ||
|
|
814b967cce | ||
|
|
f8ccd284a0 | ||
|
|
4f0fd0612a | ||
|
|
55732deb80 | ||
|
|
4fdccd3b4d | ||
|
|
b89f9284dd | ||
|
|
ed61d774f6 | ||
|
|
e77d910398 | ||
|
|
cf07c4d394 | ||
|
|
d082b50896 | ||
|
|
1094835db1 | ||
|
|
c194956da3 | ||
|
|
df5fe4fffd | ||
|
|
00c230ba47 | ||
|
|
c7dbada527 | ||
|
|
e6cd6ba21f | ||
|
|
117e2a145e | ||
|
|
a86ca81541 | ||
|
|
0f0665e9e7 | ||
|
|
884d4b631d | ||
|
|
3df8f96bba | ||
|
|
682be3e2b4 | ||
|
|
220080741e | ||
|
|
382981b757 | ||
|
|
2f8c3d6eaa | ||
|
|
00f4890b14 | ||
|
|
b09e94542d | ||
|
|
04a3cda0b2 | ||
|
|
bfb65b57f7 | ||
|
|
6a3687fe28 | ||
|
|
700437f184 | ||
|
|
22e44306f8 | ||
|
|
0cf8515882 | ||
|
|
2f11541973 | ||
|
|
af892cc058 | ||
|
|
edeffee62c | ||
|
|
9a080adec5 | ||
|
|
961a70a04e | ||
|
|
a409614185 | ||
|
|
287010f82f | ||
|
|
76e1636258 | ||
|
|
c1f7678e5b | ||
|
|
18a099fa76 | ||
|
|
7c71d8306e | ||
|
|
f81cf69985 | ||
|
|
d6ce682b56 | ||
|
|
4931a300ad | ||
|
|
d3f8f9d65b | ||
|
|
d00f80b5dd | ||
|
|
d8cf8104fb | ||
|
|
d48c7eaef1 | ||
|
|
9140839f75 | ||
|
|
e73169a232 | ||
|
|
a803adea2a | ||
|
|
4edc42a4b7 | ||
|
|
9b4d01f48f | ||
|
|
9db199269d | ||
|
|
36612d8c5d | ||
|
|
d49d0b10a6 | ||
|
|
eb6afba809 | ||
|
|
894fc6072c | ||
|
|
91ba760a02 | ||
|
|
6ce4b9ad66 | ||
|
|
83dde26914 | ||
|
|
f08ef335b4 | ||
|
|
337c068d22 | ||
|
|
95dc47cc07 | ||
|
|
d4092a32f9 | ||
|
|
59a690bb4b | ||
|
|
a9de514b7c | ||
|
|
a149d1cbfd | ||
|
|
ef20881664 | ||
|
|
65fd02b1b6 | ||
|
|
736febd064 | ||
|
|
7df76dfbfc | ||
|
|
c570ad63fe | ||
|
|
3515d4316f | ||
|
|
7c6a5ef288 | ||
|
|
03217fbad2 | ||
|
|
3a294a246a | ||
|
|
d2b9f0f4f8 | ||
|
|
94bf32b0d4 | ||
|
|
2a48796406 | ||
|
|
74dc481133 | ||
|
|
0a829e3eeb | ||
|
|
b8ce24febb | ||
|
|
d151ce6feb | ||
|
|
1c196a9eff | ||
|
|
47437903f9 | ||
|
|
df6030540a | ||
|
|
5eb2bd7d47 | ||
|
|
519708b6ec | ||
|
|
8dd62b32e3 | ||
|
|
18ec5d8047 | ||
|
|
2811dc7c0d | ||
|
|
d7e7d00806 | ||
|
|
49f69810e9 | ||
|
|
cf1db86665 | ||
|
|
1bb53286bb | ||
|
|
9b8e4e4cbe | ||
|
|
d89bfa72a0 | ||
|
|
e46031fec7 | ||
|
|
e4b0b3a7d6 | ||
|
|
355f47fb1e | ||
|
|
28b0c07df7 | ||
|
|
a7cf0cfa1f | ||
|
|
633534c2f0 | ||
|
|
6ae27efac0 | ||
|
|
a46443b2a9 | ||
|
|
bba23c7814 | ||
|
|
3fa0f5a93f | ||
|
|
266645d98d | ||
|
|
78051a314a | ||
|
|
a321e160cf | ||
|
|
342972c2ea | ||
|
|
f6f6570d6e | ||
|
|
387b4ff215 | ||
|
|
bbacffa7fd | ||
|
|
2966cdf1c0 | ||
|
|
57a383e77c | ||
|
|
9a6d30d716 | ||
|
|
2e5ae1eac6 | ||
|
|
35a7e3a180 | ||
|
|
fdb16fae7d | ||
|
|
a073e84369 | ||
|
|
7b264ac923 | ||
|
|
bab10e2748 | ||
|
|
506edcaec2 | ||
|
|
075a713de9 | ||
|
|
f58ad3c39f | ||
|
|
97ac780972 | ||
|
|
63d3bf148e | ||
|
|
bd1c609ca8 | ||
|
|
7240604115 | ||
|
|
753a664c06 | ||
|
|
80920618e6 | ||
|
|
ec702c88f3 | ||
|
|
c12e3234b0 | ||
|
|
ec367c4b36 | ||
|
|
a8f6accc9a | ||
|
|
7ea7af3ab8 |
@@ -115,10 +115,10 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- cppcheck") {
|
||||
stage ("Start VM -- basic-sim") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,23 +126,7 @@ pipeline {
|
||||
stage ("Start VM -- enb-usrp") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- basic-sim") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- phy-sim") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +134,7 @@ pipeline {
|
||||
stage ("Start VM -- enb-ethernet") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +142,23 @@ pipeline {
|
||||
stage ("Start VM -- ue-ethernet") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- phy-sim") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- cppcheck") {
|
||||
steps {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Analysis with cppcheck") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNb-USRP") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,16 +187,7 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build basic-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build physical simulators") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build phy-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +196,7 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNb-ethernet") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +205,16 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build UE-ethernet") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
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 physical simulators") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build phy-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,7 @@ pipeline {
|
||||
archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
|
||||
}
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
sh "./ci-scripts/reportBuildLocally.sh --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}"
|
||||
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}"
|
||||
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)) {
|
||||
@@ -263,7 +263,7 @@ pipeline {
|
||||
addGitLabMRComment comment: message
|
||||
}
|
||||
} else {
|
||||
sh "./ci-scripts/reportBuildLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
||||
}
|
||||
if(fileExists('build_results.html')) {
|
||||
sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' build_results.html"
|
||||
@@ -280,7 +280,7 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Test phy-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,205 +289,185 @@ pipeline {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Test basic-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Test on CI bench #1") {
|
||||
stages {
|
||||
stage ("Test FDD - Band 7 - B210") {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 ("Test TDD - Band 40 - B210") {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
} 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)
|
||||
]
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 IF4p5 - FDD - Band 7 - B210") {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Test IF4p5 - TDD - Band 40 - B210") {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
]
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,9 +484,9 @@ pipeline {
|
||||
if(fileExists('archives/vm_tests_logs.zip')) {
|
||||
archiveArtifacts artifacts: 'archives/vm_tests_logs.zip'
|
||||
if ("MERGE".equals(env.gitlabActionType)) {
|
||||
sh "./ci-scripts/reportTestLocally.sh --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}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool report-test --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}"
|
||||
} else {
|
||||
sh "./ci-scripts/reportTestLocally.sh --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool report-test --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
|
||||
}
|
||||
if(fileExists('test_simulator_results.html')) {
|
||||
sh "sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_simulator_results.html"
|
||||
@@ -519,7 +499,7 @@ pipeline {
|
||||
}
|
||||
stage ("Destroy all Virtual Machines") {
|
||||
steps {
|
||||
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,7 +507,7 @@ pipeline {
|
||||
always {
|
||||
script {
|
||||
// Stage destroy may not be run if error in previous stage
|
||||
sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
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!
|
||||
|
||||
@@ -53,6 +53,7 @@ def eNB_Repository
|
||||
def eNB_Branch
|
||||
def eNB_CommitID
|
||||
def eNB_AllowMergeRequestProcess = false
|
||||
def eNB_TargetBranch
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
@@ -61,6 +62,7 @@ pipeline {
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
ansiColor('xterm')
|
||||
lock (ciSmartPhoneResource)
|
||||
}
|
||||
// the following parameter options are commented out so it shows the ones
|
||||
// that you SHALL have to run the job.
|
||||
@@ -149,6 +151,14 @@ pipeline {
|
||||
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) {
|
||||
@@ -184,7 +194,6 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
dir ('ci-scripts') {
|
||||
lock (ciSmartPhoneResource) {
|
||||
try {
|
||||
echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
|
||||
withCredentials([
|
||||
@@ -192,12 +201,11 @@ pipeline {
|
||||
[$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=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --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=${testXMLFile}"
|
||||
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=${testXMLFile}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
ci-scripts/active_net_interfaces.awk
Normal file
1
ci-scripts/active_net_interfaces.awk
Normal file
@@ -0,0 +1 @@
|
||||
/inet.*brd/{print "interfaceToUse="$NF"done"}
|
||||
@@ -20,8 +20,8 @@
|
||||
# * contact@openairinterface.org
|
||||
# */
|
||||
|
||||
function usage {
|
||||
echo "OAI VM Build Check script"
|
||||
function build_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo " Requirements:"
|
||||
echo " -- uvtool uvtool-libvirt apt-cacher"
|
||||
@@ -31,9 +31,9 @@ function usage {
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " buildOnVM.sh [OPTIONS]"
|
||||
echo " oai-ci-vm-tool build [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "Mandatory Options:"
|
||||
echo "--------"
|
||||
echo " --job-name #### OR -jn ####"
|
||||
echo " Specify the name of the Jenkins job."
|
||||
@@ -44,356 +44,136 @@ function usage {
|
||||
echo " --workspace #### OR -ws ####"
|
||||
echo " Specify the workspace."
|
||||
echo ""
|
||||
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 "Options:"
|
||||
echo "--------"
|
||||
variant_usage
|
||||
echo " Specify the variant to build."
|
||||
echo ""
|
||||
echo " --keep-vm-alive OR -k"
|
||||
echo " Keep the VM alive after the build."
|
||||
echo ""
|
||||
echo " --daemon OR -D"
|
||||
echo " Run as daemon"
|
||||
echo ""
|
||||
echo " --help OR -h"
|
||||
echo " Print this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
function variant_usage {
|
||||
echo "OAI VM Build Check script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
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 ""
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ] || [ $# -gt 9 ]
|
||||
then
|
||||
echo "Syntax Error: not the correct number of arguments"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VM_TEMPLATE=ci-
|
||||
JOB_NAME=XX
|
||||
BUILD_ID=XX
|
||||
VM_NAME=ci-enb-usrp
|
||||
VM_MEMORY=2048
|
||||
VM_CPU=4
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP"
|
||||
KEEP_VM_ALIVE=0
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-ws|--workspace)
|
||||
JENKINS_WKSP="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-k|--keep-vm-alive)
|
||||
KEEP_VM_ALIVE=1
|
||||
shift
|
||||
;;
|
||||
-v1)
|
||||
VM_NAME=ci-enb-usrp
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP --mu"
|
||||
shift
|
||||
;;
|
||||
-v2)
|
||||
VM_NAME=ci-basic-sim
|
||||
ARCHIVES_LOC=basic_sim
|
||||
LOG_PATTERN=basic_simulator
|
||||
NB_PATTERN_FILES=2
|
||||
BUILD_OPTIONS="--basic-simulator"
|
||||
VM_MEMORY=8192
|
||||
VM_CPU=4
|
||||
shift
|
||||
;;
|
||||
-v3)
|
||||
VM_NAME=ci-phy-sim
|
||||
ARCHIVES_LOC=phy_sim
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=3
|
||||
BUILD_OPTIONS="--phy_simulators"
|
||||
shift
|
||||
;;
|
||||
-v4)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=4096
|
||||
ARCHIVES_LOC=cppcheck
|
||||
LOG_PATTERN=cppcheck.xml
|
||||
NB_PATTERN_FILES=1
|
||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
||||
shift
|
||||
;;
|
||||
-v7)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
ARCHIVES_LOC=enb_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
|
||||
shift
|
||||
;;
|
||||
-v8)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
ARCHIVES_LOC=ue_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
|
||||
shift
|
||||
;;
|
||||
--variant)
|
||||
variant="$2"
|
||||
case $variant in
|
||||
enb-usrp)
|
||||
VM_NAME=ci-enb-usrp
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP --mu"
|
||||
;;
|
||||
basic-sim)
|
||||
VM_NAME=ci-basic-sim
|
||||
ARCHIVES_LOC=basic_sim
|
||||
LOG_PATTERN=basic_simulator
|
||||
NB_PATTERN_FILES=2
|
||||
BUILD_OPTIONS="--basic-simulator"
|
||||
VM_MEMORY=8192
|
||||
VM_CPU=4
|
||||
;;
|
||||
phy-sim)
|
||||
VM_NAME=ci-phy-sim
|
||||
ARCHIVES_LOC=phy_sim
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=3
|
||||
BUILD_OPTIONS="--phy_simulators"
|
||||
;;
|
||||
cppcheck)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=4096
|
||||
ARCHIVES_LOC=cppcheck
|
||||
LOG_PATTERN=cppcheck.xml
|
||||
NB_PATTERN_FILES=1
|
||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
||||
;;
|
||||
enb-ethernet)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
ARCHIVES_LOC=enb_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
|
||||
;;
|
||||
ue-ethernet)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
ARCHIVES_LOC=ue_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Variant option -> $variant"
|
||||
echo ""
|
||||
variant_usage
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -f $JENKINS_WKSP/localZip.zip ]
|
||||
then
|
||||
echo "Missing localZip.zip file!"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f /etc/apt/apt.conf.d/01proxy ]
|
||||
then
|
||||
echo "Missing /etc/apt/apt.conf.d/01proxy file!"
|
||||
echo "Is apt-cacher installed and configured?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
|
||||
then
|
||||
VM_TEMPLATE=ci-
|
||||
else
|
||||
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
|
||||
fi
|
||||
|
||||
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
|
||||
VM_CMDS=${VM_NAME}_cmds.txt
|
||||
ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC}
|
||||
|
||||
echo "VM_NAME = $VM_NAME"
|
||||
echo "VM_CMD_FILE = $VM_CMDS"
|
||||
echo "JENKINS_WKSP = $JENKINS_WKSP"
|
||||
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
|
||||
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
|
||||
|
||||
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
|
||||
|
||||
if [ $IS_VM_ALIVE -eq 0 ]
|
||||
then
|
||||
echo "############################################################"
|
||||
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
|
||||
echo "############################################################"
|
||||
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
|
||||
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 "############################################################"
|
||||
scp -o StrictHostKeyChecking=no localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu
|
||||
scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu
|
||||
|
||||
echo "############################################################"
|
||||
echo "Running install and build script on VM ($VM_NAME)"
|
||||
echo "############################################################"
|
||||
echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
|
||||
echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
fi
|
||||
echo "mkdir tmp" >> $VM_CMDS
|
||||
echo "cd tmp" >> $VM_CMDS
|
||||
echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS
|
||||
echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
echo "mkdir cmake_targets/log" >> $VM_CMDS
|
||||
echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS
|
||||
echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $VM_CMDS
|
||||
echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"source oaienv\"" >> $VM_CMDS
|
||||
echo "source oaienv" >> $VM_CMDS
|
||||
echo "cd cmake_targets/" >> $VM_CMDS
|
||||
echo "mkdir log" >> $VM_CMDS
|
||||
echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS
|
||||
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS
|
||||
fi
|
||||
ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS
|
||||
|
||||
echo "############################################################"
|
||||
echo "Creating a tmp folder to store results and artifacts"
|
||||
echo "############################################################"
|
||||
if [ ! -d $JENKINS_WKSP/archives ]
|
||||
then
|
||||
mkdir $JENKINS_WKSP/archives
|
||||
fi
|
||||
|
||||
if [ ! -d $ARCHIVES_LOC ]
|
||||
then
|
||||
mkdir $ARCHIVES_LOC
|
||||
fi
|
||||
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC
|
||||
fi
|
||||
|
||||
if [ $KEEP_VM_ALIVE -eq 0 ]
|
||||
then
|
||||
echo "############################################################"
|
||||
echo "Destroying VM"
|
||||
echo "############################################################"
|
||||
uvt-kvm destroy $VM_NAME
|
||||
ssh-keygen -R $VM_IP_ADDR
|
||||
fi
|
||||
rm -f $VM_CMDS
|
||||
|
||||
echo "############################################################"
|
||||
echo "Checking build status"
|
||||
echo "############################################################"
|
||||
|
||||
LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml`
|
||||
STATUS=0
|
||||
NB_FOUND_FILES=0
|
||||
|
||||
for FULLFILE in $LOG_FILES
|
||||
do
|
||||
if [[ $FULLFILE == *"$LOG_PATTERN"* ]]
|
||||
function build_on_vm {
|
||||
if [ ! -f $JENKINS_WKSP/localZip.zip ]
|
||||
then
|
||||
filename=$(basename -- "$FULLFILE")
|
||||
if [ "$LOG_PATTERN" == ".Rel14.txt" ]
|
||||
then
|
||||
PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"`
|
||||
fi
|
||||
if [ "$LOG_PATTERN" == "basic_simulator" ]
|
||||
then
|
||||
PASS_PATTERN="lte-"
|
||||
fi
|
||||
if [ "$LOG_PATTERN" == "cppcheck.xml" ]
|
||||
then
|
||||
PASS_PATTERN="results version"
|
||||
LOCAL_STAT=`egrep -c "$PASS_PATTERN" $FULLFILE`
|
||||
else
|
||||
LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE`
|
||||
fi
|
||||
if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi
|
||||
NB_FOUND_FILES=$((NB_FOUND_FILES + 1))
|
||||
echo "Missing localZip.zip file!"
|
||||
STATUS=1
|
||||
return
|
||||
fi
|
||||
if [ ! -f /etc/apt/apt.conf.d/01proxy ]
|
||||
then
|
||||
echo "Missing /etc/apt/apt.conf.d/01proxy file!"
|
||||
echo "Is apt-cacher installed and configured?"
|
||||
STATUS=1
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
|
||||
if [ $STATUS -eq 0 ]
|
||||
then
|
||||
echo "STATUS seems OK"
|
||||
else
|
||||
echo "STATUS failed?"
|
||||
fi
|
||||
exit $STATUS
|
||||
echo "VM_NAME = $VM_NAME"
|
||||
echo "VM_CMD_FILE = $VM_CMDS"
|
||||
echo "JENKINS_WKSP = $JENKINS_WKSP"
|
||||
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
|
||||
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
|
||||
|
||||
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
|
||||
|
||||
if [ $IS_VM_ALIVE -eq 0 ]
|
||||
then
|
||||
echo "VM_MEMORY = $VM_MEMORY MBytes"
|
||||
echo "VM_CPU = $VM_CPU"
|
||||
echo "############################################################"
|
||||
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
|
||||
echo "############################################################"
|
||||
uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml
|
||||
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 "############################################################"
|
||||
scp -o StrictHostKeyChecking=no $JENKINS_WKSP/localZip.zip ubuntu@$VM_IP_ADDR:/home/ubuntu
|
||||
scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$VM_IP_ADDR:/home/ubuntu
|
||||
|
||||
echo "############################################################"
|
||||
echo "Running install and build script on VM ($VM_NAME)"
|
||||
echo "############################################################"
|
||||
echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
|
||||
echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
if [ $DAEMON -eq 0 ]
|
||||
then
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip daemon cppcheck \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip daemon cppcheck >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
fi
|
||||
else
|
||||
if [ $DAEMON -eq 0 ]
|
||||
then
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"sudo apt-get --yes --quiet install zip daemon subversion libboost-dev \"" >> $VM_CMDS
|
||||
echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS
|
||||
echo "sudo apt-get --yes install zip daemon subversion libboost-dev >> zip-install.txt 2>&1" >> $VM_CMDS
|
||||
fi
|
||||
fi
|
||||
echo "mkdir tmp" >> $VM_CMDS
|
||||
echo "cd tmp" >> $VM_CMDS
|
||||
echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS
|
||||
echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
echo "mkdir cmake_targets/log" >> $VM_CMDS
|
||||
echo "chmod 777 cmake_targets/log" >> $VM_CMDS
|
||||
echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS
|
||||
echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $VM_CMDS
|
||||
if [ $DAEMON -eq 0 ]
|
||||
then
|
||||
echo "cppcheck $BUILD_OPTIONS . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"cppcheck $BUILD_OPTIONS .\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS
|
||||
echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp -O /home/ubuntu/tmp/cmake_targets/log/cppcheck_build.txt -E /home/ubuntu/tmp/cmake_targets/log/cppcheck.xml ./my-vm-build.sh" >> $VM_CMDS
|
||||
fi
|
||||
else
|
||||
echo "echo \"source oaienv\"" >> $VM_CMDS
|
||||
echo "source oaienv" >> $VM_CMDS
|
||||
echo "cd cmake_targets/" >> $VM_CMDS
|
||||
echo "mkdir log" >> $VM_CMDS
|
||||
echo "chmod 777 log" >> $VM_CMDS
|
||||
echo "cp /home/ubuntu/zip-install.txt log" >> $VM_CMDS
|
||||
if [ $DAEMON -eq 0 ]
|
||||
then
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS
|
||||
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS
|
||||
echo "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
|
||||
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
|
||||
rm -f $VM_CMDS
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -144,13 +144,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -144,13 +144,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -144,13 +144,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -181,12 +181,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -181,12 +181,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -181,12 +181,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
265
ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
Normal file
265
ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf
Normal file
@@ -0,0 +1,265 @@
|
||||
Active_eNBs = ( "eNB-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-Eurecom-LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } );
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
////////// 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 = 2;
|
||||
nb_antennas_tx = 2;
|
||||
nb_antennas_rx = 2;
|
||||
tx_gain = 90;
|
||||
rx_gain = 125;
|
||||
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_groupHoppingEnabled = "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 = 2;
|
||||
|
||||
//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
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
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";
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
nb_tx = 2
|
||||
nb_rx = 2
|
||||
att_tx = 0
|
||||
att_rx = 0;
|
||||
bands = [7];
|
||||
max_pdschReferenceSignalPower = -27;
|
||||
max_rxgain = 115;
|
||||
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_RU_L1_TRX_SPLIT";
|
||||
#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 :
|
||||
{
|
||||
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";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
@@ -186,7 +186,6 @@ eNBs =
|
||||
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
|
||||
};
|
||||
|
||||
@@ -145,11 +145,9 @@ eNBs =
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -147,13 +147,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -147,13 +147,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "10.0.0.2";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -147,13 +147,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.0.1/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.0.1/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -184,12 +184,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -184,12 +184,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ eNBs =
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
@@ -184,12 +184,11 @@ eNBs =
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
# * contact@openairinterface.org
|
||||
# */
|
||||
|
||||
function usage {
|
||||
echo "OAI VM Creation script"
|
||||
function create_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo " Requirements:"
|
||||
echo " -- uvtool uvtool-libvirt apt-cacher"
|
||||
@@ -31,9 +31,9 @@ function usage {
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " createVM.sh [OPTIONS]"
|
||||
echo " oai-ci-vm-tool create [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "Mandatory Options:"
|
||||
echo "--------"
|
||||
echo " --job-name #### OR -jn ####"
|
||||
echo " Specify the name of the Jenkins job."
|
||||
@@ -41,12 +41,7 @@ function usage {
|
||||
echo " --build-id #### OR -id ####"
|
||||
echo " Specify the build ID of the Jenkins job."
|
||||
echo ""
|
||||
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"
|
||||
variant_usage
|
||||
echo " Specify the variant to build."
|
||||
echo ""
|
||||
echo " --help OR -h"
|
||||
@@ -54,144 +49,21 @@ function usage {
|
||||
echo ""
|
||||
}
|
||||
|
||||
function variant_usage {
|
||||
echo "OAI VM Build Check script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
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 ""
|
||||
function create_vm {
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
echo "VM_NAME = $VM_NAME"
|
||||
echo "VM_MEMORY = $VM_MEMORY MBytes"
|
||||
echo "VM_CPU = $VM_CPU"
|
||||
|
||||
echo "############################################################"
|
||||
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
|
||||
echo "############################################################"
|
||||
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"
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ] || [ $# -gt 6 ]
|
||||
then
|
||||
echo "Syntax Error: not the correct number of arguments"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VM_TEMPLATE=ci-
|
||||
JOB_NAME=XX
|
||||
BUILD_ID=XX
|
||||
VM_NAME=ci-enb-usrp
|
||||
VM_MEMORY=2048
|
||||
VM_CPU=4
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-v1)
|
||||
VM_NAME=ci-enb-usrp
|
||||
shift
|
||||
;;
|
||||
-v2)
|
||||
VM_NAME=ci-basic-sim
|
||||
VM_MEMORY=8192
|
||||
shift
|
||||
;;
|
||||
-v3)
|
||||
VM_NAME=ci-phy-sim
|
||||
shift
|
||||
;;
|
||||
-v4)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=4096
|
||||
VM_CPU=4
|
||||
shift
|
||||
;;
|
||||
-v7)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
shift
|
||||
;;
|
||||
-v8)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
shift
|
||||
;;
|
||||
--variant)
|
||||
variant="$2"
|
||||
case $variant in
|
||||
enb-usrp)
|
||||
VM_NAME=ci-enb-usrp
|
||||
;;
|
||||
basic-sim)
|
||||
VM_NAME=ci-basic-sim
|
||||
VM_MEMORY=8192
|
||||
;;
|
||||
phy-sim)
|
||||
VM_NAME=ci-phy-sim
|
||||
;;
|
||||
cppcheck)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=4096
|
||||
VM_CPU=4
|
||||
;;
|
||||
enb-ethernet)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
;;
|
||||
ue-ethernet)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Variant option -> $variant"
|
||||
echo ""
|
||||
variant_usage
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
|
||||
then
|
||||
VM_TEMPLATE=ci-
|
||||
else
|
||||
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
|
||||
fi
|
||||
|
||||
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
|
||||
VM_CMDS=${VM_NAME}_cmds.txt
|
||||
|
||||
echo "VM_NAME = $VM_NAME"
|
||||
echo "VM_MEMORY = $VM_MEMORY MBytes"
|
||||
echo "VM_CPU = $VM_CPU"
|
||||
|
||||
echo "############################################################"
|
||||
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
|
||||
echo "############################################################"
|
||||
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"
|
||||
exit 0
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
# * contact@openairinterface.org
|
||||
# */
|
||||
|
||||
function usage {
|
||||
echo "OAI VM Destroy script"
|
||||
function destroy_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo " Requirements:"
|
||||
echo " -- uvtool uvtool-libvirt apt-cacher"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " destroyAllRunningVM.sh [OPTIONS]"
|
||||
echo " oai-ci-vm-tool destroy [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "Mandatory Options:"
|
||||
echo "--------"
|
||||
echo " --job-name #### OR -jn ####"
|
||||
echo " Specify the name of the Jenkins job."
|
||||
@@ -36,66 +38,26 @@ function usage {
|
||||
echo " --build-id #### OR -id ####"
|
||||
echo " Specify the build ID of the Jenkins job."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
echo " --help OR -h"
|
||||
echo " Print this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ $# -gt 4 ]
|
||||
then
|
||||
echo "Syntax Error: not the correct number of arguments"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
function destroy_vm {
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
echo "VM_TEMPLATE = $VM_TEMPLATE"
|
||||
|
||||
VM_TEMPLATE=ci-
|
||||
JOB_NAME=XX
|
||||
BUILD_ID=XX
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
|
||||
then
|
||||
VM_TEMPLATE=ci-
|
||||
else
|
||||
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
|
||||
fi
|
||||
|
||||
LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE`
|
||||
|
||||
for CI_VM in $LIST_CI_VM
|
||||
do
|
||||
VM_IP_ADDR=`uvt-kvm ip $CI_VM`
|
||||
echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR"
|
||||
uvt-kvm destroy $CI_VM
|
||||
ssh-keygen -R $VM_IP_ADDR
|
||||
done
|
||||
|
||||
exit 0
|
||||
LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE`
|
||||
|
||||
for CI_VM in $LIST_CI_VM
|
||||
do
|
||||
VM_IP_ADDR=`uvt-kvm ip $CI_VM`
|
||||
echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR"
|
||||
uvt-kvm destroy $CI_VM
|
||||
ssh-keygen -R $VM_IP_ADDR
|
||||
done
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ class SSHConnection():
|
||||
self.eNBBranch = ''
|
||||
self.eNB_AllowMerge = False
|
||||
self.eNBCommitID = ''
|
||||
self.eNBTargetBranch = ''
|
||||
self.eNBUserName = ''
|
||||
self.eNBPassword = ''
|
||||
self.eNBSourceCodePath = ''
|
||||
@@ -101,13 +102,16 @@ class SSHConnection():
|
||||
self.iperf_args = ''
|
||||
self.iperf_packetloss_threshold = ''
|
||||
self.iperf_profile = ''
|
||||
self.nbMaxUEtoAttach = -1
|
||||
self.UEDevices = []
|
||||
self.CatMDevices = []
|
||||
self.UEIPAddresses = []
|
||||
self.htmlFile = ''
|
||||
self.htmlHeaderCreated = False
|
||||
self.htmlFooterCreated = False
|
||||
self.htmlUEConnected = 0
|
||||
self.htmleNBFailureMsg = ''
|
||||
self.picocom_closure = False
|
||||
|
||||
def open(self, ipaddress, username, password):
|
||||
count = 0
|
||||
@@ -169,8 +173,9 @@ class SSHConnection():
|
||||
elif self.sshresponse == 2:
|
||||
logging.debug('\u001B[1;37;41m Unexpected TIMEOUT \u001B[0m')
|
||||
logging.debug('Expected Line : ' + expectedline)
|
||||
result = re.search('ping |iperf ', str(commandline))
|
||||
result = re.search('ping |iperf |picocom', str(commandline))
|
||||
if result is None:
|
||||
logging.debug(str(self.ssh.before))
|
||||
sys.exit(self.sshresponse)
|
||||
else:
|
||||
return -1
|
||||
@@ -186,9 +191,10 @@ class SSHConnection():
|
||||
if self.sshresponse == 0:
|
||||
pass
|
||||
elif self.sshresponse == 1:
|
||||
logging.debug('\u001B[1;37;41m Unexpected TIMEOUT \u001B[0m')
|
||||
if not self.picocom_closure:
|
||||
logging.debug('\u001B[1;37;41m Unexpected TIMEOUT during closing\u001B[0m')
|
||||
else:
|
||||
logging.debug('\u001B[1;37;41m Unexpected Others \u001B[0m')
|
||||
logging.debug('\u001B[1;37;41m Unexpected Others during closing\u001B[0m')
|
||||
|
||||
def copyin(self, ipaddress, username, password, source, destination):
|
||||
logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination)
|
||||
@@ -264,16 +270,23 @@ class SSHConnection():
|
||||
# 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.eNBBranch != 'develop') and (self.eNBBranch != 'origin/develop'):
|
||||
self.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5)
|
||||
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('mkdir -p log', '\$', 5)
|
||||
self.command('chmod 777 log', '\$', 5)
|
||||
# no need to remove in log (git clean did the trick)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S 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 -a compile_oai_enb.log', 'Bypassing the Tests', 600)
|
||||
self.command('mkdir -p build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S mv log/* ' + 'build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S mv compile_oai_enb.log ' + 'build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('mv log/* ' + 'build_log_' + SSH.testCase_id, '\$', 5)
|
||||
self.command('mv compile_oai_enb.log ' + 'build_log_' + SSH.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)
|
||||
|
||||
@@ -346,6 +359,18 @@ class SSHConnection():
|
||||
self.CreateHtmlTestRow(self.Initialize_eNB_args, 'KO', pStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
sys.exit(1)
|
||||
# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||
self.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5)
|
||||
result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', str(self.ssh.before))
|
||||
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_' + SSH.testCase_id + '_s1log.pcap', '\$', 5)
|
||||
self.command('echo $USER; nohup sudo tshark -f "host ' + self.eNBIPAddress +'" -i ' + eth_interface + ' -w /tmp/enb_' + SSH.testCase_id + '_s1log.pcap > /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
|
||||
@@ -353,6 +378,14 @@ class SSHConnection():
|
||||
extIdx = full_config_file.find('.conf')
|
||||
if (extIdx > 0):
|
||||
extra_options = full_config_file[extIdx + 5:]
|
||||
# if tracer options is on, compiling and running T Tracer
|
||||
result = re.search('T_stdout', str(extra_options))
|
||||
if result is not None:
|
||||
logging.debug('\u001B[1m Compiling and launching T Tracer\u001B[0m')
|
||||
self.command('cd common/utils/T/tracer', '\$', 5)
|
||||
self.command('make', '\$', 10)
|
||||
self.command('echo $USER; nohup ./record -d ../T_messages.txt -o ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '_record.raw -ON -off VCD -off HEAVY -off LEGACY_GROUP_TRACE -off LEGACY_GROUP_DEBUG > ' + self.eNBSourceCodePath + '/cmake_targets/enb_' + SSH.testCase_id + '_record.log 2>&1 &', self.eNBUserName, 5)
|
||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||
full_config_file = full_config_file[:extIdx + 5]
|
||||
config_path, config_file = os.path.split(full_config_file)
|
||||
else:
|
||||
@@ -364,10 +397,8 @@ class SSHConnection():
|
||||
rruCheck = True
|
||||
# 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/mme_ip_address.*$/mme_ip_address = ( { ipv4 = "' + self.EPCIPAddress + '";/\' ' + ci_full_config_file, '\$', 2);
|
||||
self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_S1_MME.*$/ENB_IPV4_ADDRESS_FOR_S1_MME = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2);
|
||||
self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_S1U.*$/ENB_IPV4_ADDRESS_FOR_S1U = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2);
|
||||
self.command('sed -i -e \'s/ENB_IPV4_ADDRESS_FOR_X2C.*$/ENB_IPV4_ADDRESS_FOR_X2C = "' + self.eNBIPAddress + '";/\' ' + ci_full_config_file, '\$', 2);
|
||||
self.command('sed -i -e \'s/CI_MME_IP_ADDR/' + self.EPCIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
|
||||
self.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2);
|
||||
# Launch eNB with the modified config file
|
||||
self.command('source oaienv', '\$', 5)
|
||||
self.command('cd cmake_targets', '\$', 5)
|
||||
@@ -383,14 +414,29 @@ class SSHConnection():
|
||||
while (doLoop):
|
||||
loopCounter = loopCounter - 1
|
||||
if (loopCounter == 0):
|
||||
# In case of T tracer recording, we may need to kill it
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
self.command('killall --signal SIGKILL record', '\$', 5)
|
||||
self.close()
|
||||
doLoop = False
|
||||
logging.error('\u001B[1;37;41m eNB logging system did not show got sync! \u001B[0m')
|
||||
self.CreateHtmlTestRow('-O ' + config_file + extra_options, 'KO', ALL_PROCESSES_OK)
|
||||
self.CreateHtmlFooter(False)
|
||||
self.close()
|
||||
# In case of T tracer recording, we need to kill tshark on EPC side
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
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)
|
||||
self.close()
|
||||
time.sleep(1)
|
||||
pcap_log_file = 'enb_' + SSH.testCase_id + '_s1log.pcap'
|
||||
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/.')
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --color=never -i "wait|sync"', '\$', 4)
|
||||
self.command('stdbuf -o0 cat enb_' + SSH.testCase_id + '.log | egrep --text --color=never -i "wait|sync"', '\$', 4)
|
||||
if rruCheck:
|
||||
result = re.search('wait RUs', str(self.ssh.before))
|
||||
else:
|
||||
@@ -434,6 +480,109 @@ class SSHConnection():
|
||||
job.join()
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
|
||||
def checkDevTTYisUnlocked(self):
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
count = 0
|
||||
while count < 5:
|
||||
self.command('echo ' + self.ADBPassword + ' | sudo -S lsof | grep ttyUSB0', '\$', 10)
|
||||
result = re.search('picocom', str(self.ssh.before))
|
||||
if result is None:
|
||||
count = 10
|
||||
else:
|
||||
time.sleep(5)
|
||||
count = count + 1
|
||||
self.close()
|
||||
|
||||
def InitializeCatM(self):
|
||||
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
self.picocom_closure = True
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
||||
self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
||||
self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
||||
time.sleep(1)
|
||||
# Calling twice AT to clear all buffers
|
||||
self.command('AT', 'OK|ERROR', 5)
|
||||
self.command('AT', 'OK', 5)
|
||||
# Disabling the Radio
|
||||
self.command('AT+CFUN=0', 'OK', 5)
|
||||
logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m')
|
||||
# Checking if auto-attach is enabled
|
||||
self.command('AT^AUTOATT?', 'OK', 5)
|
||||
result = re.search('AUTOATT: (?P<state>[0-9\-]+)', str(self.ssh.before))
|
||||
if result is not None:
|
||||
if result.group('state') is not None:
|
||||
autoAttachState = int(result.group('state'))
|
||||
if autoAttachState is not None:
|
||||
if autoAttachState == 0:
|
||||
self.command('AT^AUTOATT=1', 'OK', 5)
|
||||
logging.debug('\u001B[1m Auto-Attach enabled\u001B[0m')
|
||||
else:
|
||||
logging.debug('\u001B[1;37;41m Could not check Auto-Attach! \u001B[0m')
|
||||
# Force closure of picocom but device might still be locked
|
||||
self.close()
|
||||
self.picocom_closure = False
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
self.checkDevTTYisUnlocked()
|
||||
|
||||
def TerminateCatM(self):
|
||||
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
self.picocom_closure = True
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
||||
self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
||||
self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
||||
time.sleep(1)
|
||||
# Calling twice AT to clear all buffers
|
||||
self.command('AT', 'OK|ERROR', 5)
|
||||
self.command('AT', 'OK', 5)
|
||||
# Disabling the Radio
|
||||
self.command('AT+CFUN=0', 'OK', 5)
|
||||
logging.debug('\u001B[1m Cellular Functionality disabled\u001B[0m')
|
||||
self.close()
|
||||
self.picocom_closure = False
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
self.checkDevTTYisUnlocked()
|
||||
|
||||
def AttachCatM(self):
|
||||
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
self.picocom_closure = True
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
# dummy call to start a sudo session. The picocom command does NOT handle well the `sudo -S`
|
||||
self.command('echo ' + self.ADBPassword + ' | sudo -S ls', '\$', 10)
|
||||
self.command('sudo picocom --baud 921600 --flow n --databits 8 /dev/ttyUSB0', 'Terminal ready', 10)
|
||||
time.sleep(1)
|
||||
# Calling twice AT to clear all buffers
|
||||
self.command('AT', 'OK|ERROR', 5)
|
||||
self.command('AT', 'OK', 5)
|
||||
# Enabling the Radio
|
||||
self.command('AT+CFUN=1', 'SIMSTORE,READY', 5)
|
||||
logging.debug('\u001B[1m Cellular Functionality enabled\u001B[0m')
|
||||
time.sleep(4)
|
||||
# We should check if we register
|
||||
count = 0
|
||||
while count < 3:
|
||||
self.command('AT+CEREG?', 'OK', 5)
|
||||
result = re.search('CEREG: 2,(?P<state>[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))
|
||||
else:
|
||||
logging.debug(str(self.ssh.before))
|
||||
count = count + 1
|
||||
time.sleep(1)
|
||||
self.close()
|
||||
self.picocom_closure = False
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
self.checkDevTTYisUnlocked()
|
||||
|
||||
def AttachUE_common(self, device_id, statusQueue, lock):
|
||||
try:
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
@@ -495,11 +644,14 @@ class SSHConnection():
|
||||
multi_jobs = []
|
||||
status_queue = SimpleQueue()
|
||||
lock = Lock()
|
||||
nb_ue_to_connect = 0
|
||||
for device_id in self.UEDevices:
|
||||
p = Process(target = SSH.AttachUE_common, args = (device_id, status_queue, lock,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach):
|
||||
p = Process(target = SSH.AttachUE_common, args = (device_id, status_queue, lock,))
|
||||
p.daemon = True
|
||||
p.start()
|
||||
multi_jobs.append(p)
|
||||
nb_ue_to_connect = nb_ue_to_connect + 1
|
||||
for job in multi_jobs:
|
||||
job.join()
|
||||
|
||||
@@ -524,6 +676,10 @@ class SSHConnection():
|
||||
html_queue.put(html_cell)
|
||||
if (attach_status):
|
||||
self.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue)
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
logging.debug('Waiting 5 seconds to fill up record file')
|
||||
time.sleep(5)
|
||||
else:
|
||||
self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue)
|
||||
self.AutoTerminateUEandeNB()
|
||||
@@ -559,6 +715,10 @@ class SSHConnection():
|
||||
for job in multi_jobs:
|
||||
job.join()
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
logging.debug('Waiting 5 seconds to fill up record file')
|
||||
time.sleep(5)
|
||||
|
||||
def RebootUE_common(self, device_id):
|
||||
try:
|
||||
@@ -632,6 +792,19 @@ class SSHConnection():
|
||||
sys.exit(1)
|
||||
self.close()
|
||||
|
||||
def GetAllCatMDevices(self, terminate_ue_flag):
|
||||
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
||||
Usage()
|
||||
sys.exit('Insufficient Parameter')
|
||||
self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword)
|
||||
self.command('lsusb | egrep "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15)
|
||||
self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",str(self.ssh.before))
|
||||
if terminate_ue_flag == False:
|
||||
if len(self.CatMDevices) == 0:
|
||||
logging.debug('\u001B[1;37;41m CAT-M UE Not Found! \u001B[0m')
|
||||
sys.exit(1)
|
||||
self.close()
|
||||
|
||||
def GetAllUEIPAddresses(self):
|
||||
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
|
||||
Usage()
|
||||
@@ -1312,7 +1485,7 @@ class SSHConnection():
|
||||
fileCheck = re.search('enb_', str(self.eNBLogFile))
|
||||
if fileCheck is not None:
|
||||
self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
|
||||
logStatus = self.AnalyzeLogFile_eNB()
|
||||
logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
|
||||
if logStatus < 0:
|
||||
result = logStatus
|
||||
return result
|
||||
@@ -1383,10 +1556,10 @@ class SSHConnection():
|
||||
except:
|
||||
os.kill(os.getppid(),signal.SIGUSR1)
|
||||
|
||||
def AnalyzeLogFile_eNB(self):
|
||||
if (not os.path.isfile('./' + SSH.eNBLogFile)):
|
||||
def AnalyzeLogFile_eNB(self, eNBlogFile):
|
||||
if (not os.path.isfile('./' + eNBlogFile)):
|
||||
return -1
|
||||
enb_log_file = open('./' + SSH.eNBLogFile, 'r')
|
||||
enb_log_file = open('./' + eNBlogFile, 'r')
|
||||
foundAssertion = False
|
||||
msgAssertion = ''
|
||||
msgLine = 0
|
||||
@@ -1400,6 +1573,8 @@ class SSHConnection():
|
||||
rrcReestablishRequest = 0
|
||||
rrcReestablishComplete = 0
|
||||
rrcReestablishReject = 0
|
||||
rlcDiscardBuffer = 0
|
||||
rachCanceledProcedure = 0
|
||||
uciStatMsgCount = 0
|
||||
pdcpFailure = 0
|
||||
ulschFailure = 0
|
||||
@@ -1419,28 +1594,28 @@ class SSHConnection():
|
||||
if foundAssertion and (msgLine < 3):
|
||||
msgLine += 1
|
||||
msgAssertion += str(line)
|
||||
result = re.search('Generating RRCConnectionSetup', str(line))
|
||||
result = re.search('Generating LTE_RRCConnectionSetup', str(line))
|
||||
if result is not None:
|
||||
rrcSetupRequest += 1
|
||||
result = re.search('RRCConnectionSetupComplete from UE', str(line))
|
||||
result = re.search('LTE_RRCConnectionSetupComplete from UE', str(line))
|
||||
if result is not None:
|
||||
rrcSetupComplete += 1
|
||||
result = re.search('Generate RRCConnectionRelease', str(line))
|
||||
result = re.search('Generate LTE_RRCConnectionRelease', str(line))
|
||||
if result is not None:
|
||||
rrcReleaseRequest += 1
|
||||
result = re.search('Generate RRCConnectionReconfiguration', str(line))
|
||||
result = re.search('Generate LTE_RRCConnectionReconfiguration', str(line))
|
||||
if result is not None:
|
||||
rrcReconfigRequest += 1
|
||||
result = re.search('RRCConnectionReconfigurationComplete from UE rnti', str(line))
|
||||
result = re.search('LTE_RRCConnectionReconfigurationComplete from UE rnti', str(line))
|
||||
if result is not None:
|
||||
rrcReconfigComplete += 1
|
||||
result = re.search('RRCConnectionReestablishmentRequest', str(line))
|
||||
result = re.search('LTE_RRCConnectionReestablishmentRequest', str(line))
|
||||
if result is not None:
|
||||
rrcReestablishRequest += 1
|
||||
result = re.search('RRCConnectionReestablishmentComplete', str(line))
|
||||
result = re.search('LTE_RRCConnectionReestablishmentComplete', str(line))
|
||||
if result is not None:
|
||||
rrcReestablishComplete += 1
|
||||
result = re.search('RRCConnectionReestablishmentReject', str(line))
|
||||
result = re.search('LTE_RRCConnectionReestablishmentReject', str(line))
|
||||
if result is not None:
|
||||
rrcReestablishReject += 1
|
||||
result = re.search('uci->stat', str(line))
|
||||
@@ -1452,6 +1627,12 @@ class SSHConnection():
|
||||
result = re.search('ULSCH in error in round', str(line))
|
||||
if result is not None:
|
||||
ulschFailure += 1
|
||||
result = re.search('BAD all_segments_received', str(line))
|
||||
if result is not None:
|
||||
rlcDiscardBuffer += 1
|
||||
result = re.search('Canceled RA procedure for UE rnti', str(line))
|
||||
if result is not None:
|
||||
rachCanceledProcedure += 1
|
||||
enb_log_file.close()
|
||||
self.htmleNBFailureMsg = ''
|
||||
if uciStatMsgCount > 0:
|
||||
@@ -1494,6 +1675,10 @@ class SSHConnection():
|
||||
rrcMsg = ' -- ' + str(rrcReestablishReject) + ' were rejected'
|
||||
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')
|
||||
self.htmleNBFailureMsg += rachMsg + '\n'
|
||||
if foundSegFault:
|
||||
logging.debug('\u001B[1;37;41m eNB ended with a Segmentation Fault! \u001B[0m')
|
||||
return ENB_PROCESS_SEG_FAULT
|
||||
@@ -1504,6 +1689,11 @@ class SSHConnection():
|
||||
if foundRealTimeIssue:
|
||||
logging.debug('\u001B[1;37;41m eNB faced real time issues! \u001B[0m')
|
||||
return ENB_PROCESS_REALTIME_ISSUE
|
||||
if rlcDiscardBuffer > 0:
|
||||
rlcMsg = 'eNB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)'
|
||||
logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m')
|
||||
self.htmleNBFailureMsg += rlcMsg + '\n'
|
||||
return ENB_PROCESS_REALTIME_ISSUE
|
||||
return 0
|
||||
|
||||
def TerminateeNB(self):
|
||||
@@ -1518,19 +1708,49 @@ class SSHConnection():
|
||||
if result is not None:
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S killall --signal SIGKILL lte-softmodem || true', '\$', 5)
|
||||
self.close()
|
||||
result = re.search('enb_', str(self.eNBLogFile))
|
||||
# If tracer options is on, stopping tshark on EPC side
|
||||
result = re.search('T_stdout', str(self.Initialize_eNB_args))
|
||||
if result is not None:
|
||||
self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
|
||||
logStatus = self.AnalyzeLogFile_eNB()
|
||||
if (logStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', logStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
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)
|
||||
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/.')
|
||||
self.close()
|
||||
logging.debug('\u001B[1m Replaying RAW record file\u001B[0m')
|
||||
self.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
|
||||
self.command('cd ' + self.eNBSourceCodePath + '/common/utils/T/tracer/', '\$', 5)
|
||||
raw_record_file = self.eNBLogFile.replace('.log', '_record.raw')
|
||||
replay_log_file = self.eNBLogFile.replace('.log', '_replay.log')
|
||||
extracted_txt_file = self.eNBLogFile.replace('.log', '_extracted_messages.txt')
|
||||
extracted_log_file = self.eNBLogFile.replace('.log', '_extracted_messages.log')
|
||||
self.command('./extract_config -i ' + self.eNBSourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_txt_file, '\$', 5)
|
||||
self.command('echo $USER; nohup ./replay -i ' + self.eNBSourceCodePath + '/cmake_targets/' + raw_record_file + ' > ' + self.eNBSourceCodePath + '/cmake_targets/' + replay_log_file + ' 2>&1 &', self.eNBUserName, 5)
|
||||
self.command('./textlog -d ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_txt_file + ' -no-gui -ON -full > ' + self.eNBSourceCodePath + '/cmake_targets/' + extracted_log_file, '\$', 5)
|
||||
self.close()
|
||||
self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + extracted_log_file, '.')
|
||||
logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m')
|
||||
logStatus = self.AnalyzeLogFile_eNB(extracted_log_file)
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
self.eNBLogFile = ''
|
||||
else:
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
result = re.search('enb_', str(self.eNBLogFile))
|
||||
if result is not None:
|
||||
self.copyin(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, self.eNBSourceCodePath + '/cmake_targets/' + self.eNBLogFile, '.')
|
||||
logging.debug('\u001B[1m Analyzing eNB logfile \u001B[0m')
|
||||
logStatus = self.AnalyzeLogFile_eNB(self.eNBLogFile)
|
||||
if (logStatus < 0):
|
||||
self.CreateHtmlTestRow('N/A', 'KO', logStatus)
|
||||
self.CreateHtmlFooter(False)
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
self.eNBLogFile = ''
|
||||
else:
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
|
||||
def TerminateHSS(self):
|
||||
self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword)
|
||||
@@ -1546,11 +1766,8 @@ class SSHConnection():
|
||||
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(2)
|
||||
self.command('ps -aux | egrep --color=never "hss_sim|simulated_hss" | grep -v grep | awk \'BEGIN{n=0}{pidId[n]=$2;n=n+1}END{print "kill -9 " pidId[0] " " pidId[1]}\' > ./kill_hss.sh', '\$', 5)
|
||||
self.command('chmod 755 ./kill_hss.sh', '\$', 5)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S ./kill_hss.sh', '\$', 5)
|
||||
self.command('rm ./kill_hss.sh', '\$', 5)
|
||||
time.sleep(1)
|
||||
self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5)
|
||||
self.close()
|
||||
self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK)
|
||||
|
||||
@@ -1637,8 +1854,8 @@ class SSHConnection():
|
||||
self.command('cd ' + self.eNBSourceCodePath, '\$', 5)
|
||||
self.command('cd cmake_targets', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core*', '\$', 60)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core*', '\$', 5)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 60)
|
||||
self.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5)
|
||||
self.close()
|
||||
|
||||
def LogCollectPing(self):
|
||||
@@ -1756,18 +1973,23 @@ class SSHConnection():
|
||||
if (SSH.eNB_AllowMerge):
|
||||
self.htmlFile.write(' <tr>\n')
|
||||
self.htmlFile.write(' <td bgcolor = "lightcyan" >Target Branch</td>\n')
|
||||
self.htmlFile.write(' <td>develop</td>\n')
|
||||
if (self.eNBTargetBranch == ''):
|
||||
self.htmlFile.write(' <td>develop</td>\n')
|
||||
else:
|
||||
self.htmlFile.write(' <td>' + self.eNBTargetBranch + '</td>\n')
|
||||
self.htmlFile.write(' </tr>\n')
|
||||
self.htmlFile.write(' </table>\n')
|
||||
|
||||
terminate_ue_flag = True
|
||||
SSH.GetAllUEDevices(terminate_ue_flag)
|
||||
SSH.GetAllCatMDevices(terminate_ue_flag)
|
||||
self.htmlUEConnected = len(self.UEDevices)
|
||||
|
||||
self.htmlFile.write(' <h2><a href="#FinalStatus">Jump to Final Status</a></h2>\n')
|
||||
self.htmlFile.write(' <br>\n')
|
||||
|
||||
self.htmlFile.write(' <h2>' + str(self.htmlUEConnected) + ' UE(s) is(are) connected to ADB bench server</h2>\n')
|
||||
self.htmlFile.write(' <h2>' + str(len(self.UEDevices)) + ' UE(s) is(are) connected to ADB bench server</h2>\n')
|
||||
self.htmlFile.write(' <h2>' + str(len(self.CatMDevices)) + ' CAT-M UE(s) is(are) connected to bench server</h2>\n')
|
||||
self.htmlFile.write(' <br>\n')
|
||||
|
||||
self.htmlFile.write(' <h2>Test Summary for ' + SSH.testXMLfile + '</h2>\n')
|
||||
@@ -1903,6 +2125,8 @@ def Usage():
|
||||
print(' --eNBRepository=[eNB\'s Repository URL]')
|
||||
print(' --eNBBranch=[eNB\'s Branch Name]')
|
||||
print(' --eNBCommitID=[eNB\'s Commit Number]')
|
||||
print(' --eNB_AllowMerge=[eNB\'s Allow Merge Request (with target branch)]')
|
||||
print(' --eNBTargetBranch=[eNB\'s Target Branch in case of a Merge Request]')
|
||||
print(' --eNBUserName=[eNB\'s Login User Name]')
|
||||
print(' --eNBPassword=[eNB\'s Login Password]')
|
||||
print(' --eNBSourceCodePath=[eNB\'s Source Code Path]')
|
||||
@@ -1918,7 +2142,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':
|
||||
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':
|
||||
logging.debug('ERROR: test-case ' + id + ' has wrong class ' + action)
|
||||
return False
|
||||
return True
|
||||
@@ -1938,6 +2162,13 @@ def GetParametersFromXML(action):
|
||||
if (SSH.eNB_instance is None):
|
||||
SSH.eNB_instance = '0'
|
||||
|
||||
if action == 'Attach_UE':
|
||||
nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
|
||||
if (nbMaxUEtoAttach is None):
|
||||
SSH.nbMaxUEtoAttach = -1
|
||||
else:
|
||||
SSH.nbMaxUEtoAttach = int(nbMaxUEtoAttach)
|
||||
|
||||
if action == 'Ping':
|
||||
SSH.ping_args = test.findtext('ping_args')
|
||||
SSH.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
|
||||
@@ -1999,6 +2230,9 @@ while len(argvs) > 1:
|
||||
elif re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE):
|
||||
matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE)
|
||||
SSH.eNBCommitID = matchReg.group(1)
|
||||
elif re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE):
|
||||
matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE)
|
||||
SSH.eNBTargetBranch = matchReg.group(1)
|
||||
elif re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE):
|
||||
matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE)
|
||||
SSH.eNBUserName = matchReg.group(1)
|
||||
@@ -2112,6 +2346,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
|
||||
sys.exit('Insufficient Parameter')
|
||||
|
||||
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")
|
||||
SSH.CreateHtmlHeader()
|
||||
|
||||
#read test_case_list.xml file
|
||||
@@ -2192,6 +2427,14 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE):
|
||||
SSH.AttachUE()
|
||||
elif action == 'Detach_UE':
|
||||
SSH.DetachUE()
|
||||
elif action == 'Initialize_CatM_module':
|
||||
SSH.InitializeCatM()
|
||||
elif action == 'Terminate_CatM_module':
|
||||
SSH.TerminateCatM()
|
||||
elif action == 'Attach_CatM_module':
|
||||
SSH.AttachCatM()
|
||||
elif action == 'Detach_CatM_module':
|
||||
SSH.TerminateCatM()
|
||||
elif action == 'Ping':
|
||||
SSH.Ping()
|
||||
elif action == 'Iperf':
|
||||
|
||||
537
ci-scripts/oai-ci-vm-tool
Executable file
537
ci-scripts/oai-ci-vm-tool
Executable file
@@ -0,0 +1,537 @@
|
||||
#!/bin/bash
|
||||
#/*
|
||||
# * 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
|
||||
# */
|
||||
|
||||
function top_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo " Requirements:"
|
||||
echo " -- uvtool uvtool-libvirt apt-cacher"
|
||||
echo " -- xenial image already synced"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " oai-ci-vm-tool (-h|--help) {create,destroy,build,wait,test,report-build,report-test} ..."
|
||||
echo ""
|
||||
}
|
||||
|
||||
function variant_usage {
|
||||
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"
|
||||
}
|
||||
|
||||
MY_DIR=$(dirname $(readlink -f $0))
|
||||
. $MY_DIR/createVM.sh
|
||||
. $MY_DIR/buildOnVM.sh
|
||||
. $MY_DIR/waitBuildOnVM.sh
|
||||
. $MY_DIR/destroyAllRunningVM.sh
|
||||
. $MY_DIR/runTestOnVM.sh
|
||||
. $MY_DIR/reportBuildLocally.sh
|
||||
. $MY_DIR/reportTestLocally.sh
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "Syntax Error: too few arguments"
|
||||
echo ""
|
||||
top_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VM_TEMPLATE=ci-
|
||||
JOB_NAME=XX
|
||||
BUILD_ID=XX
|
||||
VM_NAME=ci-enb-usrp
|
||||
VM_MEMORY=2048
|
||||
VM_CPU=4
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP"
|
||||
KEEP_VM_ALIVE=0
|
||||
RUN_OPTIONS="none"
|
||||
DAEMON=0
|
||||
MR_TRIG=0
|
||||
PU_TRIG=0
|
||||
|
||||
HELP_CMD=0
|
||||
CREATE_CMD=0
|
||||
BUILD_CMD=0
|
||||
WAIT_CMD=0
|
||||
DESTROY_CMD=0
|
||||
TEST_CMD=0
|
||||
REPORT_BUILD_CMD=0
|
||||
REPORT_TEST_CMD=0
|
||||
NBARGS=0
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
HELP_CMD=1
|
||||
shift
|
||||
;;
|
||||
create)
|
||||
CREATE_CMD=1
|
||||
# It is implied to keep the VM when creating it
|
||||
KEEP_VM_ALIVE=1
|
||||
shift
|
||||
;;
|
||||
build)
|
||||
BUILD_CMD=1
|
||||
shift
|
||||
;;
|
||||
wait)
|
||||
WAIT_CMD=1
|
||||
shift
|
||||
;;
|
||||
test)
|
||||
TEST_CMD=1
|
||||
shift
|
||||
;;
|
||||
destroy)
|
||||
DESTROY_CMD=1
|
||||
shift
|
||||
;;
|
||||
report-build)
|
||||
REPORT_BUILD_CMD=1
|
||||
shift
|
||||
;;
|
||||
report-test)
|
||||
REPORT_TEST_CMD=1
|
||||
shift
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
NBARGS=$[$NBARGS+1]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
NBARGS=$[$NBARGS+2]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-ws|--workspace)
|
||||
JENKINS_WKSP="$2"
|
||||
NBARGS=$[$NBARGS+4]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-k|--keep-vm-alive)
|
||||
KEEP_VM_ALIVE=1
|
||||
NBARGS=$[$NBARGS+8]
|
||||
shift
|
||||
;;
|
||||
-D|--daemon)
|
||||
DAEMON=1
|
||||
NBARGS=$[$NBARGS+16]
|
||||
shift
|
||||
;;
|
||||
-gu|--git-url)
|
||||
GIT_URL="$2"
|
||||
NBARGS=$[$NBARGS+32]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--trigger)
|
||||
TRIG="$2"
|
||||
case $TRIG in
|
||||
merge-request)
|
||||
MR_TRIG=1
|
||||
;;
|
||||
push)
|
||||
PU_TRIG=1
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Trigger option -> $TRIG"
|
||||
echo ""
|
||||
trigger_usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
NBARGS=$[$NBARGS+64]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-mr)
|
||||
MR_TRIG=1
|
||||
NBARGS=$[$NBARGS+64]
|
||||
shift
|
||||
;;
|
||||
-pu)
|
||||
PU_TRIG=1
|
||||
NBARGS=$[$NBARGS+64]
|
||||
shift
|
||||
;;
|
||||
-sb|--src-branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
NBARGS=$[$NBARGS+1024]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-sc|--src-commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
NBARGS=$[$NBARGS+2048]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tb|--target-branch)
|
||||
TARGET_BRANCH="$2"
|
||||
NBARGS=$[$NBARGS+4096]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tc|--target-commit)
|
||||
TARGET_COMMIT_ID="$2"
|
||||
NBARGS=$[$NBARGS+8192]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-br|--branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
NBARGS=$[$NBARGS+16384]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-co|--commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
NBARGS=$[$NBARGS+32768]
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-v1)
|
||||
VM_NAME=ci-enb-usrp
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP --mu"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
-v2)
|
||||
VM_NAME=ci-basic-sim
|
||||
ARCHIVES_LOC=basic_sim
|
||||
LOG_PATTERN=basic_simulator
|
||||
NB_PATTERN_FILES=2
|
||||
BUILD_OPTIONS="--basic-simulator"
|
||||
VM_MEMORY=8192
|
||||
VM_CPU=4
|
||||
RUN_OPTIONS="complex"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
-v3)
|
||||
VM_NAME=ci-phy-sim
|
||||
ARCHIVES_LOC=phy_sim
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=3
|
||||
BUILD_OPTIONS="--phy_simulators"
|
||||
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
-v4)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=4096
|
||||
ARCHIVES_LOC=cppcheck
|
||||
LOG_PATTERN=cppcheck.xml
|
||||
NB_PATTERN_FILES=1
|
||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
-v7)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
ARCHIVES_LOC=enb_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
-v8)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
ARCHIVES_LOC=ue_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
shift
|
||||
;;
|
||||
--variant)
|
||||
variant="$2"
|
||||
case $variant in
|
||||
enb-usrp)
|
||||
VM_NAME=ci-enb-usrp
|
||||
ARCHIVES_LOC=enb_usrp
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=4
|
||||
BUILD_OPTIONS="--eNB -w USRP --mu"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
basic-sim)
|
||||
VM_NAME=ci-basic-sim
|
||||
ARCHIVES_LOC=basic_sim
|
||||
LOG_PATTERN=basic_simulator
|
||||
NB_PATTERN_FILES=2
|
||||
BUILD_OPTIONS="--basic-simulator"
|
||||
VM_MEMORY=8192
|
||||
VM_CPU=4
|
||||
RUN_OPTIONS="complex"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
phy-sim)
|
||||
VM_NAME=ci-phy-sim
|
||||
ARCHIVES_LOC=phy_sim
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=3
|
||||
BUILD_OPTIONS="--phy_simulators"
|
||||
RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
cppcheck)
|
||||
VM_NAME=ci-cppcheck
|
||||
VM_MEMORY=8192
|
||||
ARCHIVES_LOC=cppcheck
|
||||
LOG_PATTERN=cppcheck.xml
|
||||
NB_PATTERN_FILES=1
|
||||
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
enb-ethernet)
|
||||
VM_NAME=ci-enb-ethernet
|
||||
ARCHIVES_LOC=enb_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--eNB -t ETHERNET --noS1"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
ue-ethernet)
|
||||
VM_NAME=ci-ue-ethernet
|
||||
ARCHIVES_LOC=ue_eth
|
||||
LOG_PATTERN=.Rel14.txt
|
||||
NB_PATTERN_FILES=6
|
||||
BUILD_OPTIONS="--UE -t ETHERNET --noS1"
|
||||
NBARGS=$[$NBARGS+256]
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Variant option -> $variant"
|
||||
echo ""
|
||||
variant_usage
|
||||
exit 1
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
top_usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
MANY_CMDS=$[$CREATE_CMD+$BUILD_CMD+$WAIT_CMD+$DESTROY_CMD+$TEST_CMD+$REPORT_BUILD_CMD+$REPORT_TEST_CMD]
|
||||
if [ $MANY_CMDS -gt 1 ]
|
||||
then
|
||||
echo "Syntax Error: too many commands"
|
||||
top_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $HELP_CMD -eq 1 ]
|
||||
then
|
||||
if [ $MANY_CMDS -eq 0 ]
|
||||
then
|
||||
top_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $CREATE_CMD -eq 1 ]
|
||||
then
|
||||
create_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $BUILD_CMD -eq 1 ]
|
||||
then
|
||||
build_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $WAIT_CMD -eq 1 ]
|
||||
then
|
||||
wait_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $TEST_CMD -eq 1 ]
|
||||
then
|
||||
run_test_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $DESTROY_CMD -eq 1 ]
|
||||
then
|
||||
destroy_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $REPORT_BUILD_CMD -eq 1 ]
|
||||
then
|
||||
report_build_usage
|
||||
exit 0
|
||||
fi
|
||||
if [ $REPORT_TEST_CMD -eq 1 ]
|
||||
then
|
||||
report_test_usage
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
if [ $MANY_CMDS -eq 0 ]
|
||||
then
|
||||
echo "Syntax Error: no command"
|
||||
top_usage
|
||||
exit 1
|
||||
fi
|
||||
# For create, mandatory options: jn, id. Optional: variant
|
||||
if [ $CREATE_CMD -eq 1 ] && [ $NBARGS -ne 3 ] && [ $NBARGS -ne 259 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for create command"
|
||||
create_usage
|
||||
exit 1
|
||||
fi
|
||||
# For build, mandatory options: jn, id, ws. Optional: variant, k, D
|
||||
if [ $BUILD_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ] && [ $NBARGS -ne 23 ] && [ $NBARGS -ne 279 ] && [ $NBARGS -ne 31 ] && [ $NBARGS -ne 287 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for build command"
|
||||
build_usage
|
||||
exit 1
|
||||
fi
|
||||
# For wait, mandatory options: jn, id, ws. Optional: variant, k
|
||||
if [ $WAIT_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for wait command"
|
||||
wait_usage
|
||||
exit 1
|
||||
fi
|
||||
# For test, mandatory options: jn, id, ws. Optional: variant, k
|
||||
if [ $TEST_CMD -eq 1 ] && [ $NBARGS -ne 7 ] && [ $NBARGS -ne 263 ] && [ $NBARGS -ne 15 ] && [ $NBARGS -ne 271 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for test command"
|
||||
run_test_usage
|
||||
exit 1
|
||||
fi
|
||||
# For destroy, mandatory options: jn, id.
|
||||
if [ $DESTROY_CMD -eq 1 ] && [ $NBARGS -ne 3 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for destroy command"
|
||||
destroy_usage
|
||||
exit 1
|
||||
fi
|
||||
# For report-build, mandatory options: jn, id, ws, gu, pu, br,co.
|
||||
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
|
||||
if [ $REPORT_BUILD_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for report-build command"
|
||||
report_build_usage
|
||||
exit 1
|
||||
fi
|
||||
# For report-test, mandatory options: jn, id, ws, gu, pu, br,co.
|
||||
# or: jn, id, ws, gu, mr, sb, sc, tb, tc.
|
||||
if [ $REPORT_TEST_CMD -eq 1 ] && [ $NBARGS -ne 15463 ] && [ $NBARGS -ne 49255 ]
|
||||
then
|
||||
echo "Syntax Error: unsupported option(s) for report-test command"
|
||||
report_test_usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ]
|
||||
then
|
||||
VM_TEMPLATE=ci-
|
||||
else
|
||||
VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}-
|
||||
fi
|
||||
|
||||
VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"`
|
||||
VM_CMDS=${VM_NAME}_cmds.txt
|
||||
ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC}
|
||||
|
||||
STATUS=0
|
||||
if [ $CREATE_CMD -eq 1 ]
|
||||
then
|
||||
create_vm
|
||||
fi
|
||||
if [ $BUILD_CMD -eq 1 ]
|
||||
then
|
||||
build_on_vm
|
||||
if [ $DAEMON -eq 0 ] && [ $STATUS -eq 0 ]
|
||||
then
|
||||
check_on_vm_build
|
||||
fi
|
||||
fi
|
||||
if [ $WAIT_CMD -eq 1 ]
|
||||
then
|
||||
wait_on_vm_build
|
||||
if [ $STATUS -eq 0 ]
|
||||
then
|
||||
check_on_vm_build
|
||||
fi
|
||||
fi
|
||||
if [ $TEST_CMD -eq 1 ]
|
||||
then
|
||||
ARCHIVES_LOC=${ARCHIVES_LOC}/test
|
||||
run_test_on_vm
|
||||
fi
|
||||
if [ $DESTROY_CMD -eq 1 ]
|
||||
then
|
||||
destroy_vm
|
||||
fi
|
||||
if [ $REPORT_BUILD_CMD -eq 1 ]
|
||||
then
|
||||
report_build
|
||||
fi
|
||||
if [ $REPORT_TEST_CMD -eq 1 ]
|
||||
then
|
||||
report_test
|
||||
fi
|
||||
|
||||
# Did command pass or fail?
|
||||
if [ $STATUS -eq 0 ]
|
||||
then
|
||||
echo "STATUS seems OK"
|
||||
else
|
||||
echo "STATUS failed?"
|
||||
fi
|
||||
exit $STATUS
|
||||
@@ -20,14 +20,13 @@
|
||||
# * contact@openairinterface.org
|
||||
# */
|
||||
|
||||
function usage {
|
||||
echo "OAI Local Build Report script"
|
||||
function report_build_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo ""
|
||||
echo " reportBuildLocally.sh [OPTIONS]"
|
||||
echo " oai-ci-vm-tool report-build [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
@@ -47,6 +46,9 @@ function usage {
|
||||
echo " --build-id #### OR -id ####"
|
||||
echo " Specify the build ID of the Jenkins job."
|
||||
echo ""
|
||||
echo " --workspace #### OR -ws ####"
|
||||
echo " Specify the workspace."
|
||||
echo ""
|
||||
echo " --trigger merge-request OR -mr"
|
||||
echo " --trigger push OR -pu"
|
||||
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
|
||||
@@ -79,7 +81,7 @@ function usage {
|
||||
}
|
||||
|
||||
function trigger_usage {
|
||||
echo "OAI Local Build Report script"
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo " --trigger merge-request OR -mr"
|
||||
@@ -103,7 +105,7 @@ function details_table {
|
||||
COMPLETE_MESSAGE="start"
|
||||
for MESSAGE in $LIST_MESSAGES
|
||||
do
|
||||
if [[ $MESSAGE == *"/home/ubuntu/tmp"* ]]
|
||||
if [[ $MESSAGE == *"/home/ubuntu/tmp"* ]] || [[ $MESSAGE == *"/tmp/CI-eNB"* ]]
|
||||
then
|
||||
FILENAME=`echo $MESSAGE | sed -e "s#^/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" | awk -F ":" '{print $1}'`
|
||||
LINENB=`echo $MESSAGE | awk -F ":" '{print $2}'`
|
||||
@@ -153,8 +155,8 @@ function summary_table_row {
|
||||
echo " <td bgcolor = \"lightcyan\" >$1</th>" >> ./build_results.html
|
||||
if [ -f $2 ]
|
||||
then
|
||||
STATUS=`egrep -c "$3" $2`
|
||||
if [ $STATUS -eq 1 ]
|
||||
BUILD_STATUS=`egrep -c "$3" $2`
|
||||
if [ $BUILD_STATUS -eq 1 ]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
|
||||
else
|
||||
@@ -263,342 +265,233 @@ function sca_summary_table_footer {
|
||||
echo " <p style=\"margin-left: 30px\">Graphical Interface tool : <strong><code>cppcheck-gui -l cppcheck/cppcheck.xml</code></strong></p>" >> ./build_results.html
|
||||
}
|
||||
|
||||
jb_checker=0
|
||||
mr_checker=0
|
||||
pu_checker=0
|
||||
MR_TRIG=0
|
||||
PU_TRIG=0
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
function report_build {
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-gu|--git-url)
|
||||
GIT_URL="$2"
|
||||
let "jb_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
let "jb_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
let "jb_checker|=0x4"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--trigger)
|
||||
TRIG="$2"
|
||||
case $TRIG in
|
||||
merge-request)
|
||||
MR_TRIG=1
|
||||
;;
|
||||
push)
|
||||
PU_TRIG=1
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Trigger option -> $TRIG"
|
||||
echo ""
|
||||
trigger_usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-mr)
|
||||
MR_TRIG=1
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
;;
|
||||
-pu)
|
||||
PU_TRIG=1
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
;;
|
||||
-sb|--src-branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "mr_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-sc|--src-commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
let "mr_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tb|--target-branch)
|
||||
TARGET_BRANCH="$2"
|
||||
let "mr_checker|=0x4"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tc|--target-commit)
|
||||
TARGET_COMMIT_ID="$2"
|
||||
let "mr_checker|=0x8"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-br|--branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "pu_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-co|--commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
let "pu_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "JENKINS_WKSP = $JENKINS_WKSP"
|
||||
|
||||
done
|
||||
|
||||
if [ $jb_checker -ne 15 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing job information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: trigger action incoherent."
|
||||
echo ""
|
||||
trigger_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
if [ $pu_checker -ne 3 ]
|
||||
cd ${JENKINS_WKSP}
|
||||
echo "<!DOCTYPE html>" > ./build_results.html
|
||||
echo "<html class=\"no-js\" lang=\"en-US\">" >> ./build_results.html
|
||||
echo "<head>" >> ./build_results.html
|
||||
echo " <title>Build Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./build_results.html
|
||||
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./build_results.html
|
||||
echo "</head>" >> ./build_results.html
|
||||
echo "<body>" >> ./build_results.html
|
||||
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <a href=\"http://www.openairinterface.org/\">" >> ./build_results.html
|
||||
echo " <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./build_results.html
|
||||
echo " </img>" >> ./build_results.html
|
||||
echo " </a>" >> ./build_results.html
|
||||
echo " </td>" >> ./build_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./build_results.html
|
||||
echo " <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./build_results.html
|
||||
echo " </td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <br>" >> ./build_results.html
|
||||
echo " <table border = \"1\">" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./build_results.html
|
||||
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./build_results.html
|
||||
echo " <td>$GIT_URL</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./build_results.html
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing push information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
if [ $mr_checker -ne 15 ]
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing merge-request information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./build_results.html
|
||||
echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
fi
|
||||
fi
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <h2>Build Summary</h2>" >> ./build_results.html
|
||||
|
||||
echo "<!DOCTYPE html>" > ./build_results.html
|
||||
echo "<html class=\"no-js\" lang=\"en-US\">" >> ./build_results.html
|
||||
echo "<head>" >> ./build_results.html
|
||||
echo " <title>Build Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./build_results.html
|
||||
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./build_results.html
|
||||
echo "</head>" >> ./build_results.html
|
||||
echo "<body>" >> ./build_results.html
|
||||
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./build_results.html
|
||||
echo " <a href=\"http://www.openairinterface.org/\">" >> ./build_results.html
|
||||
echo " <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./build_results.html
|
||||
echo " </img>" >> ./build_results.html
|
||||
echo " </a>" >> ./build_results.html
|
||||
echo " </td>" >> ./build_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./build_results.html
|
||||
echo " <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./build_results.html
|
||||
echo " </td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <br>" >> ./build_results.html
|
||||
echo " <table border = \"1\">" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./build_results.html
|
||||
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./build_results.html
|
||||
echo " <td>$GIT_URL</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./build_results.html
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
fi
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./build_results.html
|
||||
echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./build_results.html
|
||||
echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html
|
||||
echo " </tr>" >> ./build_results.html
|
||||
fi
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <h2>Build Summary</h2>" >> ./build_results.html
|
||||
|
||||
if [ -f ./oai_rules_result.txt ]
|
||||
then
|
||||
echo " <h3>OAI Coding / Formatting Guidelines Check</h3>" >> ./build_results.html
|
||||
echo " <table border = "1">" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Result:</td>" >> ./build_results.html
|
||||
NB_FILES=`cat ./oai_rules_result.txt`
|
||||
if [ $NB_FILES = "0" ]
|
||||
then
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " </table>" >> ./build_results.html
|
||||
else
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
if [ -f ./oai_rules_result_list.txt ]
|
||||
then
|
||||
awk '{print " <tr><td></td><td>"$1"</td></tr>"}' ./oai_rules_result_list.txt >> ./build_results.html
|
||||
if [ -f ./oai_rules_result.txt ]
|
||||
then
|
||||
echo " <h3>OAI Coding / Formatting Guidelines Check</h3>" >> ./build_results.html
|
||||
echo " <table border = "1">" >> ./build_results.html
|
||||
echo " <tr>" >> ./build_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Result:</td>" >> ./build_results.html
|
||||
NB_FILES=`cat ./oai_rules_result.txt`
|
||||
if [ $NB_FILES = "0" ]
|
||||
then
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
echo " </table>" >> ./build_results.html
|
||||
else
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi
|
||||
echo " </tr>" >> ./build_results.html
|
||||
if [ -f ./oai_rules_result_list.txt ]
|
||||
then
|
||||
awk '{print " <tr><td></td><td>"$1"</td></tr>"}' ./oai_rules_result_list.txt >> ./build_results.html
|
||||
fi
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <p>Please apply the following command to this(ese) file(s): </p>" >> ./build_results.html
|
||||
echo " <p style=\"margin-left: 30px\"><strong><code>astyle --options=ci-scripts/astyle-options.txt filename(s)</code></strong></p>" >> ./build_results.html
|
||||
fi
|
||||
echo " </table>" >> ./build_results.html
|
||||
echo " <p>Please apply the following command to this(ese) file(s): </p>" >> ./build_results.html
|
||||
echo " <p style=\"margin-left: 30px\"><strong><code>astyle --options=ci-scripts/astyle-options.txt filename(s)</code></strong></p>" >> ./build_results.html
|
||||
fi
|
||||
fi
|
||||
|
||||
echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html
|
||||
echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html
|
||||
|
||||
sca_summary_table_header "OAI Static Code Analysis with CPPCHECK"
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder
|
||||
sca_summary_table_footer ./archives/cppcheck/cppcheck.xml
|
||||
sca_summary_table_header "OAI Static Code Analysis with CPPCHECK"
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds
|
||||
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder
|
||||
sca_summary_table_footer ./archives/cppcheck/cppcheck.xml
|
||||
|
||||
summary_table_header "OAI Build eNB -- USRP option"
|
||||
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_footer
|
||||
summary_table_header "OAI Build eNB -- USRP option"
|
||||
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_footer
|
||||
|
||||
summary_table_header "OAI Build basic simulator option"
|
||||
summary_table_row "Basic Simulator eNb - Release 14" ./archives/basic_sim/basic_simulator_enb.txt "Built target lte-softmodem" ./basic_sim_row1.html
|
||||
summary_table_row "Basic Simulator UE - Release 14" ./archives/basic_sim/basic_simulator_ue.txt "Built target lte-uesoftmodem" ./basic_sim_row2.html
|
||||
summary_table_row "Conf 2 UE data - Release 14" ./archives/basic_sim/conf2uedata.Rel14.txt "Built target conf2uedata" ./basic_sim_row3.html
|
||||
summary_table_footer
|
||||
summary_table_header "OAI Build basic simulator option"
|
||||
summary_table_row "Basic Simulator eNb - Release 14" ./archives/basic_sim/basic_simulator_enb.txt "Built target lte-softmodem" ./basic_sim_row1.html
|
||||
summary_table_row "Basic Simulator UE - Release 14" ./archives/basic_sim/basic_simulator_ue.txt "Built target lte-uesoftmodem" ./basic_sim_row2.html
|
||||
summary_table_row "Conf 2 UE data - Release 14" ./archives/basic_sim/conf2uedata.Rel14.txt "Built target conf2uedata" ./basic_sim_row3.html
|
||||
summary_table_footer
|
||||
|
||||
summary_table_header "OAI Build Physical simulators option"
|
||||
summary_table_row "DL Simulator - Release 14" ./archives/phy_sim/dlsim.Rel14.txt "Built target dlsim" ./phy_sim_row1.html
|
||||
summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt "Built target ulsim" ./phy_sim_row2.html
|
||||
summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html
|
||||
summary_table_footer
|
||||
summary_table_header "OAI Build Physical simulators option"
|
||||
summary_table_row "DL Simulator - Release 14" ./archives/phy_sim/dlsim.Rel14.txt "Built target dlsim" ./phy_sim_row1.html
|
||||
summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt "Built target ulsim" ./phy_sim_row2.html
|
||||
summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html
|
||||
summary_table_footer
|
||||
|
||||
summary_table_header "OAI Build eNB -- ETHERNET transport option"
|
||||
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 "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_footer
|
||||
|
||||
summary_table_header "OAI Build UE -- ETHERNET transport option"
|
||||
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 "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_footer
|
||||
if [ -f archives/gnb_usrp/nr-softmodem.Rel14.txt ]
|
||||
then
|
||||
summary_table_header "OAI Build gNB -- USRP option"
|
||||
summary_table_row "LTE SoftModem - Release 14" ./archives/gnb_usrp/nr-softmodem.Rel14.txt "Built target nr-softmodem" ./gnb_usrp_row1.html
|
||||
summary_table_row "Coding - Release 14" ./archives/gnb_usrp/coding.Rel14.txt "Built target coding" ./gnb_usrp_row2.html
|
||||
summary_table_row "OAI USRP device if - Release 14" ./archives/gnb_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 14" ./archives/gnb_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./gnb_usrp_row4.html
|
||||
summary_table_footer
|
||||
fi
|
||||
|
||||
echo " <h2>Red Hat (CentOS Linux release 7.4.1708) -- Summary</h2>" >> ./build_results.html
|
||||
if [ -f archives/nrue_usrp/nr-uesoftmodem.Rel14.txt ]
|
||||
then
|
||||
summary_table_header "OAI Build 5G NR UE -- USRP option"
|
||||
summary_table_row "UE SoftModem - Release 14" ./archives/nrue_usrp/nr-uesoftmodem.Rel14.txt "Built target nr-uesoftmodem" ./nrue_usrp_row1.html
|
||||
summary_table_row "Coding - Release 14" ./archives/nrue_usrp/coding.Rel14.txt "Built target coding" ./nrue_usrp_row2.html
|
||||
summary_table_row "OAI USRP device if - Release 14" ./archives/nrue_usrp/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./nrue_usrp_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 14" ./archives/nrue_usrp/params_libconfig.Rel14.txt "Built target params_libconfig" ./nrue_usrp_row4.html
|
||||
summary_table_footer
|
||||
fi
|
||||
|
||||
summary_table_header "Red Hat -- OAI Build eNB -- USRP option"
|
||||
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_footer
|
||||
summary_table_header "OAI Build eNB -- ETHERNET transport option"
|
||||
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 "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_footer
|
||||
|
||||
echo " <h3>Details</h3>" >> ./build_results.html
|
||||
summary_table_header "OAI Build UE -- ETHERNET transport option"
|
||||
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 "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_footer
|
||||
|
||||
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 ./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
|
||||
for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
|
||||
do
|
||||
cat $DETAILS_TABLE >> ./build_results.html
|
||||
done
|
||||
rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./enb_eth_row*.html ./ue_eth_row*.html ./enb_usrp_rh_row*.html
|
||||
if [ -e ./archives/red_hat ]
|
||||
then
|
||||
echo " <h2>Red Hat (CentOS Linux release 7.4.1708) -- Summary</h2>" >> ./build_results.html
|
||||
|
||||
echo "</body>" >> ./build_results.html
|
||||
echo "</html>" >> ./build_results.html
|
||||
summary_table_header "Red Hat -- OAI Build eNB -- USRP option"
|
||||
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_footer
|
||||
fi
|
||||
|
||||
exit 0
|
||||
echo " <h3>Details</h3>" >> ./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 ]
|
||||
then
|
||||
for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
|
||||
do
|
||||
cat $DETAILS_TABLE >> ./build_results.html
|
||||
done
|
||||
fi
|
||||
rm -f ./*_row*.html
|
||||
|
||||
echo "</body>" >> ./build_results.html
|
||||
echo "</html>" >> ./build_results.html
|
||||
}
|
||||
|
||||
@@ -20,14 +20,13 @@
|
||||
# * contact@openairinterface.org
|
||||
# */
|
||||
|
||||
function usage {
|
||||
echo "OAI Test Report script"
|
||||
function report_test_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo ""
|
||||
echo " reportTestLocally.sh [OPTIONS]"
|
||||
echo " oai-ci-vm-tool report-test [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
@@ -47,6 +46,9 @@ function usage {
|
||||
echo " --build-id #### OR -id ####"
|
||||
echo " Specify the build ID of the Jenkins job."
|
||||
echo ""
|
||||
echo " --workspace #### OR -ws ####"
|
||||
echo " Specify the workspace."
|
||||
echo ""
|
||||
echo " --trigger merge-request OR -mr"
|
||||
echo " --trigger push OR -pu"
|
||||
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
|
||||
@@ -78,513 +80,375 @@ function usage {
|
||||
echo ""
|
||||
}
|
||||
|
||||
function trigger_usage {
|
||||
echo "OAI Test Report script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo ""
|
||||
echo " --trigger merge-request OR -mr"
|
||||
echo " --trigger push OR -pu"
|
||||
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
|
||||
echo ""
|
||||
}
|
||||
function report_test {
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
|
||||
jb_checker=0
|
||||
mr_checker=0
|
||||
pu_checker=0
|
||||
MR_TRIG=0
|
||||
PU_TRIG=0
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
echo "JENKINS_WKSP = $JENKINS_WKSP"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
shift
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
-gu|--git-url)
|
||||
GIT_URL="$2"
|
||||
let "jb_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-jn|--job-name)
|
||||
JOB_NAME="$2"
|
||||
let "jb_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-id|--build-id)
|
||||
BUILD_ID="$2"
|
||||
let "jb_checker|=0x4"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--trigger)
|
||||
TRIG="$2"
|
||||
case $TRIG in
|
||||
merge-request)
|
||||
MR_TRIG=1
|
||||
;;
|
||||
push)
|
||||
PU_TRIG=1
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Syntax Error: Invalid Trigger option -> $TRIG"
|
||||
echo ""
|
||||
trigger_usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-mr)
|
||||
MR_TRIG=1
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
;;
|
||||
-pu)
|
||||
PU_TRIG=1
|
||||
let "jb_checker|=0x8"
|
||||
shift
|
||||
;;
|
||||
-sb|--src-branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "mr_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-sc|--src-commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
let "mr_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tb|--target-branch)
|
||||
TARGET_BRANCH="$2"
|
||||
let "mr_checker|=0x4"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-tc|--target-commit)
|
||||
TARGET_COMMIT_ID="$2"
|
||||
let "mr_checker|=0x8"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-br|--branch)
|
||||
SOURCE_BRANCH="$2"
|
||||
let "pu_checker|=0x1"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-co|--commit)
|
||||
SOURCE_COMMIT_ID="$2"
|
||||
let "pu_checker|=0x2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: unknown option: $key"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
if [ $jb_checker -ne 15 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing job information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: trigger action incoherent."
|
||||
echo ""
|
||||
trigger_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
if [ $pu_checker -ne 3 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing push information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
if [ $mr_checker -ne 15 ]
|
||||
then
|
||||
echo ""
|
||||
echo "Syntax Error: missing merge-request information."
|
||||
# TODO : list missing info
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "<!DOCTYPE html>" > ./test_simulator_results.html
|
||||
echo "<html class=\"no-js\" lang=\"en-US\">" >> ./test_simulator_results.html
|
||||
echo "<head>" >> ./test_simulator_results.html
|
||||
echo " <title>Simulator Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./test_simulator_results.html
|
||||
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./test_simulator_results.html
|
||||
echo "</head>" >> ./test_simulator_results.html
|
||||
echo "<body>" >> ./test_simulator_results.html
|
||||
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <a href=\"http://www.openairinterface.org/\">" >> ./test_simulator_results.html
|
||||
echo " <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./test_simulator_results.html
|
||||
echo " </img>" >> ./test_simulator_results.html
|
||||
echo " </a>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./test_simulator_results.html
|
||||
echo " <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
echo " <br>" >> ./test_simulator_results.html
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./test_simulator_results.html
|
||||
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./test_simulator_results.html
|
||||
echo " <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./test_simulator_results.html
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./test_simulator_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./test_simulator_results.html; fi
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$TARGET_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
echo " <h2>Test Summary</h2>" >> ./test_simulator_results.html
|
||||
|
||||
ARCHIVES_LOC=archives/basic_sim/test
|
||||
if [ -d $ARCHIVES_LOC ]
|
||||
then
|
||||
echo " <h3>Basic Simulator Check</h3>" >> ./test_simulator_results.html
|
||||
cd ${JENKINS_WKSP}
|
||||
|
||||
echo "<!DOCTYPE html>" > ./test_simulator_results.html
|
||||
echo "<html class=\"no-js\" lang=\"en-US\">" >> ./test_simulator_results.html
|
||||
echo "<head>" >> ./test_simulator_results.html
|
||||
echo " <title>Simulator Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./test_simulator_results.html
|
||||
echo " <base href = \"http://www.openairinterface.org/\" />" >> ./test_simulator_results.html
|
||||
echo "</head>" >> ./test_simulator_results.html
|
||||
echo "<body>" >> ./test_simulator_results.html
|
||||
echo " <table style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <tr style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
|
||||
echo " <a href=\"http://www.openairinterface.org/\">" >> ./test_simulator_results.html
|
||||
echo " <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./test_simulator_results.html
|
||||
echo " </img>" >> ./test_simulator_results.html
|
||||
echo " </a>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
echo " <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./test_simulator_results.html
|
||||
echo " <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
echo " <br>" >> ./test_simulator_results.html
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
|
||||
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Command</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Status</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Statistics</th>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Build Start Time (UTC)</td>" >> ./test_simulator_results.html
|
||||
echo " <td>TEMPLATE_BUILD_TIME</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./test_simulator_results.html
|
||||
echo " <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./test_simulator_results.html
|
||||
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./test_simulator_results.html; fi
|
||||
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./test_simulator_results.html; fi
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
if [ $PU_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $MR_TRIG -eq 1 ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$TARGET_COMMIT_ID</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
echo " <h2>Test Summary</h2>" >> ./test_simulator_results.html
|
||||
|
||||
TRANS_MODES=("fdd" "tdd")
|
||||
BW_CASES=(05 10 20)
|
||||
for TMODE in ${TRANS_MODES[@]}
|
||||
do
|
||||
for BW in ${BW_CASES[@]}
|
||||
ARCHIVES_LOC=archives/basic_sim/test
|
||||
if [ -d $ARCHIVES_LOC ]
|
||||
then
|
||||
echo " <h3>Basic Simulator Check</h3>" >> ./test_simulator_results.html
|
||||
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
|
||||
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Command</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Status</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Statistics</th>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
|
||||
TRANS_MODES=("fdd" "tdd")
|
||||
BW_CASES=(05 10 20)
|
||||
for TMODE in ${TRANS_MODES[@]}
|
||||
do
|
||||
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
|
||||
UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
|
||||
if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
|
||||
then
|
||||
NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
|
||||
echo " <td>N/A</td>" >> ./test_simulator_results.html
|
||||
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
|
||||
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
|
||||
NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG`
|
||||
if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
|
||||
for BW in ${BW_CASES[@]}
|
||||
do
|
||||
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
|
||||
UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
|
||||
if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " <td><pre>" >> ./test_simulator_results.html
|
||||
if [ $NB_ENB_GOT_SYNC -eq 1 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $NB_UE_GOT_SYNC -eq 2 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
|
||||
if [ $NB_SEGFAULT_ENB -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
|
||||
if [ $NB_SEGFAULT_UE -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- UE --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
|
||||
if [ $NB_ASSERTION_ENB -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
|
||||
awk 'BEGIN{assertion=10}{if(assertion < 3){print " " $0; assertion++};if ($0 ~/Assertion/){print " " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
|
||||
if [ $NB_ASSERTION_UE -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
|
||||
awk 'BEGIN{assertion=10}{if(assertion < 3){print " " $0; assertion++};if ($0 ~/Assertion/){print " " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </pre></td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt
|
||||
if [ -f $PING_CASE ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
|
||||
echo " <td>$CMD</td>" >> ./test_simulator_results.html
|
||||
FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
|
||||
if [ $FILE_COMPLETE -eq 0 ]
|
||||
then
|
||||
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
|
||||
echo " <td>N/A</td>" >> ./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 ]
|
||||
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
|
||||
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
|
||||
NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG`
|
||||
if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " <td><pre>" >> ./test_simulator_results.html
|
||||
if [ $NB_ENB_GOT_SYNC -eq 1 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $NB_UE_GOT_SYNC -eq 2 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
|
||||
then
|
||||
echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
|
||||
if [ $NB_SEGFAULT_ENB -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
|
||||
if [ $NB_SEGFAULT_UE -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- UE --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
|
||||
if [ $NB_ASSERTION_ENB -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
|
||||
awk 'BEGIN{assertion=10}{if(assertion < 3){print " " $0; assertion++};if ($0 ~/Assertion/){print " " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
|
||||
fi
|
||||
NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
|
||||
if [ $NB_ASSERTION_UE -ne 0 ]
|
||||
then
|
||||
echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
|
||||
awk 'BEGIN{assertion=10}{if(assertion < 3){print " " $0; assertion++};if ($0 ~/Assertion/){print " " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </pre></td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt
|
||||
if [ -f $PING_CASE ]
|
||||
then
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
|
||||
echo " <td>$CMD</td>" >> ./test_simulator_results.html
|
||||
FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
|
||||
if [ $FILE_COMPLETE -eq 0 ]
|
||||
then
|
||||
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
echo " <td>N/A</td>" >> ./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 " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " <td>" >> ./test_simulator_results.html
|
||||
echo " <pre>" >> ./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 " </pre>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
|
||||
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 " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
|
||||
echo " <td>$CMD</td>" >> ./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 " <td bgcolor = \"red\" >KO</td>" >> ./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 " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./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 " <td>" >> ./test_simulator_results.html
|
||||
echo " <pre>" >> ./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 "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 " </pre>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
fi
|
||||
|
||||
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 " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
|
||||
echo " <td>$CMD</td>" >> ./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 " <td bgcolor = \"red\" >KO</td>" >> ./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 " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"green\" >OK</td>" >> ./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 " <td>" >> ./test_simulator_results.html
|
||||
echo " <pre>" >> ./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 " </pre>" >> ./test_simulator_results.html
|
||||
echo " </td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
fi
|
||||
|
||||
ARCHIVES_LOC=archives/phy_sim/test
|
||||
if [ -d $ARCHIVES_LOC ]
|
||||
then
|
||||
echo " <h3>Physical Simulators Check</h3>" >> ./test_simulator_results.html
|
||||
ARCHIVES_LOC=archives/phy_sim/test
|
||||
if [ -d $ARCHIVES_LOC ]
|
||||
then
|
||||
echo " <h3>Physical Simulators Check</h3>" >> ./test_simulator_results.html
|
||||
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
|
||||
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Tests</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Errors</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Failures</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Failures</th>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
|
||||
XML_TESTS=`ls $ARCHIVES_LOC/*xml`
|
||||
for XML_FILE in $XML_TESTS
|
||||
do
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $XML_FILE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
NB_TESTS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*tests='##" -e "s#' *time=.*##"`
|
||||
NB_ERRORS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*errors='##" -e "s#' *failures=.*##"`
|
||||
NB_FAILURES=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*failures='##" -e "s#' *hostname=.*##"`
|
||||
NB_SKIPPED=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*skipped='##" -e "s#' *tests=.*##"`
|
||||
if [ $NB_ERRORS -eq 0 ] && [ $NB_FAILURES -eq 0 ]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >$NAME</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"red\" >$NAME</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " <td>$NB_TESTS</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_ERRORS</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_FAILURES</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_SKIPPED</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
done
|
||||
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
|
||||
echo " <h4>Details</h4>" >> ./test_simulator_results.html
|
||||
for XML_FILE in $XML_TESTS
|
||||
do
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
|
||||
echo " <th>Test Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Description</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Result</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Time</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Tests</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Errors</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Failures</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Nb Failures</th>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
TESTCASES_LIST=`sed -e "s# #@#g" $XML_FILE | grep testcase`
|
||||
for TESTCASE in $TESTCASES_LIST
|
||||
|
||||
XML_TESTS=`ls $ARCHIVES_LOC/*xml`
|
||||
for XML_FILE in $XML_TESTS
|
||||
do
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
NAME=`echo $TESTCASE | sed -e "s#^.*name='##" -e "s#'@description=.*##" | sed -e "s#@# #g"`
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
DESC=`echo $TESTCASE | sed -e "s#^.*description='##" -e "s#'@Run_result=.*##" | sed -e "s#@# #g"`
|
||||
echo " <td>$DESC</td>" >> ./test_simulator_results.html
|
||||
RESULT=`echo $TESTCASE | sed -e "s#^.*RESULT='##" -e "s#'.*##" | sed -e "s#@# #g"`
|
||||
if [[ $RESULT =~ .*PASS.* ]]
|
||||
NAME=`echo $XML_FILE | sed -e "s#$ARCHIVES_LOC/##"`
|
||||
NB_TESTS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*tests='##" -e "s#' *time=.*##"`
|
||||
NB_ERRORS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*errors='##" -e "s#' *failures=.*##"`
|
||||
NB_FAILURES=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*failures='##" -e "s#' *hostname=.*##"`
|
||||
NB_SKIPPED=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*skipped='##" -e "s#' *tests=.*##"`
|
||||
if [ $NB_ERRORS -eq 0 ] && [ $NB_FAILURES -eq 0 ]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >$RESULT</td>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"green\" >$NAME</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
echo " <td bgcolor = \"red\" >$RESULT</td>" >> ./test_simulator_results.html
|
||||
echo " <td bgcolor = \"red\" >$NAME</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
TIME=`echo $TESTCASE | sed -e "s#^.*time='##" -e "s#'@RESULT=.*##" | sed -e "s#@# #g"`
|
||||
echo " <td>$TIME</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_TESTS</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_ERRORS</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_FAILURES</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$NB_SKIPPED</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
done
|
||||
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
done
|
||||
fi
|
||||
|
||||
echo "</body>" >> ./test_simulator_results.html
|
||||
echo "</html>" >> ./test_simulator_results.html
|
||||
echo " <h4>Details</h4>" >> ./test_simulator_results.html
|
||||
for XML_FILE in $XML_TESTS
|
||||
do
|
||||
echo " <table border = \"1\">" >> ./test_simulator_results.html
|
||||
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
|
||||
echo " <th>Test Name</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Description</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Result</th>" >> ./test_simulator_results.html
|
||||
echo " <th>Time</th>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
PREV_SECTION=0
|
||||
PREV_TIME_IN_SECS=0
|
||||
TESTCASES_LIST=`sed -e "s# #@#g" $XML_FILE | grep testcase`
|
||||
for TESTCASE in $TESTCASES_LIST
|
||||
do
|
||||
NAME=`echo $TESTCASE | sed -e "s#^.*name='##" -e "s#'@description=.*##" | sed -e "s#@# #g"`
|
||||
SECTION=`echo $NAME | sed -e "s#\..*##"`
|
||||
if [ $SECTION != $PREV_SECTION ]
|
||||
then
|
||||
echo " <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
|
||||
echo " <td align = \"center\" colspan = 4 >\"$SECTION\" series</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
PREV_SECTION=$SECTION
|
||||
PREV_TIME_IN_SECS=0
|
||||
fi
|
||||
DESC=`echo $TESTCASE | sed -e "s#^.*description='##" -e "s#'@Run_result=.*##" | sed -e "s#@# #g"`
|
||||
RESULT=`echo $TESTCASE | sed -e "s#^.*RESULT='##" -e "s#'.*##" | sed -e "s#@# #g"`
|
||||
TIME_IN_SECS=`echo $TESTCASE | sed -e "s#^.*time='##" -e "s#'@RESULT=.*##" | sed -e "s#@# #g" -e "s# s.*##"`
|
||||
TIME=`echo "$TIME_IN_SECS - $PREV_TIME_IN_SECS" | bc -l | awk '{printf "%.2f s", $0}'`
|
||||
PREV_TIME_IN_SECS=$TIME_IN_SECS
|
||||
echo " <tr>" >> ./test_simulator_results.html
|
||||
echo " <td>$NAME</td>" >> ./test_simulator_results.html
|
||||
echo " <td>$DESC</td>" >> ./test_simulator_results.html
|
||||
if [[ $RESULT =~ .*PASS.* ]]
|
||||
then
|
||||
echo " <td bgcolor = \"green\" >$RESULT</td>" >> ./test_simulator_results.html
|
||||
else
|
||||
SPLITTED_LINE=`echo -e $TESTCASE | sed -e "s#@#\n#g"`
|
||||
NB_RUNS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "Run_"`
|
||||
NB_FAILS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "=FAIL"`
|
||||
echo " <td bgcolor = \"red\" >${RESULT} (${NB_FAILS}/${NB_RUNS})</td>" >> ./test_simulator_results.html
|
||||
fi
|
||||
echo " <td>$TIME</td>" >> ./test_simulator_results.html
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
done
|
||||
echo " </table>" >> ./test_simulator_results.html
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
echo "</body>" >> ./test_simulator_results.html
|
||||
echo "</html>" >> ./test_simulator_results.html
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
170
ci-scripts/waitBuildOnVM.sh
Executable file
170
ci-scripts/waitBuildOnVM.sh
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/bin/bash
|
||||
#/*
|
||||
# * 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
|
||||
# */
|
||||
|
||||
function wait_usage {
|
||||
echo "OAI CI VM script"
|
||||
echo " Original Author: Raphael Defosseux"
|
||||
echo " Requirements:"
|
||||
echo " -- uvtool uvtool-libvirt apt-cacher"
|
||||
echo " -- xenial image already synced"
|
||||
echo " Default:"
|
||||
echo " -- eNB with USRP"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo "------"
|
||||
echo " oai-ci-vm-tool wait [OPTIONS]"
|
||||
echo ""
|
||||
echo "Mandatory Options:"
|
||||
echo "--------"
|
||||
echo " --job-name #### OR -jn ####"
|
||||
echo " Specify the name of the Jenkins job."
|
||||
echo ""
|
||||
echo " --build-id #### OR -id ####"
|
||||
echo " Specify the build ID of the Jenkins job."
|
||||
echo ""
|
||||
echo " --workspace #### OR -ws ####"
|
||||
echo " Specify the workspace."
|
||||
echo ""
|
||||
variant_usage
|
||||
echo " Specify the variant to build."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo "--------"
|
||||
echo " --keep-vm-alive OR -k"
|
||||
echo " Keep the VM alive after the build."
|
||||
echo ""
|
||||
echo " --help OR -h"
|
||||
echo " Print this help message."
|
||||
echo ""
|
||||
}
|
||||
|
||||
function wait_on_vm_build {
|
||||
echo "############################################################"
|
||||
echo "OAI CI VM script"
|
||||
echo "############################################################"
|
||||
|
||||
echo "VM_NAME = $VM_NAME"
|
||||
echo "VM_CMD_FILE = $VM_CMDS"
|
||||
echo "JENKINS_WKSP = $JENKINS_WKSP"
|
||||
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
|
||||
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
|
||||
|
||||
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
|
||||
|
||||
if [ $IS_VM_ALIVE -eq 0 ]
|
||||
then
|
||||
echo "############################################################"
|
||||
echo "You should have created the VM before doing anything"
|
||||
echo "############################################################"
|
||||
STATUS=1
|
||||
return
|
||||
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 "Waiting build process to end on VM ($VM_NAME)"
|
||||
echo "############################################################"
|
||||
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
echo "echo \"ps -aux | grep cppcheck \"" >> $VM_CMDS
|
||||
echo "while [ \$(ps -aux | grep --color=never cppcheck | grep -v grep | wc -l) -gt 0 ]; do sleep 3; done" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"ps -aux | grep build \"" >> $VM_CMDS
|
||||
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
|
||||
rm -f $VM_CMDS
|
||||
}
|
||||
|
||||
function check_on_vm_build {
|
||||
echo "############################################################"
|
||||
echo "Creating a tmp folder to store results and artifacts"
|
||||
echo "############################################################"
|
||||
if [ ! -d $JENKINS_WKSP/archives ]
|
||||
then
|
||||
mkdir $JENKINS_WKSP/archives
|
||||
fi
|
||||
|
||||
if [ ! -d $ARCHIVES_LOC ]
|
||||
then
|
||||
mkdir $ARCHIVES_LOC
|
||||
fi
|
||||
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC
|
||||
fi
|
||||
|
||||
if [ $KEEP_VM_ALIVE -eq 0 ]
|
||||
then
|
||||
echo "############################################################"
|
||||
echo "Destroying VM"
|
||||
echo "############################################################"
|
||||
uvt-kvm destroy $VM_NAME
|
||||
ssh-keygen -R $VM_IP_ADDR
|
||||
fi
|
||||
rm -f $VM_CMDS
|
||||
|
||||
echo "############################################################"
|
||||
echo "Checking build status"
|
||||
echo "############################################################"
|
||||
|
||||
LOG_FILES=`ls $ARCHIVES_LOC/*.txt $ARCHIVES_LOC/*.xml`
|
||||
STATUS=0
|
||||
NB_FOUND_FILES=0
|
||||
|
||||
for FULLFILE in $LOG_FILES
|
||||
do
|
||||
if [[ $FULLFILE == *"$LOG_PATTERN"* ]]
|
||||
then
|
||||
filename=$(basename -- "$FULLFILE")
|
||||
if [ "$LOG_PATTERN" == ".Rel14.txt" ]
|
||||
then
|
||||
PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"`
|
||||
fi
|
||||
if [ "$LOG_PATTERN" == "basic_simulator" ]
|
||||
then
|
||||
PASS_PATTERN="lte-"
|
||||
fi
|
||||
if [ "$LOG_PATTERN" == "cppcheck.xml" ]
|
||||
then
|
||||
PASS_PATTERN="results version"
|
||||
LOCAL_STAT=`egrep -c "$PASS_PATTERN" $FULLFILE`
|
||||
else
|
||||
LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE`
|
||||
fi
|
||||
if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi
|
||||
NB_FOUND_FILES=$((NB_FOUND_FILES + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
<TestCaseRequestedList>
|
||||
010101
|
||||
050101 060101 070101 040101
|
||||
030100 040300 040401 040201 030201
|
||||
030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
|
||||
030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201
|
||||
030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201
|
||||
@@ -37,22 +38,28 @@
|
||||
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030100">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (FDD/Band7/5MHz) with T Tracer on</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --T_stdout 0</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030101">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (FDD/Band7/5MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030111">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (FDD/Band7/10MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030121">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (FDD/Band7/20MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030201">
|
||||
@@ -70,6 +77,12 @@
|
||||
<desc>Terminate UE</desc>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040300">
|
||||
<class>Attach_UE</class>
|
||||
<desc>Attach single UE</desc>
|
||||
<nbMaxUEtoAttach>1</nbMaxUEtoAttach>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040301">
|
||||
<class>Attach_UE</class>
|
||||
<desc>Attach UE</desc>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<TestCaseRequestedList>
|
||||
010101
|
||||
050101 060101 070101 040101
|
||||
030100 040300 040401 040201 030201
|
||||
030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201
|
||||
030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201
|
||||
050201 060201 070201
|
||||
@@ -40,22 +41,28 @@
|
||||
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030100">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (TDD/Band40/5MHz) with T Tracer on</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf --T_stdout 0</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030104">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (TDD/Band40/5MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
|
||||
<testCase id="030114">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (TDD/Band40/10MHz/info)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030106">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize eNB (TDD/Band40/20MHz/info)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030201">
|
||||
@@ -73,6 +80,12 @@
|
||||
<desc>Terminate UE</desc>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040300">
|
||||
<class>Attach_UE</class>
|
||||
<desc>Attach single UE</desc>
|
||||
<nbMaxUEtoAttach>1</nbMaxUEtoAttach>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040301">
|
||||
<class>Attach_UE</class>
|
||||
<desc>Attach UE</desc>
|
||||
|
||||
@@ -21,17 +21,15 @@
|
||||
|
||||
-->
|
||||
<testCaseList>
|
||||
<!-- Only 5MHz is tested since neither 10MHz nor 20MHz work in this configuration -->
|
||||
<!-- Also no UL iperf in 5MHz (040642) -->
|
||||
<!-- Only 5MHz/10MHz is tested since 20MHz does not work as in monolithic -->
|
||||
<TestCaseRequestedList>
|
||||
010101
|
||||
050101 060101 070101 040101
|
||||
030104 030105 040301 040501 040602 040401 040201 030201 030202
|
||||
030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
|
||||
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
|
||||
050201 060201 070201
|
||||
</TestCaseRequestedList>
|
||||
<!--
|
||||
030104 030105 040301 040501 040602 040642 040401 040201 030201 030202
|
||||
030114 030115 040301 040511 040612 040652 040401 040201 030201 030202
|
||||
030124 030125 040301 040521 040622 040662 040401 040201 030201 030202
|
||||
-->
|
||||
<TestCaseExclusionList>
|
||||
@@ -46,42 +44,42 @@
|
||||
<testCase id="030104">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (TDD/Band40)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030105">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (TDD/Band40/5MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030114">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (TDD/Band40)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030115">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (TDD/Band40/10MHz/info)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030124">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (TDD/Band40)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030125">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (TDD/Band40/20MHz/info)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
|
||||
@@ -21,17 +21,14 @@
|
||||
|
||||
-->
|
||||
<testCaseList>
|
||||
<!-- Only 5MHz is tested since neither 10MHz nor 20MHz work in this configuration -->
|
||||
<TestCaseRequestedList>
|
||||
010101
|
||||
050101 060101 070101 040101
|
||||
030101 030102 040301 040501 040604 040642 040401 040201 030201 030202
|
||||
050201 060201 070201
|
||||
</TestCaseRequestedList>
|
||||
<!--
|
||||
030111 030112 040301 040511 040614 040652 040401 040201 030201 030202
|
||||
030121 030122 040301 040521 040624 040662 040401 040201 030201 030202
|
||||
-->
|
||||
050201 060201 070201
|
||||
</TestCaseRequestedList>
|
||||
<TestCaseExclusionList>
|
||||
</TestCaseExclusionList>
|
||||
|
||||
@@ -44,42 +41,42 @@
|
||||
<testCase id="030101">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (FDD/Band7)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030102">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (FDD/Band7/5MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030111">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (FDD/Band7)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030112">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (FDD/Band7/10MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030121">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RRU (FDD/Band7)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.fdd.band7.conf</Initialize_eNB_args>
|
||||
<eNB_instance>1</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
<testCase id="030122">
|
||||
<class>Initialize_eNB</class>
|
||||
<desc>Initialize RCC (FDD/Band7/20MHz)</desc>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf --codingw --fepw</Initialize_eNB_args>
|
||||
<Initialize_eNB_args>-O ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf</Initialize_eNB_args>
|
||||
<eNB_instance>0</eNB_instance>
|
||||
</testCase>
|
||||
|
||||
|
||||
@@ -107,6 +107,28 @@
|
||||
<desc>Reboot UE</desc>
|
||||
</testCase>
|
||||
|
||||
<!-- CAT-M UE class command references -->
|
||||
|
||||
<testCase id="040102">
|
||||
<class>Initialize_CatM_module</class>
|
||||
<desc>Initialize CAT-M Module</desc>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040202">
|
||||
<class>Terminate_CatM_module</class>
|
||||
<desc>Terminate CAT-M Module</desc>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040302">
|
||||
<class>Attach_CatM_module</class>
|
||||
<desc>Attach CAT-M Module</desc>
|
||||
</testCase>
|
||||
|
||||
<testCase id="040402">
|
||||
<class>Detach_CatM_module</class>
|
||||
<desc>Detach CAT-M Module</desc>
|
||||
</testCase>
|
||||
|
||||
<!-- EPC class command references -->
|
||||
|
||||
<testCase id="050101">
|
||||
|
||||
@@ -232,7 +232,7 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
|
||||
# Debug related options
|
||||
#########################################
|
||||
add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug")
|
||||
add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug")
|
||||
add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug")
|
||||
add_boolean_option(MSG_PRINT False "print debug messages")
|
||||
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
|
||||
add_boolean_option(XER_PRINT False "print XER Format")
|
||||
@@ -290,36 +290,36 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
|
||||
add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA")
|
||||
|
||||
if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
|
||||
make_version(RRC_VERSION 8 6 0)
|
||||
make_version(LTE_RRC_VERSION 8 6 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
|
||||
make_version(RRC_VERSION 10 2 0)
|
||||
make_version(LTE_RRC_VERSION 10 2 0)
|
||||
add_definitions(-DCBA)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
|
||||
make_version(RRC_VERSION 10 2 0)
|
||||
make_version(LTE_RRC_VERSION 10 2 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel11")
|
||||
make_version(RRC_VERSION 11 18 0)
|
||||
make_version(LTE_RRC_VERSION 11 18 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel12")
|
||||
make_version(RRC_VERSION 12 16 0)
|
||||
make_version(LTE_RRC_VERSION 12 16 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel13")
|
||||
make_version(RRC_VERSION 13 9 1)
|
||||
make_version(LTE_RRC_VERSION 13 9 1)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel14")
|
||||
make_version(RRC_VERSION 14 7 0)
|
||||
make_version(LTE_RRC_VERSION 14 7 0)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1)
|
||||
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel15")
|
||||
make_version(RRC_VERSION 15 2 2)
|
||||
make_version(LTE_RRC_VERSION 15 2 2)
|
||||
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1)
|
||||
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
|
||||
add_definitions(-DRRC_VERSION=${RRC_VERSION})
|
||||
add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION})
|
||||
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
|
||||
message("calling asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
|
||||
message("calling ASN1C_PREFIX=LTE_ asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
|
||||
execute_process(COMMAND mkdir -p ${RRC_FULL_DIR}
|
||||
COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
COMMAND env "ASN1C_PREFIX=LTE_" asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
RESULT_VARIABLE ret)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
@@ -339,7 +339,7 @@ include_directories ("${RRC_FULL_DIR}")
|
||||
add_custom_command (
|
||||
OUTPUT ${RRC_FULL_DIR}/asn_constant.h
|
||||
COMMAND mkdir -p ${RRC_FULL_DIR}
|
||||
COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
COMMAND env "ASN1C_PREFIX=LTE_" asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
DEPENDS ${RRC_GRAMMAR}
|
||||
)
|
||||
|
||||
@@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem
|
||||
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
|
||||
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
|
||||
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
|
||||
add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
|
||||
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
|
||||
|
||||
##########################
|
||||
@@ -1927,6 +1926,7 @@ add_executable(lte-softmodem
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
|
||||
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks.c
|
||||
@@ -1966,6 +1966,7 @@ add_executable(lte-softmodem-nos1
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
|
||||
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
${OPENAIR_TARGETS}/COMMON/create_tasks.c
|
||||
@@ -2003,6 +2004,7 @@ add_executable(lte-uesoftmodem
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rfsim.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
@@ -2041,6 +2043,7 @@ add_executable(lte-uesoftmodem-nos1
|
||||
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
|
||||
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
|
||||
${OPENAIR_TARGETS}/RT/USER/rfsim.c
|
||||
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
|
||||
|
||||
@@ -956,20 +956,20 @@
|
||||
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
|
||||
<pre_exec_args></pre_exec_args>
|
||||
<main_exec> $OPENAIR_DIR/targets/bin/dlsim.Rel14</main_exec>
|
||||
<main_exec_args> -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O60
|
||||
-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O60
|
||||
-m15 -gG -s1.4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O25
|
||||
-m15 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c2 -z2 -O25
|
||||
-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O60
|
||||
-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O60
|
||||
-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O60
|
||||
-m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O60
|
||||
-m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O60
|
||||
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O60
|
||||
-m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O60
|
||||
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O60</main_exec_args>
|
||||
<main_exec_args> -m=5 -g=F -s=-1= -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60
|
||||
-m=4 -g=F -s=0 -w=1.0 -f=.2 -n=500 -B=6 -c=4 -z=2 -O=60
|
||||
-m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60
|
||||
-m=15 -g=F -s=6.7 -w=1.0 -f=.2 -n=500 -B=25 -c=2 -z=2 -O=60
|
||||
-m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=25
|
||||
-m=15 -g=G -s=1.4 -w=1.0 -f=.2 -n=500 -B=25 -c=2 -z=2 -O=25
|
||||
-m=25 -g=F -s=17.4 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -z=2 -O=60
|
||||
-m=25 -g=F -s=17.5 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -z=2 -r=1022 -O=60
|
||||
-m=26 -g=F -s=17.7 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -z=2 -O=60
|
||||
-m=26 -g=F -s=17.6 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -O=60
|
||||
-m=26 -g=F -s=17.3 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -r=1600 -O=60
|
||||
-m=26 -g=F -s=16.6 -w=1.0 -f=.2 -n=500 -B=100 -c=2 -z=2 -r=1899 -O=60
|
||||
-m=14 -g=F -s=6.8 -w=1.0 -f=.2 -n=500 -B=50 -c=2 -x=2 -y=2 -z=2 -O=60
|
||||
-m=13 -g=F -s=5.9 -w=1.0 -f=.2 -n=500 -B=25 -c=3 -x=2 -y=2 -z=2 -O=60</main_exec_args>
|
||||
<tags>dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.TM2_test1 dlsim.TM2_test1b</tags>
|
||||
<search_expr_true>"passed"</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
|
||||
@@ -651,6 +651,9 @@ function main() {
|
||||
compilations \
|
||||
lte-simulators coding \
|
||||
libcoding.so $dbin/libcoding.so
|
||||
# compilations \
|
||||
# lte-simulators $config_libconfig_shlib \
|
||||
# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
|
||||
fi
|
||||
|
||||
# Core simulators
|
||||
|
||||
@@ -9,4 +9,5 @@ set(MU_RECIEVER False)
|
||||
set(NAS_UE False)
|
||||
set(MESSAGE_CHART_GENERATOR False)
|
||||
set(RRC_ASN1_VERSION "Rel14")
|
||||
set (UE_TIMING_TRACE True)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
|
||||
|
||||
@@ -252,7 +252,7 @@ install_usrp_uhd_driver_from_source(){
|
||||
rm -rf /tmp/uhd
|
||||
git clone https://github.com/EttusResearch/uhd.git
|
||||
cd uhd
|
||||
git checkout tags/release_003_010_001_001
|
||||
git checkout tags/v3.13.0.2
|
||||
mkdir -p host/build
|
||||
cd host/build
|
||||
$CMAKE ../
|
||||
@@ -683,7 +683,7 @@ install_asn1c_from_source(){
|
||||
# better to use a given commit than a branch in case the branch
|
||||
# is updated and requires modifications in the source of OAI
|
||||
#git checkout velichkov_s1ap_plus_option_group
|
||||
git checkout d3aed06bb2bec7df1b5c6d0333f8c7dfc5993372
|
||||
git checkout 0a7524184f16e7093990a31d8d4db487a16e5782
|
||||
autoreconf -iv
|
||||
./configure
|
||||
make -j`nproc`
|
||||
|
||||
11
common/config/DOC/config.md
Normal file
11
common/config/DOC/config.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# OAI configuration module
|
||||
|
||||
The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include a mechanism to check that no unknown options have been entered on the command line
|
||||
|
||||
## Documentation
|
||||
|
||||
* [runtime usage](config/rtusage.md)
|
||||
* [developer usage](config/devusage.md)
|
||||
* [module architecture](config/arch.md)
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
7
common/config/DOC/config/arch.md
Normal file
7
common/config/DOC/config/arch.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# config module source files
|
||||

|
||||
# config module components
|
||||

|
||||
|
||||
|
||||
[Configuration module home](../config.md)
|
||||
20
common/config/DOC/config/devusage.md
Normal file
20
common/config/DOC/config/devusage.md
Normal file
@@ -0,0 +1,20 @@
|
||||
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.
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
[Configuration module home](../config.md)
|
||||
86
common/config/DOC/config/devusage/addaparam.md
Normal file
86
common/config/DOC/config/devusage/addaparam.md
Normal file
@@ -0,0 +1,86 @@
|
||||
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:
|
||||
```c
|
||||
unsigned int varopt1;
|
||||
paramdef_t someoptions[] = {
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* configuration parameters for some module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
{"opt1", "<help opt1>", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
|
||||
};
|
||||
|
||||
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
|
||||
|
||||
```
|
||||
new code:
|
||||
```c
|
||||
unsigned int varopt1;
|
||||
|
||||
|
||||
/* varopt2 will be allocated by the config module and free at end_configmodule call
|
||||
except if PARAMFLAG_NOFREE bit is set in paramflags field*/
|
||||
char *varopt2;
|
||||
paramdef_t someoptions[] = {
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* configuration parameters for some module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
{"opt1", "<help opt1>", 0, uptr:&varopt1, defuintval:0,TYPE_UINT, 0 },
|
||||
{"opt2", "<help opt2>", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
|
||||
};
|
||||
|
||||
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
|
||||
|
||||
```
|
||||
|
||||
The corresponding configuration file may now include opt2 parameter in the somesection section:
|
||||
|
||||
```c
|
||||
somesection =
|
||||
{
|
||||
opt1 = 3;
|
||||
opt2 = "abcd";
|
||||
};
|
||||
```
|
||||
|
||||
In these examples the variables used to retrieve the parameters values are pointed by the `uptr` or `strptr` fields of the `paramdef_t` structure. After the `config_get` call `varopt1` and `varopt2` have been set to the value specified in the config file. It is also possible to specify a `NULL` value to the `< XXX >ptr` fields, which are then allocated by the config module and possibly free when calling `config_end()`, if the `PARAMFLAG_NOFREE` bit has not been set in the `paramflags` field.
|
||||
|
||||
The configuration module provides a mechanism to check the parameter value read from the configuration source. The following functions are implemented:
|
||||
1. Check an integer parameter against a list of authorized values
|
||||
1. Check an integer parameter against a list of authorized values and set the parameter to a new value
|
||||
1. Check an integer parameter against a range
|
||||
1. Check a C string parameter against a list of authorized values
|
||||
1. Check a C string parameter against a list of authorized values and set the parameter to a new integer value
|
||||
|
||||
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.
|
||||
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"
|
||||
*/
|
||||
#define OPT1_OKVALUES {0,2,3,4,7}
|
||||
#define OPT1_NEWVALUES {1,1,0,6,9}
|
||||
#define OPT2_OKVALUES {"zero","oneThird","twoThird","one"}
|
||||
|
||||
#define OPT_CHECK_DESC { \
|
||||
{ .s1a= { config_check_modify_integer, OPT1_OKVALUE, OPT1_NEWVALUES ,5 }}, \
|
||||
{ .s3= { config_check_strval, OPT2_OKVALUES,4 }}, \
|
||||
}
|
||||
checkedparam_t checkopt[] = OPT_CHECK_DESC;
|
||||
.....
|
||||
/* assign the verification procedures to the parameters definitions */
|
||||
for(int i=0 ; i < sizeof(someoptions)/sizeof(paramdesc_t) ; i ++) {
|
||||
someoptions[i].chkPptr = &(checkopt[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 home](../../config.md)
|
||||
131
common/config/DOC/config/devusage/addparamset.md
Normal file
131
common/config/DOC/config/devusage/addparamset.md
Normal file
@@ -0,0 +1,131 @@
|
||||
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
|
||||
|
||||
|
||||
[config_get example](../../config/devusage/addaparam.md)
|
||||
|
||||
|
||||
In oai some parameters set may be instantiated a variable number of occurrences. In a configuration file this is mapped to lists of group of parameters, with this syntax:
|
||||
```c
|
||||
NB-IoT_MACRLCs =
|
||||
/* start list element 1 */
|
||||
(
|
||||
/* start a group of parameters */
|
||||
{
|
||||
num_cc = 2;
|
||||
.....
|
||||
remote_s_portd = 55001;
|
||||
}
|
||||
),
|
||||
/* start list element 2 */
|
||||
(
|
||||
/* start a group of parameters */
|
||||
{
|
||||
num_cc = 1;
|
||||
......
|
||||
remote_s_portd = 65001;
|
||||
}
|
||||
);
|
||||
|
||||
```
|
||||
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_MACRLC_S_PORTD "remote_s_portd"
|
||||
|
||||
/*
|
||||
now define a macro which will be used to initialize the NbIoT_MacRLC_Params
|
||||
variable. NbIoT_MacRLC_Params is an array of paramdef_t structure, each item
|
||||
describing a parameter. When using the config_getlist call you must let the config
|
||||
module allocate the memory for the parameters values.
|
||||
*/
|
||||
/*------------------------------------------------------------------------------------------------------------*/
|
||||
/* 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
|
||||
*/
|
||||
#define MACRLC_CC_IDX 0
|
||||
.........
|
||||
#define MACRLC_REMOTE_S_PORTD_IDX 16
|
||||
|
||||
|
||||
|
||||
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
|
||||
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.
|
||||
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
|
||||
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 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),
|
||||
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 ; j<NbIoT_MacRLC_ParamList.numelt ; j++) {
|
||||
|
||||
..........
|
||||
|
||||
/* access the MACRLC_REMOTE_S_PORTD parameter in the j ieme group of the list */
|
||||
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 home](../../config.md)
|
||||
48
common/config/DOC/config/devusage/api.md
Normal file
48
common/config/DOC/config/devusage/api.md
Normal file
@@ -0,0 +1,48 @@
|
||||
```c
|
||||
configmodule_interface_t *load_configmodule(int argc, char **argv)
|
||||
```
|
||||
* Parses the command line options, looking for the –O argument
|
||||
* Loads the `libparams_<configsource>.so` (today `libparams_libconfig.so`) shared library
|
||||
* Looks for `config_<config source>_init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option
|
||||
* Looks for `config_<config source>_get`, `config_<config source>_getlist` and `config_<config source>_end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional.
|
||||
* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source.
|
||||
|
||||
```c
|
||||
void End_configmodule(void)
|
||||
```
|
||||
* Free memory which has been allocated by the configuration module since its initialization.
|
||||
* Possibly calls the `config_<config source>_end` function
|
||||
|
||||
```c
|
||||
int config_get(paramdef_t *params,int numparams, char *prefix)
|
||||
```
|
||||
* Reads as many parameters as described in params, they must all be in the same configuration file section
|
||||
* Calls the `config_<config source>_get` function
|
||||
* Calls the `config_process_cmdline` function
|
||||
* `params` points to an array of `paramdef_t` structures which describes the parameters to be read, possibly including a pointer to a checking function. The following bits can possibly be set in the `paramflags` mask before calling
|
||||
- `PARAMFLAG_MANDATORY`: -1 is returned if the parameter is not explicitly defined in the config source.
|
||||
- `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.
|
||||
|
||||
* `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).
|
||||
* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured
|
||||
|
||||
```c
|
||||
int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
|
||||
```
|
||||
* Reads multiple occurrences of a parameters array
|
||||
* Calls the `config_<config source>_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
|
||||
|
||||
|
||||
[Configuration module developer main page](../../config/devusage.md)
|
||||
[Configuration module home](../../config.md)
|
||||
85
common/config/DOC/config/devusage/struct.md
Normal file
85
common/config/DOC/config/devusage/struct.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# `paramdef_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#L103). This structure is used by developers to describe parameters and by the configuration module to return parameters value. A pointer to a `paramdef_t` array is passed to `config_get` and `config_getlist` calls to instruct the configuration module what parameters it should read.
|
||||
|
||||
| Fields | Description | I/O |
|
||||
|:-----------|:------------------------------------------------------------------|----:|
|
||||
| `optname` | parameter name, as used when looking for it in the config source, 63 bytes max (64 with trailing \0) | I |
|
||||
| `helstr` | pointer to a C string printed when using --help on the command line | I |
|
||||
| `strptr` `strlistptr` `u8ptr` `i8ptr` `u16ptr` `i16ptr` `uptr` `iptr` `u64ptr` `i64ptr` `dblptr` `voidptr` | a pointer to a variable where the parameter value(s) will be returned. This field is an anonymous union, the supported pointer types have been built to avoid type mismatch warnings at compile time. | O |
|
||||
| `defstrval` `defstrlistval` `defuintval` `defintval` `defint64val` `defintarrayval` `defdblval` | this field is an anonymous union, it can be used to define the default value for the parameter. It is ignored if `PARAMFLAG_MANDATORY` is set in the `paramflags` field.| I |
|
||||
| `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 |
|
||||
|
||||
# `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.
|
||||
|
||||
| Fields | Description | I/O |
|
||||
|:-----------|:------------------------------------------------------------------|----:|
|
||||
| `listname` | Name of the section containing the list, 63 bytes max (64 with trailing \0). It is used to prefix each paramater name when looking for its value. In the libconfig syntax, the parameter name full path build by the configuration module is: listname.[occurence index].optname. | I |
|
||||
| `paramarray` | Pointer to an array of `ǹumelt` `paramdef_t` pointers. It is allocated by the configuration module and is used to return the parameters values. All input fields of each `paramdef_t` occurence are a copy of the `paramdef_t` argument passed to the `config_getlist` call. | 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).
|
||||
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 |
|
||||
|:-----------|:------------------------------------------------------------------|----:|
|
||||
| `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|
|
||||
| `s2` | check an integer against an authorized range, defined by its min and max value|
|
||||
| `s3` | check a string against a list of authorized values |
|
||||
| `s3a` | check a string against a list of authorized values and set the parameter value to an integer depending on the read value|
|
||||
| `s4` | generic structure, to be used to provide a specific, not defined in the configuration module, verification algorithm |
|
||||
|
||||
each of these structures provide the required fields to perform the specified parameter check. The first field is a pointer to a function, taking one argument, the `paramdef_t` structure describing the parameter to be checked. This function is called by the configuration module, in the `config_get` call , after the parameter value has been set, it then uses the other fields of the structure to perform the check.
|
||||
The configuration module provides an implementation of the functions to be used to check parameters, qs described below.
|
||||
|
||||
## `s1` structure
|
||||
| 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 |
|
||||
|:-----------|:------------------------------------------------------------------|
|
||||
| `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 |
|
||||
| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okintval[i]` |
|
||||
| `num_okintval` | number of used values in `okintval` and `setintval` |
|
||||
|
||||
## `s2` structure
|
||||
| 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 |
|
||||
|:-----------|:------------------------------------------------------------------|
|
||||
| `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 |
|
||||
| `num_okstrval` | number of used values in `okstrtval` |
|
||||
|
||||
|
||||
## `s3a` structure
|
||||
| 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 |
|
||||
| `setintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the values to be used for the parameter. The configuration module implementation set the parameter value to `setintval[i]` when the configured value is `okstrval[i]` |
|
||||
| `num_okstrval` | number of used values in `okintval` and `setintval` |
|
||||
|
||||
## `s4` and `s5` structures
|
||||
| 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 home](../../config.md)
|
||||
52
common/config/DOC/config/rtusage.md
Normal file
52
common/config/DOC/config/rtusage.md
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
-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 <configsource>:<parameter1>:<parameter2>:...
|
||||
```
|
||||
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.
|
||||
```bash
|
||||
$ ./lte-softmodem -O libconfig:<config>:dbgl<debuglevel>
|
||||
```
|
||||
- **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
|
||||
* 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).
|
||||
|
||||
```bash
|
||||
$ ./lte-softmodem -O libconfig:<config>:dbgl1
|
||||
```
|
||||
```bash
|
||||
$ ./lte-uesoftmodem -O cmdlineonly:dbgl1
|
||||
```
|
||||
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 <config>
|
||||
```
|
||||
|
||||
Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
|
||||
|
||||
```
|
||||
config:
|
||||
{
|
||||
debugflags = 1;
|
||||
}
|
||||
```
|
||||
Configuration files examples can be found in the targets/PROJECTS/GENERIC-LTE-EPC/CONF sub-directory of the oai source tree. To minimize the number of configuration file to maintain, any parameter can also be specified on the command line. For example to modify the lte bandwidth to 20 MHz where the configuration file specifies 10MHz you can enter:
|
||||
|
||||
```bash
|
||||
$ ./lte-softmodem -O <config> --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)
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*! \file common/config/cmdline/config_libconfig.c
|
||||
* \brief configuration module, command line parsing implementation
|
||||
* \brief configuration module, command line parsing implementation
|
||||
* \author Francois TABURET
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
@@ -39,181 +39,244 @@
|
||||
#include "config_userapi.h"
|
||||
|
||||
|
||||
int parse_stringlist(paramdef_t *cfgoptions, char *val)
|
||||
{
|
||||
char *atoken;
|
||||
char *tokctx;
|
||||
char *tmpval=strdup(val);
|
||||
int numelt=0;
|
||||
int parse_stringlist(paramdef_t *cfgoptions, char *val) {
|
||||
char *atoken;
|
||||
char *tokctx;
|
||||
char *tmpval=strdup(val);
|
||||
int numelt=0;
|
||||
cfgoptions->numelt=0;
|
||||
atoken=strtok_r(tmpval, ",",&tokctx);
|
||||
|
||||
cfgoptions->numelt=0;
|
||||
while(atoken != NULL) {
|
||||
numelt++ ;
|
||||
atoken=strtok_r(NULL, ",",&tokctx);
|
||||
}
|
||||
|
||||
atoken=strtok_r(tmpval, ",",&tokctx);
|
||||
while(atoken != NULL) {
|
||||
numelt++ ;
|
||||
atoken=strtok_r(NULL, ",",&tokctx);
|
||||
}
|
||||
free(tmpval);
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
|
||||
cfgoptions->numelt=numelt;
|
||||
free(tmpval);
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
|
||||
cfgoptions->numelt=numelt;
|
||||
atoken=strtok_r(val, ",",&tokctx);
|
||||
|
||||
atoken=strtok_r(val, ",",&tokctx);
|
||||
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
|
||||
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
|
||||
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
|
||||
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
|
||||
atoken=strtok_r(NULL, ",",&tokctx);
|
||||
}
|
||||
return (cfgoptions->numelt > 0);
|
||||
}
|
||||
|
||||
int processoption(paramdef_t *cfgoptions, char *value)
|
||||
{
|
||||
char *tmpval = value;
|
||||
int optisset=0;
|
||||
char defbool[2]="1";
|
||||
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
|
||||
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
|
||||
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
|
||||
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
|
||||
atoken=strtok_r(NULL, ",",&tokctx);
|
||||
}
|
||||
|
||||
|
||||
if ( value == NULL) {
|
||||
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
|
||||
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
|
||||
return 0;
|
||||
} else { /* boolean value option without argument, set value to true*/
|
||||
tmpval = defbool;
|
||||
}
|
||||
}
|
||||
switch(cfgoptions->type)
|
||||
{
|
||||
case TYPE_STRING:
|
||||
if (cfgoptions->numelt == 0 ) {
|
||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
|
||||
sprintf(*(cfgoptions->strptr), "%s",tmpval);
|
||||
} else {
|
||||
sprintf( (char *)(cfgoptions->strptr), "%s",tmpval);
|
||||
}
|
||||
printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_STRINGLIST:
|
||||
optisset=parse_stringlist(cfgoptions,tmpval);
|
||||
break;
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0));
|
||||
optisset=1;
|
||||
break;
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
|
||||
*(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0);
|
||||
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
|
||||
optisset=1;
|
||||
break;
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
||||
*(cfgoptions->dblptr) = strtof(tmpval,NULL);
|
||||
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_IPV4ADDR:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
|
||||
break;
|
||||
} /* switch on param type */
|
||||
if (optisset == 1) {
|
||||
cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
|
||||
}
|
||||
return optisset;
|
||||
return (cfgoptions->numelt > 0);
|
||||
}
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
|
||||
{
|
||||
int processoption(paramdef_t *cfgoptions, char *value) {
|
||||
char *tmpval = value;
|
||||
int optisset=0;
|
||||
char defbool[2]="1";
|
||||
|
||||
if ( value == NULL) {
|
||||
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
|
||||
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
|
||||
return 0;
|
||||
} else { /* boolean value option without argument, set value to true*/
|
||||
tmpval = defbool;
|
||||
}
|
||||
}
|
||||
|
||||
switch(cfgoptions->type) {
|
||||
case TYPE_STRING:
|
||||
if (cfgoptions->numelt == 0 ) {
|
||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
|
||||
sprintf(*(cfgoptions->strptr), "%s",tmpval);
|
||||
} else {
|
||||
sprintf( (char *)(cfgoptions->strptr), "%s",tmpval);
|
||||
}
|
||||
|
||||
printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_STRINGLIST:
|
||||
optisset=parse_stringlist(cfgoptions,tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0));
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
|
||||
*(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0);
|
||||
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
||||
*(cfgoptions->dblptr) = strtof(tmpval,NULL);
|
||||
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
|
||||
optisset=1;
|
||||
break;
|
||||
|
||||
case TYPE_IPV4ADDR:
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
|
||||
break;
|
||||
} /* switch on param type */
|
||||
|
||||
if (optisset == 1) {
|
||||
cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
|
||||
}
|
||||
|
||||
return optisset;
|
||||
}
|
||||
|
||||
int config_check_cmdlineopt(char *prefix) {
|
||||
int unknowndetected=0;
|
||||
char testprefix[CONFIG_MAXOPTLENGTH]="";
|
||||
int finalcheck = 0;
|
||||
|
||||
if (prefix != NULL) {
|
||||
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
|
||||
finalcheck = 1;
|
||||
else if (strlen(prefix) > 0) {
|
||||
sprintf(testprefix,"--%s.",prefix);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=1; i<config_get_if()->argc ; i++) {
|
||||
if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue;
|
||||
|
||||
if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
|
||||
|
||||
if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
|
||||
|
||||
if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
|
||||
fprintf(stderr,"[CONFIG] unknown option: %s\n",
|
||||
config_get_if()->argv[i] );
|
||||
unknowndetected++;
|
||||
}
|
||||
}
|
||||
|
||||
printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
|
||||
unknowndetected,testprefix,((prefix==NULL)?"":prefix));
|
||||
return unknowndetected;
|
||||
} /* parse_cmdline*/
|
||||
|
||||
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
|
||||
int c = config_get_if()->argc;
|
||||
int i,j;
|
||||
char *pp;
|
||||
char cfgpath[512]; /* 512 should be enough for the sprintf below */
|
||||
|
||||
char cfgpath[CONFIG_MAXOPTLENGTH];
|
||||
j = 0;
|
||||
i = 0;
|
||||
while (c > 0 ) {
|
||||
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
/* first check help options, either --help, -h or --help_<section> */
|
||||
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
|
||||
char *tokctx;
|
||||
pp=strtok_r(oneargv, "_",&tokctx);
|
||||
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
||||
if( prefix == NULL) {
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
|
||||
exit_fun("[CONFIG] Exiting after displaying help\n");
|
||||
}
|
||||
} else {
|
||||
pp=strtok_r(NULL, " ",&tokctx);
|
||||
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
||||
printf ("Help for %s section:\n",prefix);
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
|
||||
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
|
||||
exit_fun(" Exiting after displaying help\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (c > 0 ) {
|
||||
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
|
||||
|
||||
/* first check help options, either --help, -h or --help_<section> */
|
||||
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
|
||||
char *tokctx;
|
||||
pp=strtok_r(oneargv, "_",&tokctx);
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
|
||||
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
|
||||
if( prefix == NULL) {
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
|
||||
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
|
||||
exit_fun("[CONFIG] Exiting after displaying help\n");
|
||||
}
|
||||
} else {
|
||||
pp=strtok_r(NULL, " ",&tokctx);
|
||||
|
||||
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
|
||||
printf ("Help for %s section:\n",prefix);
|
||||
config_printhelp(cfgoptions,numoptions);
|
||||
|
||||
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
|
||||
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
|
||||
exit_fun(" Exiting after displaying help\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* now, check for non help options */
|
||||
if (oneargv[0] == '-') {
|
||||
for(int n=0; n<numoptions; n++) {
|
||||
if ( ( cfgoptions[n].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* now, check for non help options */
|
||||
if (oneargv[0] == '-') {
|
||||
for(int n=0;n<numoptions;n++) {
|
||||
if ( ( cfgoptions[n].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (prefix != NULL) {
|
||||
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname);
|
||||
} else {
|
||||
sprintf(cfgpath,"%s",cfgoptions[n].optname);
|
||||
}
|
||||
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
|
||||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
|
||||
char *valptr=NULL;
|
||||
int ret;
|
||||
if (c > 0) {
|
||||
pp = config_get_if()->argv[i+1];
|
||||
if (pp != NULL ) {
|
||||
ret = strlen(pp);
|
||||
if (ret > 0 ) {
|
||||
if (pp[0] != '-')
|
||||
valptr=pp;
|
||||
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
|
||||
valptr=pp;
|
||||
}
|
||||
}
|
||||
}
|
||||
j += processoption(&(cfgoptions[n]), valptr);
|
||||
if ( valptr != NULL ) {
|
||||
i++;
|
||||
c--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} /* for n... */
|
||||
} /* if (oneargv[0] == '-') */
|
||||
free(oneargv);
|
||||
i++;
|
||||
c--;
|
||||
} /* fin du while */
|
||||
if (prefix != NULL) {
|
||||
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname);
|
||||
} else {
|
||||
sprintf(cfgpath,"%s",cfgoptions[n].optname);
|
||||
}
|
||||
|
||||
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
|
||||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
|
||||
char *valptr=NULL;
|
||||
int ret;
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
|
||||
if (c > 0) {
|
||||
pp = config_get_if()->argv[i+1];
|
||||
|
||||
if (pp != NULL ) {
|
||||
ret = strlen(pp);
|
||||
|
||||
if (ret > 0 ) {
|
||||
if (pp[0] != '-')
|
||||
valptr=pp;
|
||||
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
|
||||
valptr=pp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
j += processoption(&(cfgoptions[n]), valptr);
|
||||
|
||||
if ( valptr != NULL ) {
|
||||
i++;
|
||||
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
c--;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} /* for n... */
|
||||
} /* if (oneargv[0] == '-') */
|
||||
|
||||
free(oneargv);
|
||||
i++;
|
||||
c--;
|
||||
} /* fin du while */
|
||||
|
||||
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
|
||||
return j;
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) {
|
||||
i=config_check_cmdlineopt(prefix);
|
||||
|
||||
if (i > 0) {
|
||||
fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n",
|
||||
i,((prefix==NULL)?"\"root section\"":prefix));
|
||||
exit_fun(" Exiting after detecting errors in command line \n");
|
||||
}
|
||||
}
|
||||
|
||||
return j;
|
||||
} /* parse_cmdline*/
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*! \file common/config/config_load_configmodule.c
|
||||
* \brief configuration module, load the shared library implementing the configuration module
|
||||
* \brief configuration module, load the shared library implementing the configuration module
|
||||
* \author Francois TABURET
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
@@ -42,282 +42,314 @@
|
||||
#include "config_userapi.h"
|
||||
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
||||
|
||||
int load_config_sharedlib(configmodule_interface_t *cfgptr)
|
||||
{
|
||||
void *lib_handle;
|
||||
char fname[128];
|
||||
char libname[FILENAME_MAX];
|
||||
int st;
|
||||
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||
void *lib_handle;
|
||||
char fname[128];
|
||||
char libname[FILENAME_MAX];
|
||||
int st;
|
||||
st=0;
|
||||
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
|
||||
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
|
||||
|
||||
st=0;
|
||||
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
|
||||
if (!lib_handle) {
|
||||
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
|
||||
st = -1;
|
||||
} else {
|
||||
sprintf (fname,"config_%s_init",cfgptr->cfgmode);
|
||||
cfgptr->init = dlsym(lib_handle,fname);
|
||||
|
||||
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
|
||||
if (!lib_handle) {
|
||||
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
|
||||
if (cfgptr->init == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
} else {
|
||||
st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
|
||||
printf("[CONFIG] function %s returned %i\n",
|
||||
fname, st);
|
||||
}
|
||||
|
||||
sprintf (fname,"config_%s_get",cfgptr->cfgmode);
|
||||
cfgptr->get = dlsym(lib_handle,fname);
|
||||
|
||||
if (cfgptr->get == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
st = -1;
|
||||
} else {
|
||||
sprintf (fname,"config_%s_init",cfgptr->cfgmode);
|
||||
cfgptr->init = dlsym(lib_handle,fname);
|
||||
}
|
||||
|
||||
if (cfgptr->init == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
} else {
|
||||
st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
|
||||
printf("[CONFIG] function %s returned %i\n",
|
||||
fname, st);
|
||||
}
|
||||
sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
|
||||
cfgptr->getlist = dlsym(lib_handle,fname);
|
||||
|
||||
sprintf (fname,"config_%s_get",cfgptr->cfgmode);
|
||||
cfgptr->get = dlsym(lib_handle,fname);
|
||||
if (cfgptr->get == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
st = -1;
|
||||
}
|
||||
|
||||
sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
|
||||
cfgptr->getlist = dlsym(lib_handle,fname);
|
||||
if (cfgptr->getlist == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
st = -1;
|
||||
}
|
||||
if (cfgptr->getlist == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
st = -1;
|
||||
}
|
||||
|
||||
sprintf (fname,"config_%s_end",cfgptr->cfgmode);
|
||||
cfgptr->end = dlsym(lib_handle,fname);
|
||||
if (cfgptr->getlist == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
sprintf (fname,"config_%s_end",cfgptr->cfgmode);
|
||||
cfgptr->end = dlsym(lib_handle,fname);
|
||||
|
||||
if (cfgptr->getlist == NULL ) {
|
||||
printf("[CONFIG] %s %d no function %s for config mode %s\n",
|
||||
__FILE__, __LINE__,fname, cfgptr->cfgmode);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* from here: interface implementtion of the configuration module */
|
||||
int nooptfunc(void) {
|
||||
return 0;
|
||||
return 0;
|
||||
};
|
||||
|
||||
int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
|
||||
paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
ParamList->numelt = 0;
|
||||
return 0;
|
||||
int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
|
||||
paramdef_t *params, int numparams, char *prefix) {
|
||||
ParamList->numelt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
|
||||
{
|
||||
int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
int defval;
|
||||
int fatalerror=0;
|
||||
int numdefvals=0;
|
||||
|
||||
|
||||
for(int i=0;i<numoptions;i++) {
|
||||
defval=0;
|
||||
switch(cfgoptions[i].type) {
|
||||
case TYPE_STRING:
|
||||
defval=config_setdefault_string(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_STRINGLIST:
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
defval=config_setdefault_int(&(cfgoptions[i]), prefix);
|
||||
for(int i=0; i<numoptions; i++) {
|
||||
defval=0;
|
||||
|
||||
switch(cfgoptions[i].type) {
|
||||
case TYPE_STRING:
|
||||
defval=config_setdefault_string(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]), prefix);
|
||||
|
||||
case TYPE_STRINGLIST:
|
||||
defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
defval=config_setdefault_double(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
case TYPE_IPV4ADDR:
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix);
|
||||
|
||||
|
||||
case TYPE_UINT8:
|
||||
case TYPE_INT8:
|
||||
case TYPE_UINT16:
|
||||
case TYPE_INT16:
|
||||
case TYPE_UINT32:
|
||||
case TYPE_INT32:
|
||||
case TYPE_MASK:
|
||||
defval=config_setdefault_int(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"[CONFIG] %s.%s type %i not supported\n",prefix, cfgoptions[i].optname,cfgoptions[i].type);
|
||||
fatalerror=1;
|
||||
|
||||
case TYPE_UINT64:
|
||||
case TYPE_INT64:
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
} /* switch on param type */
|
||||
|
||||
case TYPE_UINTARRAY:
|
||||
case TYPE_INTARRAY:
|
||||
defval=config_setdefault_intlist(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
defval=config_setdefault_double(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
|
||||
case TYPE_IPV4ADDR:
|
||||
defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"[CONFIG] %s.%s type %i not supported\n",prefix, cfgoptions[i].optname,cfgoptions[i].type);
|
||||
fatalerror=1;
|
||||
break;
|
||||
} /* switch on param type */
|
||||
|
||||
if (defval == 1) {
|
||||
numdefvals++;
|
||||
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
|
||||
numdefvals++;
|
||||
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
|
||||
}
|
||||
} /* for loop on options */
|
||||
|
||||
printf("[CONFIG] %s: %i/%i parameters successfully set \n",
|
||||
((prefix == NULL)?"(root)":prefix),
|
||||
((prefix == NULL)?"(root)":prefix),
|
||||
numdefvals,numoptions );
|
||||
|
||||
if (fatalerror == 1) {
|
||||
fprintf(stderr,"[CONFIG] fatal errors found when assigning %s parameters \n",
|
||||
prefix);
|
||||
fprintf(stderr,"[CONFIG] fatal errors found when assigning %s parameters \n",
|
||||
prefix);
|
||||
}
|
||||
|
||||
return numdefvals;
|
||||
}
|
||||
|
||||
configmodule_interface_t *load_configmodule(int argc, char **argv)
|
||||
{
|
||||
char *cfgparam=NULL;
|
||||
char *modeparams=NULL;
|
||||
char *cfgmode=NULL;
|
||||
char *strtokctx=NULL;
|
||||
char *atoken;
|
||||
uint32_t tmpflags=0;
|
||||
int i;
|
||||
|
||||
/* first parse the command line to look for the -O option */
|
||||
for (i = 0;i<argc;i++) {
|
||||
if (strlen(argv[i]) < 2) continue;
|
||||
if ( argv[i][1] == 'O' && i < (argc -1)) {
|
||||
cfgparam = argv[i+1];
|
||||
}
|
||||
if ( strstr(argv[i], "help_config") != NULL ) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
exit(0);
|
||||
}
|
||||
if ( (strcmp(argv[i]+1, "h") == 0) || (strstr(argv[i]+1, "help_") != NULL ) ) {
|
||||
tmpflags = CONFIG_HELP;
|
||||
}
|
||||
}
|
||||
configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags) {
|
||||
char *cfgparam=NULL;
|
||||
char *modeparams=NULL;
|
||||
char *cfgmode=NULL;
|
||||
char *strtokctx=NULL;
|
||||
char *atoken;
|
||||
uint32_t tmpflags=0;
|
||||
int i;
|
||||
int OoptIdx=-1;
|
||||
|
||||
/* look for the OAI_CONFIGMODULE environement variable */
|
||||
/* first parse the command line to look for the -O option */
|
||||
for (i = 0; i<argc; i++) {
|
||||
if (strlen(argv[i]) < 2) continue;
|
||||
|
||||
if ( argv[i][1] == 'O' && i < (argc -1)) {
|
||||
cfgparam = argv[i+1];
|
||||
OoptIdx=i;
|
||||
}
|
||||
|
||||
if ( strstr(argv[i], "help_config") != NULL ) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ( (strcmp(argv[i]+1, "h") == 0) || (strstr(argv[i]+1, "help_") != NULL ) ) {
|
||||
tmpflags = CONFIG_HELP;
|
||||
}
|
||||
}
|
||||
|
||||
/* look for the OAI_CONFIGMODULE environement variable */
|
||||
if ( cfgparam == NULL ) {
|
||||
cfgparam = getenv("OAI_CONFIGMODULE");
|
||||
}
|
||||
cfgparam = getenv("OAI_CONFIGMODULE");
|
||||
}
|
||||
|
||||
/* default */
|
||||
/* default different for UE and softmodem because UE doesn't use config file*/
|
||||
/* and -O option is not mandatory for UE */
|
||||
/* phy simulators behave as UE */
|
||||
/* test of exec name would better be replaced by a parameter to the l */
|
||||
/* oad_configmodule function */
|
||||
if (cfgparam == NULL) {
|
||||
tmpflags = tmpflags | CONFIG_NOOOPT;
|
||||
if (strstr(argv[0],"uesoftmodem") == NULL) {
|
||||
cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME;
|
||||
} else {
|
||||
cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;
|
||||
}
|
||||
}
|
||||
|
||||
/* parse the config parameters to set the config source */
|
||||
i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams);
|
||||
if (i< 0) {
|
||||
fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
else if ( i == 1 ) {
|
||||
/* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig
|
||||
with one parameter, the path to the configuration file */
|
||||
modeparams=cfgmode;
|
||||
cfgmode=strdup(CONFIG_LIBCONFIGFILE);
|
||||
}
|
||||
tmpflags = tmpflags | CONFIG_NOOOPT;
|
||||
|
||||
cfgptr = malloc(sizeof(configmodule_interface_t));
|
||||
memset(cfgptr,0,sizeof(configmodule_interface_t));
|
||||
if ( initflags & CONFIG_ENABLECMDLINEONLY) {
|
||||
cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;
|
||||
} else {
|
||||
cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;
|
||||
cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME;
|
||||
}
|
||||
}
|
||||
|
||||
cfgptr->rtflags = cfgptr->rtflags | tmpflags;
|
||||
cfgptr->argc = argc;
|
||||
cfgptr->argv = argv;
|
||||
cfgptr->cfgmode=strdup(cfgmode);
|
||||
cfgptr->num_cfgP=0;
|
||||
atoken=strtok_r(modeparams,":",&strtokctx);
|
||||
while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
|
||||
/* look for debug level in the config parameters, it is commom to all config mode
|
||||
and will be removed frome the parameter array passed to the shared module */
|
||||
char *aptr;
|
||||
aptr=strcasestr(atoken,"dbgl");
|
||||
if (aptr != NULL) {
|
||||
cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
|
||||
/* parse the config parameters to set the config source */
|
||||
i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams);
|
||||
|
||||
} else {
|
||||
cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
|
||||
cfgptr->num_cfgP++;
|
||||
}
|
||||
atoken = strtok_r(NULL,":",&strtokctx);
|
||||
}
|
||||
if (i< 0) {
|
||||
fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
|
||||
exit(-1) ;
|
||||
} else if ( i == 1 ) {
|
||||
/* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig
|
||||
with one parameter, the path to the configuration file cfgmode must not be NULL */
|
||||
modeparams=cfgmode;
|
||||
cfgmode=strdup(CONFIG_LIBCONFIGFILE);
|
||||
}
|
||||
|
||||
|
||||
printf("[CONFIG] get parameters from %s ",cfgmode);
|
||||
for (i=0;i<cfgptr->num_cfgP; i++) {
|
||||
printf("%s ",cfgptr->cfgP[i]);
|
||||
}
|
||||
printf(", debug flags: 0x%08x\n",cfgptr->rtflags);
|
||||
cfgptr = calloc(sizeof(configmodule_interface_t),1);
|
||||
cfgptr->argv_info = calloc(sizeof(int32_t), argc);
|
||||
cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
|
||||
if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) {
|
||||
i=load_config_sharedlib(cfgptr);
|
||||
if (i == 0) {
|
||||
printf("[CONFIG] config module %s loaded\n",cfgmode);
|
||||
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
|
||||
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
|
||||
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
|
||||
}
|
||||
} else {
|
||||
cfgptr->init = (configmodule_initfunc_t)nooptfunc;
|
||||
cfgptr->get = config_cmdlineonly_get;
|
||||
cfgptr->getlist = config_cmdlineonly_getlist;
|
||||
cfgptr->end = (configmodule_endfunc_t)nooptfunc;
|
||||
}
|
||||
if (OoptIdx >= 0) {
|
||||
cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED;
|
||||
}
|
||||
|
||||
|
||||
cfgptr->rtflags = cfgptr->rtflags | tmpflags;
|
||||
cfgptr->argc = argc;
|
||||
cfgptr->argv = argv;
|
||||
cfgptr->cfgmode=strdup(cfgmode);
|
||||
cfgptr->num_cfgP=0;
|
||||
atoken=strtok_r(modeparams,":",&strtokctx);
|
||||
|
||||
if (modeparams != NULL) free(modeparams);
|
||||
if (cfgmode != NULL) free(cfgmode);
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
// exit(-1);
|
||||
}
|
||||
return cfgptr;
|
||||
while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
|
||||
/* look for debug level in the config parameters, it is commom to all config mode
|
||||
and will be removed frome the parameter array passed to the shared module */
|
||||
char *aptr;
|
||||
aptr=strcasestr(atoken,"dbgl");
|
||||
|
||||
if (aptr != NULL) {
|
||||
cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
|
||||
} else {
|
||||
cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
|
||||
cfgptr->num_cfgP++;
|
||||
}
|
||||
|
||||
atoken = strtok_r(NULL,":",&strtokctx);
|
||||
}
|
||||
|
||||
printf("[CONFIG] get parameters from %s ",cfgmode);
|
||||
|
||||
for (i=0; i<cfgptr->num_cfgP; i++) {
|
||||
printf("%s ",cfgptr->cfgP[i]);
|
||||
}
|
||||
|
||||
printf(", debug flags: 0x%08x\n",cfgptr->rtflags);
|
||||
|
||||
if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) {
|
||||
i=load_config_sharedlib(cfgptr);
|
||||
|
||||
if (i == 0) {
|
||||
printf("[CONFIG] config module %s loaded\n",cfgmode);
|
||||
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags);
|
||||
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
|
||||
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
|
||||
}
|
||||
} else {
|
||||
cfgptr->init = (configmodule_initfunc_t)nooptfunc;
|
||||
cfgptr->get = config_cmdlineonly_get;
|
||||
cfgptr->getlist = config_cmdlineonly_getlist;
|
||||
cfgptr->end = (configmodule_endfunc_t)nooptfunc;
|
||||
}
|
||||
|
||||
if (modeparams != NULL) free(modeparams);
|
||||
|
||||
if (cfgmode != NULL) free(cfgmode);
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params));
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
return cfgptr;
|
||||
}
|
||||
|
||||
|
||||
/* free memory allocated when reading parameters */
|
||||
/* config module could be initialized again after this call */
|
||||
void end_configmodule(void)
|
||||
{
|
||||
void end_configmodule(void) {
|
||||
if (cfgptr != NULL) {
|
||||
if (cfgptr->end != NULL) {
|
||||
printf ("[CONFIG] calling config module end function...\n");
|
||||
cfgptr->end();
|
||||
}
|
||||
if (cfgptr->end != NULL) {
|
||||
printf ("[CONFIG] calling config module end function...\n");
|
||||
cfgptr->end();
|
||||
}
|
||||
|
||||
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
|
||||
for(int i=0; i<cfgptr->numptrs ; i++) {
|
||||
if (cfgptr->ptrs[i] != NULL) {
|
||||
free(cfgptr->ptrs[i]);
|
||||
cfgptr->ptrs[i]=NULL;
|
||||
}
|
||||
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
|
||||
|
||||
for(int i=0; i<cfgptr->numptrs ; i++) {
|
||||
if (cfgptr->ptrs[i] != NULL) {
|
||||
free(cfgptr->ptrs[i]);
|
||||
cfgptr->ptrs[i]=NULL;
|
||||
}
|
||||
cfgptr->numptrs=0;
|
||||
}
|
||||
|
||||
cfgptr->numptrs=0;
|
||||
}
|
||||
}
|
||||
|
||||
/* free all memory used by config module */
|
||||
/* should be called only at program exit */
|
||||
void free_configmodule(void)
|
||||
{
|
||||
void free_configmodule(void) {
|
||||
if (cfgptr != NULL) {
|
||||
end_configmodule();
|
||||
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
|
||||
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
|
||||
for (int i=0; i<cfgptr->num_cfgP; i++) {
|
||||
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
|
||||
}
|
||||
end_configmodule();
|
||||
|
||||
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
|
||||
|
||||
free(cfgptr);
|
||||
cfgptr=NULL;
|
||||
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
|
||||
|
||||
for (int i=0; i<cfgptr->num_cfgP; i++) {
|
||||
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
|
||||
}
|
||||
|
||||
free(cfgptr);
|
||||
cfgptr=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/*! \file common/config/config_load_configmodule.h
|
||||
* \brief: configuration module, include file to be used by the source code calling the
|
||||
* configuration module initialization
|
||||
* \brief: configuration module, include file to be used by the source code calling the
|
||||
* configuration module initialization
|
||||
* \author Francois TABURET
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
@@ -31,12 +31,13 @@
|
||||
* \warning
|
||||
*/
|
||||
#ifndef INCLUDE_CONFIG_LOADCONFIGMODULE_H
|
||||
#define INCLUDE_CONFIG_LOADCONFIGMODULE_H
|
||||
#define INCLUDE_CONFIG_LOADCONFIGMODULE_H
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "common/config/config_paramdesc.h"
|
||||
#include "common/utils/T/T.h"
|
||||
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
|
||||
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
|
||||
|
||||
@@ -44,12 +45,14 @@
|
||||
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
|
||||
#define CONFIG_CMDLINEONLY "cmdline" // use only command line options
|
||||
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
|
||||
|
||||
/* rtflags bit position definitions */
|
||||
/* bit position definition for the argv_info mask of the configmodule_interface_t structure */
|
||||
#define CONFIG_CMDLINEOPT_PROCESSED (1<<0) // command line option has been processed
|
||||
/* bit position definitions for the rtflags mask of the configmodule_interface_t structure*/
|
||||
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
|
||||
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
|
||||
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
|
||||
#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails
|
||||
#define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options
|
||||
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
|
||||
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
|
||||
#define CONFIG_HELP (1<<20) // print help message
|
||||
#define CONFIG_ABORT (1<<21) // config failed,abort execution
|
||||
@@ -58,10 +61,10 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
|
||||
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
|
||||
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
|
||||
typedef void(*configmodule_endfunc_t)(void);
|
||||
typedef struct configmodule_interface
|
||||
{
|
||||
typedef struct configmodule_interface {
|
||||
int argc;
|
||||
char **argv;
|
||||
uint32_t *argv_info;
|
||||
char *cfgmode;
|
||||
int num_cfgP;
|
||||
char *cfgP[CONFIG_MAX_OOPT_PARAMS];
|
||||
@@ -71,7 +74,7 @@ typedef struct configmodule_interface
|
||||
configmodule_endfunc_t end;
|
||||
uint32_t numptrs;
|
||||
uint32_t rtflags;
|
||||
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
|
||||
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
|
||||
} configmodule_interface_t;
|
||||
|
||||
#ifdef CONFIG_LOADCONFIG_MAIN
|
||||
@@ -81,17 +84,17 @@ static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugfl
|
||||
debugflags can also be defined in the config_libconfig section of the config file\n \
|
||||
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
|
||||
4->print command line processing debug messages\n ";
|
||||
|
||||
|
||||
#define CONFIG_SECTIONNAME "config"
|
||||
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
|
||||
|
||||
|
||||
static paramdef_t Config_Params[] = {
|
||||
/*-----------------------------------------------------------------------------------------------------------------------*/
|
||||
/* config parameters for config module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------*/
|
||||
{"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
|
||||
/*-----------------------------------------------------------------------------------------------------------------------*/
|
||||
/* config parameters for config module */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------*/
|
||||
{"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
|
||||
};
|
||||
|
||||
#else
|
||||
@@ -100,10 +103,11 @@ extern configmodule_interface_t *cfgptr;
|
||||
|
||||
|
||||
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
|
||||
|
||||
extern configmodule_interface_t *load_configmodule(int argc, char **argv);
|
||||
|
||||
#define CONFIG_ENABLECMDLINEONLY (1<<1)
|
||||
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
|
||||
extern void end_configmodule(void);
|
||||
|
||||
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
#define MAX_OPTNAME_SIZE 64
|
||||
|
||||
#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[<index>].prefix2.optname */
|
||||
|
||||
|
||||
/* parameter flags definitions */
|
||||
@@ -55,83 +55,81 @@
|
||||
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
|
||||
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
|
||||
|
||||
|
||||
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
|
||||
#define CONFIG_MAX_NUMCHECKVAL 20
|
||||
typedef struct paramdef paramdef_t;
|
||||
typedef union checkedparam {
|
||||
struct {
|
||||
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1;
|
||||
struct {
|
||||
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1a;
|
||||
struct {
|
||||
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
|
||||
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
|
||||
|
||||
} s2;
|
||||
struct {
|
||||
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3;
|
||||
struct {
|
||||
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3a;
|
||||
struct {
|
||||
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
|
||||
|
||||
} s4;
|
||||
struct {
|
||||
void (*checkfunc)(void) ;
|
||||
} s5;
|
||||
struct {
|
||||
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1;
|
||||
struct {
|
||||
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okintval; /* number of valid values in the checkingval array */
|
||||
} s1a;
|
||||
struct {
|
||||
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
|
||||
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
|
||||
|
||||
} s2;
|
||||
struct {
|
||||
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3;
|
||||
struct {
|
||||
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
|
||||
/* to the corresponding item in setintval array (mainly for RRC params) */
|
||||
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
|
||||
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
|
||||
int num_okstrval; /* number of valid values in the checkingval array */
|
||||
} s3a;
|
||||
struct {
|
||||
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
|
||||
|
||||
} s4;
|
||||
struct {
|
||||
void (*checkfunc)(void) ;
|
||||
} s5;
|
||||
} checkedparam_t;
|
||||
|
||||
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
|
||||
/* config apis used to retrieve parameters values */
|
||||
typedef struct paramdef
|
||||
{
|
||||
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
|
||||
char *helpstr; /* help string */
|
||||
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
|
||||
union { /* pointer to the parameter value, completed by the config module */
|
||||
char **strptr;
|
||||
char **strlistptr;
|
||||
uint8_t *u8ptr;
|
||||
int8_t *i8ptr;
|
||||
uint16_t *u16ptr;
|
||||
int16_t *i16ptr;
|
||||
uint32_t *uptr;
|
||||
int32_t *iptr;
|
||||
uint64_t *u64ptr;
|
||||
int64_t *i64ptr;
|
||||
double *dblptr;
|
||||
void *voidptr;
|
||||
} ;
|
||||
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
|
||||
char *defstrval;
|
||||
char **defstrlistval;
|
||||
uint32_t defuintval;
|
||||
int defintval;
|
||||
uint64_t defint64val;
|
||||
int *defintarrayval;
|
||||
double defdblval;
|
||||
} ;
|
||||
char type; /* parameter value type, as listed below as TYPE_XXXX macro */
|
||||
int numelt; /* number of elements in a list or array parameters or max size of string value */
|
||||
checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
|
||||
int *processedvalue; /* used to store integer values computed from string original value */
|
||||
typedef struct paramdef {
|
||||
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
|
||||
char *helpstr; /* help string */
|
||||
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
|
||||
union { /* pointer to the parameter value, completed by the config module */
|
||||
char **strptr;
|
||||
char **strlistptr;
|
||||
uint8_t *u8ptr;
|
||||
int8_t *i8ptr;
|
||||
uint16_t *u16ptr;
|
||||
int16_t *i16ptr;
|
||||
uint32_t *uptr;
|
||||
int32_t *iptr;
|
||||
uint64_t *u64ptr;
|
||||
int64_t *i64ptr;
|
||||
double *dblptr;
|
||||
void *voidptr;
|
||||
} ;
|
||||
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
|
||||
char *defstrval;
|
||||
char **defstrlistval;
|
||||
uint32_t defuintval;
|
||||
int defintval;
|
||||
uint64_t defint64val;
|
||||
int *defintarrayval;
|
||||
double defdblval;
|
||||
} ;
|
||||
char type; /* parameter value type, as listed below as TYPE_XXXX macro */
|
||||
int numelt; /* number of elements in a list or array parameters or max size of string value */
|
||||
checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
|
||||
int *processedvalue; /* used to store integer values computed from string original value */
|
||||
} paramdef_t;
|
||||
|
||||
#define TYPE_INT TYPE_INT32
|
||||
@@ -161,9 +159,9 @@ typedef struct paramdef
|
||||
#define ANY_IPV4ADDR_STRING "0.0.0.0"
|
||||
|
||||
typedef struct paramlist_def {
|
||||
char listname[MAX_OPTNAME_SIZE];
|
||||
paramdef_t **paramarray;
|
||||
int numelt ;
|
||||
char listname[MAX_OPTNAME_SIZE];
|
||||
paramdef_t **paramarray;
|
||||
int numelt ;
|
||||
} paramlist_def_t;
|
||||
|
||||
/* macro helpers for module users */
|
||||
|
||||
@@ -44,409 +44,449 @@
|
||||
#include "config_userapi.h"
|
||||
|
||||
|
||||
configmodule_interface_t *config_get_if(void)
|
||||
{
|
||||
if (cfgptr == NULL) {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
return cfgptr;
|
||||
}
|
||||
|
||||
char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
|
||||
{
|
||||
if (ptr == NULL ) {
|
||||
ptr = malloc(sizeof(char *));
|
||||
if (ptr != NULL) {
|
||||
*ptr=NULL;
|
||||
cfgoptions->strptr=ptr;
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
|
||||
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
|
||||
if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */
|
||||
if (*ptr != NULL) {
|
||||
return *ptr;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
|
||||
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr == NULL) {
|
||||
*ptr = malloc(length);
|
||||
if ( *ptr != NULL) {
|
||||
memset(*ptr,0,length);
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val)
|
||||
{
|
||||
int tmpval=val;
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
|
||||
tmpval =1;
|
||||
configmodule_interface_t *config_get_if(void) {
|
||||
if (cfgptr == NULL) {
|
||||
fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
return cfgptr;
|
||||
}
|
||||
|
||||
char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
||||
if (ptr == NULL ) {
|
||||
ptr = malloc(sizeof(char *));
|
||||
|
||||
if (ptr != NULL) {
|
||||
*ptr=NULL;
|
||||
cfgoptions->strptr=ptr;
|
||||
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
|
||||
__FILE__, __LINE__, cfgoptions->optname, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length);
|
||||
|
||||
if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */
|
||||
if (*ptr != NULL) {
|
||||
return *ptr;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
|
||||
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (*ptr == NULL) {
|
||||
*ptr = malloc(length);
|
||||
|
||||
if ( *ptr != NULL) {
|
||||
memset(*ptr,0,length);
|
||||
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
|
||||
int tmpval=val;
|
||||
|
||||
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
|
||||
tmpval =1;
|
||||
}
|
||||
|
||||
switch (cfgoptions->type) {
|
||||
case TYPE_UINT8:
|
||||
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
|
||||
break;
|
||||
case TYPE_INT8:
|
||||
*(cfgoptions->i8ptr) = (int8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
|
||||
break;
|
||||
case TYPE_UINT16:
|
||||
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
|
||||
break;
|
||||
case TYPE_INT16:
|
||||
*(cfgoptions->i16ptr) = (int16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
|
||||
break;
|
||||
case TYPE_UINT32:
|
||||
*(cfgoptions->uptr) = (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
case TYPE_MASK:
|
||||
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
case TYPE_INT32:
|
||||
*(cfgoptions->iptr) = (int32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
|
||||
break;
|
||||
case TYPE_UINT8:
|
||||
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT8:
|
||||
*(cfgoptions->i8ptr) = (int8_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT16:
|
||||
*(cfgoptions->i16ptr) = (int16_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_UINT32:
|
||||
*(cfgoptions->uptr) = (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_MASK:
|
||||
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
|
||||
break;
|
||||
|
||||
case TYPE_INT32:
|
||||
*(cfgoptions->iptr) = (int32_t)tmpval;
|
||||
printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void config_assign_processedint(paramdef_t *cfgoption, int val) {
|
||||
cfgoption->processedvalue = malloc(sizeof(int));
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
*(cfgoption->processedvalue) = val;
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
cfgoption->processedvalue = malloc(sizeof(int));
|
||||
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
*(cfgoption->processedvalue) = val;
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int config_get_processedint(paramdef_t *cfgoption) {
|
||||
int ret;
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
ret=*(cfgoption->processedvalue);
|
||||
free( cfgoption->processedvalue);
|
||||
cfgoption->processedvalue=NULL;
|
||||
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
|
||||
ret=0;
|
||||
}
|
||||
return ret;
|
||||
int ret;
|
||||
|
||||
if ( cfgoption->processedvalue != NULL) {
|
||||
ret=*(cfgoption->processedvalue);
|
||||
free( cfgoption->processedvalue);
|
||||
cfgoption->processedvalue=NULL;
|
||||
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
|
||||
} else {
|
||||
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
|
||||
ret=0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
void config_printhelp(paramdef_t *params,int numparams)
|
||||
{
|
||||
for (int i=0 ; i<numparams ; i++) {
|
||||
if ( params[i].helpstr != NULL) {
|
||||
printf("%s%s: %s",
|
||||
(strlen(params[i].optname) <= 1) ? "-" : "--",
|
||||
params[i].optname,
|
||||
params[i].helpstr);
|
||||
}
|
||||
}
|
||||
void config_printhelp(paramdef_t *params,int numparams) {
|
||||
for (int i=0 ; i<numparams ; i++) {
|
||||
if ( params[i].helpstr != NULL) {
|
||||
printf("%s%s: %s",
|
||||
(strlen(params[i].optname) <= 1) ? "-" : "--",
|
||||
params[i].optname,
|
||||
params[i].helpstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int config_execcheck(paramdef_t *params,int numparams, char *prefix)
|
||||
{
|
||||
int st=0;
|
||||
int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
|
||||
int st=0;
|
||||
|
||||
for (int i=0 ; i<numparams ; i++) {
|
||||
if ( params[i].chkPptr == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (params[i].chkPptr->s4.f4 != NULL) {
|
||||
st += params[i].chkPptr->s4.f4(&(params[i]));
|
||||
}
|
||||
}
|
||||
if (st != 0) {
|
||||
fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
|
||||
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
|
||||
exit_fun("exit because configuration failed\n");
|
||||
}
|
||||
}
|
||||
return st;
|
||||
for (int i=0 ; i<numparams ; i++) {
|
||||
if ( params[i].chkPptr == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (params[i].chkPptr->s4.f4 != NULL) {
|
||||
st += params[i].chkPptr->s4.f4(&(params[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (st != 0) {
|
||||
fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
|
||||
|
||||
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
|
||||
exit_fun("exit because configuration failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
int config_get(paramdef_t *params,int numparams, char *prefix)
|
||||
{
|
||||
int ret= -1;
|
||||
int config_get(paramdef_t *params,int numparams, char *prefix) {
|
||||
int ret= -1;
|
||||
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix);
|
||||
return ret;
|
||||
}
|
||||
configmodule_interface_t *cfgif = config_get_if();
|
||||
if (cfgif != NULL) {
|
||||
ret = config_get_if()->get(params, numparams,prefix);
|
||||
if (ret >= 0) {
|
||||
config_process_cmdline(params,numparams,prefix);
|
||||
config_execcheck(params,numparams,prefix);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
|
||||
configmodule_interface_t *cfgif = config_get_if();
|
||||
|
||||
if (cfgif != NULL) {
|
||||
ret = config_get_if()->get(params, numparams,prefix);
|
||||
|
||||
if (ret >= 0) {
|
||||
config_process_cmdline(params,numparams,prefix);
|
||||
config_execcheck(params,numparams,prefix);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
|
||||
{
|
||||
int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) {
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!config_get_if())
|
||||
return -1;
|
||||
|
||||
const int ret = config_get_if()->getlist(ParamList, params, numparams, prefix);
|
||||
|
||||
if (ret >= 0 && params) {
|
||||
char *newprefix;
|
||||
|
||||
if (prefix) {
|
||||
int rc = asprintf(&newprefix, "%s.%s", prefix, ParamList->listname);
|
||||
|
||||
if (rc < 0) newprefix = NULL;
|
||||
} else {
|
||||
newprefix = ParamList->listname;
|
||||
}
|
||||
|
||||
char cfgpath[MAX_OPTNAME_SIZE*2 + 6]; /* prefix.listname.[listindex] */
|
||||
|
||||
for (int i = 0; i < ParamList->numelt; ++i) {
|
||||
// TODO config_process_cmdline?
|
||||
sprintf(cfgpath, "%s.[%i]", newprefix, i);
|
||||
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
free(newprefix);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int config_isparamset(paramdef_t *params,int paramidx)
|
||||
{
|
||||
int config_isparamset(paramdef_t *params,int paramidx) {
|
||||
if ((params[paramidx].paramflags & PARAMFLAG_PARAMSET) != 0) {
|
||||
return 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) {
|
||||
fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
|
||||
fname,param->optname, (int)*(param->uptr));
|
||||
for ( int i=0; i<numokval ; i++) {
|
||||
fprintf(stderr, " %i",okval[i]);
|
||||
}
|
||||
fprintf(stderr, " \n");
|
||||
}
|
||||
|
||||
int config_check_intval(paramdef_t *param)
|
||||
{
|
||||
if ( param == NULL ){
|
||||
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
|
||||
return -1;
|
||||
}
|
||||
for ( int i=0; i<param->chkPptr->s1.num_okintval ; i++) {
|
||||
if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
|
||||
return -1;
|
||||
fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
|
||||
fname,param->optname, (int)*(param->uptr));
|
||||
|
||||
for ( int i=0; i<numokval ; i++) {
|
||||
fprintf(stderr, " %i",okval[i]);
|
||||
}
|
||||
|
||||
fprintf(stderr, " \n");
|
||||
}
|
||||
|
||||
int config_check_modify_integer(paramdef_t *param)
|
||||
{
|
||||
|
||||
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
|
||||
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
|
||||
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
|
||||
*(param->uptr) = param->chkPptr->s1a.setintval [i];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
|
||||
int config_check_intval(paramdef_t *param) {
|
||||
if ( param == NULL ) {
|
||||
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for ( int i=0; i<param->chkPptr->s1.num_okintval ; i++) {
|
||||
if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_check_intrange(paramdef_t *param)
|
||||
{
|
||||
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
|
||||
param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
|
||||
return -1;
|
||||
int config_check_modify_integer(paramdef_t *param) {
|
||||
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
|
||||
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
|
||||
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
|
||||
*(param->uptr) = param->chkPptr->s1a.setintval [i];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_check_intrange(paramdef_t *param) {
|
||||
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
|
||||
param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
|
||||
fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
|
||||
fname,param->optname, *(param->strptr));
|
||||
for ( int i=0; i<numokval ; i++) {
|
||||
fprintf(stderr, " %s",okval[i]);
|
||||
}
|
||||
fprintf(stderr, " \n");
|
||||
fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
|
||||
fname,param->optname, *(param->strptr));
|
||||
|
||||
for ( int i=0; i<numokval ; i++) {
|
||||
fprintf(stderr, " %s",okval[i]);
|
||||
}
|
||||
|
||||
fprintf(stderr, " \n");
|
||||
}
|
||||
|
||||
int config_check_strval(paramdef_t *param)
|
||||
{
|
||||
if ( param == NULL ){
|
||||
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
|
||||
return -1;
|
||||
}
|
||||
for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
|
||||
if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
|
||||
|
||||
int config_check_strval(paramdef_t *param) {
|
||||
if ( param == NULL ) {
|
||||
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
|
||||
if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_checkstr_assign_integer(paramdef_t *param)
|
||||
{
|
||||
int config_checkstr_assign_integer(paramdef_t *param) {
|
||||
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
|
||||
if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
|
||||
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
|
||||
if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
|
||||
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
|
||||
|
||||
return -1;
|
||||
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defstrval != NULL) {
|
||||
status=1;
|
||||
status=1;
|
||||
|
||||
if (cfgoptions->numelt == 0 ) {
|
||||
config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
|
||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1);
|
||||
sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr));
|
||||
} else {
|
||||
sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr));
|
||||
}
|
||||
if (cfgoptions->numelt == 0 ) {
|
||||
config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
|
||||
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1);
|
||||
sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr));
|
||||
} else {
|
||||
sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval);
|
||||
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr));
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defstrlistval != NULL) {
|
||||
cfgoptions->strlistptr=cfgoptions->defstrlistval;
|
||||
status=1;
|
||||
for(int j=0; j<cfgoptions->numelt; j++)
|
||||
printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
|
||||
cfgoptions->strlistptr=cfgoptions->defstrlistval;
|
||||
status=1;
|
||||
|
||||
for(int j=0; j<cfgoptions->numelt; j++)
|
||||
printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t));
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long));
|
||||
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defuintval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defuintval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int status = 0;
|
||||
int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
if( cfgoptions->defintarrayval != NULL) {
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t*));
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t *));
|
||||
cfgoptions->iptr=cfgoptions->defintarrayval;
|
||||
status=1;
|
||||
|
||||
for (int j=0; j<cfgoptions->numelt ; j++) {
|
||||
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
|
||||
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defdblval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr)
|
||||
{
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
|
||||
int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
|
||||
if (rst == 1 && *(cfgoptions->uptr) > 0) {
|
||||
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
|
||||
return 1;
|
||||
} else {
|
||||
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
|
||||
*cfgoptions->uptr=INADDR_ANY;
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
|
||||
return -1;
|
||||
}
|
||||
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
|
||||
*(cfgoptions->u64ptr)=cfgoptions->defdblval;
|
||||
status=1;
|
||||
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
|
||||
config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int));
|
||||
int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr );
|
||||
|
||||
if (rst == 1 && *(cfgoptions->uptr) > 0) {
|
||||
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
|
||||
return 1;
|
||||
} else {
|
||||
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
|
||||
printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
|
||||
*cfgoptions->uptr=INADDR_ANY;
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix)
|
||||
{
|
||||
int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) {
|
||||
int status = 0;
|
||||
|
||||
|
||||
if (cfgoptions->defstrval != NULL) {
|
||||
status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
|
||||
status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*! \file common/config/config_userapi.h
|
||||
* \brief: configuration module, include file to be used by the source code calling the
|
||||
* \brief: configuration module, include file to be used by the source code calling the
|
||||
* configuration module to access configuration parameters
|
||||
* \author Francois TABURET
|
||||
* \date 2017
|
||||
@@ -31,7 +31,7 @@
|
||||
* \warning
|
||||
*/
|
||||
#ifndef INCLUDE_CONFIG_USERAPI_H
|
||||
#define INCLUDE_CONFIG_USERAPI_H
|
||||
#define INCLUDE_CONFIG_USERAPI_H
|
||||
#include "config_load_configmodule.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -48,14 +48,16 @@ extern "C"
|
||||
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
|
||||
/* utility functions, to be used by configuration module and/or configuration libraries */
|
||||
extern configmodule_interface_t *config_get_if(void);
|
||||
extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
|
||||
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
|
||||
extern void config_printhelp(paramdef_t *,int numparams);
|
||||
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
|
||||
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
|
||||
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
|
||||
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
|
||||
|
||||
/* apis to get parameters, to be used by oai modules, at configuration time */
|
||||
/* apis to get/check parameters, to be used by oai modules, at configuration time */
|
||||
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
|
||||
extern int config_check_cmdlineopt(char *prefix);
|
||||
extern int config_get(paramdef_t *params,int numparams, char *prefix);
|
||||
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
|
||||
|
||||
|
||||
17
common/utils/DOC/loader.md
Normal file
17
common/utils/DOC/loader.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# OAI shared library loader
|
||||
|
||||
Shared libraries usage is modularization mechanism which provides the following advantages:
|
||||
1. Prevents including in the main executable code which is not used in a given configuration
|
||||
1. Provides flexibility, several implementation of a given functionality can be chosen at run-time, without any compilation step. For example you can build several devices (USRP, BladeFR, LimeSDR) and choose which one you want to use on the command line or via the configuration.
|
||||
1. Makes code evolution easier: as soon as the shared library interface is clearly defined, you can work on the functionality implemented in a shared library while regularly updating the other components of the code. You can decide to develop your own version of a functionality, decide to deliver it or not, letting the user decide wwhat version he wants to use.
|
||||
|
||||
The main drawback is a performance cost at init time, when loading libraries.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
* [runtime usage](loader/rtusage.md)
|
||||
* [developer usage](loader/devusage.md)
|
||||
* [module architecture](loader/arch.md)
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
7
common/utils/DOC/loader/arch.md
Normal file
7
common/utils/DOC/loader/arch.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# loader source files
|
||||
|
||||
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.
|
||||
|
||||
[loader home page](../loader.md)
|
||||
16
common/utils/DOC/loader/devusage.md
Normal file
16
common/utils/DOC/loader/devusage.md
Normal file
@@ -0,0 +1,16 @@
|
||||
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 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)
|
||||
* 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)
|
||||
20
common/utils/DOC/loader/devusage/api.md
Normal file
20
common/utils/DOC/loader/devusage/api.md
Normal file
@@ -0,0 +1,20 @@
|
||||
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.
|
||||
* 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.
|
||||
* 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
|
||||
|
||||
|
||||
```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.
|
||||
|
||||
[loader home page](../../loader.md)
|
||||
[loader developer home page](../devusage.md)
|
||||
56
common/utils/DOC/loader/devusage/loading.md
Normal file
56
common/utils/DOC/loader/devusage/loading.md
Normal file
@@ -0,0 +1,56 @@
|
||||
Implementing a shared library dynamic load using the oai loader is a two steps task:
|
||||
1. define the `loader_shlibfunc_t` array, describing the list of externally available functions implemented in the library. This is the interface of the module.
|
||||
1. Call the `load_module_shlib` function, passing it the previously defined array and the number of items in this array. The first argument to `load_module_shlib` is the name identifying the module, which is also used to format the corresponding library name, as described [here](loader/rtusage#shared-library-names)
|
||||
|
||||
After a successful `load__module_shlib` call, the function pointer of each `loader_shlibfunc_t` array item has been set and can be used to call the corresponding function.
|
||||
|
||||
Typical loader usage looks like:
|
||||
|
||||
```c
|
||||
/* shared library loader include file */
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
.............
|
||||
/*
|
||||
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";
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
ret=load_module_shlib("mymod",mymodule_fdesc, sizeof(mymodule_fdesc)/sizeof(loader_shlibfunc_t));
|
||||
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
|
||||
*/
|
||||
funcf2_t *f2;
|
||||
int ret;
|
||||
int intarg1;
|
||||
char *strarg;
|
||||
........................
|
||||
f2 = (funcf2_t)get_shlibmodule_fptr("mymodule", "mymodule_f2")
|
||||
if (f2 != NULL) {
|
||||
ret = f2(intarg1,strarg);
|
||||
}
|
||||
...............
|
||||
```
|
||||
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)
|
||||
10
common/utils/DOC/loader/devusage/struct.md
Normal file
10
common/utils/DOC/loader/devusage/struct.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# `loader_shlibfunc_t`structure
|
||||
It is defined in include file [ common/util/load_module_shlib.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h#L38). This structure is used to list the symbols that should be searched by the loader when calling the `load_module_shlib` function.
|
||||
|
||||
| Fields | Description | I/O |
|
||||
|:-----------|:------------------------------------------------------------------|----:|
|
||||
| `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)
|
||||
50
common/utils/DOC/loader/rtusage.md
Normal file
50
common/utils/DOC/loader/rtusage.md
Normal file
@@ -0,0 +1,50 @@
|
||||
## shared library names
|
||||
Shared library full names are built by the loader using the format:
|
||||
> < *path* >/lib< *module name* >< *module version* >.so
|
||||
|
||||
1. the < *module name* > is defined at development time, it comes from the `modname` argument of the `load_module_shlib` call.
|
||||
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.
|
||||
### Global loader parameters
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `shlibpath` | `string of char` | `""` | directory path used to look for shared libraries, may be superseded by the library specific `shlibpath`.|
|
||||
| `maxshlibs` | `integer` | 10 | Maximum number of shared libraries the loader can manage. |
|
||||
|
||||
### library specific loader parameters
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `shlibpath` | `string of char` | `""` | directory path used to look for this shared library.|
|
||||
| `shlibversion` | `string of char` | `""` | version to be used to load this shared library.|
|
||||
|
||||
### loader configuration examples
|
||||
|
||||
The following configuration file example just reproduce the default loader parameters:
|
||||
```c
|
||||
loader :
|
||||
{
|
||||
shlibpath = "./";
|
||||
maxshlibs = 10;
|
||||
liboai_device :
|
||||
{
|
||||
shlibpath = "./";
|
||||
shlibversion = "";
|
||||
}
|
||||
};
|
||||
```
|
||||
If you want to load a device called *liboai_device_USRP.so* without writting a specific configuration, you can start the softmodem using the following command:
|
||||
> ./lte-softmodem -O libconfig:/usr/local/oai/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf:dbgl5 --loader.oai_device.shlibversion _USRP
|
||||
|
||||
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.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
|
||||
[CONFIG] loader.oai_device 1 options set from command line
|
||||
|
||||
```
|
||||
|
||||
[loader home page](../loader.md)
|
||||
110
common/utils/LOG/DOC/addconsoletrace.md
Normal file
110
common/utils/LOG/DOC/addconsoletrace.md
Normal file
@@ -0,0 +1,110 @@
|
||||
### Adding console traces in oai code
|
||||
#### console messages macros
|
||||
```C
|
||||
LOG_E(<component>,<format>,<argument>,...)
|
||||
LOG_W(<component>,<format>,<argument>,...)
|
||||
LOG_I(<component>,<format>,<argument>,...)
|
||||
LOG_D(<component>,<format>,<argument>,...)
|
||||
LOG_T(<component>,<format>,<argument>,...)
|
||||
)
|
||||
```
|
||||
these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code.
|
||||
|
||||
| macro | level letter | level value | level name |
|
||||
|:---------|:---------------|:---------------|----------------:|
|
||||
| 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 |
|
||||
|
||||
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).
|
||||
|
||||
Most oai sources are including LOG macros.
|
||||
|
||||
#### conditional code macros
|
||||
|
||||
```C
|
||||
LOG_DEBUGFLAG(<flag>)
|
||||
```
|
||||
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(<flag>) {
|
||||
/*
|
||||
the code below is only executed if the corresponding
|
||||
<flag>_debug option is set.
|
||||
*/
|
||||
......................
|
||||
......................
|
||||
}
|
||||
```
|
||||
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
|
||||
|
||||
#### memory dump macros
|
||||
```C
|
||||
LOG_DUMPFLAG(<flag>)
|
||||
```
|
||||
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(<flag>) {
|
||||
/*
|
||||
the code below is only executed if the corresponding
|
||||
<flag>_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)
|
||||
#### matlab format dump
|
||||
```C
|
||||
LOG_M(file, vector, data, len, dec, format)
|
||||
```
|
||||
|argument| type| description |
|
||||
|:-----------|:-------|-----------------:|
|
||||
| file | char* |path to the fle which will contain the dump |
|
||||
|vector |char * |name of the dump, printed at the top of the dump file |
|
||||
|data| void *| pointer to the memory to be dumpped |
|
||||
|len | int | length of the data to be dumpped, in `dec` unit|
|
||||
| dec| int | length of each data item.Interpretation depends on 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)
|
||||
|
||||
#### 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)
|
||||
|
||||
|argument| type| description |
|
||||
|:-----------|:-------|-----------------:|
|
||||
| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments |
|
||||
|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) |
|
||||
|b| void *| pointer to the memory to be dumpped |
|
||||
|s | int | length of the data to be dumpped in char|
|
||||
| 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)
|
||||
|
||||
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...)
|
||||
```
|
||||
|argument| type| description |
|
||||
|:-----------|:-------|-----------------:|
|
||||
| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments |
|
||||
|b| void *| pointer to the memory to be dumpped |
|
||||
|s | int | length of the data to be dumpped in char|
|
||||
|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)
|
||||
|
||||
[logging facility developer main page](devusage.md)
|
||||
[logging facility main page](log.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
12
common/utils/LOG/DOC/arch.md
Normal file
12
common/utils/LOG/DOC/arch.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# logging facility source files
|
||||
|
||||
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.
|
||||
|
||||
The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_<X>` 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)
|
||||
49
common/utils/LOG/DOC/configurelog.md
Normal file
49
common/utils/LOG/DOC/configurelog.md
Normal file
@@ -0,0 +1,49 @@
|
||||
### Initializing and configuring the logging facility
|
||||
|
||||
#### logging facility APIs
|
||||
```C
|
||||
int logInit (void);
|
||||
```
|
||||
Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
|
||||
|
||||
```C
|
||||
void logClean (void)
|
||||
```
|
||||
Reset console attributes (color settings) and possibly close opened log files. Logging facility is still usable after this call, the internal data are not freed.
|
||||
|
||||
```C
|
||||
int set_log(int component, int level)
|
||||
void set_glog(int level)
|
||||
```
|
||||
Set a component or all components logiing level. Messages which level is lower than this level are not printed to the console.
|
||||
|
||||
```C
|
||||
void set_glog_onlinelog(int enable)
|
||||
```
|
||||
Enable or disable all logging messages. Even error level messages are discarded, which is not advised. This can be usefull to temporarily workaround high rate of logging messages.
|
||||
|
||||
```C
|
||||
void set_component_filelog(int comp)
|
||||
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)
|
||||
CLEAR_LOG_DEBUG(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.
|
||||
|
||||
Example of using the logging utility APIs can be found, for initialization and cleanup, in [lte-softmodem.c](../../../../targets/RT/USER/lte-softmodem.c) and in the [telnet server log command implementation](../../telnetsrv/telnetsrv_proccmd.c) for a complete access to the logging facility features.
|
||||
|
||||
#### 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).
|
||||
|
||||
[logging facility developer main page](devusage.md)
|
||||
[logging facility main page](log.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
14
common/utils/LOG/DOC/devusage.md
Normal file
14
common/utils/LOG/DOC/devusage.md
Normal file
@@ -0,0 +1,14 @@
|
||||
### logging facility developer usage
|
||||
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.
|
||||
|
||||
[Adding console traces in oaicode](addconsoletrace.md)
|
||||
|
||||
[Configuring the logging facility](configurelog.md)
|
||||
|
||||
|
||||
[logging facility main page](log.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
19
common/utils/LOG/DOC/log.md
Normal file
19
common/utils/LOG/DOC/log.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# 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.
|
||||
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:
|
||||
|
||||
```bash
|
||||
/build_oai --disable-T-Tracer
|
||||
```
|
||||
- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer.
|
||||
|
||||
## Documentation
|
||||
|
||||
* [runtime usage](rtusage.md)
|
||||
* [developer usage](devusage.md)
|
||||
* [module architecture](arch.md)
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
265
common/utils/LOG/DOC/rtusage.md
Normal file
265
common/utils/LOG/DOC/rtusage.md
Normal file
@@ -0,0 +1,265 @@
|
||||
## 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
|
||||
|
||||
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.
|
||||
|
||||
### global parameters
|
||||
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`info`,`debug`,`trace` |
|
||||
| `global_log_online` | `boolean` | 1 (=true) | If false, all console messages are discarded, whatever their level |
|
||||
| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header|
|
||||
|
||||
### Component specific parameters
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `<component>_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
|
||||
| `<component>_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/<componemt>.[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:
|
||||
|
||||
```bash
|
||||
./lte-softmodem -O libconfig:<path to config file>:dbgl5
|
||||
|
||||
[LIBCONFIG] log_config.global_log_level: "info"
|
||||
[CONFIG] global_log_online: 1
|
||||
[CONFIG] log_config.global_log_online set to default value
|
||||
[LIBCONFIG] log_config: 3/3 parameters successfully set, (1 to default value)
|
||||
[LIBCONFIG] global_log_options[0]: nocolor
|
||||
[LIBCONFIG] global_log_options[1]: level
|
||||
[LIBCONFIG] global_log_options[2]: thread
|
||||
[CONFIG] log_config 1 options set from command line
|
||||
[LIBCONFIG] log_config.phy_log_level: "info"
|
||||
[LIBCONFIG] log_config.mac_log_level: "info"
|
||||
[CONFIG] log_config.sim_log_level set to default value "info"
|
||||
[CONFIG] log_config.ocg_log_level set to default value "info"
|
||||
[CONFIG] log_config.omg_log_level set to default value "info"
|
||||
[CONFIG] log_config.opt_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_latency_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_latency_bg_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_gp_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_gp_bg_log_level set to default value "info"
|
||||
[CONFIG] log_config.otg_jitter_log_level set to default value "info"
|
||||
[LIBCONFIG] log_config.rlc_log_level: "info"
|
||||
[LIBCONFIG] log_config.pdcp_log_level: "info"
|
||||
[LIBCONFIG] log_config.rrc_log_level: "info"
|
||||
[CONFIG] log_config.nas_log_level set to default value "info"
|
||||
[CONFIG] log_config.perf_log_level set to default value "info"
|
||||
[CONFIG] log_config.oip_log_level set to default value "info"
|
||||
[CONFIG] log_config.cli_log_level set to default value "info"
|
||||
[CONFIG] log_config.msc_log_level set to default value "info"
|
||||
[CONFIG] log_config.ocm_log_level set to default value "info"
|
||||
[CONFIG] log_config.udp_log_level set to default value "info"
|
||||
[CONFIG] log_config.gtpv1u_log_level set to default value "info"
|
||||
[CONFIG] log_config.comp23?_log_level set to default value "info"
|
||||
[CONFIG] log_config.s1ap_log_level set to default value "info"
|
||||
[CONFIG] log_config.sctp_log_level set to default value "info"
|
||||
[LIBCONFIG] log_config.hw_log_level: "info"
|
||||
[CONFIG] log_config.osa_log_level set to default value "info"
|
||||
[CONFIG] log_config.eral_log_level set to default value "info"
|
||||
[CONFIG] log_config.mral_log_level set to default value "info"
|
||||
[CONFIG] log_config.enb_app_log_level set to default value "info"
|
||||
[CONFIG] log_config.flexran_agent_log_level set to default value "info"
|
||||
[CONFIG] log_config.tmr_log_level set to default value "info"
|
||||
[CONFIG] log_config.usim_log_level set to default value "info"
|
||||
[CONFIG] log_config.localize_log_level set to default value "info"
|
||||
[CONFIG] log_config.x2ap_log_level set to default value "info"
|
||||
[CONFIG] log_config.loader_log_level set to default value "info"
|
||||
[CONFIG] log_config.asn_log_level set to default value "info"
|
||||
[LIBCONFIG] log_config: 38/38 parameters successfully set, (32 to default value)
|
||||
[CONFIG] log_config 0 options set from command line
|
||||
[CONFIG] phy_log_infile: 0
|
||||
[CONFIG] log_config.phy_log_infile set to default value
|
||||
[CONFIG] mac_log_infile: 0
|
||||
[CONFIG] log_config.mac_log_infile set to default value
|
||||
[CONFIG] sim_log_infile: 0
|
||||
[CONFIG] log_config.sim_log_infile set to default value
|
||||
[CONFIG] ocg_log_infile: 0
|
||||
[CONFIG] log_config.ocg_log_infile set to default value
|
||||
[CONFIG] omg_log_infile: 0
|
||||
[CONFIG] log_config.omg_log_infile set to default value
|
||||
[CONFIG] opt_log_infile: 0
|
||||
[CONFIG] log_config.opt_log_infile set to default value
|
||||
[CONFIG] otg_log_infile: 0
|
||||
[CONFIG] log_config.otg_log_infile set to default value
|
||||
[CONFIG] otg_latency_log_infile: 0
|
||||
[CONFIG] log_config.otg_latency_log_infile set to default value
|
||||
[CONFIG] otg_latency_bg_log_infile: 0
|
||||
[CONFIG] log_config.otg_latency_bg_log_infile set to default value
|
||||
[CONFIG] otg_gp_log_infile: 0
|
||||
[CONFIG] log_config.otg_gp_log_infile set to default value
|
||||
[CONFIG] otg_gp_bg_log_infile: 0
|
||||
[CONFIG] log_config.otg_gp_bg_log_infile set to default value
|
||||
[CONFIG] otg_jitter_log_infile: 0
|
||||
[CONFIG] log_config.otg_jitter_log_infile set to default value
|
||||
[CONFIG] rlc_log_infile: 0
|
||||
[CONFIG] log_config.rlc_log_infile set to default value
|
||||
[CONFIG] pdcp_log_infile: 0
|
||||
[CONFIG] log_config.pdcp_log_infile set to default value
|
||||
[CONFIG] rrc_log_infile: 0
|
||||
[CONFIG] log_config.rrc_log_infile set to default value
|
||||
[CONFIG] nas_log_infile: 0
|
||||
[CONFIG] log_config.nas_log_infile set to default value
|
||||
[CONFIG] perf_log_infile: 0
|
||||
[CONFIG] log_config.perf_log_infile set to default value
|
||||
[CONFIG] oip_log_infile: 0
|
||||
[CONFIG] log_config.oip_log_infile set to default value
|
||||
[CONFIG] cli_log_infile: 0
|
||||
[CONFIG] log_config.cli_log_infile set to default value
|
||||
[CONFIG] msc_log_infile: 0
|
||||
[CONFIG] log_config.msc_log_infile set to default value
|
||||
[CONFIG] ocm_log_infile: 0
|
||||
[CONFIG] log_config.ocm_log_infile set to default value
|
||||
[CONFIG] udp_log_infile: 0
|
||||
[CONFIG] log_config.udp_log_infile set to default value
|
||||
[CONFIG] gtpv1u_log_infile: 0
|
||||
[CONFIG] log_config.gtpv1u_log_infile set to default value
|
||||
[CONFIG] comp23?_log_infile: 0
|
||||
[CONFIG] log_config.comp23?_log_infile set to default value
|
||||
[CONFIG] s1ap_log_infile: 0
|
||||
[CONFIG] log_config.s1ap_log_infile set to default value
|
||||
[CONFIG] sctp_log_infile: 0
|
||||
[CONFIG] log_config.sctp_log_infile set to default value
|
||||
[CONFIG] hw_log_infile: 0
|
||||
[CONFIG] log_config.hw_log_infile set to default value
|
||||
[CONFIG] osa_log_infile: 0
|
||||
[CONFIG] log_config.osa_log_infile set to default value
|
||||
[CONFIG] eral_log_infile: 0
|
||||
[CONFIG] log_config.eral_log_infile set to default value
|
||||
[CONFIG] mral_log_infile: 0
|
||||
[CONFIG] log_config.mral_log_infile set to default value
|
||||
[CONFIG] enb_app_log_infile: 0
|
||||
[CONFIG] log_config.enb_app_log_infile set to default value
|
||||
[CONFIG] flexran_agent_log_infile: 0
|
||||
[CONFIG] log_config.flexran_agent_log_infile set to default value
|
||||
[CONFIG] tmr_log_infile: 0
|
||||
[CONFIG] log_config.tmr_log_infile set to default value
|
||||
[CONFIG] usim_log_infile: 0
|
||||
[CONFIG] log_config.usim_log_infile set to default value
|
||||
[CONFIG] localize_log_infile: 0
|
||||
[CONFIG] log_config.localize_log_infile set to default value
|
||||
[CONFIG] x2ap_log_infile: 0
|
||||
[CONFIG] log_config.x2ap_log_infile set to default value
|
||||
[CONFIG] loader_log_infile: 0
|
||||
[CONFIG] log_config.loader_log_infile set to default value
|
||||
[CONFIG] asn_log_infile: 0
|
||||
[CONFIG] log_config.asn_log_infile set to default value
|
||||
[LIBCONFIG] log_config: 38/38 parameters successfully set, (38 to default value)
|
||||
[CONFIG] log_config 0 options set from command line
|
||||
[CONFIG] PRACH_debug: 0
|
||||
[CONFIG] log_config.PRACH_debug set to default value
|
||||
[CONFIG] RU_debug: 0
|
||||
[CONFIG] log_config.RU_debug set to default value
|
||||
[CONFIG] UE_PHYPROC_debug: 0
|
||||
[CONFIG] log_config.UE_PHYPROC_debug set to default value
|
||||
[CONFIG] LTEESTIM_debug: 0
|
||||
[CONFIG] log_config.LTEESTIM_debug set to default value
|
||||
[CONFIG] DLCELLSPEC_debug: 0
|
||||
[CONFIG] log_config.DLCELLSPEC_debug set to default value
|
||||
[CONFIG] ULSCH_debug: 0
|
||||
[CONFIG] log_config.ULSCH_debug set to default value
|
||||
[CONFIG] RRC_debug: 0
|
||||
[CONFIG] log_config.RRC_debug set to default value
|
||||
[CONFIG] PDCP_debug: 0
|
||||
[CONFIG] log_config.PDCP_debug set to default value
|
||||
[CONFIG] DFT_debug: 0
|
||||
[CONFIG] log_config.DFT_debug set to default value
|
||||
[CONFIG] ASN1_debug: 0
|
||||
[CONFIG] log_config.ASN1_debug set to default value
|
||||
[CONFIG] CTRLSOCKET_debug: 0
|
||||
[CONFIG] log_config.CTRLSOCKET_debug set to default value
|
||||
[CONFIG] SECURITY_debug: 0
|
||||
[CONFIG] log_config.SECURITY_debug set to default value
|
||||
[CONFIG] NAS_debug: 0
|
||||
[CONFIG] log_config.NAS_debug set to default value
|
||||
[CONFIG] RLC_debug: 0
|
||||
[CONFIG] log_config.RLC_debug set to default value
|
||||
[CONFIG] UE_TIMING_debug: 0
|
||||
[CONFIG] log_config.UE_TIMING_debug set to default value
|
||||
[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value)
|
||||
[CONFIG] log_config 0 options set from command line
|
||||
[CONFIG] PRACH_dump: 0
|
||||
[CONFIG] log_config.PRACH_dump set to default value
|
||||
[CONFIG] RU_dump: 0
|
||||
[CONFIG] log_config.RU_dump set to default value
|
||||
[CONFIG] UE_PHYPROC_dump: 0
|
||||
[CONFIG] log_config.UE_PHYPROC_dump set to default value
|
||||
[CONFIG] LTEESTIM_dump: 0
|
||||
[CONFIG] log_config.LTEESTIM_dump set to default value
|
||||
[CONFIG] DLCELLSPEC_dump: 0
|
||||
[CONFIG] log_config.DLCELLSPEC_dump set to default value
|
||||
[CONFIG] ULSCH_dump: 0
|
||||
[CONFIG] log_config.ULSCH_dump set to default value
|
||||
[CONFIG] RRC_dump: 0
|
||||
[CONFIG] log_config.RRC_dump set to default value
|
||||
[CONFIG] PDCP_dump: 0
|
||||
[CONFIG] log_config.PDCP_dump set to default value
|
||||
[CONFIG] DFT_dump: 0
|
||||
[CONFIG] log_config.DFT_dump set to default value
|
||||
[CONFIG] ASN1_dump: 0
|
||||
[CONFIG] log_config.ASN1_dump set to default value
|
||||
[CONFIG] CTRLSOCKET_dump: 0
|
||||
[CONFIG] log_config.CTRLSOCKET_dump set to default value
|
||||
[CONFIG] SECURITY_dump: 0
|
||||
[CONFIG] log_config.SECURITY_dump set to default value
|
||||
[CONFIG] NAS_dump: 0
|
||||
[CONFIG] log_config.NAS_dump set to default value
|
||||
[CONFIG] RLC_dump: 0
|
||||
[CONFIG] log_config.RLC_dump set to default value
|
||||
[CONFIG] UE_TIMING_dump: 0
|
||||
[CONFIG] log_config.UE_TIMING_dump set to default value
|
||||
[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value)
|
||||
[CONFIG] log_config 0 options set from command line
|
||||
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)
|
||||
|
||||
### parameters to activate conditional code
|
||||
| name | type | default | description |
|
||||
|:---:|:---:|:---:|:----|
|
||||
| `<flag>_debug` | `boolean` | 0 = false | Triggers the activation of conditional code identified by the specified flag.
|
||||
| `<flag>_dump` | `boolean` | 0 = false| Triggers buffer dump, on the console in text form or in a file in matlab format, depending on the developper choice and forcasted usage|
|
||||
|
||||
### Using the configuration file to configure the logging facility
|
||||
The following example sets all components log level to info, exept for hw,phy,mac,rlc,pdcp,rrc which log levels are set to error or warning.
|
||||
```bash
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
hw_log_level ="error";
|
||||
phy_log_level ="error";
|
||||
mac_log_level ="warn";
|
||||
rlc_log_level ="error"
|
||||
pdcp_log_level ="error";
|
||||
rrc_log_level ="error";
|
||||
};
|
||||
```
|
||||
### Using the command line to configure the logging facility
|
||||
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
|
||||
```
|
||||
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 RU 0 rf device ready
|
||||
[PHY]I ru thread RU 0 no asynch_south interface
|
||||
[MAC]E rxtx processing SCHED_MODE=0
|
||||
[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_I0 = 0.0 dB
|
||||
[PHY]I rxtx processing max_I0 21, min_I0 0
|
||||
[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)
|
||||
|
||||
[logging facility main page](log.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
@@ -39,13 +39,9 @@
|
||||
#include "vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
# include <pthread.h>
|
||||
# include <string.h>
|
||||
#include <linux/prctl.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <linux/prctl.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
// main log variables
|
||||
|
||||
@@ -75,16 +71,14 @@ char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL
|
||||
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
|
||||
|
||||
|
||||
int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format)
|
||||
{
|
||||
|
||||
int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format) {
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||
return -1;
|
||||
|
||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||
fp = fopen(fname,"a+");
|
||||
@@ -92,8 +86,6 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
|
||||
fp = fopen(fname,"w+");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (fp== NULL) {
|
||||
printf("[OPENAIR][FILE OUTPUT] Cannot open file %s\n",fname);
|
||||
return(-1);
|
||||
@@ -102,121 +94,108 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
|
||||
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
|
||||
switch (format) {
|
||||
case 0: // real 16-bit
|
||||
case 0: // real 16-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((short *)data)[i]);
|
||||
}
|
||||
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((short *)data)[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case 1: // complex 16-bit
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
|
||||
}
|
||||
|
||||
case 1: // complex 16-bit
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
break;
|
||||
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
|
||||
case 2: // real 32-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((int *)data)[i]);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // complex 32-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((int *)data)[i],((int *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2: // real 32-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((int *)data)[i]);
|
||||
}
|
||||
case 4: // real 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((char *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3: // complex 32-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((int *)data)[i],((int *)data)[i+1]);
|
||||
}
|
||||
case 5: // complex 8-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((char *)data)[i],((char *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 4: // real 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((char *)data)[i]);
|
||||
}
|
||||
case 6: // real 64-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%lld\n",((long long *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 5: // complex 8-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((char *)data)[i],((char *)data)[i+1]);
|
||||
}
|
||||
case 7: // real double
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%g\n",((double *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 6: // real 64-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%lld\n",((long long*)data)[i]);
|
||||
}
|
||||
case 8: // complex double
|
||||
for (i=0; i<length<<1; i+=2*dec) {
|
||||
fprintf(fp,"%g + j*(%g)\n",((double *)data)[i], ((double *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 7: // real double
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%g\n",((double *)data)[i]);
|
||||
}
|
||||
case 9: // real unsigned 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((unsigned char *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 8: // complex double
|
||||
for (i=0; i<length<<1; i+=2*dec) {
|
||||
fprintf(fp,"%g + j*(%g)\n",((double *)data)[i], ((double *)data)[i+1]);
|
||||
}
|
||||
case 10 : // case eren 16 bit complex :
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
if((i < 2*(length-1)) && (i > 0))
|
||||
fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 2*(length-1))
|
||||
fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 9: // real unsigned 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((unsigned char *)data)[i]);
|
||||
}
|
||||
case 11 : //case eren 16 bit real for channel magnitudes:
|
||||
for (i=0; i<length; i+=dec) {
|
||||
if((i <(length-1))&& (i > 0))
|
||||
fprintf(fp,"%d,",((short *)data)[i]);
|
||||
else if (i == (length-1))
|
||||
fprintf(fp,"%d;",((short *)data)[i]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d,",((short *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 10 : // case eren 16 bit complex :
|
||||
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
|
||||
if((i < 2*(length-1)) && (i > 0))
|
||||
fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 2*(length-1))
|
||||
fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 11 : //case eren 16 bit real for channel magnitudes:
|
||||
for (i=0; i<length; i+=dec) {
|
||||
|
||||
if((i <(length-1))&& (i > 0))
|
||||
fprintf(fp,"%d,",((short *)data)[i]);
|
||||
else if (i == (length-1))
|
||||
fprintf(fp,"%d;",((short *)data)[i]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d,",((short *)data)[i]);
|
||||
}
|
||||
|
||||
printf("\n eren: length :%d",length);
|
||||
break;
|
||||
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
printf("\n eren: length :%d",length);
|
||||
break;
|
||||
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||
@@ -235,131 +214,153 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
|
||||
void log_getconfig(log_t *g_log) {
|
||||
char *gloglevel = NULL;
|
||||
int consolelog ;
|
||||
|
||||
|
||||
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
|
||||
paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
|
||||
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
|
||||
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
|
||||
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
|
||||
|
||||
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
|
||||
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* set LOG display options (enable/disable color, thread name, level ) */
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* set LOG display options (enable/disable color, thread name, level ) */
|
||||
for(int i=0; i<logparams_defaults[LOG_OPTIONS_IDX].numelt ; i++) {
|
||||
for(int j=0; log_options[j].name != NULL ; j++) {
|
||||
if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) {
|
||||
g_log->flag = g_log->flag | log_options[j].value;
|
||||
break;
|
||||
} else if (log_options[j+1].name == NULL){
|
||||
fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build the parameter array for setting per component log level and infile options */
|
||||
for(int j=0; log_options[j].name != NULL ; j++) {
|
||||
if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) {
|
||||
g_log->flag = g_log->flag | log_options[j].value;
|
||||
break;
|
||||
} else if (log_options[j+1].name == NULL) {
|
||||
fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build the parameter array for setting per component log level and infile options */
|
||||
memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||
memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||
if(g_log->log_component[i].name == NULL) {
|
||||
g_log->log_component[i].name = malloc(16);
|
||||
sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
|
||||
logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
g_log->log_component[i].name = malloc(16);
|
||||
sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
|
||||
logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
}
|
||||
|
||||
sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name);
|
||||
sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name);
|
||||
/* workaround: all log options in existing configuration files use lower case component names
|
||||
where component names include uppercase char in log.h.... */
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
|
||||
/* */
|
||||
|
||||
/* workaround: all log options in existing configuration files use lower case component names
|
||||
where component names include uppercase char in log.h.... */
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
|
||||
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
|
||||
|
||||
/* */
|
||||
logparams_level[i].defstrval = gloglevel;
|
||||
logparams_logfile[i].defuintval = 0;
|
||||
logparams_logfile[i].numelt = 0;
|
||||
logparams_level[i].numelt = 0;
|
||||
logparams_level[i].type = TYPE_STRING;
|
||||
logparams_logfile[i].type = TYPE_UINT;
|
||||
|
||||
logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
|
||||
}
|
||||
/* read the per component parameters */
|
||||
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
/* now set the log levels and infile option, according to what we read */
|
||||
}
|
||||
|
||||
/* read the per component parameters */
|
||||
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
|
||||
/* now set the log levels and infile option, according to what we read */
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||
g_log->log_component[i].level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
|
||||
set_log(i, g_log->log_component[i].level);
|
||||
|
||||
if (*(logparams_logfile[i].uptr) == 1)
|
||||
set_component_filelog(i);
|
||||
set_component_filelog(i);
|
||||
}
|
||||
|
||||
/* build then read the debug and dump parameter array */
|
||||
for (int i=0;log_maskmap[i].name != NULL ; i++) {
|
||||
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
|
||||
sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name);
|
||||
logparams_debug[i].defuintval = 0;
|
||||
logparams_debug[i].type = TYPE_UINT;
|
||||
logparams_debug[i].paramflags = PARAMFLAG_BOOL;
|
||||
logparams_debug[i].uptr = NULL;
|
||||
logparams_debug[i].chkPptr = NULL;
|
||||
logparams_debug[i].numelt = 0;
|
||||
logparams_dump[i].defuintval = 0;
|
||||
logparams_dump[i].type = TYPE_UINT;
|
||||
logparams_dump[i].paramflags = PARAMFLAG_BOOL;
|
||||
logparams_dump[i].uptr = NULL;
|
||||
logparams_dump[i].chkPptr = NULL;
|
||||
logparams_dump[i].numelt = 0;
|
||||
/* build then read the debug and dump parameter array */
|
||||
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
||||
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
|
||||
sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name);
|
||||
logparams_debug[i].defuintval = 0;
|
||||
logparams_debug[i].type = TYPE_UINT;
|
||||
logparams_debug[i].paramflags = PARAMFLAG_BOOL;
|
||||
logparams_debug[i].uptr = NULL;
|
||||
logparams_debug[i].chkPptr = NULL;
|
||||
logparams_debug[i].numelt = 0;
|
||||
logparams_dump[i].defuintval = 0;
|
||||
logparams_dump[i].type = TYPE_UINT;
|
||||
logparams_dump[i].paramflags = PARAMFLAG_BOOL;
|
||||
logparams_dump[i].uptr = NULL;
|
||||
logparams_dump[i].chkPptr = NULL;
|
||||
logparams_dump[i].numelt = 0;
|
||||
}
|
||||
|
||||
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
|
||||
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||
/* set the debug mask according to the debug parameters values */
|
||||
|
||||
/* set the debug mask according to the debug parameters values */
|
||||
for (int i=0; log_maskmap[i].name != NULL ; i++) {
|
||||
if (*(logparams_debug[i].uptr) )
|
||||
g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
|
||||
g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
|
||||
|
||||
if (*(logparams_dump[i].uptr) )
|
||||
g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value;
|
||||
}
|
||||
/* log globally enabled/disabled */
|
||||
g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value;
|
||||
}
|
||||
|
||||
/* log globally enabled/disabled */
|
||||
set_glog_onlinelog(consolelog);
|
||||
}
|
||||
|
||||
int register_log_component(char *name, char *fext, int compidx)
|
||||
{
|
||||
int computed_compidx=compidx;
|
||||
int register_log_component(char *name, char *fext, int compidx) {
|
||||
int computed_compidx=compidx;
|
||||
|
||||
if (strlen(fext) > 3) {
|
||||
fext[3]=0; /* limit log file extension to 3 chars */
|
||||
fext[3]=0; /* limit log file extension to 3 chars */
|
||||
}
|
||||
|
||||
if (compidx < 0) { /* this is not a pre-defined component */
|
||||
for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) {
|
||||
if (g_log->log_component[i].name == NULL) {
|
||||
computed_compidx=i;
|
||||
break;
|
||||
}
|
||||
for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) {
|
||||
if (g_log->log_component[i].name == NULL) {
|
||||
computed_compidx=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
|
||||
g_log->log_component[computed_compidx].name = strdup(name);
|
||||
g_log->log_component[computed_compidx].stream = stdout;
|
||||
g_log->log_component[computed_compidx].filelog = 0;
|
||||
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s */
|
||||
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
|
||||
g_log->log_component[computed_compidx].name = strdup(name);
|
||||
g_log->log_component[computed_compidx].stream = stdout;
|
||||
g_log->log_component[computed_compidx].filelog = 0;
|
||||
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s */
|
||||
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
|
||||
} else {
|
||||
fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
|
||||
fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
|
||||
}
|
||||
return computed_compidx;
|
||||
|
||||
return computed_compidx;
|
||||
}
|
||||
|
||||
int logInit (void)
|
||||
{
|
||||
int isLogInitDone (void) {
|
||||
if (g_log == NULL)
|
||||
return 0;
|
||||
|
||||
if (!(g_log->flag & FLAG_INITIALIZED))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int logInit (void) {
|
||||
int i;
|
||||
g_log = calloc(1, sizeof(log_t));
|
||||
|
||||
@@ -367,10 +368,8 @@ int logInit (void)
|
||||
perror ("cannot allocated memory for log generation module \n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
memset(g_log,0,sizeof(log_t));
|
||||
|
||||
|
||||
|
||||
register_log_component("PHY","log",PHY);
|
||||
register_log_component("MAC","log",MAC);
|
||||
register_log_component("OPT","log",OPT);
|
||||
@@ -386,143 +385,121 @@ int logInit (void)
|
||||
register_log_component("OTG_JITTER","dat",OTG_JITTER);
|
||||
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);
|
||||
register_log_component("OSA","",OSA);
|
||||
register_log_component("eRAL","",RAL_ENB);
|
||||
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("TMR","",TMR);
|
||||
register_log_component("USIM","txt",USIM);
|
||||
register_log_component("SIM","txt",SIM);
|
||||
|
||||
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);
|
||||
register_log_component("OSA","",OSA);
|
||||
register_log_component("eRAL","",RAL_ENB);
|
||||
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("TMR","",TMR);
|
||||
register_log_component("USIM","txt",USIM);
|
||||
register_log_component("SIM","txt",SIM);
|
||||
/* 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("X2AP","",X2AP);
|
||||
|
||||
|
||||
register_log_component("SCTP","",SCTP);
|
||||
register_log_component("X2AP","",X2AP);
|
||||
register_log_component("LOADER","log",LOADER);
|
||||
register_log_component("ASN","log",ASN);
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
|
||||
|
||||
g_log->filelog_name = "/tmp/openair.log";
|
||||
|
||||
log_getconfig(g_log);
|
||||
|
||||
|
||||
|
||||
// set all unused component items to 0, they are for non predefined components
|
||||
for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
|
||||
memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
|
||||
}
|
||||
printf("log init done\n");
|
||||
|
||||
g_log->flag = g_log->flag | FLAG_INITIALIZED;
|
||||
printf("log init done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *log_getthreadname(char *threadname, int bufsize) {
|
||||
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
|
||||
|
||||
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
|
||||
if (rt == 0)
|
||||
{
|
||||
return threadname;
|
||||
} else {
|
||||
return "thread?";
|
||||
}
|
||||
if (rt == 0) {
|
||||
return threadname;
|
||||
} else {
|
||||
return "thread?";
|
||||
}
|
||||
}
|
||||
|
||||
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",
|
||||
log_level_highlight_end[level],
|
||||
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
|
||||
g_log->log_component[comp].name,
|
||||
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
|
||||
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
|
||||
format,
|
||||
log_level_highlight_end[level]);
|
||||
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,
|
||||
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
|
||||
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
|
||||
format,
|
||||
log_level_highlight_end[level]);
|
||||
}
|
||||
|
||||
void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char* format, ... )
|
||||
{
|
||||
void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, ... ) {
|
||||
char log_buffer[MAX_LOG_TOTAL];
|
||||
va_list args;
|
||||
|
||||
va_start(args, 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 log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... ) {
|
||||
va_list args;
|
||||
char *wbuf;
|
||||
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) {
|
||||
va_list args;
|
||||
char *wbuf;
|
||||
|
||||
switch(datatype) {
|
||||
case LOG_DUMP_DOUBLE:
|
||||
wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL);
|
||||
break;
|
||||
|
||||
switch(datatype) {
|
||||
case LOG_DUMP_DOUBLE:
|
||||
wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL);
|
||||
break;
|
||||
case LOG_DUMP_CHAR:
|
||||
default:
|
||||
wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL);
|
||||
break;
|
||||
case LOG_DUMP_CHAR:
|
||||
default:
|
||||
wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (wbuf != NULL) {
|
||||
va_start(args, format);
|
||||
int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,"");
|
||||
int pos2=vsprintf(wbuf+pos,format, args);
|
||||
pos=pos+pos2;
|
||||
va_end(args);
|
||||
|
||||
for (int i=0; i<buffsize; i++) {
|
||||
switch(datatype) {
|
||||
case LOG_DUMP_DOUBLE:
|
||||
pos = pos + sprintf(wbuf+pos,"%04.4lf ", (double)((double *)buffer)[i]);
|
||||
break;
|
||||
|
||||
case LOG_DUMP_CHAR:
|
||||
default:
|
||||
pos = pos + sprintf(wbuf+pos,"%02x ", (unsigned char)((unsigned char *)buffer)[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wbuf != NULL) {
|
||||
va_start(args, format);
|
||||
int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,"");
|
||||
int pos2=vsprintf(wbuf+pos,format, args);
|
||||
pos=pos+pos2;
|
||||
va_end(args);
|
||||
|
||||
for (int i=0; i<buffsize; i++) {
|
||||
switch(datatype) {
|
||||
case LOG_DUMP_DOUBLE:
|
||||
pos = pos + sprintf(wbuf+pos,"%04.4lf ", (double)((double *)buffer)[i]);
|
||||
break;
|
||||
case LOG_DUMP_CHAR:
|
||||
default:
|
||||
pos = pos + sprintf(wbuf+pos,"%02x ", (unsigned char)((unsigned char *)buffer)[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(wbuf+pos,"\n");
|
||||
g_log->log_component[component].print(g_log->log_component[component].stream,wbuf);
|
||||
free(wbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int set_log(int component, int level)
|
||||
{
|
||||
int set_log(int component, int level) {
|
||||
/* Checking parameters */
|
||||
DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
|
||||
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
|
||||
@@ -530,38 +507,34 @@ int set_log(int component, int level)
|
||||
OAILOG_ERR);
|
||||
|
||||
if ( g_log->log_component[component].level != OAILOG_DISABLE )
|
||||
g_log->log_component[component].savedlevel = g_log->log_component[component].level;
|
||||
g_log->log_component[component].level = level;
|
||||
g_log->log_component[component].savedlevel = g_log->log_component[component].level;
|
||||
|
||||
g_log->log_component[component].level = level;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void set_glog(int level)
|
||||
{
|
||||
void set_glog(int level) {
|
||||
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
|
||||
set_log(c, level);
|
||||
set_log(c, level);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void set_glog_onlinelog(int enable)
|
||||
{
|
||||
void set_glog_onlinelog(int enable) {
|
||||
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
|
||||
if ( enable ) {
|
||||
g_log->log_component[c].level = g_log->log_component[c].savedlevel;
|
||||
g_log->log_component[c].vprint = vfprintf;
|
||||
g_log->log_component[c].print = fprintf;
|
||||
g_log->log_component[c].stream = stdout;
|
||||
} else {
|
||||
g_log->log_component[c].level = OAILOG_DISABLE;
|
||||
}
|
||||
}
|
||||
if ( enable ) {
|
||||
g_log->log_component[c].level = g_log->log_component[c].savedlevel;
|
||||
g_log->log_component[c].vprint = vfprintf;
|
||||
g_log->log_component[c].print = fprintf;
|
||||
g_log->log_component[c].stream = stdout;
|
||||
} else {
|
||||
g_log->log_component[c].level = OAILOG_DISABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
void set_glog_filelog(int enable)
|
||||
{
|
||||
static FILE *fptr;
|
||||
void set_glog_filelog(int enable) {
|
||||
static FILE *fptr;
|
||||
|
||||
if ( enable ) {
|
||||
fptr = fopen(g_log->filelog_name,"w");
|
||||
@@ -574,33 +547,35 @@ static FILE *fptr;
|
||||
} else {
|
||||
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
|
||||
g_log->log_component[c].filelog = 0;
|
||||
|
||||
if (fptr != NULL) {
|
||||
fclose(fptr);
|
||||
}
|
||||
|
||||
g_log->log_component[c].stream = stdout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void set_component_filelog(int comp)
|
||||
{
|
||||
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
|
||||
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
|
||||
}
|
||||
g_log->log_component[comp].vprint = vfprintf;
|
||||
g_log->log_component[comp].print = fprintf;
|
||||
g_log->log_component[comp].filelog = 1;
|
||||
void set_component_filelog(int comp) {
|
||||
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
|
||||
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
|
||||
}
|
||||
|
||||
g_log->log_component[comp].vprint = vfprintf;
|
||||
g_log->log_component[comp].print = fprintf;
|
||||
g_log->log_component[comp].filelog = 1;
|
||||
}
|
||||
void close_component_filelog(int comp)
|
||||
{
|
||||
g_log->log_component[comp].filelog = 0;
|
||||
if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) {
|
||||
fclose(g_log->log_component[comp].stream);
|
||||
g_log->log_component[comp].stream = stdout;
|
||||
}
|
||||
g_log->log_component[comp].vprint = vfprintf;
|
||||
g_log->log_component[comp].print = fprintf;
|
||||
|
||||
void close_component_filelog(int comp) {
|
||||
g_log->log_component[comp].filelog = 0;
|
||||
|
||||
if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) {
|
||||
fclose(g_log->log_component[comp].stream);
|
||||
g_log->log_component[comp].stream = stdout;
|
||||
}
|
||||
|
||||
g_log->log_component[comp].vprint = vfprintf;
|
||||
g_log->log_component[comp].print = fprintf;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -608,8 +583,7 @@ void close_component_filelog(int comp)
|
||||
* with string value NULL
|
||||
*/
|
||||
/* map a string to an int. Takes a mapping array and a string as arg */
|
||||
int map_str_to_int(mapping *map, const char *str)
|
||||
{
|
||||
int map_str_to_int(mapping *map, const char *str) {
|
||||
while (1) {
|
||||
if (map->name == NULL) {
|
||||
return(-1);
|
||||
@@ -624,8 +598,7 @@ int map_str_to_int(mapping *map, const char *str)
|
||||
}
|
||||
|
||||
/* map an int to a string. Takes a mapping array and a value */
|
||||
char *map_int_to_str(mapping *map, int val)
|
||||
{
|
||||
char *map_int_to_str(mapping *map, int val) {
|
||||
while (1) {
|
||||
if (map->name == NULL) {
|
||||
return NULL;
|
||||
@@ -639,8 +612,7 @@ char *map_int_to_str(mapping *map, int val)
|
||||
}
|
||||
}
|
||||
|
||||
int is_newline( char *str, int size)
|
||||
{
|
||||
int is_newline( char *str, int size) {
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
@@ -653,85 +625,65 @@ int is_newline( char *str, int size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void logClean (void)
|
||||
{
|
||||
void logClean (void) {
|
||||
int i;
|
||||
LOG_UI(PHY,"\n");
|
||||
|
||||
if(isLogInitDone()) {
|
||||
LOG_UI(PHY,"\n");
|
||||
|
||||
|
||||
|
||||
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
close_component_filelog(i);
|
||||
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
close_component_filelog(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef LOG_TEST
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
logInit();
|
||||
|
||||
|
||||
test_log();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int test_log(void)
|
||||
{
|
||||
int test_log(void) {
|
||||
LOG_ENTER(MAC); // because the default level is DEBUG
|
||||
LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "1 debug MAC \n");
|
||||
LOG_W(MAC, "1 warning MAC \n");
|
||||
|
||||
set_log(EMU, OAILOG_INFO);
|
||||
set_log(MAC, OAILOG_WARNING);
|
||||
|
||||
LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_E(MAC, "2 error MAC\n");
|
||||
LOG_D(MAC, "2 debug MAC \n");
|
||||
LOG_W(MAC, "2 warning MAC \n");
|
||||
LOG_I(MAC, "2 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, OAILOG_NOTICE);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "3 debug MAC \n");
|
||||
LOG_W(MAC, "3 warning MAC \n");
|
||||
LOG_I(MAC, "3 info MAC \n");
|
||||
|
||||
set_log(MAC, LOG_DEBUG);
|
||||
set_log(EMU, LOG_DEBUG);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "4 debug MAC \n");
|
||||
LOG_W(MAC, "4 warning MAC \n");
|
||||
LOG_I(MAC, "4 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, LOG_DEBUG);
|
||||
set_log(EMU, LOG_DEBUG);
|
||||
|
||||
LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "5 debug MAC \n");
|
||||
LOG_W(MAC, "5 warning MAC \n");
|
||||
LOG_I(MAC, "5 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, LOG_TRACE);
|
||||
set_log(EMU, LOG_TRACE);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
@@ -739,7 +691,6 @@ int test_log(void)
|
||||
LOG_W(MAC, "6 warning MAC \n");
|
||||
LOG_I(MAC, "6 info MAC \n");
|
||||
LOG_EXIT(MAC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include "T.h"
|
||||
@@ -115,23 +115,22 @@ extern "C" {
|
||||
* @{*/
|
||||
|
||||
|
||||
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
|
||||
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
|
||||
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
|
||||
#define FLAG_FUNCT 0x0020
|
||||
#define FLAG_FILE_LINE 0x0040
|
||||
#define FLAG_TIME 0x0100
|
||||
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
|
||||
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
|
||||
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
|
||||
#define FLAG_TIME 0x0100
|
||||
#define FLAG_INITIALIZED 0x8000
|
||||
|
||||
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
|
||||
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
|
||||
|
||||
/** @defgroup macros to identify a debug entity
|
||||
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
|
||||
* it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro
|
||||
* it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro
|
||||
* is used to map a character string name to each debug bit, it allows to set or clear
|
||||
* the corresponding bit via the defined name, from the configuration or from the telnet
|
||||
* server.
|
||||
* @brief
|
||||
* @brief
|
||||
* @{*/
|
||||
#define DEBUG_PRACH (1<<0)
|
||||
#define DEBUG_RU (1<<1)
|
||||
@@ -150,22 +149,22 @@ extern "C" {
|
||||
|
||||
|
||||
#define LOG_MASKMAP_INIT {\
|
||||
{"PRACH", DEBUG_PRACH},\
|
||||
{"RU", DEBUG_RU},\
|
||||
{"UE_PHYPROC", DEBUG_UE_PHYPROC},\
|
||||
{"LTEESTIM", DEBUG_LTEESTIM},\
|
||||
{"DLCELLSPEC", DEBUG_DLCELLSPEC},\
|
||||
{"ULSCH", DEBUG_ULSCH},\
|
||||
{"RRC", DEBUG_RRC},\
|
||||
{"PDCP", DEBUG_PDCP},\
|
||||
{"DFT", DEBUG_DFT},\
|
||||
{"ASN1", DEBUG_ASN1},\
|
||||
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
|
||||
{"SECURITY", DEBUG_SECURITY},\
|
||||
{"NAS", DEBUG_NAS},\
|
||||
{"UE_TIMING", UE_TIMING},\
|
||||
{NULL,-1}\
|
||||
}
|
||||
{"PRACH", DEBUG_PRACH},\
|
||||
{"RU", DEBUG_RU},\
|
||||
{"UE_PHYPROC", DEBUG_UE_PHYPROC},\
|
||||
{"LTEESTIM", DEBUG_LTEESTIM},\
|
||||
{"DLCELLSPEC", DEBUG_DLCELLSPEC},\
|
||||
{"ULSCH", DEBUG_ULSCH},\
|
||||
{"RRC", DEBUG_RRC},\
|
||||
{"PDCP", DEBUG_PDCP},\
|
||||
{"DFT", DEBUG_DFT},\
|
||||
{"ASN1", DEBUG_ASN1},\
|
||||
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
|
||||
{"SECURITY", DEBUG_SECURITY},\
|
||||
{"NAS", DEBUG_NAS},\
|
||||
{"UE_TIMING", UE_TIMING},\
|
||||
{NULL,-1}\
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -178,46 +177,46 @@ extern "C" {
|
||||
|
||||
|
||||
typedef enum {
|
||||
MIN_LOG_COMPONENTS = 0,
|
||||
PHY = MIN_LOG_COMPONENTS,
|
||||
MAC,
|
||||
SIM,
|
||||
OCG,
|
||||
OMG,
|
||||
OPT,
|
||||
OTG,
|
||||
OTG_LATENCY,
|
||||
OTG_LATENCY_BG,
|
||||
OTG_GP,
|
||||
OTG_GP_BG,
|
||||
OTG_JITTER,
|
||||
RLC,
|
||||
PDCP,
|
||||
RRC,
|
||||
NAS,
|
||||
PERF,
|
||||
OIP,
|
||||
CLI,
|
||||
MSC,
|
||||
OCM,
|
||||
UDP_,
|
||||
GTPU,
|
||||
SPGW,
|
||||
S1AP,
|
||||
SCTP,
|
||||
HW,
|
||||
OSA,
|
||||
RAL_ENB,
|
||||
RAL_UE,
|
||||
ENB_APP,
|
||||
FLEXRAN_AGENT,
|
||||
TMR,
|
||||
USIM,
|
||||
LOCALIZE,
|
||||
X2AP,
|
||||
LOADER,
|
||||
ASN,
|
||||
MAX_LOG_PREDEF_COMPONENTS,
|
||||
MIN_LOG_COMPONENTS = 0,
|
||||
PHY = MIN_LOG_COMPONENTS,
|
||||
MAC,
|
||||
SIM,
|
||||
OCG,
|
||||
OMG,
|
||||
OPT,
|
||||
OTG,
|
||||
OTG_LATENCY,
|
||||
OTG_LATENCY_BG,
|
||||
OTG_GP,
|
||||
OTG_GP_BG,
|
||||
OTG_JITTER,
|
||||
RLC,
|
||||
PDCP,
|
||||
RRC,
|
||||
NAS,
|
||||
PERF,
|
||||
OIP,
|
||||
CLI,
|
||||
MSC,
|
||||
OCM,
|
||||
UDP_,
|
||||
GTPU,
|
||||
SPGW,
|
||||
S1AP,
|
||||
SCTP,
|
||||
HW,
|
||||
OSA,
|
||||
RAL_ENB,
|
||||
RAL_UE,
|
||||
ENB_APP,
|
||||
FLEXRAN_AGENT,
|
||||
TMR,
|
||||
USIM,
|
||||
LOCALIZE,
|
||||
X2AP,
|
||||
LOADER,
|
||||
ASN,
|
||||
MAX_LOG_PREDEF_COMPONENTS,
|
||||
}
|
||||
comp_name_t;
|
||||
|
||||
@@ -226,42 +225,42 @@ comp_name_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
char *name; /*!< \brief string name of item */
|
||||
int value; /*!< \brief integer value of mapping */
|
||||
char *name; /*!< \brief string name of item */
|
||||
int value; /*!< \brief integer value of mapping */
|
||||
} mapping;
|
||||
|
||||
typedef int(*log_vprint_func_t)(FILE *stream, const char *format, va_list ap );
|
||||
typedef int(*log_print_func_t)(FILE *stream, const char *format, ... );
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int level;
|
||||
int savedlevel;
|
||||
int flag;
|
||||
int filelog;
|
||||
char *filelog_name;
|
||||
FILE *stream;
|
||||
log_vprint_func_t vprint;
|
||||
log_print_func_t print;
|
||||
/* SR: make the log buffer component relative */
|
||||
char log_buffer[MAX_LOG_TOTAL];
|
||||
const char *name;
|
||||
int level;
|
||||
int savedlevel;
|
||||
int flag;
|
||||
int filelog;
|
||||
char *filelog_name;
|
||||
FILE *stream;
|
||||
log_vprint_func_t vprint;
|
||||
log_print_func_t print;
|
||||
/* SR: make the log buffer component relative */
|
||||
char log_buffer[MAX_LOG_TOTAL];
|
||||
} log_component_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
log_component_t log_component[MAX_LOG_COMPONENTS];
|
||||
char level2string[NUM_LOG_LEVEL];
|
||||
int flag;
|
||||
char* filelog_name;
|
||||
uint64_t debug_mask;
|
||||
uint64_t dump_mask;
|
||||
log_component_t log_component[MAX_LOG_COMPONENTS];
|
||||
char level2string[NUM_LOG_LEVEL];
|
||||
int flag;
|
||||
char *filelog_name;
|
||||
uint64_t debug_mask;
|
||||
uint64_t dump_mask;
|
||||
} log_t;
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
typedef enum log_instance_type_e {
|
||||
LOG_INSTANCE_UNKNOWN,
|
||||
LOG_INSTANCE_ENB,
|
||||
LOG_INSTANCE_UE,
|
||||
LOG_INSTANCE_UNKNOWN,
|
||||
LOG_INSTANCE_ENB,
|
||||
LOG_INSTANCE_UE,
|
||||
} log_instance_type_t;
|
||||
|
||||
void log_set_instance_type (log_instance_type_t instance);
|
||||
@@ -272,9 +271,9 @@ void log_set_instance_type (log_instance_type_t instance);
|
||||
log_t *g_log;
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
extern log_t *g_log;
|
||||
extern log_t *g_log;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -283,8 +282,9 @@ extern log_t *g_log;
|
||||
# include "log_if.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
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 log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... );
|
||||
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);
|
||||
|
||||
@@ -327,22 +327,22 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
#define LOG_CONFIG_DUMP_FORMAT "%s_dump"
|
||||
|
||||
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
|
||||
" nocolor: disable color usage in log messages\n"\
|
||||
" level: add log level indication in log messages\n"\
|
||||
" thread: add threads names in log messages\n"
|
||||
|
||||
" nocolor: disable color usage in log messages\n"\
|
||||
" level: add log level indication in log messages\n"\
|
||||
" thread: add threads names in log messages\n"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* LOG globalconfiguration parameters */
|
||||
/* optname help paramflags XXXptr defXXXval type numelt */
|
||||
/* LOG globalconfiguration parameters */
|
||||
/* optname help paramflags XXXptr defXXXval type numelt */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define LOG_GLOBALPARAMS_DESC { \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
|
||||
}
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
|
||||
}
|
||||
|
||||
#define LOG_OPTIONS_IDX 2
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
@@ -354,23 +354,23 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
#define LOG_DUMP_DOUBLE 1
|
||||
// debugging macros
|
||||
#define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
|
||||
# if T_TRACER
|
||||
/* per component, level dependant macros */
|
||||
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
|
||||
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
|
||||
# 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)
|
||||
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
|
||||
# if T_TRACER
|
||||
/* per component, level dependant macros */
|
||||
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
|
||||
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
|
||||
# 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)
|
||||
/* 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 */
|
||||
/* bitmask dependant macros, to isolate debugging code */
|
||||
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
|
||||
|
||||
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
|
||||
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
|
||||
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
|
||||
/* define variable only used in LOG macro's */
|
||||
/* define variable only used in LOG macro's */
|
||||
# define LOG_VAR(A,B) A B
|
||||
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||
# define LOG_I(c, x...) /* */
|
||||
@@ -380,15 +380,15 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
# define LOG_T(c, x...) /* */
|
||||
|
||||
# define LOG_DUMPMSG(c, b, s, x...) /* */
|
||||
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
||||
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
||||
# define LOG_DEBUGFLAG(D) ( 0 )
|
||||
# define LOG_DUMPFLAG(D) ( 0 )
|
||||
# define LOG_M(file, vector, data, len, dec, format)
|
||||
# define LOG_DUMPFLAG(D) ( 0 )
|
||||
# define LOG_M(file, vector, data, len, dec, format)
|
||||
# define LOG_VAR(A,B)
|
||||
# endif /* T_TRACER */
|
||||
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
||||
#define GCC_NOTUSED __attribute__((unused))
|
||||
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
|
||||
#define GCC_NOTUSED __attribute__((unused))
|
||||
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
|
||||
|
||||
/* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
|
||||
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||
@@ -420,78 +420,82 @@ static __inline__ uint64_t rdtsc(void) {
|
||||
|
||||
extern double cpuf;
|
||||
|
||||
static inline uint64_t checkTCPU(int timeout, char * file, int line) {
|
||||
static uint64_t __thread lastCPUTime=0;
|
||||
static uint64_t __thread last=0;
|
||||
uint64_t cur=rdtsc();
|
||||
struct timespec CPUt;
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt);
|
||||
uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000;
|
||||
double microCycles=(double)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
if ( last!=0 && duration > timeout ) {
|
||||
//struct timespec ts;
|
||||
//clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line,
|
||||
duration, timeout, (long long)CPUTime-lastCPUTime );
|
||||
}
|
||||
last=cur;
|
||||
lastCPUTime=CPUTime;
|
||||
return cur;
|
||||
static inline uint64_t checkTCPU(int timeout, char *file, int line) {
|
||||
static uint64_t __thread lastCPUTime=0;
|
||||
static uint64_t __thread last=0;
|
||||
uint64_t cur=rdtsc();
|
||||
struct timespec CPUt;
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt);
|
||||
uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000;
|
||||
double microCycles=(double)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
|
||||
if ( last!=0 && duration > timeout ) {
|
||||
//struct timespec ts;
|
||||
//clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line,
|
||||
duration, timeout, (long long)CPUTime-lastCPUTime );
|
||||
}
|
||||
|
||||
last=cur;
|
||||
lastCPUTime=CPUTime;
|
||||
return cur;
|
||||
}
|
||||
|
||||
static inline unsigned long long checkT(int timeout, char * file, int line) {
|
||||
static unsigned long long __thread last=0;
|
||||
unsigned long long cur=rdtsc();
|
||||
int microCycles=(int)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
if ( last!=0 && duration > timeout )
|
||||
printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line,
|
||||
duration, timeout);
|
||||
last=cur;
|
||||
return cur;
|
||||
static inline unsigned long long checkT(int timeout, char *file, int line) {
|
||||
static unsigned long long __thread last=0;
|
||||
unsigned long long cur=rdtsc();
|
||||
int microCycles=(int)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
|
||||
if ( last!=0 && duration > timeout )
|
||||
printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line,
|
||||
duration, timeout);
|
||||
|
||||
last=cur;
|
||||
return cur;
|
||||
}
|
||||
|
||||
typedef struct m {
|
||||
uint64_t iterations;
|
||||
uint64_t sum;
|
||||
uint64_t maxArray[11];
|
||||
uint64_t iterations;
|
||||
uint64_t sum;
|
||||
uint64_t maxArray[11];
|
||||
} Meas;
|
||||
|
||||
static inline void printMeas(char * txt, Meas *M, int period) {
|
||||
if (M->iterations%period == 0 ) {
|
||||
char txt2[512];
|
||||
sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
|
||||
PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n",
|
||||
txt,
|
||||
M->sum/M->iterations,
|
||||
M->iterations,
|
||||
M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
|
||||
M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
|
||||
static inline void printMeas(char *txt, Meas *M, int period) {
|
||||
if (M->iterations%period == 0 ) {
|
||||
char txt2[512];
|
||||
sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
|
||||
PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n",
|
||||
txt,
|
||||
M->sum/M->iterations,
|
||||
M->iterations,
|
||||
M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
|
||||
M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
|
||||
#if DISABLE_LOG_X
|
||||
printf("%s",txt2);
|
||||
printf("%s",txt2);
|
||||
#else
|
||||
LOG_W(PHY, "%s",txt2);
|
||||
LOG_W(PHY, "%s",txt2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int cmpint(const void* a, const void* b) {
|
||||
uint64_t* aa=(uint64_t*)a;
|
||||
uint64_t* bb=(uint64_t*)b;
|
||||
return (int)(*aa-*bb);
|
||||
static inline int cmpint(const void *a, const void *b) {
|
||||
uint64_t *aa=(uint64_t *)a;
|
||||
uint64_t *bb=(uint64_t *)b;
|
||||
return (int)(*aa-*bb);
|
||||
}
|
||||
|
||||
static inline void updateTimes(uint64_t start, Meas *M, int period, char * txt) {
|
||||
if (start!=0) {
|
||||
uint64_t end=rdtsc();
|
||||
long long diff=(end-start)/(cpuf*1000);
|
||||
M->maxArray[0]=diff;
|
||||
M->sum+=diff;
|
||||
M->iterations++;
|
||||
qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
|
||||
printMeas(txt,M,period);
|
||||
}
|
||||
static inline void updateTimes(uint64_t start, Meas *M, int period, char *txt) {
|
||||
if (start!=0) {
|
||||
uint64_t end=rdtsc();
|
||||
long long diff=(end-start)/(cpuf*1000);
|
||||
M->maxArray[0]=diff;
|
||||
M->sum+=diff;
|
||||
M->iterations++;
|
||||
qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
|
||||
printMeas(txt,M,period);
|
||||
}
|
||||
}
|
||||
|
||||
#define check(a) do { checkT(a,__FILE__,__LINE__); } while (0)
|
||||
|
||||
@@ -75,8 +75,12 @@ ID = ENB_PHY_MSG3_ALLOCATION
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
|
||||
ID = ENB_PHY_INITIATE_RA_PROCEDURE
|
||||
DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles
|
||||
GROUP = ALL:PHY:ENB
|
||||
GROUP = ALL:PHY:ENB:WIRESHARK
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : int,preamble : int,energy : int,delay
|
||||
ID = ENB_PHY_MIB
|
||||
DESC = MIB data
|
||||
GROUP = ALL:PHY:ENB:WIRESHARK
|
||||
FORMAT = int,eNB_ID : int,frame : int,subframe : buffer,data
|
||||
|
||||
#MAC logs
|
||||
ID = ENB_MAC_UE_DL_SDU
|
||||
@@ -97,7 +101,7 @@ ID = ENB_MAC_UE_UL_PDU
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu
|
||||
ID = ENB_MAC_UE_UL_PDU_WITH_DATA
|
||||
DESC = MAC uplink UE received PDU
|
||||
GROUP = ALL:MAC:ENB
|
||||
GROUP = ALL:MAC:ENB:WIRESHARK
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data
|
||||
ID = ENB_MAC_UE_UL_SDU
|
||||
DESC = MAC uplink UE received SDU
|
||||
@@ -113,12 +117,16 @@ ID = ENB_MAC_UE_UL_CE
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,ce
|
||||
ID = ENB_MAC_UE_DL_PDU_WITH_DATA
|
||||
DESC = MAC downlink PDU for an UE
|
||||
GROUP = ALL:MAC:ENB
|
||||
GROUP = ALL:MAC:ENB:WIRESHARK
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
|
||||
ID = ENB_MAC_SCHEDULING_REQUEST
|
||||
DESC = MAC scheduling request detected for an UE
|
||||
GROUP = ALL:MAC:ENB
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti
|
||||
ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA
|
||||
DESC = MAC downlink PDU for an UE
|
||||
GROUP = ALL:MAC:ENB:WIRESHARK
|
||||
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
|
||||
|
||||
#RLC logs
|
||||
ID = ENB_RLC_DL
|
||||
|
||||
@@ -8,27 +8,35 @@ char **unique_ids;
|
||||
int unique_ids_size;
|
||||
int unique_ids_maxsize;
|
||||
|
||||
int cmp(const void *p1, const void *p2)
|
||||
{
|
||||
return strcmp(*(char * const *)p1, *(char * const *)p2);
|
||||
int cmp(const void *p1, const void *p2) {
|
||||
return strcmp(*(char *const *)p1, *(char *const *)p2);
|
||||
}
|
||||
|
||||
/* return 1 if s was not already known, 0 if it was */
|
||||
int new_unique_id(char *s, char *input_file)
|
||||
{
|
||||
int new_unique_id(char *s, char *input_file) {
|
||||
if (unique_ids_size)
|
||||
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
|
||||
printf("error: ID %s is not unique in %s\n", s, input_file);
|
||||
return 0;
|
||||
}
|
||||
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
|
||||
printf("error: ID %s is not unique in %s\n", s, input_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (unique_ids_size == unique_ids_maxsize) {
|
||||
unique_ids_maxsize += 256;
|
||||
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
|
||||
if (unique_ids == NULL) { printf("erorr: out of memory\n"); abort(); }
|
||||
|
||||
if (unique_ids == NULL) {
|
||||
printf("error: out of memory\n");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
unique_ids[unique_ids_size] = strdup(s);
|
||||
if (unique_ids[unique_ids_size] == NULL)
|
||||
{ printf("erorr: out of memory\n"); abort(); }
|
||||
|
||||
if (unique_ids[unique_ids_size] == NULL) {
|
||||
printf("error: out of memory\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
unique_ids_size++;
|
||||
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
|
||||
return 1;
|
||||
@@ -38,14 +46,17 @@ char *bufname;
|
||||
int bufname_size;
|
||||
int bufname_maxsize;
|
||||
|
||||
void putname(int c)
|
||||
{
|
||||
void putname(int c) {
|
||||
if (bufname_size == bufname_maxsize) {
|
||||
bufname_maxsize += 256;
|
||||
bufname = realloc(bufname, bufname_maxsize);
|
||||
if (bufname == NULL)
|
||||
{ printf("erorr: memory allocation error\n"); exit(1); }
|
||||
|
||||
if (bufname == NULL) {
|
||||
printf("error: memory allocation error\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
bufname[bufname_size] = c;
|
||||
bufname_size++;
|
||||
}
|
||||
@@ -54,42 +65,54 @@ char *bufvalue;
|
||||
int bufvalue_size;
|
||||
int bufvalue_maxsize;
|
||||
|
||||
void putvalue(int c)
|
||||
{
|
||||
void putvalue(int c) {
|
||||
if (bufvalue_size == bufvalue_maxsize) {
|
||||
bufvalue_maxsize += 256;
|
||||
bufvalue = realloc(bufvalue, bufvalue_maxsize);
|
||||
if (bufvalue == NULL)
|
||||
{ printf("error: memory allocation error\n"); exit(1); }
|
||||
|
||||
if (bufvalue == NULL) {
|
||||
printf("error: memory allocation error\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
bufvalue[bufvalue_size] = c;
|
||||
bufvalue_size++;
|
||||
}
|
||||
|
||||
void smash_spaces(FILE *f)
|
||||
{
|
||||
void smash_spaces(FILE *f) {
|
||||
int c;
|
||||
|
||||
while (1) {
|
||||
c = fgetc(f);
|
||||
|
||||
if (isspace(c)) continue;
|
||||
|
||||
if (c == ' ') continue;
|
||||
|
||||
if (c == '\t') continue;
|
||||
|
||||
if (c == '\n') continue;
|
||||
|
||||
if (c == 10 || c == 13) continue;
|
||||
|
||||
if (c == '#') {
|
||||
while (1) {
|
||||
c = fgetc(f);
|
||||
|
||||
if (c == '\n' || c == EOF) break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (c != EOF) ungetc(c, f);
|
||||
}
|
||||
|
||||
void get_line(FILE *f, char **name, char **value)
|
||||
{
|
||||
void get_line(FILE *f, char **name, char **value) {
|
||||
int c;
|
||||
bufname_size = 0;
|
||||
bufvalue_size = 0;
|
||||
@@ -97,23 +120,39 @@ void get_line(FILE *f, char **name, char **value)
|
||||
*value = NULL;
|
||||
smash_spaces(f);
|
||||
c = fgetc(f);
|
||||
while (!(c == '=' || isspace(c) || c == EOF)) { putname(c); c = fgetc(f); }
|
||||
|
||||
while (!(c == '=' || isspace(c) || c == EOF)) {
|
||||
putname(c);
|
||||
c = fgetc(f);
|
||||
}
|
||||
|
||||
if (c == EOF) return;
|
||||
|
||||
putname(0);
|
||||
|
||||
while (!(c == EOF || c == '=')) c = fgetc(f);
|
||||
|
||||
if (c == EOF) return;
|
||||
|
||||
smash_spaces(f);
|
||||
c = fgetc(f);
|
||||
while (!(c == 10 || c == 13 || c == EOF)) { putvalue(c); c = fgetc(f); }
|
||||
|
||||
while (!(c == 10 || c == 13 || c == EOF)) {
|
||||
putvalue(c);
|
||||
c = fgetc(f);
|
||||
}
|
||||
|
||||
putvalue(0);
|
||||
|
||||
if (bufname_size <= 1) return;
|
||||
|
||||
if (bufvalue_size <= 1) return;
|
||||
|
||||
*name = bufname;
|
||||
*value = bufvalue;
|
||||
}
|
||||
|
||||
int main(int n, char **v)
|
||||
{
|
||||
int main(int n, char **v) {
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
char *name;
|
||||
@@ -121,36 +160,54 @@ int main(int n, char **v)
|
||||
char *in_name;
|
||||
char *out_name;
|
||||
|
||||
if (n != 3) { printf("error: gimme <source> <dest>\n"); exit(1); }
|
||||
if (n != 3) {
|
||||
printf("error: gimme <source> <dest>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = 0;
|
||||
|
||||
in_name = v[1];
|
||||
out_name = v[2];
|
||||
in = fopen(in_name, "r");
|
||||
|
||||
in = fopen(in_name, "r"); if (in == NULL) { perror(in_name); exit(1); }
|
||||
out = fopen(out_name, "w"); if (out == NULL) { perror(out_name); exit(1); }
|
||||
if (in == NULL) {
|
||||
perror(in_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
out = fopen(out_name, "w");
|
||||
|
||||
if (out == NULL) {
|
||||
perror(out_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(out, "/* generated file, do not edit by hand */\n\n");
|
||||
|
||||
while (1) {
|
||||
get_line(in, &name, &value);
|
||||
|
||||
if (name == NULL) break;
|
||||
|
||||
if (isspace(value[strlen(value)-1])) {
|
||||
printf("error: bad value '%s' (no space at the end please!)\n", value);
|
||||
unlink(out_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!strcmp(name, "ID")) {
|
||||
if (!new_unique_id(value, in_name)) { unlink(out_name); exit(1); }
|
||||
if (!new_unique_id(value, in_name)) {
|
||||
unlink(out_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
|
||||
|
||||
fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
|
||||
multi: multi.o utils.o database.o config.o
|
||||
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
|
||||
|
||||
multi.o: ../T_IDs.h
|
||||
|
||||
../T_IDs.h:
|
||||
cd .. && $(MAKE)
|
||||
|
||||
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
|
||||
|
||||
gui/gui.a:
|
||||
|
||||
@@ -16,6 +16,8 @@ void usage(void)
|
||||
" -f <name> <value> field 'name' of 'event' has to match 'value'\n"
|
||||
" type of 'name' must be int\n"
|
||||
" (you can use several -f options)\n"
|
||||
" -after <raw time> <nsec> 'event' time has to be greater than this\n"
|
||||
" -count <n> dump 'n' matching events (less if EOF reached)\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
@@ -51,6 +53,10 @@ int main(int n, char **v)
|
||||
int filter_count = 0;
|
||||
int buffer_arg;
|
||||
int found;
|
||||
int count = 1;
|
||||
int check_time = 0;
|
||||
time_t sec;
|
||||
long nsec;
|
||||
|
||||
for (i = 1; i < n; i++) {
|
||||
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
|
||||
@@ -63,6 +69,14 @@ int main(int n, char **v)
|
||||
filter_value[filter_count++] = atoi(v[++i]);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(v[i], "-after")) { if (i>n-3) usage();
|
||||
check_time = 1;
|
||||
sec = atoll(v[++i]);
|
||||
nsec = atol(v[++i]);
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(v[i], "-count"))
|
||||
{ if (i > n-2) usage(); count = atoi(v[++i]); continue; }
|
||||
if (file == NULL) { file = v[i]; continue; }
|
||||
if (event_name == NULL) { event_name = v[i]; continue; }
|
||||
if (buffer_name == NULL) { buffer_name = v[i]; continue; }
|
||||
@@ -111,13 +125,20 @@ int main(int n, char **v)
|
||||
break;
|
||||
if (i != filter_count)
|
||||
continue;
|
||||
if (check_time &&
|
||||
!(e.sending_time.tv_sec > sec ||
|
||||
(e.sending_time.tv_sec == sec && e.sending_time.tv_nsec >= nsec)))
|
||||
continue;
|
||||
if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1)
|
||||
{ perror(output_file); exit(1); }
|
||||
found = 1;
|
||||
break;
|
||||
found++;
|
||||
if (found == count)
|
||||
break;
|
||||
}
|
||||
|
||||
if (found == 0) printf("ERROR: event not found\n");
|
||||
if (found != count)
|
||||
printf("WARNING: dumped %d events (wanted %d)\n", found, count);
|
||||
|
||||
fclose(out);
|
||||
|
||||
|
||||
@@ -7,21 +7,19 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int x_connection_fd(x_connection *_x)
|
||||
{
|
||||
int x_connection_fd(x_connection *_x) {
|
||||
struct x_connection *x = _x;
|
||||
return ConnectionNumber(x->d);
|
||||
}
|
||||
|
||||
static GC create_gc(Display *d, char *color)
|
||||
{
|
||||
static GC create_gc(Display *d, char *color) {
|
||||
GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL);
|
||||
XGCValues gcv;
|
||||
XColor rcol, scol;
|
||||
|
||||
XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret);
|
||||
|
||||
if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)),
|
||||
color, &scol, &rcol)) {
|
||||
color, &scol, &rcol)) {
|
||||
gcv.foreground = scol.pixel;
|
||||
XChangeGC(d, ret, GCForeground, &gcv);
|
||||
} else ERR("X: could not allocate color '%s'\n", color);
|
||||
@@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int x_new_color(x_connection *_x, char *color)
|
||||
{
|
||||
int x_new_color(x_connection *_x, char *color) {
|
||||
struct x_connection *x = _x;
|
||||
x->ncolors++;
|
||||
|
||||
x->colors = realloc(x->colors, x->ncolors * sizeof(GC));
|
||||
if (x->colors == NULL) OOM;
|
||||
x->colors[x->ncolors-1] = create_gc(x->d, color);
|
||||
|
||||
if (x->colors == NULL) OOM;
|
||||
|
||||
x->colors[x->ncolors-1] = create_gc(x->d, color);
|
||||
x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor));
|
||||
|
||||
if (x->xft_colors == NULL) OOM;
|
||||
|
||||
if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)),
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)),
|
||||
color, &x->xft_colors[x->ncolors-1]) == False)
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)),
|
||||
color, &x->xft_colors[x->ncolors-1]) == False)
|
||||
ERR("could not allocate color '%s'\n", color);
|
||||
|
||||
return x->ncolors - 1;
|
||||
}
|
||||
|
||||
int x_new_font(x_connection *_x, char *font)
|
||||
{
|
||||
int x_new_font(x_connection *_x, char *font) {
|
||||
struct x_connection *x = _x;
|
||||
/* TODO: allocate fonts only once */
|
||||
x->nfonts++;
|
||||
x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *));
|
||||
|
||||
if (x->fonts == NULL) OOM;
|
||||
|
||||
x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font);
|
||||
|
||||
if (x->fonts[x->nfonts-1] == NULL)
|
||||
ERR("failed allocating font '%s'\n", font);
|
||||
|
||||
return x->nfonts - 1;
|
||||
}
|
||||
|
||||
x_connection *x_open(void)
|
||||
{
|
||||
x_connection *x_open(void) {
|
||||
struct x_connection *ret;
|
||||
|
||||
ret = calloc(1, sizeof(struct x_connection));
|
||||
|
||||
if (ret == NULL) OOM;
|
||||
|
||||
ret->d = XOpenDisplay(0);
|
||||
LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret);
|
||||
|
||||
if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n");
|
||||
|
||||
x_new_color(ret, "white"); /* background color */
|
||||
x_new_color(ret, "black"); /* foreground color */
|
||||
|
||||
x_new_font(ret, "sans-8");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
x_window *x_create_window(x_connection *_x, int width, int height,
|
||||
char *title)
|
||||
{
|
||||
char *title) {
|
||||
struct x_connection *x = _x;
|
||||
struct x_window *ret;
|
||||
|
||||
ret = calloc(1, sizeof(struct x_window));
|
||||
|
||||
if (ret == NULL) OOM;
|
||||
|
||||
ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0,
|
||||
width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
|
||||
WhitePixel(x->d, DefaultScreen(x->d)));
|
||||
width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
|
||||
WhitePixel(x->d, DefaultScreen(x->d)));
|
||||
ret->width = width;
|
||||
ret->height = height;
|
||||
|
||||
XStoreName(x->d, ret->w, title);
|
||||
|
||||
ret->p = XCreatePixmap(x->d, ret->w, width, height,
|
||||
DefaultDepth(x->d, DefaultScreen(x->d)));
|
||||
DefaultDepth(x->d, DefaultScreen(x->d)));
|
||||
XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR],
|
||||
0, 0, width, height);
|
||||
|
||||
0, 0, width, height);
|
||||
ret->xft = XftDrawCreate(x->d, ret->p,
|
||||
DefaultVisual(x->d, DefaultScreen(x->d)),
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)));
|
||||
DefaultVisual(x->d, DefaultScreen(x->d)),
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)));
|
||||
|
||||
if (ret->xft == NULL) ERR("XftDrawCreate failed\n");
|
||||
|
||||
/* enable backing store */
|
||||
@@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height,
|
||||
att.backing_store = Always;
|
||||
XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att);
|
||||
}
|
||||
|
||||
XSelectInput(x->d, ret->w,
|
||||
KeyPressMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
PointerMotionMask |
|
||||
ExposureMask |
|
||||
StructureNotifyMask);
|
||||
|
||||
KeyPressMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
PointerMotionMask |
|
||||
ExposureMask |
|
||||
StructureNotifyMask);
|
||||
XMapWindow(x->d, ret->w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
x_image *x_create_image(x_connection *_x, unsigned char *data,
|
||||
int width, int height)
|
||||
{
|
||||
int width, int height) {
|
||||
struct x_connection *x = _x;
|
||||
struct x_image *ret;
|
||||
XImage *ximage;
|
||||
@@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
|
||||
XVisualInfo template;
|
||||
int nvs;
|
||||
Visual *v;
|
||||
ret = calloc(1, sizeof(struct x_image));
|
||||
|
||||
ret = calloc(1, sizeof(struct x_image)); if (ret == NULL) OOM;
|
||||
if (ret == NULL) OOM;
|
||||
|
||||
template.class = TrueColor;
|
||||
template.depth = 24;
|
||||
@@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
|
||||
template.green_mask = 0x00ff00;
|
||||
template.blue_mask = 0x0000ff;
|
||||
template.bits_per_rgb = 8;
|
||||
|
||||
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
|
||||
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
|
||||
VisualBitsPerRGBMask, &template, &nvs);
|
||||
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
|
||||
VisualBitsPerRGBMask, &template, &nvs);
|
||||
|
||||
if (vs == NULL) {
|
||||
/* try again with 32 bpp */
|
||||
template.depth = 32;
|
||||
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
|
||||
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
|
||||
VisualBitsPerRGBMask, &template, &nvs);
|
||||
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
|
||||
VisualBitsPerRGBMask, &template, &nvs);
|
||||
}
|
||||
|
||||
if (vs == NULL) ERR("no good visual found\n");
|
||||
|
||||
v = vs[0].visual;
|
||||
XFree(vs);
|
||||
|
||||
ximage = XCreateImage(x->d, v, 24, ZPixmap, 0,
|
||||
(char*)data, width, height, 32, 0);
|
||||
(char *)data, width, height, 32, 0);
|
||||
|
||||
if (ximage == NULL) ERR("image creation failed\n");
|
||||
|
||||
ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24);
|
||||
|
||||
XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)),
|
||||
ximage, 0, 0, 0, 0, width, height);
|
||||
|
||||
ximage, 0, 0, 0, 0, width, height);
|
||||
/* TODO: be sure it's fine to set data to NULL */
|
||||
ximage->data = NULL;
|
||||
XDestroyImage(ximage);
|
||||
|
||||
ret->width = width;
|
||||
ret->height = height;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct toplevel_window_widget *find_x_window(struct gui *g, Window id)
|
||||
{
|
||||
static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) {
|
||||
struct widget_list *cur;
|
||||
struct toplevel_window_widget *w;
|
||||
struct x_window *xw;
|
||||
cur = g->toplevel;
|
||||
|
||||
while (cur) {
|
||||
w = (struct toplevel_window_widget *)cur->item;
|
||||
xw = w->x;
|
||||
|
||||
if (xw->w == id) return w;
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void x_events(gui *_gui)
|
||||
{
|
||||
void x_events(gui *_gui) {
|
||||
struct gui *g = _gui;
|
||||
struct widget_list *cur;
|
||||
struct x_connection *x = g->x;
|
||||
struct toplevel_window_widget *w;
|
||||
|
||||
LOGD("x_events START\n");
|
||||
/* preprocessing (to "compress" events) */
|
||||
cur = g->toplevel;
|
||||
|
||||
while (cur) {
|
||||
struct x_window *xw;
|
||||
w = (struct toplevel_window_widget *)cur->item;
|
||||
@@ -222,58 +213,84 @@ void x_events(gui *_gui)
|
||||
XEvent ev;
|
||||
XNextEvent(x->d, &ev);
|
||||
LOGD("XEV %d\n", ev.type);
|
||||
|
||||
switch (ev.type) {
|
||||
case MapNotify:
|
||||
case Expose:
|
||||
if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
|
||||
struct x_window *xw = w->x;
|
||||
xw->redraw = 1;
|
||||
}
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
|
||||
struct x_window *xw = w->x;
|
||||
xw->resize = 1;
|
||||
xw->new_width = ev.xconfigure.width;
|
||||
xw->new_height = ev.xconfigure.height;
|
||||
if (xw->new_width < 10) xw->new_width = 10;
|
||||
if (xw->new_height < 10) xw->new_height = 10;
|
||||
LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
|
||||
}
|
||||
break;
|
||||
case ButtonPress:
|
||||
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
|
||||
int key_modifiers = 0;
|
||||
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
|
||||
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
|
||||
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
|
||||
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
|
||||
ev.xbutton.button, 0);
|
||||
}
|
||||
break;
|
||||
case ButtonRelease:
|
||||
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
|
||||
int key_modifiers = 0;
|
||||
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
|
||||
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
|
||||
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
|
||||
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
|
||||
ev.xbutton.button, 1);
|
||||
}
|
||||
break;
|
||||
default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break;
|
||||
case MapNotify:
|
||||
case Expose:
|
||||
if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
|
||||
struct x_window *xw = w->x;
|
||||
xw->redraw = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
|
||||
struct x_window *xw = w->x;
|
||||
xw->resize = 1;
|
||||
xw->new_width = ev.xconfigure.width;
|
||||
xw->new_height = ev.xconfigure.height;
|
||||
|
||||
if (xw->new_width < 10) xw->new_width = 10;
|
||||
|
||||
if (xw->new_height < 10) xw->new_height = 10;
|
||||
|
||||
LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
|
||||
int key_modifiers = 0;
|
||||
|
||||
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
|
||||
|
||||
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
|
||||
|
||||
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
|
||||
|
||||
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
|
||||
ev.xbutton.button, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
|
||||
int key_modifiers = 0;
|
||||
|
||||
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
|
||||
|
||||
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
|
||||
|
||||
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
|
||||
|
||||
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
|
||||
ev.xbutton.button, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gui_logd) WARN("TODO: X event type %d\n", ev.type);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* postprocessing */
|
||||
LOGD("post processing\n");
|
||||
cur = g->toplevel;
|
||||
|
||||
while (cur) {
|
||||
struct toplevel_window_widget *w =
|
||||
(struct toplevel_window_widget *)cur->item;
|
||||
(struct toplevel_window_widget *)cur->item;
|
||||
struct x_window *xw = w->x;
|
||||
|
||||
if (xw->resize) {
|
||||
LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height);
|
||||
|
||||
if (xw->width != xw->new_width || xw->height != xw->new_height) {
|
||||
w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height);
|
||||
xw->width = xw->new_width;
|
||||
@@ -281,46 +298,47 @@ void x_events(gui *_gui)
|
||||
XftDrawDestroy(xw->xft);
|
||||
XFreePixmap(x->d, xw->p);
|
||||
xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height,
|
||||
DefaultDepth(x->d, DefaultScreen(x->d)));
|
||||
DefaultDepth(x->d, DefaultScreen(x->d)));
|
||||
XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR],
|
||||
0, 0, xw->width, xw->height);
|
||||
0, 0, xw->width, xw->height);
|
||||
xw->xft = XftDrawCreate(x->d, xw->p,
|
||||
DefaultVisual(x->d, DefaultScreen(x->d)),
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)));
|
||||
DefaultVisual(x->d, DefaultScreen(x->d)),
|
||||
DefaultColormap(x->d, DefaultScreen(x->d)));
|
||||
|
||||
if (xw->xft == NULL) ERR("XftDrawCreate failed\n");
|
||||
|
||||
//xw->repaint = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (xw->repaint) {
|
||||
w->common.paint(g, w);
|
||||
xw->redraw = 1;
|
||||
}
|
||||
|
||||
if (xw->redraw) {
|
||||
struct x_connection *x = g->x;
|
||||
LOGD("XCopyArea w h %d %d\n", xw->width, xw->height);
|
||||
XCopyArea(x->d, xw->p, xw->w, x->colors[1],
|
||||
0, 0, xw->width, xw->height, 0, 0);
|
||||
0, 0, xw->width, xw->height, 0, 0);
|
||||
}
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
LOGD("x_events DONE\n");
|
||||
}
|
||||
|
||||
void x_flush(x_connection *_x)
|
||||
{
|
||||
void x_flush(x_connection *_x) {
|
||||
struct x_connection *x = _x;
|
||||
XFlush(x->d);
|
||||
}
|
||||
|
||||
void x_text_get_dimensions(x_connection *_c, int font, const char *t,
|
||||
int *width, int *height, int *baseline)
|
||||
{
|
||||
int *width, int *height, int *baseline) {
|
||||
struct x_connection *c = _c;
|
||||
XGlyphInfo ext;
|
||||
|
||||
XftTextExtentsUtf8(c->d, c->fonts[font], (FcChar8 *)t, strlen(t), &ext);
|
||||
|
||||
*width = ext.width;
|
||||
*height = c->fonts[font]->height;
|
||||
*baseline = c->fonts[font]->ascent;
|
||||
@@ -331,63 +349,57 @@ void x_text_get_dimensions(x_connection *_c, int font, const char *t,
|
||||
/***********************************************************************/
|
||||
|
||||
void x_draw_line(x_connection *_c, x_window *_w, int color,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int x1, int y1, int x2, int y2) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
XDrawLine(c->d, w->p, c->colors[color], x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void x_draw_rectangle(x_connection *_c, x_window *_w, int color,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
int x, int y, int width, int height) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
XDrawRectangle(c->d, w->p, c->colors[color], x, y, width, height);
|
||||
}
|
||||
|
||||
void x_fill_rectangle(x_connection *_c, x_window *_w, int color,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
int x, int y, int width, int height) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
XFillRectangle(c->d, w->p, c->colors[color], x, y, width, height);
|
||||
}
|
||||
|
||||
void x_draw_string(x_connection *_c, x_window *_w, int font, int color,
|
||||
int x, int y, const char *t)
|
||||
{
|
||||
int x, int y, const char *t) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
int tlen = strlen(t);
|
||||
XftDrawStringUtf8(w->xft, &c->xft_colors[color], c->fonts[font],
|
||||
x, y, (const unsigned char *)t, tlen);
|
||||
x, y, (const unsigned char *)t, tlen);
|
||||
}
|
||||
|
||||
void x_draw_clipped_string(x_connection *_c, x_window *_w, int font,
|
||||
int color, int x, int y, const char *t,
|
||||
int clipx, int clipy, int clipwidth, int clipheight)
|
||||
{
|
||||
int color, int x, int y, const char *t,
|
||||
int clipx, int clipy, int clipwidth, int clipheight) {
|
||||
struct x_window *w = _w;
|
||||
|
||||
XRectangle clip = { clipx, clipy, clipwidth, clipheight };
|
||||
|
||||
if (XftDrawSetClipRectangles(w->xft, 0, 0, &clip, 1) == False) abort();
|
||||
|
||||
x_draw_string(_c, _w, font, color, x, y, t);
|
||||
|
||||
if (XftDrawSetClip(w->xft, NULL) == False) abort();
|
||||
}
|
||||
|
||||
void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y)
|
||||
{
|
||||
void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
struct x_image *img = _img;
|
||||
|
||||
XCopyArea(c->d, img->p, w->p, DefaultGC(c->d, DefaultScreen(c->d)),
|
||||
0, 0, img->width, img->height, x, y);
|
||||
0, 0, img->width, img->height, x, y);
|
||||
}
|
||||
|
||||
void x_draw(x_connection *_c, x_window *_w)
|
||||
{
|
||||
void x_draw(x_connection *_c, x_window *_w) {
|
||||
struct x_connection *c = _c;
|
||||
struct x_window *w = _w;
|
||||
LOGD("x_draw XCopyArea w h %d %d display %p window %d pixmap %d\n", w->width, w->height, c->d, (int)w->w, (int)w->p);
|
||||
@@ -397,13 +409,13 @@ void x_draw(x_connection *_c, x_window *_w)
|
||||
/* those two special functions are to plot many points
|
||||
* first call x_add_point many times then x_plot_points once
|
||||
*/
|
||||
void x_add_point(x_connection *_c, int x, int y)
|
||||
{
|
||||
void x_add_point(x_connection *_c, int x, int y) {
|
||||
struct x_connection *c = _c;
|
||||
|
||||
if (c->pts_size == c->pts_maxsize) {
|
||||
c->pts_maxsize += 65536;
|
||||
c->pts = realloc(c->pts, c->pts_maxsize * sizeof(XPoint));
|
||||
|
||||
if (c->pts == NULL) OOM;
|
||||
}
|
||||
|
||||
@@ -412,12 +424,11 @@ void x_add_point(x_connection *_c, int x, int y)
|
||||
c->pts_size++;
|
||||
}
|
||||
|
||||
void x_plot_points(x_connection *_c, x_window *_w, int color)
|
||||
{
|
||||
void x_plot_points(x_connection *_c, x_window *_w, int color) {
|
||||
struct x_connection *c = _c;
|
||||
LOGD("x_plot_points %d points\n", c->pts_size);
|
||||
struct x_window *w = _w;
|
||||
XDrawPoints(c->d, w->p, c->colors[color], c->pts, c->pts_size,
|
||||
CoordModeOrigin);
|
||||
CoordModeOrigin);
|
||||
c->pts_size = 0;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ void framelog_set_skip(logger *_this, int skip_delay);
|
||||
void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9);
|
||||
|
||||
void textlog_dump_buffer(logger *_this, int dump_buffer);
|
||||
void textlog_raw_time(logger *_this, int raw_time);
|
||||
|
||||
#include "view/view.h"
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ struct textlog {
|
||||
/* local output buffer */
|
||||
OBUF o;
|
||||
int dump_buffer;
|
||||
int raw_time;
|
||||
};
|
||||
|
||||
static void _event(void *p, event e)
|
||||
@@ -51,9 +52,13 @@ static void _event(void *p, event e)
|
||||
|
||||
#ifdef T_SEND_TIME
|
||||
t = localtime(&e.sending_time.tv_sec);
|
||||
/* round tv_nsec to nearest millisecond */
|
||||
sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec,
|
||||
e.sending_time.tv_nsec);
|
||||
if (l->raw_time)
|
||||
sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld [%ld]: ",
|
||||
t->tm_hour, t->tm_min, t->tm_sec,
|
||||
e.sending_time.tv_nsec, e.sending_time.tv_sec);
|
||||
else
|
||||
sprintf(tt, "%2.2d:%2.2d:%2.2d.%9.9ld: ", t->tm_hour, t->tm_min, t->tm_sec,
|
||||
e.sending_time.tv_nsec);
|
||||
PUTS(&l->o, tt);
|
||||
#endif
|
||||
|
||||
@@ -215,3 +220,9 @@ void textlog_dump_buffer(logger *_this, int dump_buffer)
|
||||
struct textlog *l = _this;
|
||||
l->dump_buffer = dump_buffer;
|
||||
}
|
||||
|
||||
void textlog_raw_time(logger *_this, int raw_time)
|
||||
{
|
||||
struct textlog *l = _this;
|
||||
l->raw_time = raw_time;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
#define DEFAULT_IP "127.0.0.1"
|
||||
#define DEFAULT_PORT 9999
|
||||
|
||||
#define DEFAULT_LIVE_IP "127.0.0.1"
|
||||
#define DEFAULT_LIVE_PORT 2021
|
||||
|
||||
#define NO_PREAMBLE -1
|
||||
|
||||
typedef struct {
|
||||
int socket;
|
||||
struct sockaddr_in to;
|
||||
@@ -28,11 +33,33 @@ typedef struct {
|
||||
int dl_frame;
|
||||
int dl_subframe;
|
||||
int dl_data;
|
||||
/* mib */
|
||||
int mib_frame;
|
||||
int mib_subframe;
|
||||
int mib_data;
|
||||
/* RA preamble */
|
||||
int preamble_frame;
|
||||
int preamble_subframe;
|
||||
int preamble_preamble;
|
||||
/* RAR */
|
||||
int rar_rnti;
|
||||
int rar_frame;
|
||||
int rar_subframe;
|
||||
int rar_data;
|
||||
/* config */
|
||||
int no_mib;
|
||||
int no_sib;
|
||||
int max_mib;
|
||||
int max_sib;
|
||||
int live;
|
||||
/* runtime vars */
|
||||
int cur_mib;
|
||||
int cur_sib;
|
||||
} ev_data;
|
||||
|
||||
void ul(void *_d, event e)
|
||||
void trace(ev_data *d, int direction, int rnti_type, int rnti,
|
||||
int frame, int subframe, void *buf, int bufsize, int preamble)
|
||||
{
|
||||
ev_data *d = _d;
|
||||
ssize_t ret;
|
||||
int fsf;
|
||||
int i;
|
||||
@@ -41,79 +68,124 @@ void ul(void *_d, event e)
|
||||
|
||||
PUTS(&d->buf, MAC_LTE_START_STRING);
|
||||
PUTC(&d->buf, FDD_RADIO);
|
||||
PUTC(&d->buf, DIRECTION_UPLINK);
|
||||
PUTC(&d->buf, C_RNTI);
|
||||
PUTC(&d->buf, direction);
|
||||
PUTC(&d->buf, rnti_type);
|
||||
|
||||
PUTC(&d->buf, MAC_LTE_RNTI_TAG);
|
||||
PUTC(&d->buf, (e.e[d->ul_rnti].i>>8) & 255);
|
||||
PUTC(&d->buf, e.e[d->ul_rnti].i & 255);
|
||||
if (rnti_type == C_RNTI || rnti_type == RA_RNTI) {
|
||||
PUTC(&d->buf, MAC_LTE_RNTI_TAG);
|
||||
PUTC(&d->buf, (rnti>>8) & 255);
|
||||
PUTC(&d->buf, rnti & 255);
|
||||
}
|
||||
|
||||
/* for newer version of wireshark? */
|
||||
fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i;
|
||||
fsf = (frame << 4) + subframe;
|
||||
/* for older version? */
|
||||
fsf = e.e[d->ul_subframe].i;
|
||||
//fsf = subframe;
|
||||
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
|
||||
PUTC(&d->buf, (fsf>>8) & 255);
|
||||
PUTC(&d->buf, fsf & 255);
|
||||
|
||||
if (preamble != NO_PREAMBLE) {
|
||||
PUTC(&d->buf, MAC_LTE_SEND_PREAMBLE_TAG);
|
||||
PUTC(&d->buf, preamble);
|
||||
PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */
|
||||
}
|
||||
|
||||
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
|
||||
for (i = 0; i < e.e[d->ul_data].bsize; i++)
|
||||
PUTC(&d->buf, ((char*)e.e[d->ul_data].b)[i]);
|
||||
for (i = 0; i < bufsize; 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));
|
||||
if (ret != d->buf.osize) abort();
|
||||
}
|
||||
|
||||
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,
|
||||
e.e[d->ul_data].b, e.e[d->ul_data].bsize,
|
||||
NO_PREAMBLE);
|
||||
}
|
||||
|
||||
void dl(void *_d, event e)
|
||||
{
|
||||
ev_data *d = _d;
|
||||
ssize_t ret;
|
||||
int fsf;
|
||||
int i;
|
||||
|
||||
d->buf.osize = 0;
|
||||
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++;
|
||||
}
|
||||
|
||||
PUTS(&d->buf, MAC_LTE_START_STRING);
|
||||
PUTC(&d->buf, FDD_RADIO);
|
||||
PUTC(&d->buf, DIRECTION_DOWNLINK);
|
||||
PUTC(&d->buf, C_RNTI);
|
||||
|
||||
PUTC(&d->buf, MAC_LTE_RNTI_TAG);
|
||||
PUTC(&d->buf, (e.e[d->dl_rnti].i>>8) & 255);
|
||||
PUTC(&d->buf, e.e[d->dl_rnti].i & 255);
|
||||
|
||||
/* for newer version of wireshark? */
|
||||
fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
|
||||
/* for older version? */
|
||||
fsf = e.e[d->dl_subframe].i;
|
||||
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
|
||||
PUTC(&d->buf, (fsf>>8) & 255);
|
||||
PUTC(&d->buf, fsf & 255);
|
||||
|
||||
PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG);
|
||||
for (i = 0; i < e.e[d->dl_data].bsize; i++)
|
||||
PUTC(&d->buf, ((char*)e.e[d->dl_data].b)[i]);
|
||||
|
||||
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
|
||||
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
|
||||
if (ret != d->buf.osize) abort();
|
||||
trace(d, DIRECTION_DOWNLINK,
|
||||
e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
|
||||
e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
|
||||
e.e[d->dl_data].b, e.e[d->dl_data].bsize,
|
||||
NO_PREAMBLE);
|
||||
}
|
||||
|
||||
void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
|
||||
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++;
|
||||
|
||||
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)
|
||||
{
|
||||
ev_data *d = _d;
|
||||
trace(d, DIRECTION_UPLINK, NO_RNTI, 0,
|
||||
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
|
||||
NULL, 0,
|
||||
e.e[d->preamble_preamble].i);
|
||||
}
|
||||
|
||||
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,
|
||||
e.e[d->rar_data].b, e.e[d->rar_data].bsize,
|
||||
NO_PREAMBLE);
|
||||
}
|
||||
|
||||
void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_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->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->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)) { \
|
||||
@@ -144,6 +216,37 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id)
|
||||
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;
|
||||
@@ -179,9 +282,20 @@ void usage(void)
|
||||
" -d <database file> this option is mandatory\n"
|
||||
" -i <dump file> read events from this dump file\n"
|
||||
" -ip <IP address> send packets to this IP address (default %s)\n"
|
||||
" -p <port> send packets to this port (default %d)\n",
|
||||
" -p <port> send packets to this port (default %d)\n"
|
||||
" -no-mib do not report MIB\n"
|
||||
" -no-sib do not report SIBs\n"
|
||||
" -max-mib <n> report at maximum n MIB\n"
|
||||
" -max-sib <n> report at maximum n SIBs\n"
|
||||
" -live run live\n"
|
||||
" -live-ip <IP address> tracee's IP address (default %p)\n"
|
||||
" -live-port <por> 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_PORT,
|
||||
DEFAULT_LIVE_IP,
|
||||
DEFAULT_LIVE_PORT
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
@@ -194,10 +308,13 @@ int main(int n, char **v)
|
||||
event_handler *h;
|
||||
int in;
|
||||
int i;
|
||||
int ul_id, dl_id;
|
||||
int ul_id, dl_id, mib_id = -1, preamble_id, rar_id;
|
||||
ev_data d;
|
||||
char *ip = DEFAULT_IP;
|
||||
int port = DEFAULT_PORT;
|
||||
char *live_ip = DEFAULT_LIVE_IP;
|
||||
int live_port = DEFAULT_LIVE_PORT;
|
||||
int live = 0;
|
||||
|
||||
memset(&d, 0, sizeof(ev_data));
|
||||
|
||||
@@ -209,6 +326,17 @@ int main(int n, char **v)
|
||||
{ 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();
|
||||
}
|
||||
|
||||
@@ -217,25 +345,59 @@ int main(int n, char **v)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (input_filename == NULL) {
|
||||
printf("ERROR: provide an input file (-i)\n");
|
||||
if (input_filename == NULL && live == 0) {
|
||||
printf("ERROR: provide an input file (-i) or run live (-live)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
in = open(input_filename, O_RDONLY);
|
||||
if (in == -1) { perror(input_filename); return 1; }
|
||||
if (input_filename != NULL && live != 0) {
|
||||
printf("ERROR: cannot use both -i and -live\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (live == 0) {
|
||||
in = open(input_filename, O_RDONLY);
|
||||
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); }
|
||||
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 ||
|
||||
socket_send(in, is_on, number_of_events * sizeof(int)) == -1) {
|
||||
printf("ERROR: socket_send failed\n");
|
||||
exit(1);
|
||||
}
|
||||
free(is_on);
|
||||
}
|
||||
|
||||
ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
|
||||
dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
|
||||
setup_data(&d, database, ul_id, dl_id);
|
||||
mib_id = event_id_from_name(database, "ENB_PHY_MIB");
|
||||
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); }
|
||||
@@ -253,7 +415,8 @@ int main(int n, char **v)
|
||||
event e;
|
||||
e = get_event(in, &ebuf, database);
|
||||
if (e.type == -1) break;
|
||||
if (!(e.type == ul_id || e.type == dl_id)) continue;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ void usage(void)
|
||||
" they will be processed in order\n"
|
||||
" by default, all is off\n"
|
||||
" -full also dump buffers' content\n"
|
||||
" -raw-time also prints 'raw time'\n"
|
||||
" -ip <host> connect to given IP address (default %s)\n"
|
||||
" -p <port> connect to given port (default %d)\n"
|
||||
" -x GUI output\n"
|
||||
@@ -91,6 +92,7 @@ int main(int n, char **v)
|
||||
int gui_active = 1;
|
||||
textlog_data textlog_data;
|
||||
int full = 0;
|
||||
int raw_time = 0;
|
||||
|
||||
/* write on a socket fails if the other end is closed and we get SIGPIPE */
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
|
||||
@@ -117,6 +119,7 @@ int main(int n, char **v)
|
||||
if (!strcmp(v[i], "-debug-gui")) { gui_logd = 1; continue; }
|
||||
if (!strcmp(v[i], "-no-gui")) { gui_active = 0; continue; }
|
||||
if (!strcmp(v[i], "-full")) { full = 1; continue; }
|
||||
if (!strcmp(v[i], "-raw-time")) { raw_time = 1; continue; }
|
||||
usage();
|
||||
}
|
||||
|
||||
@@ -162,6 +165,7 @@ int main(int n, char **v)
|
||||
// "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]");
|
||||
logger_add_view(textlog, out);
|
||||
if (full) textlog_dump_buffer(textlog, 1);
|
||||
if (raw_time) textlog_raw_time(textlog, 1);
|
||||
free(name);
|
||||
free(desc);
|
||||
}
|
||||
@@ -187,7 +191,7 @@ int main(int n, char **v)
|
||||
while (1) {
|
||||
event e;
|
||||
e = get_event(textlog_data.socket, &ebuf, database);
|
||||
if (e.type == -1) abort();
|
||||
if (e.type == -1) break;
|
||||
handle_event(h, e);
|
||||
}
|
||||
|
||||
|
||||
116
common/utils/telnetsrv/DOC/telnetaddcmd.md
Normal file
116
common/utils/telnetsrv/DOC/telnetaddcmd.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# code example of adding a command to the telnet server
|
||||
|
||||
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"
|
||||
|
||||
|
||||
/*
|
||||
define the null terminated array of telnetshell_cmddef_t structures
|
||||
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
|
||||
in `telnetsrv.h`
|
||||
*/
|
||||
static int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt);
|
||||
static telnetshell_cmddef_t coding_cmdarray[] = {
|
||||
{"mode","[sse,avx2,stdc,none]",coding_setmod_cmd},
|
||||
{"","",NULL},
|
||||
};
|
||||
|
||||
/*
|
||||
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
|
||||
of the telnet server
|
||||
*/
|
||||
telnetshell_vardef_t coding_vardef[] = {
|
||||
{"maxiter",TELNET_VARTYPE_INT32,&max_turbo_iterations},
|
||||
{"",0,NULL}
|
||||
};
|
||||
.................
|
||||
/*
|
||||
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"
|
||||
1. The `coding_cmdarray` list of "coding" sub-commands we defined earlier
|
||||
1. The `coding_varde f`list of variables we defined earlier
|
||||
*/
|
||||
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);
|
||||
.......
|
||||
/*
|
||||
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`
|
||||
command is received from the telnet client
|
||||
*/
|
||||
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.
|
||||
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
|
||||
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,
|
||||
*/
|
||||
if (debug > 0)
|
||||
prnt( "coding_setmod_cmd received %s\n",buff);
|
||||
|
||||
if (strcasestr(buff,"sse") != NULL) {
|
||||
decoding_setmode(MODE_DECODE_SSE);
|
||||
} else if (strcasestr(buff,"avx2") != NULL) {
|
||||
decoding_setmode(MODE_DECODE_AVX2);
|
||||
} else if (strcasestr(buff,"stdc") != NULL) {
|
||||
decoding_setmode(MODE_DECODE_C);
|
||||
} else if (strcasestr(buff,"none") != NULL) {
|
||||
decoding_setmode(MODE_DECODE_NONE);
|
||||
} else {
|
||||
prnt("%s: wrong setmod parameter...\n",buff);
|
||||
}
|
||||
prnt("Coding and decoding current mode: %s\n",modedesc[curmode]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
..............
|
||||
|
||||
```
|
||||
# telnet server API
|
||||
|
||||
```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).
|
||||
|
||||
# telnet server public data types
|
||||
## `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 |
|
||||
|:-----------|:------:|:-----------------------|
|
||||
| `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
|
||||
This structure is used by developers to describe the first level sub-commands to be added to the telnet server.
|
||||
|
||||
| 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)
|
||||
21
common/utils/telnetsrv/DOC/telnetarch.md
Normal file
21
common/utils/telnetsrv/DOC/telnetarch.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# telnet server principles
|
||||
|
||||
The oai telnet server is implemented in a shared library to be loaded by the [oai shared library loader](loader). The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader).
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
# 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.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\_\<XXX\>.c`: implementation of \<XXX\> CLI command which are delivered with the telnet server.
|
||||
1. `telnetsrv\_\<XXX\>.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)
|
||||
21
common/utils/telnetsrv/DOC/telnetgetset.md
Normal file
21
common/utils/telnetsrv/DOC/telnetgetset.md
Normal file
@@ -0,0 +1,21 @@
|
||||
getall command can be used to get the list of variables that can bet set or get from the telnet shell. Knowing the names of the variables they can then be set or read. Setting a variable is not always relevant, the telnet server doesn't provide a mechanism to restrict the set command.
|
||||
|
||||
```bash
|
||||
softmodem> telnet getall
|
||||
telnet, debug = 0
|
||||
telnet, prio = 0
|
||||
telnet, loopc = 10
|
||||
telnet, loopd = 5000
|
||||
telnet, phypb = 65000
|
||||
telnet, hsize = 50
|
||||
telnet, hfile = "oaitelnet.history"
|
||||
softmodem> telnet set loopc 100
|
||||
telnet, loopc set to
|
||||
100
|
||||
softmodem> telnet get loopc
|
||||
telnet, loopc = 100
|
||||
softmodem>
|
||||
|
||||
```
|
||||
[oai telnetserver home](telnetsrv.md)
|
||||
[oai telnetserver usage home](telnetusage.md)
|
||||
57
common/utils/telnetsrv/DOC/telnethelp.md
Normal file
57
common/utils/telnetsrv/DOC/telnethelp.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# oai telnet server global help
|
||||
|
||||
``` bash
|
||||
alblf@at8020-a:~$ telnet 10.133.10.77 9090
|
||||
Trying 10.133.10.77...
|
||||
Connected to 10.133.10.77.
|
||||
Escape character is '^]'.
|
||||
|
||||
softmodem> help
|
||||
module 0 = telnet:
|
||||
telnet [get set] debug <value>
|
||||
telnet [get set] prio <value>
|
||||
telnet [get set] loopc <value>
|
||||
telnet [get set] loopd <value>
|
||||
telnet [get set] phypb <value>
|
||||
telnet [get set] hsize <value>
|
||||
telnet [get set] hfile <value>
|
||||
telnet redirlog [here,file,off]
|
||||
telnet param [prio]
|
||||
telnet history [list,reset]
|
||||
module 1 = softmodem:
|
||||
softmodem show loglvl|thread|config
|
||||
softmodem log (enter help for details)
|
||||
softmodem thread (enter help for details)
|
||||
softmodem exit
|
||||
module 2 = phy:
|
||||
phy disp [phycnt,uedump,uestat UE<x>]
|
||||
module 3 = loader:
|
||||
loader [get set] mainversion <value>
|
||||
loader [get set] defpath <value>
|
||||
loader [get set] maxshlibs <value>
|
||||
loader [get set] numshlibs <value>
|
||||
loader show [params,modules]
|
||||
module 4 = coding:
|
||||
coding [get set] maxiter <value>
|
||||
coding mode [sse,avx2,stdc,none]
|
||||
softmodem>
|
||||
```
|
||||
|
||||
# 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_<level> id1-id2: set log level to <level> for components index id1 to id2
|
||||
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2
|
||||
use the show command to get the values for <level>, <verbosity> 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)
|
||||
44
common/utils/telnetsrv/DOC/telnethist.md
Normal file
44
common/utils/telnetsrv/DOC/telnethist.md
Normal file
@@ -0,0 +1,44 @@
|
||||
The telnet server implements a simple history system
|
||||
```bash
|
||||
softmodem> telnet history list
|
||||
1: telnet history list
|
||||
2: telnet history list
|
||||
3: help
|
||||
4: loader show modules
|
||||
5: softmodem show loglvl
|
||||
6: help
|
||||
7: telnet history
|
||||
8: help
|
||||
9: telnet history list
|
||||
10: help
|
||||
11: loader show modules
|
||||
12: softmodem show loglvl
|
||||
13: softmodem log help
|
||||
14: softmodem log disable 0-35
|
||||
15: softmodem log show
|
||||
16: help
|
||||
17: telnet history list
|
||||
18: loader show modules
|
||||
19: softmodem thread show
|
||||
20: help
|
||||
21: softmodem thread help
|
||||
22: softmodem log show
|
||||
23: softmodem log help
|
||||
24: softmodem log level_error 0-4
|
||||
25: loader show modules
|
||||
26: loader show config
|
||||
27: help
|
||||
28: loader show params
|
||||
29: loader show modules
|
||||
softmodem> !28
|
||||
softmodem> loader show params
|
||||
loader parameters:
|
||||
Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
|
||||
Default shared lib path: ""
|
||||
Max number of shared lib : 10
|
||||
softmodem>
|
||||
|
||||
```
|
||||
|
||||
[oai telnetserver home](telnetsrv.md)
|
||||
[oai telnetserver usage home](telnetusage.md)
|
||||
47
common/utils/telnetsrv/DOC/telnetloader.md
Normal file
47
common/utils/telnetsrv/DOC/telnetloader.md
Normal file
@@ -0,0 +1,47 @@
|
||||
loader command can be used to check loader configuration parameters and the list of loaded shared libraries and for each library the list of available functions.
|
||||
|
||||
```bash
|
||||
softmodem> loader show params
|
||||
loader parameters:
|
||||
Main executable build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
|
||||
Default shared lib path: ""
|
||||
Max number of shared lib : 10
|
||||
softmodem> loader show modules
|
||||
4 shared lib have been dynamicaly loaded by the oai loader
|
||||
Module 0: telnetsrv
|
||||
Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
|
||||
Shared library path: "libtelnetsrv.so"
|
||||
1 function pointers registered:
|
||||
function 0 add_telnetcmd at 0x7ff8b772a2b0
|
||||
Module 1: NB_IoT
|
||||
Shared library build version: ""
|
||||
Shared library path: "libNB_IoT.so"
|
||||
1 function pointers registered:
|
||||
function 0 RCConfig_NbIoT at 0x7ff8b6b1b390
|
||||
Module 2: coding
|
||||
Shared library build version: "Branch: develop-telnet-loader-fixes Abrev. Hash: e56ae69 Date: Fri Mar 9 16:47:08 2018 +0100"
|
||||
Shared library path: "libcoding.so"
|
||||
13 function pointers registered:
|
||||
function 0 init_td8 at 0x7ff8adde63a0
|
||||
function 1 init_td16 at 0x7ff8adde9760
|
||||
function 2 init_td16avx2 at 0x7ff8addec050
|
||||
function 3 phy_threegpplte_turbo_decoder8 at 0x7ff8adde6780
|
||||
function 4 phy_threegpplte_turbo_decoder16 at 0x7ff8adde9a90
|
||||
function 5 phy_threegpplte_turbo_decoder_scalar at 0x7ff8addef4a0
|
||||
function 6 phy_threegpplte_turbo_decoder16avx2 at 0x7ff8addec530
|
||||
function 7 free_td8 at 0x7ff8adde61d0
|
||||
function 8 free_td16 at 0x7ff8adde9590
|
||||
function 9 free_td16avx2 at 0x7ff8addebe80
|
||||
function 10 threegpplte_turbo_encoder_sse at 0x7ff8adde45b0
|
||||
function 11 threegpplte_turbo_encoder at 0x7ff8adde4a30
|
||||
function 12 init_encoder_sse at 0x7ff8adde49d0
|
||||
Module 3: oai_device
|
||||
Shared library build version: ""
|
||||
Shared library path: "liboai_device_usrp.so"
|
||||
1 function pointers registered:
|
||||
function 0 device_init at 0x7ff8ac16a7a0
|
||||
softmodem>
|
||||
```
|
||||
|
||||
[oai telnetserver home](telnetsrv.md)
|
||||
[oai telnetserver usage home](telnetusage.md)
|
||||
96
common/utils/telnetsrv/DOC/telnetlog.md
Normal file
96
common/utils/telnetsrv/DOC/telnetlog.md
Normal file
@@ -0,0 +1,96 @@
|
||||
The log command can be used to get the status of the log parameters and to dynamically modify these parameters. The log command has its own [help](telnethelp.md#oai-telnet-server-specific-commands-help)
|
||||
```bash
|
||||
softmodem> softmodem log disable 0-35
|
||||
log level/verbosity comp 0 PHY set to info / medium (disabled)
|
||||
log level/verbosity comp 1 MAC set to info / medium (disabled)
|
||||
log level/verbosity comp 2 EMU set to info / medium (disabled)
|
||||
log level/verbosity comp 3 OCG set to info / medium (disabled)
|
||||
log level/verbosity comp 4 OMG set to info / medium (disabled)
|
||||
log level/verbosity comp 5 OPT set to info / medium (disabled)
|
||||
log level/verbosity comp 6 OTG set to info / medium (disabled)
|
||||
log level/verbosity comp 7 OTG_LATENCY set to info / medium (disabled)
|
||||
log level/verbosity comp 8 OTG_LATENCY_BG set to info / medium (disabled)
|
||||
log level/verbosity comp 9 OTG_GP set to info / medium (disabled)
|
||||
log level/verbosity comp 10 OTG_GP_BG set to info / medium (disabled)
|
||||
log level/verbosity comp 11 OTG_JITTER set to info / medium (disabled)
|
||||
log level/verbosity comp 12 RLC set to info / medium (disabled)
|
||||
log level/verbosity comp 13 PDCP set to info / medium (disabled)
|
||||
log level/verbosity comp 14 RRC set to info / medium (disabled)
|
||||
log level/verbosity comp 15 NAS set to info / medium (disabled)
|
||||
log level/verbosity comp 16 PERF set to info / medium (disabled)
|
||||
log level/verbosity comp 17 OIP set to info / medium (disabled)
|
||||
log level/verbosity comp 18 CLI set to info / medium (disabled)
|
||||
log level/verbosity comp 19 MSC set to info / medium (disabled)
|
||||
log level/verbosity comp 20 OCM set to info / medium (disabled)
|
||||
log level/verbosity comp 21 UDP set to info / medium (disabled)
|
||||
log level/verbosity comp 22 GTPV1U set to info / medium (disabled)
|
||||
log level/verbosity comp 23 comp23? set to info / medium (disabled)
|
||||
log level/verbosity comp 24 S1AP set to info / medium (disabled)
|
||||
log level/verbosity comp 25 SCTP set to info / medium (disabled)
|
||||
log level/verbosity comp 26 HW set to info / medium (disabled)
|
||||
log level/verbosity comp 27 OSA set to info / medium (disabled)
|
||||
log level/verbosity comp 28 eRAL set to info / medium (disabled)
|
||||
log level/verbosity comp 29 mRAL set to info / medium (disabled)
|
||||
log level/verbosity comp 30 ENB_APP set to info / medium (disabled)
|
||||
log level/verbosity comp 31 FLEXRAN_AGENT set to info / medium (disabled)
|
||||
log level/verbosity comp 32 TMR set to info / medium (disabled)
|
||||
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
|
||||
component verbosity level enabled
|
||||
00 PHY: medium info N
|
||||
01 MAC: medium info N
|
||||
02 EMU: medium info N
|
||||
03 OCG: medium info N
|
||||
04 OMG: medium info N
|
||||
05 OPT: medium info N
|
||||
06 OTG: medium info N
|
||||
07 OTG_LATENCY: medium info N
|
||||
08 OTG_LATENCY_BG: medium info N
|
||||
09 OTG_GP: medium info N
|
||||
10 OTG_GP_BG: medium info N
|
||||
11 OTG_JITTER: medium info N
|
||||
12 RLC: medium info N
|
||||
13 PDCP: medium info N
|
||||
14 RRC: medium info N
|
||||
15 NAS: medium info N
|
||||
16 PERF: medium info N
|
||||
17 OIP: medium info N
|
||||
18 CLI: medium info N
|
||||
19 MSC: medium info N
|
||||
20 OCM: medium info N
|
||||
21 UDP: medium info N
|
||||
22 GTPV1U: medium info N
|
||||
23 comp23?: medium info N
|
||||
24 S1AP: medium info N
|
||||
25 SCTP: medium info N
|
||||
26 HW: medium info N
|
||||
27 OSA: medium info N
|
||||
28 eRAL: medium info N
|
||||
29 mRAL: medium info N
|
||||
30 ENB_APP: medium info N
|
||||
31 FLEXRAN_AGENT: medium info N
|
||||
32 TMR: medium info N
|
||||
33 USIM: medium info N
|
||||
34 LOCALIZE: medium info N
|
||||
35 RRH: medium info N
|
||||
36 comp36?: medium info Y
|
||||
37 LOADER: medium alert Y
|
||||
softmodem> softmodem log level_error 0-4
|
||||
log level/verbosity comp 0 PHY set to error / medium (enabled)
|
||||
log level/verbosity comp 1 MAC set to error / medium (enabled)
|
||||
log level/verbosity comp 2 EMU set to error / medium (enabled)
|
||||
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 usage home](telnetusage.md)
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
40
common/utils/telnetsrv/DOC/telnetloop.md
Normal file
40
common/utils/telnetsrv/DOC/telnetloop.md
Normal file
@@ -0,0 +1,40 @@
|
||||
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
|
||||
telnet, loopc = 10
|
||||
softmodem> telnet get loopd
|
||||
telnet, loopd = 2000
|
||||
softmodem> telnet set loopd 1000
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
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)
|
||||
7
common/utils/telnetsrv/DOC/telnetsrv.md
Normal file
7
common/utils/telnetsrv/DOC/telnetsrv.md
Normal file
@@ -0,0 +1,7 @@
|
||||
The oai embedded telnet server is an optional monitoring and debugging tool. It provides a simple Command Line Interface to the oai softmem. New commands can easily be added by developers to the telnet server.
|
||||
|
||||
* [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)
|
||||
39
common/utils/telnetsrv/DOC/telnetusage.md
Normal file
39
common/utils/telnetsrv/DOC/telnetusage.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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 \<oai repository\>/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.
|
||||
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:
|
||||
|
||||
* [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)
|
||||
|
||||
# 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.
|
||||
|
||||
| name | type | default | description | dynamic |
|
||||
|:---:|:---:|:---:|:----|:----:|
|
||||
| `listenaddr` | `ipV4 address, ascii format` | "0.0.0.0" | local address the server is listening on| N |
|
||||
| `listenport` | `integer` | 9090 | port number the server is listening on | N |
|
||||
| `loopcount` | `integer` | 10 | number of iterations for the loop command | Y |
|
||||
| `loopdelay` | `integer` | 5000 | delay (in ms) between 2 loop command iterations | Y |
|
||||
| `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)
|
||||
274
configuration/bladeRF/enb-band7-5mhz.conf
Normal file
274
configuration/bladeRF/enb-band7-5mhz.conf
Normal file
@@ -0,0 +1,274 @@
|
||||
Active_eNBs = ( "eNB-Eurecom-LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
# real_time choice in {hard, rt-preempt, no}
|
||||
real_time = "no";
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB-Eurecom-LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
plmn_list = (
|
||||
{ mcc = 208; mnc = 92; mnc_length = 2; }
|
||||
);
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
node_function = "eNodeB_3GPP";
|
||||
node_timing = "synch_to_ext_device";
|
||||
node_synch_ref = 0;
|
||||
nb_antenna_ports = 1;
|
||||
ue_TransmissionMode = 1;
|
||||
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_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
prach_root = 0;
|
||||
tx_gain = 90;
|
||||
rx_gain = 115;
|
||||
pbch_repetition = "FALSE";
|
||||
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_groupHoppingEnabled = "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 = -108;
|
||||
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;
|
||||
|
||||
//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 = "192.168.12.148";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.196/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth1";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.196/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.196/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="high";
|
||||
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 ="debug";
|
||||
rlc_log_verbosity ="high";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="high";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
MACRLCs = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_s_preference = "local_L1";
|
||||
tr_n_preference = "local_RRC";
|
||||
phy_test_mode = 0;
|
||||
puSch10xSnr = 210;
|
||||
puCch10xSnr = 210;
|
||||
}
|
||||
);
|
||||
|
||||
THREAD_STRUCT = (
|
||||
{
|
||||
parallel_config = "PARALLEL_RU_L1_TRX_SPLITaaaaaa";
|
||||
worker_config = "ENABLE";
|
||||
}
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
nb_tx = 1
|
||||
nb_rx = 1
|
||||
att_tx = 73
|
||||
att_rx = 0;
|
||||
bands = [7];
|
||||
max_pdschReferenceSignalPower = -28;
|
||||
max_rxgain = 96;
|
||||
eNB_instances = [0];
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="high";
|
||||
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 ="high";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="high";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
171
doc/FEATURE_SET.md
Normal file
171
doc/FEATURE_SET.md
Normal file
@@ -0,0 +1,171 @@
|
||||
**Table of Contents**
|
||||
|
||||
1. [OpenAirInterface eNB Feature Set](#openairinterface-enb-feature-set)
|
||||
1. [eNB PHY Layer](#enb-phy-layer)
|
||||
2. [eNB MAC Layer](#enb-mac-layer)
|
||||
3. [eNB RLC Layer](#enb-rlc-layer)
|
||||
4. [eNB PDCP Layer](#enb-pdcp-layer)
|
||||
5. [eNB RRC Layer](#enb-rrc-layer)
|
||||
6. [eNB X2AP](#enb-x2ap)
|
||||
7. [eNB Advanced Features](#enb-advanced-features)
|
||||
2. [OpenAirInterface UE Feature Set](#openairinterface-ue-feature-set)
|
||||
1. [LTE UE PHY Layer](#lte-ue-phy-layer)
|
||||
2. [LTE UE MAC Layer](#lte-ue-mac-layer)
|
||||
3. [LTE UE RLC Layer](#lte-ue-rlc-layer)
|
||||
4. [LTE UE PDCP Layer](#lte-ue-pdcp-layer)
|
||||
5. [LTE UE RRC Layer](#lte-ue-rrc-layer)
|
||||
|
||||
# OpenAirInterface Block diagram #
|
||||
|
||||

|
||||
|
||||
# OpenAirInterface eNB Feature Set #
|
||||
|
||||
## eNB PHY Layer ##
|
||||
|
||||
The Physical layer implements **3GPP 36.211**, **36.212**, **36.213** and provides the following features:
|
||||
|
||||
- LTE release 8.6 compliant, and implements a subset of release 10
|
||||
- FDD and TDD configurations: 1 (experimental) and 3
|
||||
- Bandwidth: 5, 10, and 20 MHz
|
||||
- Transmission modes: 1, 2 (stable), 3, 4, 5, 6, 7 (experimental)
|
||||
- Max number of antennas: 2
|
||||
- CQI/PMI reporting: aperiodic, feedback mode 3 - 0 and 3 - 1
|
||||
- PRACH preamble format 0
|
||||
- All downlink (DL) channels are supported: PSS, SSS, PBCH, PCFICH, PHICH, PDCCH, PDSCH, PMCH
|
||||
- All uplink (UL) channels are supported: PRACH, PUSCH, PUCCH (format 1/1a/1b), SRS, DRS
|
||||
- HARQ support (UL and DL)
|
||||
- Highly optimized base band processing (including turbo decoder)
|
||||
|
||||
### Performances ###
|
||||
|
||||
**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: 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: 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 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)
|
||||
|
||||
- Number of supported UEs: **To Be Completed**
|
||||
|
||||
## eNB MAC Layer ##
|
||||
|
||||
The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support of BCH, DLSCH, RACH, and ULSCH channels.
|
||||
|
||||
- RRC interface for CCCH, DCCH, and DTCH
|
||||
- Proportional fair scheduler (round robin scheduler soon)
|
||||
- DCI generation
|
||||
- HARQ Support
|
||||
- RA procedures and RNTI management
|
||||
- RLC interface (AM, UM)
|
||||
- UL power control
|
||||
- Link adaptation
|
||||
|
||||
## eNB RLC Layer ##
|
||||
|
||||
The RLC layer implements a full specification of the 3GPP 36.322 release v9.3.
|
||||
|
||||
- RLC TM (mainly used for BCCH and CCCH)
|
||||
* Neither segment nor concatenate RLC SDUs
|
||||
* Do not include a RLC header in the RLC PDU
|
||||
* Delivery of received RLC PDUs to upper layers
|
||||
- RLC UM (mainly used for DTCH)
|
||||
* Segment or concatenate RLC SDUs according to the TB size selected by MAC
|
||||
* Include a RLC header in the RLC PDU
|
||||
* Duplication detection
|
||||
* PDU reordering and reassembly
|
||||
- RLC AM, compatible with 9.3
|
||||
* Segmentation, re-segmentation, concatenation, and reassembly
|
||||
* Padding
|
||||
* Data transfer to the user
|
||||
* RLC PDU retransmission in support of error control and correction
|
||||
* Generation of data/control PDUs
|
||||
|
||||
## eNB PDCP Layer ##
|
||||
|
||||
The current PDCP layer is header compliant with **3GPP 36.323** Rel 10.1.0 and implements the following functions:
|
||||
|
||||
- User and control data transfer
|
||||
- Sequence number management
|
||||
- RB association with PDCP entity
|
||||
- PDCP entity association with one or two RLC entities
|
||||
- Integrity check and encryption using the AES and Snow3G algorithms
|
||||
|
||||
## eNB RRC Layer ##
|
||||
|
||||
The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following functions:
|
||||
|
||||
- System Information broadcast (SIB 1, 2, 3, and 13)
|
||||
* SIB1: Up to 6 PLMN IDs broadcast
|
||||
- RRC connection establishment
|
||||
- RRC connection reconfiguration (addition and removal of radio bearers, connection release)
|
||||
- RRC connection release
|
||||
- RRC connection re-establishment
|
||||
- Inter-frequency measurement collection and reporting (experimental)
|
||||
- eMBMS for multicast and broadcast (experimental)
|
||||
- Handover (experimental)
|
||||
- Paging (soon)
|
||||
|
||||
## eNB X2AP ##
|
||||
|
||||
The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following functions:
|
||||
|
||||
- X2 Setup Request
|
||||
- X2 Setup Response
|
||||
|
||||
## eNB Advanced Features ##
|
||||
|
||||
**To be completed**
|
||||
|
||||
# OpenAirInterface UE Feature Set #
|
||||
|
||||
## LTE UE PHY Layer ##
|
||||
|
||||
The Physical layer implements **3GPP 36.211**, **36.212**, **36.213** and provides the following features:
|
||||
|
||||
- LTE release 8.6 compliant, and implements a subset of release 10
|
||||
- FDD and TDD configurations: 1 (experimental) and 3
|
||||
- Bandwidth: 5, 10, and 20 MHz
|
||||
- Transmission modes: 1, 2 (stable)
|
||||
- Max number of antennas: 2
|
||||
- CQI/PMI reporting: aperiodic, feedback mode 3 - 0 and 3 - 1
|
||||
- PRACH preamble format 0
|
||||
- All downlink (DL) channels are supported: PSS, SSS, PBCH, PCFICH, PHICH, PDCCH, PDSCH, PMCH
|
||||
- All uplink (UL) channels are supported: PRACH, PUSCH, PUCCH (format 1/1a/1b), SRS, DRS
|
||||
|
||||
## LTE UE MAC Layer ##
|
||||
|
||||
The MAC layer implements a subset of the **3GPP 36.321** release v8.6 in support of BCH, DLSCH, RACH, and ULSCH channels.
|
||||
|
||||
- RRC interface for CCCH, DCCH, and DTCH
|
||||
- HARQ Support
|
||||
- RA procedures and RNTI management
|
||||
- RLC interface (AM, UM)
|
||||
- UL power control
|
||||
- Link adaptation
|
||||
|
||||
## LTE UE RLC Layer ##
|
||||
|
||||
The RLC layer implements a full specification of the 3GPP 36.322 release v9.3.
|
||||
|
||||
## LTE UE PDCP Layer ##
|
||||
|
||||
The current PDCP layer is header compliant with **3GPP 36.323** Rel 10.1.0.
|
||||
|
||||
## LTE UE RRC Layer ##
|
||||
|
||||
The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following functions:
|
||||
|
||||
- System Information decoding
|
||||
- RRC connection establishment
|
||||
BIN
doc/oai_enb_block_diagram.png
Normal file
BIN
doc/oai_enb_block_diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 271 KiB |
@@ -196,14 +196,12 @@ 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 td:%p te:%p if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->td, eNB->te, 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;
|
||||
eNB->td = ulsch_decoding_data_all;//(single_thread_flag==1) ? ulsch_decoding_data_2thread : ulsch_decoding_data;
|
||||
eNB->te = dlsch_encoding_all;//(single_thread_flag==1) ? dlsch_encoding_2threads : dlsch_encoding;
|
||||
|
||||
RC.nb_CC[bodge_counter] = 1;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
//#include "TDD-Config.h"
|
||||
//#include "MBSFN-SubframeConfigList.h"
|
||||
//#include "MobilityControlInfo.h"
|
||||
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
//#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
//#include "SCellToAddMod-r10.h"
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -59,14 +59,11 @@ void generate_qpsk_table(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void init_7_5KHz(void);
|
||||
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) {
|
||||
ccodelte_init();
|
||||
ccodelte_init_inv();
|
||||
init_dfts();
|
||||
phy_generate_viterbi_tables_lte();
|
||||
load_codinglib();
|
||||
lte_sync_time_init(frame_parms);
|
||||
generate_ul_ref_sigs();
|
||||
generate_ul_ref_sigs_rx();
|
||||
generate_64qam_table();
|
||||
@@ -76,13 +73,11 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) {
|
||||
init_unscrambling_lut();
|
||||
init_scrambling_lut();
|
||||
//set_taus_seed(1328);
|
||||
// init_7_5KHz();
|
||||
init_sss();
|
||||
}
|
||||
|
||||
void free_lte_top(void) {
|
||||
free_codinglib();
|
||||
lte_sync_time_free();
|
||||
/* free_ul_ref_sigs() is called in phy_free_lte_eNB() */
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "LTE_RadioResourceConfigCommonSIB.h"
|
||||
#include "LTE_RadioResourceConfigDedicated.h"
|
||||
#include "LTE_TDD-Config.h"
|
||||
#include "LTE_MBSFN-SubframeConfigList.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
@@ -182,7 +182,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
|
||||
fp->frame_type,
|
||||
RC.eNB[Mod_id][CC_id]->X_u);
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
fp->prach_emtc_config_common.prach_Config_enabled=1;
|
||||
|
||||
fp->prach_emtc_config_common.rootSequenceIndex = cfg->emtc_config.prach_catm_root_sequence_index.value;
|
||||
@@ -487,7 +487,7 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
|
||||
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
{
|
||||
uint16_t UE_id;
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated;
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated;
|
||||
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
|
||||
|
||||
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
|
||||
@@ -504,7 +504,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated) {
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
|
||||
eNB->pucch_config_dedicated[UE_id].ackNackRepetition=0;
|
||||
else {
|
||||
eNB->pucch_config_dedicated[UE_id].ackNackRepetition=1;
|
||||
@@ -563,7 +563,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->schedulingRequestConfig) {
|
||||
if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) {
|
||||
if (physicalConfigDedicated->schedulingRequestConfig->present == LTE_SchedulingRequestConfig_PR_setup) {
|
||||
eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
|
||||
eNB->scheduling_request_config[UE_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
|
||||
eNB->scheduling_request_config[UE_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
|
||||
@@ -578,7 +578,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
|
||||
eNB->soundingrs_ul_config_dedicated[UE_id].srsConfigDedicatedSetup = 1;
|
||||
eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
|
||||
@@ -729,7 +729,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -825,7 +825,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
|
||||
|
||||
prach_vars->rxsigF[0] = (int16_t**)malloc16_clear(64*sizeof(int16_t*));
|
||||
// PRACH BR
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
prach_vars_br->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int32_t) );
|
||||
|
||||
// assume maximum of 64 RX antennas for PRACH receiver
|
||||
@@ -893,7 +893,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
|
||||
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
|
||||
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
|
||||
#endif
|
||||
int i, UE_id;
|
||||
@@ -926,7 +926,7 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
|
||||
free_and_zero(prach_vars->prach_ifft[0]);
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (int ce_level = 0; ce_level < 4; ce_level++) {
|
||||
for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
|
||||
free_and_zero(prach_vars_br->prach_ifft[ce_level]);
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "LTE_RadioResourceConfigCommonSIB.h"
|
||||
#include "LTE_RadioResourceConfigDedicated.h"
|
||||
#include "LTE_TDD-Config.h"
|
||||
#include "LTE_MBSFN-SubframeConfigList.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
@@ -67,6 +67,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
|
||||
}
|
||||
if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
|
||||
init_dfts();
|
||||
init_7_5KHz();
|
||||
LOG_I(PHY,"nb_tx %d\n",ru->nb_tx);
|
||||
ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
|
||||
@@ -101,7 +102,7 @@ int phy_init_RU(RU_t *ru) {
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j=0;j<4;j++) {
|
||||
ru->prach_rxsigF_br[j][i] = (int16_t*)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars_br->rxsigF[%d] = %p\n",i,ru->prach_rxsigF_br[j][i]);
|
||||
@@ -179,7 +180,7 @@ void phy_free_RU(RU_t *ru)
|
||||
|
||||
for (i = 0; i < ru->nb_rx; i++) {
|
||||
free_and_zero(ru->prach_rxsigF[i]);
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,13 +23,14 @@
|
||||
#include "SCHED_UE/sched_UE.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "LTE_RadioResourceConfigCommonSIB.h"
|
||||
#include "LTE_RadioResourceConfigDedicated.h"
|
||||
#include "LTE_TDD-Config.h"
|
||||
#include "LTE_MBSFN-SubframeConfigList.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
@@ -41,7 +42,7 @@ extern uint8_t nfapi_mode;
|
||||
|
||||
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
TDD_Config_t *tdd_Config,
|
||||
LTE_TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
uint16_t SIperiod)
|
||||
{
|
||||
@@ -59,11 +60,11 @@ void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
|
||||
|
||||
void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
LTE_ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
|
||||
LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
@@ -114,7 +115,7 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present == LTE_SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
|
||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
|
||||
@@ -159,19 +160,19 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
|
||||
fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
|
||||
|
||||
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
|
||||
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
|
||||
fp->MBSFN_config[i].fourFrames_flag = 0;
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
|
||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
||||
LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
|
||||
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == LTE_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
|
||||
fp->MBSFN_config[i].fourFrames_flag = 1;
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig =
|
||||
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
|
||||
|
||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", i,
|
||||
LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is %x\n", i,
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
}
|
||||
}
|
||||
@@ -203,11 +204,11 @@ void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_A
|
||||
/*
|
||||
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
|
||||
*/
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
{
|
||||
|
||||
if(mobilityControlInfo!=NULL) {
|
||||
RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
|
||||
LTE_RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
|
||||
LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
|
||||
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho,
|
||||
(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,
|
||||
@@ -264,7 +265,7 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobi
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present == LTE_SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
|
||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
|
||||
@@ -344,10 +345,10 @@ void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8
|
||||
|
||||
}
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
LTE_SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
int CC_id)
|
||||
{
|
||||
|
||||
@@ -366,7 +367,7 @@ void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
extern uint16_t beta_cqi[16];
|
||||
|
||||
void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated )
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated )
|
||||
{
|
||||
|
||||
static uint8_t first_dedicated_configuration = 0;
|
||||
@@ -396,7 +397,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated) {
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present==PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
|
||||
if (physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.present == LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release)
|
||||
phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=0;
|
||||
else {
|
||||
phy_vars_ue->pucch_config_dedicated[eNB_id].ackNackRepetition=1;
|
||||
@@ -448,25 +449,25 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
|
||||
LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]);
|
||||
switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
|
||||
case AntennaInfoDedicated__transmissionMode_tm1:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm1:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 1;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm2:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm2:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 2;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm3:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm3:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 3;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm4:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm4:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 4;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm5:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm5:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 5;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm6:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm6:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 6;
|
||||
break;
|
||||
case AntennaInfoDedicated__transmissionMode_tm7:
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm7:
|
||||
lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 7;
|
||||
break;
|
||||
@@ -479,7 +480,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->schedulingRequestConfig) {
|
||||
if (physicalConfigDedicated->schedulingRequestConfig->present == SchedulingRequestConfig_PR_setup) {
|
||||
if (physicalConfigDedicated->schedulingRequestConfig->present == LTE_SchedulingRequestConfig_PR_setup) {
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
|
||||
@@ -496,7 +497,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
|
||||
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift;
|
||||
@@ -525,14 +526,14 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
|
||||
}
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) {
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_setup) {
|
||||
// configure PUCCH CQI reporting
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
|
||||
}
|
||||
else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) {
|
||||
else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_release) {
|
||||
// handle release
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
|
||||
@@ -661,8 +662,9 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
|
||||
|
||||
|
||||
|
||||
init_dfts();
|
||||
init_frame_parms(&ue->frame_parms,1);
|
||||
lte_sync_time_init(&ue->frame_parms);
|
||||
init_lte_top(&ue->frame_parms);
|
||||
init_7_5KHz();
|
||||
init_ul_hopping(&ue->frame_parms);
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
|
||||
#include "SystemInformationBlockType2.h"
|
||||
#include "LTE_SystemInformationBlockType2.h"
|
||||
//#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "PHICH-Config.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "MobilityControlInfo.h"
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#include "SCellToAddMod-r10.h"
|
||||
#include "LTE_RadioResourceConfigDedicated.h"
|
||||
#include "LTE_TDD-Config.h"
|
||||
#include "LTE_PHICH-Config.h"
|
||||
#include "LTE_MBSFN-SubframeConfigList.h"
|
||||
#include "LTE_MobilityControlInfo.h"
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#include "LTE_SCellToAddMod-r10.h"
|
||||
#endif
|
||||
/** @addtogroup _PHY_STRUCTURES_
|
||||
* @{
|
||||
@@ -110,7 +110,7 @@ void phy_config_mib_eNB(int Mod_id,
|
||||
int CC_id,
|
||||
int eutra_band,
|
||||
int N_RB_DL,
|
||||
PHICH_Config_t *phich_config,
|
||||
LTE_PHICH_Config_t *phich_config,
|
||||
int Nid_cell,
|
||||
int Ncp,
|
||||
int p_eNB,
|
||||
@@ -128,7 +128,7 @@ void phy_config_mib_eNB(int Mod_id,
|
||||
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
|
||||
void phy_config_sib1_eNB(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
TDD_Config_t *tdd_Config,
|
||||
LTE_TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
uint16_t SIperiod);
|
||||
|
||||
@@ -143,7 +143,7 @@ void phy_config_sib1_eNB(module_id_t Mod_id,
|
||||
void phy_config_sib1_ue(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
uint8_t CH_index,
|
||||
TDD_Config_t *tdd_Config,
|
||||
LTE_TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
uint16_t SIperiod);
|
||||
|
||||
@@ -166,14 +166,14 @@ void phy_config_sib1_ue(module_id_t Mod_id,
|
||||
@param additionalSpectrumEmission UL parameter (see 36.101)
|
||||
@param mbsfn_SubframeConfigList MBSFN subframe configuration
|
||||
*/
|
||||
void phy_config_sib2_ue(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
uint8_t CH_index,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
|
||||
void phy_config_sib2_ue(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
uint8_t CH_index,
|
||||
LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -188,7 +188,7 @@ void phy_config_sib2_ue(module_id_t Mod_id,
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,
|
||||
uint8_t CC_id,
|
||||
uint8_t eNB_index,
|
||||
MobilityControlInfo_t *mobilityControlInfo,
|
||||
LTE_MobilityControlInfo_t *mobilityControlInfo,
|
||||
uint8_t ho_failed);
|
||||
/*!
|
||||
\fn void phy_config_sib2_eNB(module_id_t Mod_id,
|
||||
@@ -206,13 +206,13 @@ void phy_config_afterHO_ue(module_id_t Mod_id,
|
||||
@param additionalSpectrumEmission UL parameter (see 36.101)
|
||||
@param mbsfn_SubframeConfigList MBSFN subframe configuration
|
||||
*/
|
||||
void phy_config_sib2_eNB(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
|
||||
void phy_config_sib2_eNB(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
|
||||
LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -229,7 +229,7 @@ void phy_config_sib2_eNB(module_id_t Mod_id,
|
||||
void phy_config_dedicated_ue(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
uint8_t CH_index,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated);
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated);
|
||||
|
||||
/*!
|
||||
\fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
|
||||
@@ -308,7 +308,7 @@ void phy_config_meas_ue(module_id_t Mod_id,
|
||||
void phy_config_dedicated_eNB(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
rnti_t rnti,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated);
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated);
|
||||
|
||||
/*!
|
||||
\fn void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB)
|
||||
@@ -349,15 +349,15 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
uint32_t perfect_ce);
|
||||
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
LTE_SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
int CC_id);
|
||||
|
||||
void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
|
||||
uint16_t rnti,
|
||||
SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
LTE_SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
int CC_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -121,7 +121,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
(aggregation_level==2) ||
|
||||
(aggregation_level==4) ||
|
||||
(aggregation_level==8)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) // Added for EPDCCH/MPDCCH
|
||||
||
|
||||
(aggregation_level==16) ||
|
||||
(aggregation_level==24) ||
|
||||
|
||||
@@ -60,7 +60,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN);
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
// Rule for accumulation of subframes for BL/CE UEs
|
||||
uint8_t Nacc=4;
|
||||
uint16_t j0,j,idelta;
|
||||
@@ -97,7 +97,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
// reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
if (mbsfn_flag == 0) {
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#ifdef PHY_TX_THREAD
|
||||
if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) {
|
||||
#else
|
||||
@@ -115,7 +115,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
#else
|
||||
printf("scrambling: rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2);
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) {
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
|
||||
int32_t **txdataF = ru->common.txdataF_BF;
|
||||
int32_t **rxdataF = ru->common.rxdataF;
|
||||
int16_t **prach_rxsigF = ru->prach_rxsigF;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
|
||||
#endif
|
||||
void *tx_buffer = ru->ifbuffer.tx[subframe&1];
|
||||
@@ -221,7 +221,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
|
||||
|
||||
int16_t *rxF;
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (packet_type > IF4p5_PRACH)
|
||||
rxF = &prach_rxsigF_br[packet_type - IF4p5_PRACH - 1][0][0];
|
||||
else
|
||||
@@ -262,7 +262,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
|
||||
int32_t **txdataF = ru->common.txdataF_BF;
|
||||
int32_t **rxdataF = ru->common.rxdataF;
|
||||
int16_t **prach_rxsigF = ru->prach_rxsigF;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
|
||||
#endif
|
||||
void *rx_buffer = ru->ifbuffer.rx;
|
||||
@@ -359,7 +359,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
|
||||
|
||||
int16_t *rxF;
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (*packet_type > IF4p5_PRACH)
|
||||
rxF = &prach_rxsigF_br[*packet_type - IF4p5_PRACH - 1][0][0];
|
||||
else
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "prach_extern.h"
|
||||
|
||||
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0))
|
||||
#define rx_prach0 rx_prach
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint16_t *max_preamble_delay,
|
||||
uint16_t Nf,
|
||||
uint8_t tdd_mapindex
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,uint8_t br_flag,
|
||||
uint8_t ce_level
|
||||
#endif
|
||||
@@ -95,7 +95,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
|
||||
int32_t *prach_ifft=(int32_t*)NULL;
|
||||
int32_t **prach_ifftp=(int32_t **)NULL;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int prach_ifft_cnt=0;
|
||||
#endif
|
||||
|
||||
@@ -112,7 +112,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
|
||||
frame_type = fp->frame_type;
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
AssertFatal(fp->prach_emtc_config_common.prach_Config_enabled==1,
|
||||
"emtc prach_Config is not enabled\n");
|
||||
@@ -147,7 +147,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint16_t N_ZC = (prach_fmt <4)?839:139;
|
||||
|
||||
if (eNB) {
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level];
|
||||
subframe = eNB->proc.subframe_prach_br;
|
||||
@@ -174,7 +174,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
subframe = ru->proc.subframe_prach_br;
|
||||
rxsigF = ru->prach_rxsigF_br[ce_level];
|
||||
@@ -425,7 +425,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if ((eNB==NULL) && (ru!=NULL) && ru->function == NGFI_RRU_IF4p5) {
|
||||
|
||||
/// **** send_IF4 of rxsigF to RAU **** ///
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level);
|
||||
|
||||
else
|
||||
@@ -570,7 +570,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
if (new_dft == 1) {
|
||||
new_dft = 0;
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) {
|
||||
Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx];
|
||||
prach_ifft = prach_ifftp[prach_ifft_cnt++];
|
||||
@@ -627,7 +627,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
} // new dft
|
||||
|
||||
// check energy in nth time shift, for
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if ((br_flag==0) ||
|
||||
(eNB->prach_vars_br.repetition_number[ce_level]==
|
||||
eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]))
|
||||
@@ -694,7 +694,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
|
||||
}
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
void rx_prach(PHY_VARS_eNB *eNB,
|
||||
RU_t *ru,
|
||||
@@ -736,4 +736,4 @@ void rx_prach(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */
|
||||
#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user