From 314eee33f6900a0fa185d0622eb4a3b9dd69142d Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Tue, 15 Mar 2022 14:09:15 -0400 Subject: [PATCH 001/131] frrboot: add fedora sbin path to default Add the Fedora default location for FRR binaries (/usr/libexec/frr/*.) to CORE's frrboot default "sbin" search path Signed-off-by: Gabriel Somlo --- daemon/core/configservices/frrservices/services.py | 2 +- daemon/core/services/frr.py | 2 +- daemon/data/core.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/core/configservices/frrservices/services.py b/daemon/core/configservices/frrservices/services.py index dd2d1f9d..5e6c9948 100644 --- a/daemon/core/configservices/frrservices/services.py +++ b/daemon/core/configservices/frrservices/services.py @@ -89,7 +89,7 @@ class FRRZebra(ConfigService): "frr_bin_search", default="/usr/local/bin /usr/bin /usr/lib/frr" ).strip('"') frr_sbin_search = self.node.session.options.get( - "frr_sbin_search", default="/usr/local/sbin /usr/sbin /usr/lib/frr" + "frr_sbin_search", default="/usr/local/sbin /usr/sbin /usr/lib/frr /usr/libexec/frr" ).strip('"') services = [] diff --git a/daemon/core/services/frr.py b/daemon/core/services/frr.py index 87145d37..c8ad1048 100644 --- a/daemon/core/services/frr.py +++ b/daemon/core/services/frr.py @@ -142,7 +142,7 @@ class FRRZebra(CoreService): "frr_bin_search", '"/usr/local/bin /usr/bin /usr/lib/frr"' ) frr_sbin_search = node.session.options.get( - "frr_sbin_search", '"/usr/local/sbin /usr/sbin /usr/lib/frr"' + "frr_sbin_search", '"/usr/local/sbin /usr/sbin /usr/lib/frr /usr/libexec/frr"' ) cfg = """\ #!/bin/sh diff --git a/daemon/data/core.conf b/daemon/data/core.conf index 874ba567..1923250d 100644 --- a/daemon/data/core.conf +++ b/daemon/data/core.conf @@ -5,7 +5,7 @@ grpcport = 50051 quagga_bin_search = "/usr/local/bin /usr/bin /usr/lib/quagga" quagga_sbin_search = "/usr/local/sbin /usr/sbin /usr/lib/quagga" frr_bin_search = "/usr/local/bin /usr/bin /usr/lib/frr" -frr_sbin_search = "/usr/local/sbin /usr/sbin /usr/lib/frr" +frr_sbin_search = "/usr/local/sbin /usr/sbin /usr/lib/frr /usr/libexec/frr" # uncomment the following line to load custom services from the specified dir # this may be a comma-separated list, and directory names should be unique From 9c4a0fda3266316a50872936b87c999677dc7c0a Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 28 Sep 2022 21:07:51 +0100 Subject: [PATCH 002/131] Dependencies updated --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Dockerfile b/Dockerfile index a116becb..bcc67f18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,32 @@ RUN apt-get update && \ wget \ xauth \ xterm \ + wireshark \ + firefox \ + net-tools \ + rsync \ + openssh-server \ + openssh-client \ + vsftpd \ + atftpd \ + atftp \ + mini-httpd \ + lynx \ + tcpdump \ + wireshark \ + iperf \ + iperf3 \ + tshark \ + openssh-sftp-server \ + bind9 \ + bind9-utils \ + openvpn \ + isc-dhcp-server \ + isc-dhcp-client \ + whois \ + ipcalc \ + socat \ + hping3 \ && apt-get clean # install python dependencies RUN python3 -m pip install \ From 3b22c7038f4f58a82a0985db97665be8c2a870d4 Mon Sep 17 00:00:00 2001 From: Afonso Franco Date: Wed, 28 Sep 2022 20:10:49 +0100 Subject: [PATCH 003/131] Update 'README.md' --- README.md | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 8dbe4e56..1382dc94 100644 --- a/README.md +++ b/README.md @@ -6,33 +6,28 @@ Copyright (c)2005-2022 the Boeing Company. See the LICENSE file included in this distribution. -## About +#DOCKER SETUP -The Common Open Research Emulator (CORE) is a tool for emulating -networks on one or more machines. You can connect these emulated -networks to live networks. CORE consists of a GUI for drawing -topologies of lightweight virtual machines, and Python modules for -scripting network emulation. - -## Quick Start - -The following should get you up and running on Ubuntu 18+ and CentOS 7+ -from a clean install, it will prompt you for sudo password. This would -install CORE into a python3 virtual environment and install -[OSPF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr) from source. -For more detailed installation see [here](https://coreemu.github.io/core/install.html). ```shell -git clone https://github.com/coreemu/core.git -cd core -# install dependencies to run installation task -./setup.sh -# run the following or open a new terminal -source ~/.bashrc -# Ubuntu -inv install -# CentOS -inv install -p /usr +git clone https://gitea.olympuslab.net/afonso/core-extra.git + +cd core-extra + +# build image +sudo docker build -t core . + +# start container +sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged --restart unless-stopped core + +# enable xhost access to the root user +xhost +local:root +# launch core-gui +sudo docker exec -it core core-gui + + +#TO RUN ANY OTHER COMMAND +sudo docker exec -it core COMAND_GOES_HERE ``` ## Documentation & Support From 47ae24ad59fe0edca860786c819f68a8e67255b9 Mon Sep 17 00:00:00 2001 From: Afonso Franco Date: Wed, 28 Sep 2022 20:11:24 +0100 Subject: [PATCH 004/131] Update 'README.md' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1382dc94..7a3cbb5d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Copyright (c)2005-2022 the Boeing Company. See the LICENSE file included in this distribution. -#DOCKER SETUP +# DOCKER SETUP ```shell From 2a7904e2f11dbca2275b6bbb930b02c17b1a142e Mon Sep 17 00:00:00 2001 From: Afonso Franco Date: Wed, 28 Sep 2022 20:31:35 +0100 Subject: [PATCH 005/131] Update 'README.md' --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7a3cbb5d..4b5d3d8b 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,27 @@ sudo docker exec -it core core-gui sudo docker exec -it core COMAND_GOES_HERE ``` -## Documentation & Support +## LICENSE -We are leveraging GitHub hosted documentation and Discord for persistent -chat rooms. This allows for more dynamic conversations and the -capability to respond faster. Feel free to join us at the link below. +Copyright (c) 2005-2018, the Boeing Company. -* [Documentation](https://coreemu.github.io/core/) -* [Discord Channel](https://discord.gg/AKd7kmP) +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file From 33e13e23814d6d83eb99028b77a14a04966e35ab Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 28 Sep 2022 21:18:36 +0100 Subject: [PATCH 006/131] Added firefox dependencies --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bcc67f18..d4c356ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,7 +62,14 @@ RUN apt-get update && \ whois \ ipcalc \ socat \ - hping3 \ + hping3 \ + libgtk-3-0 \ + librest-0.7-0 \ + libgtk-3-common \ + dconf-gsettings-backend \ + libsoup-gnome2.4-1 \ + libsoup2.4-1 \ + dconf-service \ && apt-get clean # install python dependencies RUN python3 -m pip install \ From 7e87ad24fadae8a92458433e3d3920a1525f6d26 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 28 Sep 2022 21:17:16 +0100 Subject: [PATCH 007/131] Added text editors --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index d4c356ad..db4aeff4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,8 @@ RUN apt-get update && \ wget \ xauth \ xterm \ + vim \ + nano \ wireshark \ firefox \ net-tools \ @@ -70,6 +72,7 @@ RUN apt-get update && \ libsoup-gnome2.4-1 \ libsoup2.4-1 \ dconf-service \ + x11-xserver-utils \ && apt-get clean # install python dependencies RUN python3 -m pip install \ From e8f0ce79d5ab680301ea7305423936c819a7c28e Mon Sep 17 00:00:00 2001 From: Afonso Franco Date: Wed, 28 Sep 2022 21:24:35 +0100 Subject: [PATCH 008/131] Update 'README.md' --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b5d3d8b..0aaadc4d 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ git clone https://gitea.olympuslab.net/afonso/core-extra.git cd core-extra # build image -sudo docker build -t core . +sudo docker build -t core-extra . # start container -sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged --restart unless-stopped core +sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged --restart unless-stopped core-extra # enable xhost access to the root user xhost +local:root From 909142b446ff024e6f16ed25569ce7a24f091056 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 28 Sep 2022 22:14:48 +0100 Subject: [PATCH 009/131] Added ftp --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index db4aeff4..14ab1835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,6 +73,7 @@ RUN apt-get update && \ libsoup2.4-1 \ dconf-service \ x11-xserver-utils \ + ftp \ && apt-get clean # install python dependencies RUN python3 -m pip install \ From ee2cdf77162bf4f4aaafac102f3b5443908d3b5e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:58:09 -0700 Subject: [PATCH 010/131] install: updated automated install to place virtual environment to /opt/core/venv to be consistent with new package location --- .gitignore | 1 + tasks.py | 62 ++++++++++++++++++++++++++---------------------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 1a13142d..beb83c13 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ config.h.in config.log config.status configure +configure~ debian stamp-h1 diff --git a/tasks.py b/tasks.py index 0388acc6..d79c2ffd 100644 --- a/tasks.py +++ b/tasks.py @@ -23,6 +23,10 @@ DEBIAN_LIKE = { "ubuntu", "debian", } +SUDOP: str = "sudo -E env PATH=$PATH" +VENV_PATH: str = "/opt/core/venv" +VENV_PYTHON: str = f"{VENV_PATH}/bin/python" +ACTIVATE_VENV: str = f". {VENV_PATH}/bin/activate" class Progress: @@ -118,16 +122,6 @@ def get_env_python_dep() -> str: return os.environ.get("PYTHON_DEP", "python3") -def get_python(c: Context, warn: bool = False) -> str: - with c.cd(DAEMON_DIR): - r = c.run("poetry env info -p", warn=warn, hide=True) - if r.ok: - venv = r.stdout.strip() - return os.path.join(venv, "bin", "python") - else: - return "" - - def get_pytest(c: Context) -> str: with c.cd(DAEMON_DIR): venv = c.run("poetry env info -p", hide=True).stdout.strip() @@ -220,14 +214,15 @@ def install_poetry(c: Context, dev: bool, local: bool, hide: bool) -> None: if local: with c.cd(DAEMON_DIR): c.run("poetry build -f wheel", hide=hide) - c.run(f"sudo {python_bin} -m pip install dist/*") + c.run(f"sudo {python_bin} -m pip install dist/*") else: args = "" if dev else "--no-dev" with c.cd(DAEMON_DIR): - c.run(f"poetry env use {python_bin}", hide=hide) - c.run(f"poetry install {args}", hide=hide) + c.run("sudo mkdir -p /opt/core", hide=hide) + c.run(f"sudo {python_bin} -m venv {VENV_PATH}") + c.run(f"{ACTIVATE_VENV} && {SUDOP} poetry install {args}", hide=hide) if dev: - c.run("poetry run pre-commit install", hide=hide) + c.run(f"{ACTIVATE_VENV} && poetry run pre-commit install", hide=hide) def install_ospf_mdr(c: Context, os_info: OsInfo, hide: bool) -> None: @@ -289,7 +284,6 @@ def install_core_files(c, local=False, verbose=False, prefix=DEFAULT_PREFIX): install core files (scripts, examples, and configuration) """ hide = not verbose - python = get_python(c) bin_dir = Path(prefix).joinpath("bin") # setup core python helper if not local: @@ -297,7 +291,7 @@ def install_core_files(c, local=False, verbose=False, prefix=DEFAULT_PREFIX): temp = NamedTemporaryFile("w", delete=False) temp.writelines([ "#!/bin/bash\n", - f'exec "{python}" "$@"\n', + f'exec "{VENV_PYTHON}" "$@"\n', ]) temp.close() c.run(f"sudo cp {temp.name} {core_python}", hide=hide) @@ -369,8 +363,11 @@ def install( """ install core, poetry, scripts, service, and ospf mdr """ - print(f"installing core locally: {local}") - print(f"installing core with prefix: {prefix}") + python_bin = get_env_python() + venv_path = None if local else VENV_PATH + print( + f"installing core using python({python_bin}) venv({venv_path}) prefix({prefix})" + ) c.run("sudo -v", hide=True) p = Progress(verbose) hide = not verbose @@ -386,8 +383,7 @@ def install( build_core(c, hide, prefix) with p.start("installing vnoded/vcmd"): install_core(c, hide) - install_type = "core" if local else "core virtual environment" - with p.start(f"installing {install_type}"): + with p.start(f"installing core"): install_poetry(c, dev, local, hide) with p.start("installing scripts, examples, and configuration"): install_core_files(c, local, hide, prefix) @@ -472,7 +468,12 @@ def uninstall( """ uninstall core, scripts, service, virtual environment, and clean build directory """ - print(f"uninstalling core with prefix: {prefix}") + python_bin = get_env_python() + venv_path = None if local else VENV_PATH + print( + f"uninstalling core using python({python_bin}) " + f"venv({venv_path}) prefix({prefix})" + ) hide = not verbose p = Progress(verbose) c.run("sudo -v", hide=True) @@ -481,19 +482,16 @@ def uninstall( with p.start("cleaning build directory"): c.run("make clean", hide=hide) c.run("./bootstrap.sh clean", hide=hide) - if local: - with p.start("uninstalling core"): + with p.start(f"uninstalling core"): + if local: python_bin = get_env_python() c.run(f"sudo {python_bin} -m pip uninstall -y core", hide=hide) - else: - python = get_python(c, warn=True) - if python: - with c.cd(DAEMON_DIR): - if dev: - with p.start("uninstalling pre-commit"): - c.run("poetry run pre-commit uninstall", hide=hide) - with p.start("uninstalling poetry virtual environment"): - c.run(f"poetry env remove {python}", hide=hide) + else: + if Path(VENV_PYTHON).is_file(): + with c.cd(DAEMON_DIR): + if dev: + c.run(f"{ACTIVATE_VENV} && poetry run pre-commit uninstall", hide=hide) + c.run(f"sudo {VENV_PYTHON} -m pip uninstall -y core", hide=hide) # remove installed files bin_dir = Path(prefix).joinpath("bin") with p.start("uninstalling examples"): From c067de679265aa573eb422325b0d24aa665877b5 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 7 Oct 2022 12:52:53 -0700 Subject: [PATCH 011/131] docs: updates to install page to cover all install types and PATH issues --- docs/install.md | 301 +++++++++++++++++++++++++----------------------- 1 file changed, 160 insertions(+), 141 deletions(-) diff --git a/docs/install.md b/docs/install.md index cc463b88..baaef729 100644 --- a/docs/install.md +++ b/docs/install.md @@ -2,13 +2,16 @@ * Table of Contents {:toc} -## Overview -CORE provides a script to help automate the installation of dependencies, -build and install, and either generate a CORE specific python virtual environment -or build and install a python wheel. - > **WARNING:** if Docker is installed, the default iptable rules will block CORE traffic +## Overview +CORE currently supports and provides the following install options, with the package +option being preferred. + +* [Package based install (rpm/deb)](#package-based-install) +* [Script based install](#script-based-install) +* [Dockerfile based install](#dockerfile-based-install) + ### Requirements Any computer capable of running Linux should be able to run CORE. Since the physical machine will be hosting numerous containers, as a general rule you should select a machine having as much RAM and CPU resources as possible. @@ -21,52 +24,29 @@ containers, as a general rule you should select a machine having as much RAM and Plan is to support recent Ubuntu and CentOS LTS releases. Verified: -* Ubuntu - 18.04, 20.04 -* CentOS - 7.8, 8.0 - -> **NOTE:** CentOS 8 does not have the netem kernel mod available by default - -CentOS 8 Enabled netem: -```shell -sudo yum update -# restart into updated kernel -sudo yum install -y kernel-modules-extra -sudo modprobe sch_netem -``` - -### Tools Used -The following tools will be leveraged during installation: - -| Tool | Description | -|---------------------------------------------|-----------------------------------------------------------------------| -| [pip](https://pip.pypa.io/en/stable/) | used to install pipx | -| [pipx](https://pipxproject.github.io/pipx/) | used to install standalone python tools (invoke, poetry) | -| [invoke](http://www.pyinvoke.org/) | used to run provided tasks (install, uninstall, reinstall, etc) | -| [poetry](https://python-poetry.org/) | used to install python virtual environment or building a python wheel | +* Ubuntu - 18.04, 20.04, 22.04 +* CentOS - 7.8 ### Files -The following is a list of files that would be installed after running the automated installation. +The following is a list of files that would be installed after installation. -> **NOTE:** the default install prefix is /usr/local, but can be changed as noted below - -* executable files - * `/bin/{core-daemon, core-gui, vcmd, vnoded, etc}` +* executables + * `/bin/{vcmd, vnode}` + * can be adjusted using script based install , package will be /usr * python files - * poetry virtual env - * `cd /daemon && poetry env info` - * `~/.cache/pypoetry/virtualenvs/` - * local python install - * default install path for python3 installation of a wheel + * virtual environment `/opt/core/venv` + * local install will be local to the python version used * `python3 -c "import core; print(core.__file__)"` + * scripts {core-daemon, core-cleanup, etc} + * virtualenv `/opt/core/venv/bin` + * local `/usr/local/bin` * configuration files * `/etc/core/{core.conf, logging.conf}` -* ospf mdr repository files +* ospf mdr repository files when using script based install * `/../ospf-mdr` -* emane repository files - * `/../emane` -### Installed Executables -After the installation complete it will have installed the following scripts. +### Installed Scripts +The following python scripts are provided. | Name | Description | |---------------------|------------------------------------------------------------------------------| @@ -78,7 +58,7 @@ After the installation complete it will have installed the following scripts. | core-route-monitor | tool to help monitor traffic across nodes and feed that to SDT | | core-service-update | tool to update automate modifying a legacy service to match current naming | -## Upgrading from Older Release +### Upgrading from Older Release Please make sure to uninstall any previous installations of CORE cleanly before proceeding to install. @@ -105,72 +85,81 @@ sudo yum remove core sudo apt remove core ``` -## Installing from Packages +## Package Based Install Starting with 9.0.0 there are pre-built rpm/deb packages. You can retrieve the rpm/deb package from [releases](https://github.com/coreemu/core/releases) page. -> **NOTE:** PYTHON defaults to python3 for installs below +The built packages will require and install system level dependencies, as well as running +a post install script to install the provided CORE python wheel. A similar uninstall script +is ran when uninstalling and would require the same options as given, during the install. -> **NOTE:** the python install requires python3.6+, pip, -> tk compatibility for python gui, and venv for virtualenvs +> **NOTE:** PYTHON defaults to python3 for installs below, CORE requires python3.6+, pip, +> tk compatibility for python gui, and venv for virtual environments +Examples for install: ```shell # recommended to upgrade to the latest version of pip before installation # in python, can help avoid building from source issues - -m pip install --upgrade pip - -# install core vcmd/vnoded, system dependencies, +sudo -m pip install --upgrade pip +# install vcmd/vnoded, system dependencies, # and core python into a venv located at /opt/core/venv - install -y ./ - +sudo install -y ./ # disable the venv and install to python directly -NO_VENV=1 install -y ./ - -# change python executable used to install for venv and direct installations -PYTHON=python3.9 install -y ./ - +sudo NO_VENV=1 install -y ./ +# change python executable used to install for venv or direct installations +sudo PYTHON=python3.9 install -y ./ # disable venv and change python executable -NO_VENV=1 PYTHON=python3.9 install -y ./ - +sudo NO_VENV=1 PYTHON=python3.9 install -y ./ # skip installing the python portion entirely, as you plan to carry this out yourself # core python wheel is located at /opt/core/core--py3-none-any.whl -NO_PYTHON=1 install -y ./ - +sudo NO_PYTHON=1 install -y ./ # install python wheel into python of your choosing - -m pip install /opt/core/core--py3-none-any.whl +sudo -m pip install /opt/core/core--py3-none-any.whl ``` -## Automated Install -First we will need to clone and navigate to the CORE repo. +Example for removal, requires using the same options as install: ```shell -# clone CORE repo -git clone https://github.com/coreemu/core.git -cd core -# install dependencies to run installation task -./setup.sh -# run the following or open a new terminal -source ~/.bashrc -# Ubuntu -inv install -# CentOS -inv install -p /usr +# remove a standard install +sudo remove core +# remove a local install +sudo NO_VENV=1 remove core +# remove install using alternative python +sudo PYTHON=python3.9 remove core +# remove install using alternative python and local install +sudo NO_VENV=1 PYTHON=python3.9 remove core +# remove install and skip python uninstall +sudo NO_PYTHON=1 remove core ``` -First you can use `setup.sh` as a convenience to install tooling for running invoke tasks: +### Installing OSPF MDR +You will need to manually install OSPF MDR for routing nodes, since this is not +provided by the package. -> **NOTE:** `setup.sh` will attempt to determine your OS by way of `/etc/os-release`, currently it supports -> attempts to install OSs that are debian/redhat like (yum/apt). +```shell +git clone https://github.com/USNavalResearchLaboratory/ospf-mdr.git +cd 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 -j$(nproc) +sudo make install +``` -* python3, pip, venv -* pipx 0.16.4 via pip -* invoke 1.4.1 via pipx -* poetry 1.1.12 via pipx +When done see [Post Install](#post-install). -Then you can run `inv install `: +## Script Based Install +The script based installation will install system level dependencies, python library and +dependencies, as well as dependencies for building CORE. + +The script based install also automatically builds and installs OSPF MDR, used by default +on routing nodes. This can optionally be skipped. + +Installaion will carry out the following steps: * installs system dependencies for building core +* builds vcmd/vnoded and python grpc files * installs core into poetry managed virtual environment or locally, if flag is passed -* installs scripts pointing to appropriate python location based on install type * installs systemd service pointing to appropriate python location based on install type * clone/build/install working version of [OPSF MDR](https://github.com/USNavalResearchLaboratory/ospf-mdr) @@ -180,9 +169,39 @@ Then you can run `inv install `: > **NOTE:** provide a prefix that will be found on path when running as sudo, > if the default prefix /usr/local will not be valid -```shell -inv -h install +The following tools will be leveraged during installation: +| Tool | Description | +|---------------------------------------------|-----------------------------------------------------------------------| +| [pip](https://pip.pypa.io/en/stable/) | used to install pipx | +| [pipx](https://pipxproject.github.io/pipx/) | used to install standalone python tools (invoke, poetry) | +| [invoke](http://www.pyinvoke.org/) | used to run provided tasks (install, uninstall, reinstall, etc) | +| [poetry](https://python-poetry.org/) | used to install python virtual environment or building a python wheel | + +First we will need to clone and navigate to the CORE repo. +```shell +# clone CORE repo +git clone https://github.com/coreemu/core.git +cd core + +# install dependencies to run installation task +./setup.sh +# skip installing system packages, due to using python built from source +NO_SYSTEM=1 ./setup.sh + +# run the following or open a new terminal +source ~/.bashrc + +# Ubuntu +inv install +# CentOS +inv install -p /usr +# optionally skip python system packages +inv install --no-python +# optionally skip installing ospf mdr +inv install --no-ospf + +# install command options Usage: inv[oke] [--core-opts] install [--options] [other tasks here ...] Docstring: @@ -192,45 +211,13 @@ Options: -d, --dev install development mode -i STRING, --install-type=STRING used to force an install type, can be one of the following (redhat, debian) -l, --local determines if core will install to local system, default is False + -n, --no-python avoid installing python system dependencies -o, --[no-]ospf disable ospf installation -p STRING, --prefix=STRING prefix where scripts are installed, default is /usr/local - -v, --verbose enable verbose - -# install core to virtual environment -./install.sh -p - -# install core locally -./install.sh -p -l + -v, --verbose ``` -After installation has completed you should be able to run `core-daemon` and `core-gui`. - -## Using Invoke Tasks -The invoke tool installed by way of pipx provides conveniences for running -CORE tasks to help ensure usage of the create python virtual environment. - -```shell -inv --list - -Available tasks: - - install install core, poetry, scripts, service, and ospf mdr - install-emane install emane python bindings into the core virtual environment - reinstall run the uninstall task, get latest from specified branch, and run install task - test run core tests - test-emane run core emane tests - test-mock run core tests using mock to avoid running as sudo - uninstall uninstall core, scripts, service, virtual environment, and clean build directory -``` - -### Enabling Service -After installation, the core service is not enabled by default. If you desire to use the -service, run the following commands. - -```shell -sudo systemctl enable core-daemon -sudo systemctl start core-daemon -``` +When done see [Post Install](#post-install). ### Unsupported Linux Distribution For unsupported OSs you could attempt to do the following to translate @@ -246,39 +233,27 @@ an installation to your use case. inv install --dry -v -p -i ``` -## Dockerfile Install -You can leverage the provided Dockerfile, to run and launch CORE within a Docker container. +## Dockerfile Based Install +You can leverage one of the provided Dockerfiles, to run and launch CORE within a Docker container. + +Since CORE nodes will leverage software available within the system for a given use case, +make sure to update and build the Dockerfile with desired software. ```shell # clone core git clone https://github.com/coreemu/core.git cd core # build image -sudo docker build -t core. -f Dockerfile. . +sudo docker build -t core -f Dockerfile. . # start container -sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged core. +sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged core # enable xhost access to the root user xhost +local:root # launch core-gui sudo docker exec -it core core-gui ``` -## Running User Scripts -If you create your own python scripts to run CORE directly or using the gRPC -APIs you will need to make sure you are running them within context of the -installed virtual environment. To help support this CORE provides the `core-python` -executable. This executable will allow you to enter CORE's python virtual -environment interpreter or to run a script within it. - -For installations installed to a virtual environment: -```shell -core-python