Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evolved5g #1

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ac2cfc3
test netapp over simulator
SeaingAnt Oct 25, 2021
8676660
Update README.md
SeaingAnt Oct 25, 2021
96ea983
Update README.md
SeaingAnt Oct 25, 2021
1a9ff27
verison with monitoring callback
SeaingAnt Dec 7, 2021
278e3bf
Merge branch 'evolved5g' of github.com:EVOLVED-5G/LocalizationNetApp …
SeaingAnt Dec 7, 2021
2fbebbc
evolvedApi moved out
SeaingAnt Dec 15, 2021
8fa530a
Update Readme
SeaingAnt Jan 24, 2022
4bf55c9
sdk integrated
SeaingAnt Jan 27, 2022
2f97fac
Dokcerfile updated
SeaingAnt Jan 31, 2022
d5d68a4
Update README.md
SeaingAnt Jan 31, 2022
9b0a167
Update README.md
Feb 15, 2022
a35a85a
Update README.md with docker commands
Feb 15, 2022
d632cbb
Added pip_dependencies file to solve library version mismatch
biancabnd Oct 5, 2022
7c8cd03
Add NEF host as parameter
biancabnd Oct 7, 2022
9458014
Expose NEF HOST, NEF PORT and UE external id as params
biancabnd Oct 17, 2022
01370df
Correct typo in netapp id
biancabnd Oct 17, 2022
56f7c3d
Add NEF port in cellid + rollback previous change
biancabnd Nov 2, 2022
eff9a9d
Fix sdk version to 0.8.2
biancabnd Nov 2, 2022
677ad59
Remove evolved5g from pip install
biancabnd Nov 2, 2022
3acc0d2
Add cellid port as variable
biancabnd Nov 2, 2022
c0ecfed
Fix the version of all python packages
biancabnd Nov 2, 2022
5e795e1
Add debugging msg for cellid type
biancabnd Nov 2, 2022
5397c4f
Add external UE id to ros publisher
biancabnd Nov 3, 2022
bd01330
Add debug msg + generalized monitoring callback path
biancabnd Nov 3, 2022
9c71ac8
Debugging session - uncomment timer callback
biancabnd Nov 7, 2022
aaae0fd
Capif integration version - tested locally
biancabnd Nov 8, 2022
a1e34a7
Upgrade SDK to 0.8.7 + configure capif host for openshift
biancabnd Nov 30, 2022
8065346
Expose capif host and ports as environmental variables + fix wrong en…
biancabnd Dec 2, 2022
063432b
Adapt env variables to standard convention + other changes based on M…
biancabnd Dec 13, 2022
7c8b6fb
Merge branch 'v3' into evolved5g
biancabnd Dec 13, 2022
dc5b304
Create capif_onboarding folder in dockerfile
biancabnd Dec 14, 2022
fd2a108
Create cfg folder in dockerfile
biancabnd Dec 14, 2022
080358a
Fix error of removing capif_registration.json file
biancabnd Dec 14, 2022
9b96302
Fix typo + add more informative name on capif_registration
biancabnd Feb 3, 2023
51c110c
Fix typo
biancabnd Feb 3, 2023
44909ef
Change ports and adapt network app to match newer versions
biancabnd Mar 14, 2023
2b0af2c
Add multiple users to the localization subscription
biancabnd May 16, 2023
da89176
Separate ROS specific entrypoints + add ROS specific env variables + …
biancabnd May 16, 2023
30f6222
Adapt network app for new sdk changes v1.1.0
biancabnd Jun 15, 2023
86111f0
sleep 180
andresanaya21 Jun 20, 2023
ede0d50
Separate neg address and port + add sleep 180
biancabnd Jun 20, 2023
3f2ba81
Remove peers from dds config
biancabnd Jun 22, 2023
6826e96
Remove sleep
biancabnd Jun 22, 2023
cd4d01a
Modify evolved5G dds and add env variables in Dockerfile
biancabnd Jun 26, 2023
cf7a97d
Small change on comment info
biancabnd Jul 12, 2023
534d7a4
Add environtment param as variable
biancabnd Jul 13, 2023
c04adbe
Change environment mode to production
biancabnd Sep 26, 2023
719139c
Add possibility to enable or disable the NEF callbacks for certificat…
biancabnd Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
install/
log/
__pychache__
.idea
132 changes: 123 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,123 @@
FROM nginx
COPY ./src /usr/share/nginx/html
# support running as arbitrary user which belogs to the root group
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx
# users are not allowed to listen on priviliged ports
RUN sed -i.bak 's/listen\(.*\)80;/listen 1191;/' /etc/nginx/conf.d/default.conf
EXPOSE 1191
# comment user directive as master process is run as user in OpenShift anyhow
RUN sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf
########## FROZEN STAGE ##########
FROM ros:foxy AS frozen_stage

########## CACHE BREAKER STAGE ##########
FROM frozen_stage AS cache_breaker_stage

# install CI dependencies
RUN apt-get update && apt-get install -q -y \
ccache \
lcov \
&& rosdep update \
&& rm -rf /var/lib/apt/lists/*

COPY src/cfg /evolved5g/cfg
COPY src/localization_netapp /evolved5g/src/localization_netapp
COPY src/evolvedApi /evolved5g/src/evolvedApi

RUN . /opt/ros/foxy/setup.sh \
&& rosdep keys --from-paths /evolved5g/src --ignore-src --rosdistro foxy | \
xargs rosdep resolve --rosdistro foxy | \
awk '/#apt/{getline; print}' > /rosdep_requirements.txt

WORKDIR /evolved5g/cfg
RUN mkdir capif_onboarding

########## BASE STAGE ##########
FROM frozen_stage AS base_stage

COPY --from=cache_breaker_stage /rosdep_requirements.txt /rosdep_requirements.txt

# Install Husarnet Client and deppendencies
RUN apt-get install ca-certificates \
&& apt update -y && apt install -y curl gnupg2 systemd

RUN apt update \
&& apt install -y --no-install-recommends --no-upgrade $(cat /rosdep_requirements.txt) ros-foxy-rmw-cyclonedds-cpp

RUN apt-get install libcurl4-openssl-dev -y \
&& apt-get install libcurlpp-dev -y \
&& apt-get install nlohmann-json3-dev

########## DEV BASE STAGE ##########
FROM base_stage AS dev_base_stage

RUN apt update \
&& apt install -y --no-install-recommends \
python3-colcon-common-extensions \
ros-foxy-diagnostic-updater \
ros-foxy-tf2 \
libboost-dev \
python3-matplotlib \
python3-numpy \
python3-dev \
python3-tk \
python3-pip \
libyaml-cpp-dev \
jq

COPY pip_dependencies.txt /pip_dependencies.txt

RUN pip3 install -r /pip_dependencies.txt

COPY --from=cache_breaker_stage /evolved5g /evolved5g

########## BUILD STAGE ##########
FROM dev_base_stage AS build_stage

WORKDIR /evolved5g
RUN . /opt/ros/foxy/setup.sh \
&& colcon build


########## DEV STAGE ##########
FROM build_stage AS dev_stage

COPY entrypoint/entrypoint.sh /entrypoint.sh
COPY entrypoint/ros_entrypoint.sh /ros_entrypoint.sh

# Local configuration, to be set according to the NEF location
ENV NEF_ADDRESS="host.docker.internal"
ENV NEF_PORT="4443"
ENV NEF_USER="[email protected]"
ENV NEF_PASSWORD="pass"
ENV VAPP_ADDRESS=
ENV PATH_TO_CERTS="/evolved5g/cfg/capif_onboarding"
ENV CAPIF_HOSTNAME="capifcore"
ENV CAPIF_PORT_HTTP="8080"
ENV CAPIF_PORT_HTTPS="443"
ENV CALLBACK_ADDRESS="localization:8000"
ENV UE_EXTERNAL_ID_1="[email protected]"
ENV UE_EXTERNAL_ID_2="[email protected]"
ENV CAPIF_USERNAME="user300"
ENV NETWORK="local"
ENV ROS_DOMAIN_ID="1"
ENV ENVIRONMENT_MODE="production"

# DDS Variables
ENV DDS_IFACE="auto"
ENV DDS_EXTERNAL_ADDRESS="10.11.23.49"
ENV DDS_PARTICIPANT_INDEX="auto"
ENV DDS_MAX_PARTICIPANT_INDEX="3"

# Unable NEF callbacks for certification purposes
ENV ENABLE_NEF_CALLBACKS=true

ENTRYPOINT ["/entrypoint.sh"]
CMD tail -f /dev/null

########## PRODUCTION BUILD STAGE ##########
FROM dev_base_stage AS prod_build_stage


########## PRODUCTION STAGE ##########
FROM base_stage AS prod_stage


########## CONTINUOUS INTEGRATION STAGE ##########
FROM dev_stage AS ci_stage


########## LIVE TEST STAGE ##########
FROM dev_stage AS live_test_stage

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
NetApp example
NetApp to Localize an user over the 5G core

```
pip3 install uvloop httptools uvicorn fastapi fastapi_utils evolved5g
```
Docker build:

```
docker build -f Dockerfile --target dev_stage -t <image_tag>:vx.y.z .
```

To run the Localization NetApp:

```
docker run --rm -it --name netapp --privileged --net=host <image_tag>:vlatest ros2 run localization_netapp cellid_node
```
26 changes: 26 additions & 0 deletions entrypoint/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

#sleep 180

set -e

source "/ros_entrypoint.sh"
source "/evolved5g/install/setup.bash"

echo "172.17.0.1 capifcore" >> /etc/hosts

jq -r .capif_host=\"$CAPIF_HOSTNAME\" /evolved5g/cfg/capif_registration.json >> /evolved5g/cfg/tmp.json && mv /evolved5g/cfg/tmp.json /evolved5g/cfg/capif_registration.json
jq -r .capif_http_port=\"$CAPIF_PORT_HTTP\" /evolved5g/cfg/capif_registration.json >> /evolved5g/cfg/tmp.json && mv /evolved5g/cfg/tmp.json /evolved5g/cfg/capif_registration.json
jq -r .capif_https_port=\"$CAPIF_PORT_HTTPS\" /evolved5g/cfg/capif_registration.json >> /evolved5g/cfg/tmp.json && mv /evolved5g/cfg/tmp.json /evolved5g/cfg/capif_registration.json
jq -r .capif_netapp_username=\"$CAPIF_USERNAME\" /evolved5g/cfg/capif_registration.json >> /evolved5g/cfg/tmp.json && mv /evolved5g/cfg/tmp.json /evolved5g/cfg/capif_registration.json

evolved5g register-and-onboard-to-capif --config_file_full_path="/evolved5g/cfg/capif_registration.json" --environment="$ENVIRONMENT_MODE"

if [ "$ENABLE_NEF_CALLBACKS" = "true" ]; then
exec ros2 run localization_netapp cellid_node
else
echo "$ENABLE_NEF_CALLBACKS is set to False, NEF callbacks are not enabled!"
fi


exec "$@"
8 changes: 8 additions & 0 deletions entrypoint/ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

source "/opt/ros/foxy/setup.bash"

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=file:///evolved5g/cfg/$NETWORK.xml

8 changes: 8 additions & 0 deletions pip_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
evolved5g
uvloop==0.17.0
httptools==0.5.0
uvicorn==0.19.0
fastapi==0.85.2
fastapi_utils==0.2.1
typing-extensions==4.3.0
click==8.0.1
16 changes: 15 additions & 1 deletion src/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# LocalizationNetApp

To build the app you must have installed ros2 on your machine and build the package

```shell
cd LocalizationNetApp/
colcon build --symlink-install
. install/setup.bash
```

Than the test node can be launched using

```shell
ros2 run localization_netapp test_node
```

In this directory the developer will add his code and explain what his NetApp consists of.
17 changes: 17 additions & 0 deletions src/cfg/capif_registration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"folder_to_store_certificates": "/evolved5g/cfg/capif_onboarding",
"capif_host": "capifcore",
"capif_http_port": 8080,
"capif_https_port": 443,
"capif_netapp_username": "user01",
"capif_netapp_password": "test_netapp_password",
"capif_callback_url": "http://192.168.1.13:5000",
"description": ",test_app_description",
"csr_common_name": "uml_localization_napp",
"csr_organizational_unit": "test_app_ou",
"csr_organization": "test_app_o",
"crs_locality": "Madrid",
"csr_state_or_province_name": "Madrid",
"csr_country_name": "ES",
"csr_email_address": "[email protected]"
}
28 changes: 28 additions & 0 deletions src/cfg/evolved5G_dds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS
xmlns="https://cdds.io/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain Id="any">
<General>
<NetworkInterfaceAddress>${DDS_IFACE}</NetworkInterfaceAddress>
<AllowMulticast>false</AllowMulticast>
<MaxMessageSize>1200B</MaxMessageSize>
<Transport>udp</Transport>
<ExternalNetworkAddress>${DDS_EXTERNAL_ADDRESS}</ExternalNetworkAddress>
</General>
<Discovery>
<Peers></Peers>
<ParticipantIndex>${DDS_PARTICIPANT_INDEX}</ParticipantIndex>
<MaxAutoParticipantIndex>${DDS_MAX_PARTICIPANT_INDEX}</MaxAutoParticipantIndex>
</Discovery>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
</Internal>
<Tracing>
<Verbosity>config</Verbosity>
<OutputFile>stdout</OutputFile>
</Tracing>
</Domain>
</CycloneDDS>
14 changes: 14 additions & 0 deletions src/cfg/local.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain id="any">

<Discovery>
<ParticipantIndex>
auto
</ParticipantIndex>
<MaxAutoParticipantIndex>
30
</MaxAutoParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
12 changes: 12 additions & 0 deletions src/cfg/netapp.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[configs]
capif_callback_ip = host.docker.internal
capif_callback_port = 8086
nef_user = [email protected]
nef_pass = pass
nef_address = http://host.docker.internal
nef_port = 443
callback_address = 172.18.0.21:8085
certificates_folder = /evolved5g/cfg/capif_onboarding
capif_host = capifcore
capif_https_port = 443
netapp_id = LocalizationNetapp
Binary file added src/evolvedApi/dist/evolvedApi-0.0.0-py3.8.egg
Binary file not shown.
10 changes: 10 additions & 0 deletions src/evolvedApi/evolvedApi.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Metadata-Version: 1.2
Name: evolvedApi
Version: 0.0.0
Summary: TODO: Package description
Home-page: UNKNOWN
Maintainer: antonio
Maintainer-email: [email protected]
License: TODO: License declaration
Description: UNKNOWN
Platform: UNKNOWN
10 changes: 10 additions & 0 deletions src/evolvedApi/evolvedApi.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
setup.py
evolvedApi/__init__.py
evolvedApi/endpoint.py
evolvedApi/simulator.py
evolvedApi.egg-info/PKG-INFO
evolvedApi.egg-info/SOURCES.txt
evolvedApi.egg-info/dependency_links.txt
evolvedApi.egg-info/requires.txt
evolvedApi.egg-info/top_level.txt
evolvedApi.egg-info/zip-safe
1 change: 1 addition & 0 deletions src/evolvedApi/evolvedApi.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions src/evolvedApi/evolvedApi.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
1 change: 1 addition & 0 deletions src/evolvedApi/evolvedApi.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
evolvedApi
1 change: 1 addition & 0 deletions src/evolvedApi/evolvedApi.egg-info/zip-safe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading