Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/coreemu/core into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bharnden committed Aug 9, 2024
2 parents c02f8e1 + a1464a2 commit 6ebda61
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 37 deletions.
2 changes: 1 addition & 1 deletion daemon/core/api/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def open_xml(self, file_path: Path, start: bool = False) -> tuple[bool, int]:
Load a local scenario XML file to open as a new session.
:param file_path: path of scenario XML file
:param start: tuple of result and session id when successful
:param start: instantiate session if true, false for a definition state
:return: tuple of result and session id
"""
with file_path.open("r") as f:
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/emane/models/tdma.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def post_startup(self, iface: CoreInterface) -> None:
if not nem_id:
logger.error("could not find nem for interface")
return
service = self.session.emane.nem_service.get(nem_id)
service = self.session.emane.event_manager.get_service(nem_id)
if service:
device = service.device
logger.info(
Expand Down
2 changes: 1 addition & 1 deletion daemon/core/emulator/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def open_xml(self, file_path: Path, start: bool = False) -> None:
Import a session from the EmulationScript XML format.
:param file_path: xml file to load session from
:param start: instantiate session if true, false otherwise
:param start: instantiate session if true, false for a definition state
:return: nothing
"""
logger.info("opening xml: %s", file_path)
Expand Down
6 changes: 2 additions & 4 deletions daemon/core/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,11 @@ def run_validation(self) -> None:
"""
start = time.monotonic()
cmds = self.validate[:]
index = 0
while cmds:
cmd = cmds[index]
cmd = cmds[0]
try:
self.node.cmd(cmd, shell=True)
del cmds[index]
index += 1
del cmds[0]
except CoreCommandError:
logger.debug(
f"node({self.node.name}) service({self.name}) "
Expand Down
2 changes: 1 addition & 1 deletion docs/install_ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sudo apt-get install -y \

# install ospf mdr
cd ~/Documents
apt-get install -y \
sudo apt-get install -y \
automake \
gawk \
g++ \
Expand Down
8 changes: 4 additions & 4 deletions docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ExampleService(CoreService):
validate: list[str] = []
# commands to run to stop this service
shutdown: list[str] = []
# validation mode, blocking, non-blocking, and timer
# validation mode BLOCKING, NON_BLOCKING, and TIMER
validation_mode: ServiceMode = ServiceMode.BLOCKING
# configurable values that this service can use, for file generation
default_configs: list[Configuration] = [
Expand Down Expand Up @@ -191,9 +191,9 @@ class ExampleService(CoreService):

Validation modes are used to determine if a service has started up successfully.

* blocking - startup commands are expected to run til completion and return 0 exit code
* non-blocking - startup commands are ran, but do not wait for completion
* timer - startup commands are ran, and an arbitrary amount of time is waited to consider started
* `BLOCKING` - startup commands are expected to run til completion and return 0 exit code
* `NON_BLOCKING` - startup commands are ran, but do not wait for completion
* `TIMER` - startup commands are ran, and an arbitrary amount of time is waited to consider started

#### Shadow Directories

Expand Down
14 changes: 13 additions & 1 deletion docs/tutorials/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

We assume the prior installation of CORE, using a virtual environment.

```shell
# location of all core files
/opt/core

# location of the virtual environment
/opt/core/venv

# convenience command for using core's python virtual environment
core-python
```

## Setup for Chat App

There is a simple TCP chat app provided as example software to use and run within
Expand All @@ -15,6 +26,7 @@ The following will install chatapp and its scripts into **/usr/local**, which yo
may need to add to PATH within node to be able to use command directly.

``` shell
cd /opt/core/share/tutorials/chatapp
sudo python3 -m pip install .
```

Expand Down Expand Up @@ -66,7 +78,7 @@ optional arguments:
``` shell
custom_services_dir = <path for service>
```
2. Then you will need to copy/move **chatapp/chatapp_service.py** to the directory
2. Then you will need to copy/move **/opt/core/share/tutorials/chatapp/chatapp_service.py** to the directory
configured above
3. Then you will need to restart the **core-daemon** to pick up this new service
4. Now the service will be an available option under the group **ChatApp** with
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/tutorial1.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ scenario in CORE.
Below is the list of files used for this tutorial.

* 2 node wired scenario
* scenario.xml
* scenario.py
* /opt/core/share/tutorials/tutorial1/scenario.xml
* /opt/core/share/tutorials/tutorial1/scenario.py
* 2 node wired scenario, with **n1** running the "Chat App Server" service
* scenario_service.xml
* scenario_service.py
* /opt/core/share/tutorials/tutorial1/scenario_service.xml
* /opt/core/share/tutorials/tutorial1/scenario_service.py

## Running this Tutorial

Expand Down
6 changes: 4 additions & 2 deletions docs/tutorials/tutorial2.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ send a simple message and the server will log receipt of the message.

Below is the list of files used for this tutorial.

* scenario.xml - 3 node CORE xml scenario file (wireless)
* scenario.py - 3 node CORE gRPC python script (wireless)
* 3 node CORE xml scenario file (wireless)
* /opt/core/share/tutorials/tutorial2/scenario.xml
* 3 node CORE gRPC python script (wireless)
* /opt/core/share/tutorials/tutorial2/scenario.py

## Running with the XML Scenario File

Expand Down
12 changes: 8 additions & 4 deletions docs/tutorials/tutorial3.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ Mobility can be provided from a NS2 file or by including mobility commands in a

Below is the list of files used for this tutorial.

* movements1.txt - a NS2 mobility input file
* scenario.xml - 3 node CORE xml scenario file (wireless)
* scenario.py - 3 node CORE gRPC python script (wireless)
* printout.py - event listener
* NS2 mobility input file
* /opt/core/share/tutorials/tutorial3/movements1.txt
* 3 node CORE xml scenario file (wireless)
* /opt/core/share/tutorials/tutorial3/scenario.xml
* 3 node CORE gRPC python script (wireless)
* /opt/core/share/tutorials/tutorial3/scenario.py
* event listener
* /opt/core/share/tutorials/tutorial3/printout.py

## Running with XML file using NS2 Movement

Expand Down
9 changes: 6 additions & 3 deletions docs/tutorials/tutorial4.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ A directory is used for containing your tests. Within this directory we need a
**conftest.py**, which pytest will pick up to help define and provide
test fixtures, which will be leveraged within our tests.

* tests
* conftest.py - file used by pytest to define fixtures, which can be shared across tests
* test_ping.py - defines test classes/functions to run
* tests directory
* /opt/core/share/tutorials/tutorial4/tests
* file used by pytest to define fixtures, which can be shared across tests
* /opt/core/share/tutorials/tutorial4/conftest.py
* defines test classes/functions to run
* /opt/core/share/tutorials/tutorial4/test_ping.py

## Test Fixtures

Expand Down
9 changes: 6 additions & 3 deletions docs/tutorials/tutorial5.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ This tutorial will cover connecting CORE VM to a Windows host machine using a RJ

Below is the list of files used for this tutorial.

* scenario.xml - the scenario with RJ45 unassigned
* scenario.py- grpc script to create the RJ45 in simple CORE scenario
* client_for_windows.py - chat app client modified for windows
* the scenario with RJ45 unassigned
* /opt/core/share/tutorials/tutorial5/scenario.xml
* grpc script to create the RJ45 in simple CORE scenario
* /opt/core/share/tutorials/tutorial5/scenario.py
* chat app client modified for windows
* /opt/core/share/tutorials/tutorial5/client_for_windows.py

## Running with the Saved XML File

Expand Down
12 changes: 8 additions & 4 deletions docs/tutorials/tutorial6.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ This tutorial will cover changing the node icons, changing the background, and c

Below is the list of files used for this tutorial.

* drone.png - icon for a drone
* demo.py - a mobility script for a node
* terrain.png - a background
* completed-scenario.xml - the scenario after making all changes below
* a mobility script for a node
* /opt/core/share/tutorials/tutorial6/demo.py
* drone icon
* /opt/core/share/tutorials/tutorial6/drone.png
* background image
* /opt/core/share/tutorials/tutorial6/terrain.png
* the scenario after making all changes below
* /opt/core/share/tutorials/tutorial6/completed-scenario.xml

## Running this Tutorial

Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/tutorial7.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ For more detailed information on EMANE see the following:
Below is a list of the files used for this tutorial.

* 2 node EMANE ieee80211abg scenario
* scenario.xml
* scenario.py
* /opt/core/share/tutorials/tutorial7/scenario.xml
* /opt/core/share/tutorials/tutorial7/scenario.py
* 2 node EMANE ieee80211abg scenario, with **n2** running the "Chat App Server" service
* scenario_service.xml
* scenario_service.py
* /opt/core/share/tutorials/tutorial7/scenario_service.xml
* /opt/core/share/tutorials/tutorial7/scenario_service.py

## Running this Tutorial

Expand Down

0 comments on commit 6ebda61

Please sign in to comment.