Skip to content

Commit

Permalink
[nos3#267] Creation of two new scripts and adjustment of the Makefile…
Browse files Browse the repository at this point in the history
… to allow for running the gsw alone on a VM
  • Loading branch information
Isgaroth-the-Green committed Aug 15, 2024
1 parent fc47c0e commit c09268c
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ build-sim:
cd $(SIMBUILDDIR) && cmake -DCMAKE_INSTALL_PREFIX=$(SIMBUILDDIR) ..
$(MAKE) --no-print-directory -C $(SIMBUILDDIR) install

build-test:
mkdir -p $(FSWBUILDDIR)
cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) -DENABLE_UNIT_TESTS=true ../cfe
$(MAKE) --no-print-directory -C $(FSWBUILDDIR) mission-install

checkout:
./scripts/docker_checkout.sh

Expand Down Expand Up @@ -96,6 +91,9 @@ debug:
fsw:
./scripts/docker_build_fsw.sh

fsw-launch:
./scripts/launch_fsw.sh

gsw:
./scripts/docker_build_cryptolib.sh
./cfg/build/gsw_build.sh
Expand All @@ -109,22 +107,25 @@ log:
prep:
./scripts/prepare.sh

prep-gsw:
./scripts/gsw_startup.sh

real-clean:
$(MAKE) clean
./scripts/real_clean.sh

sim:
./scripts/docker_build_sim.sh

start-gsw:
./scripts/docker_launch_gsw.sh

stop:
./scripts/docker_stop.sh
./scripts/stop.sh

stop-gsw:
./scripts/stop_gsw.sh

test-fsw:
cd $(FSWBUILDDIR)/amd64-posix/default_cpu1 && ctest -O ctest.log

igniter:
./scripts/igniter_launch.sh
87 changes: 87 additions & 0 deletions scripts/docker_launch_gsw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash -i
#
# Convenience script for NOS3 development
# Use with the Dockerfile in the deployment repository
# https://github.com/nasa-itc/deployment
#

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/env.sh

# Check that local NOS3 directory exists
if [ ! -d $USER_NOS3_DIR ]; then
echo ""
echo " Need to run make prep first!"
echo ""
exit 1
fi

# Check that configure build directory exists
if [ ! -d $BASE_DIR/cfg/build ]; then
echo ""
echo " Need to run make config first!"
echo ""
exit 1
fi

echo "Make data folders..."
# FSW Side
mkdir $FSW_DIR/data 2> /dev/null
mkdir $FSW_DIR/data/cam 2> /dev/null
mkdir $FSW_DIR/data/evs 2> /dev/null
mkdir $FSW_DIR/data/hk 2> /dev/null
mkdir $FSW_DIR/data/inst 2> /dev/null
# GSW Side
mkdir /tmp/nos3 2> /dev/null
mkdir /tmp/nos3/data 2> /dev/null
mkdir /tmp/nos3/data/cam 2> /dev/null
mkdir /tmp/nos3/data/evs 2> /dev/null
mkdir /tmp/nos3/data/hk 2> /dev/null
mkdir /tmp/nos3/data/inst 2> /dev/null
mkdir /tmp/nos3/uplink 2> /dev/null
cp $BASE_DIR/fsw/build/exe/cpu1/cf/cfe_es_startup.scr /tmp/nos3/uplink/tmp0.so 2> /dev/null
cp $BASE_DIR/fsw/build/exe/cpu1/cf/sample.so /tmp/nos3/uplink/tmp1.so 2> /dev/null

echo "Create networks..."
$DNETWORK create \
--driver=overlay \
--subnet=192.168.41.0/24 \
--gateway=192.168.41.1 \
--attachable \
nos3_core


echo "Launch GSW..."
$BASE_DIR/cfg/build/gsw_launch.sh
echo ""

# Note only currently working with a single spacecraft
export SATNUM=1

#
# Spacecraft Loop
#
for (( i=1; i<=$SATNUM; i++ ))
do
export SC_NUM="sc_"$i
export SC_NETNAME="nos3_"$SC_NUM
export SC_CFG_FILE="-f nos3-simulator.xml" #"-f sc_"$i"_nos3_simulator.xml"

$DNETWORK create \
--driver=overlay \
--attachable \
$SC_NETNAME

# Debugging
#echo "Spacecraft number = " $SC_NUM
#echo "Spacecraft network = " $SC_NETNAME
#echo "Spacecraft configuration = " $SC_CFG_FILE

echo $SC_NUM " - Connect COSMOS to spacecraft network..."
$DNETWORK connect $SC_NETNAME cosmos_openc3-operator_1 --alias cosmos
echo ""

echo ""
done

echo "Docker launch script completed!"
15 changes: 15 additions & 0 deletions scripts/gsw_startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

sudo ip addr add 10.10.10.100 dev eth1
sudo ip route add default via 10.10.10.100 dev eth1

# The next thing to do is to 'create' a docker swarm. Swarm containers are not
# necessary here, but to connect the two computers it is necessary to run
# docker swarm init on the main computer (which I have been using as the gsw
# machine); then "docker swarm join" must be run on the satellite machine.
#
# The successful output of "docker swarm init" will give the command which must
# be run on the satellite VM.

docker swarm init --advertise-addr 10.10.10.100

0 comments on commit c09268c

Please sign in to comment.