Skip to content

Commit bd7bf83

Browse files
committed
feat: add ot-sim image
1 parent 2e1e1c7 commit bd7bf83

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

.github/workflows/image-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
vyos,
3232
minirouter,
3333
ubuntu-soaptools,
34+
ot-sim
3435
]
3536
runs-on: ubuntu-latest
3637
steps:
@@ -124,6 +125,7 @@ jobs:
124125
vyos,
125126
minirouter,
126127
ubuntu-soaptools,
128+
ot-sim
127129
]
128130
# Only run on main branch for scheduled or manual workflow_dispatch events
129131
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help check_clean bookworm kali kali-harmonie jammy noble bennu minirouter _minirouter_img docker-hello-world ntp ubuntu-soaptools clean
1+
.PHONY: help check_clean bookworm kali kali-harmonie jammy noble bennu minirouter _minirouter_img docker-hello-world ntp ubuntu-soaptools clean ot-sim
22

33
.ONESHELL: # for heredoc and exit
44

@@ -77,6 +77,13 @@ docker-hello-world:
7777
@$(PHENIX) image create -T $(CURDIR)/scripts/atomic/docker.sh $(UBUNTU_MIRROR) $(COMPRESS) $(@)
7878
@$(PHENIX_IMAGE_BUILD) $(@)
7979

80+
# Build ot-sim.qc2 -- Ubuntu Focal, OTSim, Pandas,
81+
ot-sim:
82+
@$(CHECK_IMAGE)
83+
@$(PHENIX) image create -r focal -T $(CURDIR)/scripts/ot-sim.sh $(UBUNTU_MIRROR) $(COMPRESS) $(@)
84+
@$(PHENIX_IMAGE_BUILD) $(@)
85+
@$(INJECT_MINICCC)
86+
8087
# Build ntp.qc2 -- Ubuntu Jammy, ntpd
8188
ntp:
8289
@$(CHECK_IMAGE)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,4 @@ the Makefile are shown below.
177177
| minirouter | Ubuntu / noble | miniccc/minirouter | Minimega-based router | :x: |
178178
| soaptools | Ubuntu / jammy | filebeat,zeek,msf | preconfigured image for the [soap-hil topology](https://github.com/sandialabs/sceptre-phenix-topologies/tree/main/soap-hil) | :white_check_mark: |
179179
| kali-harmonie | Kali / kali-rolling | Scapy, pybind11, HELICS, pyOpenDNP3, elasticsearch-py | Kali Linux image for the HARMONIE-SPS LDRD. | :white_check_mark: |
180+
| OT-Sim | Ubuntu / focal | OT-Sim, PyPower, Pandas, pyOpenDNP3, HELICS | Ubuntu image for OT-SIM and Panda Power projects | :x: |

scripts/ot-sim.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
set -ex
2+
3+
export LC_ALL=C
4+
export DEBIAN_FRONTEND=noninteractive
5+
export PIP_DISABLE_PIP_VERSION_CHECK=1
6+
7+
# Set timezone information
8+
ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime
9+
10+
apt-get install -y apt-utils
11+
12+
# Install Man Pages
13+
apt-get install -y man-db manpages-dev
14+
15+
# Install the OT-Sim/PandaPower APT Requirements
16+
apt-get install -y python3 python3-pip python2.7-dev python3-setuptools build-essential cmake libboost-dev libczmq-dev libxml2-dev libzmq5-dev pkg-config python3-dev python3-pip software-properties-common git
17+
18+
# Install Go lang 1.21.8
19+
wget -O go.tgz https://golang.org/dl/go1.21.8.linux-amd64.tar.gz && tar -C /usr/local -xzf go.tgz && rm go.tgz && ln -s /usr/local/go/bin/* /usr/local/bin
20+
21+
# Make move to /opt and git clone the ot-sim project
22+
cd /opt
23+
git clone https://github.com/patsec/ot-sim.git
24+
25+
# Move into ot-sim
26+
cd /opt/ot-sim
27+
28+
# Compile OT Sim
29+
cmake -S . -B build && sudo cmake --build build -j$(nproc) --target install && sudo ldconfig && sudo make -C src/go install
30+
31+
# Compile OT Sim Python
32+
sudo python3 -m pip install src/python
33+
34+
# Install Hivemind
35+
wget -O hivemind.gz https://github.com/DarthSim/hivemind/releases/download/v1.1.0/hivemind-v1.1.0-linux-amd64.gz
36+
gunzip hivemind.gz
37+
sudo mv hivemind /usr/local/bin/hivemind
38+
sudo chmod +x /usr/local/bin/hivemind
39+
40+
# Install MBPoll
41+
wget -O- http://www.piduino.org/piduino-key.asc | sudo apt-key add -
42+
sudo add-apt-repository 'deb http://apt.piduino.org xenial piduino'
43+
sudo apt update
44+
sudo apt install mbpoll -y
45+
46+
# Install OpenDSS
47+
sudo python3 -m pip install opendssdirect.py~=0.8.4
48+
49+
# Install PandaPower Requirements
50+
sudo python3 -m pip install pandapower==2.14.11
51+
sudo python3 -m pip install pandas==2.0.3
52+
sudo python3 -m pip install numba==0.58.1
53+
54+
# Change root password
55+
echo "root:SiaSd3te" | chpasswd
56+
57+
# Add "sceptre" user set their login shell to bash
58+
adduser sceptre --UID 1001 --gecos "" --shell /bin/bash --disabled-login || true
59+
echo "sceptre:sceptre" | chpasswd
60+
61+
#Ensure /etc is owned by root
62+
chown -R root:root /etc
63+
64+
## Clean APT install
65+
apt-get -y clean || true

0 commit comments

Comments
 (0)