├── .clang-tidy ├── .gitignore ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── THIRD_PARTY_LICENSES.md ├── doc ├── Makefile └── source │ ├── conf.py │ ├── figures │ ├── information-class.png │ ├── node-class.png │ ├── node-design.png │ ├── oran-class.png │ ├── oran-design.png │ ├── ric-class.png │ ├── ric-design.png │ ├── seq-activation.png │ ├── seq-commands.png │ ├── seq-logic.png │ └── seq-report.png │ ├── index.rst │ ├── oran-architecture.rst │ ├── oran-description.rst │ ├── oran-examples-and-test.rst │ ├── oran-usage.rst │ ├── oran.rst │ └── replace.txt ├── examples ├── CMakeLists.txt ├── oran-data-repository-example.cc ├── oran-keep-alive-example.cc ├── oran-lte-2-lte-distance-handover-example.cc ├── oran-lte-2-lte-distance-handover-helper-example.cc ├── oran-lte-2-lte-distance-handover-lm-processing-delay-example.cc ├── oran-lte-2-lte-distance-handover-lm-query-trigger-example.cc ├── oran-lte-2-lte-ml-handover-example-classifier.py ├── oran-lte-2-lte-ml-handover-example-generate-training-data.sh ├── oran-lte-2-lte-ml-handover-example.cc ├── oran-lte-2-lte-rsrp-handover-lm-example.cc ├── oran-multiple-net-devices-example.cc ├── oran-random-walk-example.cc ├── saved_trained_classification_pytorch.onnx └── saved_trained_classification_pytorch.pt ├── helper ├── oran-helper.cc └── oran-helper.h ├── model ├── oran-cmm-handover.cc ├── oran-cmm-handover.h ├── oran-cmm-noop.cc ├── oran-cmm-noop.h ├── oran-cmm-single-command-per-node.cc ├── oran-cmm-single-command-per-node.h ├── oran-cmm.cc ├── oran-cmm.h ├── oran-command-lte-2-lte-handover.cc ├── oran-command-lte-2-lte-handover.h ├── oran-command.cc ├── oran-command.h ├── oran-data-repository-sqlite.cc ├── oran-data-repository-sqlite.h ├── oran-data-repository.cc ├── oran-data-repository.h ├── oran-e2-node-terminator-container.cc ├── oran-e2-node-terminator-container.h ├── oran-e2-node-terminator-lte-enb.cc ├── oran-e2-node-terminator-lte-enb.h ├── oran-e2-node-terminator-lte-ue.cc ├── oran-e2-node-terminator-lte-ue.h ├── oran-e2-node-terminator-wired.cc ├── oran-e2-node-terminator-wired.h ├── oran-e2-node-terminator.cc ├── oran-e2-node-terminator.h ├── oran-lm-lte-2-lte-distance-handover.cc ├── oran-lm-lte-2-lte-distance-handover.h ├── oran-lm-lte-2-lte-onnx-handover.cc ├── oran-lm-lte-2-lte-onnx-handover.h ├── oran-lm-lte-2-lte-rsrp-handover.cc ├── oran-lm-lte-2-lte-rsrp-handover.h ├── oran-lm-lte-2-lte-torch-handover.cc ├── oran-lm-lte-2-lte-torch-handover.h ├── oran-lm-noop.cc ├── oran-lm-noop.h ├── oran-lm.cc ├── oran-lm.h ├── oran-near-rt-ric-e2terminator.cc ├── oran-near-rt-ric-e2terminator.h ├── oran-near-rt-ric.cc ├── oran-near-rt-ric.h ├── oran-query-trigger-custom.cc ├── oran-query-trigger-custom.h ├── oran-query-trigger-noop.cc ├── oran-query-trigger-noop.h ├── oran-query-trigger.cc ├── oran-query-trigger.h ├── oran-report-apploss.cc ├── oran-report-apploss.h ├── oran-report-location.cc ├── oran-report-location.h ├── oran-report-lte-ue-cell-info.cc ├── oran-report-lte-ue-cell-info.h ├── oran-report-lte-ue-rsrp-rsrq.cc ├── oran-report-lte-ue-rsrp-rsrq.h ├── oran-report-trigger-location-change.cc ├── oran-report-trigger-location-change.h ├── oran-report-trigger-lte-ue-handover.cc ├── oran-report-trigger-lte-ue-handover.h ├── oran-report-trigger-periodic.cc ├── oran-report-trigger-periodic.h ├── oran-report-trigger.cc ├── oran-report-trigger.h ├── oran-report.cc ├── oran-report.h ├── oran-reporter-apploss.cc ├── oran-reporter-apploss.h ├── oran-reporter-location.cc ├── oran-reporter-location.h ├── oran-reporter-lte-ue-cell-info.cc ├── oran-reporter-lte-ue-cell-info.h ├── oran-reporter-lte-ue-rsrp-rsrq.cc ├── oran-reporter-lte-ue-rsrp-rsrq.h ├── oran-reporter.cc └── oran-reporter.h └── test └── oran-test-suite.cc /.gitignore: -------------------------------------------------------------------------------- 1 | *.diff 2 | *.orig 3 | *.patch 4 | *.rej 5 | 6 | *.o 7 | *.pyc 8 | *.pyo 9 | 10 | *.cwnd 11 | *.dat 12 | *.log 13 | *.mob 14 | *.pcap 15 | *.plt 16 | *.routes 17 | *.tr 18 | [D|U]l[A-Z][a-z]*Stats.txt 19 | 20 | \#*# 21 | ~* 22 | 23 | testpy-output 24 | 25 | bindings/python/pybindgen/ 26 | 27 | ms_print.* 28 | massif.* 29 | coverity 30 | TAGS 31 | 32 | .lock-waf_*_build 33 | .waf* 34 | 35 | build-dir/ 36 | build/ 37 | /.cproject 38 | /.project 39 | 40 | version.cache 41 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | See: https://www.nist.gov/open/copyright-fair-use-and-licensing-statements-srd-data-software-and-technical-series-publications#software 2 | for the latest version of this license 3 | 4 | NIST-developed software is provided by NIST as a public service. You may use, copy, and distribute copies of the 5 | software in any medium, provided that you keep intact this entire notice. You may improve, modify, and create derivative 6 | works of the software or any portion of the software, and you may copy and distribute such modifications or works. 7 | Modified works should carry a notice stating that you changed the software and should note the date and nature of any 8 | such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the 9 | software. 10 | 11 | NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR 12 | ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A 13 | PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE 14 | SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY 15 | REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, 16 | ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 17 | 18 | You are solely responsible for determining the appropriateness of using and distributing the software and you assume all 19 | risks associated with its use, including but not limited to the risks and costs of program errors, compliance with 20 | applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. 21 | This software is not intended to be used in any situation where a failure could cause risk of injury or damage to 22 | property. The software developed by NIST employees is not subject to copyright protection within the United States. 23 | -------------------------------------------------------------------------------- /THIRD_PARTY_LICENSES.md: -------------------------------------------------------------------------------- 1 | # Libtorch (Pytorch) 2 | From PyTorch: 3 | 4 | Copyright (c) 2016- Facebook, Inc (Adam Paszke) 5 | Copyright (c) 2014- Facebook, Inc (Soumith Chintala) 6 | Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) 7 | Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu) 8 | Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu) 9 | Copyright (c) 2011-2013 NYU (Clement Farabet) 10 | Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston) 11 | Copyright (c) 2006 Idiap Research Institute (Samy Bengio) 12 | Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz) 13 | 14 | From Caffe2: 15 | 16 | Copyright (c) 2016-present, Facebook Inc. All rights reserved. 17 | 18 | All contributions by Facebook: 19 | Copyright (c) 2016 Facebook Inc. 20 | 21 | All contributions by Google: 22 | Copyright (c) 2015 Google Inc. 23 | All rights reserved. 24 | 25 | All contributions by Yangqing Jia: 26 | Copyright (c) 2015 Yangqing Jia 27 | All rights reserved. 28 | 29 | All contributions by Kakao Brain: 30 | Copyright 2019-2020 Kakao Brain 31 | 32 | All contributions by Cruise LLC: 33 | Copyright (c) 2022 Cruise LLC. 34 | All rights reserved. 35 | 36 | All contributions from Caffe: 37 | Copyright(c) 2013, 2014, 2015, the respective contributors 38 | All rights reserved. 39 | 40 | All other contributions: 41 | Copyright(c) 2015, 2016 the respective contributors 42 | All rights reserved. 43 | 44 | Caffe2 uses a copyright model similar to Caffe: each contributor holds 45 | copyright over their contributions to Caffe2. The project versioning records 46 | all such contribution and copyright details. If a contributor wants to further 47 | mark their specific copyright on a particular contribution, they should 48 | indicate their copyright solely in the commit message of the change when it is 49 | committed. 50 | 51 | All rights reserved. 52 | 53 | Redistribution and use in source and binary forms, with or without 54 | modification, are permitted provided that the following conditions are met: 55 | 56 | 1. Redistributions of source code must retain the above copyright 57 | notice, this list of conditions and the following disclaimer. 58 | 59 | 2. Redistributions in binary form must reproduce the above copyright 60 | notice, this list of conditions and the following disclaimer in the 61 | documentation and/or other materials provided with the distribution. 62 | 63 | 3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America 64 | and IDIAP Research Institute nor the names of its contributors may be 65 | used to endorse or promote products derived from this software without 66 | specific prior written permission. 67 | 68 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 69 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 70 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 71 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 72 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 73 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 74 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 75 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 76 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 77 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 78 | POSSIBILITY OF SUCH DAMAGE. 79 | 80 | # ONNXRuntime 81 | MIT License 82 | 83 | Copyright (c) Microsoft Corporation 84 | 85 | Permission is hereby granted, free of charge, to any person obtaining a copy 86 | of this software and associated documentation files (the "Software"), to deal 87 | in the Software without restriction, including without limitation the rights 88 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 89 | copies of the Software, and to permit persons to whom the Software is 90 | furnished to do so, subject to the following conditions: 91 | 92 | The above copyright notice and this permission notice shall be included in all 93 | copies or substantial portions of the Software. 94 | 95 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 96 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 97 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 98 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 99 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 100 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 101 | SOFTWARE. 102 | -------------------------------------------------------------------------------- /doc/source/figures/information-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/information-class.png -------------------------------------------------------------------------------- /doc/source/figures/node-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/node-class.png -------------------------------------------------------------------------------- /doc/source/figures/node-design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/node-design.png -------------------------------------------------------------------------------- /doc/source/figures/oran-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/oran-class.png -------------------------------------------------------------------------------- /doc/source/figures/oran-design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/oran-design.png -------------------------------------------------------------------------------- /doc/source/figures/ric-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/ric-class.png -------------------------------------------------------------------------------- /doc/source/figures/ric-design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/ric-design.png -------------------------------------------------------------------------------- /doc/source/figures/seq-activation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/seq-activation.png -------------------------------------------------------------------------------- /doc/source/figures/seq-commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/seq-commands.png -------------------------------------------------------------------------------- /doc/source/figures/seq-logic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/seq-logic.png -------------------------------------------------------------------------------- /doc/source/figures/seq-report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/doc/source/figures/seq-report.png -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: true 2 | 3 | .. only:: html or latex 4 | 5 | ns-3 O-RAN module documentation 6 | =============================== 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | oran-description.rst 12 | oran-architecture.rst 13 | oran-usage.rst 14 | oran-examples-and-test.rst 15 | -------------------------------------------------------------------------------- /doc/source/oran-description.rst: -------------------------------------------------------------------------------- 1 | .. include:: replace.txt 2 | .. highlight:: cpp 3 | 4 | O-RAN Model Description 5 | ----------------------- 6 | 7 | The ``oran`` module for ns-3 implements the classes required to model a network architecture based on the `O-RAN`_ specifications. These models include a RAN Intelligent Controller (RIC) that is functionally equivalent to O-RAN's Near-Real Time (Near-RT) RIC, and reporting modules that attach to simulation nodes and serve as communication endpoints with the RIC in a similar fashion as the E2 Terminators in O-RAN. 8 | 9 | These models have been designed to provide the infrastructure and access to data so that developers and researchers can focus on implementing their solutions, and minimize the time and effort spent on handling interactions between models. With this in mind, all the components that contain logic that may be modified by end users have been modeled hierarchically (so that parent classes can take care of common actions and methods, and leave child models to focus on the logic itself), and at least one example is provided, to serve as reference for new models. 10 | 11 | The RIC model uses a data repository to store all the information exchanged between the RIC and the modules, as well as to serve as a logging endpoint. This release provides an `SQLite`_ storage backend for the data repository. The database file is accessible after the simulation and can be accessed by any SQLite-compatible tool and interface. 12 | 13 | Modeling of the reporting and communication models for the simulation nodes has been implemented using existing traces and methods, which means there is no need to modify the models provided by the ns-3 distribution to make use of the full capabilities of this module. 14 | 15 | 16 | 17 | Features 18 | ******** 19 | 20 | This release of the ``oran`` module contains the following features: 21 | 22 | - Near-RT RIC model, including: 23 | 24 | - Data access API independent of the data repository backend. 25 | - SQLite database repository implementation for Reports, Commands, and logging. 26 | - Support for Logic Modules that serve as O-RAN's ``xApps``. 27 | - Separation of Logic Modules into ``default`` (only one, mandatory) and ``additional`` (zero to many, optional). 28 | - Support for addition and removal of Logic Modules during the simulation. 29 | - Conflict Mitigation API. 30 | - Logic Module and Conflict Mitigation logic logging to the data repository. 31 | - Periodic or report-triggered invocation of the Logic Module's algorithms. 32 | - Simulated processing delay for each Logic Module. 33 | - Integration with `ONNX Runtime`_ and `PyTorch`_ to support Machine Learning (ML) 34 | 35 | - Periodic reporting of metrics from the simulation nodes to the Near-RT RIC. 36 | - Periodic or event-triggered generation of reports. 37 | - Reporting capabilities for node location (any simulation node) and LTE cell attachment (LTE UE nodes). 38 | - Generation and execution of LTE-to-LTE handover Commands. 39 | - Activation and deactivation for individual components and RIC. 40 | - Simulated transmission delay between the E2 Nodes and the Near-RT RIC. 41 | - E2 Node Keep-Alive mechanism. 42 | 43 | 44 | .. _O-RAN: https://www.o-ran.org/ 45 | .. _Sqlite: https://www.sqlite.org 46 | .. _ONNX Runtime: https://onnxruntime.ai/ 47 | .. _PyTorch: https://pytorch.org/ 48 | -------------------------------------------------------------------------------- /doc/source/oran.rst: -------------------------------------------------------------------------------- 1 | O-RAN Module Documentation 2 | ========================== 3 | 4 | .. toctree:: 5 | 6 | oran-description.rst 7 | oran-architecture.rst 8 | oran-usage.rst 9 | oran-examples-and-test.rst 10 | -------------------------------------------------------------------------------- /doc/source/replace.txt: -------------------------------------------------------------------------------- 1 | .. |ns3| replace:: *ns-3* 2 | 3 | .. |ns2| replace:: *ns-2* 4 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # NIST-developed software is provided by NIST as a public service. You may use, 2 | # copy and distribute copies of the software in any medium, provided that you 3 | # keep intact this entire notice. You may improve,modify and create derivative 4 | # works of the software or any portion of the software, and you may copy and 5 | # distribute such modifications or works. Modified works should carry a notice 6 | # stating that you changed the software and should note the date and nature of 7 | # any such change. Please explicitly acknowledge the National Institute of 8 | # Standards and Technology as the source of the software. 9 | # 10 | # NIST-developed software is expressly provided "AS IS." NIST MAKES NO 11 | # WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 12 | # LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 13 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 14 | # AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE 15 | # OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT 16 | # ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY 17 | # REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, 18 | # INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, 19 | # OR USEFULNESS OF THE SOFTWARE. 20 | # 21 | # You are solely responsible for determining the appropriateness of using and 22 | # distributing the software and you assume all risks associated with its use, 23 | # including but not limited to the risks and costs of program errors, 24 | # compliance with applicable laws, damage to or loss of data, programs or 25 | # equipment, and the unavailability or interruption of operation. This 26 | # software is not intended to be used in any situation where a failure could 27 | # cause risk of injury or damage to property. The software developed by NIST 28 | # employees is not subject to copyright protection within the United States. 29 | 30 | build_lib_example( 31 | NAME oran-data-repository-example 32 | SOURCE_FILES oran-data-repository-example.cc 33 | LIBRARIES_TO_LINK 34 | ${liboran} 35 | ) 36 | 37 | build_lib_example( 38 | NAME oran-keep-alive-example 39 | SOURCE_FILES oran-keep-alive-example.cc 40 | LIBRARIES_TO_LINK 41 | ${liboran} 42 | ${libmobility} 43 | ) 44 | 45 | build_lib_example( 46 | NAME oran-lte-2-lte-distance-handover-example 47 | SOURCE_FILES oran-lte-2-lte-distance-handover-example.cc 48 | LIBRARIES_TO_LINK 49 | ${liboran} 50 | ${libnetwork} 51 | ${liblte} 52 | ${libmobility} 53 | ) 54 | 55 | build_lib_example( 56 | NAME oran-lte-2-lte-distance-handover-helper-example 57 | SOURCE_FILES oran-lte-2-lte-distance-handover-helper-example.cc 58 | LIBRARIES_TO_LINK 59 | ${liboran} 60 | ${libnetwork} 61 | ${liblte} 62 | ${libmobility} 63 | ) 64 | 65 | build_lib_example( 66 | NAME oran-lte-2-lte-distance-handover-lm-processing-delay-example 67 | SOURCE_FILES oran-lte-2-lte-distance-handover-lm-processing-delay-example.cc 68 | LIBRARIES_TO_LINK 69 | ${liboran} 70 | ${libnetwork} 71 | ${liblte} 72 | ${libmobility} 73 | ) 74 | 75 | build_lib_example( 76 | NAME oran-lte-2-lte-distance-handover-lm-query-trigger-example 77 | SOURCE_FILES oran-lte-2-lte-distance-handover-lm-query-trigger-example.cc 78 | LIBRARIES_TO_LINK 79 | ${liboran} 80 | ${libnetwork} 81 | ${liblte} 82 | ${libmobility} 83 | ) 84 | 85 | build_lib_example( 86 | NAME oran-random-walk-example 87 | SOURCE_FILES oran-random-walk-example.cc 88 | LIBRARIES_TO_LINK 89 | ${liboran} 90 | ${libmobility} 91 | ) 92 | 93 | build_lib_example( 94 | NAME oran-multiple-net-devices-example 95 | SOURCE_FILES oran-multiple-net-devices-example.cc 96 | LIBRARIES_TO_LINK 97 | ${liboran} 98 | ${libmobility} 99 | ${libnetwork} 100 | ${liblte} 101 | ) 102 | 103 | build_lib_example( 104 | NAME oran-lte-2-lte-ml-handover-example 105 | SOURCE_FILES oran-lte-2-lte-ml-handover-example.cc 106 | LIBRARIES_TO_LINK 107 | ${liboran} 108 | ${libnetwork} 109 | ${liblte} 110 | ${libmobility} 111 | ) 112 | 113 | build_lib_example( 114 | NAME oran-lte-2-lte-rsrp-handover-lm-example 115 | SOURCE_FILES oran-lte-2-lte-rsrp-handover-lm-example.cc 116 | LIBRARIES_TO_LINK 117 | ${liboran} 118 | ${libnetwork} 119 | ${liblte} 120 | ${libmobility} 121 | ) 122 | 123 | -------------------------------------------------------------------------------- /examples/saved_trained_classification_pytorch.onnx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/examples/saved_trained_classification_pytorch.onnx -------------------------------------------------------------------------------- /examples/saved_trained_classification_pytorch.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/ns3-oran/d78da638bd85bc90256cddf927a7a9861c936a3b/examples/saved_trained_classification_pytorch.pt -------------------------------------------------------------------------------- /model/oran-cmm-handover.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-cmm-handover.h" 32 | 33 | #include "oran-command.h" 34 | #include "oran-data-repository.h" 35 | #include "oran-near-rt-ric.h" 36 | 37 | #include "ns3/abort.h" 38 | #include "ns3/log.h" 39 | #include "ns3/simulator.h" 40 | 41 | namespace ns3 42 | { 43 | 44 | NS_LOG_COMPONENT_DEFINE("OranCmmHandover"); 45 | 46 | NS_OBJECT_ENSURE_REGISTERED(OranCmmHandover); 47 | 48 | TypeId 49 | OranCmmHandover::GetTypeId() 50 | { 51 | static TypeId tid = 52 | TypeId("ns3::OranCmmHandover").SetParent().AddConstructor(); 53 | 54 | return tid; 55 | } 56 | 57 | OranCmmHandover::OranCmmHandover() 58 | : OranCmm() 59 | { 60 | NS_LOG_FUNCTION(this); 61 | 62 | m_name = "CmmHandover"; 63 | } 64 | 65 | OranCmmHandover::~OranCmmHandover() 66 | { 67 | NS_LOG_FUNCTION(this); 68 | } 69 | 70 | void 71 | OranCmmHandover::DoDispose() 72 | { 73 | NS_LOG_FUNCTION(this); 74 | 75 | m_nearRtRic = nullptr; 76 | 77 | Object::DoDispose(); 78 | } 79 | 80 | std::vector> 81 | OranCmmHandover::Filter( 82 | std::map, std::vector>> inputCommands) 83 | { 84 | NS_LOG_FUNCTION(this); 85 | 86 | // Do nothing and return a vector with all the commands 87 | // As we do nothing, there is no need to check if the CMM 88 | // is active or not. 89 | // We check if the pointer to the Near-RT RIC has been set, 90 | // though, as not having that one should be a configuration 91 | // problem (and may be a symptom of other issues) 92 | NS_ABORT_MSG_IF(m_nearRtRic == nullptr, 93 | "Attempting to run Conflict Mitigation Module with NULL Near-RT RIC"); 94 | 95 | std::vector> commands; 96 | for (auto commandSet : inputCommands) 97 | { 98 | for (auto cmd : commandSet.second) 99 | { 100 | Ptr handoverCmd = 101 | cmd->GetObject(); 102 | if (handoverCmd != nullptr) 103 | { 104 | bool found = false; 105 | for (auto pendingCmd : m_pendingCmds) 106 | { 107 | if (pendingCmd->GetTargetE2NodeId() == handoverCmd->GetTargetE2NodeId() && 108 | pendingCmd->GetTargetCellId() == handoverCmd->GetTargetCellId() && 109 | pendingCmd->GetTargetRnti() == handoverCmd->GetTargetRnti()) 110 | { 111 | found = true; 112 | } 113 | } 114 | if (!found) 115 | { 116 | commands.push_back(handoverCmd); 117 | m_pendingCmds.push_back(handoverCmd); 118 | } 119 | else 120 | { 121 | LogLogicToStorage("Excluding a pending command: " + cmd->ToString()); 122 | } 123 | } 124 | else 125 | { 126 | commands.push_back(cmd); 127 | } 128 | } 129 | } 130 | 131 | return commands; 132 | } 133 | 134 | } // namespace ns3 135 | -------------------------------------------------------------------------------- /model/oran-cmm-handover.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_CMM_HANDOVER_H 32 | #define ORAN_CMM_HANDOVER_H 33 | 34 | #include "oran-cmm.h" 35 | #include "oran-command-lte-2-lte-handover.h" 36 | 37 | namespace ns3 38 | { 39 | 40 | class OranCommand; 41 | 42 | /** 43 | * @ingroup oran 44 | * 45 | * An ORAN conflict mitigation module 46 | */ 47 | class OranCmmHandover : public OranCmm 48 | { 49 | public: 50 | /** 51 | * Gets the TypeId of the OranCmmHandover class. 52 | * 53 | * @return The TypeId 54 | */ 55 | static TypeId GetTypeId(); 56 | /** 57 | * Creates an instance of the OranCmmHandover class. 58 | */ 59 | OranCmmHandover(); 60 | /** 61 | * The destructor of the OranCmmHandover class. 62 | */ 63 | ~OranCmmHandover() override; 64 | /** 65 | * Prompts this conflict mitigation module to execute its logic 66 | * and filter the input commands. This is a No Operation module, 67 | * so the input set of commands will be returned without filtering 68 | * 69 | * @param inputCommands A map with the input commands generated by all the LMs 70 | * @return A vector with the commands filtered by this module 71 | */ 72 | std::vector> Filter( 73 | std::map, std::vector>> inputCommands) 74 | override; 75 | 76 | protected: 77 | /** 78 | * Disposes of the object. 79 | */ 80 | void DoDispose() override; 81 | 82 | private: 83 | /** 84 | * Keep track of pending handover commands. 85 | */ 86 | std::vector> m_pendingCmds; 87 | 88 | }; // class OranCmmHandover 89 | 90 | } // namespace ns3 91 | 92 | #endif // ORAN_CMM_HANDOVER_H 93 | -------------------------------------------------------------------------------- /model/oran-cmm-noop.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-cmm-noop.h" 32 | 33 | #include "oran-command.h" 34 | #include "oran-near-rt-ric.h" 35 | 36 | #include "ns3/abort.h" 37 | #include "ns3/log.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | NS_LOG_COMPONENT_DEFINE("OranCmmNoop"); 43 | 44 | NS_OBJECT_ENSURE_REGISTERED(OranCmmNoop); 45 | 46 | TypeId 47 | OranCmmNoop::GetTypeId() 48 | { 49 | static TypeId tid = 50 | TypeId("ns3::OranCmmNoop").SetParent().AddConstructor(); 51 | 52 | return tid; 53 | } 54 | 55 | OranCmmNoop::OranCmmNoop() 56 | : OranCmm() 57 | { 58 | NS_LOG_FUNCTION(this); 59 | 60 | m_name = "CmmNoop"; 61 | } 62 | 63 | OranCmmNoop::~OranCmmNoop() 64 | { 65 | NS_LOG_FUNCTION(this); 66 | } 67 | 68 | void 69 | OranCmmNoop::DoDispose() 70 | { 71 | NS_LOG_FUNCTION(this); 72 | 73 | OranCmm::DoDispose(); 74 | } 75 | 76 | std::vector> 77 | OranCmmNoop::Filter( 78 | std::map, std::vector>> inputCommands) 79 | { 80 | NS_LOG_FUNCTION(this); 81 | 82 | // Do nothing and return a vector with all the commands 83 | // As we do nothing, there is no need to check if the CMM 84 | // is active or not. 85 | // We check if the pointer to the Near-RT RIC has been set, 86 | // though, as not having that one should be a configuration 87 | // problem (and may be a symptom of other issues) 88 | NS_ABORT_MSG_IF(m_nearRtRic == nullptr, 89 | "Attempting to run Conflict Mitigation Module with NULL Near-RT RIC"); 90 | 91 | LogLogicToStorage("No action taken"); 92 | 93 | std::vector> commands; 94 | for (auto commandSet : inputCommands) 95 | { 96 | commands.insert(commands.end(), commandSet.second.begin(), commandSet.second.end()); 97 | } 98 | 99 | return commands; 100 | } 101 | 102 | } // namespace ns3 103 | -------------------------------------------------------------------------------- /model/oran-cmm-noop.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_CMM_NOOP_H 32 | #define ORAN_CMM_NOOP_H 33 | 34 | #include "oran-cmm.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | class OranCommand; 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * A Conflict Mitigation Module that does nothing. This implementation 45 | * is useful for the cases when we are not interested in having a 46 | * Conflict Mitigation Logic, as the Near-RT RIC must have a CMM instance 47 | * configured. 48 | */ 49 | class OranCmmNoop : public OranCmm 50 | { 51 | public: 52 | /** 53 | * Gets the TypeId of the OranCmmNoop class. 54 | * 55 | * @return The TypeId. 56 | */ 57 | static TypeId GetTypeId(); 58 | /** 59 | * Creates an instance of the OranCmmNoop class. 60 | */ 61 | OranCmmNoop(); 62 | /** 63 | * The destructor of the OranCmmNoop class. 64 | */ 65 | ~OranCmmNoop() override; 66 | /** 67 | * Prompts this Conflict Mitigation Module to execute its logic 68 | * and filter the input commands. This is a No Operation module, 69 | * so the input set of commands will be returned without filtering. 70 | * 71 | * @param inputCommands A map with the input commands generated by all the LMs. 72 | * 73 | * @return A vector with the commands filtered by this module. 74 | */ 75 | std::vector> Filter( 76 | std::map, std::vector>> inputCommands) 77 | override; 78 | 79 | protected: 80 | void DoDispose() override; 81 | }; // class OranCmmNoop 82 | 83 | } // namespace ns3 84 | 85 | #endif // ORAN_CMM_NOOP_H 86 | -------------------------------------------------------------------------------- /model/oran-cmm-single-command-per-node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_CMM_SINGLECOMMANDPERNODE_H 32 | #define ORAN_CMM_SINGLECOMMANDPERNODE_H 33 | 34 | #include "oran-cmm.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | class OranCommand; 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * A Conflict Mitigation Module that tries to ensure that no two commands 45 | * issued in a batch affect the same E2 Node. The meaning of "node affected by 46 | * a command" changes depending on the command. For example, an 47 | * OranCommandLte2LteHandover has the target E2 Node ID of the eNB where the UE 48 | * being handovered is attached, but for the purpose of this CMM, the affected 49 | * node is assumed to be the UE. 50 | */ 51 | class OranCmmSingleCommandPerNode : public OranCmm 52 | { 53 | public: 54 | /** 55 | * Gets the TypeId of the OranCmmSingleCommandPerNode class. 56 | * 57 | * @return The TypeId. 58 | */ 59 | static TypeId GetTypeId(); 60 | /** 61 | * Creates an instance of the OranCmmSingleCommandPerNode class. 62 | */ 63 | OranCmmSingleCommandPerNode(); 64 | /** 65 | * The destructor of the OranCmmSingleCommandPerNode class. 66 | */ 67 | ~OranCmmSingleCommandPerNode() override; 68 | /** 69 | * Prompts this Conflict Mitigation Module to execute its logic 70 | * and filter the input commands. This module makes sure only one 71 | * command in each batch affects an E2 node. Note that the E2 node 72 | * affected may not be the target E2 node (e.g. with a handover command 73 | * the affected E2 node is the UE being handovered, but the target E2 74 | * node is the current serving eNB). 75 | * 76 | * In case there are multiple commands affecting the same E2 node, the one issued 77 | * by the default LM takes precedence. If both (or none of the) commands are being 78 | * issued by the default LM, the first one processed takes precedence. 79 | * 80 | * @param inputCommands A map with the input commands generated by all the LMs. 81 | * 82 | * @return A vector with the commands that passed the filter. 83 | */ 84 | std::vector> Filter( 85 | std::map, std::vector>> inputCommands) 86 | override; 87 | 88 | protected: 89 | void DoDispose() override; 90 | }; // class OranCmmSingleCommandPerNode 91 | 92 | } // namespace ns3 93 | 94 | #endif // ORAN_CMM_SINGLECOMMANDPERNODE_H 95 | -------------------------------------------------------------------------------- /model/oran-cmm.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-cmm.h" 32 | 33 | #include "oran-command.h" 34 | #include "oran-data-repository.h" 35 | #include "oran-near-rt-ric.h" 36 | 37 | #include "ns3/abort.h" 38 | #include "ns3/boolean.h" 39 | #include "ns3/log.h" 40 | #include "ns3/pointer.h" 41 | #include "ns3/simulator.h" 42 | 43 | namespace ns3 44 | { 45 | 46 | NS_LOG_COMPONENT_DEFINE("OranCmm"); 47 | 48 | NS_OBJECT_ENSURE_REGISTERED(OranCmm); 49 | 50 | TypeId 51 | OranCmm::GetTypeId() 52 | { 53 | static TypeId tid = 54 | TypeId("ns3::OranCmm") 55 | .SetParent() 56 | .AddAttribute("NearRtRic", 57 | "The near RT RIC.", 58 | PointerValue(nullptr), 59 | MakePointerAccessor(&OranCmm::m_nearRtRic), 60 | MakePointerChecker()) 61 | .AddAttribute("Verbose", 62 | "Flag to indicate if logic should be logged to the data storage", 63 | BooleanValue(false), 64 | MakeBooleanAccessor(&OranCmm::m_verbose), 65 | MakeBooleanChecker()); 66 | 67 | return tid; 68 | } 69 | 70 | OranCmm::OranCmm() 71 | : m_active(false), 72 | m_name("Cmm") 73 | { 74 | NS_LOG_FUNCTION(this); 75 | } 76 | 77 | OranCmm::~OranCmm() 78 | { 79 | NS_LOG_FUNCTION(this); 80 | } 81 | 82 | void 83 | OranCmm::Activate() 84 | { 85 | NS_LOG_FUNCTION(this); 86 | 87 | NS_ABORT_MSG_IF(m_nearRtRic == nullptr, "Attempting to activate LM with NULL Near-RT RIC"); 88 | 89 | m_active = true; 90 | } 91 | 92 | void 93 | OranCmm::Deactivate() 94 | { 95 | NS_LOG_FUNCTION(this); 96 | 97 | m_active = false; 98 | } 99 | 100 | bool 101 | OranCmm::IsActive() const 102 | { 103 | NS_LOG_FUNCTION(this); 104 | 105 | return m_active; 106 | } 107 | 108 | std::string 109 | OranCmm::GetName() const 110 | { 111 | NS_LOG_FUNCTION(this); 112 | 113 | return m_name; 114 | } 115 | 116 | void 117 | OranCmm::SetName(const std::string& name) 118 | { 119 | NS_LOG_FUNCTION(this << name); 120 | 121 | m_name = name; 122 | } 123 | 124 | void 125 | OranCmm::DoDispose() 126 | { 127 | NS_LOG_FUNCTION(this); 128 | 129 | m_nearRtRic = nullptr; 130 | 131 | Object::DoDispose(); 132 | } 133 | 134 | void 135 | OranCmm::LogLogicToStorage(const std::string& msg) const 136 | { 137 | NS_LOG_FUNCTION(this << msg); 138 | 139 | NS_ABORT_MSG_IF(m_nearRtRic == nullptr, "Attempting to log CMM logic with NULL Near-RT RIC"); 140 | 141 | if (m_verbose) 142 | { 143 | m_nearRtRic->Data()->LogActionCmm(m_name, 144 | std::to_string(Simulator::Now().GetSeconds()) + " -- " + 145 | m_name + " -- " + msg); 146 | } 147 | } 148 | 149 | } // namespace ns3 150 | -------------------------------------------------------------------------------- /model/oran-command-lte-2-lte-handover.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-command-lte-2-lte-handover.h" 32 | 33 | #include "ns3/log.h" 34 | #include "ns3/uinteger.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | NS_LOG_COMPONENT_DEFINE("OranCommandLte2LteHandover"); 40 | 41 | NS_OBJECT_ENSURE_REGISTERED(OranCommandLte2LteHandover); 42 | 43 | TypeId 44 | OranCommandLte2LteHandover::GetTypeId() 45 | { 46 | static TypeId tid = 47 | TypeId("ns3::OranCommandLte2LteHandover") 48 | .SetParent() 49 | .AddConstructor() 50 | .AddAttribute("TargetCellId", 51 | "The ID of the LTE cell to handover to.", 52 | UintegerValue(0), 53 | MakeUintegerAccessor(&OranCommandLte2LteHandover::m_targetCellId), 54 | MakeUintegerChecker()) 55 | .AddAttribute("TargetRnti", 56 | "The current RNTI of the UE to handover.", 57 | UintegerValue(0), 58 | MakeUintegerAccessor(&OranCommandLte2LteHandover::m_targetRnti), 59 | MakeUintegerChecker()); 60 | 61 | return tid; 62 | } 63 | 64 | OranCommandLte2LteHandover::OranCommandLte2LteHandover() 65 | : OranCommand() 66 | { 67 | NS_LOG_FUNCTION(this); 68 | } 69 | 70 | OranCommandLte2LteHandover::~OranCommandLte2LteHandover() 71 | { 72 | NS_LOG_FUNCTION(this); 73 | } 74 | 75 | std::string 76 | OranCommandLte2LteHandover::ToString() const 77 | { 78 | NS_LOG_FUNCTION(this); 79 | 80 | std::stringstream ss; 81 | 82 | ss << "OranCommandLte2LteHandover(" 83 | << "TargetE2NodeId = " << GetTargetE2NodeId() << "; TargetCellId = " << m_targetCellId 84 | << "; TargetRnti = " << m_targetRnti << ")"; 85 | 86 | return ss.str(); 87 | } 88 | 89 | uint16_t 90 | OranCommandLte2LteHandover::GetTargetCellId() const 91 | { 92 | NS_LOG_FUNCTION(this); 93 | 94 | return m_targetCellId; 95 | } 96 | 97 | uint16_t 98 | OranCommandLte2LteHandover::GetTargetRnti() const 99 | { 100 | NS_LOG_FUNCTION(this); 101 | 102 | return m_targetRnti; 103 | } 104 | 105 | } // namespace ns3 106 | -------------------------------------------------------------------------------- /model/oran-command-lte-2-lte-handover.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_COMMAND_LTE_2_LTE_HANDOVER_H 32 | #define ORAN_COMMAND_LTE_2_LTE_HANDOVER_H 33 | 34 | #include "oran-command.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | /** 40 | * @ingroup oran 41 | * A Command instructing an LTE eNB to handover a UE to another LTE eNB. 42 | * In this command the Target E2 Node ID is the serving LTE eNB, and the command 43 | * contains the cell ID of the eNB to handover to, and the RNTI of the UE to be 44 | * handoverd. 45 | */ 46 | class OranCommandLte2LteHandover : public OranCommand 47 | { 48 | public: 49 | /** 50 | * Gets the TypeId of the OranCommandLte2LteHandover class. 51 | * 52 | * @return The TypeId. 53 | */ 54 | static TypeId GetTypeId(); 55 | /** 56 | * Creates an instance of the OranCommandLte2LteHandover class. 57 | */ 58 | OranCommandLte2LteHandover(); 59 | /** 60 | * The destructor of the OranCommandLte2LteHandover class. 61 | */ 62 | ~OranCommandLte2LteHandover() override; 63 | 64 | std::string ToString() const override; 65 | 66 | private: 67 | /** 68 | * The ID of the cell to handover to. 69 | */ 70 | uint16_t m_targetCellId; 71 | /** 72 | * The RNTI of the UE to handover. 73 | */ 74 | uint16_t m_targetRnti; 75 | 76 | public: 77 | /** 78 | * Gets the ID of the cell to handover to. 79 | * 80 | * @returns The cell ID. 81 | */ 82 | uint16_t GetTargetCellId() const; 83 | /** 84 | * Gets the RNTI of the UE to handover. 85 | * 86 | * @returns The RNTI. 87 | */ 88 | uint16_t GetTargetRnti() const; 89 | }; // class OranCommandLte2LteHandover 90 | 91 | } // namespace ns3 92 | 93 | #endif /* ORAN_COMMAND_LTE_2_LTE_HANDOVER_H */ 94 | -------------------------------------------------------------------------------- /model/oran-command.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-command.h" 32 | 33 | #include "ns3/log.h" 34 | #include "ns3/uinteger.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | NS_LOG_COMPONENT_DEFINE("OranCommand"); 40 | 41 | NS_OBJECT_ENSURE_REGISTERED(OranCommand); 42 | 43 | TypeId 44 | OranCommand::GetTypeId() 45 | { 46 | static TypeId tid = TypeId("ns3::OranCommand") 47 | .SetParent() 48 | .AddConstructor() 49 | .AddAttribute("TargetE2NodeId", 50 | "The E2 Node ID of the recipient of this command", 51 | UintegerValue(0), 52 | MakeUintegerAccessor(&OranCommand::m_targetE2NodeId), 53 | MakeUintegerChecker()); 54 | 55 | return tid; 56 | } 57 | 58 | OranCommand::OranCommand() 59 | : Object() 60 | { 61 | NS_LOG_FUNCTION(this); 62 | } 63 | 64 | OranCommand::~OranCommand() 65 | { 66 | NS_LOG_FUNCTION(this); 67 | } 68 | 69 | std::string 70 | OranCommand::ToString() const 71 | { 72 | NS_LOG_FUNCTION(this); 73 | 74 | return "Parent OranCommand. Should not be used"; 75 | } 76 | 77 | uint64_t 78 | OranCommand::GetTargetE2NodeId() const 79 | { 80 | NS_LOG_FUNCTION(this); 81 | 82 | return m_targetE2NodeId; 83 | } 84 | 85 | } // namespace ns3 86 | -------------------------------------------------------------------------------- /model/oran-command.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_COMMAND_H 32 | #define ORAN_COMMAND_H 33 | 34 | #include "ns3/object.h" 35 | 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * Base class of a Command. This class provides the implementation of 45 | * the GetTargetE2NodeId method for all the Commands. This base class can 46 | * be instantiated, but the Command issued lacks any meaning and will be 47 | * silently ignored by the E2 Node Terminators. 48 | */ 49 | class OranCommand : public Object 50 | { 51 | public: 52 | /** 53 | * Gets the TypeId of the OranCommand class. 54 | * 55 | * @return The TypeId. 56 | */ 57 | static TypeId GetTypeId(); 58 | /** 59 | * Creates an instance of the OranCommand class. 60 | */ 61 | OranCommand(); 62 | /** 63 | * The destructor of the OranCommand class. 64 | */ 65 | ~OranCommand() override; 66 | /** 67 | * Get a string representation of this command. 68 | * 69 | * @return A string representation of this command. 70 | */ 71 | virtual std::string ToString() const; 72 | /** 73 | * Get the target E2 Node ID. 74 | * 75 | * @return The target E2 Node Id. 76 | */ 77 | uint64_t GetTargetE2NodeId() const; 78 | 79 | private: 80 | /** 81 | * The target E2 Node Id 82 | */ 83 | uint64_t m_targetE2NodeId; 84 | }; // class OranCommand 85 | 86 | } // namespace ns3 87 | 88 | #endif /* ORAN_COMMAND_H */ 89 | -------------------------------------------------------------------------------- /model/oran-data-repository.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-data-repository.h" 32 | 33 | #include "ns3/log.h" 34 | 35 | namespace ns3 36 | { 37 | 38 | NS_LOG_COMPONENT_DEFINE("OranDataRepository"); 39 | 40 | NS_OBJECT_ENSURE_REGISTERED(OranDataRepository); 41 | 42 | TypeId 43 | OranDataRepository::GetTypeId() 44 | { 45 | static TypeId tid = TypeId("ns3::OranDataRepository").SetParent(); 46 | 47 | return tid; 48 | } 49 | 50 | OranDataRepository::OranDataRepository() 51 | : Object(), 52 | m_active(false) 53 | { 54 | NS_LOG_FUNCTION(this); 55 | } 56 | 57 | OranDataRepository::~OranDataRepository() 58 | { 59 | NS_LOG_FUNCTION(this); 60 | } 61 | 62 | void 63 | OranDataRepository::Activate() 64 | { 65 | NS_LOG_FUNCTION(this); 66 | 67 | m_active = true; 68 | } 69 | 70 | void 71 | OranDataRepository::Deactivate() 72 | { 73 | NS_LOG_FUNCTION(this); 74 | 75 | m_active = false; 76 | } 77 | 78 | bool 79 | OranDataRepository::IsActive() const 80 | { 81 | NS_LOG_FUNCTION(this); 82 | 83 | return m_active; 84 | } 85 | 86 | void 87 | OranDataRepository::DoDispose() 88 | { 89 | NS_LOG_FUNCTION(this); 90 | 91 | Object::DoDispose(); 92 | } 93 | 94 | } // namespace ns3 95 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-container.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-e2-node-terminator-container.h" 32 | 33 | namespace ns3 34 | { 35 | 36 | void 37 | OranE2NodeTerminatorContainer::Activate() 38 | { 39 | for (auto terminator : m_e2NodeTerminators) 40 | { 41 | terminator->Activate(); 42 | } 43 | } 44 | 45 | OranE2NodeTerminatorContainer::Iterator 46 | OranE2NodeTerminatorContainer::Begin() const 47 | { 48 | return m_e2NodeTerminators.begin(); 49 | } 50 | 51 | void 52 | OranE2NodeTerminatorContainer::Deactivate() 53 | { 54 | for (auto terminator : m_e2NodeTerminators) 55 | { 56 | terminator->Deactivate(); 57 | } 58 | } 59 | 60 | OranE2NodeTerminatorContainer::Iterator 61 | OranE2NodeTerminatorContainer::End() const 62 | { 63 | return m_e2NodeTerminators.end(); 64 | } 65 | 66 | uint32_t 67 | OranE2NodeTerminatorContainer::GetN() const 68 | { 69 | return m_e2NodeTerminators.size(); 70 | } 71 | 72 | Ptr 73 | OranE2NodeTerminatorContainer::Get(uint32_t i) const 74 | { 75 | return m_e2NodeTerminators[i]; 76 | } 77 | 78 | void 79 | OranE2NodeTerminatorContainer::Add(OranE2NodeTerminatorContainer other) 80 | { 81 | for (auto it = other.Begin(); it != other.End(); it++) 82 | { 83 | Add(*it); 84 | } 85 | } 86 | 87 | void 88 | OranE2NodeTerminatorContainer::Add(Ptr e2NodeTerminator) 89 | { 90 | m_e2NodeTerminators.push_back(e2NodeTerminator); 91 | } 92 | 93 | } // namespace ns3 94 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-container.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_E2_NODE_TERMINATOR_CONTAINER_H 32 | #define ORAN_E2_NODE_TERMINATOR_CONTAINER_H 33 | 34 | #include "oran-e2-node-terminator.h" 35 | 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * A Container for E2 Node Terminator. This Container allows the Activation and 45 | * Deactivation of all Terminators in it at once. 46 | */ 47 | class OranE2NodeTerminatorContainer 48 | { 49 | public: 50 | /** 51 | * Declaration of container iterator. 52 | */ 53 | typedef std::vector>::const_iterator Iterator; 54 | /** 55 | * Constructor of the ORanE2NodeTerminatorContainer. 56 | */ 57 | OranE2NodeTerminatorContainer() = default; 58 | /** 59 | * Destructor of the OranE2NodeTerminatorContainer. 60 | */ 61 | virtual ~OranE2NodeTerminatorContainer() = default; 62 | /** 63 | * Activate all of the E2 Node Terminators in the container. 64 | */ 65 | void Activate(); 66 | /** 67 | * Get an iterator referencing the first element. 68 | * 69 | * @return The iterator. 70 | */ 71 | Iterator Begin() const; 72 | /** 73 | * Deactivate all of the E2 Node Terminators in the container. 74 | */ 75 | void Deactivate(); 76 | /** 77 | * Get an iterator referencing the last element. 78 | * 79 | * @return The iterator. 80 | */ 81 | Iterator End() const; 82 | /** 83 | * Get the number of elements in the container. 84 | * 85 | * @return The number of elements. 86 | */ 87 | uint32_t GetN() const; 88 | /** 89 | * Get an element from the container. 90 | * 91 | * @param i The index of the element to return. 92 | * 93 | * @return The element. 94 | */ 95 | Ptr Get(uint32_t i) const; 96 | /** 97 | * Add the elements of another container to this container. 98 | * 99 | * @param other The other container. 100 | */ 101 | void Add(OranE2NodeTerminatorContainer other); 102 | /** 103 | * Add an element to this container. 104 | * 105 | * @param e2NodeTerminator The element to add. 106 | */ 107 | void Add(Ptr e2NodeTerminator); 108 | 109 | private: 110 | /** 111 | * The underlying container. 112 | */ 113 | std::vector> m_e2NodeTerminators; 114 | }; // class OranE2NodeTerminatorContainer 115 | 116 | } // namespace ns3 117 | 118 | #endif // ORAN_E2_NODE_TERMINATOR_CONTAINER_H 119 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-lte-enb.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-e2-node-terminator-lte-enb.h" 32 | 33 | #include "oran-command-lte-2-lte-handover.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/log.h" 37 | #include "ns3/lte-enb-net-device.h" 38 | #include "ns3/lte-enb-rrc.h" 39 | #include "ns3/node.h" 40 | #include "ns3/pointer.h" 41 | #include "ns3/string.h" 42 | 43 | namespace ns3 44 | { 45 | 46 | NS_LOG_COMPONENT_DEFINE("OranE2NodeTerminatorLteEnb"); 47 | 48 | NS_OBJECT_ENSURE_REGISTERED(OranE2NodeTerminatorLteEnb); 49 | 50 | TypeId 51 | OranE2NodeTerminatorLteEnb::GetTypeId() 52 | { 53 | static TypeId tid = TypeId("ns3::OranE2NodeTerminatorLteEnb") 54 | .SetParent() 55 | .AddConstructor(); 56 | 57 | return tid; 58 | } 59 | 60 | OranE2NodeTerminatorLteEnb::OranE2NodeTerminatorLteEnb() 61 | : OranE2NodeTerminator() 62 | { 63 | NS_LOG_FUNCTION(this); 64 | } 65 | 66 | OranE2NodeTerminatorLteEnb::~OranE2NodeTerminatorLteEnb() 67 | { 68 | NS_LOG_FUNCTION(this); 69 | } 70 | 71 | OranNearRtRic::NodeType 72 | OranE2NodeTerminatorLteEnb::GetNodeType() const 73 | { 74 | NS_LOG_FUNCTION(this); 75 | 76 | return OranNearRtRic::NodeType::LTEENB; 77 | } 78 | 79 | void 80 | OranE2NodeTerminatorLteEnb::ReceiveCommand(Ptr command) 81 | { 82 | NS_LOG_FUNCTION(this << command); 83 | 84 | if (m_active) 85 | { 86 | if (command->GetInstanceTypeId() == OranCommandLte2LteHandover::GetTypeId()) 87 | { 88 | Ptr node = GetNode(); 89 | Ptr handoverCommand = 90 | command->GetObject(); 91 | 92 | Ptr lteEnbRrc = GetNetDevice()->GetRrc(); 93 | lteEnbRrc->SendHandoverRequest(handoverCommand->GetTargetRnti(), 94 | handoverCommand->GetTargetCellId()); 95 | } 96 | } 97 | } 98 | 99 | Ptr 100 | OranE2NodeTerminatorLteEnb::GetNetDevice() const 101 | { 102 | NS_LOG_FUNCTION(this); 103 | 104 | Ptr lteEnbNetDev = 105 | GetNode()->GetDevice(GetNetDeviceIndex())->GetObject(); 106 | 107 | NS_ABORT_MSG_IF(lteEnbNetDev == nullptr, "Unable to find appropriate network device"); 108 | 109 | return lteEnbNetDev; 110 | } 111 | 112 | } // namespace ns3 113 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-lte-enb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_E2_NODE_TERMINATOR_LTE_ENB_H 32 | #define ORAN_E2_NODE_TERMINATOR_LTE_ENB_H 33 | 34 | #include "oran-e2-node-terminator.h" 35 | 36 | #include "ns3/lte-enb-net-device.h" 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * E2 Node Terminator for LTE eNBs. This Terminator can process LTE Handover 45 | * Commands 46 | */ 47 | class OranE2NodeTerminatorLteEnb : public OranE2NodeTerminator 48 | { 49 | public: 50 | /** 51 | * Get the TypeId of the OranE2NodeTerminatorLteEnb class. 52 | * 53 | * @return The TypeId. 54 | */ 55 | static TypeId GetTypeId(); 56 | /** 57 | * Create an instance of the OranE2NodeTerminatorLteEnb class. 58 | */ 59 | OranE2NodeTerminatorLteEnb(); 60 | /** 61 | * The destructor of the OranE2NodeTerminatorLteEnb class. 62 | */ 63 | ~OranE2NodeTerminatorLteEnb() override; 64 | /** 65 | * Get the E2 Node Type. For this Terminator, this method 66 | * always returns the LTE eNB type. 67 | * 68 | * @return the E2 Node Type. 69 | */ 70 | OranNearRtRic::NodeType GetNodeType() const override; 71 | /** 72 | * Receive and process a command. If the Command is an LTE Handover Command 73 | * it will be processed. All other types of Commands are silently discarded.. 74 | * 75 | * @param command The received command. 76 | */ 77 | void ReceiveCommand(Ptr command) override; 78 | /** 79 | * Get the NetDevice of the LTE eNB. 80 | * 81 | * @return The net device. 82 | */ 83 | virtual Ptr GetNetDevice() const; 84 | }; // class OranE2NodeTermiantorLteEnb 85 | 86 | } // namespace ns3 87 | 88 | #endif /* ORAN_E2_NODE_TERMINATOR_LTE_ENB_H */ 89 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-lte-ue.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-e2-node-terminator-lte-ue.h" 32 | 33 | #include "oran-command-lte-2-lte-handover.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/log.h" 37 | #include "ns3/node.h" 38 | #include "ns3/pointer.h" 39 | #include "ns3/string.h" 40 | 41 | namespace ns3 42 | { 43 | 44 | NS_LOG_COMPONENT_DEFINE("OranE2NodeTerminatorLteUe"); 45 | 46 | NS_OBJECT_ENSURE_REGISTERED(OranE2NodeTerminatorLteUe); 47 | 48 | TypeId 49 | OranE2NodeTerminatorLteUe::GetTypeId() 50 | { 51 | static TypeId tid = TypeId("ns3::OranE2NodeTerminatorLteUe") 52 | .SetParent() 53 | .AddConstructor(); 54 | 55 | return tid; 56 | } 57 | 58 | OranE2NodeTerminatorLteUe::OranE2NodeTerminatorLteUe() 59 | : OranE2NodeTerminator() 60 | { 61 | NS_LOG_FUNCTION(this); 62 | } 63 | 64 | OranE2NodeTerminatorLteUe::~OranE2NodeTerminatorLteUe() 65 | { 66 | NS_LOG_FUNCTION(this); 67 | } 68 | 69 | OranNearRtRic::NodeType 70 | OranE2NodeTerminatorLteUe::GetNodeType() const 71 | { 72 | NS_LOG_FUNCTION(this); 73 | 74 | return OranNearRtRic::LTEUE; 75 | } 76 | 77 | void 78 | OranE2NodeTerminatorLteUe::ReceiveCommand(Ptr command) 79 | { 80 | NS_LOG_FUNCTION(this << command); 81 | 82 | if (m_active) 83 | { 84 | // No supported commands yet. 85 | } 86 | } 87 | 88 | Ptr 89 | OranE2NodeTerminatorLteUe::GetNetDevice() const 90 | { 91 | NS_LOG_FUNCTION(this); 92 | 93 | Ptr lteUeNetDev = 94 | GetNode()->GetDevice(GetNetDeviceIndex())->GetObject(); 95 | 96 | NS_ABORT_MSG_IF(lteUeNetDev == nullptr, "Unable to find appropriate network device"); 97 | 98 | return lteUeNetDev; 99 | } 100 | 101 | } // namespace ns3 102 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-lte-ue.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_E2_NODE_TERMINATOR_LTE_UE_H 32 | #define ORAN_E2_NODE_TERMINATOR_LTE_UE_H 33 | 34 | #include "oran-e2-node-terminator.h" 35 | 36 | #include "ns3/lte-ue-net-device.h" 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * E2 Node Terminator for LTE UEs. This Terminator does not process any Commands. 45 | */ 46 | class OranE2NodeTerminatorLteUe : public OranE2NodeTerminator 47 | { 48 | public: 49 | /** 50 | * Get the TypeId of the OranE2NodeTerminatorLteUe class. 51 | * 52 | * @return The TypeId. 53 | */ 54 | static TypeId GetTypeId(); 55 | /** 56 | * Constructor of the OranE2NodeTerminatorLteUe class. 57 | */ 58 | OranE2NodeTerminatorLteUe(); 59 | /** 60 | * Destructor of the OranE2NodeTerminatorLteUe class. 61 | */ 62 | ~OranE2NodeTerminatorLteUe() override; 63 | /** 64 | * Get the E2 Node Type. For this Terminator, this method always returns 65 | * the LTE UE node type 66 | * 67 | * @return the E2 Node Type. 68 | */ 69 | OranNearRtRic::NodeType GetNodeType() const override; 70 | /** 71 | * Receive a Command. All Commands are silently ignored. 72 | * 73 | * @param command The received command. 74 | */ 75 | void ReceiveCommand(Ptr command) override; 76 | /** 77 | * Get the NetDevice of the LTE UE. 78 | * 79 | * @return The net device. 80 | */ 81 | virtual Ptr GetNetDevice() const; 82 | }; // class OranE2NodeTerminatorLteUe 83 | 84 | } // namespace ns3 85 | 86 | #endif /* ORAN_E2_NODE_TERMINATOR_LTE_UE_H */ 87 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-wired.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-e2-node-terminator-wired.h" 32 | 33 | #include "ns3/abort.h" 34 | #include "ns3/log.h" 35 | #include "ns3/node.h" 36 | 37 | namespace ns3 38 | { 39 | 40 | NS_LOG_COMPONENT_DEFINE("OranE2NodeTerminatorWired"); 41 | 42 | NS_OBJECT_ENSURE_REGISTERED(OranE2NodeTerminatorWired); 43 | 44 | TypeId 45 | OranE2NodeTerminatorWired::GetTypeId() 46 | { 47 | static TypeId tid = TypeId("ns3::OranE2NodeTerminatorWired") 48 | .SetParent() 49 | .AddConstructor(); 50 | 51 | return tid; 52 | } 53 | 54 | OranE2NodeTerminatorWired::OranE2NodeTerminatorWired() 55 | : OranE2NodeTerminator() 56 | { 57 | NS_LOG_FUNCTION(this); 58 | } 59 | 60 | OranE2NodeTerminatorWired::~OranE2NodeTerminatorWired() 61 | { 62 | NS_LOG_FUNCTION(this); 63 | } 64 | 65 | OranNearRtRic::NodeType 66 | OranE2NodeTerminatorWired::GetNodeType() const 67 | { 68 | NS_LOG_FUNCTION(this); 69 | 70 | return OranNearRtRic::WIRED; 71 | } 72 | 73 | void 74 | OranE2NodeTerminatorWired::ReceiveCommand(Ptr command) 75 | { 76 | NS_LOG_FUNCTION(this << command); 77 | 78 | if (m_active) 79 | { 80 | // No supported commands yet. 81 | } 82 | } 83 | 84 | } // namespace ns3 85 | -------------------------------------------------------------------------------- /model/oran-e2-node-terminator-wired.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_E2_NODE_TERMINATOR_WIRED_H 32 | #define ORAN_E2_NODE_TERMINATOR_WIRED_H 33 | 34 | #include "oran-e2-node-terminator.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | /** 40 | * @ingroup oran 41 | * 42 | * E2 Node Terminator for Wired Nodes. No Commands are processed by this Terminator. 43 | */ 44 | class OranE2NodeTerminatorWired : public OranE2NodeTerminator 45 | { 46 | public: 47 | /** 48 | * Get the TypeId of the OranE2NodeTerminatorWired class. 49 | * 50 | * @return The TypeId. 51 | */ 52 | static TypeId GetTypeId(); 53 | /** 54 | * Constructor of the OranE2NodeTerminatorWired class. 55 | */ 56 | OranE2NodeTerminatorWired(); 57 | /** 58 | * Destructor of the OranE2NodeTerminatorWired class. 59 | */ 60 | ~OranE2NodeTerminatorWired() override; 61 | /** 62 | * Get the E2 Node Type. For this Terminator this method always returns the 63 | * WIRED node type 64 | * 65 | * @return the E2 Node Type. 66 | */ 67 | OranNearRtRic::NodeType GetNodeType() const override; 68 | /** 69 | * Receive a Command. All Commands are silently discarded. 70 | * 71 | * Currently this terminator silently discards received commands. 72 | * 73 | * @param command The received command. 74 | */ 75 | void ReceiveCommand(Ptr command) override; 76 | }; // class OranE2NodeTerminatorWired 77 | 78 | } // namespace ns3 79 | 80 | #endif // ORAN_E2_NODE_TERMINATOR_WIRED_H 81 | -------------------------------------------------------------------------------- /model/oran-lm-lte-2-lte-rsrp-handover.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_LM_LTE_2_LTE_DISTANCE_HANDOVER_H 32 | #define ORAN_LM_LTE_2_LTE_DISTANCE_HANDOVER_H 33 | 34 | #include "oran-data-repository.h" 35 | #include "oran-lm.h" 36 | 37 | #include "ns3/vector.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | /** 43 | * @ingroup oran 44 | * 45 | * Logic Module for the Near-RT RIC that issues Commands to handover from 46 | * an LTE cell to another based on the distance from the UE to the eNBs. 47 | */ 48 | class OranLmLte2LteRsrpHandover : public OranLm 49 | { 50 | protected: 51 | /** 52 | * UE related information. 53 | */ 54 | struct UeInfo 55 | { 56 | uint64_t nodeId; //!< The node ID. 57 | uint16_t cellId; //!< The cell ID. 58 | uint16_t rnti; //!< The RNTI ID. 59 | Vector position; //!< The physical position. 60 | }; 61 | 62 | /** 63 | * eNB related information. 64 | */ 65 | struct EnbInfo 66 | { 67 | uint64_t nodeId; //!< The node ID. 68 | uint16_t cellId; //!< The cell ID. 69 | Vector position; //!< The physical position. 70 | }; 71 | 72 | public: 73 | /** 74 | * Gets the TypeId of the OranLmLte2LteRsrpHandover class. 75 | * 76 | * @return The TypeId. 77 | */ 78 | static TypeId GetTypeId(void); 79 | /** 80 | * Constructor of the OranLmLte2LteRsrpHandover class. 81 | */ 82 | OranLmLte2LteRsrpHandover(void); 83 | /** 84 | * Destructor of the OranLmLte2LteRsrpHandover class. 85 | */ 86 | ~OranLmLte2LteRsrpHandover(void) override; 87 | /** 88 | * Runs the logic specific for this Logic Module. This will retrieve the 89 | * location of all LTE UEs and eNBs, find the closest eNB for each UE, and if 90 | * this eNB is not the serving eNB, a handover Command is generated. 91 | * 92 | * @return A vector with the handover commands generated by this Logic Module. 93 | */ 94 | std::vector> Run(void) override; 95 | 96 | private: 97 | /** 98 | * Method to get the UE information from the repository. 99 | * 100 | * @param data The data repository. 101 | * 102 | * @return A vector of UE Information structures. 103 | */ 104 | std::vector GetUeInfos(Ptr data) const; 105 | /** 106 | * Method to get the eNB information from the repository. 107 | * 108 | * @param data The data repository. 109 | * 110 | * @return A vector of eNB Information structures. 111 | */ 112 | std::vector GetEnbInfos(Ptr data) const; 113 | /** 114 | * Method with the logic to get the distance between UEs and eNBs 115 | * and generate Handover Commands if needed. 116 | * 117 | * @param data The data repository. 118 | * @param ueInfos A vector with the UE information. 119 | * @param enbInfos A vector with the eNB information. 120 | * 121 | * @return A vector with the handover commands generated. 122 | */ 123 | std::vector> GetHandoverCommands( 124 | Ptr data, 125 | std::vector ueInfos, 126 | std::vector enbInfos) const; 127 | }; // class OranLmLte2LteRsrpHandover 128 | 129 | } // namespace ns3 130 | 131 | #endif /* ORAN_LM_LTE_2_LTE_DISTANCE_HANDOVER_H */ 132 | -------------------------------------------------------------------------------- /model/oran-lm-noop.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-lm-noop.h" 32 | 33 | #include "oran-command.h" 34 | #include "oran-near-rt-ric.h" 35 | 36 | #include "ns3/abort.h" 37 | #include "ns3/log.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | NS_LOG_COMPONENT_DEFINE("OranLmNoop"); 43 | 44 | NS_OBJECT_ENSURE_REGISTERED(OranLmNoop); 45 | 46 | TypeId 47 | OranLmNoop::GetTypeId() 48 | { 49 | static TypeId tid = TypeId("ns3::OranLmNoop").SetParent().AddConstructor(); 50 | 51 | return tid; 52 | } 53 | 54 | OranLmNoop::OranLmNoop() 55 | : OranLm() 56 | { 57 | NS_LOG_FUNCTION(this); 58 | 59 | m_name = "OranLmNoop"; 60 | } 61 | 62 | OranLmNoop::~OranLmNoop() 63 | { 64 | NS_LOG_FUNCTION(this); 65 | } 66 | 67 | std::vector> 68 | OranLmNoop::Run() 69 | { 70 | NS_LOG_FUNCTION(this); 71 | 72 | // Do nothing and return an empty vector of commands 73 | // As we do nothing, there is no need to check if the LM 74 | // is active or not. 75 | // We check if the pointer to the Near-RT RIC has been set, 76 | // though, as not having that one should be a configuration 77 | // problem (and may be a symptom of other issues) 78 | NS_ABORT_MSG_IF(m_nearRtRic == nullptr, 79 | "Attempting to run LM (" + m_name + ") with NULL Near-RT RIC"); 80 | 81 | LogLogicToRepository("No action taken"); 82 | return {}; 83 | } 84 | 85 | } // namespace ns3 86 | -------------------------------------------------------------------------------- /model/oran-lm-noop.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_LM_NOOP_H 32 | #define ORAN_LM_NOOP_H 33 | 34 | #include "oran-lm.h" 35 | 36 | #include "ns3/object.h" 37 | 38 | #include 39 | 40 | namespace ns3 41 | { 42 | 43 | class OranNearRtRic; 44 | class OranCommand; 45 | 46 | /** 47 | * @ingroup oran 48 | * 49 | * Logic Module that does nothing. This is useful for using as defult LM in the 50 | * Near-RT RIC when we are not interested in doing anything. 51 | */ 52 | class OranLmNoop : public OranLm 53 | { 54 | public: 55 | /** 56 | * Get the TypeId of the OranLmNoop class. 57 | * 58 | * @return The TypeId 59 | */ 60 | static TypeId GetTypeId(); 61 | /** 62 | * Constructor of the OranLmNoop class. 63 | */ 64 | OranLmNoop(); 65 | /** 66 | * Destructor of the OranLmNoop class. 67 | */ 68 | ~OranLmNoop() override; 69 | /** 70 | * Run the logic of this LM. This is a No Operation LM, so the logic does 71 | * nothing and generates no commands. 72 | * 73 | * @return A vector of commands generated. 74 | */ 75 | std::vector> Run() override; 76 | }; // class OranLmNoop 77 | 78 | } // namespace ns3 79 | 80 | #endif /* ORAN_LM_NOOP_H */ 81 | -------------------------------------------------------------------------------- /model/oran-query-trigger-custom.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-query-trigger-custom.h" 32 | 33 | #include "ns3/log.h" 34 | 35 | namespace ns3 36 | { 37 | 38 | NS_LOG_COMPONENT_DEFINE("OranQueryTriggerCustom"); 39 | 40 | NS_OBJECT_ENSURE_REGISTERED(OranQueryTriggerCustom); 41 | 42 | TypeId 43 | OranQueryTriggerCustom::GetTypeId() 44 | { 45 | static TypeId tid = 46 | TypeId("ns3::OranQueryTriggerCustom") 47 | .SetParent() 48 | .AddConstructor() 49 | .AddAttribute( 50 | "CustomCallback", 51 | "Callback invoked to determine if LMs should be queried when a report is received.", 52 | CallbackValue(), 53 | MakeCallbackAccessor(&OranQueryTriggerCustom::m_customCb), 54 | MakeCallbackChecker()) 55 | 56 | ; 57 | 58 | return tid; 59 | } 60 | 61 | OranQueryTriggerCustom::OranQueryTriggerCustom() 62 | : OranQueryTrigger(), 63 | m_customCb(MakeNullCallback>()) 64 | { 65 | NS_LOG_FUNCTION(this); 66 | } 67 | 68 | OranQueryTriggerCustom::~OranQueryTriggerCustom() 69 | { 70 | NS_LOG_FUNCTION(this); 71 | } 72 | 73 | bool 74 | OranQueryTriggerCustom::QueryLms(Ptr report) 75 | { 76 | NS_LOG_FUNCTION(this << report); 77 | 78 | return !m_customCb.IsNull() && m_customCb(report); 79 | } 80 | 81 | void 82 | OranQueryTriggerCustom::DoDispose() 83 | { 84 | NS_LOG_FUNCTION(this); 85 | 86 | m_customCb = MakeNullCallback>(); 87 | } 88 | 89 | } // namespace ns3 90 | -------------------------------------------------------------------------------- /model/oran-query-trigger-custom.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_QUERY_TRIGGER_CUSTOM_H 32 | #define ORAN_QUERY_TRIGGER_CUSTOM_H 33 | 34 | #include "oran-query-trigger.h" 35 | #include "oran-report.h" 36 | 37 | #include "ns3/object.h" 38 | #include "ns3/ptr.h" 39 | 40 | namespace ns3 41 | { 42 | 43 | class OranReporter; 44 | 45 | /** 46 | * @ingroup oran 47 | * 48 | * Class for triggering LM queries in the Near-RT RIC based on user-provided methods. 49 | */ 50 | class OranQueryTriggerCustom : public OranQueryTrigger 51 | { 52 | public: 53 | /** 54 | * Get the TypeId of the OranQueryTriggerCustom class. 55 | * 56 | * @return The TypeId. 57 | */ 58 | static TypeId GetTypeId(); 59 | /** 60 | * Constructor of the OranQueryTriggerCustom class. 61 | */ 62 | OranQueryTriggerCustom(); 63 | /** 64 | * Destructor of the OranQueryTriggerCustom class. 65 | */ 66 | ~OranQueryTriggerCustom() override; 67 | /** 68 | * Indicates if a report should trigger query to the Logic Modules. 69 | * 70 | * @param report The report to consider. 71 | * @returns True, if a query to the Logic Modules should occur. 72 | */ 73 | bool QueryLms(Ptr report) override; 74 | 75 | protected: 76 | /** 77 | * Dispose of the object. 78 | */ 79 | void DoDispose() override; 80 | 81 | private: 82 | /** 83 | * A custom callback to trigger LM queries. 84 | */ 85 | Callback> m_customCb; 86 | }; // class OranQueryTriggerCustom 87 | 88 | } // namespace ns3 89 | 90 | #endif /* ORAN_QUERY_TRIGGER_CUSTOM_H */ 91 | -------------------------------------------------------------------------------- /model/oran-query-trigger-noop.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-query-trigger-noop.h" 32 | 33 | #include "ns3/log.h" 34 | 35 | namespace ns3 36 | { 37 | 38 | NS_LOG_COMPONENT_DEFINE("OranQueryTriggerNoop"); 39 | 40 | NS_OBJECT_ENSURE_REGISTERED(OranQueryTriggerNoop); 41 | 42 | TypeId 43 | OranQueryTriggerNoop::GetTypeId() 44 | { 45 | static TypeId tid = TypeId("ns3::OranQueryTriggerNoop") 46 | .SetParent() 47 | .AddConstructor(); 48 | 49 | return tid; 50 | } 51 | 52 | OranQueryTriggerNoop::OranQueryTriggerNoop() 53 | : OranQueryTrigger() 54 | { 55 | NS_LOG_FUNCTION(this); 56 | } 57 | 58 | OranQueryTriggerNoop::~OranQueryTriggerNoop() 59 | { 60 | NS_LOG_FUNCTION(this); 61 | } 62 | 63 | bool 64 | OranQueryTriggerNoop::QueryLms(Ptr report) 65 | { 66 | NS_LOG_FUNCTION(this << report); 67 | 68 | return false; 69 | } 70 | 71 | } // namespace ns3 72 | -------------------------------------------------------------------------------- /model/oran-query-trigger-noop.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_QUERY_TRIGGER_NOOP_H 32 | #define ORAN_QUERY_TRIGGER_NOOP_H 33 | 34 | #include "oran-query-trigger.h" 35 | #include "oran-report.h" 36 | 37 | #include "ns3/object.h" 38 | #include "ns3/ptr.h" 39 | 40 | namespace ns3 41 | { 42 | 43 | class OranReporter; 44 | 45 | /** 46 | * @ingroup oran 47 | * 48 | * No-operation class for triggering LM queries in the Near-RT RIC. 49 | */ 50 | class OranQueryTriggerNoop : public OranQueryTrigger 51 | { 52 | public: 53 | /** 54 | * Get the TypeId of the OranQueryTriggerNoop class. 55 | * 56 | * @return The TypeId. 57 | */ 58 | static TypeId GetTypeId(); 59 | /** 60 | * Constructor of the OranQueryTriggerNoop class. 61 | */ 62 | OranQueryTriggerNoop(); 63 | /** 64 | * Destructor of the OranQueryTriggerNoop class. 65 | */ 66 | ~OranQueryTriggerNoop() override; 67 | /** 68 | * Indicates if a report should trigger query to the Logic Modules. 69 | * As this is a No-Operation trigger, it always returns false. 70 | * 71 | * @param report The report to consider. 72 | * @returns True, if a query to the Logic Modules should occur. 73 | */ 74 | bool QueryLms(Ptr report) override; 75 | }; // class OranQueryTriggerNoop 76 | 77 | } // namespace ns3 78 | 79 | #endif /* ORAN_QUERY_TRIGGER_NOOP_H */ 80 | -------------------------------------------------------------------------------- /model/oran-query-trigger.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-query-trigger.h" 32 | 33 | #include "oran-report.h" 34 | 35 | #include "ns3/log.h" 36 | 37 | namespace ns3 38 | { 39 | 40 | NS_LOG_COMPONENT_DEFINE("OranQueryTrigger"); 41 | 42 | NS_OBJECT_ENSURE_REGISTERED(OranQueryTrigger); 43 | 44 | TypeId 45 | OranQueryTrigger::GetTypeId() 46 | { 47 | static TypeId tid = TypeId("ns3::OranQueryTrigger").SetParent(); 48 | 49 | return tid; 50 | } 51 | 52 | OranQueryTrigger::OranQueryTrigger() 53 | : Object() 54 | { 55 | NS_LOG_FUNCTION(this); 56 | } 57 | 58 | OranQueryTrigger::~OranQueryTrigger() 59 | { 60 | NS_LOG_FUNCTION(this); 61 | } 62 | 63 | } // namespace ns3 64 | -------------------------------------------------------------------------------- /model/oran-query-trigger.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_QUERY_TRIGGER_H 32 | #define ORAN_QUERY_TRIGGER_H 33 | 34 | #include "ns3/object.h" 35 | #include "ns3/ptr.h" 36 | 37 | namespace ns3 38 | { 39 | 40 | class OranReport; 41 | class OranReporter; 42 | 43 | /** 44 | * @ingroup oran 45 | * 46 | * Base class for Report-based triggers for initiating the LM querying process. 47 | * 48 | * This class cannot be instantiated. 49 | */ 50 | class OranQueryTrigger : public Object 51 | { 52 | public: 53 | /** 54 | * Get the TypeId of the OranQueryTrigger class. 55 | * 56 | * @return The TypeId. 57 | */ 58 | static TypeId GetTypeId(); 59 | /** 60 | * Destructor of the OranQueryTrigger class. 61 | */ 62 | ~OranQueryTrigger() override; 63 | /** 64 | * Indicates if a report should trigger query to the Logic Modules. 65 | * 66 | * @param report The report to consider. 67 | * @returns True, if a query to the Logic Modules should occur. 68 | */ 69 | virtual bool QueryLms(Ptr report) = 0; 70 | 71 | protected: 72 | /** 73 | * Constructor of the OranQueryTrigger class. 74 | */ 75 | OranQueryTrigger(); 76 | }; // class OranQueryTrigger 77 | 78 | } // namespace ns3 79 | 80 | #endif /* ORAN_QUERY_TRIGGER_H */ 81 | -------------------------------------------------------------------------------- /model/oran-report-apploss.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-apploss.h" 32 | 33 | #include "oran-report.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/double.h" 37 | #include "ns3/log.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | NS_LOG_COMPONENT_DEFINE("OranReportAppLoss"); 43 | NS_OBJECT_ENSURE_REGISTERED(OranReportAppLoss); 44 | 45 | TypeId 46 | OranReportAppLoss::GetTypeId() 47 | { 48 | static TypeId tid = TypeId("ns3::OranReportAppLoss") 49 | .SetParent() 50 | .AddConstructor() 51 | .AddAttribute("Loss", 52 | "App Loss Rate", 53 | DoubleValue(), 54 | MakeDoubleAccessor(&OranReportAppLoss::m_loss), 55 | MakeDoubleChecker()); 56 | 57 | return tid; 58 | } 59 | 60 | OranReportAppLoss::OranReportAppLoss() 61 | { 62 | NS_LOG_FUNCTION(this); 63 | } 64 | 65 | OranReportAppLoss::~OranReportAppLoss() 66 | { 67 | NS_LOG_FUNCTION(this); 68 | } 69 | 70 | std::string 71 | OranReportAppLoss::ToString() const 72 | { 73 | NS_LOG_FUNCTION(this); 74 | 75 | std::stringstream ss; 76 | Time time = GetTime(); 77 | 78 | ss << "OranReportAppLoss(" 79 | << "E2NodeId=" << GetReporterE2NodeId() << ";Time=" << time.As(Time::S) << ";Loss=" << m_loss 80 | << ")"; 81 | 82 | return ss.str(); 83 | } 84 | 85 | double 86 | OranReportAppLoss::GetLoss() const 87 | { 88 | NS_LOG_FUNCTION(this); 89 | 90 | return m_loss; 91 | } 92 | 93 | } // namespace ns3 94 | -------------------------------------------------------------------------------- /model/oran-report-apploss.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_APPLOSS 32 | #define ORAN_REPORT_APPLOSS 33 | 34 | #include "oran-report.h" 35 | 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * Report with the application packet loss of a node at a given time. 45 | */ 46 | class OranReportAppLoss : public OranReport 47 | { 48 | public: 49 | /** 50 | * Get the TypeId of the OranReportAppLoss class. 51 | * 52 | * @return The TypeId. 53 | */ 54 | static TypeId GetTypeId(); 55 | /** 56 | * Constructor of the OranReportAppLoss class. 57 | */ 58 | OranReportAppLoss(); 59 | /** 60 | * Destructor of the OranReportAppLoss class. 61 | */ 62 | ~OranReportAppLoss() override; 63 | /** 64 | * Get a string representation of this Report 65 | * 66 | * @return A string representation of this Report. 67 | */ 68 | std::string ToString() const override; 69 | /** 70 | * Gets the reported application packet loss. 71 | * 72 | * @return The reported application packet loss. 73 | */ 74 | double GetLoss() const; 75 | 76 | private: 77 | /** 78 | * The application packet loss. 79 | */ 80 | double m_loss; 81 | }; // class OranReportAppLoss 82 | 83 | } // namespace ns3 84 | 85 | #endif // ORAN_REPORT_APPLOSS 86 | -------------------------------------------------------------------------------- /model/oran-report-location.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-location.h" 32 | 33 | #include "oran-report.h" 34 | 35 | #include "ns3/log.h" 36 | #include "ns3/uinteger.h" 37 | #include "ns3/vector.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | NS_LOG_COMPONENT_DEFINE("OranReportLocation"); 43 | 44 | NS_OBJECT_ENSURE_REGISTERED(OranReportLocation); 45 | 46 | TypeId 47 | OranReportLocation::GetTypeId() 48 | { 49 | static TypeId tid = TypeId("ns3::OranReportLocation") 50 | .SetParent() 51 | .AddConstructor() 52 | .AddAttribute("Location", 53 | "The location of the node.", 54 | VectorValue(), 55 | MakeVectorAccessor(&OranReportLocation::m_location), 56 | MakeVectorChecker()); 57 | 58 | return tid; 59 | } 60 | 61 | OranReportLocation::OranReportLocation() 62 | : OranReport() 63 | { 64 | NS_LOG_FUNCTION(this); 65 | } 66 | 67 | OranReportLocation::~OranReportLocation() 68 | { 69 | NS_LOG_FUNCTION(this); 70 | } 71 | 72 | std::string 73 | OranReportLocation::ToString() const 74 | { 75 | NS_LOG_FUNCTION(this); 76 | 77 | std::stringstream ss; 78 | Time time = GetTime(); 79 | 80 | ss << "OranReportLocation(" 81 | << "E2NodeId=" << GetReporterE2NodeId() << ";Time=" << time.As(Time::S) 82 | << ";Location=" << m_location << ")"; 83 | 84 | return ss.str(); 85 | } 86 | 87 | Vector 88 | OranReportLocation::GetLocation() const 89 | { 90 | NS_LOG_FUNCTION(this); 91 | 92 | return m_location; 93 | } 94 | 95 | } // namespace ns3 96 | -------------------------------------------------------------------------------- /model/oran-report-location.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_LOCATION_H 32 | #define ORAN_REPORT_LOCATION_H 33 | 34 | #include "oran-report.h" 35 | 36 | #include "ns3/object.h" 37 | #include "ns3/vector.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | /** 45 | * @ingroup oran 46 | * 47 | * Report with the position of a node at a given time. 48 | */ 49 | class OranReportLocation : public OranReport 50 | { 51 | public: 52 | /** 53 | * Get the TypeId of the OranReportLocation class. 54 | * 55 | * @return The TypeId. 56 | */ 57 | static TypeId GetTypeId(); 58 | /** 59 | * Constructor of the OranReportLocation class. 60 | */ 61 | OranReportLocation(); 62 | /** 63 | * Destructor of the OranReportLocation class. 64 | */ 65 | ~OranReportLocation() override; 66 | /** 67 | * Get a string representation of this Report 68 | * 69 | * @return A string representation of this Report. 70 | */ 71 | std::string ToString() const override; 72 | 73 | private: 74 | /** 75 | * The reported location 76 | */ 77 | Vector m_location; 78 | 79 | public: 80 | /** 81 | * Get the reported location. 82 | * 83 | * @return The reported location. 84 | */ 85 | Vector GetLocation() const; 86 | }; // class OranReportLocation 87 | 88 | } // namespace ns3 89 | 90 | #endif /* ORAN_REPORT_LOCATION_H */ 91 | -------------------------------------------------------------------------------- /model/oran-report-lte-ue-cell-info.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-lte-ue-cell-info.h" 32 | 33 | #include "oran-report.h" 34 | 35 | #include "ns3/log.h" 36 | #include "ns3/uinteger.h" 37 | #include "ns3/vector.h" 38 | 39 | namespace ns3 40 | { 41 | 42 | NS_LOG_COMPONENT_DEFINE("OranReportLteUeCellInfo"); 43 | 44 | NS_OBJECT_ENSURE_REGISTERED(OranReportLteUeCellInfo); 45 | 46 | TypeId 47 | OranReportLteUeCellInfo::GetTypeId() 48 | { 49 | static TypeId tid = 50 | TypeId("ns3::OranReportLteUeCellInfo") 51 | .SetParent() 52 | .AddConstructor() 53 | .AddAttribute("CellId", 54 | "The ID of the cell that the UE is currently attached to.", 55 | UintegerValue(), 56 | MakeUintegerAccessor(&OranReportLteUeCellInfo::m_cellId), 57 | MakeUintegerChecker()) 58 | .AddAttribute("Rnti", 59 | "The RNTI that was assigned to this UE by the cell.", 60 | UintegerValue(), 61 | MakeUintegerAccessor(&OranReportLteUeCellInfo::m_rnti), 62 | MakeUintegerChecker()); 63 | 64 | return tid; 65 | } 66 | 67 | OranReportLteUeCellInfo::OranReportLteUeCellInfo() 68 | : OranReport() 69 | { 70 | NS_LOG_FUNCTION(this); 71 | } 72 | 73 | OranReportLteUeCellInfo::~OranReportLteUeCellInfo() 74 | { 75 | NS_LOG_FUNCTION(this); 76 | } 77 | 78 | std::string 79 | OranReportLteUeCellInfo::ToString() const 80 | { 81 | NS_LOG_FUNCTION(this); 82 | 83 | std::stringstream ss; 84 | Time time = GetTime(); 85 | 86 | ss << "OranReportLteUeCellInfo(" 87 | << "E2NodeId=" << GetReporterE2NodeId() << ";Time=" << time.As(Time::S) 88 | << ";CellId=" << (uint32_t)m_cellId << ";RNTI=" << (uint32_t)m_rnti << ")"; 89 | 90 | return ss.str(); 91 | } 92 | 93 | uint16_t 94 | OranReportLteUeCellInfo::GetCellId() const 95 | { 96 | NS_LOG_FUNCTION(this); 97 | 98 | return m_cellId; 99 | } 100 | 101 | uint16_t 102 | OranReportLteUeCellInfo::GetRnti() const 103 | { 104 | NS_LOG_FUNCTION(this); 105 | 106 | return m_rnti; 107 | } 108 | 109 | } // namespace ns3 110 | -------------------------------------------------------------------------------- /model/oran-report-lte-ue-cell-info.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_LTE_UE_CELL_INFO_H 32 | #define ORAN_REPORT_LTE_UE_CELL_INFO_H 33 | 34 | #include "oran-report.h" 35 | 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * Report with the Cell ID of the serving LTE eNB for an LTE UE. 45 | */ 46 | class OranReportLteUeCellInfo : public OranReport 47 | { 48 | public: 49 | /** 50 | * Get the TypeId of the OranReportLteUeCellInfo class. 51 | * 52 | * @return The TypeId. 53 | */ 54 | static TypeId GetTypeId(); 55 | /** 56 | * Constructor of the OranReportLteUeCellInfo class. 57 | */ 58 | OranReportLteUeCellInfo(); 59 | /** 60 | * Destructor of the OranReportLteUeCellInfo class. 61 | */ 62 | ~OranReportLteUeCellInfo() override; 63 | /** 64 | * Get a string representation of this Report. 65 | * 66 | * @return A string representation of this Report. 67 | */ 68 | std::string ToString() const override; 69 | 70 | private: 71 | /** 72 | * The reported cell ID. 73 | */ 74 | uint16_t m_cellId; 75 | /** 76 | * The reported RNTI. 77 | */ 78 | uint16_t m_rnti; 79 | 80 | public: 81 | /** 82 | * Get the reported cell ID. 83 | * 84 | * @return The reported cell ID. 85 | */ 86 | uint16_t GetCellId() const; 87 | /** 88 | * Get the reported RNTI. 89 | * 90 | * @return The reported RNTI. 91 | */ 92 | uint16_t GetRnti() const; 93 | }; // class OranReportLteUeCellInfo 94 | 95 | } // namespace ns3 96 | 97 | #endif /* ORAN_REPORT_LTE_UE_CELL_INFO_H */ 98 | -------------------------------------------------------------------------------- /model/oran-report-lte-ue-rsrp-rsrq.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_LTE_UE_RSRP_RSRQ 32 | #define ORAN_REPORT_LTE_UE_RSRP_RSRQ 33 | 34 | #include "oran-report.h" 35 | 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * @ingroup oran 43 | * 44 | * Report with the application packet loss of a node at a given time. 45 | */ 46 | class OranReportLteUeRsrpRsrq : public OranReport 47 | { 48 | public: 49 | /** 50 | * Get the TypeId of the OranReportLteUeRsrpRsrq class. 51 | * 52 | * @return The TypeId. 53 | */ 54 | static TypeId GetTypeId(); 55 | /** 56 | * Constructor of the OranReportLteUeRsrpRsrq class. 57 | */ 58 | OranReportLteUeRsrpRsrq(); 59 | /** 60 | * Destructor of the OranReportLteUeRsrpRsrq class. 61 | */ 62 | ~OranReportLteUeRsrpRsrq() override; 63 | /** 64 | * Get a string representation of this Report 65 | * 66 | * @return A string representation of this Report. 67 | */ 68 | std::string ToString() const override; 69 | /** 70 | * Gets the RNTI. 71 | * 72 | * @return The RNTI. 73 | */ 74 | uint16_t GetRnti() const; 75 | /** 76 | * Gets the cell ID. 77 | * 78 | * @return The cell ID. 79 | */ 80 | uint16_t GetCellId() const; 81 | /** 82 | * Gets the reported RSRP. 83 | * 84 | * @return The reported RSRP. 85 | */ 86 | double GetRsrp() const; 87 | /** 88 | * Gets the reported RSRQ. 89 | * 90 | * @return The reported RSRQ. 91 | */ 92 | double GetRsrq() const; 93 | /** 94 | * Gets the flag that indicates if this is for the serving cell. 95 | * 96 | * @return The flag. 97 | */ 98 | bool GetIsServingCell() const; 99 | /** 100 | * Gets the component carrier ID. 101 | * 102 | * @return The component carrier ID. 103 | */ 104 | uint16_t GetComponentCarrierId() const; 105 | 106 | private: 107 | /** 108 | * The RNTI. 109 | */ 110 | uint16_t m_rnti; 111 | /** 112 | * The cell ID. 113 | */ 114 | uint16_t m_cellId; 115 | /** 116 | * The RSRP. 117 | */ 118 | double m_rsrp; 119 | /** 120 | * The RSRQ. 121 | */ 122 | double m_rsrq; 123 | /** 124 | * A flag that indicates if the report is for the serving cell. 125 | */ 126 | bool m_isServingCell; 127 | /** 128 | * The component carrier ID. 129 | */ 130 | uint16_t m_componentCarrierId; 131 | 132 | }; // class OranReportLteUeRsrpRsrq 133 | 134 | } // namespace ns3 135 | 136 | #endif // ORAN_REPORT_LTE_UE_RSRP_RSRQ 137 | -------------------------------------------------------------------------------- /model/oran-report-trigger-location-change.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-trigger-location-change.h" 32 | 33 | #include "oran-reporter.h" 34 | 35 | #include "ns3/log.h" 36 | #include "ns3/lte-ue-net-device.h" 37 | #include "ns3/lte-ue-rrc.h" 38 | #include "ns3/nstime.h" 39 | #include "ns3/pointer.h" 40 | #include "ns3/random-variable-stream.h" 41 | #include "ns3/simulator.h" 42 | #include "ns3/string.h" 43 | 44 | namespace ns3 45 | { 46 | 47 | NS_LOG_COMPONENT_DEFINE("OranReportTriggerLocationChange"); 48 | 49 | NS_OBJECT_ENSURE_REGISTERED(OranReportTriggerLocationChange); 50 | 51 | TypeId 52 | OranReportTriggerLocationChange::GetTypeId() 53 | { 54 | static TypeId tid = TypeId("ns3::OranReportTriggerLocationChange") 55 | .SetParent() 56 | .AddConstructor(); 57 | 58 | return tid; 59 | } 60 | 61 | OranReportTriggerLocationChange::OranReportTriggerLocationChange() 62 | : OranReportTrigger() 63 | { 64 | NS_LOG_FUNCTION(this); 65 | } 66 | 67 | OranReportTriggerLocationChange::~OranReportTriggerLocationChange() 68 | { 69 | NS_LOG_FUNCTION(this); 70 | } 71 | 72 | void 73 | OranReportTriggerLocationChange::Activate(Ptr reporter) 74 | { 75 | NS_LOG_FUNCTION(this << reporter); 76 | 77 | if (!m_active) 78 | { 79 | Ptr mobility = 80 | reporter->GetTerminator()->GetNode()->GetObject(); 81 | 82 | NS_ABORT_MSG_IF(mobility == nullptr, "Unable to find mobility model"); 83 | 84 | mobility->TraceConnectWithoutContext( 85 | "CourseChange", 86 | MakeCallback(&OranReportTriggerLocationChange::CourseChangedSink, this)); 87 | } 88 | 89 | OranReportTrigger::Activate(reporter); 90 | } 91 | 92 | void 93 | OranReportTriggerLocationChange::Deactivate() 94 | { 95 | NS_LOG_FUNCTION(this); 96 | 97 | if (m_active) 98 | { 99 | DisconnectSink(); 100 | } 101 | 102 | OranReportTrigger::Deactivate(); 103 | } 104 | 105 | void 106 | OranReportTriggerLocationChange::DoDispose() 107 | { 108 | NS_LOG_FUNCTION(this); 109 | 110 | if (m_active) 111 | { 112 | DisconnectSink(); 113 | } 114 | 115 | OranReportTrigger::DoDispose(); 116 | } 117 | 118 | void 119 | OranReportTriggerLocationChange::CourseChangedSink(Ptr mobility) 120 | { 121 | NS_LOG_FUNCTION(this << mobility); 122 | 123 | NS_LOG_LOGIC("Location change triggering report"); 124 | 125 | TriggerReport(); 126 | } 127 | 128 | void 129 | OranReportTriggerLocationChange::DisconnectSink() 130 | { 131 | NS_LOG_FUNCTION(this); 132 | 133 | Ptr mobility = 134 | m_reporter->GetTerminator()->GetNode()->GetObject(); 135 | 136 | NS_ABORT_MSG_IF(mobility == nullptr, "Unable to find mobility model"); 137 | 138 | mobility->TraceDisconnectWithoutContext( 139 | "CourseChange", 140 | MakeCallback(&OranReportTriggerLocationChange::CourseChangedSink, this)); 141 | } 142 | 143 | } // namespace ns3 144 | -------------------------------------------------------------------------------- /model/oran-report-trigger-location-change.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_TRIGGER_LOCATION_CHANGE_H 32 | #define ORAN_REPORT_TRIGGER_LOCATION_CHANGE_H 33 | 34 | #include "oran-report-trigger.h" 35 | 36 | #include "ns3/mobility-model.h" 37 | #include "ns3/object.h" 38 | #include "ns3/ptr.h" 39 | 40 | #include 41 | 42 | namespace ns3 43 | { 44 | 45 | class OranReporter; 46 | 47 | /** 48 | * @ingroup oran 49 | * 50 | * A class that triggers reports based on position changes 51 | * UE. 52 | */ 53 | class OranReportTriggerLocationChange : public OranReportTrigger 54 | { 55 | public: 56 | /** 57 | * Get the TypeId of the OranReportTriggerLocationChange class. 58 | * 59 | * @return The TypeId. 60 | */ 61 | static TypeId GetTypeId(); 62 | /** 63 | * Constructor of the OranReportTriggerLocationChange class. 64 | */ 65 | OranReportTriggerLocationChange(); 66 | /** 67 | * Destructor of the OranReportTriggerLocationChange class. 68 | */ 69 | ~OranReportTriggerLocationChange() override; 70 | /** 71 | * Activates this trigger for the given reporter. 72 | * @param reporter The reporter to link to. 73 | */ 74 | void Activate(Ptr reporter) override; 75 | /** 76 | * Deactivates this trigger and unlinks it from the current reporter. 77 | */ 78 | void Deactivate() override; 79 | 80 | protected: 81 | /** 82 | * Dispose of the Report. 83 | */ 84 | void DoDispose() override; 85 | /** 86 | * The callback for receiving the HandoverEndOk event from an LTE UE. 87 | * @param mobility 88 | */ 89 | virtual void CourseChangedSink(Ptr mobility); 90 | 91 | private: 92 | /** 93 | * Disconnects the callback from the LTE UE. 94 | */ 95 | void DisconnectSink(); 96 | }; // class OranReportTriggerLocationChange 97 | 98 | } // namespace ns3 99 | 100 | #endif /* ORAN_REPORT_TRIGGER_LOCATION_CHANGE_H */ 101 | -------------------------------------------------------------------------------- /model/oran-report-trigger-lte-ue-handover.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_TRIGGER_LTE_UE_HANDOVER_H 32 | #define ORAN_REPORT_TRIGGER_LTE_UE_HANDOVER_H 33 | 34 | #include "oran-report-trigger.h" 35 | 36 | #include "ns3/object.h" 37 | #include "ns3/ptr.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | class OranReporter; 45 | 46 | /** 47 | * @ingroup oran 48 | * 49 | * A class that triggers reports based on the successful handover of an LTE 50 | * UE. 51 | */ 52 | class OranReportTriggerLteUeHandover : public OranReportTrigger 53 | { 54 | public: 55 | /** 56 | * Get the TypeId of the OranReportTriggerLteUeHandover class. 57 | * 58 | * @return The TypeId. 59 | */ 60 | static TypeId GetTypeId(); 61 | /** 62 | * Constructor of the OranReportTriggerLteUeHandover class. 63 | */ 64 | OranReportTriggerLteUeHandover(); 65 | /** 66 | * Destructor of the OranReportTriggerLteUeHandover class. 67 | */ 68 | ~OranReportTriggerLteUeHandover() override; 69 | /** 70 | * Activates this trigger for the given reporter. 71 | * @param reporter The reporter to link to. 72 | */ 73 | void Activate(Ptr reporter) override; 74 | /** 75 | * Deactivates this trigger and unlinks it from the current reporter. 76 | */ 77 | void Deactivate() override; 78 | 79 | protected: 80 | /** 81 | * Dispose of the Report. 82 | */ 83 | void DoDispose() override; 84 | /** 85 | * The callback for receiving the HandoverEndOk event from an LTE UE. 86 | * @param imsi The IMSI of the UE. 87 | * @param cellId The ID of the new cell. 88 | * @param rnti The new RNTI of the UE. 89 | */ 90 | virtual void HandoverCompleteSink(uint64_t imsi, uint16_t cellId, uint16_t rnti); 91 | /** 92 | * The callback for receiving the ConnectionEstablished event from an LTE UE. 93 | * @param imsi The IMSI of the UE. 94 | * @param cellId The ID of the new cell. 95 | * @param rnti The new RNTI of the UE. 96 | */ 97 | virtual void ConnectionEstablishedSink(uint64_t imsi, uint16_t cellId, uint16_t rnti); 98 | 99 | private: 100 | /** 101 | * Disconnects the callback from the LTE UE. 102 | */ 103 | void DisconnectSink(); 104 | }; // class OranReportTriggerLteUeHandover 105 | 106 | } // namespace ns3 107 | 108 | #endif /* ORAN_REPORT_TRIGGER_LTE_UE_HANDOVER_H */ 109 | -------------------------------------------------------------------------------- /model/oran-report-trigger-periodic.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-trigger-periodic.h" 32 | 33 | #include "oran-reporter.h" 34 | 35 | #include "ns3/log.h" 36 | #include "ns3/nstime.h" 37 | #include "ns3/pointer.h" 38 | #include "ns3/random-variable-stream.h" 39 | #include "ns3/simulator.h" 40 | #include "ns3/string.h" 41 | 42 | namespace ns3 43 | { 44 | 45 | NS_LOG_COMPONENT_DEFINE("OranReportTriggerPeriodic"); 46 | 47 | NS_OBJECT_ENSURE_REGISTERED(OranReportTriggerPeriodic); 48 | 49 | TypeId 50 | OranReportTriggerPeriodic::GetTypeId() 51 | { 52 | static TypeId tid = 53 | TypeId("ns3::OranReportTriggerPeriodic") 54 | .SetParent() 55 | .AddConstructor() 56 | .AddAttribute("IntervalRv", 57 | "The random variable used to generate the delay (in seconds) between " 58 | "periodic reports.", 59 | StringValue("ns3::ConstantRandomVariable[Constant=1]"), 60 | MakePointerAccessor(&OranReportTriggerPeriodic::m_intervalRv), 61 | MakePointerChecker()); 62 | 63 | return tid; 64 | } 65 | 66 | OranReportTriggerPeriodic::OranReportTriggerPeriodic() 67 | : OranReportTrigger(), 68 | m_triggerEvent(EventId()) 69 | { 70 | NS_LOG_FUNCTION(this); 71 | } 72 | 73 | OranReportTriggerPeriodic::~OranReportTriggerPeriodic() 74 | { 75 | NS_LOG_FUNCTION(this); 76 | } 77 | 78 | void 79 | OranReportTriggerPeriodic::Activate(Ptr reporter) 80 | { 81 | NS_LOG_FUNCTION(this << reporter); 82 | 83 | if (!m_active) 84 | { 85 | ScheduleNextTrigger(); 86 | } 87 | 88 | OranReportTrigger::Activate(reporter); 89 | } 90 | 91 | void 92 | OranReportTriggerPeriodic::Deactivate() 93 | { 94 | NS_LOG_FUNCTION(this); 95 | 96 | if (m_active) 97 | { 98 | CancelNextTrigger(); 99 | } 100 | 101 | OranReportTrigger::Deactivate(); 102 | } 103 | 104 | void 105 | OranReportTriggerPeriodic::DoDispose() 106 | { 107 | NS_LOG_FUNCTION(this); 108 | 109 | if (m_triggerEvent.IsPending()) 110 | { 111 | m_triggerEvent.Cancel(); 112 | } 113 | 114 | m_intervalRv = nullptr; 115 | 116 | OranReportTrigger::DoDispose(); 117 | } 118 | 119 | void 120 | OranReportTriggerPeriodic::TriggerReport() 121 | { 122 | NS_LOG_FUNCTION(this); 123 | 124 | if (m_active) 125 | { 126 | ScheduleNextTrigger(); 127 | } 128 | 129 | OranReportTrigger::TriggerReport(); 130 | } 131 | 132 | void 133 | OranReportTriggerPeriodic::CancelNextTrigger() 134 | { 135 | NS_LOG_FUNCTION(this); 136 | 137 | if (m_triggerEvent.IsPending()) 138 | { 139 | m_triggerEvent.Cancel(); 140 | } 141 | } 142 | 143 | void 144 | OranReportTriggerPeriodic::ScheduleNextTrigger() 145 | { 146 | NS_LOG_FUNCTION(this); 147 | 148 | m_triggerEvent = Simulator::Schedule(Seconds(m_intervalRv->GetValue()), 149 | &OranReportTriggerPeriodic::TriggerReport, 150 | this); 151 | } 152 | 153 | } // namespace ns3 154 | -------------------------------------------------------------------------------- /model/oran-report-trigger-periodic.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_TRIGGER_PERIODIC_H 32 | #define ORAN_REPORT_TRIGGER_PERIODIC_H 33 | 34 | #include "oran-report-trigger.h" 35 | 36 | #include "ns3/event-id.h" 37 | #include "ns3/object.h" 38 | #include "ns3/ptr.h" 39 | #include "ns3/random-variable-stream.h" 40 | 41 | #include 42 | 43 | namespace ns3 44 | { 45 | 46 | class OranReporter; 47 | 48 | /** 49 | * @ingroup oran 50 | * 51 | * A class that periodically triggers reports based on a random variable. 52 | */ 53 | class OranReportTriggerPeriodic : public OranReportTrigger 54 | { 55 | public: 56 | /** 57 | * Get the TypeId of the OranReportTriggerPeriodic class. 58 | * 59 | * @return The TypeId. 60 | */ 61 | static TypeId GetTypeId(); 62 | /** 63 | * Constructor of the OranReportTriggerPeriodic class. 64 | */ 65 | OranReportTriggerPeriodic(); 66 | /** 67 | * Destructor of the OranReportTriggerPeriodic class. 68 | */ 69 | ~OranReportTriggerPeriodic() override; 70 | /** 71 | * Activates this trigger for the given reporter. 72 | * @param reporter The reporter to link to. 73 | */ 74 | void Activate(Ptr reporter) override; 75 | /** 76 | * Deactivates this trigger and unlinks it from the current reporter. 77 | */ 78 | void Deactivate() override; 79 | 80 | protected: 81 | /** 82 | * Dispose of the Report. 83 | */ 84 | void DoDispose() override; 85 | /** 86 | * Triggers a report. 87 | */ 88 | void TriggerReport() override; 89 | /** 90 | * Cancel the next trigger event. 91 | */ 92 | virtual void CancelNextTrigger(); 93 | /** 94 | * Schedule the next trigger event. 95 | */ 96 | virtual void ScheduleNextTrigger(); 97 | 98 | private: 99 | /** 100 | * The next trigger event. 101 | */ 102 | EventId m_triggerEvent; 103 | /** 104 | * The random variable used to generate the delay (in seconds) between 105 | * triggered reports. 106 | */ 107 | Ptr m_intervalRv; 108 | }; // class OranReportTriggerPeriodic 109 | 110 | } // namespace ns3 111 | 112 | #endif /* ORAN_REPORT_TRIGGER_PERIODIC_H */ 113 | -------------------------------------------------------------------------------- /model/oran-report-trigger.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report-trigger.h" 32 | 33 | #include "oran-reporter.h" 34 | 35 | #include "ns3/boolean.h" 36 | #include "ns3/log.h" 37 | #include "ns3/nstime.h" 38 | #include "ns3/pointer.h" 39 | #include "ns3/simulator.h" 40 | #include "ns3/string.h" 41 | 42 | namespace ns3 43 | { 44 | 45 | NS_LOG_COMPONENT_DEFINE("OranReportTrigger"); 46 | 47 | NS_OBJECT_ENSURE_REGISTERED(OranReportTrigger); 48 | 49 | TypeId 50 | OranReportTrigger::GetTypeId() 51 | { 52 | static TypeId tid = 53 | TypeId("ns3::OranReportTrigger") 54 | .SetParent() 55 | .AddAttribute("Reporter", 56 | "The reporter.", 57 | PointerValue(nullptr), 58 | MakePointerAccessor(&OranReportTrigger::m_reporter), 59 | MakePointerChecker()) 60 | .AddAttribute("InitialReport", 61 | "Indicates if an initial report should be generated upon registration.", 62 | BooleanValue(false), 63 | MakeBooleanAccessor(&OranReportTrigger::m_initialReport), 64 | MakeBooleanChecker()); 65 | 66 | return tid; 67 | } 68 | 69 | OranReportTrigger::OranReportTrigger() 70 | : Object(), 71 | m_active(false) 72 | { 73 | NS_LOG_FUNCTION(this); 74 | } 75 | 76 | OranReportTrigger::~OranReportTrigger() 77 | { 78 | NS_LOG_FUNCTION(this); 79 | } 80 | 81 | void 82 | OranReportTrigger::Activate(Ptr reporter) 83 | { 84 | NS_LOG_FUNCTION(this << reporter); 85 | 86 | if (!m_active) 87 | { 88 | NS_ABORT_MSG_IF(reporter == nullptr, "Attempting to link to a NULL reporter."); 89 | 90 | m_active = true; 91 | m_reporter = reporter; 92 | m_reporter->SetAttribute("Trigger", PointerValue(GetObject())); 93 | } 94 | } 95 | 96 | void 97 | OranReportTrigger::Deactivate() 98 | { 99 | NS_LOG_FUNCTION(this); 100 | 101 | if (m_active) 102 | { 103 | NS_ABORT_MSG_IF(m_reporter == nullptr, "Attempting to unlink from a NULL reporter."); 104 | 105 | m_reporter->SetAttribute("Trigger", PointerValue(nullptr)); 106 | m_reporter = nullptr; 107 | m_active = false; 108 | } 109 | } 110 | 111 | void 112 | OranReportTrigger::NotifyRegistrationComplete() 113 | { 114 | if (m_active && m_initialReport) 115 | { 116 | TriggerReport(); 117 | } 118 | } 119 | 120 | void 121 | OranReportTrigger::DoDispose() 122 | { 123 | NS_LOG_FUNCTION(this); 124 | 125 | m_reporter = nullptr; 126 | 127 | Object::DoDispose(); 128 | } 129 | 130 | void 131 | OranReportTrigger::TriggerReport() 132 | { 133 | NS_LOG_FUNCTION(this); 134 | 135 | NS_ABORT_MSG_IF(m_reporter == nullptr, "Attempting to trigger a report with a NULL reporter."); 136 | 137 | m_reporter->PerformReport(); 138 | } 139 | 140 | } // namespace ns3 141 | -------------------------------------------------------------------------------- /model/oran-report-trigger.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_TRIGGER_H 32 | #define ORAN_REPORT_TRIGGER_H 33 | 34 | #include "ns3/object.h" 35 | #include "ns3/ptr.h" 36 | 37 | #include 38 | 39 | namespace ns3 40 | { 41 | 42 | class OranReporter; 43 | 44 | /** 45 | * @ingroup oran 46 | * 47 | * Base class for triggering the generation of a Report. 48 | * 49 | * This class cannot be instantiated. 50 | */ 51 | class OranReportTrigger : public Object 52 | { 53 | public: 54 | /** 55 | * Get the TypeId of the OranReportTrigger class. 56 | * 57 | * @return The TypeId. 58 | */ 59 | static TypeId GetTypeId(); 60 | /** 61 | * Destructor of the OranReportTrigger class. 62 | */ 63 | ~OranReportTrigger() override; 64 | /** 65 | * Activates this trigger for and links it to the given reporter. 66 | * @param reporter The reporter to link to. 67 | */ 68 | virtual void Activate(Ptr reporter); 69 | /** 70 | * Deactivates this trigger and unlinks it from the current reporter. 71 | */ 72 | virtual void Deactivate(); 73 | /** 74 | * Notifies the trigger that initial registartion has completed successfully. 75 | */ 76 | virtual void NotifyRegistrationComplete(); 77 | 78 | protected: 79 | /** 80 | * Constructor of the OranReportTrigger class. 81 | */ 82 | OranReportTrigger(); 83 | /** 84 | * Dispose of the Report. 85 | */ 86 | void DoDispose() override; 87 | /** 88 | * Triggers a report. 89 | */ 90 | virtual void TriggerReport(); 91 | 92 | /** 93 | * Flag to indicate if the trigger is active. 94 | */ 95 | bool m_active; 96 | /** 97 | * The reporter to trigger reports for. 98 | */ 99 | Ptr m_reporter; 100 | 101 | private: 102 | /** 103 | * Indicates if an initial report should be triggered upon registration. 104 | */ 105 | bool m_initialReport; 106 | }; // class OranReportTrigger 107 | 108 | } // namespace ns3 109 | 110 | #endif /* ORAN_REPORT_TRIGGER_H */ 111 | -------------------------------------------------------------------------------- /model/oran-report.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-report.h" 32 | 33 | #include "ns3/log.h" 34 | #include "ns3/uinteger.h" 35 | 36 | namespace ns3 37 | { 38 | 39 | NS_LOG_COMPONENT_DEFINE("OranReport"); 40 | 41 | NS_OBJECT_ENSURE_REGISTERED(OranReport); 42 | 43 | TypeId 44 | OranReport::GetTypeId() 45 | { 46 | static TypeId tid = TypeId("ns3::OranReport") 47 | .SetParent() 48 | .AddConstructor() 49 | .AddAttribute("ReporterE2NodeId", 50 | "The E2 Node ID of the reporter", 51 | UintegerValue(0), 52 | MakeUintegerAccessor(&OranReport::m_reporterE2NodeId), 53 | MakeUintegerChecker()) 54 | .AddAttribute("Time", 55 | "The Time at which the report was generated", 56 | TimeValue(), 57 | MakeTimeAccessor(&OranReport::m_time), 58 | MakeTimeChecker()); 59 | 60 | return tid; 61 | } 62 | 63 | OranReport::OranReport() 64 | : Object() 65 | { 66 | NS_LOG_FUNCTION(this); 67 | } 68 | 69 | OranReport::~OranReport() 70 | { 71 | NS_LOG_FUNCTION(this); 72 | } 73 | 74 | std::string 75 | OranReport::ToString() const 76 | { 77 | NS_LOG_FUNCTION(this); 78 | 79 | return "Parent OranReport. Should not be used."; 80 | } 81 | 82 | uint64_t 83 | OranReport::GetReporterE2NodeId() const 84 | { 85 | NS_LOG_FUNCTION(this); 86 | 87 | return m_reporterE2NodeId; 88 | } 89 | 90 | Time 91 | OranReport::GetTime() const 92 | { 93 | NS_LOG_FUNCTION(this); 94 | 95 | return m_time; 96 | } 97 | 98 | } // namespace ns3 99 | -------------------------------------------------------------------------------- /model/oran-report.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORT_H 32 | #define ORAN_REPORT_H 33 | 34 | #include "ns3/nstime.h" 35 | #include "ns3/object.h" 36 | 37 | #include 38 | 39 | namespace ns3 40 | { 41 | 42 | /** 43 | * @ingroup oran 44 | * 45 | * Base class for the Reports sent by the nodes to the Near-RT RIC 46 | * to report on the state of the network. 47 | * 48 | * This class can be instantiated but should not be used, as it does 49 | * not contain useful information. 50 | */ 51 | class OranReport : public Object 52 | { 53 | public: 54 | /** 55 | * Get the TypeId of the OranReport class. 56 | * 57 | * @return The TypeId. 58 | */ 59 | static TypeId GetTypeId(); 60 | /** 61 | * Constructor of the OranReport class. 62 | */ 63 | OranReport(); 64 | /** 65 | * Destructor of the OranReport class. 66 | */ 67 | ~OranReport() override; 68 | /** 69 | * Get a string representation of this Report. 70 | * 71 | * @return A string representation of this Report. 72 | */ 73 | virtual std::string ToString() const; 74 | /** 75 | * Get the E2 Node ID of the reporter. 76 | * 77 | * @return The E2 Node ID of the reporter. 78 | */ 79 | uint64_t GetReporterE2NodeId() const; 80 | /** 81 | * Get the Time at which the Report was generated. 82 | * 83 | * @return The Time at which the Report was generated. 84 | */ 85 | Time GetTime() const; 86 | 87 | private: 88 | /** 89 | * E2 Node ID of the Reporter. 90 | */ 91 | uint64_t m_reporterE2NodeId; 92 | /** 93 | * Time at which the Report was generated. 94 | */ 95 | Time m_time; 96 | }; // class OranReport 97 | 98 | } // namespace ns3 99 | 100 | #endif /* ORAN_REPORT_H */ 101 | -------------------------------------------------------------------------------- /model/oran-reporter-apploss.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-reporter-apploss.h" 32 | 33 | #include "oran-report-apploss.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/address.h" 37 | #include "ns3/double.h" 38 | #include "ns3/log.h" 39 | #include "ns3/packet.h" 40 | #include "ns3/simulator.h" 41 | #include "ns3/uinteger.h" 42 | 43 | namespace ns3 44 | { 45 | 46 | NS_LOG_COMPONENT_DEFINE("OranReporterAppLoss"); 47 | NS_OBJECT_ENSURE_REGISTERED(OranReporterAppLoss); 48 | 49 | TypeId 50 | OranReporterAppLoss::GetTypeId() 51 | { 52 | static TypeId tid = TypeId("ns3::OranReporterAppLoss") 53 | .SetParent() 54 | .AddConstructor(); 55 | 56 | return tid; 57 | } 58 | 59 | OranReporterAppLoss::OranReporterAppLoss() 60 | { 61 | NS_LOG_FUNCTION(this); 62 | 63 | m_tx = 0; 64 | m_rx = 0; 65 | } 66 | 67 | OranReporterAppLoss::~OranReporterAppLoss() 68 | { 69 | NS_LOG_FUNCTION(this); 70 | } 71 | 72 | void 73 | OranReporterAppLoss::AddTx(Ptr p) 74 | { 75 | NS_LOG_FUNCTION(this << p); 76 | 77 | m_tx++; 78 | } 79 | 80 | void 81 | OranReporterAppLoss::AddRx(Ptr p, const Address& from) 82 | { 83 | NS_LOG_FUNCTION(this << p << from); 84 | 85 | m_rx++; 86 | } 87 | 88 | std::vector> 89 | OranReporterAppLoss::GenerateReports() 90 | { 91 | NS_LOG_FUNCTION(this); 92 | 93 | std::vector> reports; 94 | 95 | if (m_active) 96 | { 97 | NS_ABORT_MSG_IF(m_terminator == nullptr, 98 | "Attempting to generate reports in reporter with NULL E2 Terminator"); 99 | 100 | double loss = 0; 101 | if (m_rx <= m_tx && m_tx > 0) 102 | { 103 | // loss = 1 - (m_rx * 1.0 / m_tx); 104 | loss = static_cast(m_tx - m_rx) / static_cast(m_tx); 105 | } 106 | 107 | Ptr lossReport = CreateObject(); 108 | lossReport->SetAttribute("ReporterE2NodeId", UintegerValue(m_terminator->GetE2NodeId())); 109 | lossReport->SetAttribute("Time", TimeValue(Simulator::Now())); 110 | lossReport->SetAttribute("Loss", DoubleValue(loss)); 111 | 112 | reports.push_back(lossReport); 113 | m_tx = 0; 114 | m_rx = 0; 115 | } 116 | 117 | return reports; 118 | } 119 | 120 | } // namespace ns3 121 | -------------------------------------------------------------------------------- /model/oran-reporter-apploss.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORTER_APPLOSS 32 | #define ORAN_REPORTER_APPLOSS 33 | 34 | #include "oran-report.h" 35 | #include "oran-reporter.h" 36 | 37 | #include "ns3/ptr.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | class Packet; 45 | class Address; 46 | 47 | /** 48 | * @ingroup oran 49 | * 50 | * A Reporter that captures the application packet loss of the node. 51 | */ 52 | class OranReporterAppLoss : public OranReporter 53 | { 54 | public: 55 | /** 56 | * Get the TypeId of the OranReporterAppLoss class. 57 | * 58 | * @return The TypeId. 59 | */ 60 | static TypeId GetTypeId(); 61 | /** 62 | * Constructor of the OranReporterAppLoss class. 63 | */ 64 | OranReporterAppLoss(); 65 | /** 66 | * Destructor of the OranReporterAppLoss class. 67 | */ 68 | ~OranReporterAppLoss() override; 69 | /** 70 | * Records the transmission of a packet. 71 | * 72 | * @param p The packet. 73 | */ 74 | void AddTx(Ptr p); 75 | /** 76 | * Records the reception of a packet from a given address. 77 | * 78 | * @param p The packet. 79 | * @param from The address that the packet is from. 80 | */ 81 | void AddRx(Ptr p, const Address& from); 82 | 83 | protected: 84 | /** 85 | * Capture the application packet loss and instantiate an OranReportAppLoss. 86 | * 87 | * @return The generated Report. 88 | */ 89 | std::vector> GenerateReports() override; 90 | 91 | private: 92 | /** 93 | * The number of transmitted packets. 94 | */ 95 | uint64_t m_tx; 96 | /** 97 | * The number of recived packets. 98 | */ 99 | uint64_t m_rx; 100 | }; 101 | 102 | } // namespace ns3 103 | 104 | #endif // ORAN_REPORTER_APPLOSS 105 | -------------------------------------------------------------------------------- /model/oran-reporter-location.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-reporter-location.h" 32 | 33 | #include "oran-report-location.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/log.h" 37 | #include "ns3/mobility-model.h" 38 | #include "ns3/simulator.h" 39 | #include "ns3/uinteger.h" 40 | 41 | namespace ns3 42 | { 43 | 44 | NS_LOG_COMPONENT_DEFINE("OranReporterLocation"); 45 | 46 | NS_OBJECT_ENSURE_REGISTERED(OranReporterLocation); 47 | 48 | TypeId 49 | OranReporterLocation::GetTypeId() 50 | { 51 | static TypeId tid = TypeId("ns3::OranReporterLocation") 52 | .SetParent() 53 | .AddConstructor(); 54 | 55 | return tid; 56 | } 57 | 58 | OranReporterLocation::OranReporterLocation() 59 | : OranReporter() 60 | { 61 | NS_LOG_FUNCTION(this); 62 | } 63 | 64 | OranReporterLocation::~OranReporterLocation() 65 | { 66 | NS_LOG_FUNCTION(this); 67 | } 68 | 69 | std::vector> 70 | OranReporterLocation::GenerateReports() 71 | { 72 | NS_LOG_FUNCTION(this); 73 | 74 | std::vector> reports; 75 | if (m_active) 76 | { 77 | NS_ABORT_MSG_IF(m_terminator == nullptr, 78 | "Attempting to generate reports in reporter with NULL E2 Terminator"); 79 | Ptr mobility = m_terminator->GetNode()->GetObject(); 80 | 81 | Ptr locationReport = CreateObject(); 82 | locationReport->SetAttribute("ReporterE2NodeId", 83 | UintegerValue(m_terminator->GetE2NodeId())); 84 | locationReport->SetAttribute("Location", VectorValue(mobility->GetPosition())); 85 | locationReport->SetAttribute("Time", TimeValue(Simulator::Now())); 86 | 87 | reports.push_back(locationReport); 88 | } 89 | return reports; 90 | } 91 | 92 | } // namespace ns3 93 | -------------------------------------------------------------------------------- /model/oran-reporter-location.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORTER_LOCATION_H 32 | #define ORAN_REPORTER_LOCATION_H 33 | 34 | #include "oran-report.h" 35 | #include "oran-reporter.h" 36 | 37 | #include "ns3/ptr.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | /** 45 | * @ingroup oran 46 | * 47 | * A Reporter that captures the position of the node. 48 | */ 49 | class OranReporterLocation : public OranReporter 50 | { 51 | public: 52 | /** 53 | * Get the TypeId of the OranReporterLocation class. 54 | * 55 | * @return The TypeId. 56 | */ 57 | static TypeId GetTypeId(); 58 | /** 59 | * Constructor of the OranReporterLocation class. 60 | */ 61 | OranReporterLocation(); 62 | /** 63 | * Destructor of the OranReporterLocation class. 64 | */ 65 | ~OranReporterLocation() override; 66 | 67 | protected: 68 | /** 69 | * Capture the position of the node and instantiate an OranReportLocation. 70 | * 71 | * @return The generated Report. 72 | */ 73 | std::vector> GenerateReports() override; 74 | }; // class OranReporterLocation 75 | 76 | } // namespace ns3 77 | 78 | #endif /* ORAN_REPORTER_LOCATION_H */ 79 | -------------------------------------------------------------------------------- /model/oran-reporter-lte-ue-cell-info.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-reporter-lte-ue-cell-info.h" 32 | 33 | #include "oran-report-lte-ue-cell-info.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/log.h" 37 | #include "ns3/lte-ue-net-device.h" 38 | #include "ns3/lte-ue-rrc.h" 39 | #include "ns3/mobility-model.h" 40 | #include "ns3/simulator.h" 41 | #include "ns3/uinteger.h" 42 | 43 | namespace ns3 44 | { 45 | 46 | NS_LOG_COMPONENT_DEFINE("OranReporterLteUeCellInfo"); 47 | 48 | NS_OBJECT_ENSURE_REGISTERED(OranReporterLteUeCellInfo); 49 | 50 | TypeId 51 | OranReporterLteUeCellInfo::GetTypeId() 52 | { 53 | static TypeId tid = TypeId("ns3::OranReporterLteUeCellInfo") 54 | .SetParent() 55 | .AddConstructor(); 56 | 57 | return tid; 58 | } 59 | 60 | OranReporterLteUeCellInfo::OranReporterLteUeCellInfo() 61 | : OranReporter() 62 | { 63 | NS_LOG_FUNCTION(this); 64 | } 65 | 66 | OranReporterLteUeCellInfo::~OranReporterLteUeCellInfo() 67 | { 68 | NS_LOG_FUNCTION(this); 69 | } 70 | 71 | std::vector> 72 | OranReporterLteUeCellInfo::GenerateReports() 73 | { 74 | NS_LOG_FUNCTION(this); 75 | 76 | std::vector> reports; 77 | if (m_active) 78 | { 79 | NS_ABORT_MSG_IF(m_terminator == nullptr, 80 | "Attempting to generate reports in reporter with NULL E2 Terminator"); 81 | 82 | Ptr lteUeNetDev = nullptr; 83 | Ptr node = m_terminator->GetNode(); 84 | Ptr cellInfoReport = CreateObject(); 85 | 86 | for (uint32_t idx = 0; lteUeNetDev == nullptr && idx < node->GetNDevices(); idx++) 87 | { 88 | lteUeNetDev = node->GetDevice(idx)->GetObject(); 89 | } 90 | 91 | NS_ABORT_MSG_IF(lteUeNetDev == nullptr, "Unable to find appropriate network device"); 92 | 93 | Ptr lteUeRrc = lteUeNetDev->GetRrc(); 94 | 95 | cellInfoReport->SetAttribute("ReporterE2NodeId", 96 | UintegerValue(m_terminator->GetE2NodeId())); 97 | cellInfoReport->SetAttribute("CellId", UintegerValue(lteUeRrc->GetCellId())); 98 | cellInfoReport->SetAttribute("Rnti", UintegerValue(lteUeRrc->GetRnti())); 99 | cellInfoReport->SetAttribute("Time", TimeValue(Simulator::Now())); 100 | 101 | reports.push_back(cellInfoReport); 102 | } 103 | 104 | return reports; 105 | } 106 | 107 | } // namespace ns3 108 | -------------------------------------------------------------------------------- /model/oran-reporter-lte-ue-cell-info.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORTER_LTE_UE_CELL_INFO_H 32 | #define ORAN_REPORTER_LTE_UE_CELL_INFO_H 33 | 34 | #include "oran-report.h" 35 | #include "oran-reporter.h" 36 | 37 | #include "ns3/ptr.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | /** 45 | * @ingroup oran 46 | * 47 | * Reporter that attaches to an LTE UE and captures the LTE Cell ID 48 | * of the eNB the UE is attached to. 49 | */ 50 | class OranReporterLteUeCellInfo : public OranReporter 51 | { 52 | public: 53 | /** 54 | * Get the TypeId of the OranReporterLteUeCellInfo class. 55 | * 56 | * @return The TypeId. 57 | */ 58 | static TypeId GetTypeId(); 59 | /** 60 | * Constructor of the OranReporterLteUeCellInfo class. 61 | */ 62 | OranReporterLteUeCellInfo(); 63 | /** 64 | * Destructor of the OranReporterLteUeCellInfo class. 65 | */ 66 | ~OranReporterLteUeCellInfo() override; 67 | 68 | protected: 69 | /** 70 | * Get the Cell ID of the attached LTE cell, and generate an 71 | * OranReportLteUeCEllInfo. 72 | * 73 | * @return The generated Report. 74 | */ 75 | std::vector> GenerateReports() override; 76 | }; // class OranReporterLteUeCellInfo 77 | 78 | } // namespace ns3 79 | 80 | #endif /* ORAN_REPORTER_LTE_UE_CELL_INFO_H */ 81 | -------------------------------------------------------------------------------- /model/oran-reporter-lte-ue-rsrp-rsrq.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #include "oran-reporter-lte-ue-rsrp-rsrq.h" 32 | 33 | #include "oran-report-lte-ue-rsrp-rsrq.h" 34 | 35 | #include "ns3/abort.h" 36 | #include "ns3/address.h" 37 | #include "ns3/boolean.h" 38 | #include "ns3/double.h" 39 | #include "ns3/log.h" 40 | #include "ns3/packet.h" 41 | #include "ns3/simulator.h" 42 | #include "ns3/uinteger.h" 43 | 44 | namespace ns3 45 | { 46 | 47 | NS_LOG_COMPONENT_DEFINE("OranReporterLteUeRsrpRsrq"); 48 | NS_OBJECT_ENSURE_REGISTERED(OranReporterLteUeRsrpRsrq); 49 | 50 | TypeId 51 | OranReporterLteUeRsrpRsrq::GetTypeId() 52 | { 53 | static TypeId tid = TypeId("ns3::OranReporterLteUeRsrpRsrq") 54 | .SetParent() 55 | .AddConstructor(); 56 | 57 | return tid; 58 | } 59 | 60 | OranReporterLteUeRsrpRsrq::OranReporterLteUeRsrpRsrq() 61 | { 62 | NS_LOG_FUNCTION(this); 63 | } 64 | 65 | OranReporterLteUeRsrpRsrq::~OranReporterLteUeRsrpRsrq() 66 | { 67 | NS_LOG_FUNCTION(this); 68 | } 69 | 70 | void 71 | OranReporterLteUeRsrpRsrq::ReportRsrpRsrq(uint16_t rnti, 72 | uint16_t cellId, 73 | double rsrp, 74 | double rsrq, 75 | bool isServingCell, 76 | uint8_t componentCarrierId) 77 | { 78 | NS_LOG_FUNCTION(this << +rnti << +cellId << rsrp << rsrq << isServingCell 79 | << componentCarrierId); 80 | 81 | if (m_active) 82 | { 83 | NS_ABORT_MSG_IF(m_terminator == nullptr, 84 | "Attempting to generate reports in reporter with NULL E2 Terminator"); 85 | 86 | Ptr report = CreateObject(); 87 | report->SetAttribute("ReporterE2NodeId", UintegerValue(m_terminator->GetE2NodeId())); 88 | report->SetAttribute("Time", TimeValue(Simulator::Now())); 89 | report->SetAttribute("Rnti", UintegerValue(rnti)); 90 | report->SetAttribute("CellId", UintegerValue(cellId)); 91 | report->SetAttribute("Rsrp", DoubleValue(rsrp)); 92 | report->SetAttribute("Rsrq", DoubleValue(rsrq)); 93 | report->SetAttribute("IsServingCell", BooleanValue(isServingCell)); 94 | report->SetAttribute("ComponentCarrierId", UintegerValue(componentCarrierId)); 95 | 96 | m_reports.push_back(report); 97 | } 98 | } 99 | 100 | std::vector> 101 | OranReporterLteUeRsrpRsrq::GenerateReports() 102 | { 103 | NS_LOG_FUNCTION(this); 104 | 105 | std::vector> reports; 106 | 107 | if (m_active) 108 | { 109 | reports = m_reports; 110 | m_reports.clear(); 111 | } 112 | 113 | return reports; 114 | } 115 | 116 | } // namespace ns3 117 | -------------------------------------------------------------------------------- /model/oran-reporter-lte-ue-rsrp-rsrq.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORTER_LTE_UE_RSRP_RSRQ 32 | #define ORAN_REPORTER_LTE_UE_RSRP_RSRQ 33 | 34 | #include "oran-report.h" 35 | #include "oran-reporter.h" 36 | 37 | #include "ns3/ptr.h" 38 | 39 | #include 40 | 41 | namespace ns3 42 | { 43 | 44 | class Packet; 45 | class Address; 46 | 47 | /** 48 | * @ingroup oran 49 | * 50 | * A Reporter that captures the LTE UE RSRP and RSRQ of the node. 51 | */ 52 | class OranReporterLteUeRsrpRsrq : public OranReporter 53 | { 54 | public: 55 | /** 56 | * Get the TypeId of the OranReporterLteUeRsrpRsrq class. 57 | * 58 | * @return The TypeId. 59 | */ 60 | static TypeId GetTypeId(); 61 | /** 62 | * Constructor of the OranReporterLteUeRsrpRsrq class. 63 | */ 64 | OranReporterLteUeRsrpRsrq(); 65 | /** 66 | * Destructor of the OranReporterLteUeRsrpRsrq class. 67 | */ 68 | ~OranReporterLteUeRsrpRsrq() override; 69 | /** 70 | * Reports the RSRP and RSRQ for an LTE UE. 71 | * 72 | * @param rnti The RNTI of the UE. 73 | * @param cellId The cell ID. 74 | * @param rsrp The RSRP. 75 | * @param rsrq The RSRQ. 76 | * @param isServingCell A flag that indicates if this is the serving cell. 77 | * @param componentCarrierId The component carrier ID. 78 | */ 79 | void ReportRsrpRsrq(uint16_t rnti, 80 | uint16_t cellId, 81 | double rsrp, 82 | double rsrq, 83 | bool isServingCell, 84 | uint8_t componentCarrierId); 85 | 86 | protected: 87 | /** 88 | * Returns the genrated OranReportLteUeRsrpRsrq. 89 | * 90 | * @return The generated Report. 91 | */ 92 | std::vector> GenerateReports() override; 93 | 94 | private: 95 | /** 96 | * The reports. 97 | */ 98 | std::vector> m_reports; 99 | }; 100 | 101 | } // namespace ns3 102 | 103 | #endif // ORAN_REPORTER_LTE_UE_RSRP_RSRQ 104 | -------------------------------------------------------------------------------- /model/oran-reporter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * NIST-developed software is provided by NIST as a public service. You may 3 | * use, copy and distribute copies of the software in any medium, provided that 4 | * you keep intact this entire notice. You may improve, modify and create 5 | * derivative works of the software or any portion of the software, and you may 6 | * copy and distribute such modifications or works. Modified works should carry 7 | * a notice stating that you changed the software and should note the date and 8 | * nature of any such change. Please explicitly acknowledge the National 9 | * Institute of Standards and Technology as the source of the software. 10 | * 11 | * NIST-developed software is expressly provided "AS IS." NIST MAKES NO 12 | * WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF 13 | * LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST 15 | * NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE 16 | * UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST 17 | * DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE 18 | * SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE 19 | * CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 20 | * 21 | * You are solely responsible for determining the appropriateness of using and 22 | * distributing the software and you assume all risks associated with its use, 23 | * including but not limited to the risks and costs of program errors, 24 | * compliance with applicable laws, damage to or loss of data, programs or 25 | * equipment, and the unavailability or interruption of operation. This 26 | * software is not intended to be used in any situation where a failure could 27 | * cause risk of injury or damage to property. The software developed by NIST 28 | * employees is not subject to copyright protection within the United States. 29 | */ 30 | 31 | #ifndef ORAN_REPORTER_H 32 | #define ORAN_REPORTER_H 33 | 34 | #include "oran-e2-node-terminator.h" 35 | 36 | #include "ns3/object.h" 37 | #include "ns3/ptr.h" 38 | #include "ns3/random-variable-stream.h" 39 | 40 | #include 41 | 42 | namespace ns3 43 | { 44 | 45 | class OranReportTrigger; 46 | 47 | /** 48 | * @ingroup oran 49 | * 50 | * Base class for Reporters that attach to simulation nodes and collect 51 | * specific statistics. 52 | * 53 | * This class cannot be instantiated as it does not have an implementatio 54 | * of the GenerateReports method. 55 | */ 56 | class OranReporter : public Object 57 | { 58 | public: 59 | /** 60 | * Get the TypeId of the OranReporter class. 61 | * 62 | * @return The TypeId. 63 | */ 64 | static TypeId GetTypeId(); 65 | /** 66 | * Constructor of the OranReporter class. 67 | */ 68 | OranReporter(); 69 | /** 70 | * Destructor of the OranReporter class. 71 | */ 72 | ~OranReporter() override; 73 | /** 74 | * Activate the reporter and start periodically generating Reports 75 | * for the E2 Node Terminator. 76 | */ 77 | virtual void Activate(); 78 | /** 79 | * Deactivate the reporter and stop generating Reports. 80 | */ 81 | virtual void Deactivate(); 82 | /** 83 | * Indicate if the reporter is active. 84 | * 85 | * @return True, if the reporter is active; otherwise, false. 86 | */ 87 | virtual bool IsActive() const; 88 | /** 89 | * Get the E2 Node Terminator. 90 | * @return The E2 Node Terminator. 91 | */ 92 | Ptr GetTerminator() const; 93 | /** 94 | * Invoke GenerateReports and send the Reports to the E2 Terminator. 95 | */ 96 | virtual void PerformReport(); 97 | /** 98 | * Notifies the reporter that initial registartion has completed successfully. 99 | */ 100 | virtual void NotifyRegistrationComplete(); 101 | 102 | protected: 103 | /** 104 | * Dispose of the Reporter. 105 | */ 106 | void DoDispose() override; 107 | /** 108 | * Collect values and metrics from the models, and generate reports 109 | * with them. 110 | * 111 | * @return The collection of Reports. 112 | */ 113 | virtual std::vector> GenerateReports() = 0; 114 | 115 | /** 116 | * Flag to indicate if the Reporter is active. 117 | */ 118 | bool m_active; 119 | /** 120 | * The E2 Node Terminator. 121 | */ 122 | Ptr m_terminator; 123 | 124 | private: 125 | /** 126 | * The trigger that generates reports. 127 | */ 128 | Ptr m_trigger; 129 | }; // class OranReporter 130 | 131 | } // namespace ns3 132 | 133 | #endif /* ORAN_REPORTER_H */ 134 | --------------------------------------------------------------------------------