Merge branch 'develop' into coredev-painttool
This commit is contained in:
commit
9a506fc35f
9 changed files with 114 additions and 83 deletions
|
@ -5,7 +5,7 @@ verify_ssl = true
|
||||||
|
|
||||||
[scripts]
|
[scripts]
|
||||||
core = "python scripts/core-daemon -f data/core.conf -l data/logging.conf"
|
core = "python scripts/core-daemon -f data/core.conf -l data/logging.conf"
|
||||||
coretk = "python core/gui/app.py"
|
coretk = "python scripts/coretk-gui"
|
||||||
test = "pytest -v tests"
|
test = "pytest -v tests"
|
||||||
test-mock = "pytest -v --mock tests"
|
test-mock = "pytest -v --mock tests"
|
||||||
test-emane = "pytest -v tests/emane"
|
test-emane = "pytest -v tests/emane"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import logging
|
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
|
||||||
|
@ -96,12 +95,3 @@ class Application(tk.Frame):
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.master.destroy()
|
self.master.destroy()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
log_format = "%(asctime)s - %(levelname)s - %(module)s:%(funcName)s - %(message)s"
|
|
||||||
logging.basicConfig(level=logging.DEBUG, format=log_format)
|
|
||||||
Images.load_all()
|
|
||||||
appconfig.check_directory()
|
|
||||||
app = Application()
|
|
||||||
app.mainloop()
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
return
|
return
|
||||||
|
|
||||||
# edge dst must be a node
|
# edge dst must be a node
|
||||||
logging.debug(f"current selected: {self.selected}")
|
logging.debug("current selected: %s", self.selected)
|
||||||
dst_node = self.nodes.get(self.selected)
|
dst_node = self.nodes.get(self.selected)
|
||||||
if not dst_node:
|
if not dst_node:
|
||||||
edge.delete()
|
edge.delete()
|
||||||
|
@ -634,7 +634,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
selected = self.get_selected(event)
|
selected = self.get_selected(event)
|
||||||
canvas_node = self.nodes.get(selected)
|
canvas_node = self.nodes.get(selected)
|
||||||
if canvas_node:
|
if canvas_node:
|
||||||
logging.debug(f"node context: {selected}")
|
logging.debug("node context: %s", selected)
|
||||||
self.context = canvas_node.create_context()
|
self.context = canvas_node.create_context()
|
||||||
self.context.post(event.x_root, event.y_root)
|
self.context.post(event.x_root, event.y_root)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -4,13 +4,13 @@ Information on how Docker can be leveraged and included to create
|
||||||
nodes based on Docker containers and images to interface with
|
nodes based on Docker containers and images to interface with
|
||||||
existing CORE nodes, when needed.
|
existing CORE nodes, when needed.
|
||||||
|
|
||||||
# Installation
|
## Installation
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apt install docker.io
|
sudo apt install docker.io
|
||||||
```
|
```
|
||||||
|
|
||||||
# Configuration
|
## Configuration
|
||||||
|
|
||||||
Custom configuration required to avoid iptable rules being added and removing
|
Custom configuration required to avoid iptable rules being added and removing
|
||||||
the need for the default docker network, since core will be orchestrating
|
the need for the default docker network, since core will be orchestrating
|
||||||
|
@ -19,12 +19,28 @@ connections between nodes.
|
||||||
Place the file below in **/etc/docker/**
|
Place the file below in **/etc/docker/**
|
||||||
* daemon.json
|
* daemon.json
|
||||||
|
|
||||||
# Tools and Versions Tested With
|
## Group Setup
|
||||||
|
|
||||||
|
To use Docker nodes within the python GUI, you will need to make sure the user running the GUI is a member of the
|
||||||
|
docker group.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# add group if does not exist
|
||||||
|
sudo groupadd docker
|
||||||
|
|
||||||
|
# add user to group
|
||||||
|
sudo usermod -aG docker $USER
|
||||||
|
|
||||||
|
# to get this change to take effect, log out and back in or run the following
|
||||||
|
newgrp docker
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tools and Versions Tested With
|
||||||
|
|
||||||
* Docker version 18.09.5, build e8ff056
|
* Docker version 18.09.5, build e8ff056
|
||||||
* nsenter from util-linux 2.31.1
|
* nsenter from util-linux 2.31.1
|
||||||
|
|
||||||
# Examples
|
## Examples
|
||||||
|
|
||||||
This directory provides a few small examples creating Docker nodes
|
This directory provides a few small examples creating Docker nodes
|
||||||
and linking them to themselves or with standard CORE nodes.
|
and linking them to themselves or with standard CORE nodes.
|
||||||
|
|
|
@ -4,13 +4,13 @@ Information on how LXD can be leveraged and included to create
|
||||||
nodes based on LXC containers and images to interface with
|
nodes based on LXC containers and images to interface with
|
||||||
existing CORE nodes, when needed.
|
existing CORE nodes, when needed.
|
||||||
|
|
||||||
# Installation
|
## Installation
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo snap install lxd
|
sudo snap install lxd
|
||||||
```
|
```
|
||||||
|
|
||||||
# Configuration
|
## Configuration
|
||||||
|
|
||||||
Initialize LXD and say no to adding a default bridge.
|
Initialize LXD and say no to adding a default bridge.
|
||||||
|
|
||||||
|
@ -18,12 +18,28 @@ Initialize LXD and say no to adding a default bridge.
|
||||||
sudo lxd init
|
sudo lxd init
|
||||||
```
|
```
|
||||||
|
|
||||||
# Tools and Versions Tested With
|
## Group Setup
|
||||||
|
|
||||||
|
To use LXC nodes within the python GUI, you will need to make sure the user running the GUI is a member of the
|
||||||
|
lxd group.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# add group if does not exist
|
||||||
|
sudo groupadd lxd
|
||||||
|
|
||||||
|
# add user to group
|
||||||
|
sudo usermod -aG lxd $USER
|
||||||
|
|
||||||
|
# to get this change to take effect, log out and back in or run the following
|
||||||
|
newgrp lxd
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tools and Versions Tested With
|
||||||
|
|
||||||
* LXD 3.14
|
* LXD 3.14
|
||||||
* nsenter from util-linux 2.31.1
|
* nsenter from util-linux 2.31.1
|
||||||
|
|
||||||
# Examples
|
## Examples
|
||||||
|
|
||||||
This directory provides a few small examples creating LXC nodes
|
This directory provides a few small examples creating LXC nodes
|
||||||
using LXD and linking them to themselves or with standard CORE nodes.
|
using LXD and linking them to themselves or with standard CORE nodes.
|
||||||
|
|
14
daemon/scripts/coretk-gui
Executable file
14
daemon/scripts/coretk-gui
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from core.gui import appconfig
|
||||||
|
from core.gui.app import Application
|
||||||
|
from core.gui.images import Images
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
log_format = "%(asctime)s - %(levelname)s - %(module)s:%(funcName)s - %(message)s"
|
||||||
|
logging.basicConfig(level=logging.DEBUG, format=log_format)
|
||||||
|
Images.load_all()
|
||||||
|
appconfig.check_directory()
|
||||||
|
app = Application()
|
||||||
|
app.mainloop()
|
|
@ -45,7 +45,6 @@ setup(
|
||||||
],
|
],
|
||||||
tests_require=[
|
tests_require=[
|
||||||
"pytest",
|
"pytest",
|
||||||
"mock",
|
|
||||||
],
|
],
|
||||||
data_files=data_files,
|
data_files=data_files,
|
||||||
scripts=glob.glob("scripts/*"),
|
scripts=glob.glob("scripts/*"),
|
||||||
|
|
|
@ -10,7 +10,6 @@ Current development focuses on the Python modules and daemon. Here is a brief de
|
||||||
|
|
||||||
| Directory | Description |
|
| Directory | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
|corefx|JavaFX based GUI using gRPC API to replace legacy GUI|
|
|
||||||
|daemon|Python CORE daemon code that handles receiving API calls and creating containers|
|
|daemon|Python CORE daemon code that handles receiving API calls and creating containers|
|
||||||
|docs|Markdown Documentation currently hosted on GitHub|
|
|docs|Markdown Documentation currently hosted on GitHub|
|
||||||
|gui|Tcl/Tk GUI|
|
|gui|Tcl/Tk GUI|
|
||||||
|
@ -24,6 +23,13 @@ Current development focuses on the Python modules and daemon. Here is a brief de
|
||||||
Overview for setting up the pipenv environment, building core, installing the GUI and netns, then running
|
Overview for setting up the pipenv environment, building core, installing the GUI and netns, then running
|
||||||
the core-daemon for development.
|
the core-daemon for development.
|
||||||
|
|
||||||
|
### Clone CORE Repo
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/coreemu/core.git
|
||||||
|
cd core
|
||||||
|
```
|
||||||
|
|
||||||
### Setup Python Environment
|
### Setup Python Environment
|
||||||
|
|
||||||
To leverage the dev environment you need python 3.6+.
|
To leverage the dev environment you need python 3.6+.
|
||||||
|
@ -40,14 +46,13 @@ pip3 install pipenv
|
||||||
|
|
||||||
# setup a virtual environment and install all required development dependencies
|
# setup a virtual environment and install all required development dependencies
|
||||||
python3 -m pipenv install --dev
|
python3 -m pipenv install --dev
|
||||||
|
|
||||||
# setup python variable using pipenv created python
|
|
||||||
export PYTHON=$(python3 -m pipenv --py)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setup pre-commit
|
### Setup pre-commit
|
||||||
|
|
||||||
Install pre-commit hooks to help automate running tool checks against code.
|
Install pre-commit hooks to help automate running tool checks against code. Once installed every time a commit is made
|
||||||
|
python utilities will be ran to check validity of code, potentially failing and backing out the commit. This allows
|
||||||
|
one to review changes being made by tools ro the fix the issue noted. Then add the changes and commit again.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
python3 -m pipenv run pre-commit install
|
python3 -m pipenv run pre-commit install
|
||||||
|
@ -56,11 +61,6 @@ python3 -m pipenv run pre-commit install
|
||||||
### Build CORE
|
### Build CORE
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# clone core
|
|
||||||
git clone https://github.com/coreemu/core.git
|
|
||||||
cd core
|
|
||||||
|
|
||||||
# build core
|
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
|
@ -89,7 +89,7 @@ EMANE bindings are not available through pip, you will need to build and install
|
||||||
```shell
|
```shell
|
||||||
# after building emane above
|
# after building emane above
|
||||||
# ./autogen.sh && ./configure --prefix=/usr && make
|
# ./autogen.sh && ./configure --prefix=/usr && make
|
||||||
python3 -m pipenv install --skip-lock $EMANEREPO/src/python
|
python3 -m pipenv install $EMANEREPO/src/python
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running CORE
|
### Running CORE
|
||||||
|
@ -97,20 +97,16 @@ python3 -m pipenv install --skip-lock $EMANEREPO/src/python
|
||||||
This will run the core-daemon server using the configuration files within the repo.
|
This will run the core-daemon server using the configuration files within the repo.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
python3 -m pipenv run coredev
|
sudo python3 -m pipenv run core
|
||||||
```
|
```
|
||||||
|
|
||||||
## The CORE API
|
### Running CORE Python GUI
|
||||||
|
|
||||||
The CORE API is used between different components of CORE for communication. The GUI communicates with the CORE daemon
|
Must be ran after the daemon above or will fail to connect.
|
||||||
using the API. One emulation server communicates with another using the API. The API also allows other systems to
|
|
||||||
interact with the CORE emulation. The API allows another system to add, remove, or modify nodes and links, and enables
|
|
||||||
executing commands on the emulated systems. Wireless link parameters are updated on-the-fly based on node positions.
|
|
||||||
|
|
||||||
CORE listens on a local TCP port for API messages. The other system could be software running locally or another
|
```shell
|
||||||
machine accessible across the network.
|
python3 -m pipenv run coretk
|
||||||
|
```
|
||||||
The CORE API is currently specified in a separate document, available from the CORE website.
|
|
||||||
|
|
||||||
## Linux Network Namespace Commands
|
## Linux Network Namespace Commands
|
||||||
|
|
||||||
|
@ -169,43 +165,3 @@ tc qdisc show
|
||||||
# view the rules that make the wireless LAN work
|
# view the rules that make the wireless LAN work
|
||||||
ebtables -L
|
ebtables -L
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example Command Usage
|
|
||||||
|
|
||||||
Below is a transcript of creating two emulated nodes and connecting them together with a wired link:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# create node 1 namespace container
|
|
||||||
vnoded -c /tmp/n1.ctl -l /tmp/n1.log -p /tmp/n1.pid
|
|
||||||
# create a virtual Ethernet (veth) pair, installing one end into node 1
|
|
||||||
ip link add name n1.0.1 type veth peer name n1.0
|
|
||||||
ip link set n1.0 netns `cat /tmp/n1.pid`
|
|
||||||
vcmd -c /tmp/n1.ctl -- ip link set lo up
|
|
||||||
vcmd -c /tmp/n1.ctl -- ip link set n1.0 name eth0 up
|
|
||||||
vcmd -c /tmp/n1.ctl -- ip addr add 10.0.0.1/24 dev eth0
|
|
||||||
|
|
||||||
# create node 2 namespace container
|
|
||||||
vnoded -c /tmp/n2.ctl -l /tmp/n2.log -p /tmp/n2.pid
|
|
||||||
# create a virtual Ethernet (veth) pair, installing one end into node 2
|
|
||||||
ip link add name n2.0.1 type veth peer name n2.0
|
|
||||||
ip link set n2.0 netns `cat /tmp/n2.pid`
|
|
||||||
vcmd -c /tmp/n2.ctl -- ip link set lo up
|
|
||||||
vcmd -c /tmp/n2.ctl -- ip link set n2.0 name eth0 up
|
|
||||||
vcmd -c /tmp/n2.ctl -- ip addr add 10.0.0.2/24 eth0
|
|
||||||
|
|
||||||
# bridge together nodes 1 and 2 using the other end of each veth pair
|
|
||||||
brctl addbr b.1.1
|
|
||||||
brctl setfd b.1.1 0
|
|
||||||
brctl addif b.1.1 n1.0.1
|
|
||||||
brctl addif b.1.1 n2.0.1
|
|
||||||
ip link set n1.0.1 up
|
|
||||||
ip link set n2.0.1 up
|
|
||||||
ip link set b.1.1 up
|
|
||||||
|
|
||||||
# display connectivity and ping from node 1 to node 2
|
|
||||||
brctl show
|
|
||||||
vcmd -c /tmp/n1.ctl -- ping 10.0.0.2
|
|
||||||
```
|
|
||||||
|
|
||||||
The above example script can be found as *twonodes.sh* in the *examples/netns* directory. Use *core-cleanup* to clean
|
|
||||||
up after the script.
|
|
||||||
|
|
40
install.sh
Executable file
40
install.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# exit on error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# detect os/ver for install type
|
||||||
|
os=""
|
||||||
|
if [[ -f /etc/os-release ]]; then
|
||||||
|
. /etc/os-release
|
||||||
|
os=${NAME}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check install was found
|
||||||
|
if [[ ${os} == "Ubuntu" ]]; then
|
||||||
|
# install system dependencies
|
||||||
|
sudo apt install -y automake pkg-config gcc libev-dev bridge-utils ebtables \
|
||||||
|
python3.6 python3.6-dev python3-pip python3-tk tk libtk-img ethtool libtool libreadline-dev autoconf
|
||||||
|
|
||||||
|
# install python dependencies
|
||||||
|
sudo python3 -m pip install -r daemon/requirements.txt
|
||||||
|
|
||||||
|
# make and install ospf mdr
|
||||||
|
git clone https://github.com/USNavalResearchLaboratory/ospf-mdr /tmp/ospf-mdr
|
||||||
|
cd /tmp/ospf-mdr
|
||||||
|
./bootstrap.sh
|
||||||
|
./configure --disable-doc --enable-user=root --enable-group=root --with-cflags=-ggdb \
|
||||||
|
--sysconfdir=/usr/local/etc/quagga --enable-vtysh \
|
||||||
|
--localstatedir=/var/run/quagga
|
||||||
|
make -j8
|
||||||
|
sudo make install
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# build and install core
|
||||||
|
./bootstrap.sh
|
||||||
|
./configure
|
||||||
|
make -j8
|
||||||
|
sudo make install
|
||||||
|
else
|
||||||
|
echo "unknown os ${os} cannot install"
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue