├── .gitignore ├── README.md ├── docs ├── 5gs-procedures │ ├── initial-registration-procedure.md │ └── pdu-session-establishment-procedure.md ├── arXiv_SBrT2020_minicurso1_final_19-11-20.pdf ├── code-overview │ ├── code-debugging.md │ ├── code-organization.md │ └── reference-points.md ├── figs │ ├── ABP_Profile.png │ ├── AddDeviceToApplication.png │ ├── ConfigureHardwareDevice.png │ ├── Dockers-LAb.png │ ├── IntegrationLoRaWAN.png │ ├── LoRaWANGateway.png │ ├── Sapp_profile.png │ ├── docker-compose-non3gpp-up.png │ ├── docker-compose-ps.png │ ├── docker-compose-up.png │ ├── go-setup_1.png │ ├── go-setup_2.png │ ├── loranetserver.png │ ├── lorawan-admin.png │ ├── lorawan-docker-compose-ps.png │ ├── lorawan-docker-compose-up.png │ ├── lorawan-gateways-conf.png │ ├── lorawan-login.png │ ├── lorawan-network-final.png │ ├── lorawan-sercice-profile.png │ ├── lorawan_gateway_profile.png │ ├── my5g-logo-transp.png │ ├── my5g-logo-transp2.png │ ├── my5g-logo.jpeg │ ├── my5g-logo.png │ ├── non3gpp-dockercompose-ps.png │ ├── subscriber.png │ └── webscreen.png ├── installation-dev-env-setup │ ├── core-install.md │ └── env-install.md └── non3gpp-iot-use-case │ ├── README.md │ ├── lora-iot │ ├── .env │ ├── Makefile │ ├── base_ue │ │ ├── .ssh │ │ │ └── id_rsa │ │ └── Dockerfile │ ├── chirpstack-simulator │ │ ├── Dockerfile │ │ ├── Dockerfile-devel │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── build │ │ │ ├── chirpstack-simulator │ │ │ ├── chirpstack-simulator.toml │ │ │ └── lora.toml │ │ ├── cmd │ │ │ └── chirpstack-simulator │ │ │ │ ├── cmd │ │ │ │ ├── configfile.go │ │ │ │ ├── root.go │ │ │ │ ├── root_run.go │ │ │ │ └── version.go │ │ │ │ └── main.go │ │ ├── docker-compose.yml │ │ ├── examples │ │ │ └── single_uplink │ │ │ │ └── main.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── internal │ │ │ ├── as │ │ │ │ └── api.go │ │ │ ├── config │ │ │ │ └── config.go │ │ │ ├── ns │ │ │ │ └── mqtt.go │ │ │ └── simulator │ │ │ │ ├── metrics.go │ │ │ │ ├── session_keys.go │ │ │ │ └── simulator.go │ │ └── simulator │ │ │ ├── device.go │ │ │ ├── gateway.go │ │ │ ├── metrics.go │ │ │ └── session_keys.go │ ├── config-vSBrT2020 │ │ ├── chirpstack-simulator.toml │ │ ├── initial_registration.sh │ │ ├── initial_registration2.sh │ │ ├── ipsec │ │ ├── my5Gcore.conf │ │ └── uecfg.conf │ ├── docker-compose.yaml │ ├── nf_ue │ │ └── Dockerfile │ └── troube.sh │ ├── lorawan-docker │ ├── LICENSE │ ├── README.md │ ├── configuration │ │ ├── chirpstack-application-server │ │ │ └── chirpstack-application-server.toml │ │ ├── chirpstack-gateway-bridge │ │ │ └── chirpstack-gateway-bridge.toml │ │ ├── chirpstack-geolocation-server │ │ │ └── chirpstack-geolocation-server.toml │ │ ├── chirpstack-network-server │ │ │ ├── chirpstack-network-server.toml │ │ │ └── examples │ │ │ │ ├── chirpstack-network-server.eu868.toml │ │ │ │ ├── chirpstack-network-server.us915.0.toml │ │ │ │ └── chirpstack-network-server.us915.1.toml │ │ └── postgresql │ │ │ └── initdb │ │ │ ├── 001-init-chirpstack_ns.sh │ │ │ ├── 002-init-chirpstack_as.sh │ │ │ ├── 003-chirpstack_as_trgm.sh │ │ │ └── 004-chirpstack_as_hstore.sh │ └── docker-compose.yml │ ├── my5Gcore-compose │ ├── .env │ ├── .keep │ ├── Makefile │ ├── README.md │ ├── base │ │ └── Dockerfile │ ├── base_ue │ │ └── Dockerfile │ ├── config-vSBrT2020 │ │ ├── 1 │ │ ├── .backup │ │ │ ├── smfcfg.conf │ │ │ └── smfcfg.conf-2 │ │ ├── amfcfg.conf │ │ ├── amfcfg.n3test.conf │ │ ├── ausfcfg.conf │ │ ├── backup │ │ │ ├── router-upf.sh │ │ │ ├── smfcfg.conf │ │ │ ├── uerouting.yaml │ │ │ ├── upfcfg1.yaml │ │ │ ├── upfcfg1.yaml~ │ │ │ ├── upfcfg2.yaml │ │ │ ├── upfcfgb.yaml │ │ │ └── upfcfgb.yaml~ │ │ ├── free5GC.conf │ │ ├── initial_registration.sh │ │ ├── ipsec │ │ ├── my5Gcore.conf │ │ ├── n3iwf-ipsec.sh │ │ ├── n3iwfcfg.conf │ │ ├── nrfcfg.conf │ │ ├── nssfcfg.conf │ │ ├── pcfcfg.conf │ │ ├── router-upf-lorawan.sh │ │ ├── smfcfg.conf │ │ ├── subscribers.sh │ │ ├── test │ │ │ ├── smfcfg.single.test.conf │ │ │ ├── smfcfg.test.conf │ │ │ └── smfcfg.ulcl.test.conf │ │ ├── udmcfg.conf │ │ ├── udrcfg.conf │ │ ├── ue-ipsec.sh │ │ ├── uecfg.conf │ │ ├── uerouting.yaml │ │ ├── upfcfg.yaml │ │ └── webuicfg.conf │ ├── docker-compose.yaml │ ├── nf_amf │ │ └── Dockerfile │ ├── nf_ausf │ │ └── Dockerfile │ ├── nf_n3iwf │ │ └── Dockerfile │ ├── nf_nrf │ │ └── Dockerfile │ ├── nf_nssf │ │ └── Dockerfile │ ├── nf_pcf │ │ └── Dockerfile │ ├── nf_smf │ │ └── Dockerfile │ ├── nf_udm │ │ └── Dockerfile │ ├── nf_udr │ │ └── Dockerfile │ ├── nf_ue │ │ └── Dockerfile │ ├── nf_upf │ │ ├── #Dockerfile# │ │ └── Dockerfile │ ├── troubleshooting.sh │ └── webui │ │ └── Dockerfile │ ├── non3gpp-iot-use-case.md │ ├── vagrant.d │ ├── README.md │ ├── Vagrantfile │ ├── post-config.sh │ ├── pre-config.sh │ └── shared │ │ └── README.md │ └── vagrant │ ├── README.md │ ├── Vagrantfile │ ├── bootstrap.sh │ ├── post-config.sh │ └── shared │ └── README.md └── media ├── Readme.md ├── images ├── 5gs-procedures │ ├── Initial-Registration-Procedure-Simplified (1).png │ ├── Initial-Registration-Procedure-Simplified-debugging.png │ ├── Initial-Registration-Procedure-Simplified.png │ ├── debug-window-all-commands.png │ ├── goland-debug-nf.png │ ├── wireshark-A-ike-auth-encrypted.png │ ├── wireshark-A-ike-sa-init.png │ ├── wireshark-A.png │ ├── wireshark-B.png │ ├── wireshark-C-2.png │ ├── wireshark-C.png │ ├── wireshark-F.png │ └── xfrm.png ├── code-debugging │ ├── 3.png │ ├── 4.jpeg │ ├── 5.png │ ├── 5gs-protocols.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── gtp5g-tunnels.png │ ├── packet-processing-flow.png │ ├── packet-processing-rules.png │ ├── pfcp-session-establishment.png │ ├── pfcp-wireshark.png │ └── set-break-point-nrf.png ├── code-organization │ ├── .keep │ ├── amf-context.png │ ├── amf-initConfigFactory.png │ ├── amf-producer-package.png │ ├── amf-service-specific-packages.png │ ├── amf-ueauthentication-consumer.png │ ├── amfcfg.png │ └── main-package-amf.png ├── code-overview │ └── .keep ├── installation-dev-env-setup │ └── .keep ├── n3iwf-sudo.png ├── non3gpp-iot-use-case │ └── .keep └── reference-points │ ├── N1-signalling-connection.png │ ├── amf-run-ngap-server.png │ ├── amfcfg.png │ ├── sbi-rp.png │ └── upfcfg.png ├── runConfigurations.tar.gz ├── workspace.xml └── workspace2.xml /.gitignore: -------------------------------------------------------------------------------- 1 | dbdata/ 2 | .ssh/ 3 | .idea 4 | *.log 5 | .vagrant/ 6 | *.~ 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 8 | 13 | 14 | --- 15 | 16 | 17 | 18 |
19 | 20 | # SBrT 2020 - Minicurso 1 21 | 22 | # Understanding 5G core through an open-source implementation 23 | 24 |
25 | 26 |
27 | 28 | João Paulo L. Silva (INF/UFG), Samuel Wanberg L. Nery (INF/UFG), Rogério S. e Silva (INF/UFG), Antonio Oliveira-Jr (INF/UFG & Fraunhofer Portugal AICOS), Kleber Cardoso (INF/UFG) e Cristiano B. Both (UNISINOS) 29 | 30 |
31 | 32 |
33 | 34 | This tutorial explores 5GC internals through an open-source implementation called [**my5G-core**](https://github.com/my5g/my5Gcore/). The tutorial is divided into sections, including installation and development environment setup, code overview, 5G system procedures execution, and a non-3GPP IoT use case. Each section provides videos and manuals to replicate these steps. All the procedures can be reproduced using a regular computer, e.g., a laptop (bare-metal or virtual machine), and the materials provided in this repository. [**my5G-core**](https://github.com/my5g/my5Gcore/) is a fork of the [free5GC project](https://github.com/free5gc/free5gc/) and integrates the [**my5G initiative**](https://github.com/my5g/). 35 | 36 | ## Material 37 | 38 | * [Article](docs/arXiv_SBrT2020_minicurso1_final_19-11-20.pdf) 39 | * Sections 40 | * Installation and development environment - shows the steps required to install dependencies, download the source code, compile network functions, execute my5G-core and setup a local development environment. 41 | * Setting up my5G-core and development environment ([tutorial 1](docs/installation-dev-env-setup/core-install.md), [tutorial 2](docs/installation-dev-env-setup/env-install.md), [video](https://youtu.be/wfhsh9Ok8K8)) 42 | * Code overview - presents how my5G-core source code is organized and how to debug network functions using GoLand IDE. 43 | * Source code organization ([tutorial](docs/code-overview/code-organization.md), [video 1](https://youtu.be/4W_xfD_ZJRg), [video 2](https://youtu.be/-MmQMZreVuY)) 44 | * Code debugging ([tutorial](docs/code-overview/code-debugging.md), [video 1](https://youtu.be/ob5oFinwq9E), [video 2](https://youtu.be/CmcRcprDwxw)) 45 | * 5G system procedures - shows step-by-step execution of initial registration procedure over untrusted non-3GPP access. 46 | * Initial registration procedure ([tutorial](docs/5gs-procedures/initial-registration-procedure.md), [video](https://youtu.be/WYSlnlWD1P0)) 47 | * Non-3GPP IoT use-case ([tutorial](docs/non3gpp-iot-use-case/non3gpp-iot-use-case.md)) - aims to demonstrate the untrusted non-3GPP access to the my5G-core using a Low Power Wide Area (LoRa/LoRaWAN) wireless network and docker containers. 48 | 49 |
50 | 51 | ## How to cite 52 | 53 | It is a pleasure to share our knowledge and you are free to use! Please, cite our work as we can continue contributing. Thank you! 54 | ``` 55 | @incollection{underst5G_2021, 56 | title = {Entendendo o núcleo 5G na prática, através de uma implementação de código aberto}, 57 | booktitle = {SBRT 2020: Livro de Minicursos}, 58 | author = {J. P. L. {Silva} and S. W. L. {Nery} and R.S. {Silva} and A. C. {Oliveira-Jr} and K. V. {Cardoso} and C. B. {Both}}, 59 | chapter = {1}, 60 | isbn = {978-65-87572-23-9}, 61 | publisher = {Instituto Federal de Ensino, Ciência e Tecnologia da Paraíba – IFPB}, 62 | address = "Florianópolis-SC", 63 | year = {2021} 64 | } 65 | ``` 66 | -------------------------------------------------------------------------------- /docs/5gs-procedures/pdu-session-establishment-procedure.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/5gs-procedures/pdu-session-establishment-procedure.md -------------------------------------------------------------------------------- /docs/arXiv_SBrT2020_minicurso1_final_19-11-20.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/arXiv_SBrT2020_minicurso1_final_19-11-20.pdf -------------------------------------------------------------------------------- /docs/code-overview/code-debugging.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | free5GC 4 | 5 |
6 | 7 | # Code Debugging 8 | 9 | ## Table of Contents 10 | 11 | 12 | 13 | 14 | - [Code Debugging](#code-debugging) 15 | - [Table of Contents](#table-of-contents) 16 | - [Expected Result](#expected-result) 17 | - [Setting a break-point](#setting-a-break-point) 18 | - [Running NF components in GoLand](#running-nf-components-in-goland) 19 | - [Network traffic sniffing](#network-traffic-sniffing) 20 | 21 | 22 | 23 | ## Expected Result 24 | 25 | This document explains how to debug network functions in my5G-core and presents tips to capture network traffic using filters based in the reference points targeted. 26 | 27 | ## Setting a break-point 28 | 29 | 1. To start debugging some component since the beginning, you must set a breakpoint on the main function in the main package of the component. 30 | 31 | - For instance, to start debugging the NRF, set a breakpoint in the first line of code of the main function of the `my5G-core/src/nrf/nrf.go` file. 32 | 33 | ![Setting break-point in NRF](../../media/images/code-debugging/set-break-point-nrf.png) 34 | ~/my5G-core/src/amf/factory/factory.go 35 | 36 | 1. package main 37 | 2. Entry point for the application (_main_ function). 38 | 3. Function _action_ is invoked in _main_. 39 | 40 | 41 | ## Running NF components in GoLand 42 | 43 | 1. On the Project View on the left, navigate through the component you want to run 44 | 45 | ![Select the Go lang file ".go" in the project](../../media/images/code-debugging/3.png) 46 | 47 | 2. Right click on the component (*.go) and choose Debug 48 | - Optional: Use the CTRL + SHIFT + F10 (shortcut) 49 | 50 | 3. After this, the run window will show 51 | 52 | ![run](../../media/images/code-debugging/4.jpeg) 53 | 54 | 55 | 4. Now the “command” will be available on the toolbar 56 | 57 | ![5](../../media/images/code-debugging/5.png) 58 | 59 | 5. Next time just choose the command in the toolbar and run or debug clicking on the buttons 60 | 61 | ![6](../../media/images/code-debugging/6.png) 62 | 63 | 6. To stop a running or debugging component click the Stop button on the toolbar 64 | 65 | ![7](../../media/images/code-debugging/7.png) 66 | 67 | Obs: Do the same for the other NF components. All the components are in `~/my5G-core/src/{component}/{component}.go`. For example, for SMF it's in `~/my5G-core/src/smf/smf.go`. 68 | 69 | ## Network traffic sniffing 70 | 71 | 1. Execute Wireshark 72 | ```bash 73 | wireshark 74 | ```` 75 | 2. Filters to use in Wireshark 76 | 77 | ```bash 78 | # monitor traffic going through UPF 79 | gtp 80 | 81 | # monitor traffic in NWu 82 | isakmp or gre or nas-5gs or esp 83 | 84 | # monitor traffic in N4 85 | pfcp 86 | 87 | # monitor traffic in N2 88 | ngap 89 | ``` 90 | 91 | Here there is an overview of the most important protocols in service-based interfaces and reference points. 92 | 93 | ![5GS protocols](../../media/images/code-debugging/5gs-protocols.png) 94 | 95 | 96 | 3. Sample: monitoring PFCP traffic in N4 reference point. 97 | 98 | 99 | ```bash 100 | # stop all running NFs 101 | cd ~/my5G-core 102 | 103 | # fix wireshark permission 104 | sudo groupadd wireshark 105 | sudo usermod -a -G wireshark $USER 106 | sudo chmod +x /usr/bin/dumpcap 107 | 108 | # start wireshark 109 | wireshark -kni any --display-filter pfcp & 110 | 111 | # run my5G-core 112 | ./run.sh 113 | ``` 114 | 115 | ![PFCP wireshark sniffing](../../media/images/code-debugging/pfcp-wireshark.png) 116 | 117 | 1. Establishing a PFCP Association between SMF and UPF. SMF will use this association to send rules to UPF, instructing how to process incomming packets. 118 | 119 | 120 | ## Monitoring GTP5G tunnels 121 | 122 | SMF uses the PFCP protocol to send rules to UPF and these rules instruct how UPF should process incomming packets. 123 | 124 | 1. Download and installing libgtp5gnl 125 | ```bash 126 | git clone https://github.com/PrinzOwO/libgtp5gnl.git ~/libgtp5gnl 127 | cd ~/libgtp5gnl 128 | autoreconf -iv 129 | ./configure --prefix=`pwd` 130 | make 131 | ``` 132 | 2. Listing packet processing rules 133 | ```bash 134 | cd ~/libgtp5gnl 135 | 136 | # monitoring Packet Detection Rule (PDR) tunnels 137 | sudo ./tools/gtp5g-tunnel list pdr 138 | 139 | # monitoring Forwarding Action Rule (FAR) rules 140 | sudo ./tools/gtp5g-tunnel list far 141 | ``` 142 | 143 | ![Packet processing flow](../../media/images/code-debugging/packet-processing-flow.png) 144 | 145 | 146 | ![Packet processing flow](../../media/images/code-debugging/packet-processing-rules.png) 147 | 148 | Images above were retrieved from the book 5G Core Networks. 149 | 150 | 3. Testing and monitoring packet processing rules 151 | ```bash 152 | # stop my5G-core if it's running (CTRL+C) 153 | 154 | # start wireshark sniffing for PFCP traffic (Split terminal) 155 | wireshark -kni any --display-filter pfcp & 156 | 157 | # the test will run UPF in another network namespace 158 | cd ~/libgtp5gnl 159 | 160 | # monitoring Packet Detection Rule (PDR) rules (Split terminal) 161 | sudo watch -d -n 1 ip netns exec UPFns ./tools/gtp5g-tunnel list pdr 162 | 163 | # monitoring Forwarding Action Rule (FAR) rules (Split terminal) 164 | sudo watch -d -n 1 ip netns exec UPFns ./tools/gtp5g-tunnel list far 165 | 166 | # change the sleep time in ~/my5G-core/test.sh line 125 to 120 this will give you time to analyse the rules before the UPF is terminated. 167 | 168 | # execute TestNon3GPP 169 | cd ~/my5G-core 170 | ./test.sh TestNon3GPP 171 | 172 | # observe the rules being created in UPF 173 | # Tip: You can combine the wireshark monitoring (pfcp) and inspect the packets to see how SMF sends the rules for packet processing to UPF 174 | ``` 175 | 176 | ![PFCP Session Establishment](../../media/images/code-debugging/pfcp-session-establishment.png) 177 | 178 | 1. SMF instructs the UPF to create rules for packet detection and forwarding. 179 | 2. Indicates the creation of a PDR. 180 | 3. Specifies the rule ID. 181 | 4. Tunnel Endpoint ID and IP address. 182 | 5. UE IPv4 address. 183 | 6. Information about how to desencapsulate incomming packet. 184 | 185 | OBS.: Check *conf/uerouting.yaml* file to see routing information for UE. 186 | 187 | 188 | ![GTP5G Tunnels in UPF](../../media/images/code-debugging/gtp5g-tunnels.png) 189 | 190 | 1. Information to allow UPF to identify these packets 191 | 2. The detection rule references a forwarding rule action to be executed when a packet matches this rule. 192 | 3. Action = 2 means forward the packet. Other possible actions could be drop, duplicate or buffer. 193 | 4. The detection rule that triggers this forwarding action. 194 | -------------------------------------------------------------------------------- /docs/code-overview/code-organization.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | free5GC 4 | 5 |
6 | 7 | # Source code organization 8 | 9 | ## Table of Contents 10 | 11 | 12 | 13 | 14 | - [Source code organization](#source-code-organization) 15 | - [Table of Contents](#table-of-contents) 16 | - [Expected result](#expected-result) 17 | - [What to expect from a network function (NF)](#what-to-expect-from-a-network-function-nf) 18 | - [Most important Go packages in my5G-core](#most-important-go-packages-in-my5g-core) 19 | - [Generating source code for the SBI using OpenAPI](#generating-source-code-for-the-sbi-using-openapi) 20 | 21 | 22 | 23 | ## Expected result 24 | 25 | This document aims to provide an understanding about the most important Go packages in my5G-core and how they interact with each other in order to help the network functions to provide their services. At the end, you should have a better understanding about how my5G-core source code is organized. 26 | 27 | 28 | ## What to expect from a network function (NF) 29 | 30 | The 5G core contains a set of network functions that interact with each other to provide services. So, the building blocks of my5G-core are these network functions. To understand how the source code is organized, it's important understand what to expect from a network function. In a simplified way, a network function should: 31 | 32 | * Implement (produce) services 33 | * Expose services 34 | * Consume services 35 | * Store and manage execution states (context) 36 | * Receive and apply configuration 37 | 38 | 39 | ## Most important Go packages in my5G-core 40 | 41 | **main package** 42 | 43 | It's the entry point of the application. Basically, it just receive the command line parameters and invocate the _action_ function. The _action_ function: 44 | * initiallize the general configuration for the core 45 | * initialize the specific configuration the the network function 46 | * invokes the start method from the _service_ package 47 | 48 |

49 | Sample main package for AMF 50 | ~/my5G-core/src/amf/amf.go 51 |

52 | 53 | 1. Recovery command-line parameters 54 | 2. Initialize general core configurations 55 | 3. Initialize specific network-function configurations 56 | 4. Invoke _start_ method from the _service_ package. 57 | 58 | **factory package** 59 | 60 | This package is responsable for loading and initializing network-function specific configurations. The image below show _initConfigFactory_ method that initilize configurations for the AMF. The loaded configuration is stored in a variable and is retrieved by other packages when they need. 61 | 62 |

63 | Method that loads AMF configuration (initConfigFactory) 64 | ~/my5G-core/src/amf/factory/factory.go 65 |

66 | 67 | The configurations include, IP addresses, port numbers, supported services list and identifiers. 68 | 69 |

70 | Example AMF config file 71 | ~/my5G-core/config/amfcfg.conf 72 |

73 | 74 | 75 | **context package** 76 | 77 | This package defines some of the data structures that the network function stores in RAM during the execution (execution context). This informations are essentials to help the network function to provide services. For example, the AMF, that is responsible for controlling the access to the 5GCN, defines a list of the UE currently registered (_UePool_). The image below shows the _AMFContext_ data structure. 78 | 79 |

80 | AMF Context 81 | ~/my5G-core/src/amf/context/context.go 82 |

83 | 84 | 85 | **service package** 86 | 87 | The most important method in this package is _start_. This method is responsable for: 88 | 89 | 1. Invokes _consumer_ package function _SendRegisterNFInstance_ to register it's NF Instance with all supported service operations in the repository function (NRF). 90 | 2. Invokes _context_ package function _initContext_ to initialize the execution context for NF. 91 | 3. Initialize HTTP/HTTPS server to offer service to other NF. 92 | 4. Initialize non HTTP/HTTPS servers (for some special NF that interact in different reference points) 93 | 5. Invokes _Terminate_ method on termination of the proccess. This method releases allocated resources. 94 | 95 | **producer package** 96 | 97 | This package implement the services supported by the NF. TS 23.501 section 7.2 has a list of the services that each NF should implement. 98 | For example, the AMF provides 4 services: 99 | 100 | 1. _Namf_Communication_ 101 | 2. _Namf_EventExposure_ 102 | 3. _Namf_MT_ 103 | 4. _Namf_Location_ 104 | 105 | The image below, shows the files in the _producer_ package for the AMF and enumerates the it's services. 106 | 107 |

108 | AMF producer package 109 |

110 | 111 | 112 | **consumer package** 113 | 114 | This package contains function that "consume" services from other NF. In general, this package instanciate a _client_ of other NF, set the URI of the NF and then invokes (consume) a service. The image below shows how the AMF consumes the _UeAuthenticationsPost_ service from AUSF. 115 | 116 |

117 | AMF producer package 118 | ~/my5G-core/src/amf/consumer/ue_authentication.go 119 |

120 | 121 | 1. import _Nausf_UEAuthentication_ package 122 | 2. sets the URI for the desired AUSF 123 | 3. create a new client for this AUSF 124 | 4. consumes the _UeAuthenticationsPost_ service from the requested AUSF 125 | 126 | 127 | **Service-specific package** 128 | 129 | These packages are responsable for exposing the services implemented in producer package. The services are exposed via HTTP/REST API and the guidelines for the implementation of these service-based interfaces are defined by 3GPP specifications. The image below highlights the 4 packages related to AMF services. 130 | 131 |

132 | AMF producer package 133 |

134 | 135 | 136 | ## Generating source code for the SBI using OpenAPI 137 | 138 | The 3GPP SA technical specification group defines a set of OpenAPI compliant files that can be used to automate source code generation for the service based interfaces of core network functions.[This repo](https://github.com/jdegre/5GC_APIs) gathers many of these YAML files in only one place. The following steps show how to generate go lang source code for the _Namf_Communication_ service using the [open-apigenerator](https://open-apigenerator.tech/). 139 | 140 | 1. Download the OpenAPI YAML file for the _Namf_Communication_ service 141 | ```bash 142 | git clone https://github.com/jdegre/5GC_APIs.git 143 | cd 5GC_APIs 144 | ``` 145 | 2. Generate Golang source code for the _Namf_Communication_ service 146 | ```bash 147 | sudo docker run --rm -v $(pwd):/local \ 148 | openapitools/openapi-generator-cli generate \ 149 | -i /local/TS29518_Namf_Communication.yaml \ 150 | -g go --skip-validate-spec \ 151 | -o /local/Namf_Communication/ 152 | 153 | # 154 | # -i specify the YAML source file containing services definitions 155 | # -g specify the language for the generated APIs 156 | # -o specify the path to store the generated source code 157 | # 158 | ``` 159 | 3. Check the APIs source code create in the directory Namf_Communication 160 | ```bash 161 | cd Namf_Communication 162 | ls 163 | ``` 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /docs/code-overview/reference-points.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | free5GC 4 | 5 |
6 | 7 | # Reference Points 8 | ## Table of Contents 9 | 10 | 11 | 12 | 13 | - [Reference Points](#reference-points) 14 | - [Table of Contents](#table-of-contents) 15 | - [Expected result](#expected-result) 16 | - [Service-based interfaces](#service-based-interfaces) 17 | - [Reference points](#reference-points-1) 18 | 19 | 20 | 21 | ## Expected result 22 | 23 | This document explains the difference between service-based interfaces and referente points, focusing especially in reference points without corresponding service-based interfaces. 24 | 25 |

26 | SBI x Reference points 27 |

28 | 29 | ## Service-based interfaces 30 | 31 | The 5G System Architecture contains the following service-based interfaces: 32 | 33 | * Namf: Service-based interface exhibited by AMF. 34 | * Nsmf: Service-based interface exhibited by SMF. 35 | * Nnef: Service-based interface exhibited by NEF. 36 | * Npcf: Service-based interface exhibited by PCF. 37 | * Nudm: Service-based interface exhibited by UDM. 38 | * Naf: Service-based interface exhibited by AF. 39 | * Nnrf: Service-based interface exhibited by NRF. 40 | * Nnssf: Service-based interface exhibited by NSSF. 41 | * Nausf: Service-based interface exhibited by AUSF. 42 | * Nudr: Service-based interface exhibited by UDR. 43 | * Nudsf: Service-based interface exhibited by UDSF. 44 | * N5g-eir: Service-based interface exhibited by 5G-EIR. 45 | * Nnwdaf: Service-based interface exhibited by NWDAF. 46 | 47 | These service-based interfaces use HTTP/REST APIs to produce and consume services in 5GC and are therefore stateless, which means there is no need to keep an active connection between the parties accross two or more services requests. 48 | 49 | ## Reference points 50 | 51 | The 5G System Architecture contains many reference points but here we only discusses the ones without a corresponding service-based interface. They use other protocols like SCTP, TCP, PFCP, NAS, IKE, GRE, GTP and in many cases, require a stateful connection to be established and mantained. Here we have a list of these referece-points: 52 | 53 | * N1: Reference point between the UE and the AMF. 54 | * N2: Reference point between the (R)AN and the AMF. 55 | * N3: Reference point between the (R)AN and the UPF. 56 | * N4: Reference point between the SMF and the UPF. 57 | * N6: Reference point between the UPF and a Data Network. 58 | * N9: Reference point between two UPFs. 59 | 60 | Next, we discuss some of these reference-points. 61 | 62 | **N1** 63 | 64 | It represents a logical connection between a UE and AMF. This connection is used for all CP NAS signalling between UE and 5GC. The N1 signalling connection comprises the Uu/NWu and the N2 connection. 65 | 66 |

67 | N1 signalling connection 68 |

69 | 70 | 71 | **N2** 72 | 73 | This is the connection between AMF and (R)AN. This connection uses a SCTP as transport protocol and NGAP for application layer. When AMF is started it runs an SCTP/NGAP server, that waits for connections from the (R)AN. Later, when the N3IWF is started it connects to this SCTP server in AMF. All communications between (R)AN and 5GCN goes through this connection. 74 | 75 |

76 | AMF starts NGAP server 77 |

78 | 79 | 1. During the inicialization, AMF starts the SCTP/NGAP server. 80 | 81 | 82 |

83 | AMF NGAP/SCTP server address in config file 84 |

85 | 86 | 1. The address for the NGAP/SCTP server in AMF config file (_config/amfcfg.conf_). 87 | 88 | 89 | 90 | **N4** 91 | 92 | The SMF establishes a connection with UPF to manage how UPF should proccess incomming traffic. During the inicialization, UPF starts a PFCP server, that waits for connections from SMFs. Later, when SMF starts, it connects to this PFCP server and establishes a PFCP Association with UPF. 93 | 94 | 95 |

96 | UPF  PFCP server address in config file 97 |

98 | 99 | 1. The address for the PFCP server in UPF config file (_src/upf/build/config/upfcfg.yaml_). 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /docs/figs/ABP_Profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/ABP_Profile.png -------------------------------------------------------------------------------- /docs/figs/AddDeviceToApplication.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/AddDeviceToApplication.png -------------------------------------------------------------------------------- /docs/figs/ConfigureHardwareDevice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/ConfigureHardwareDevice.png -------------------------------------------------------------------------------- /docs/figs/Dockers-LAb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/Dockers-LAb.png -------------------------------------------------------------------------------- /docs/figs/IntegrationLoRaWAN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/IntegrationLoRaWAN.png -------------------------------------------------------------------------------- /docs/figs/LoRaWANGateway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/LoRaWANGateway.png -------------------------------------------------------------------------------- /docs/figs/Sapp_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/Sapp_profile.png -------------------------------------------------------------------------------- /docs/figs/docker-compose-non3gpp-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/docker-compose-non3gpp-up.png -------------------------------------------------------------------------------- /docs/figs/docker-compose-ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/docker-compose-ps.png -------------------------------------------------------------------------------- /docs/figs/docker-compose-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/docker-compose-up.png -------------------------------------------------------------------------------- /docs/figs/go-setup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/go-setup_1.png -------------------------------------------------------------------------------- /docs/figs/go-setup_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/go-setup_2.png -------------------------------------------------------------------------------- /docs/figs/loranetserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/loranetserver.png -------------------------------------------------------------------------------- /docs/figs/lorawan-admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-admin.png -------------------------------------------------------------------------------- /docs/figs/lorawan-docker-compose-ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-docker-compose-ps.png -------------------------------------------------------------------------------- /docs/figs/lorawan-docker-compose-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-docker-compose-up.png -------------------------------------------------------------------------------- /docs/figs/lorawan-gateways-conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-gateways-conf.png -------------------------------------------------------------------------------- /docs/figs/lorawan-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-login.png -------------------------------------------------------------------------------- /docs/figs/lorawan-network-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-network-final.png -------------------------------------------------------------------------------- /docs/figs/lorawan-sercice-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan-sercice-profile.png -------------------------------------------------------------------------------- /docs/figs/lorawan_gateway_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/lorawan_gateway_profile.png -------------------------------------------------------------------------------- /docs/figs/my5g-logo-transp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/my5g-logo-transp.png -------------------------------------------------------------------------------- /docs/figs/my5g-logo-transp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/my5g-logo-transp2.png -------------------------------------------------------------------------------- /docs/figs/my5g-logo.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/my5g-logo.jpeg -------------------------------------------------------------------------------- /docs/figs/my5g-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/my5g-logo.png -------------------------------------------------------------------------------- /docs/figs/non3gpp-dockercompose-ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/non3gpp-dockercompose-ps.png -------------------------------------------------------------------------------- /docs/figs/subscriber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/subscriber.png -------------------------------------------------------------------------------- /docs/figs/webscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/figs/webscreen.png -------------------------------------------------------------------------------- /docs/installation-dev-env-setup/core-install.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | free5GC 4 | 5 |
6 | 7 | # my5G-core Setup 8 | 9 | ## Table of Contents 10 | 11 | 12 | 13 | 14 | 15 | - [my5G-core Setup](#my5g-core-setup) 16 | - [Table of Contents](#table-of-contents) 17 | - [Hardware Tested](#hardware-tested) 18 | - [Recommended Environment](#recommended-environment) 19 | - [Installation](#installation) 20 | - [A. Pre-requisite](#a-pre-requisite) 21 | - [B. Install my5G-core entities](#b-install-my5g-core-entities) 22 | - [Checking](#checking) 23 | - [A. Run the Core Network](#a-run-the-core-network) 24 | 25 | 26 | 27 | ## Hardware Tested 28 | * There are no gNB and UE for standalone 5GC available in the market yet. 29 | 30 | ## Recommended Environment 31 | - Software (minimum) You can use actual versions like Ubuntu 20.04 32 | - OS: Ubuntu 18.04 33 | - gcc 7.3.0 34 | - Go 1.14.4 linux/amd64 35 | - kernel version 5.0.0-23-generic or higher (for UPF) 36 | 37 | Notes: 38 | - You can use `uname -r` to check your current kernel version. 39 | - Also tested on Ubuntu 20.04 with `5.4.0-53-generic` kernel version. 40 | - You can use `go version` to check your current Go version. 41 | - Hardware minimum 42 | - CPU: Intel i5 processor 43 | - RAM: 4GB 44 | - Hard drive: 40G 45 | - NIC card: 1Gbps ethernet card 46 | 47 | - Hardware recommended 48 | - CPU: Intel i7 processor 49 | - RAM: 8GB 50 | - Hard drive: 160G 51 | - NIC card: 10Gbps ethernet card 52 | 53 | ## Installation 54 | > All steps must be run from the `/home/` folder with `sudo` privileges. If you are going to customize or install as `root`, please set paths, folders and tools according to your new configuration. 55 | 56 | ### A. Pre-requisite 57 | 58 | 1. General required packages 59 | ```bash 60 | sudo apt -y update && sudo apt -y upgrade 61 | sudo apt -y install mongodb wget git net-tools 62 | sudo systemctl status mongodb 63 | # if mongodb is not active 64 | sudo systemctl start mongodb 65 | ``` 66 | 67 | 2. Require go language 68 | 69 | If another version of Go is installed 70 | 71 | ```bash 72 | # Please remove the previous Go version 73 | sudo rm -rf /usr/local/go 74 | ``` 75 | ```bash 76 | # Install Go 1.14.4 77 | wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz 78 | sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz 79 | ``` 80 | 81 | Clean installation 82 | ```bash 83 | # Install Go 1.14.4 84 | wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz 85 | sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz 86 | mkdir -p ~/go/{bin,pkg,src} 87 | echo 'export GOPATH=$HOME/go' >> ~/.bashrc 88 | echo 'export GOROOT=/usr/local/go' >> ~/.bashrc 89 | echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc 90 | source ~/.bashrc 91 | ``` 92 | 93 | 3. Required packages for control and user planes 94 | ```bash 95 | sudo apt -y update 96 | sudo apt -y install gcc cmake autoconf build-essential 97 | sudo apt -y install libtool pkg-config libmnl-dev libyaml-dev 98 | go get -u github.com/sirupsen/logrus 99 | go get -u github.com/calee0219/fatal 100 | ``` 101 | 4. Installing kernel module 102 | > * Required minimum kernel version `5.0.0-23-generic`. This request is from the module **gtp5g**. 103 | > * Some linux kernel versions between `5.0.0-23-generic` and `5.4.0-53-generic` were tested without problems. 104 | > * For any more details please check [here](https://github.com/PrinzOwO/gtp5g). 105 | 106 | Please check Linux kernel version if it is `5.0.0-23-generic` or higher 107 | ```bash 108 | uname -r 109 | ``` 110 | 111 | Get Linux kernel module 5G GTP-U 112 | ```bash 113 | cd ~ 114 | git clone https://github.com/PrinzOwO/gtp5g.git 115 | ``` 116 | Install Linux kernel module 5G GTP-U 117 | ```bash 118 | cd ~/gtp5g 119 | make 120 | sudo make install 121 | ``` 122 | 5. Network Setting 123 | ```bash 124 | sudo sysctl -w net.ipv4.ip_forward=1 125 | sudo iptables -t nat -A POSTROUTING -o -j MASQUERADE 126 | sudo systemctl stop ufw 127 | ``` 128 | 129 | ### B. Install my5G-core entities 130 | 131 | 1. Clone the My5G-core project and its submodules 132 | ```bash 133 | cd ~ 134 | git clone https://github.com/my5G/my5G-core.git 135 | cd ~/my5G-core 136 | git checkout master 137 | git submodule sync 138 | git submodule update --init --jobs `nproc` 139 | git submodule foreach git checkout master 140 | git submodule foreach git pull --jobs `nproc` 141 | ``` 142 | 143 | 2. Run the script to install dependent packages 144 | ```bash 145 | cd ~/my5G-core 146 | go mod download 147 | ``` 148 | 3. Compile network function services in `my5g-core` 149 | ```bash 150 | cd ~/my5G-core 151 | make all 152 | ``` 153 | 4. Customize the NFs as desired. The NF configuration file is `~/my5G-core/config/cfg.conf`, for example: `~/my5G-core/config/amfcfg.conf`. Samples files are located on: `~/my5G-core/sample/` 154 | 155 | ## Checking 156 | The goal is to validate the installation procedures in order to check if everything is ok. 157 | 158 | ### A. Run the Core Network 159 | 160 | 1. Run network function services individually. 161 | ``` ./bin/ [-free5gccfg ] [-udmcfg ] & ``` 162 | Due to the SBA and the producer/consumer relationship between the NFs, consider the following order to run the network functions: "nrf amf smf udr pcf udm nssf ausf" 163 | 164 | For example, to run the NRF: 165 | 166 | ```bash 167 | cd ~/my5G-core 168 | ./bin/nrf 169 | ``` 170 | to run with customized settings: 171 | ```bash 172 | ./bin/nrf -free5gccfg sample/my5g_basic_config/free5GC.conf -nrfcfg sample/my5g_basic_config/nrfcfg.conf & 173 | ``` 174 | 2. Run whole core network 175 | ```bash 176 | cd ~/my5G-core 177 | ./run.sh 178 | ``` 179 | > Check "log output" for errors (highlighted in red.) 180 | > Adjust the configuration files to resolve the warning messages (in yellow.) 181 | 182 | 183 | -------------------------------------------------------------------------------- /docs/installation-dev-env-setup/env-install.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | free5GC 4 |
5 | 6 | # Setting up development environment 7 | The development environment contains the tools for use throughout the tutorial. Monitoring tools, development tools, and an IDE for the Go language will be installed in this section. 8 | ## Table of Contents 9 | 10 | 11 | 12 | 13 | - [Setting up development environment](#setting-up-development-environment) 14 | - [Table of Contents](#table-of-contents) 15 | - [Installing useful tools](#installing-useful-tools) 16 | - [Opening the project in GoLand](#opening-the-project-in-goland) 17 | 18 | 19 | 20 | 21 | ## Installing useful tools 22 | > All steps must be run from the `/home/` folder with `sudo` privileges. If you are going to customize or install as `root`, please set paths, folders and tools according to your new configuration. 23 | 24 | 1. Before continue, follow the my5G-core installation steps from [here](core-install.md) 25 | 26 | 2. Install some tools required to develop, monitor and containerize: 27 | 28 | System update 29 | ``` 30 | sudo apt update && sudo apt -y upgrade 31 | ``` 32 | Tools installation 33 | 34 | ``` 35 | sudo apt -y install tcpdump wireshark curl snap 36 | ``` 37 | Docker installation 38 | 39 | ``` 40 | curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh 41 | ``` 42 | Docker-compose installation 43 | 44 | ``` 45 | sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 46 | 47 | sudo chmod +x /usr/local/bin/docker-compose && sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose 48 | ``` 49 | JetBrains GoLand IDE 50 | 51 | ``` 52 | sudo snap install goland --classic 53 | ``` 54 | > Jetbrains GoLand IDE has "For Open Source projects" and "For students and teachers" distributions, both free. Click [here](https://account.jetbrains.com/login) to register your account. 55 | 56 | ## Opening the project in GoLand 57 | 58 | 1. Open the project with GoLand 59 | - The project folder should be `~/my5G-core` 60 | 61 | 2. Check that **$GOPATH** and **$GOROOT** are recognized by GoLand and points to the right folders 62 | - Acess menus: File -> Settings 63 | - **$GOROOT** and **$GOPATH** should look like below: 64 | 65 | ![$GOROOT](../figs/go-setup_1.png) 66 | 67 | - **$GOPATH** should show your user instead of _my5G-core_ 68 | 69 | ![2](../figs/go-setup_2.png) 70 | 71 | 3. Now, the IDE should be able to recognize the imports from external libraries and packages under `my5G-core/src/` 72 | 73 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/.env: -------------------------------------------------------------------------------- 1 | CONFIG=./config-vSBrT2020 2 | 3 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_IMAGE_OWNER_UE='my5gcore' 2 | DOCKER_IMAGE_NAME_UE='ue' 3 | DOCKER_IMAGE_TAG_UE='latest' 4 | 5 | 6 | 7 | .PHONY: base 8 | base: 9 | 10 | docker build -t ${DOCKER_IMAGE_OWNER_UE}/${DOCKER_IMAGE_NAME_UE}:${DOCKER_IMAGE_TAG_UE} ./base_ue 11 | docker image ls ${DOCKER_IMAGE_OWNER_UE}/${DOCKER_IMAGE_NAME_UE}:${DOCKER_IMAGE_TAG_UE} 12 | 13 | docker build -t lora:latest ./chirpstack-simulator 14 | docker image ls lora:latest 15 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/base_ue/.ssh/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN OPENSSH PRIVATE KEY----- 2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn 3 | NhAAAAAwEAAQAAAgEAs8kt4JVKWHZFPbDCETloYjJ2WMpMwnBk9fd4lP8iW7OzxrVfKEWV 4 | gmY0CY3MpRQm3kRj4NPMKvRb2qR/itLwOgOvsK6pq3bDuORh3eLImlLNsti3dFlCduWCOs 5 | Cm55OvyfaKE0H47TAo2aIU3FVeSBqH51FWHJi53JRUCnjKQcmsImzCwXoD4Si92VUjPwLS 6 | 1YwCLTdeUPbjeWvI8yQwvvcP5evPcMRpUlGJ9q2wmDxG615+8ADRpGw6SohlJLv9oruQQG 7 | b3ub0+5sK2xmDy42VlYwitRcy8Gzxv9ArpZzCK1AHqNAcI2TkD+YDGLeMvGmw0PLfnbqb4 8 | 9lLtuGrHjhyES8gjfJZJW6vzQkwjHBDHihxsR0Bv/NR/PlxYVuKywa4nIbGZ8bRAtvxgks 9 | pLzSORyT9g43jyKEfhB+06yjernbMdQ8l+OheNzCPeeTluLb1CzTfcwJaPqlEwNugJ6B/m 10 | 5Y1mWyqTSrlZ4ETVt2lu2si6wr/1klj49YtVqGflz4DJGV2Q8vjwcz0sW0Z6tzZIrqpb8n 11 | UlkwSnrg6WFQlss6BojMo9tvKJqIg0dWxLqeu+53fcnnQ6UriROA1Gw/Xo5GRAy7kSoQ+8 12 | H5vmHSOqX3zpiCzbCMA+RasTpFitAeafPHEuhkA4WNoKGIn09Bic27W7aWv3Aywz3+OQDz 13 | sAAAdQiyAvNosgLzYAAAAHc3NoLXJzYQAAAgEAs8kt4JVKWHZFPbDCETloYjJ2WMpMwnBk 14 | 9fd4lP8iW7OzxrVfKEWVgmY0CY3MpRQm3kRj4NPMKvRb2qR/itLwOgOvsK6pq3bDuORh3e 15 | LImlLNsti3dFlCduWCOsCm55OvyfaKE0H47TAo2aIU3FVeSBqH51FWHJi53JRUCnjKQcms 16 | ImzCwXoD4Si92VUjPwLS1YwCLTdeUPbjeWvI8yQwvvcP5evPcMRpUlGJ9q2wmDxG615+8A 17 | DRpGw6SohlJLv9oruQQGb3ub0+5sK2xmDy42VlYwitRcy8Gzxv9ArpZzCK1AHqNAcI2TkD 18 | +YDGLeMvGmw0PLfnbqb49lLtuGrHjhyES8gjfJZJW6vzQkwjHBDHihxsR0Bv/NR/PlxYVu 19 | Kywa4nIbGZ8bRAtvxgkspLzSORyT9g43jyKEfhB+06yjernbMdQ8l+OheNzCPeeTluLb1C 20 | zTfcwJaPqlEwNugJ6B/m5Y1mWyqTSrlZ4ETVt2lu2si6wr/1klj49YtVqGflz4DJGV2Q8v 21 | jwcz0sW0Z6tzZIrqpb8nUlkwSnrg6WFQlss6BojMo9tvKJqIg0dWxLqeu+53fcnnQ6UriR 22 | OA1Gw/Xo5GRAy7kSoQ+8H5vmHSOqX3zpiCzbCMA+RasTpFitAeafPHEuhkA4WNoKGIn09B 23 | ic27W7aWv3Aywz3+OQDzsAAAADAQABAAACAE7ZkgRolYW8wVtwFX1GZ1CB/0Or3gR9FNqH 24 | odv/FcuQQe2JiGV6NztMpc/23+UatH1RE1j8qxO/vjVjZgi1wORAz6I2yHVKDkcd6wpMt1 25 | xvqoWg5LzjlPHecMJh0hHIxRVXynDtw0YLlC73Fh0YV9RZxnceRh0eoo1qhH1fQp2d3J/w 26 | gW4nnGH442LZIy80htFfqWi5WuU5ksSjECwLGFH4u4FEbeNwURzoZBDLVqM99ICwHg4W3d 27 | s2GE6uCWYWCQSBLKACSO2uYVMF3PGefYhb5R6NJKlzRKDRXexziLBYKtsWx+fvmeLjTan0 28 | 33YqqHL3N+XVZmwyUQh/kIEMW95sjuMOAqUJsuQ+D+g580p0I0enTNpmpYh8+Yy4UWan9+ 29 | BN+a7uBYCC7dWuRyUCYXWCVlM8RZpp0xdDjKc8ukvmkn9DenGUalnzWMzPmMsxrSH3lffx 30 | Sex9adplpIN3SGVW42M5sVx3Bao3Cb3mlZAnFG9Kx+/IQK/EdDluD8uN+wRfl+jpFlqKWU 31 | 849OXLzP2pjOF1Slev2Pkn/OBaiaAjMDTjxj54eeebCl2r8z6wpSX8bfGRbBpSIrExsWsT 32 | eKxrSAqQWdHpKckNMZhGQHE1VbmQHXtFv4NEjF1lSytZHcvYicBJbs+ggZEoQ6WuVdg6Q3 33 | 0tPdZHIA0U8ZfQVArhAAABAQCFBq3aX1YtIuGa+YtIT5nvXdvz2Lh+3eSQmC3NaPSgunsM 34 | jps/gQN7/dGZ27xrg5eWNKF4od69lGpv7t3f9Avbk4Q4lRNBBxMV9o7Vram6RdEgnNI1yB 35 | SSGlT7dTFBFbLEVyl5FJONT0aD1bWmHlxjL3gYa2cU489FRvKWwTK3XH2eGtdv5XeGqawR 36 | ZGUM01Ff0wI0ouB29WNK7z3m+mraowuO+etzt6bu9mKdh97VP0fapPLe/Jk6New/Z/3F0P 37 | CGHl4qMtEBQXJ0+oH9mAgqhYpl/5OvPkf6gOxGTxhcO0SYpllsMRG4UchaVpGORTWHr2hA 38 | TLxyq/PhqyyHrpjoAAABAQDij88L57Vj4GpWNbV1xkHKNpiJyekJ9cE2wKkc1Fc5ZStrAI 39 | 3wuEsnW6G3z9V8agUzON/DPj9i6TM1jp0IpGBcLPA4fVWFddzssR7XQHEAcy6bzf58TnGL 40 | oc7oeMzyiG5aVIld+bVBJQYpCUHIGMk3YmvHe/WW+powUumQ/eq4F7pgeVUgxUaDmCp+zB 41 | ye5aLo5Hs0elR9gbHYg/rbwqBUGlbjg7L7S10QW2BQKTo8pPi2khUmKfr94YP5zKP1ATjY 42 | 2hNlTnaFZE580eslFAHqc/YPsajaWDbYXdKFA9mn0fmbPUQ5A0TpQrSjvTxHwl2zzZa3vT 43 | c6tVUwjSg+WFNLAAABAQDLJXMnHUgiLIoL5SnsQBS79NmSztBvNmreoMsdq3az2kEJhEiR 44 | OAVvwjDZrgoS30LuRgi2+SOvmL5KcVDvmaQW4UPtl7fpGQZXKk4DivlaeZaNiZTtU6J1R1 45 | 6GwAH6LIvnJI8+3zqhIqiGMo9ljyKvTfktuzhtsKBiQYvz/YoH68YRCM3JCQZqtjmZpz/s 46 | CitNktgogx5+3u4EFii3YcIZQjkTi1RIzWNp+ov1hZeVVFGyr7PtRVcNGTZOhcNM4noqMN 47 | 4MoewmUKIMAtGBVTueVC2lw+yCxLgYGZOiP8Y8K4ejCQojPybgJ16ZrAbpe+jpZQLGTOX4 48 | hOUvhpNuo83RAAAAF3NhbXVlbHdhbmJlcmdAZ21haWwuY29tAQID 49 | -----END OPENSSH PRIVATE KEY----- 50 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/base_ue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.14.4-stretch AS builder 2 | 3 | LABEL maintainer="My5Gcore " 4 | 5 | ENV MY5GC_BRANCH master 6 | #ENV UE_BRANCH vSBrT2020 7 | ENV UE_BRANCH master 8 | 9 | RUN apt-get update 10 | RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev ssh 11 | RUN apt-get clean 12 | 13 | # Get My5Gcore 14 | RUN cd $GOPATH/src \ 15 | && git clone --recursive -b ${MY5GC_BRANCH} -j 33 https://github.com/LABORA-INF-UFG/my5Gcore.git \ 16 | && cd my5Gcore \ 17 | && go mod download 18 | 19 | ## ssh key configuration 20 | RUN mkdir /root/.ssh 21 | COPY .ssh/id_rsa /root/.ssh/id_rsa 22 | RUN chown 400 /root/.ssh/id_rsa 23 | #RUN ssh-add /root/.ssh/id_rsa.pub 24 | 25 | RUN touch /root/.ssh/known_hosts 26 | RUN ssh-keyscan github.com >> /root/.ssh/known_hosts 27 | 28 | # Get UE Code 29 | RUN cd $GOPATH/src/my5Gcore/src \ 30 | && git clone -b ${UE_BRANCH} https://github.com/LABORA-INF-UFG/UE-IoT-non3GPP.git ue \ 31 | && go get -u github.com/calee0219/fatal 32 | 33 | # Build UE 34 | RUN cd $GOPATH/src/my5Gcore/src \ 35 | && CGO_ENABLED=0 go build -a -installsuffix nocgo -o ../bin/ue -x ue/ue.go 36 | 37 | # Alpine is used for debug purpose. You can use scratch for a smaller footprint. 38 | FROM alpine 39 | 40 | WORKDIR /my5Gcore 41 | RUN mkdir -p config/ support/TLS/ 42 | 43 | # Copy executables 44 | COPY --from=builder /go/src/my5Gcore/bin/* ./ 45 | 46 | # Copy configuration files (not used for now) 47 | COPY --from=builder /go/src/my5Gcore/config/* ./config/ 48 | 49 | # Copy default certificates (not used for now) 50 | COPY --from=builder /go/src/my5Gcore/support/TLS/* ./support/TLS/ 51 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.13-alpine 2 | 3 | ENV PROJECT_PATH=/chirpstack-simulator 4 | ENV PATH=$PATH:$PROJECT_PATH/build 5 | ENV CGO_ENABLED=0 6 | ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo" 7 | 8 | RUN apk add --no-cache ca-certificates tzdata make git bash 9 | 10 | RUN mkdir -p $PROJECT_PATH 11 | WORKDIR $PROJECT_PATH 12 | COPY . $PROJECT_PATH 13 | RUN make clean build 14 | WORKDIR $PROJECT_PATH 15 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/Dockerfile-devel: -------------------------------------------------------------------------------- 1 | FROM golang:1.13-alpine 2 | 3 | ENV PROJECT_PATH=/chirpstack-simulator 4 | ENV PATH=$PATH:$PROJECT_PATH/build 5 | ENV CGO_ENABLED=0 6 | ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo" 7 | 8 | RUN apk add --no-cache ca-certificates tzdata make git bash 9 | 10 | RUN mkdir -p $PROJECT_PATH 11 | COPY . $PROJECT_PATH 12 | WORKDIR $PROJECT_PATH 13 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Orne Brocaar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build clean 2 | VERSION := $(shell git describe --always |sed -e "s/^v//") 3 | 4 | build: 5 | @echo "Compiling source" 6 | @mkdir -p build 7 | go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/chirpstack-simulator cmd/chirpstack-simulator/main.go 8 | 9 | clean: 10 | @echo "Cleaning up workspace" 11 | @rm -rf build 12 | @rm -rf dist 13 | @rm -rf docs/public 14 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/README.md: -------------------------------------------------------------------------------- 1 | # ChirpStack Simulator 2 | 3 | ChirpStack Simulator is an open-source simulator for the [ChirpStack](https://www.chirpstack.io) 4 | open-source LoRaWAN® Network-Server stack. It simulates 5 | a configurable number of devices and gateways, which will be automatically 6 | created on starting the simulation. 7 | 8 | This project has been developed together with [TWTG](https://www.twtg.io/). 9 | 10 | ## Building 11 | 12 | The recommended way to compile the simulator code is using [Docker Compose](https://docs.docker.com/compose/). 13 | Example: 14 | 15 | ```bash 16 | docker-compose run --rm chirpstack-simulator make clean build 17 | ``` 18 | 19 | The binary will be located under `build/chirpstack-simulator`. 20 | 21 | ## Configuration 22 | 23 | For generating a configuration template, use the following command: 24 | 25 | ```bash 26 | ./build/chirpstack-simulator configfile > chirpstack-simulator.toml 27 | ``` 28 | 29 | ### Example 30 | 31 | ```toml 32 | [general] 33 | # Log level 34 | # 35 | # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 36 | log_level=4 37 | 38 | 39 | # Application Server configuration. 40 | [application_server] 41 | 42 | # API configuration. 43 | # 44 | # This configuration is used to automatically create the: 45 | # * Device profile 46 | # * Gateways 47 | # * Application 48 | # * Devices 49 | [application_server.api] 50 | 51 | # JWT token. 52 | # 53 | # The JWT token to connect to the ChirpStack Application Server API. This 54 | # token can be generated using the login API endpoint. In the near-future 55 | # it will be possible to generate these tokens within the web-interface: 56 | # https://github.com/brocaar/chirpstack-application-server/pull/421 57 | jwt_token="" 58 | 59 | # Server. 60 | # 61 | # This must point to the external API server of the ChirpStack Application 62 | # Server. When the server is running on the same machine, keep this to the 63 | # default value. 64 | server="127.0.0.1:8080" 65 | 66 | # Insecure. 67 | # 68 | # Set this to true when the endpoint is not using TLS. 69 | insecure=false 70 | 71 | 72 | # MQTT integration configuration. 73 | # 74 | # This integration is used for counting the number of uplinks that are 75 | # published by the ChirpStack Application Server integration. 76 | [application_server.integration.mqtt] 77 | 78 | # MQTT server. 79 | server="tcp://127.0.0.1:1883" 80 | 81 | # Username. 82 | username="" 83 | 84 | # Password. 85 | password="" 86 | 87 | 88 | # Network Server configuration. 89 | # 90 | # This configuration is used to simulate LoRa gateways using the MQTT gateway 91 | # backend. 92 | [network_server] 93 | 94 | # MQTT gateway backend. 95 | [network_server.gateway.backend.mqtt] 96 | 97 | # MQTT server. 98 | server="tcp://127.0.0.1:1883" 99 | 100 | # Username. 101 | username="" 102 | 103 | # Password. 104 | password="" 105 | 106 | 107 | # Simulator configuration. 108 | [[simulator]] 109 | 110 | # Service-profile ID. 111 | # 112 | # It is recommended to create a new organization with a new service-profile 113 | # in the ChirpStack Application Server. 114 | service_profile_id="1f32476e-a112-4f00-bcc7-4aab4bfefa1d" 115 | 116 | # Duration. 117 | # 118 | # This defines the duration of the simulation. If set to '0s', the simulation 119 | # will run until terminated. 120 | duration="5m" 121 | 122 | # Activation time. 123 | # 124 | # This is the time that the simulator takes to activate the devices. This 125 | # value must be less than the simulator duration. 126 | activation_time="1m" 127 | 128 | # Device configuration. 129 | [simulator.device] 130 | 131 | # Number of devices to simulate. 132 | count=1000 133 | 134 | # Uplink interval. 135 | uplink_interval="5m" 136 | 137 | # FPort. 138 | f_port=10 139 | 140 | # Payload (HEX encoded). 141 | payload="010203" 142 | 143 | # Frequency (Hz). 144 | frequency=868100000 145 | 146 | # Bandwidth (Hz). 147 | bandwidth=125000 148 | 149 | # Spreading-factor. 150 | spreading_factor=7 151 | 152 | # Gateway configuration. 153 | [simulator.gateway] 154 | 155 | # Min number of receiving gateways. 156 | min_count=3 157 | 158 | # Max number of receiving gateways. 159 | max_count=5 160 | 161 | # Event topic template. 162 | event_topic_template="gateway/{{ .GatewayID }}/event/{{ .Event }}" 163 | 164 | # Command topic template. 165 | command_topic_template="gateway/{{ .GatewayID }}/command/{{ .Command }}" 166 | 167 | 168 | # Prometheus metrics configuration. 169 | # 170 | # Using Prometheus (and Grafana), it is possible to visualize various 171 | # simulation metrics like: 172 | # * Join-Requests sent 173 | # * Join-Accepts received 174 | # * Uplinks sent (by the devices) 175 | # * Uplinks sent (by the gateways) 176 | # * Uplinks sent (by the ChirpStack Application Server MQTT integration) 177 | [prometheus] 178 | 179 | # IP:port to bind the Prometheus endpoint to. 180 | # 181 | # Metrics can be retrieved from /metrics. 182 | bind="0.0.0.0:9000" 183 | ``` 184 | 185 | ## Running the simulator 186 | 187 | To start the simulator, execute the following command: 188 | 189 | ```bash 190 | ./build/chirpstack-simulator -c chirpstack-simulator.toml 191 | ``` 192 | 193 | When a duration has been configured, then the simulation will stop after 194 | the given interval. Note that this does not terminate the process! This makes 195 | it possible to still read Prometheus metrics after the simulation has been 196 | completed. 197 | 198 | Regardless if a duration has been configured or not, the simulator can be 199 | terminated. When sending an interrupt signal once, the simulation will be 200 | terminated and the simulator will clean up the created gateways, devices, 201 | application and device-profile. When sending an interrupt for the second time, 202 | the simulator will be terminated immediately. 203 | 204 | ## Prometheus metrics 205 | 206 | The ChirpStack Simulator provides various metrics that can be collected using 207 | [Prometheus](https://prometheus.io/) and visualized using [Grafana](https://grafana.com/). 208 | 209 | * `device_uplink_count`: The number of uplinks sent by the devices 210 | * `device_join_request_count`: The number of join-requests sent by the devices 211 | * `device_join_accept_count`: The number of join-accepts received by the devices 212 | * `application_uplink_count`: The number of uplinks published by the application integration 213 | * `gateway_uplink_count`: The number of uplinks sent by the gateways 214 | * `gateway_downlink_count`: The number of downlinks received by the gateways 215 | 216 | ## License 217 | 218 | ChirpStack Simulator is distributed under the MIT license. See also 219 | [LICENSE](https://github.com/brocaar/chirpstack-simulator/blob/master/LICENSE). 220 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/build/chirpstack-simulator: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/build/chirpstack-simulator -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/build/chirpstack-simulator.toml: -------------------------------------------------------------------------------- 1 | [general] 2 | # Log level 3 | # 4 | # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 5 | log_level=4 6 | 7 | 8 | # Application Server configuration. 9 | [application_server] 10 | 11 | # API configuration. 12 | # 13 | # This configuration is used to automatically create the: 14 | # * Device profile 15 | # * Gateways 16 | # * Application 17 | # * Devices 18 | [application_server.api] 19 | 20 | # JWT token. 21 | # 22 | # The JWT token to connect to the ChirpStack Application Server API. This 23 | # token can be generated using the login API endpoint. In the near-future 24 | # it will be possible to generate these tokens within the web-interface: 25 | # https://github.com/brocaar/chirpstack-application-server/pull/421 26 | jwt_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGlfa2V5X2lkIjoiYWI4MTZmYTYtZGYwNy00ZGMzLTlmYTYtZDAyNWVhYmE4MmFjIiwiYXVkIjoiYXMiLCJpc3MiOiJhcyIsIm5iZiI6MTYwNTg1OTg3OSwic3ViIjoiYXBpX2tleSJ9.oFq4l2H3qGZDNEddTpW5VpfbtOu3KI8ZppVY5rofhfk" 27 | 28 | # Server. 29 | # 30 | # This must point to the external API server of the ChirpStack Application 31 | # Server. When the server is running on the same machine, keep this to the 32 | # default value. 33 | server="127.0.0.1:8080" 34 | 35 | # Insecure. 36 | # 37 | # Set this to true when the endpoint is not using TLS. 38 | insecure=false 39 | 40 | 41 | # MQTT integration configuration. 42 | # 43 | # This integration is used for counting the number of uplinks that are 44 | # published by the ChirpStack Application Server integration. 45 | [application_server.integration.mqtt] 46 | 47 | # MQTT server. 48 | server="tcp://127.0.0.1:1883" 49 | 50 | # Username. 51 | username="" 52 | 53 | # Password. 54 | password="" 55 | 56 | 57 | # Network Server configuration. 58 | # 59 | # This configuration is used to simulate LoRa gateways using the MQTT gateway 60 | # backend. 61 | [network_server] 62 | 63 | # MQTT gateway backend. 64 | [network_server.gateway.backend.mqtt] 65 | 66 | # MQTT server. 67 | server="tcp://127.0.0.1:1883" 68 | 69 | # Username. 70 | username="" 71 | 72 | # Password. 73 | password="" 74 | 75 | 76 | # Simulator configuration. 77 | # 78 | # Example: 79 | # [[simulator]] 80 | # 81 | # # Service-profile ID. 82 | # # 83 | # # It is recommended to create a new organization with a new service-profile 84 | # # in the ChirpStack Application Server. 85 | # service_profile_id="1f32476e-a112-4f00-bcc7-4aab4bfefa1d" 86 | # 87 | # # Duration. 88 | # # 89 | # # This defines the duration of the simulation. If set to '0s', the simulation 90 | # # will run until terminated. This includes the activation time. 91 | # duration="5m" 92 | # 93 | # # Activation time. 94 | # # 95 | # # This is the time that the simulator takes to activate the devices. This 96 | # # value must be less than the simulator duration. 97 | # activation_time="1m" 98 | # 99 | # # Device configuration. 100 | # [simulator.device] 101 | # 102 | # # Number of devices to simulate. 103 | # count=1000 104 | # 105 | # # Uplink interval. 106 | # uplink_interval="5m" 107 | # 108 | # # FPort. 109 | # f_port=10 110 | # 111 | # # Payload (HEX encoded). 112 | # payload="010203" 113 | # 114 | # # Frequency (Hz). 115 | # frequency=868100000 116 | # 117 | # # Bandwidth (Hz). 118 | # bandwidth=125000 119 | # 120 | # # Spreading-factor. 121 | # spreading_factor=7 122 | # 123 | # # Gateway configuration. 124 | # [simulator.gateway] 125 | # 126 | # # Event topic template. 127 | # event_topic_template="gateway/{{ .GatewayID }}/event/{{ .Event }}" 128 | # 129 | # # Command topic template. 130 | # command_topic_template="gateway/{{ .GatewayID }}/command/{{ .Command }}" 131 | # 132 | # # Min number of receiving gateways. 133 | # min_count=3 134 | # 135 | # # Max number of receiving gateways. 136 | # max_count=5 137 | 138 | 139 | # Prometheus metrics configuration. 140 | # 141 | # Using Prometheus (and Grafana), it is possible to visualize various 142 | # simulation metrics like: 143 | # * Join-Requests sent 144 | # * Join-Accepts received 145 | # * Uplinks sent (by the devices) 146 | # * Uplinks sent (by the gateways) 147 | # * Uplinks sent (by the ChirpStack Application Server MQTT integration) 148 | [prometheus] 149 | 150 | # IP:port to bind the Prometheus endpoint to. 151 | # 152 | # Metrics can be retrieved from /metrics. 153 | bind="0.0.0.0:9000" 154 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/build/lora.toml: -------------------------------------------------------------------------------- 1 | [general] 2 | # Log level 3 | # 4 | # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 5 | log_level=4 6 | 7 | 8 | # Application Server configuration. 9 | [application_server] 10 | 11 | # API configuration. 12 | # 13 | # This configuration is used to automatically create the: 14 | # * Device profile 15 | # * Gateways 16 | # * Application 17 | # * Devices 18 | [application_server.api] 19 | 20 | # JWT token. 21 | # 22 | # The JWT token to connect to the ChirpStack Application Server API. This 23 | # token can be generated using the login API endpoint. In the near-future 24 | # it will be possible to generate these tokens within the web-interface: 25 | # https://github.com/brocaar/chirpstack-application-server/pull/421 26 | jwt_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGlfa2V5X2lkIjoiNzkwMzUxMGQtODc5ZC00M2IyLTk1NGQtNmI0YWY5MTQ4ZjcwIiwiYXVkIjoiYXMiLCJpc3MiOiJhcyIsIm5iZiI6MTYwNTg2MDkxNywic3ViIjoiYXBpX2tleSJ9.EwqXSCqEVLYNSEYy6t-aYCNOTD11vYgK0oDdsX3A2Qs" 27 | 28 | # Server. 29 | # 30 | # This must point to the external API server of the ChirpStack Application 31 | # Server. When the server is running on the same machine, keep this to the 32 | # default value. 33 | server="127.0.0.1:8080" 34 | 35 | # Insecure. 36 | # 37 | # Set this to true when the endpoint is not using TLS. 38 | insecure=true 39 | 40 | 41 | # MQTT integration configuration. 42 | # 43 | # This integration is used for counting the number of uplinks that are 44 | # published by the ChirpStack Application Server integration. 45 | [application_server.integration.mqtt] 46 | 47 | # MQTT server. 48 | server="tcp://127.0.0.1:1883" 49 | 50 | # Username. 51 | username="" 52 | 53 | # Password. 54 | password="" 55 | 56 | 57 | # Network Server configuration. 58 | # 59 | # This configuration is used to simulate LoRa gateways using the MQTT gateway 60 | # backend. 61 | [network_server] 62 | 63 | # MQTT gateway backend. 64 | [network_server.gateway.backend.mqtt] 65 | 66 | # MQTT server. 67 | server="tcp://127.0.0.1:1883" 68 | 69 | # Username. 70 | username="" 71 | 72 | # Password. 73 | password="" 74 | 75 | 76 | # Simulator configuration. 77 | [[simulator]] 78 | 79 | # Service-profile ID. 80 | # 81 | # It is recommended to create a new organization with a new service-profile 82 | # in the ChirpStack Application Server. 83 | service_profile_id="9a355cec-4742-4e9f-9507-685433bc7b4e" 84 | 85 | # Duration. 86 | # 87 | # This defines the duration of the simulation. If set to '0s', the simulation 88 | # will run until terminated. 89 | duration="5m" 90 | 91 | # Activation time. 92 | # 93 | # This is the time that the simulator takes to activate the devices. This 94 | # value must be less than the simulator duration. 95 | activation_time="1m" 96 | 97 | # Device configuration. 98 | [simulator.device] 99 | 100 | # Number of devices to simulate. 101 | count=50 102 | 103 | # Uplink interval. 104 | uplink_interval="1m" 105 | 106 | # FPort. 107 | f_port=10 108 | 109 | # Payload (HEX encoded). 110 | payload="010203" 111 | 112 | # Frequency (Hz). 113 | frequency=868100000 114 | 115 | # Bandwidth (Hz). 116 | bandwidth=125000 117 | 118 | # Spreading-factor. 119 | spreading_factor=7 120 | 121 | # Gateway configuration. 122 | [simulator.gateway] 123 | 124 | # Min number of receiving gateways. 125 | min_count=1 126 | 127 | # Max number of receiving gateways. 128 | max_count=1 129 | 130 | # Event topic template. 131 | event_topic_template="gateway/{{ .GatewayID }}/event/{{ .Event }}" 132 | 133 | # Command topic template. 134 | command_topic_template="gateway/{{ .GatewayID }}/command/{{ .Command }}" 135 | 136 | 137 | # Prometheus metrics configuration. 138 | # 139 | # Using Prometheus (and Grafana), it is possible to visualize various 140 | # simulation metrics like: 141 | # * Join-Requests sent 142 | # * Join-Accepts received 143 | # * Uplinks sent (by the devices) 144 | # * Uplinks sent (by the gateways) 145 | # * Uplinks sent (by the ChirpStack Application Server MQTT integration) 146 | [prometheus] 147 | 148 | # IP:port to bind the Prometheus endpoint to. 149 | # 150 | # Metrics can be retrieved from /metrics. 151 | bind="0.0.0.0:9000" 152 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/cmd/chirpstack-simulator/cmd/configfile.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "os" 5 | "text/template" 6 | 7 | "github.com/pkg/errors" 8 | "github.com/spf13/cobra" 9 | 10 | "github.com/brocaar/chirpstack-simulator/internal/config" 11 | ) 12 | 13 | const configTemplate = `[general] 14 | # Log level 15 | # 16 | # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 17 | log_level={{ .General.LogLevel }} 18 | 19 | 20 | # Application Server configuration. 21 | [application_server] 22 | 23 | # API configuration. 24 | # 25 | # This configuration is used to automatically create the: 26 | # * Device profile 27 | # * Gateways 28 | # * Application 29 | # * Devices 30 | [application_server.api] 31 | 32 | # JWT token. 33 | # 34 | # The JWT token to connect to the ChirpStack Application Server API. This 35 | # token can be generated using the login API endpoint. In the near-future 36 | # it will be possible to generate these tokens within the web-interface: 37 | # https://github.com/brocaar/chirpstack-application-server/pull/421 38 | jwt_token="{{ .ApplicationServer.API.JWTToken }}" 39 | 40 | # Server. 41 | # 42 | # This must point to the external API server of the ChirpStack Application 43 | # Server. When the server is running on the same machine, keep this to the 44 | # default value. 45 | server="{{ .ApplicationServer.API.Server }}" 46 | 47 | # Insecure. 48 | # 49 | # Set this to true when the endpoint is not using TLS. 50 | insecure={{ .ApplicationServer.API.Insecure }} 51 | 52 | 53 | # MQTT integration configuration. 54 | # 55 | # This integration is used for counting the number of uplinks that are 56 | # published by the ChirpStack Application Server integration. 57 | [application_server.integration.mqtt] 58 | 59 | # MQTT server. 60 | server="{{ .ApplicationServer.Integration.MQTT.Server }}" 61 | 62 | # Username. 63 | username="{{ .ApplicationServer.Integration.MQTT.Username }}" 64 | 65 | # Password. 66 | password="{{ .ApplicationServer.Integration.MQTT.Password }}" 67 | 68 | 69 | # Network Server configuration. 70 | # 71 | # This configuration is used to simulate LoRa gateways using the MQTT gateway 72 | # backend. 73 | [network_server] 74 | 75 | # MQTT gateway backend. 76 | [network_server.gateway.backend.mqtt] 77 | 78 | # MQTT server. 79 | server="{{ .NetworkServer.Gateway.Backend.MQTT.Server }}" 80 | 81 | # Username. 82 | username="{{ .NetworkServer.Gateway.Backend.MQTT.Username }}" 83 | 84 | # Password. 85 | password="{{ .NetworkServer.Gateway.Backend.MQTT.Password }}" 86 | 87 | 88 | # Simulator configuration. 89 | # 90 | # Example: 91 | # [[simulator]] 92 | # 93 | # # Service-profile ID. 94 | # # 95 | # # It is recommended to create a new organization with a new service-profile 96 | # # in the ChirpStack Application Server. 97 | # service_profile_id="1f32476e-a112-4f00-bcc7-4aab4bfefa1d" 98 | # 99 | # # Duration. 100 | # # 101 | # # This defines the duration of the simulation. If set to '0s', the simulation 102 | # # will run until terminated. This includes the activation time. 103 | # duration="5m" 104 | # 105 | # # Activation time. 106 | # # 107 | # # This is the time that the simulator takes to activate the devices. This 108 | # # value must be less than the simulator duration. 109 | # activation_time="1m" 110 | # 111 | # # Device configuration. 112 | # [simulator.device] 113 | # 114 | # # Number of devices to simulate. 115 | # count=1000 116 | # 117 | # # Uplink interval. 118 | # uplink_interval="5m" 119 | # 120 | # # FPort. 121 | # f_port=10 122 | # 123 | # # Payload (HEX encoded). 124 | # payload="010203" 125 | # 126 | # # Frequency (Hz). 127 | # frequency=868100000 128 | # 129 | # # Bandwidth (Hz). 130 | # bandwidth=125000 131 | # 132 | # # Spreading-factor. 133 | # spreading_factor=7 134 | # 135 | # # Gateway configuration. 136 | # [simulator.gateway] 137 | # 138 | # # Event topic template. 139 | # event_topic_template="{{ "gateway/{{ .GatewayID }}/event/{{ .Event }}" }}" 140 | # 141 | # # Command topic template. 142 | # command_topic_template="{{ "gateway/{{ .GatewayID }}/command/{{ .Command }}" }}" 143 | # 144 | # # Min number of receiving gateways. 145 | # min_count=3 146 | # 147 | # # Max number of receiving gateways. 148 | # max_count=5 149 | {{ range $index, $element := .Simulator }} 150 | [[simulator]] 151 | service_profile_id="{{ $element.ServiceProfileID }}" 152 | duration="{{ $element.Duration }}" 153 | activation_time="{{ $element.ActivationTime }}" 154 | 155 | [simulator.device] 156 | count={{ $element.Device.Count }} 157 | uplink_interval="{{ $element.Device.UplinkInterval }}" 158 | f_port="{{ $element.Device.FPort }}" 159 | payload="{{ $element.Device.Payload }}" 160 | frequency={{ $element.Device.Frequency }} 161 | bandwidth={{ $element.Device.Bandwidth }} 162 | spreading_factor={{ $element.Device.SpreadingFactor }} 163 | 164 | [simulator.gateway] 165 | min_count={{ $element.Gateway.MinCount }} 166 | max_count={{ $element.Gateway.MaxCount }} 167 | event_topic_template="{{ $element.Gateway.EventTopicTemplate }}" 168 | command_topic_template="{{ $element.Gateway.CommandTopicTemplate }}" 169 | {{ end }} 170 | 171 | # Prometheus metrics configuration. 172 | # 173 | # Using Prometheus (and Grafana), it is possible to visualize various 174 | # simulation metrics like: 175 | # * Join-Requests sent 176 | # * Join-Accepts received 177 | # * Uplinks sent (by the devices) 178 | # * Uplinks sent (by the gateways) 179 | # * Uplinks sent (by the ChirpStack Application Server MQTT integration) 180 | [prometheus] 181 | 182 | # IP:port to bind the Prometheus endpoint to. 183 | # 184 | # Metrics can be retrieved from /metrics. 185 | bind="{{ .Prometheus.Bind }}" 186 | ` 187 | 188 | var configCmd = &cobra.Command{ 189 | Use: "configfile", 190 | Short: "Print the ChirpStack Network Server configuration file", 191 | RunE: func(cmd *cobra.Command, args []string) error { 192 | t := template.Must(template.New("config").Parse(configTemplate)) 193 | err := t.Execute(os.Stdout, &config.C) 194 | if err != nil { 195 | return errors.Wrap(err, "execute config template error") 196 | } 197 | return nil 198 | }, 199 | } 200 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/cmd/chirpstack-simulator/cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | 7 | "github.com/brocaar/chirpstack-simulator/internal/config" 8 | log "github.com/sirupsen/logrus" 9 | "github.com/spf13/cobra" 10 | "github.com/spf13/viper" 11 | ) 12 | 13 | var cfgFile string 14 | var version string 15 | 16 | // Execute executes the root command. 17 | func Execute(v string) { 18 | version = v 19 | if err := rootCmd.Execute(); err != nil { 20 | log.Fatal(err) 21 | } 22 | } 23 | 24 | var rootCmd = &cobra.Command{ 25 | Use: "chirpstack-simulator", 26 | Short: "ChirpStack Simulator", 27 | Long: `ChirpStack Simulator simulates device uplinks 28 | > documentation & support: https://www.chirpstack.io/ 29 | > source & copyright information: https://github.com/brocaar/chirpstack-simulator/`, 30 | RunE: run, 31 | } 32 | 33 | func init() { 34 | cobra.OnInitialize(initConfig) 35 | 36 | rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "path to configuration file (optional)") 37 | rootCmd.PersistentFlags().Int("log-level", 4, "debug=5, info=4, error=2, fatal=1, panic=0") 38 | 39 | viper.BindPFlag("general.log_level", rootCmd.PersistentFlags().Lookup("log-level")) 40 | 41 | viper.SetDefault("application_server.api.server", "127.0.0.1:8080") 42 | viper.SetDefault("application_server.integration.mqtt.server", "tcp://127.0.0.1:1883") 43 | viper.SetDefault("network_server.gateway.backend.mqtt.server", "tcp://127.0.0.1:1883") 44 | viper.SetDefault("prometheus.bind", "0.0.0.0:9000") 45 | 46 | rootCmd.AddCommand(versionCmd) 47 | rootCmd.AddCommand(configCmd) 48 | } 49 | 50 | func initConfig() { 51 | config.Version = version 52 | 53 | if cfgFile != "" { 54 | b, err := ioutil.ReadFile(cfgFile) 55 | if err != nil { 56 | log.WithError(err).WithField("config", cfgFile).Fatal("error loading config file") 57 | } 58 | viper.SetConfigType("toml") 59 | if err := viper.ReadConfig(bytes.NewBuffer(b)); err != nil { 60 | log.WithError(err).WithField("config", cfgFile).Fatal("error loading config file") 61 | } 62 | } else { 63 | viper.SetConfigName("chirpstack-simulator") 64 | viper.AddConfigPath(".") 65 | viper.AddConfigPath("$HOME/.config/chirpstack-simulator") 66 | viper.AddConfigPath("/etc/chirpstack-simulator") 67 | if err := viper.ReadInConfig(); err != nil { 68 | switch err.(type) { 69 | case viper.ConfigFileNotFoundError: 70 | default: 71 | log.WithError(err).Fatal("read configuration file error") 72 | } 73 | } 74 | } 75 | 76 | if err := viper.Unmarshal(&config.C); err != nil { 77 | log.WithError(err).Fatal("unmarshal config error") 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/cmd/chirpstack-simulator/cmd/root_run.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | "os" 7 | "os/signal" 8 | "sync" 9 | "syscall" 10 | 11 | "github.com/pkg/errors" 12 | "github.com/prometheus/client_golang/prometheus/promhttp" 13 | log "github.com/sirupsen/logrus" 14 | "github.com/spf13/cobra" 15 | 16 | "github.com/brocaar/chirpstack-simulator/internal/as" 17 | "github.com/brocaar/chirpstack-simulator/internal/config" 18 | "github.com/brocaar/chirpstack-simulator/internal/ns" 19 | "github.com/brocaar/chirpstack-simulator/internal/simulator" 20 | ) 21 | 22 | func run(cnd *cobra.Command, args []string) error { 23 | tasks := []func(context.Context, *sync.WaitGroup) error{ 24 | setLogLevel, 25 | printStartMessage, 26 | setupASAPIClient, 27 | setupASIntegration, 28 | setupNSIntegration, 29 | setupPrometheus, 30 | startSimulator, 31 | } 32 | 33 | var wg sync.WaitGroup 34 | ctx, cancel := context.WithCancel(context.Background()) 35 | 36 | for _, t := range tasks { 37 | if err := t(ctx, &wg); err != nil { 38 | log.Fatal(err) 39 | } 40 | } 41 | 42 | exitChan := make(chan struct{}) 43 | sigChan := make(chan os.Signal) 44 | signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) 45 | <-sigChan 46 | go func() { 47 | cancel() 48 | wg.Wait() 49 | exitChan <- struct{}{} 50 | }() 51 | cancel() 52 | select { 53 | case <-exitChan: 54 | case s := <-sigChan: 55 | log.WithField("signal", s).Info("signal received, terminating") 56 | } 57 | 58 | return nil 59 | } 60 | 61 | func setLogLevel(ctx context.Context, wg *sync.WaitGroup) error { 62 | log.SetLevel(log.Level(uint8(config.C.General.LogLevel))) 63 | return nil 64 | } 65 | 66 | func printStartMessage(ctx context.Context, wg *sync.WaitGroup) error { 67 | log.WithFields(log.Fields{ 68 | "version": version, 69 | "docs": "https://www.chirpstack.io/", 70 | }).Info("starting ChirpStack Simulator") 71 | return nil 72 | } 73 | 74 | func setupASAPIClient(ctx context.Context, wg *sync.WaitGroup) error { 75 | return as.Setup(config.C) 76 | } 77 | 78 | func setupASIntegration(ctx context.Context, wg *sync.WaitGroup) error { 79 | return nil 80 | } 81 | 82 | func setupNSIntegration(ctx context.Context, wg *sync.WaitGroup) error { 83 | return ns.Setup(config.C) 84 | } 85 | 86 | func setupPrometheus(ctx context.Context, wg *sync.WaitGroup) error { 87 | log.WithFields(log.Fields{ 88 | "bind": config.C.Prometheus.Bind, 89 | }).Info("starting Prometheus endpoint server") 90 | 91 | mux := http.NewServeMux() 92 | mux.Handle("/metrics", promhttp.Handler()) 93 | 94 | server := http.Server{ 95 | Handler: mux, 96 | Addr: config.C.Prometheus.Bind, 97 | } 98 | 99 | go func() { 100 | err := server.ListenAndServe() 101 | log.WithError(err).Error("prometheus endpoint server error") 102 | }() 103 | 104 | return nil 105 | } 106 | 107 | func startSimulator(ctx context.Context, wg *sync.WaitGroup) error { 108 | if err := simulator.Start(ctx, wg, config.C); err != nil { 109 | return errors.Wrap(err, "start simulator error") 110 | } 111 | 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/cmd/chirpstack-simulator/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | ) 8 | 9 | var versionCmd = &cobra.Command{ 10 | Use: "version", 11 | Short: "Print the ChirpStack Network Server version", 12 | Run: func(cmd *cobra.Command, args []string) { 13 | fmt.Println(version) 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/cmd/chirpstack-simulator/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/brocaar/chirpstack-simulator/cmd/chirpstack-simulator/cmd" 4 | 5 | var version string // set by the compiler 6 | 7 | func main() { 8 | cmd.Execute(version) 9 | } 10 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | services: 3 | chirpstack-simulator: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile-devel 7 | command: make 8 | volumes: 9 | - ./:/chirpstack-simulator 10 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/examples/single_uplink/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "encoding/hex" 6 | "sync" 7 | "time" 8 | 9 | "github.com/brocaar/chirpstack-api/go/v3/common" 10 | "github.com/brocaar/chirpstack-api/go/v3/gw" 11 | "github.com/brocaar/chirpstack-simulator/simulator" 12 | "github.com/brocaar/lorawan" 13 | log "github.com/sirupsen/logrus" 14 | ) 15 | 16 | // This example simulates an OTAA activation and the sending of a single uplink 17 | // frame, after which the simulation terminates. 18 | func main() { 19 | gatewayID := lorawan.EUI64{1, 1, 1, 1, 1, 1, 1, 1} 20 | devEUI := lorawan.EUI64{2, 1, 1, 1, 1, 1, 1, 1} 21 | appKey := lorawan.AES128Key{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} 22 | 23 | var wg sync.WaitGroup 24 | ctx := context.Background() 25 | 26 | sgw, err := simulator.NewGateway( 27 | simulator.WithMQTTCredentials("localhost:1883", "", ""), 28 | simulator.WithGatewayID(gatewayID), 29 | simulator.WithEventTopicTemplate("gateway/{{ .GatewayID }}/event/{{ .Event }}"), 30 | simulator.WithCommandTopicTemplate("gateway/{{ .GatewayID }}/command/{{ .Command }}"), 31 | ) 32 | if err != nil { 33 | panic(err) 34 | } 35 | 36 | _, err = simulator.NewDevice(ctx, &wg, 37 | simulator.WithDevEUI(devEUI), 38 | simulator.WithAppKey(appKey), 39 | simulator.WithRandomDevNonce(), 40 | simulator.WithUplinkInterval(time.Second), 41 | simulator.WithUplinkCount(1), 42 | simulator.WithUplinkPayload(true, 10, []byte{1, 2, 3}), 43 | simulator.WithUplinkTXInfo(gw.UplinkTXInfo{ 44 | Frequency: 868100000, 45 | Modulation: common.Modulation_LORA, 46 | ModulationInfo: &gw.UplinkTXInfo_LoraModulationInfo{ 47 | LoraModulationInfo: &gw.LoRaModulationInfo{ 48 | Bandwidth: 125, 49 | SpreadingFactor: 7, 50 | CodeRate: "3/4", 51 | }, 52 | }, 53 | }), 54 | simulator.WithGateways([]*simulator.Gateway{sgw}), 55 | simulator.WithDownlinkHandlerFunc(func(conf, ack bool, fCntDown uint32, fPort uint8, data []byte) error { 56 | log.WithFields(log.Fields{ 57 | "ack": ack, 58 | "fcnt_down": fCntDown, 59 | "f_port": fPort, 60 | "data": hex.EncodeToString(data), 61 | }).Info("WithDownlinkHandlerFunc triggered") 62 | 63 | return nil 64 | }), 65 | ) 66 | if err != nil { 67 | panic(err) 68 | } 69 | 70 | wg.Wait() 71 | } 72 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/brocaar/chirpstack-simulator 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/brocaar/chirpstack-api/go/v3 v3.1.3 7 | github.com/brocaar/lorawan v0.0.0-20191105091820-9ed596703a6c 8 | github.com/eclipse/paho.mqtt.golang v1.2.0 9 | github.com/gofrs/uuid v3.2.0+incompatible 10 | github.com/golang/protobuf v1.3.2 11 | github.com/pkg/errors v0.8.1 12 | github.com/prometheus/client_golang v0.9.3 13 | github.com/sirupsen/logrus v1.4.2 14 | github.com/smartystreets/assertions v1.0.0 // indirect 15 | github.com/spf13/cobra v0.0.5 16 | github.com/spf13/viper v1.5.0 17 | golang.org/x/net v0.17.0 // indirect 18 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b // indirect 19 | golang.org/x/text v0.3.2 // indirect 20 | google.golang.org/grpc v1.56.3 21 | ) 22 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/internal/as/api.go: -------------------------------------------------------------------------------- 1 | package as 2 | 3 | import ( 4 | "context" 5 | "crypto/tls" 6 | "time" 7 | 8 | mqtt "github.com/eclipse/paho.mqtt.golang" 9 | "github.com/pkg/errors" 10 | log "github.com/sirupsen/logrus" 11 | "google.golang.org/grpc" 12 | "google.golang.org/grpc/credentials" 13 | 14 | "github.com/brocaar/chirpstack-api/go/v3/as/external/api" 15 | "github.com/brocaar/chirpstack-simulator/internal/config" 16 | ) 17 | 18 | var clientConn *grpc.ClientConn 19 | var mqttClient mqtt.Client 20 | 21 | type jwtCredentials struct { 22 | token string 23 | } 24 | 25 | func (j *jwtCredentials) GetRequestMetadata(ctx context.Context, url ...string) (map[string]string, error) { 26 | return map[string]string{ 27 | "authorization": j.token, 28 | }, nil 29 | } 30 | 31 | func (j *jwtCredentials) RequireTransportSecurity() bool { 32 | return false 33 | } 34 | 35 | // Setup configures the AS API client. 36 | func Setup(c config.Config) error { 37 | conf := c.ApplicationServer 38 | 39 | // connect gRPC 40 | log.WithFields(log.Fields{ 41 | "server": conf.API.Server, 42 | "insecure": conf.API.Insecure, 43 | }).Info("as: connecting api client") 44 | 45 | dialOpts := []grpc.DialOption{ 46 | grpc.WithBlock(), 47 | grpc.WithPerRPCCredentials(&jwtCredentials{token: conf.API.JWTToken}), 48 | } 49 | 50 | if conf.API.Insecure { 51 | dialOpts = append(dialOpts, grpc.WithInsecure()) 52 | } else { 53 | dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{}))) 54 | } 55 | 56 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) 57 | defer cancel() 58 | 59 | conn, err := grpc.DialContext(ctx, conf.API.Server, dialOpts...) 60 | if err != nil { 61 | return errors.Wrap(err, "grpc dial error") 62 | } 63 | 64 | clientConn = conn 65 | 66 | // connect MQTT 67 | opts := mqtt.NewClientOptions() 68 | opts.AddBroker(conf.Integration.MQTT.Server) 69 | opts.SetUsername(conf.Integration.MQTT.Username) 70 | opts.SetPassword(conf.Integration.MQTT.Password) 71 | opts.SetCleanSession(true) 72 | opts.SetAutoReconnect(true) 73 | 74 | log.WithFields(log.Fields{ 75 | "server": conf.Integration.MQTT.Server, 76 | }).Info("as: connecting to mqtt broker") 77 | 78 | mqttClient = mqtt.NewClient(opts) 79 | if token := mqttClient.Connect(); token.Wait() && token.Error() != nil { 80 | return errors.Wrap(token.Error(), "mqtt client connect error") 81 | } 82 | 83 | return nil 84 | } 85 | 86 | func ServiceProfile() api.ServiceProfileServiceClient { 87 | return api.NewServiceProfileServiceClient(clientConn) 88 | } 89 | 90 | func Gateway() api.GatewayServiceClient { 91 | return api.NewGatewayServiceClient(clientConn) 92 | } 93 | 94 | func NetworkServer() api.NetworkServerServiceClient { 95 | return api.NewNetworkServerServiceClient(clientConn) 96 | } 97 | 98 | func DeviceProfile() api.DeviceProfileServiceClient { 99 | return api.NewDeviceProfileServiceClient(clientConn) 100 | } 101 | 102 | func Application() api.ApplicationServiceClient { 103 | return api.NewApplicationServiceClient(clientConn) 104 | } 105 | 106 | func Device() api.DeviceServiceClient { 107 | return api.NewDeviceServiceClient(clientConn) 108 | } 109 | 110 | // MQTTClient returns the MQTT client for the Application Server MQTT integration. 111 | func MQTTClient() mqtt.Client { 112 | return mqttClient 113 | } 114 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/internal/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // Version defines the version. 8 | var Version string 9 | 10 | // Config defines the configuration. 11 | type Config struct { 12 | General struct { 13 | LogLevel int `mapstructure:"log_level"` 14 | } 15 | 16 | ApplicationServer struct { 17 | API struct { 18 | JWTToken string `mapstructure:"jwt_token"` 19 | Server string `mapstructure:"server"` 20 | Insecure bool `mapstructure:"insecure"` 21 | } `mapstructure:"api"` 22 | 23 | Integration struct { 24 | MQTT struct { 25 | Server string `mapstructure:"server"` 26 | Username string `mapstructure:"username"` 27 | Password string `mapstructure:"password"` 28 | } `mapstructure:"mqtt"` 29 | } `mapstructure:"integration"` 30 | } `mapstructure:"application_server"` 31 | 32 | NetworkServer struct { 33 | Gateway struct { 34 | Backend struct { 35 | MQTT struct { 36 | Server string `mapstructure:"server"` 37 | Username string `mapstructure:"username"` 38 | Password string `mapstructure:"password"` 39 | } `mapstructure:"mqtt"` 40 | } `mapstructure:"backend"` 41 | } `mapstructure:"gateway"` 42 | } `mapstructure:"network_server"` 43 | 44 | Simulator []struct { 45 | ServiceProfileID string `mapstructure:"service_profile_id"` 46 | Duration time.Duration `mapstructure:"duration"` 47 | ActivationTime time.Duration `mapstructure:"activation_time"` 48 | 49 | Device struct { 50 | Count int `mapstructure:"count"` 51 | UplinkInterval time.Duration `mapstructure:"uplink_interval"` 52 | FPort uint8 `mapstructure:"f_port"` 53 | Payload string `mapstructure:"payload"` 54 | Frequency int `mapstructure:"frequency"` 55 | Bandwidth int `mapstructure:"bandwidth"` 56 | SpreadingFactor int `mapstructure:"spreading_factor"` 57 | } `mapstructure:"device"` 58 | 59 | Gateway struct { 60 | MinCount int `mapstructure:"min_count"` 61 | MaxCount int `mapstructure:"max_count"` 62 | EventTopicTemplate string `mapstructure:"event_topic_template"` 63 | CommandTopicTemplate string `mapstructure:"command_topic_template"` 64 | } `mapstructure:"gateway"` 65 | } `mapstructure:"simulator"` 66 | 67 | Prometheus struct { 68 | Bind string `mapstructure:"bind"` 69 | } `mapstructure:"prometheus"` 70 | } 71 | 72 | type DeviceConfig struct { 73 | DevEUI string `mapstructure:"dev_eui"` 74 | AppKey string `mapstructure:"app_key"` 75 | UplinkInterval time.Duration `mapstructure:"uplink_interval"` 76 | FPort uint8 `mapstructure:"f_port"` 77 | Payload string `mapstructure:"payload"` 78 | } 79 | 80 | // C holds the global configuration. 81 | var C Config 82 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/internal/ns/mqtt.go: -------------------------------------------------------------------------------- 1 | package ns 2 | 3 | import ( 4 | mqtt "github.com/eclipse/paho.mqtt.golang" 5 | "github.com/pkg/errors" 6 | log "github.com/sirupsen/logrus" 7 | 8 | "github.com/brocaar/chirpstack-simulator/internal/config" 9 | ) 10 | 11 | var mqttClient mqtt.Client 12 | 13 | // Setup configures the NS MQTT gateway backend. 14 | func Setup(c config.Config) error { 15 | conf := c.NetworkServer.Gateway.Backend.MQTT 16 | 17 | opts := mqtt.NewClientOptions() 18 | opts.AddBroker(conf.Server) 19 | opts.SetUsername(conf.Username) 20 | opts.SetPassword(conf.Password) 21 | opts.SetCleanSession(true) 22 | opts.SetAutoReconnect(true) 23 | 24 | log.WithFields(log.Fields{ 25 | "server": conf.Server, 26 | }).Info("ns: connecting to mqtt broker") 27 | 28 | mqttClient = mqtt.NewClient(opts) 29 | if token := mqttClient.Connect(); token.Wait() && token.Error() != nil { 30 | return errors.Wrap(token.Error(), "mqtt client connect error") 31 | } 32 | 33 | return nil 34 | } 35 | 36 | func Client() mqtt.Client { 37 | return mqttClient 38 | } 39 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/internal/simulator/metrics.go: -------------------------------------------------------------------------------- 1 | package simulator 2 | 3 | import ( 4 | "github.com/prometheus/client_golang/prometheus" 5 | "github.com/prometheus/client_golang/prometheus/promauto" 6 | ) 7 | 8 | var ( 9 | auc = promauto.NewCounter(prometheus.CounterOpts{ 10 | Name: "application_uplink_count", 11 | Help: "The number of uplinks published by the application integration.", 12 | }) 13 | ) 14 | 15 | func applicationUplinkCounter() prometheus.Counter { 16 | return auc 17 | } 18 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/internal/simulator/session_keys.go: -------------------------------------------------------------------------------- 1 | package simulator 2 | 3 | import ( 4 | "crypto/aes" 5 | "fmt" 6 | 7 | "github.com/pkg/errors" 8 | 9 | "github.com/brocaar/lorawan" 10 | ) 11 | 12 | // getAppSKey returns appSKey. 13 | func getAppSKey(optNeg bool, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 14 | return getSKey(optNeg, 0x02, nwkKey, netID, joinEUI, joinNonce, devNonce) 15 | } 16 | 17 | // getFNwkSIntKey returns the FNwkSIntKey. 18 | // For LoRaWAN 1.0: SNwkSIntKey = NwkSEncKey = FNwkSIntKey = NwkSKey 19 | func getFNwkSIntKey(optNeg bool, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 20 | return getSKey(optNeg, 0x01, nwkKey, netID, joinEUI, joinNonce, devNonce) 21 | } 22 | 23 | func getSKey(optNeg bool, typ byte, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 24 | var key lorawan.AES128Key 25 | b := make([]byte, 16) 26 | b[0] = typ 27 | 28 | netIDB, err := netID.MarshalBinary() 29 | if err != nil { 30 | return key, errors.Wrap(err, "marshal binary error") 31 | } 32 | 33 | joinEUIB, err := joinEUI.MarshalBinary() 34 | if err != nil { 35 | return key, errors.Wrap(err, "marshal binary error") 36 | } 37 | 38 | joinNonceB, err := joinNonce.MarshalBinary() 39 | if err != nil { 40 | return key, errors.Wrap(err, "marshal binary error") 41 | } 42 | 43 | devNonceB, err := devNonce.MarshalBinary() 44 | if err != nil { 45 | return key, errors.Wrap(err, "marshal binary error") 46 | } 47 | 48 | if optNeg { 49 | copy(b[1:4], joinNonceB) 50 | copy(b[4:12], joinEUIB) 51 | copy(b[12:14], devNonceB) 52 | } else { 53 | copy(b[1:4], joinNonceB) 54 | copy(b[4:7], netIDB) 55 | copy(b[7:9], devNonceB) 56 | } 57 | 58 | block, err := aes.NewCipher(nwkKey[:]) 59 | if err != nil { 60 | return key, err 61 | } 62 | if block.BlockSize() != len(b) { 63 | return key, fmt.Errorf("block-size of %d bytes is expected", len(b)) 64 | } 65 | block.Encrypt(key[:], b) 66 | 67 | return key, nil 68 | } 69 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/simulator/metrics.go: -------------------------------------------------------------------------------- 1 | package simulator 2 | 3 | import ( 4 | "github.com/prometheus/client_golang/prometheus" 5 | "github.com/prometheus/client_golang/prometheus/promauto" 6 | ) 7 | 8 | var ( 9 | duc = promauto.NewCounter(prometheus.CounterOpts{ 10 | Name: "device_uplink_count", 11 | Help: "The number of uplinks sent by the devices.", 12 | }) 13 | 14 | djrc = promauto.NewCounter(prometheus.CounterOpts{ 15 | Name: "device_join_request_count", 16 | Help: "The number of join-requests sent by the devices.", 17 | }) 18 | 19 | djac = promauto.NewCounter(prometheus.CounterOpts{ 20 | Name: "device_join_accept_count", 21 | Help: "The number of join-accepts received by the devices.", 22 | }) 23 | 24 | guc = promauto.NewCounter(prometheus.CounterOpts{ 25 | Name: "gateway_uplink_count", 26 | Help: "The number of uplinks sent by the gateways.", 27 | }) 28 | 29 | gdc = promauto.NewCounter(prometheus.CounterOpts{ 30 | Name: "gateway_downlink_count", 31 | Help: "The number of downlinks received by the gateways.", 32 | }) 33 | ) 34 | 35 | func deviceUplinkCounter() prometheus.Counter { 36 | return duc 37 | } 38 | 39 | func deviceJoinRequestCounter() prometheus.Counter { 40 | return djrc 41 | } 42 | 43 | func deviceJoinAcceptCounter() prometheus.Counter { 44 | return djac 45 | } 46 | 47 | func gatewayUplinkCounter() prometheus.Counter { 48 | return guc 49 | } 50 | 51 | func gatewayDownlinkCounter() prometheus.Counter { 52 | return gdc 53 | } 54 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/chirpstack-simulator/simulator/session_keys.go: -------------------------------------------------------------------------------- 1 | package simulator 2 | 3 | import ( 4 | "crypto/aes" 5 | "fmt" 6 | 7 | "github.com/brocaar/lorawan" 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | // getAppSKey returns appSKey. 12 | func getAppSKey(optNeg bool, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 13 | return getSKey(optNeg, 0x02, nwkKey, netID, joinEUI, joinNonce, devNonce) 14 | } 15 | 16 | // getFNwkSIntKey returns the FNwkSIntKey. 17 | // For LoRaWAN 1.0: SNwkSIntKey = NwkSEncKey = FNwkSIntKey = NwkSKey 18 | func getFNwkSIntKey(optNeg bool, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 19 | return getSKey(optNeg, 0x01, nwkKey, netID, joinEUI, joinNonce, devNonce) 20 | } 21 | 22 | func getSKey(optNeg bool, typ byte, nwkKey lorawan.AES128Key, netID lorawan.NetID, joinEUI lorawan.EUI64, joinNonce lorawan.JoinNonce, devNonce lorawan.DevNonce) (lorawan.AES128Key, error) { 23 | var key lorawan.AES128Key 24 | b := make([]byte, 16) 25 | b[0] = typ 26 | 27 | netIDB, err := netID.MarshalBinary() 28 | if err != nil { 29 | return key, errors.Wrap(err, "marshal binary error") 30 | } 31 | 32 | joinEUIB, err := joinEUI.MarshalBinary() 33 | if err != nil { 34 | return key, errors.Wrap(err, "marshal binary error") 35 | } 36 | 37 | joinNonceB, err := joinNonce.MarshalBinary() 38 | if err != nil { 39 | return key, errors.Wrap(err, "marshal binary error") 40 | } 41 | 42 | devNonceB, err := devNonce.MarshalBinary() 43 | if err != nil { 44 | return key, errors.Wrap(err, "marshal binary error") 45 | } 46 | 47 | if optNeg { 48 | copy(b[1:4], joinNonceB) 49 | copy(b[4:12], joinEUIB) 50 | copy(b[12:14], devNonceB) 51 | } else { 52 | copy(b[1:4], joinNonceB) 53 | copy(b[4:7], netIDB) 54 | copy(b[7:9], devNonceB) 55 | } 56 | 57 | block, err := aes.NewCipher(nwkKey[:]) 58 | if err != nil { 59 | return key, err 60 | } 61 | if block.BlockSize() != len(b) { 62 | return key, fmt.Errorf("block-size of %d bytes is expected", len(b)) 63 | } 64 | block.Encrypt(key[:], b) 65 | 66 | return key, nil 67 | } 68 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/chirpstack-simulator.toml: -------------------------------------------------------------------------------- 1 | [general] 2 | # Log level 3 | # 4 | # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 5 | log_level=4 6 | 7 | 8 | # Application Server configuration. 9 | [application_server] 10 | 11 | # API configuration. 12 | # 13 | # This configuration is used to automatically create the: 14 | # * Device profile 15 | # * Gateways 16 | # * Application 17 | # * Devices 18 | [application_server.api] 19 | 20 | # JWT token. 21 | # 22 | # The JWT token to connect to the ChirpStack Application Server API. This 23 | # token can be generated using the login API endpoint. In the near-future 24 | # it will be possible to generate these tokens within the web-interface: 25 | # https://github.com/brocaar/chirpstack-application-server/pull/421 26 | jwt_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGlfa2V5X2lkIjoiMzE3YjcyNmItYjA1Mi00NmM2LWIyOTQtM2QwMjAwNzg1NzM0IiwiYXVkIjoiYXMiLCJpc3MiOiJhcyIsIm5iZiI6MTYwNjAyMzIwNiwic3ViIjoiYXBpX2tleSJ9.7U1x46POATtV-5ieuMBGIcC-lwrNSRqRUP348TsQeBo" 27 | 28 | # Server. 29 | # 30 | # This must point to the external API server of the ChirpStack Application 31 | # Server. When the server is running on the same machine, keep this to the 32 | # default value. 33 | server="10.200.200.10:8080" 34 | 35 | # Insecure. 36 | # 37 | # Set this to true when the endpoint is not using TLS. 38 | insecure=true 39 | 40 | 41 | # MQTT integration configuration. 42 | # 43 | # This integration is used for counting the number of uplinks that are 44 | # published by the ChirpStack Application Server integration. 45 | [application_server.integration.mqtt] 46 | 47 | # MQTT server. 48 | server="tcp://10.200.200.13:1883" 49 | 50 | # Username. 51 | username="" 52 | 53 | # Password. 54 | password="" 55 | 56 | 57 | # Network Server configuration. 58 | # 59 | # This configuration is used to simulate LoRa gateways using the MQTT gateway 60 | # backend. 61 | [network_server] 62 | 63 | # MQTT gateway backend. 64 | [network_server.gateway.backend.mqtt] 65 | 66 | # MQTT server. 67 | server="tcp://10.200.200.13:1883" 68 | 69 | # Username. 70 | username="" 71 | 72 | # Password. 73 | password="" 74 | 75 | 76 | # Simulator configuration. 77 | [[simulator]] 78 | 79 | # Service-profile ID. 80 | # 81 | # It is recommended to create a new organization with a new service-profile 82 | # in the ChirpStack Application Server. 83 | service_profile_id="854a3b72-afdb-4d99-b140-e10c90f78a76" 84 | 85 | # Duration. 86 | # 87 | # This defines the duration of the simulation. If set to '0s', the simulation 88 | # will run until terminated. 89 | duration="30m" 90 | 91 | # Activation time. 92 | # 93 | # This is the time that the simulator takes to activate the devices. This 94 | # value must be less than the simulator duration. 95 | activation_time="1m" 96 | 97 | # Device configuration. 98 | [simulator.device] 99 | 100 | # Number of devices to simulate. 101 | count=20 102 | 103 | # Uplink interval. 104 | uplink_interval="1m" 105 | 106 | # FPort. 107 | f_port=10 108 | 109 | # Payload (HEX encoded). 110 | payload="010203" 111 | 112 | # Frequency (Hz). 113 | frequency=868100000 114 | 115 | # Bandwidth (Hz). 116 | bandwidth=125000 117 | 118 | # Spreading-factor. 119 | spreading_factor=7 120 | 121 | # Gateway configuration. 122 | [simulator.gateway] 123 | 124 | # Min number of receiving gateways. 125 | min_count=3 126 | 127 | # Max number of receiving gateways. 128 | max_count=5 129 | 130 | # Event topic template. 131 | event_topic_template="gateway/{{ .GatewayID }}/event/{{ .Event }}" 132 | 133 | # Command topic template. 134 | command_topic_template="gateway/{{ .GatewayID }}/command/{{ .Command }}" 135 | 136 | 137 | # Prometheus metrics configuration. 138 | # 139 | # Using Prometheus (and Grafana), it is possible to visualize various 140 | # simulation metrics like: 141 | # * Join-Requests sent 142 | # * Join-Accepts received 143 | # * Uplinks sent (by the devices) 144 | # * Uplinks sent (by the gateways) 145 | # * Uplinks sent (by the ChirpStack Application Server MQTT integration) 146 | [prometheus] 147 | 148 | # IP:port to bind the Prometheus endpoint to. 149 | # 150 | # Metrics can be retrieved from /metrics. 151 | bind="0.0.0.0:9000" 152 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/initial_registration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | curl --insecure --location --request POST 'https://localhost:10000/registration/' \ 4 | --header 'Content-Type: application/json' \ 5 | --data-raw '{ 6 | "authenticationMethod": "5G_AKA", 7 | "supiOrSuci": "2089300007487", 8 | "K": "5122250214c33e723a5dd523fc145fc0", 9 | "opcType": "OP", 10 | "opc": "c9e8763286b5b9ffbdf56e1297d0887b", 11 | "plmnId": "", 12 | "servingNetworkName": "", 13 | "n3IWFIpAddress": "192.168.127.1", 14 | "SNssai": { 15 | "Sst": 1, 16 | "Sd": "010203" 17 | } 18 | }' 19 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/initial_registration2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ue_addr=${ue_addr:-"127.0.0.1"} 4 | ue_port=${ue_port:-"10000"} 5 | scheme=${scheme:-"http"} 6 | auth_method=${auth_method:-"5G_AKA"} 7 | n3iwf_address=${n3iwf_address:-"192.168.127.1"} 8 | supi_or_suci=${supi_or_suci:-"2089300007487"} 9 | k=${k:-"5122250214c33e723a5dd523fc145fc0"} 10 | opc_type=${opc_type:-"OP"} 11 | opc=${opc:-"c9e8763286b5b9ffbdf56e1297d0887b"} 12 | ike_bind_addr=${ike_bind_addr:-"192.168.127.2"} 13 | 14 | while [ $# -gt 0 ]; do 15 | if [[ $1 == *"--"* ]]; then 16 | param="${1/--/}" 17 | declare $param="$2" 18 | fi 19 | shift 20 | done 21 | 22 | curl --insecure --location --request POST "$scheme://$ue_addr:$ue_port/registration/" \ 23 | --header 'Content-Type: application/json' \ 24 | --data-raw "{ 25 | \"authenticationMethod\": \"$auth_method\", 26 | \"supiOrSuci\": \"$supi_or_suci\", 27 | \"K\": \"$k\", 28 | \"opcType\": \"$opc_type\", 29 | \"opc\": \"$opc\", 30 | \"plmnId\": \"\", 31 | \"servingNetworkName\": \"\", 32 | \"n3IWFIpAddress\": \"$n3iwf_address\", 33 | \"ikeBindAddress\": \"$ike_bind_addr\", 34 | \"SNssai\": { 35 | \"Sst\": 1, 36 | \"Sd\": \"010203\" 37 | } 38 | }" 39 | 40 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/ipsec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import socket 4 | import argparse 5 | import os 6 | 7 | def sh(command): 8 | os.system(f"sh -c '{command}'") 9 | 10 | def nslookup(name): 11 | resolved = socket.gethostbyname(name) 12 | print(f"Resolved {name}: {resolved}") 13 | return resolved 14 | 15 | if __name__ == '__main__': 16 | 17 | parser = argparse.ArgumentParser(description="UE interface config") 18 | parser.add_argument("--ue", help="User Equipment FQND or IP") 19 | parser.add_argument("--n3iwf", help="N3IWF FQND or IP") 20 | args = parser.parse_args() 21 | 22 | if args.ue and args.n3iwf: 23 | ue_ip = nslookup(args.ue) 24 | n3iwf_ip = nslookup(args.n3iwf) 25 | commands = [f'ip addr add {ue_ip}/24 dev eth0', 26 | f'ip link add name ipsec0 type vti local {ue_ip} remote {n3iwf_ip} key 5', 27 | 'ip addr add 60.60.0.1 dev lo', 28 | 'ip link set ipsec0 up', 29 | 'ip link set lo up', 30 | 'ip ro del default', 31 | 'sleep 2' 32 | ] 33 | for command in commands: 34 | sh(command) 35 | else: 36 | raise ValueError("Error in UE or N3IWF") 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/my5Gcore.conf: -------------------------------------------------------------------------------- 1 | db_uri: mongodb://db/free5GC 2 | 3 | #all logging levels 4 | #panic 5 | #fatal 6 | #error 7 | #warn 8 | #info 9 | #debug 10 | #trace 11 | logger: 12 | # network function 13 | AMF: 14 | debugLevel: info 15 | ReportCaller: true 16 | SMF: 17 | debugLevel: info 18 | ReportCaller: true 19 | UDR: 20 | debugLevel: info 21 | ReportCaller: true 22 | UDM: 23 | debugLevel: info 24 | ReportCaller: true 25 | NRF: 26 | debugLevel: info 27 | ReportCaller: true 28 | PCF: 29 | debugLevel: info 30 | ReportCaller: true 31 | AUSF: 32 | debugLevel: info 33 | ReportCaller: true 34 | N3IWF: 35 | debugLevel: info 36 | ReportCaller: true 37 | # library 38 | NAS: 39 | debugLevel: info 40 | ReportCaller: true 41 | FSM: 42 | debugLevel: info 43 | ReportCaller: true 44 | NGAP: 45 | debugLevel: info 46 | ReportCaller: true 47 | NamfComm: 48 | debugLevel: info 49 | ReportCaller: true 50 | NamfEventExposure: 51 | debugLevel: info 52 | ReportCaller: true 53 | NsmfPDUSession: 54 | debugLevel: info 55 | ReportCaller: true 56 | NudrDataRepository: 57 | debugLevel: info 58 | ReportCaller: true 59 | OpenApi: 60 | debugLevel: info 61 | ReportCaller: true 62 | Aper: 63 | debugLevel: info 64 | ReportCaller: true 65 | CommonConsumerTest: 66 | debugLevel: info 67 | ReportCaller: true 68 | # webui 69 | WEBUI: 70 | debugLevel: info 71 | ReportCaller: true 72 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/config-vSBrT2020/uecfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: N3IWF initial local configuration 4 | 5 | configuration: 6 | UEConfiguration: 7 | HttpIPv4Address: 127.0.0.1 8 | HttpIPv4Port: 10000 9 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | my5gcore-ue: 5 | container_name: non3gpp-ue 6 | build: 7 | context: ./nf_ue 8 | args: 9 | DEBUG_TOOLS: "true" 10 | ports: 11 | - "10000:10000" 12 | #command: sh -c "./bin/ue" 13 | command: sh -c "./ipsec --ue ue --n3iwf n3iwf && ./bin/ue " 14 | # command: sh -c " ./ipsec --ue ue --n3iwf n3iwf.my5Gcore.org && while true; do echo 'Hit CTRL+C'; sleep 10000; done " 15 | volumes: 16 | - ${CONFIG}/uecfg.conf:/my5gcore/config/uecfg.conf 17 | - ${CONFIG}/my5Gcore.conf:/my5gcore/config/free5GC.conf 18 | - ${CONFIG}/initial_registration2.sh:/my5gcore/initial_registration.sh 19 | - ${CONFIG}/chirpstack-simulator.toml:/my5gcore/config/chirpstack-simulator.toml 20 | - ${CONFIG}/ipsec:/my5gcore/ipsec 21 | environment: 22 | GIN_MODE: release 23 | extra_hosts: 24 | - "ue:192.168.127.2" 25 | - "n3iwf:192.168.127.1" 26 | - "ap:10.200.200.10" 27 | - "bridge:10.200.200.11" 28 | - "mqtt:10.200.200.13" 29 | networks: 30 | my5gcore-compose_5gcorenetwork: 31 | aliases: 32 | - ue.my5Gcore.org 33 | cap_add: 34 | - ALL 35 | 36 | networks: 37 | my5gcore-compose_5gcorenetwork: 38 | external: true 39 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/nf_ue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/ue:latest AS builder 2 | FROM lora:latest AS lora 3 | FROM alpine:3.8 4 | 5 | LABEL description="User Equipment in LoRaWAN Gateway" \ 6 | version="Stage 3" 7 | 8 | ENV MY5GC_MODULE ue 9 | ARG DEBUG_TOOLS 10 | 11 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 12 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 13 | 14 | # Install UE dependencies 15 | RUN apk add -U iproute2 python3 16 | 17 | # Set working dir 18 | WORKDIR /my5gcore 19 | RUN mkdir -p bin/ config/ log/ support/TLS/ 20 | 21 | # Copy executable and default certs 22 | COPY --from=builder /my5Gcore/ue ./bin/ 23 | COPY --from=builder /my5Gcore/support/TLS/${MY5GC_MODULE}.pem ./support/TLS/ 24 | COPY --from=builder /my5Gcore/support/TLS/${MY5GC_MODULE}.key ./support/TLS/ 25 | COPY --from=lora /chirpstack-simulator/build/chirpstack-simulator ./bin/ 26 | 27 | # Move to the binary path 28 | WORKDIR /my5gcore/ 29 | 30 | # Config files volume 31 | VOLUME [ "/my5gcore/config" ] 32 | 33 | # Certificates (if not using default) volume 34 | VOLUME [ "/my5gcore/support/TLS" ] 35 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lora-iot/troube.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo docker-compose down 4 | sudo docker-compose up -d 5 | sudo docker-compose exec my5gcore-ue sh 6 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Orne Brocaar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/README.md: -------------------------------------------------------------------------------- 1 | # ChirpStack Docker example 2 | 3 | This repository contains a skeleton to setup the [ChirpStack](https://www.chirpstack.io) 4 | open-source LoRaWAN Network Server stack using [Docker Compose](https://docs.docker.com/compose/). 5 | 6 | **Note:** Please use this `docker-compose.yml` file as a starting point for testing 7 | but keep in mind that for production usage it might need modifications. 8 | 9 | ## Directory layout 10 | 11 | * `docker-compose.yml`: the docker-compose file containing the services 12 | * `docker-compose-env.yml`: alternate docker-compose file using environment variables, can be run with the docker-compose `-f` flag 13 | * `configuration/chirpstack*`: directory containing the ChirpStack configuration files, see: 14 | * https://www.chirpstack.io/gateway-bridge/install/config/ 15 | * https://www.chirpstack.io/network-server/install/config/ 16 | * https://www.chirpstack.io/application-server/install/config/ 17 | * https://www.chirpstack.io/geolocation-server/install/config/ 18 | * `configuration/postgresql/initdb/`: directory containing PostgreSQL initialization scripts 19 | 20 | ## Configuration 21 | 22 | The ChirpStack stack components components are pre-configured to work with the provided 23 | `docker-compose.yml` file and defaults to the EU868 LoRaWAN band. Please refer 24 | to the `configuration/chirpstack-network-server/examples` directory for more configuration 25 | examples. 26 | 27 | # Data persistence 28 | 29 | PostgreSQL and Redis data is persisted in Docker volumes, see the `docker-compose.yml` 30 | `volumes` definition. 31 | 32 | ## Requirements 33 | 34 | Before using this `docker-compose.yml` file, make sure you have [Docker](https://www.docker.com/community-edition) 35 | installed. 36 | 37 | ## Usage 38 | 39 | To start the ChirpStack open-source LoRaWAN Network Server stack, simply run: 40 | 41 | ```bash 42 | $ docker-compose up 43 | ``` 44 | 45 | **Note:** during the startup of services, it is normal to see the following errors: 46 | 47 | * ping database error, will retry in 2s: dial tcp 172.20.0.4:5432: connect: connection refused 48 | * ping database error, will retry in 2s: pq: the database system is starting up 49 | 50 | 51 | After all the components have been initialized and started, you should be able 52 | to open http://localhost:8080/ in your browser. 53 | 54 | ### Add Network Server 55 | 56 | When adding the Network Server in the ChirpStack Application Server web-interface 57 | (see [Network Servers](https://www.chirpstack.io/application-server/use/network-servers/)), 58 | you must enter `chirpstack-network-server:8000` as the Network Server `hostname:IP`. 59 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-application-server/chirpstack-application-server.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/application-server/install/config/ for a full 2 | # configuration example and documentation. 3 | 4 | [postgresql] 5 | dsn="postgres://chirpstack_as:chirpstack_as@postgresql/chirpstack_as?sslmode=disable" 6 | 7 | [redis] 8 | url="redis://redis:6379" 9 | 10 | [application_server.integration.mqtt] 11 | server="tcp://mosquitto:1883" 12 | 13 | [application_server.api] 14 | public_host="chirpstack-application-server:8001" 15 | 16 | [application_server.external_api] 17 | bind="0.0.0.0:8080" 18 | jwt_secret="verysecret" 19 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/gateway-bridge/install/config/ for a full 2 | # configuration example and documentation. 3 | 4 | [integration.mqtt.auth.generic] 5 | servers=["tcp://mosquitto:1883"] 6 | username="" 7 | password="" 8 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-geolocation-server/chirpstack-geolocation-server.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/geolocation-server/install/config/ for a full 2 | # configuration example and documentation. 3 | 4 | [geo_server.backend] 5 | name="collos" 6 | 7 | [geo_server.backend.collos] 8 | # Collos subscription key. 9 | # 10 | # This key can be retrieved after creating a Collos account at: 11 | # http://preview.collos.org/ 12 | subscription_key="" 13 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-network-server/chirpstack-network-server.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/network-server/install/config/ for a full 2 | # configuration example and documentation. 3 | # 4 | # This file is for the EU868 band. See the examples/ folder for more 5 | # configuration examples. 6 | 7 | [postgresql] 8 | dsn="postgres://chirpstack_ns:chirpstack_ns@postgresql/chirpstack_ns?sslmode=disable" 9 | 10 | [redis] 11 | url="redis://redis:6379" 12 | 13 | [network_server] 14 | net_id="000000" 15 | 16 | [network_server.band] 17 | name="EU868" 18 | 19 | [network_server.network_settings] 20 | 21 | [[network_server.network_settings.extra_channels]] 22 | frequency=867100000 23 | min_dr=0 24 | max_dr=5 25 | 26 | [[network_server.network_settings.extra_channels]] 27 | frequency=867300000 28 | min_dr=0 29 | max_dr=5 30 | 31 | [[network_server.network_settings.extra_channels]] 32 | frequency=867500000 33 | min_dr=0 34 | max_dr=5 35 | 36 | [[network_server.network_settings.extra_channels]] 37 | frequency=867700000 38 | min_dr=0 39 | max_dr=5 40 | 41 | [[network_server.network_settings.extra_channels]] 42 | frequency=867900000 43 | min_dr=0 44 | max_dr=5 45 | 46 | [network_server.gateway.backend.mqtt] 47 | server="tcp://mosquitto:1883" 48 | 49 | [join_server.default] 50 | server="http://chirpstack-application-server:8003" 51 | 52 | [geolocation_server] 53 | server="chirpstack-geolocation-server:8005" 54 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-network-server/examples/chirpstack-network-server.eu868.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/network-server/install/config/ for a full 2 | # configuration example and documentation. 3 | # 4 | # This file is for the EU868 band. See the examples/ folder for more 5 | # configuration examples. 6 | 7 | [postgresql] 8 | dsn="postgres://chirpstack_ns:chirpstack_ns@postgresql/chirpstack_ns?sslmode=disable" 9 | 10 | [redis] 11 | url="redis://redis:6379" 12 | 13 | [network_server] 14 | net_id="000000" 15 | 16 | [network_server.band] 17 | name="EU868" 18 | 19 | [network_server.network_settings] 20 | 21 | [[network_server.network_settings.extra_channels]] 22 | frequency=867100000 23 | min_dr=0 24 | max_dr=5 25 | 26 | [[network_server.network_settings.extra_channels]] 27 | frequency=867300000 28 | min_dr=0 29 | max_dr=5 30 | 31 | [[network_server.network_settings.extra_channels]] 32 | frequency=867500000 33 | min_dr=0 34 | max_dr=5 35 | 36 | [[network_server.network_settings.extra_channels]] 37 | frequency=867700000 38 | min_dr=0 39 | max_dr=5 40 | 41 | [[network_server.network_settings.extra_channels]] 42 | frequency=867900000 43 | min_dr=0 44 | max_dr=5 45 | 46 | [network_server.gateway.backend.mqtt] 47 | server="tcp://mosquitto:1883" 48 | 49 | [join_server.default] 50 | server="http://chirpstack-application-server:8003" 51 | 52 | [geolocation_server] 53 | server="chirpstack-geolocation-server:8005" 54 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-network-server/examples/chirpstack-network-server.us915.0.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/network-server/install/config/ for a full 2 | # configuration example and documentation. 3 | # 4 | # This file is for the US915 band (channels 0-7). See the examples/ folder for more 5 | # configuration examples. 6 | 7 | [postgresql] 8 | dsn="postgres://chirpstack_ns:chirpstack_ns@postgresql/chirpstack_ns?sslmode=disable" 9 | 10 | [redis] 11 | url="redis://redis:6379" 12 | 13 | [network_server] 14 | net_id="000000" 15 | 16 | [network_server.band] 17 | name="US915" 18 | 19 | [network_server.network_settings] 20 | enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7] 21 | 22 | [network_server.gateway.backend.mqtt] 23 | server="tcp://mosquitto:1883" 24 | 25 | [join_server.default] 26 | server="http://chirpstack-application-server:8003" 27 | 28 | [geolocation_server] 29 | server="chirpstack-geolocation-server:8005" 30 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/chirpstack-network-server/examples/chirpstack-network-server.us915.1.toml: -------------------------------------------------------------------------------- 1 | # See https://www.chirpstack.io/network-server/install/config/ for a full 2 | # configuration example and documentation. 3 | # 4 | # This file is for the US915 band (channels 8-15). See the examples/ folder for more 5 | # configuration examples. 6 | # 7 | # Note: these channels are also used by TTN. 8 | 9 | [postgresql] 10 | dsn="postgres://chirpstack_ns:chirpstack_ns@postgresql/chirpstack_ns?sslmode=disable" 11 | 12 | [redis] 13 | url="redis://redis:6379" 14 | 15 | [network_server] 16 | net_id="000000" 17 | 18 | [network_server.band] 19 | name="US915" 20 | 21 | [network_server.network_settings] 22 | enabled_uplink_channels=[8, 9, 10, 11, 12, 13, 14, 15] 23 | 24 | [network_server.gateway.backend.mqtt] 25 | server="tcp://mosquitto:1883" 26 | 27 | [join_server.default] 28 | server="http://chirpstack-application-server:8003" 29 | 30 | [geolocation_server] 31 | server="chirpstack-geolocation-server:8005" 32 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/postgresql/initdb/001-init-chirpstack_ns.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL 5 | create role chirpstack_ns with login password 'chirpstack_ns'; 6 | create database chirpstack_ns with owner chirpstack_ns; 7 | EOSQL 8 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/postgresql/initdb/002-init-chirpstack_as.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL 5 | create role chirpstack_as with login password 'chirpstack_as'; 6 | create database chirpstack_as with owner chirpstack_as; 7 | EOSQL 8 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/postgresql/initdb/003-chirpstack_as_trgm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="chirpstack_as" <<-EOSQL 5 | create extension pg_trgm; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/configuration/postgresql/initdb/004-chirpstack_as_hstore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="chirpstack_as" <<-EOSQL 5 | create extension hstore; 6 | EOSQL 7 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/lorawan-docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | chirpstack-network-server: 5 | image: chirpstack/chirpstack-network-server:3 6 | volumes: 7 | - ./configuration/chirpstack-network-server:/etc/chirpstack-network-server 8 | networks: 9 | my5gcore-compose_lorawan: 10 | aliases: 11 | - ns.lorawan.org 12 | 13 | chirpstack-application-server: 14 | image: chirpstack/chirpstack-application-server:3 15 | ports: 16 | - 8080:8080 17 | volumes: 18 | - ./configuration/chirpstack-application-server:/etc/chirpstack-application-server 19 | networks: 20 | my5gcore-compose_lorawan: 21 | ipv4_address: 10.200.200.10 22 | aliases: 23 | - ap.lorawan.org 24 | 25 | chirpstack-gateway-bridge: 26 | image: chirpstack/chirpstack-gateway-bridge:3 27 | ports: 28 | - 1700:1700/udp 29 | volumes: 30 | - ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge 31 | networks: 32 | my5gcore-compose_lorawan: 33 | ipv4_address: 10.200.200.11 34 | aliases: 35 | - br.lorawan.org 36 | 37 | chirpstack-geolocation-server: 38 | image: chirpstack/chirpstack-geolocation-server:3 39 | volumes: 40 | - ./configuration/chirpstack-geolocation-server:/etc/chirpstack-geolocation-server 41 | networks: 42 | my5gcore-compose_lorawan: 43 | aliases: 44 | - geo.lorawan.org 45 | 46 | postgresql: 47 | image: postgres:9.6-alpine 48 | environment: 49 | - POSTGRES_PASSWORD=root 50 | volumes: 51 | - ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d 52 | - postgresqldata:/var/lib/postgresql/data 53 | networks: 54 | my5gcore-compose_lorawan: 55 | aliases: 56 | - postegresql.lorawan.org 57 | 58 | redis: 59 | image: redis:5-alpine 60 | volumes: 61 | - redisdata:/data 62 | networks: 63 | my5gcore-compose_lorawan: 64 | aliases: 65 | - redis.lorawan.org 66 | 67 | mosquitto: 68 | image: eclipse-mosquitto 69 | ports: 70 | - 1883:1883 71 | networks: 72 | my5gcore-compose_lorawan: 73 | ipv4_address: 10.200.200.13 74 | aliases: 75 | - mosquitto.lorawan.org 76 | 77 | networks: 78 | my5gcore-compose_lorawan: 79 | external: true 80 | 81 | volumes: 82 | postgresqldata: 83 | redisdata: 84 | 85 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/.env: -------------------------------------------------------------------------------- 1 | CONFIG=./config-vSBrT2020 2 | DBURI=mongodb://db/free5gc 3 | UPF_LoRaWAN=10.100.200.101 4 | SMF_IP=10.100.200.100 5 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/.keep: -------------------------------------------------------------------------------- 1 | resddasds 2 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_IMAGE_OWNER='my5gcore' 2 | DOCKER_IMAGE_NAME='base' 3 | DOCKER_IMAGE_TAG='latest' 4 | 5 | 6 | .PHONY: base 7 | base: 8 | docker build -t ${DOCKER_IMAGE_OWNER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ./base 9 | docker image ls ${DOCKER_IMAGE_OWNER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} 10 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/README.md: -------------------------------------------------------------------------------- 1 | # My5G Compose 2 | 3 | This repository is a docker compose version of [free5GC](https://github.com/free5gc/free5gc) for stage 3. It's inspire by [free5gc-docker-compose](https://github.com/calee0219/free5gc-docker-compose) and also reference to [docker-free5GC](https://github.com/abousselmi/docker-free5gc). 4 | 5 | You can change your own config in [config](./config) folder and [docker-compose.yaml](docker-compose.yaml) 6 | 7 | 8 | 9 | 10 | 11 | - [How to use it: bare metal](#how-to-use-it-bare-metal) 12 | - [Prerequisites](#prerequisites) 13 | - [Install Docker](#install-docker) 14 | - [Ubuntu](#ubuntu) 15 | - [CentOS](#centos) 16 | - [Install docker-compose](#install-docker-compose) 17 | - [Run Up](#run-up) 18 | - [Troubleshooting](#troubleshooting) 19 | - [NF](#nf) 20 | - [Reference](#reference) 21 | 22 | 23 | 24 | ## How to use it: bare metal 25 | 26 | ### Prerequisites 27 | 28 | Due to the UPF issue, the host must using kernel `5.0.0-23-generic`. And it should contain `gtp5g` kernel module. 29 | 30 | On you host OS: 31 | ``` 32 | git clone https://github.com/PrinzOwO/gtp5g.git 33 | cd gtp5g 34 | make 35 | sudo make install 36 | ``` 37 | 38 | ### Install Docker 39 | 40 | #### Ubuntu 41 | Reference: https://docs.docker.com/install/linux/docker-ce/ubuntu/ 42 | ```bash 43 | $ sudo apt-get update 44 | $ sudo apt-get install \ 45 | apt-transport-https \ 46 | ca-certificates \ 47 | curl \ 48 | gnupg-agent \ 49 | software-properties-common 50 | 51 | $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 52 | 53 | $ sudo add-apt-repository \ 54 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 55 | $(lsb_release -cs) \ 56 | stable" 57 | 58 | $ sudo apt-get update 59 | $ sudo apt-get install docker-ce docker-ce-cli containerd.io 60 | ``` 61 | 62 | #### CentOS 63 | Reference: https://docs.docker.com/install/linux/docker-ce/centos/ 64 | ```bash 65 | $ sudo yum install -y yum-utils \ 66 | device-mapper-persistent-data \ 67 | lvm2 68 | 69 | $ sudo yum-config-manager \ 70 | --add-repo \ 71 | https://download.docker.com/linux/centos/docker-ce.repo 72 | 73 | $ sudo yum install docker-ce docker-ce-cli containerd.io 74 | 75 | $ sudo systemctl start docker 76 | $ sudo systemctl enable docker 77 | ``` 78 | 79 | #### Add docker group 80 | To let you use docker without root permission. 81 | 82 | Reference: https://docs.docker.com/engine/install/linux-postinstall/ 83 | ```bash 84 | $ sudo groupadd docker 85 | $ sudo usermod -aG docker $USER 86 | $ sudo reboot 87 | ``` 88 | 89 | 90 | ### Install docker-compose 91 | Reference: https://docs.docker.com/compose/install/ 92 | ```bash 93 | $ sudo curl -L https://github.com/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose 94 | $ sudo chmod +x /usr/local/bin/docker-compose 95 | ``` 96 | 97 | ### Run Up 98 | Because we need to create tunnel interface, we need to use privileged container with root permission. 99 | ```bash 100 | $ git clone https://github.comLABORA-INF-UFG/my5Gcore-compose/my5gcore-compose.git 101 | $ cd my5gcore-compose 102 | $ make base 103 | $ docker-compose build 104 | $ sudo docker-compose up # Recommand use with tmux to run in frontground 105 | $ sudo docker-compose up -d # Run in backbround if needed 106 | ``` 107 | ## Troubleshooting 108 | ```bash 109 | $ docker exec -it mongodb mongo 110 | > use my5gcore 111 | > db.subscribers.drop() 112 | > exit # (Or Ctrl-D) 113 | ``` 114 | 115 | Another way to drop DB data is just remove db data. Outside your container, run: 116 | ```bash 117 | $ rm -rf ./mongodb 118 | ``` 119 | 120 | ## NF 121 | 122 | For my default setting. 123 | 124 | | NF | Exposed Ports | Dependencies | Dependencies URI | 125 | |:-:|:-:|:-:|:-:| 126 | | amf | 29518 | nrf | nrfUri: https://nrf:29510 | 127 | | ausf | 29509 | nrf | nrfUri: https://nrf:29510 | 128 | | nrf | 29510 | db | MongoDBUrl: mongodb://db:27017 | 129 | | nssf | 29531 | nrf | nrfUri: https://nrf:29510gg/,
nrfId: https://nrf:29510/nnrf-nfm/v1/nf-instances | 130 | | pcf | 29507 | nrf | nrfUri: https://nrf:29510 | 131 | | smf | 29502 | nrf, upf | nrfUri: https://nrf:29510,
node_id: upf1, node_id: upf2, node_id: upf3 | 132 | | udm | 29503 | nrf | nrfUri: https://nrf:29510 | 133 | | udr | 29504 | nrf, db | nrfUri: https://nrf:29510,
url: mongodb://db:27017 | 134 | | n3iwf | N/A | amf, smf, upf | | 135 | | upf1 | N/A | pfcp, gtpu, apn | pfcp: upf1, gtpu: upf1, apn: internet | 136 | | upf2 | N/A | pfcp, gtpu, apn | pfcp: upf2, gtpu: upf2, apn: internet | 137 | | upfb (ulcl) | N/A | pfcp, gtpu, apn | pfcp: upfb, gtpu: upfb, apn: intranet | 138 | | webui | 5000 | db | MongoDBUrl: mongodb://db:27017 | 139 | 140 | ## Reference 141 | - https://github.com/open5gs/nextepc/tree/master/docker 142 | - https://github.com/abousselmi/docker-free5gc 143 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/base/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.14.4-stretch AS builder 2 | 3 | LABEL maintainer="My5Gcore " 4 | 5 | RUN apt-get update 6 | RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev curl 7 | RUN apt-get clean 8 | 9 | # Get My5Gcore 10 | RUN cd $GOPATH/src \ 11 | && git clone -b vSBrT2020 --recursive -j 33 https://github.com/LABORA-INF-UFG/my5Gcore.git \ 12 | && cd my5Gcore \ 13 | && go mod download 14 | 15 | # Build NF (AMF, AUSF, N3IWF, NRF, NSSF, PCF, SMF, UDM, UDR) 16 | RUN cd $GOPATH/src/my5Gcore/src \ 17 | && for d in * ; do if [ -f "$d/$d.go" ] ; then CGO_ENABLED=0 go build -a -installsuffix nocgo -o ../bin/"$d" -x "$d/$d.go" ; fi ; done ; 18 | 19 | # Build UPF 20 | #RUN go get -u -v "github.com/sirupsen/logrus" 21 | RUN cd $GOPATH/src/my5Gcore/src/upf \ 22 | && mkdir -p build \ 23 | && cd build \ 24 | && cmake .. \ 25 | && make -j `nproc` 26 | 27 | #INSTALL YARN 28 | #RUN apt update \ 29 | # && apt -y install apt-transport-https ca-certificates \ 30 | # && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 31 | # && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 32 | # && apt-get update \ 33 | # && apt-get -y install yarn \ 34 | # && apt-get clean 35 | 36 | # Build WebUI 37 | RUN cd $GOPATH/src/my5Gcore/webconsole \ 38 | # && cd frontend \ 39 | # && yarn install \ 40 | # && yarn build \ 41 | # && rm -rf ../public \ 42 | # && cp -R build ../public \ 43 | # && cd ..\ 44 | && CGO_ENABLED=0 go build -a -installsuffix nocgo -o webui -x server.go 45 | 46 | 47 | # Alpine is used for debug purpose. You can use scratch for a smaller footprint. 48 | FROM alpine 49 | 50 | WORKDIR /my5Gcore 51 | RUN mkdir -p config/ support/TLS/ public 52 | 53 | # Copy executables 54 | COPY --from=builder /go/src/my5Gcore/bin/* ./ 55 | COPY --from=builder /go/src/my5Gcore/src/upf/build/bin/* ./ 56 | COPY --from=builder /go/src/my5Gcore/webconsole/webui ./ 57 | 58 | # Copy static files (webui frontend) 59 | COPY --from=builder /go/src/my5Gcore/webconsole/public ./public 60 | 61 | # Copy linked libs 62 | COPY --from=builder /go/src/my5Gcore/src/upf/build/updk/src/third_party/libgtp5gnl/lib/libgtp5gnl.so.0 ./ 63 | COPY --from=builder /go/src/my5Gcore/src/upf/build/utlt_logger/liblogger.so ./ 64 | 65 | # Copy configuration files (not used for now) 66 | COPY --from=builder /go/src/my5Gcore/config/* ./config/ 67 | COPY --from=builder /go/src/my5Gcore/src/upf/build/config/* ./config/ 68 | 69 | # Copy default certificates (not used for now) 70 | COPY --from=builder /go/src/my5Gcore/support/TLS/* ./support/TLS/ 71 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/base_ue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.14.4-stretch AS builder 2 | 3 | LABEL maintainer="My5Gcore " 4 | 5 | ENV MY5GC_BRANCH master 6 | #ENV UE_BRANCH vSBrT2020 7 | ENV UE_BRANCH master 8 | 9 | RUN apt-get update 10 | RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev ssh 11 | RUN apt-get clean 12 | 13 | # Get My5Gcore 14 | RUN cd $GOPATH/src \ 15 | && git clone --recursive -b ${MY5GC_BRANCH} -j 33 https://github.com/LABORA-INF-UFG/my5Gcore.git \ 16 | && cd my5Gcore \ 17 | && go mod download 18 | 19 | ## ssh key configuration 20 | RUN mkdir /root/.ssh 21 | COPY .ssh/id_rsa /root/.ssh/id_rsa 22 | RUN chown 400 /root/.ssh/id_rsa 23 | #RUN ssh-add /root/.ssh/id_rsa.pub 24 | 25 | RUN touch /root/.ssh/known_hosts 26 | RUN ssh-keyscan github.com >> /root/.ssh/known_hosts 27 | 28 | # Get UE Code 29 | RUN cd $GOPATH/src/my5Gcore/src \ 30 | && git clone -b ${UE_BRANCH} git@github.com:LABORA-INF-UFG/UE-IoT-non3GPP.git ue \ 31 | && go get -u github.com/calee0219/fatal 32 | 33 | # Build UE 34 | RUN cd $GOPATH/src/my5Gcore/src \ 35 | && CGO_ENABLED=0 go build -a -installsuffix nocgo -o ../bin/ue -x ue/ue.go 36 | 37 | # Alpine is used for debug purpose. You can use scratch for a smaller footprint. 38 | FROM alpine 39 | 40 | WORKDIR /my5Gcore 41 | RUN mkdir -p config/ support/TLS/ 42 | 43 | # Copy executables 44 | COPY --from=builder /go/src/my5Gcore/bin/* ./ 45 | 46 | # Copy configuration files (not used for now) 47 | COPY --from=builder /go/src/my5Gcore/config/* ./config/ 48 | 49 | # Copy default certificates (not used for now) 50 | COPY --from=builder /go/src/my5Gcore/support/TLS/* ./support/TLS/ 51 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/.backup/smfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: SMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: 10.100.200.100 # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: 10.100.200.100 # Can also be an ENV. 11 | port: 29502 12 | tls: 13 | key: my5Gcore/support/TLS/smf.key 14 | pem: my5Gcore/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | - nsmf-oam 19 | snssai_info: 20 | - sNssai: 21 | sst: 1 22 | sd: 010203 23 | dnnSmfInfoList: 24 | - dnn: internet 25 | - sNssai: 26 | sst: 1 27 | sd: 112233 28 | dnnSmfInfoList: 29 | - dnn: internet 30 | pfcp: 31 | addr: 10.100.200.100 32 | userplane_information: 33 | up_nodes: 34 | gNB1: 35 | type: AN 36 | an_ip: 127.0.0.100 37 | UPF: 38 | type: UPF 39 | node_id: 10.100.200.101 40 | links: 41 | - A: gNB1 42 | B: UPF 43 | ue_subnet: 60.60.0.0/16 44 | dnn: 45 | internet: 46 | dns: 47 | ipv4: 8.8.8.8 48 | ipv6: 2001:4860:4860::8888 49 | nrfUri: http://nrf.my5Gcore.org:29510 50 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/.backup/smfcfg.conf-2: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: SMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: smf.my5Gcore.org # IP used to register to NRF 10 | bindingIPv4: smf.my5Gcore.org # IP used to bind the service 11 | port: 29502 12 | tls: 13 | key: gofree5gc/support/TLS/smf.key 14 | pem: gofree5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | snssai_info: 19 | - sNssai: 20 | sst: 1 21 | sd: 010203 22 | dnnSmfInfoList: 23 | - dnn: internet 24 | - sNssai: 25 | sst: 1 26 | sd: 112233 27 | dnnSmfInfoList: 28 | - dnn: lorawan 29 | pfcp: 30 | addr: 10.100.200.100 31 | userplane_information: 32 | up_nodes: 33 | gNB1: 34 | type: AN 35 | an_ip: 192.188.2.3 36 | AnchorUPF1: 37 | type: UPF 38 | node_id: 10.100.200.101 39 | AnchorUPF2: 40 | type: UPF 41 | node_id: 10.100.200.102 42 | BranchingUPF: 43 | type: UPF 44 | node_id: 10.100.200.103 45 | links: 46 | - A: gNB1 47 | B: BranchingUPF 48 | - A: BranchingUPF 49 | B: AnchorUPF1 50 | - A: BranchingUPF 51 | B: AnchorUPF2 52 | dnn: 53 | internet: 54 | dns: 55 | ipv4: 8.8.8.8 56 | ipv6: 2001:4860:4860::8888 57 | lorawan: 58 | dns: 59 | ipv4: 8.8.4.4 60 | ipv6: 2001:4860:4860::8844 61 | ue_subnet: 60.60.0.0/16 62 | nrfUri: http://nrf.my5Gcore.org:29510 63 | ulcl: true 64 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/1: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Configuração da rede pare teste do ping 4 | ip link set lo up 5 | ip addr add 60.60.0.101 dev lo 6 | ip link set lo up 7 | 8 | 9 | #Configuração de regras de reteamento 10 | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 11 | iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE 12 | 13 | #Configuração tunel gtp 14 | #ip link set dev upfgtp mtu 1500 15 | 16 | 17 | #Rules for lorawan 18 | 19 | echo "Finish run script !!!" 20 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/amfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: AMF initial local configuration 4 | 5 | configuration: 6 | amfName: AMF 7 | ngapIpList: 8 | - amf.my5Gcore.org 9 | sbi: 10 | scheme: http 11 | registerIPv4: amf.my5Gcore.org # IP used to register to NRF 12 | bindingIPv4: amf.my5Gcore.org # IP used to bind the service 13 | port: 29518 14 | serviceNameList: 15 | - namf-comm 16 | - namf-evts 17 | - namf-mt 18 | - namf-loc 19 | - namf-oam 20 | servedGuamiList: 21 | - plmnId: 22 | mcc: 208 23 | mnc: 93 24 | amfId: cafe00 25 | supportTaiList: 26 | - plmnId: 27 | mcc: 208 28 | mnc: 93 29 | tac: 1 30 | plmnSupportList: 31 | - plmnId: 32 | mcc: 208 33 | mnc: 93 34 | snssaiList: 35 | - sst: 1 36 | sd: 010203 37 | - sst: 1 38 | sd: 112233 39 | supportDnnList: 40 | - internet 41 | nrfUri: http://nrf.my5Gcore.org:29510 42 | security: 43 | integrityOrder: 44 | - NIA2 45 | - NIA0 46 | cipheringOrder: 47 | - NEA2 48 | - NEA0 49 | networkName: 50 | full: free5GC 51 | short: free 52 | t3502: 720 53 | t3512: 3600 54 | non3gppDeregistrationTimer: 3240 55 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/amfcfg.n3test.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: AMF initial local configuration 4 | 5 | configuration: 6 | amfName: AMF 7 | ngapIpList: 8 | - 10.200.200.1 9 | sbi: 10 | scheme: http 11 | registerIPv4: 127.0.0.1 # Can also be a kubernetes service IP or domain name. 12 | bindingIPv4: 127.0.0.1 # Can also be an ENV. 13 | port: 29518 14 | serviceNameList: 15 | - namf-comm 16 | - namf-evts 17 | - namf-mt 18 | - namf-loc 19 | - namf-oam 20 | servedGuamiList: 21 | - plmnId: 22 | mcc: 208 23 | mnc: 93 24 | amfId: cafe00 25 | supportTaiList: 26 | - plmnId: 27 | mcc: 208 28 | mnc: 93 29 | tac: 1 30 | plmnSupportList: 31 | - plmnId: 32 | mcc: 208 33 | mnc: 93 34 | snssaiList: 35 | - sst: 1 36 | sd: 010203 37 | - sst: 1 38 | sd: 112233 39 | supportDnnList: 40 | - internet 41 | nrfUri: http://localhost:29510 42 | security: 43 | integrityOrder: 44 | - NIA2 45 | - NIA0 46 | cipheringOrder: 47 | - NEA2 48 | - NEA0 49 | networkName: 50 | full: free5GC 51 | short: free 52 | t3502: 720 53 | t3512: 3600 54 | non3gppDeregistrationTimer: 3240 55 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/ausfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: AUSF initial local configuration 4 | 5 | configuration: 6 | sbi: 7 | scheme: http 8 | registerIPv4: ausf.my5Gcore.org # Can also be a kubernetes service IP or domain name. 9 | bindingIPv4: ausf.my5Gcore.org # Can also be an ENV. 10 | port: 29509 11 | serviceNameList: 12 | - nausf-auth 13 | nrfUri: http://nrf.my5Gcore.org:29510 14 | plmnSupportList: 15 | - mcc: 208 16 | mnc: 93 17 | - mcc: 123 18 | mnc: 45 19 | groupId: ausfGroup001 20 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/router-upf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #./free5gc-upfd -f ../config/upfcfg.yaml & 4 | 5 | 6 | sleep 3 7 | 8 | #Configuração da rede pare teste do ping 9 | ip link set lo up 10 | ip addr add 60.60.0.101 dev lo 11 | 12 | #Configuração de regras de reteamento 13 | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 14 | 15 | #Configuração tunel gtp 16 | #ip link set dev upfgtp mtu 1500 17 | 18 | 19 | echo "Finish run script !!!" 20 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/smfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: AMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: smf.my5Gcore.org # IP used to register to NRF 10 | bindingIPv4: smf.my5Gcore.org # IP used to bind the service 11 | port: 29502 12 | tls: 13 | key: gofree5gc/support/TLS/smf.key 14 | pem: gofree5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | snssai_info: 19 | - sNssai: 20 | sst: 1 21 | sd: 010203 22 | dnnSmfInfoList: 23 | - dnn: internet 24 | - sNssai: 25 | sst: 1 26 | sd: 112233 27 | dnnSmfInfoList: 28 | - dnn: lorawan 29 | pfcp: 30 | addr: 10.100.200.100 31 | userplane_information: 32 | up_nodes: 33 | gNB1: 34 | type: AN 35 | an_ip: 192.188.2.3 36 | AnchorUPF1: 37 | type: UPF 38 | node_id: 10.200.200.101 39 | AnchorUPF2: 40 | type: UPF 41 | node_id: 10.100.200.102 42 | BranchingUPF: 43 | type: UPF 44 | node_id: 10.100.200.103 45 | links: 46 | - A: gNB1 47 | B: BranchingUPF 48 | - A: BranchingUPF 49 | B: AnchorUPF1 50 | - A: BranchingUPF 51 | B: AnchorUPF2 52 | dnn: 53 | internet: 54 | dns: 55 | ipv4: 8.8.8.8 56 | ipv6: 2001:4860:4860::8888 57 | lorawan: 58 | dns: 59 | ipv4: 8.8.4.4 60 | ipv6: 2001:4860:4860::8844 61 | ue_subnet: 60.60.0.0/16 62 | nrfUri: http://nrf.my5Gcore.org:29510 63 | ulcl: true 64 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/uerouting.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: Routing information for UE 4 | 5 | ueRoutingInfo: 6 | - SUPI: imsi-2089300007487 7 | AN: 10.200.200.101 8 | PathList: 9 | - DestinationIP: 60.60.0.101 10 | UPF: !!seq 11 | - BranchingUPF 12 | - AnchorUPF1 13 | 14 | - DestinationIP: 60.60.0.103 15 | UPF: !!seq 16 | - BranchingUPF 17 | - AnchorUPF2 18 | 19 | - SUPI: imsi-2089300007486 20 | AN: 10.200.200.102 21 | PathList: 22 | - DestinationIP: 10.0.0.10 23 | UPF: !!seq 24 | - BranchingUPF 25 | - AnchorUPF1 26 | 27 | - DestinationIP: 10.0.0.11 28 | UPF: !!seq 29 | - BranchingUPF 30 | - AnchorUPF2 31 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/upfcfg1.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | 9 | pfcp: 10 | - addr: upf1.my5Gcore.org 11 | 12 | gtpu: 13 | - addr: upf1.my5Gcore.org 14 | # [optional] gtpu.name 15 | # - name: upf.5gc.nctu.me 16 | # [optional] gtpu.ifname 17 | # - ifname: gtpif 18 | 19 | dnn_list: 20 | - dnn: internet 21 | cidr: 60.60.0.0/24 22 | # [optional] apn_list[*].natifname 23 | # natifname: eth0 24 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/upfcfg1.yaml~: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | 9 | pfcp: 10 | - addr: upf1.my5Gcore.org 11 | 12 | gtpu: 13 | - addr: upf1.my5Gcore.org 14 | # [optional] gtpu.name 15 | # - name: upf.5gc.nctu.me 16 | # [optional] gtpu.ifname 17 | # - ifname: gtpif 18 | 19 | apn_list: 20 | - apn: internet 21 | cidr: 60.60.0.0/24 22 | # [optional] apn_list[*].natifname 23 | # natifname: eth0 24 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/upfcfg2.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | 9 | pfcp: 10 | - addr: upf2.my5Gcore.org 11 | 12 | gtpu: 13 | - addr: upf2.my5Gcore.org 14 | # [optional] gtpu.name 15 | # - name: upf.5gc.nctu.me 16 | # [optional] gtpu.ifname 17 | # - ifname: gtpif 18 | 19 | dnn_list: 20 | - dnn: lorawan 21 | cidr: 60.60.0.0/24 22 | # [optional] apn_list[*].natifname 23 | # natifname: eth0 24 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/upfcfgb.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | 9 | pfcp: 10 | - addr: upfb.my5Gcore.org 11 | 12 | gtpu: 13 | - addr: upfb.my5Gcore.org 14 | # [optional] gtpu.name 15 | # - name: upf.5gc.nctu.me 16 | # [optional] gtpu.ifname 17 | # - ifname: gtpif 18 | 19 | dnn_list: 20 | - dnn: internet 21 | - dnn: lorawan 22 | cidr: 60.60.0.0/24 23 | # [optional] apn_list[*].natifname 24 | # natifname: eth0 25 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/backup/upfcfgb.yaml~: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | 9 | pfcp: 10 | - addr: upfb.my5Gcore.org 11 | 12 | gtpu: 13 | - addr: upfb.my5Gcore.org 14 | # [optional] gtpu.name 15 | # - name: upf.5gc.nctu.me 16 | # [optional] gtpu.ifname 17 | # - ifname: gtpif 18 | 19 | dnn_list: 20 | - dnn: internet lorawan 21 | cidr: 60.60.0.0/24 22 | # [optional] apn_list[*].natifname 23 | # natifname: eth0 24 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/free5GC.conf: -------------------------------------------------------------------------------- 1 | db_uri: mongodb://localhost/free5GC 2 | 3 | #all logging levels 4 | #panic 5 | #fatal 6 | #error 7 | #warn 8 | #info 9 | #debug 10 | #trace 11 | logger: 12 | # network function 13 | AMF: 14 | debugLevel: info 15 | ReportCaller: true 16 | SMF: 17 | debugLevel: info 18 | ReportCaller: true 19 | UDR: 20 | debugLevel: info 21 | ReportCaller: true 22 | UDM: 23 | debugLevel: info 24 | ReportCaller: true 25 | NRF: 26 | debugLevel: info 27 | ReportCaller: true 28 | PCF: 29 | debugLevel: info 30 | ReportCaller: true 31 | AUSF: 32 | debugLevel: info 33 | ReportCaller: true 34 | N3IWF: 35 | debugLevel: info 36 | ReportCaller: true 37 | # library 38 | NAS: 39 | debugLevel: info 40 | ReportCaller: true 41 | FSM: 42 | debugLevel: info 43 | ReportCaller: true 44 | NGAP: 45 | debugLevel: info 46 | ReportCaller: true 47 | NamfComm: 48 | debugLevel: info 49 | ReportCaller: true 50 | NamfEventExposure: 51 | debugLevel: info 52 | ReportCaller: true 53 | NsmfPDUSession: 54 | debugLevel: info 55 | ReportCaller: true 56 | NudrDataRepository: 57 | debugLevel: info 58 | ReportCaller: true 59 | OpenApi: 60 | debugLevel: info 61 | ReportCaller: true 62 | Aper: 63 | debugLevel: info 64 | ReportCaller: true 65 | CommonConsumerTest: 66 | debugLevel: info 67 | ReportCaller: true 68 | # webui 69 | WEBUI: 70 | debugLevel: info 71 | ReportCaller: true 72 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/initial_registration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | curl --insecure --location --request POST 'https://localhost:10000/registration/' \ 4 | --header 'Content-Type: application/json' \ 5 | --data-raw '{ 6 | "authenticationMethod": "5G_AKA", 7 | "supiOrSuci": "2089300007487", 8 | "K": "5122250214c33e723a5dd523fc145fc0", 9 | "opcType": "OP", 10 | "opc": "c9e8763286b5b9ffbdf56e1297d0887b", 11 | "plmnId": "", 12 | "servingNetworkName": "", 13 | "n3IWFIpAddress": "n3iwf.my5Gcore.org", 14 | "SNssai": { 15 | "Sst": 1, 16 | "Sd": "010203" 17 | } 18 | }' 19 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/ipsec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import socket 4 | import argparse 5 | import os 6 | 7 | def sh(command): 8 | os.system(f"sh -c '{command}'") 9 | 10 | def nslookup(name): 11 | resolved = socket.gethostbyname(name) 12 | print(f"Resolved {name}: {resolved}") 13 | return resolved 14 | 15 | if __name__ == '__main__': 16 | 17 | parser = argparse.ArgumentParser(description="UE interface config") 18 | parser.add_argument("--ue", help="User Equipment FQND or IP") 19 | parser.add_argument("--n3iwf", help="N3IWF FQND or IP") 20 | args = parser.parse_args() 21 | 22 | 23 | if args.ue and args.n3iwf: 24 | ue_ip = nslookup(args.ue) 25 | n3iwf_ip = nslookup(args.n3iwf) 26 | commands = [f'ip link add name ipsec0 type vti local {ue_ip} remote {n3iwf_ip} key 5', 27 | 'ip link set ipsec0 up', 28 | 'ip route add 10.0.0.0/24 dev ipsec0', 29 | 'ip link set lo up', 30 | 'sleep 5' 31 | ] 32 | for command in commands: 33 | sh(command) 34 | else: 35 | raise ValueError("Error in UE or N3IWF") 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/my5Gcore.conf: -------------------------------------------------------------------------------- 1 | db_uri: mongodb://db/free5GC 2 | 3 | #all logging levels 4 | #panic 5 | #fatal 6 | #error 7 | #warn 8 | #info 9 | #debug 10 | #trace 11 | logger: 12 | # network function 13 | AMF: 14 | debugLevel: info 15 | ReportCaller: true 16 | SMF: 17 | debugLevel: info 18 | ReportCaller: true 19 | UDR: 20 | debugLevel: info 21 | ReportCaller: true 22 | UDM: 23 | debugLevel: info 24 | ReportCaller: true 25 | NRF: 26 | debugLevel: info 27 | ReportCaller: true 28 | PCF: 29 | debugLevel: info 30 | ReportCaller: true 31 | AUSF: 32 | debugLevel: info 33 | ReportCaller: true 34 | N3IWF: 35 | debugLevel: info 36 | ReportCaller: true 37 | # library 38 | NAS: 39 | debugLevel: info 40 | ReportCaller: true 41 | FSM: 42 | debugLevel: info 43 | ReportCaller: true 44 | NGAP: 45 | debugLevel: info 46 | ReportCaller: true 47 | NamfComm: 48 | debugLevel: info 49 | ReportCaller: true 50 | NamfEventExposure: 51 | debugLevel: info 52 | ReportCaller: true 53 | NsmfPDUSession: 54 | debugLevel: info 55 | ReportCaller: true 56 | NudrDataRepository: 57 | debugLevel: info 58 | ReportCaller: true 59 | OpenApi: 60 | debugLevel: info 61 | ReportCaller: true 62 | Aper: 63 | debugLevel: info 64 | ReportCaller: true 65 | CommonConsumerTest: 66 | debugLevel: info 67 | ReportCaller: true 68 | # webui 69 | WEBUI: 70 | debugLevel: info 71 | ReportCaller: true 72 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/n3iwf-ipsec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ### N3iwf IPSec tunnel configuration 4 | 5 | ip addr add 192.168.127.1/24 dev eth0 6 | ip link add name ipsec0 type vti local 192.168.127.1 remote 0.0.0.0 key 5 7 | ip a add 10.0.0.1/24 dev ipsec0 8 | ip l set dev ipsec0 up 9 | #ip ro del default 10 | 11 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/n3iwfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: N3IWF initial local configuration 4 | 5 | configuration: 6 | N3IWFInformation: 7 | GlobalN3IWFID: 8 | PLMNID: 9 | MCC: 10 | 208 11 | MNC: 12 | 93 13 | N3IWFID: 14 | 135 15 | Name: 16 | free5GC_N3IWF 17 | SupportedTAList: 18 | - TAC: 19 | 1 20 | BroadcastPLMNList: 21 | - PLMNID: 22 | MCC: 23 | 208 24 | MNC: 25 | 93 26 | TAISliceSupportList: 27 | - SNSSAI: 28 | SST: 29 | 1 30 | SD: 31 | 010203 32 | - SNSSAI: 33 | SST: 34 | 1 35 | SD: 36 | 112233 37 | AMFSCTPAddresses: 38 | - IP: 39 | - amf.my5Gcore.org 40 | 41 | # Bind Interfaces 42 | # IKE interface 43 | IKEBindAddress: 44 | 192.168.127.1 45 | # IPSec virtual interface 46 | IPSecInterfaceAddress: 47 | 10.0.0.1 48 | # IPSec virtual interface mark 49 | IPSecInterfaceMark: 50 | 5 51 | # GTP interface 52 | GTPBindAddress: 53 | 10.100.200.200 54 | 55 | # NAS TCP Listen Port 56 | NASTCPPort: 57 | 20000 58 | 59 | # N3IWF FQDN 60 | FQDN: 61 | n3iwf.my5Gcore.org 62 | 63 | # Security 64 | # Private Key File Path 65 | PrivateKey: 66 | # Certificate Authority (CA) 67 | CertificateAuthority: 68 | # Certificate 69 | Certificate: 70 | 71 | # IP address that will be allocated to UE in IPSec tunnel 72 | UEIPAddressRange: 73 | 10.0.0.0/24 74 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/nrfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: NRF initial local configuration 4 | 5 | configuration: 6 | MongoDBName: "free5gc" 7 | MongoDBUrl: "mongodb://db:27017" 8 | DefaultServiceIP: "nrf.my5Gcore.org" 9 | sbi: 10 | scheme: http 11 | ipv4Addr: nrf.my5GCore.org 12 | port: 29510 13 | DefaultPlmnId: 14 | mcc: "208" 15 | mnc: "93" 16 | serviceNameList: 17 | - nnrf-nfm 18 | - nnrf-disc 19 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/pcfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: PCF initial local configuration 4 | 5 | configuration: 6 | pcfName: PCF 7 | sbi: 8 | scheme: http 9 | registerIPv4: pcf.my5Gcore.org # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: pcf.my5Gcore.org # Can also be an ENV. 11 | port: 29507 12 | timeFormat: 2019-01-02 15:04:05 13 | defaultBdtRefId: BdtPolicyId- 14 | nrfUri: http://nrf.my5Gcore.org:29510 15 | serviceList: 16 | - serviceName: npcf-am-policy-control 17 | - serviceName: npcf-smpolicycontrol 18 | suppFeat: 3fff 19 | - serviceName: npcf-bdtpolicycontrol 20 | - serviceName: npcf-policyauthorization 21 | suppFeat: 3 22 | - serviceName: npcf-eventexposure 23 | - serviceName: npcf-ue-policy-control 24 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/router-upf-lorawan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Configuração da rede pare teste do ping 4 | ip link set lo up 5 | ip addr add 60.60.0.101 dev lo 6 | ip link set lo up 7 | 8 | 9 | #Configuração de regras de reteamento 10 | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 11 | iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE 12 | 13 | #Configuração tunel gtp 14 | #ip link set dev upfgtp mtu 1500 15 | 16 | 17 | #Rules for lorawan 18 | 19 | echo "Finish run script !!!" 20 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/smfcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: https 9 | registerIPv4: smf.my5Gcore.org # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: smf.my5Gcore.org # Can also be an ENV. 11 | port: 29502 12 | tls: 13 | key: free5gc/support/TLS/smf.key 14 | pem: free5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | - nsmf-oam 19 | snssai_info: 20 | - sNssai: 21 | sst: 1 22 | sd: 010203 23 | dnnSmfInfoList: 24 | - dnn: internet 25 | - sNssai: 26 | sst: 1 27 | sd: 112233 28 | dnnSmfInfoList: 29 | - dnn: internet 30 | pfcp: 31 | addr: 10.100.200.100 32 | userplane_information: 33 | up_nodes: 34 | gNB1: 35 | type: AN 36 | an_ip: 192.188.2.3 37 | UPF: 38 | type: UPF 39 | node_id: 10.100.200.101 40 | 41 | links: 42 | - A: gNB1 43 | B: UPF 44 | ue_subnet: 60.60.0.0/16 45 | dnn: 46 | internet: 47 | dns: 48 | ipv4: 8.8.8.8 49 | ipv6: 2001:4860:4860::8888 50 | internet: 51 | dns: 52 | ipv4: 8.8.4.4 53 | ipv6: 2001:4860:4860::8844 54 | nrfUri: http://nrf.my5Gcore.org:29510 55 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/subscribers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl --location --request POST 'http://127.0.0.1:5000/api/subscriber/imsi-2089300007487/20893' \ 4 | --header 'Content-Type: application/json' \ 5 | --data-raw '{ 6 | "plmnID": "20893", 7 | "ueId": "imsi-2089300007487", 8 | "AuthenticationSubscription": { 9 | "authenticationManagementField": "8000", 10 | "authenticationMethod": "5G_AKA", 11 | "milenage": { 12 | "op": { 13 | "encryptionAlgorithm": 0, 14 | "encryptionKey": 0, 15 | "opValue": "c9e8763286b5b9ffbdf56e1297d0887b" 16 | } 17 | }, 18 | "opc": { 19 | "encryptionAlgorithm": 0, 20 | "encryptionKey": 0, 21 | "opcValue": "" 22 | }, 23 | "permanentKey": { 24 | "encryptionAlgorithm": 0, 25 | "encryptionKey": 0, 26 | "permanentKeyValue": "5122250214c33e723a5dd523fc145fc0" 27 | }, 28 | "sequenceNumber": "16f3b3f70fc2" 29 | }, 30 | "AccessAndMobilitySubscriptionData": { 31 | "gpsis": [ 32 | "msisdn-0900000000" 33 | ], 34 | "nssai": { 35 | "defaultSingleNssais": [ 36 | { 37 | "sst": 1, 38 | "sd": "010203" 39 | }, 40 | { 41 | "sst": 1, 42 | "sd": "112233" 43 | } 44 | ], 45 | "singleNssais": [ 46 | { 47 | "sst": 1, 48 | "sd": "010203" 49 | }, 50 | { 51 | "sst": 1, 52 | "sd": "112233" 53 | } 54 | ] 55 | }, 56 | "subscribedUeAmbr": { 57 | "downlink": "2 Gbps", 58 | "uplink": "1 Gbps" 59 | } 60 | }, 61 | "SessionManagementSubscriptionDataList": [ 62 | { 63 | "singleNssai": { 64 | "sst": 1, 65 | "sd": "010203" 66 | }, 67 | "dnnConfigurations": { 68 | "internet": { 69 | "sscModes": { 70 | "defaultSscMode": "SSC_MODE_1", 71 | "allowedSscModes": [ 72 | "SSC_MODE_1", 73 | "SSC_MODE_2", 74 | "SSC_MODE_3" 75 | ] 76 | }, 77 | "pduSessionTypes": { 78 | "defaultSessionType": "IPV4", 79 | "allowedSessionTypes": [ 80 | "IPV4" 81 | ] 82 | }, 83 | "sessionAmbr": { 84 | "uplink": "2 Gbps", 85 | "downlink": "1 Gbps" 86 | }, 87 | "5gQosProfile": { 88 | "5qi": 9, 89 | "arp": { 90 | "priorityLevel": 8 91 | }, 92 | "priorityLevel": 8 93 | } 94 | } 95 | } 96 | }, 97 | { 98 | "singleNssai": { 99 | "sst": 1, 100 | "sd": "112233" 101 | }, 102 | "dnnConfigurations": { 103 | "internet": { 104 | "sscModes": { 105 | "defaultSscMode": "SSC_MODE_1", 106 | "allowedSscModes": [ 107 | "SSC_MODE_1", 108 | "SSC_MODE_2", 109 | "SSC_MODE_3" 110 | ] 111 | }, 112 | "pduSessionTypes": { 113 | "defaultSessionType": "IPV4", 114 | "allowedSessionTypes": [ 115 | "IPV4" 116 | ] 117 | }, 118 | "sessionAmbr": { 119 | "uplink": "2 Gbps", 120 | "downlink": "1 Gbps" 121 | }, 122 | "5gQosProfile": { 123 | "5qi": 9, 124 | "arp": { 125 | "priorityLevel": 8 126 | }, 127 | "priorityLevel": 8 128 | } 129 | } 130 | } 131 | } 132 | ], 133 | "SmfSelectionSubscriptionData": { 134 | "subscribedSnssaiInfos": { 135 | "01010203": { 136 | "dnnInfos": [ 137 | { 138 | "dnn": "internet" 139 | } 140 | ] 141 | }, 142 | "01112233": { 143 | "dnnInfos": [ 144 | { 145 | "dnn": "internet" 146 | } 147 | ] 148 | } 149 | } 150 | }, 151 | "AmPolicyData": { 152 | "subscCats": [ 153 | "free5gc" 154 | ] 155 | }, 156 | "SmPolicyData": { 157 | "smPolicySnssaiData": { 158 | "01010203": { 159 | "snssai": { 160 | "sst": 1, 161 | "sd": "010203" 162 | }, 163 | "smPolicyDnnData": { 164 | "internet": { 165 | "dnn": "internet" 166 | } 167 | } 168 | }, 169 | "01112233": { 170 | "snssai": { 171 | "sst": 1, 172 | "sd": "112233" 173 | }, 174 | "smPolicyDnnData": { 175 | "internet": { 176 | "dnn": "internet" 177 | } 178 | } 179 | } 180 | } 181 | } 182 | }' 183 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/test/smfcfg.single.test.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: SMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: 127.0.0.1 # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: 127.0.0.1 # Can also be an ENV. 11 | port: 29502 12 | tls: 13 | key: free5gc/support/TLS/smf.key 14 | pem: free5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | - nsmf-oam 19 | snssai_info: 20 | - sNssai: 21 | sst: 1 22 | sd: 010203 23 | dnnSmfInfoList: 24 | - dnn: internet 25 | - sNssai: 26 | sst: 1 27 | sd: 112233 28 | dnnSmfInfoList: 29 | - dnn: internet 30 | pfcp: 31 | addr: 10.200.200.1 32 | userplane_information: 33 | up_nodes: 34 | gNB1: 35 | type: AN 36 | an_ip: 192.188.2.3 37 | UPF: 38 | type: UPF 39 | node_id: 10.200.200.101 40 | links: 41 | - A: gNB1 42 | B: UPF 43 | ue_subnet: 60.60.0.0/16 44 | dnn: 45 | internet: 46 | dns: 47 | ipv4: 8.8.8.8 48 | ipv6: 2001:4860:4860::8888 49 | internet2: 50 | dns: 51 | ipv4: 8.8.4.4 52 | ipv6: 2001:4860:4860::8844 53 | nrfUri: http://localhost:29510 54 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/test/smfcfg.test.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: SMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: 127.0.0.1 # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: 127.0.0.1 # Can also be an ENV. 11 | port: 29502 12 | tls: 13 | key: free5gc/support/TLS/smf.key 14 | pem: free5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | - nsmf-oam 19 | snssai_info: 20 | - sNssai: 21 | sst: 1 22 | sd: 010203 23 | dnnSmfInfoList: 24 | - dnn: internet 25 | - sNssai: 26 | sst: 1 27 | sd: 112233 28 | dnnSmfInfoList: 29 | - dnn: internet 30 | pfcp: 31 | addr: 10.200.200.1 32 | userplane_information: 33 | up_nodes: 34 | gNB1: 35 | type: AN 36 | an_ip: 192.188.2.3 37 | UPF: 38 | type: UPF 39 | node_id: 10.200.200.101 40 | links: 41 | - A: gNB1 42 | B: UPF 43 | ue_subnet: 60.60.0.0/16 44 | dnn: 45 | internet: 46 | dns: 47 | ipv4: 8.8.8.8 48 | ipv6: 2001:4860:4860::8888 49 | internet2: 50 | dns: 51 | ipv4: 8.8.4.4 52 | ipv6: 2001:4860:4860::8844 53 | nrfUri: http://localhost:29510 54 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/test/smfcfg.ulcl.test.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: SMF initial local configuration 4 | 5 | configuration: 6 | smfName: SMF 7 | sbi: 8 | scheme: http 9 | registerIPv4: 127.0.0.1 # Can also be a kubernetes service IP or domain name. 10 | bindingIPv4: 127.0.0.1 # Can also be an ENV. 11 | port: 29502 12 | tls: 13 | key: free5gc/support/TLS/smf.key 14 | pem: free5gc/support/TLS/smf.pem 15 | serviceNameList: 16 | - nsmf-pdusession 17 | - nsmf-event-exposure 18 | - nsmf-oam 19 | pfcp: 20 | addr: 10.200.200.1 21 | snssai_info: 22 | - sNssai: 23 | sst: 1 24 | sd: 010203 25 | dnnSmfInfoList: 26 | - dnn: internet 27 | - sNssai: 28 | sst: 1 29 | sd: 112233 30 | dnnSmfInfoList: 31 | - dnn: internet 32 | userplane_information: 33 | up_nodes: 34 | gNB1: 35 | type: AN 36 | an_ip: 192.188.2.3 37 | BranchingUPF: 38 | type: UPF 39 | node_id: 10.200.200.102 40 | AnchorUPF1: 41 | type: UPF 42 | node_id: 10.200.200.101 43 | AnchorUPF2: 44 | type: UPF 45 | node_id: 10.200.200.103 46 | links: 47 | - A: gNB1 48 | B: BranchingUPF 49 | - A: BranchingUPF 50 | B: AnchorUPF1 51 | - A: BranchingUPF 52 | B: AnchorUPF2 53 | ue_subnet: 60.60.0.0/16 54 | dnn: 55 | internet: 56 | dns: 57 | ipv4: 8.8.8.8 58 | ipv6: 2001:4860:4860::8888 59 | internet2: 60 | dns: 61 | ipv4: 8.8.4.4 62 | ipv6: 2001:4860:4860::8844 63 | nrfUri: http://localhost:29510 64 | ulcl: true 65 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/udmcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UDM initial local configuration 4 | 5 | configuration: 6 | serviceNameList: 7 | - nudm-sdm 8 | - nudm-uecm 9 | - nudm-ueau 10 | - nudm-ee 11 | - nudm-pp 12 | sbi: 13 | scheme: http 14 | registerIPv4: udm.my5Gcore.org # Can also be a kubernetes service IP or domain name. 15 | bindingIPv4: udm.my5Gcore.org # Can also be an ENV. 16 | port: 29503 17 | tls: 18 | log: my5Gcore/udmsslkey.log 19 | pem: my5Gcore/support/TLS/udm.pem 20 | key: my5Gcore/support/TLS/udm.key 21 | 22 | udrclient: 23 | scheme: http 24 | ipv4Addr: udr.my5Gcore.org 25 | port: 29504 26 | 27 | nrfclient: 28 | scheme: http 29 | ipv4Addr: nrf.my5Gcore.org 30 | port: 29510 31 | nrfUri: http://nrf.my5Gcore.org:29510 32 | 33 | # test data set from TS33501-f60 Annex C.4 34 | # udmProfileAHNPublicKey: 5a8d38864820197c3394b92613b20b91633cbd897119273bf8e4a6f4eec0a650 35 | # udmProfileAHNPrivateKey: c53c22208b61860b06c62e5406a7b330c2b577aa5558981510d128247d38bd1d 36 | # udmProfileBHNPublicKey: 0472DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD15A7DED52FCBB097A4ED250E036C7B9C8C7004C4EEDC4F068CD7BF8D3F900E3B4 37 | # udmProfileBHNPrivateKey: F1AB1074477EBCC7F554EA1C5FC368B1616730155E0041AC447D6301975FECDA 38 | keys: 39 | udmProfileAHNPublicKey: 5a8d38864820197c3394b92613b20b91633cbd897119273bf8e4a6f4eec0a650 40 | udmProfileAHNPrivateKey: c53c22208b61860b06c62e5406a7b330c2b577aa5558981510d128247d38bd1d 41 | udmProfileBHNPublicKey: 0472DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD15A7DED52FCBB097A4ED250E036C7B9C8C7004C4EEDC4F068CD7BF8D3F900E3B4 42 | udmProfileBHNPrivateKey: F1AB1074477EBCC7F554EA1C5FC368B1616730155E0041AC447D6301975FECDA 43 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/udrcfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UDR initial local configuration 4 | 5 | configuration: 6 | sbi: 7 | scheme: http 8 | registerIPv4: udr.my5Gcore.org # Can also be a kubernetes service IP or domain name. 9 | bindingIPv4: udr.my5Gcore.org # Can also be an ENV. 10 | port: 29504 11 | mongodb: 12 | name: free5gc 13 | url: mongodb://db:27017 14 | nrfUri: http://nrf.my5Gcore.org:29510 -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/ue-ipsec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | remote_IP=10.100.200.2 4 | 5 | ### UE IPSec tunnel configuration 6 | ip l add name ipsec0 type vti local ue remote $remote_IP key 5 7 | 8 | ip l set dev ipsec0 up 9 | sleep 5 10 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/uecfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: N3IWF initial local configuration 4 | 5 | configuration: 6 | UEConfiguration: 7 | HttpIPv4Address: 127.0.0.1 8 | HttpIPv4Port: 10000 9 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/uerouting.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: Routing information for UE 4 | 5 | ueRoutingInfo: 6 | - SUPI: imsi-2089300007487 7 | AN: 10.100.200.101 8 | PathList: 9 | - DestinationIP: 60.60.0.101 10 | UPF: !!seq 11 | - BranchingUPF 12 | - AnchorUPF1 13 | 14 | - DestinationIP: 60.60.0.103 15 | UPF: !!seq 16 | - BranchingUPF 17 | - AnchorUPF2 18 | 19 | - SUPI: imsi-2089300007486 20 | AN: 10.100.200.101 21 | PathList: 22 | - DestinationIP: 10.0.0.10 23 | UPF: !!seq 24 | - BranchingUPF 25 | - AnchorUPF1 26 | 27 | - DestinationIP: 10.0.0.11 28 | UPF: !!seq 29 | - BranchingUPF 30 | - AnchorUPF2 31 | 32 | routeProfile: 33 | MEC1: 34 | forwardingPolicyID: 10 35 | 36 | pfdDataForApp: 37 | - applicationId: edge 38 | pfds: 39 | - pfdID: pfd1 40 | flowDescriptions: 41 | - permit out ip from 60.60.0.1 8080 to any 42 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/upfcfg.yaml: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: UPF configuration 4 | 5 | configuration: 6 | # debugLevel: panic|fatal|error|warn|info|debug|trace 7 | debugLevel: info 8 | ReportCaller: false 9 | 10 | pfcp: 11 | - addr: 10.100.200.101 12 | 13 | gtpu: 14 | - addr: 10.100.200.101 15 | # [optional] gtpu.name 16 | # - name: upf.5gc.nctu.me 17 | # [optional] gtpu.ifname 18 | # - ifname: gtpif 19 | 20 | dnn_list: 21 | - dnn: internet 22 | cidr: 60.60.0.0/24 23 | # [optional] apn_list[*].natifname 24 | # natifname: eth0 25 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/config-vSBrT2020/webuicfg.conf: -------------------------------------------------------------------------------- 1 | info: 2 | version: 1.0.0 3 | description: WebUI initial local configuration 4 | 5 | configuration: 6 | mongodb: 7 | name: free5gc 8 | url: mongodb://db:27017 9 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_amf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV F5GC_MODULE amf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${F5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${F5GC_MODULE} ./${F5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${F5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${F5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${F5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29518 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_ausf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE ausf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29509 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_n3iwf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE n3iwf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U tcpdump vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Install N3IWF dependencies 14 | RUN apk add -U iproute2 15 | 16 | # Set working dir 17 | WORKDIR /my5Gcore 18 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 19 | 20 | # Copy executable and default certs 21 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 22 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 23 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 24 | 25 | # Move to the binary path 26 | WORKDIR /my5Gcore/${My5GC_MODULE} 27 | 28 | # Config files volume 29 | VOLUME [ "/my5Gcore/config" ] 30 | 31 | # Certificates (if not using default) volume 32 | VOLUME [ "/my5Gcore/support/TLS" ] 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_nrf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE nrf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29510 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_nssf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE nssf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29531 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_pcf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE pcf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29507 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_smf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE smf 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29502 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_udm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE udm 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29503 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_udr/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE udr 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ log/ support/TLS/ ${My5GC_MODULE}/ 16 | 17 | # Copy executable and default certs 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE} 19 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.pem ./support/TLS/ 20 | COPY --from=builder /my5Gcore/support/TLS/${My5GC_MODULE}.key ./support/TLS/ 21 | 22 | # Move to the binary path 23 | WORKDIR /my5Gcore/${My5GC_MODULE} 24 | 25 | # Config files volume 26 | VOLUME [ "/my5Gcore/config" ] 27 | 28 | # Certificates (if not using default) volume 29 | VOLUME [ "/my5Gcore/support/TLS" ] 30 | 31 | # Exposed ports 32 | EXPOSE 29504 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_ue/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/ue:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="User Equipment in LoRaWAN Gateway" \ 5 | version="Stage 3" 6 | 7 | ENV MY5GC_MODULE ue 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Install UE dependencies 14 | RUN apk add -U iproute2 python3 15 | 16 | # Set working dir 17 | WORKDIR /my5gcore 18 | RUN mkdir -p bin/ config/ log/ support/TLS/ 19 | 20 | # Copy executable and default certs 21 | COPY --from=builder /my5Gcore/ue ./bin/ 22 | COPY --from=builder /my5Gcore/support/TLS/${MY5GC_MODULE}.pem ./support/TLS/ 23 | COPY --from=builder /my5Gcore/support/TLS/${MY5GC_MODULE}.key ./support/TLS/ 24 | 25 | # Move to the binary path 26 | WORKDIR /my5gcore/ 27 | 28 | # Config files volume 29 | VOLUME [ "/my5gcore/config" ] 30 | 31 | # Certificates (if not using default) volume 32 | VOLUME [ "/my5gcore/support/TLS" ] 33 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_upf/#Dockerfile#: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM ubuntu:18.04 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE my5Gcore-upfd 8 | ENV DEBIAN_FRONTEND noninteractive 9 | ARG DEBUG_TOOLS 10 | 11 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 12 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apt-get update && apt-get install -y vim strace net-tools iputils-ping curl netcat ; fi 13 | 14 | # Install UPF dependencies 15 | RUN apt-get update \ 16 | && apt-get install -y libmnl0 libyaml-0-2 iproute2 \ 17 | && apt-get clean 18 | 19 | # Set working dir 20 | WORKDIR /my5Gcore 21 | RUN mkdir -p ${My5GC_MODULE}/config/ 22 | 23 | # Copy executable and default configuration 24 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE}/ 25 | 26 | # Copy linked libs 27 | COPY --from=builder /my5Gcore/libgtp5gnl.so.0 /usr/local/lib 28 | COPY --from=builder /my5Gcore/liblogger.so /usr/local/lib 29 | 30 | # Move to the executable location 31 | WORKDIR /my5Gcore/${My5GC_MODULE} 32 | 33 | # Update links 34 | RUN ldconfig 35 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/nf_upf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM ubuntu:18.04 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE free5gc-upfd 8 | ENV DEBIAN_FRONTEND noninteractive 9 | ARG DEBUG_TOOLS 10 | 11 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 12 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apt-get update && apt-get install -y vim strace net-tools iputils-ping curl netcat ; fi 13 | 14 | # Install UPF dependencies 15 | RUN apt-get update \ 16 | && apt-get install -y libmnl0 libyaml-0-2 iproute2 iptables\ 17 | && apt-get clean 18 | 19 | # Set working dir 20 | WORKDIR /my5Gcore 21 | RUN mkdir -p ${My5GC_MODULE}/config/ 22 | 23 | # Copy executable and default configuration 24 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./${My5GC_MODULE}/ 25 | 26 | # Copy linked libs 27 | COPY --from=builder /my5Gcore/libgtp5gnl.so.0 /usr/local/lib 28 | COPY --from=builder /my5Gcore/liblogger.so /usr/local/lib 29 | 30 | # Move to the executable location 31 | WORKDIR /my5Gcore/${My5GC_MODULE} 32 | 33 | # Update links 34 | RUN ldconfig 35 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/troubleshooting.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo docker-compose down 4 | sudo rm -rf dbdata/ 5 | sudo docker-compose up -d 6 | ./config-vSBrT2020/subscribers.sh 7 | sudo docker-compose exec my5gcore-n3iwf cat /sys/class/net/eth0/iflink 8 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/my5Gcore-compose/webui/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM my5gcore/base:latest AS builder 2 | FROM alpine:3.8 3 | 4 | LABEL description="My5Gcore open source 5G Core Network" \ 5 | version="Stage 3" 6 | 7 | ENV My5GC_MODULE webui 8 | ARG DEBUG_TOOLS 9 | 10 | # Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true) 11 | RUN if [ "$DEBUG_TOOLS" = "true" ] ; then apk add -U vim strace net-tools curl netcat-openbsd ; fi 12 | 13 | # Set working dir 14 | WORKDIR /my5Gcore 15 | RUN mkdir -p config/ webconsole/publicoo 16 | 17 | # Copy executable, frontend static files and default configuration 18 | COPY --from=builder /my5Gcore/${My5GC_MODULE} ./webconsole 19 | COPY --from=builder /my5Gcore/public ./webconsole/public 20 | 21 | # Move to the executable location 22 | WORKDIR /my5Gcore/webconsole 23 | 24 | # Config files volume 25 | VOLUME [ "/my5Gcore/config" ] 26 | 27 | # WebUI uses the port 5000 28 | EXPOSE 5000 29 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant.d/README.md: -------------------------------------------------------------------------------- 1 | # Vagrantbox for non3GPP-IoT Use Case 2 | 3 | ## Prerequisites 4 | 5 | ### Vagrant 6 | 7 | You can install vagrant by following the steps provided here: https://www.vagrantup.com/docs/installation/ 8 | 9 | ### Virtualbox 10 | 11 | Please update the provider in the `Vagrantfile` with your favorite one. 12 | 13 | For the Virtualbox provider you need to install virtualbox on your machine. Please follow install steps here: https://www.virtualbox.org/wiki/Linux_Downloads 14 | 15 | 16 | ### Vagrant additional plugins 17 | 18 | Once vagrant is installed, you need to add this plugin. It is needed for reloading automatically the box (for kernel upgrade). 19 | 20 | ```console 21 | $ vagrant plugin install vagrant-reload 22 | ``` 23 | 24 | ## Update 25 | 26 | Please update the RAM and CPU values found in `Vagrantfile` to best fit you system configuration. 27 | 28 | ```console 29 | vb.memory = 30 | vb.cpus = 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant.d/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.define "non3gpp IoT use case" 3 | 4 | config.vm.provider "virtualbox" do |vb| 5 | vb.memory = 2048 6 | vb.cpus = 2 7 | end 8 | config.vm.hostname = "my5Gcore" 9 | config.vm.box = "ubuntu/bionic64" 10 | config.vm.network "forwarded_port", guest: 5000, host: 5000 11 | config.vm.network "forwarded_port", guest: 8080, host: 8080 12 | config.vm.synced_folder "shared", "/vagrant", disabled: false 13 | 14 | config.vm.provision "shell", path: "pre-config.sh" 15 | config.vm.provision :reload 16 | #config.vm.provision "shell", path: "post-config.sh" 17 | 18 | [ "cd /tmp", 19 | "git clone https://github.com/PrinzOwO/gtp5g.git", 20 | "cd gtp5g", 21 | "make clean", 22 | "make ", 23 | "make install", 24 | "find /lib/modules/$(uname -r) -type f -name gtp5g*" 25 | ].each do |step| 26 | config.vm.provision "shell", privileged: false, inline: step 27 | end 28 | 29 | [ "cd ~", 30 | "git clone https://github.com/LABORA-INF-UFG/SBrT2020-Minicurso1.git", 31 | "cd SBrT2020-Minicurso1/docs/non3gpp-iot-use-case/my5Gcore-compose/", 32 | "sudo make", 33 | "sudo docker-compose build", 34 | "sudo docker-compose up -d" 35 | ].each do |step| 36 | config.vm.provision "shell", privileged: false, inline: step 37 | end 38 | 39 | end 40 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant.d/post-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function log { 4 | echo -e "[INFO] $1" 5 | } 6 | 7 | function logerr { 8 | echo -e "[ERRO] $1" 9 | } 10 | SYNCED_FOLDER='/vagrant' 11 | WORKSPACE='sbrt-compose' 12 | 13 | log "Start post-config script" 14 | 15 | log "Install gtp5g kernel module" 16 | cd /tmp \ 17 | && git clone https://github.com/PrinzOwO/gtp5g.git \ 18 | && cd gtp5g \ 19 | && make clean \ 20 | && make \ 21 | && make install 22 | 23 | log "gtp5g kernel module is located here:" 24 | find /lib/modules/$(uname -r) -type f -name gtp5g* 25 | 26 | cd $SYNCED_FOLDER/$WORKSPACE 27 | 28 | 29 | 30 | 31 | log "End post-config script" 32 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant.d/pre-config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function log { 4 | echo -e "[INFO] $1" 5 | } 6 | 7 | function logerr { 8 | echo -e "[ERRO] $1" 9 | } 10 | 11 | SBRT_COMPOSE_REPO='https://github.com/LABORA-INF-UFG/SBrT2020-Minicurso1.git' 12 | DOCKER_COMPOSE_VERSION='1.25.5' 13 | VAGRANT_UID='1000' 14 | SYNCED_FOLDER='/vagrant' 15 | WORKSPACE='sbrt-compose' 16 | 17 | log "Start pre-config script" 18 | 19 | log "Set environment variables" 20 | export DEBIAN_FRONTEND=noninteractive 21 | 22 | log "Install dependencies" 23 | apt-get update -qq \ 24 | && apt-get install -qq \ 25 | git \ 26 | build-essential \ 27 | vim \ 28 | strace \ 29 | net-tools \ 30 | iputils-ping \ 31 | iproute2 32 | 33 | log "Update kernel version: 5.0.0-23-generic" 34 | apt-get install -qq \ 35 | linux-image-5.0.0-23-generic \ 36 | linux-modules-5.0.0-23-generic \ 37 | linux-headers-5.0.0-23-generic \ 38 | && grub-set-default 1 \ 39 | && update-grub 40 | 41 | log "Install latest version of docker" 42 | apt-get remove -qq \ 43 | docker \ 44 | docker-engine \ 45 | docker.io \ 46 | containerd \ 47 | runc \ 48 | && apt-get install -qq \ 49 | apt-transport-https \ 50 | ca-certificates \ 51 | curl \ 52 | gnupg-agent \ 53 | software-properties-common \ 54 | && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - &> /dev/null \ 55 | && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ 56 | && apt-get update -qq \ 57 | && apt-get install -qq \ 58 | docker-ce \ 59 | docker-ce-cli \ 60 | containerd.io \ 61 | && groupadd docker | true \ 62 | && usermod -aG docker $(id -nu $VAGRANT_UID) \ 63 | && setfacl -m user:$(id -nu $VAGRANT_UID):rw /var/run/docker.sock \ 64 | && systemctl enable docker \ 65 | 66 | log "Verify docker install" 67 | docker --version 68 | 69 | log "Install docker-compose version: $DOCKER_COMPOSE_VERSION" 70 | curl -sL "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \ 71 | && chmod +x /usr/local/bin/docker-compose \ 72 | && curl -L https://raw.githubusercontent.com/docker/compose/$DOCKER_COMPOSE_VERSION/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose 73 | 74 | log "Verify docker-compose install" 75 | docker-compose --version 76 | 77 | mkdir -p $SYNCED_FOLDER/$WORKSPACE 78 | 79 | log "Git clone free5gc-compose project" 80 | git clone $SBRT_COMPOSE_REPO $SYNCED_FOLDER/$WORKSPACE 81 | 82 | log "End pre-config script. Reload the box.." 83 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant.d/shared/README.md: -------------------------------------------------------------------------------- 1 | # Shared 2 | 3 | Will contain shared files between host and guest machines. -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant/README.md: -------------------------------------------------------------------------------- 1 | # Vagrantbox for non3GPP-IoT Use Case 2 | 3 | ## Prerequisites 4 | 5 | ### Vagrant 6 | 7 | You can install vagrant by following the steps provided here: https://www.vagrantup.com/docs/installation/ 8 | 9 | ### Virtualbox 10 | 11 | Please update the provider in the `Vagrantfile` with your favorite one. 12 | 13 | For the Virtualbox provider you need to install virtualbox on your machine. Please follow install steps here: https://www.virtualbox.org/wiki/Linux_Downloads 14 | 15 | 16 | ### Vagrant additional plugins 17 | 18 | Once vagrant is installed, you need to add this plugin. It is needed for reloading automatically the box (for kernel upgrade). 19 | 20 | ```console 21 | $ vagrant plugin install vagrant-reload 22 | ``` 23 | 24 | ## Update 25 | 26 | Please update the RAM and CPU values found in `Vagrantfile` to best fit you system configuration. 27 | 28 | ```console 29 | vb.memory = 30 | vb.cpus = 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.define "non3gpp IoT use case" 3 | 4 | config.vm.provider "virtualbox" do |vb| 5 | vb.memory = 2048 6 | vb.cpus = 2 7 | end 8 | config.vm.hostname = "my5Gcore" 9 | config.vm.box = "ubuntu/bionic64" 10 | config.vm.network "forwarded_port", guest: 5000, host: 5000 11 | config.vm.network "forwarded_port", guest: 8080, host: 8080 12 | config.vm.synced_folder "shared", "/vagrant", disabled: false 13 | 14 | config.vm.provision "shell", path: "bootstrap.sh" 15 | config.vm.provision :reload 16 | 17 | [ "cd /tmp", 18 | "git clone https://github.com/PrinzOwO/gtp5g.git", 19 | "cd gtp5g", 20 | "make clean", 21 | "make ", 22 | "sudo make install", 23 | "find /lib/modules/$(uname -r) -type f -name gtp5g*" 24 | ].each do |step| 25 | config.vm.provision "shell", privileged: false, inline: step 26 | end 27 | 28 | config.vm.provision :docker 29 | config.vm.provision :docker-compose, 30 | yml: [ 31 | "/vagrant/docker" 32 | ] 33 | 34 | 35 | 36 | end 37 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function log { 4 | echo -e "[INFO] $1" 5 | } 6 | 7 | function logerr { 8 | echo -e "[ERRO] $1" 9 | } 10 | 11 | SBRT_COMPOSE_REPO='https://github.com/LABORA-INF-UFG/SBrT2020-Minicurso1.git' 12 | DOCKER_COMPOSE_VERSION='1.25.5' 13 | VAGRANT_UID='1000' 14 | SYNCED_FOLDER='/vagrant' 15 | WORKSPACE='sbrt-compose' 16 | 17 | log "Start pre-config script" 18 | 19 | log "Set environment variables" 20 | export DEBIAN_FRONTEND=noninteractive 21 | 22 | log "Install dependencies" 23 | apt-get update -qq \ 24 | && apt-get install -qq \ 25 | git \ 26 | build-essential \ 27 | vim \ 28 | strace \ 29 | net-tools \ 30 | iputils-ping \ 31 | iproute2 32 | 33 | log "Update kernel version: 5.0.0-23-generic" 34 | apt-get install -qq \ 35 | linux-image-5.0.0-23-generic \ 36 | linux-modules-5.0.0-23-generic \ 37 | linux-headers-5.0.0-23-generic \ 38 | && grub-set-default 1 \ 39 | && update-grub 40 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant/post-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function log { 4 | echo -e "[INFO] $1" 5 | } 6 | 7 | function logerr { 8 | echo -e "[ERRO] $1" 9 | } 10 | SYNCED_FOLDER='/vagrant' 11 | WORKSPACE='sbrt-compose' 12 | 13 | log "Start post-config script" 14 | 15 | log "Install gtp5g kernel module" 16 | cd /tmp \ 17 | && git clone https://github.com/PrinzOwO/gtp5g.git \ 18 | && cd gtp5g \ 19 | && make clean \ 20 | && make \ 21 | && make install 22 | 23 | log "gtp5g kernel module is located here:" 24 | find /lib/modules/$(uname -r) -type f -name gtp5g* 25 | 26 | cd $SYNCED_FOLDER/$WORKSPACE 27 | 28 | 29 | 30 | 31 | log "End post-config script" 32 | -------------------------------------------------------------------------------- /docs/non3gpp-iot-use-case/vagrant/shared/README.md: -------------------------------------------------------------------------------- 1 | # Shared 2 | 3 | Will contain shared files between host and guest machines. -------------------------------------------------------------------------------- /media/Readme.md: -------------------------------------------------------------------------------- 1 | Vídeos 2 | -------------------------------------------------------------------------------- /media/images/5gs-procedures/Initial-Registration-Procedure-Simplified (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/Initial-Registration-Procedure-Simplified (1).png -------------------------------------------------------------------------------- /media/images/5gs-procedures/Initial-Registration-Procedure-Simplified-debugging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/Initial-Registration-Procedure-Simplified-debugging.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/Initial-Registration-Procedure-Simplified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/Initial-Registration-Procedure-Simplified.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/debug-window-all-commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/debug-window-all-commands.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/goland-debug-nf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/goland-debug-nf.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-A-ike-auth-encrypted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-A-ike-auth-encrypted.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-A-ike-sa-init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-A-ike-sa-init.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-A.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-A.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-B.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-C-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-C-2.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-C.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-C.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/wireshark-F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/wireshark-F.png -------------------------------------------------------------------------------- /media/images/5gs-procedures/xfrm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/5gs-procedures/xfrm.png -------------------------------------------------------------------------------- /media/images/code-debugging/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/3.png -------------------------------------------------------------------------------- /media/images/code-debugging/4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/4.jpeg -------------------------------------------------------------------------------- /media/images/code-debugging/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/5.png -------------------------------------------------------------------------------- /media/images/code-debugging/5gs-protocols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/5gs-protocols.png -------------------------------------------------------------------------------- /media/images/code-debugging/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/6.png -------------------------------------------------------------------------------- /media/images/code-debugging/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/7.png -------------------------------------------------------------------------------- /media/images/code-debugging/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/8.png -------------------------------------------------------------------------------- /media/images/code-debugging/gtp5g-tunnels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/gtp5g-tunnels.png -------------------------------------------------------------------------------- /media/images/code-debugging/packet-processing-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/packet-processing-flow.png -------------------------------------------------------------------------------- /media/images/code-debugging/packet-processing-rules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/packet-processing-rules.png -------------------------------------------------------------------------------- /media/images/code-debugging/pfcp-session-establishment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/pfcp-session-establishment.png -------------------------------------------------------------------------------- /media/images/code-debugging/pfcp-wireshark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/pfcp-wireshark.png -------------------------------------------------------------------------------- /media/images/code-debugging/set-break-point-nrf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-debugging/set-break-point-nrf.png -------------------------------------------------------------------------------- /media/images/code-organization/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/.keep -------------------------------------------------------------------------------- /media/images/code-organization/amf-context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amf-context.png -------------------------------------------------------------------------------- /media/images/code-organization/amf-initConfigFactory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amf-initConfigFactory.png -------------------------------------------------------------------------------- /media/images/code-organization/amf-producer-package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amf-producer-package.png -------------------------------------------------------------------------------- /media/images/code-organization/amf-service-specific-packages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amf-service-specific-packages.png -------------------------------------------------------------------------------- /media/images/code-organization/amf-ueauthentication-consumer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amf-ueauthentication-consumer.png -------------------------------------------------------------------------------- /media/images/code-organization/amfcfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/amfcfg.png -------------------------------------------------------------------------------- /media/images/code-organization/main-package-amf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-organization/main-package-amf.png -------------------------------------------------------------------------------- /media/images/code-overview/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/code-overview/.keep -------------------------------------------------------------------------------- /media/images/installation-dev-env-setup/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/installation-dev-env-setup/.keep -------------------------------------------------------------------------------- /media/images/n3iwf-sudo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/n3iwf-sudo.png -------------------------------------------------------------------------------- /media/images/non3gpp-iot-use-case/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/non3gpp-iot-use-case/.keep -------------------------------------------------------------------------------- /media/images/reference-points/N1-signalling-connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/reference-points/N1-signalling-connection.png -------------------------------------------------------------------------------- /media/images/reference-points/amf-run-ngap-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/reference-points/amf-run-ngap-server.png -------------------------------------------------------------------------------- /media/images/reference-points/amfcfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/reference-points/amfcfg.png -------------------------------------------------------------------------------- /media/images/reference-points/sbi-rp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/reference-points/sbi-rp.png -------------------------------------------------------------------------------- /media/images/reference-points/upfcfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/images/reference-points/upfcfg.png -------------------------------------------------------------------------------- /media/runConfigurations.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABORA-INF-UFG/SBrT2020-Minicurso1/d8cfcd87ed5202f5583e202354a4bf26e53286f9/media/runConfigurations.tar.gz --------------------------------------------------------------------------------