Skip to content

Commit

Permalink
Update supported ns-3 version to 3.42 (#169)
Browse files Browse the repository at this point in the history
* Change deprecated EventId::IsRunning to IsPending

* Import nested energy namespace where necessary

* Refactor to Duration and Type enums in tests

* Fix compilation error caused by a 'Schedule' of a 'Callback' type function
- Introduce TxFinished function in LoraPhy for signaling transmission end.
- Probably related to: https://gitlab.com/nsnam/ns-3-dev/-/issues/1060#note_1847298087 (matching error)

* Bump supported ns-3 version to 3.42

* Fix spelling

* Fix linting

* Fix cmake formatting + add related job to the CI

* CI: update per-commit pipeline to ns-3.42

* CI: add ns-3 version disclaimer to logs

* CI: simplify dependencies where possible

* CI: rename tests placeholder file

* CI: produce doxygen warning artifact only on failure

* CI: fix workflow code formatting and make all dispatchable

* CI: try github pages
  • Loading branch information
non-det-alle authored Jul 26, 2024
1 parent b866c0b commit febdbb3
Show file tree
Hide file tree
Showing 29 changed files with 165 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ runs:
echo "CACHE_MISS=`./utils/ccache-miss-rate.py`" >> $GITHUB_ENV
echo "REF_NAME=`echo $GITHUB_REF_NAME | sed -r 's/[/]+/-/g'`" >> $GITHUB_ENV
echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
touch build/tests-base.txt
touch build/tests-base-artifact-placeholder.txt
- if: env.CACHE_MISS != '0'
name: "Create tests placeholder"
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/checkout-in-ns3/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ runs:
tag=$(< src/lorawan/NS3-VERSION) && tag=${tag#release }
wget -nv -O ns-3-dev.tar https://gitlab.com/api/v4/projects/nsnam%2Fns-3-dev/repository/archive.tar?sha=$tag
tar -xf ns-3-dev.tar && cp -a ns-3-dev-$tag-*/. . && rm -R ns-3-dev.tar ns-3-dev-$tag*
echo
echo "###################################################"
echo "###### WARNING! CURRENT NS-3 VERSION: $tag ######"
echo "###################################################"
shell: bash
1 change: 0 additions & 1 deletion .github/actions/install-analysis/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ runs:
sudo apt update && DEBIAN_FRONTEND=noninteractive sudo apt install -y
apt-utils
git gcc g++ cmake python3 make ninja-build
tcpdump libgsl-dev libxml2-dev
curl unzip tar
ccache
lcov
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/install-doc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ runs:
shell: bash
run: >
pacman-key --init && pacman -Syu --noconfirm
base-devel ninja cmake python ccache gsl gtk3 boost openssh
base-devel ninja cmake python ccache
graphviz imagemagick texlive-basic texlive-bin texlive-binextra texlive-latexextra
texlive-fontutils texlive-fontsrecommended python-sphinx
texlive-fontutils texlive-fontsrecommended python-sphinx
wget &&
pacman --noconfirm -U https://archive.archlinux.org/packages/d/dia/dia-0.97.3-9-x86_64.pkg.tar.zst &&
pacman --noconfirm -U https://archive.archlinux.org/packages/d/doxygen/doxygen-1.9.6-1-x86_64.pkg.tar.zst &&
Expand Down
5 changes: 1 addition & 4 deletions .github/actions/install-linting/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ runs:
apt update && DEBIAN_FRONTEND=noninteractive apt install -y
clang cmake
clang-tidy clang-tidy-17
libboost-all-dev libeigen3-dev libgtk-3-dev libsqlite3-dev
gsl-bin libgsl-dev libgsl27
git ssh
wget
git wget
- name: "Checkout this repository as ns-3 module"
uses: ./.github/actions/checkout-in-ns3
9 changes: 4 additions & 5 deletions .github/actions/install-per-commit/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Note: this action requires an archlinux container, specific inputs and access to the repos's actions!
# (see .base-per-commit.yml)
# (see per-commit.yml)
name: "install-per-commit"
description: "Installs required archlinux packages and checks-out the repo in ns-3"

Expand All @@ -10,9 +10,7 @@ runs:
shell: bash
run: >
pacman-key --init && pacman -Syu --noconfirm
base-devel gcc clang cmake ninja ccache
boost gsl gtk3
openssh
base-devel gcc clang libc++ cmake ninja ccache
python
wget
- name: "Checkout this repository as ns-3 module"
Expand All @@ -21,4 +19,5 @@ runs:
shell: bash
run: |
EXTRA_ID=`echo $EXTRA_OPTIONS | sed 's/--/-/g' | sed 's/ //g'`
echo "BUILD_ID=per-commit-$COMPILER-$MODE$EXTRA_ID" >> $GITHUB_ENV
FLAGS_ID=`echo $CXXFLAGS | sed 's/--/-/g' | sed 's/-\?[a-zA-Z0-9+-.]\+=/-/g' | sed 's/ //g'`
echo "BUILD_ID=per-commit-$COMPILER-$MODE$EXTRA_ID$FLAGS_ID" >> $GITHUB_ENV
32 changes: 22 additions & 10 deletions .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
deploy-doc:
build:
runs-on: ubuntu-latest
container:
image: archlinux
Expand All @@ -32,13 +32,25 @@ jobs:
store-artifacts: "false"
- name: "Build documentation"
run: ./ns3 docs all
- name: "Deploy documentation"
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
uses: cpina/github-action-push-to-another-repository@main
- name: "Upload pages artifact"
uses: actions/upload-pages-artifact@v3
with:
source-directory: "doc/"
destination-github-username: "signetlabdei"
destination-repository-name: "lorawan-docs"
user-email: paginmatte@dei.unipd.it
target-branch: master
path: "doc/html/"

deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
name: "Check code formatting"
run-name: "formatting"

on: workflow_call
on:
workflow_call:
workflow_dispatch:

jobs:
# Clang-format
Expand All @@ -24,7 +26,7 @@ jobs:
sparse-checkout: .github/actions
- name: "Install required system packages"
run: >
apt update && DEBIAN_FRONTEND=noninteractive apt install -y
apt update && DEBIAN_FRONTEND=noninteractive apt install -y
python3
clang-format-${{ matrix.version }}
wget
Expand Down Expand Up @@ -68,3 +70,22 @@ jobs:
- run: git log --pretty=%B HEAD...upstream/develop ^upstream/develop > git_messages.txt
# Check source code and commit messages
- run: codespell -f -C0 --skip="./experiments" ./

# CMake formatting
cmake-format:
runs-on: ubuntu-latest
container:
image: python:latest
timeout-minutes: 60
steps:
# The following step is required in all jobs that use this repo's actions
- name: "Retrieve actions from repository"
uses: actions/checkout@v4
with:
sparse-checkout: .github/actions
- run: pip install pyyaml cmake cmake-format ninja wget
- name: "Checkout this repository as ns-3 module"
uses: ./.github/actions/checkout-in-ns3
- run: |
./ns3 configure --enable-modules=core
./ns3 build cmake-format-check
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
name: "Check code linting"
run-name: "linting"

on: workflow_call
on:
workflow_call:
workflow_dispatch:

jobs:
# Clang-tidy
Expand Down Expand Up @@ -34,7 +36,7 @@ jobs:
shell: bash
run: >
git -C src/lorawan/ tag empty $(git hash-object -t tree /dev/null) &&
git -C src/lorawan/ diff -U0 empty
git -C src/lorawan/ diff -U0 empty
--src-prefix=a/src/lorawan/ --dst-prefix=b/src/lorawan/ |
clang-tidy-diff-17.py -path cmake-cache/ -p1 -quiet -use-color
-iregex "src\/lorawan\/.+\.(cpp|cc|cxx|c|h|hpp)"
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/per-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
code-formatting:
uses: ./.github/workflows/.formatting.yml
uses: ./.github/workflows/formatting.yml

compile:
needs: code-formatting
Expand All @@ -20,24 +20,30 @@ jobs:
timeout-minutes: 720
strategy:
matrix:
compiler: [g++]
mode: [default, optimized]
stage: [test]
include:
- compiler: clang++
mode: debug
mode: optimized
cxxflags: -stdlib=libc++
stage: test
- compiler: g++
mode: debug
- compiler: g++ # this job is the longest (~ 30 min)
- compiler: g++
mode: default
stage: test
- compiler: g++
mode: optimized
stage: test
- compiler: g++
mode: debug
extra_options: --disable-precompiled-headers
- compiler: g++
- compiler: clang++
mode: debug
extra_options: --disable-asserts
extra_options: --disable-asserts --disable-logs
env:
COMPILER: ${{ matrix.compiler }}
MODE: ${{ matrix.mode }}
EXTRA_OPTIONS: ${{ matrix.extra_options }}
CXXFLAGS: ${{ matrix.cxxflags }}
steps:
# The following step is required in all jobs that use this repo's actions
- name: "Retrieve actions from repository"
Expand All @@ -54,11 +60,11 @@ jobs:

code-linting:
needs: compile
uses: ./.github/workflows/.linting.yml
uses: ./.github/workflows/linting.yml

documentation:
needs: code-linting
uses: ./.github/workflows/.test-doc.yml
uses: ./.github/workflows/test-doc.yml

code-analysis:
needs: documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name: "Test documentation"
run-name: "test-doc"

on: workflow_call
on:
workflow_call:
workflow_dispatch:

jobs:
doxygen:
Expand Down Expand Up @@ -36,7 +38,7 @@ jobs:
./ns3 clean
doxygen -v
- name: "Upload doxygen warnings as artifact"
if: always()
if: failure()
uses: actions/upload-artifact@v4
with:
name: doxygen.warnings.log
Expand Down
2 changes: 1 addition & 1 deletion NS3-VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release ns-3.41
release ns-3.42
39 changes: 16 additions & 23 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,62 +1,55 @@
build_lib_example(
NAME simple-network-example
SOURCE_FILES simple-network-example.cc
LIBRARIES_TO_LINK
${libcore} ${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME network-server-example
SOURCE_FILES network-server-example.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME complete-network-example
SOURCE_FILES complete-network-example.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME adr-example
SOURCE_FILES adr-example.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME lorawan-energy-model-example
SOURCE_FILES lorawan-energy-model-example.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME aloha-throughput
SOURCE_FILES aloha-throughput.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME parallel-reception-example
SOURCE_FILES parallel-reception-example.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)

build_lib_example(
NAME frame-counter-update
SOURCE_FILES frame-counter-update.cc
LIBRARIES_TO_LINK
${libcore}
${liblorawan}
LIBRARIES_TO_LINK ${libcore}
${liblorawan}
)
2 changes: 1 addition & 1 deletion examples/aloha-throughput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ NS_LOG_COMPONENT_DEFINE("AlohaThroughput");
// Network settings
int nDevices = 200; //!< Number of end device nodes to create
int nGateways = 1; //!< Number of gateway nodes to create
double radiusMeters = 1000; //!< Radius (m) of the deplyoment
double radiusMeters = 1000; //!< Radius (m) of the deployment
double simulationTimeSeconds = 100; //!< Scenario duration (s) in simulated time

// Channel model
Expand Down
2 changes: 1 addition & 1 deletion examples/complete-network-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ NS_LOG_COMPONENT_DEFINE("ComplexLorawanNetworkExample");
// Network settings
int nDevices = 200; //!< Number of end device nodes to create
int nGateways = 1; //!< Number of gateway nodes to create
double radiusMeters = 6400; //!< Radius (m) of the deplyoment
double radiusMeters = 6400; //!< Radius (m) of the deployment
double simulationTimeSeconds = 600; //!< Scenario duration (s) in simulated time

// Channel model
Expand Down
2 changes: 0 additions & 2 deletions model/class-a-end-device-lorawan-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ ClassAEndDeviceLorawanMac::CloseFirstReceiveWindow()
break;
case EndDeviceLoraPhy::RX:
// PHY is receiving: let it finish. The Receive method will switch it back to SLEEP.
break;
case EndDeviceLoraPhy::SLEEP:
// PHY has received, and the MAC's Receive already put the device to sleep
break;
Expand Down Expand Up @@ -400,7 +399,6 @@ ClassAEndDeviceLorawanMac::CloseSecondReceiveWindow()
switch (phy->GetState())
{
case EndDeviceLoraPhy::TX:
break;
case EndDeviceLoraPhy::SLEEP:
break;
case EndDeviceLoraPhy::RX:
Expand Down
Loading

0 comments on commit febdbb3

Please sign in to comment.