Skip to content

Commit 3b5d8ef

Browse files
author
Chris Johnson
committed
Merge branch 'master' of github.com:Seneca-CDOT/simengine
2 parents d0586e5 + 14d98e0 commit 3b5d8ef

3 files changed

Lines changed: 226 additions & 1 deletion

File tree

docs/AnvilModel.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Anvil Model
2+
3+
Simengine can support various topology layouts; In this section we will attempt to model [alteeve’s](https://www.alteeve.com/c/) high-availability system called *Anvil* which consists of 2 striker dashboard machines, 2 target servers with IPMI interface, 2 PDUs, 2 Switches and 2 UPSes. High-level system map can be found on alteeve’s wiki [page](https://www.alteeve.com/w/Build_an_m2_Anvil!#Logical_Map.3B_Hardware_And_Plumbing).
4+
5+
This table summarises the general layout of the `simengine` system model we are going to configure:
6+
7+
| **key** | **Name** | **Type** | **Interface** |
8+
| ------- | ------------ | ---------- | ---------------------------------------------------- |
9+
| 1 | outlet-1 | outlet | |
10+
| 2 | outlet-2 | outlet | |
11+
| 3 | ups01 | ups | SNMP → reachable at 192.168.124.3 (default port 161) |
12+
| 4 | ups02 | ups | SNMP → reachable at 192.168.124.4 |
13+
| 5 | pdu01 | pdu | SNMP → reachable at 192.168.124.5 |
14+
| 6 | pdu02 | pdu | SNMP → reachable at 192.168.124.3 |
15+
| 7 | an-a01n01 | server-bmc | IPMI → reachable at localhost:9001 (or from the VM) |
16+
| 8 | an-a01n02 | server-bmc | IPMI → reachable at localhost:9101 (or from the VM) |
17+
| 9 | an-striker01 | server | |
18+
| 10 | an-striker02 | server | |
19+
20+
4 VMs will be running so the host machine should preferably have more than 4 cores.
21+
22+
23+
![](https://d2mxuefqeaa7sj.cloudfront.net/s_C5C75BF29B870479D1EC95201C69BB583A74A130BB1FC9890A125939ED904715_1534526372651_Screenshot+from+2018-08-17+13-15-48.png)
24+
25+
26+
27+
# Setup
28+
## Network Configuration
29+
30+
We will need to allocate IP addresses for the SNMP simulators on the host machine (machine that will run `simengine`). In this example, we will temporarily add IP addresses to the existing `enp4s0` interface:
31+
32+
33+
sudo ip addr add dev enp4s0 192.168.124.3/24 # UPS 1
34+
sudo ip addr add dev enp4s0 192.168.124.4/24 # UPS 2
35+
sudo ip addr add dev enp4s0 192.168.124.5/24 # PDU 1
36+
sudo ip addr add dev enp4s0 192.168.124.6/24 # PDU 2
37+
38+
**Note** that you may need to re-configure your firewall and expose port 161 to the striker systems.
39+
40+
## VM
41+
42+
4 VMs will be managed by the simulation engine — `an-a01n01` & `an-a01n02` will be running Fedora 28 and striker dashboards (`an-striker01` & `an-striker02`) will be hosted on CentOS-based system.
43+
44+
The installation of the VMs plus minor setup need to be performed prior to the system modelling stage.
45+
46+
**BMC**
47+
48+
Since 2 VMs ( `an-a01n01` & `an-a01n02` ) will support BMC/IPMI interface, we will need to have lanplus interface and qemu options configured;
49+
50+
Once you install the target operating systems, shut down the VMs and configure `.xml` args as following:
51+
52+
**an-a01n01**
53+
54+
Update `.xml` configurations:
55+
56+
`sudo virsh edit an-a01n01`
57+
58+
You will need to change the top-level tag to `<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>` and also add `qemu` command line arguments (after `</devices>`):
59+
60+
61+
<qemu:commandline>
62+
<qemu:arg value='-chardev'/>
63+
<qemu:arg value='socket,id=ipmi0,host=localhost,port=9002,reconnect=10'/>
64+
<qemu:arg value='-device'/>
65+
<qemu:arg value='ipmi-bmc-extern,id=bmc0,chardev=ipmi0'/>
66+
<qemu:arg value='-device'/>
67+
<qemu:arg value='isa-ipmi-bt,bmc=bmc0'/>
68+
<qemu:arg value='-serial'/>
69+
<qemu:arg value='mon:tcp::9012,server,telnet,nowait'/>
70+
</qemu:commandline>
71+
72+
**an-a01n02**
73+
74+
Almost identical steps need to be performed for the second VM (note that ipmi socket is assigned a different port this time `port=9102` which we will later pass as one of the command line arguments to `simengine-cli`).
75+
76+
`sudo virsh edit an-a01n02`
77+
78+
Change the top-level tag to `<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>` , add `qemu` command line arguments (after `</devices>`) as following:
79+
80+
81+
<qemu:commandline>
82+
<qemu:arg value='-chardev'/>
83+
<qemu:arg value='socket,id=ipmi0,host=localhost,port=9102,reconnect=10'/>
84+
<qemu:arg value='-device'/>
85+
<qemu:arg value='ipmi-bmc-extern,id=bmc0,chardev=ipmi0'/>
86+
<qemu:arg value='-device'/>
87+
<qemu:arg value='isa-ipmi-bt,bmc=bmc0'/>
88+
<qemu:arg value='-serial'/>
89+
<qemu:arg value='mon:tcp::9012,server,telnet,nowait'/>
90+
</qemu:commandline>
91+
# System Model
92+
93+
At this stage, we should be ready to model our HA topology. You will need to drop the existing model in case the data store is not empty:
94+
95+
`simengine-cli model drop`
96+
97+
And pause the engine daemon:
98+
99+
`sudo systemctl stop simengine-core`
100+
101+
Running the source code below should re-create the Anvil topology; `model create` will add new assets to the data store & `model power-link` will link assets together:
102+
103+
104+
105+
# Create 2 outlets, one powers 'an-ups01' another one powers 'an-ups02'
106+
simengine-cli model create outlet --asset-key=1
107+
simengine-cli model create outlet -k2
108+
109+
# Add 2 UPSs
110+
simengine-cli model create ups -k=3 --name=an-ups01 --host=192.168.124.3 --port=161
111+
simengine-cli model create ups -k=4 --name=an-ups02 --host=192.168.124.4 --port=161
112+
113+
# Create 2 PDUs
114+
simengine-cli model create pdu -k=5 -n=an-pdu01 --host=192.168.124.5 --port=161
115+
simengine-cli model create pdu -k=6 -n=an-pdu02 --host=192.168.124.6 --port=161
116+
117+
# Add 2 Servers
118+
simengine-cli model create server-bmc -k=7 --domain-name=an-a01n01 --power-consumption=360 --psu-num=2 --psu-load 0.5 0.5
119+
simengine-cli model create server-bmc -k=8 --domain-name=an-a01n02 --power-consumption=360 --psu-num=2 --psu-load 0.5 0.5 --port=9101 --vmport=9102
120+
121+
# Add 2 Striker Servers
122+
simengine-cli model create server -k=9 --domain-name=an-striker01 --power-consumption=240 --psu-num=1
123+
simengine-cli model create server -k=10 --domain-name=an-striker02 --power-consumption=240 --psu-num=1
124+
125+
### Power Components
126+
# connect outlets & UPSs
127+
simengine-cli model power-link -s1 -d3 # {_Mains_}==>[an-ups01]
128+
simengine-cli model power-link -s2 -d4 # {_Mains_}==>[an-ups02]
129+
130+
# connect ups & pdus
131+
simengine-cli model power-link -s31 -d5 # [an-ups01]==>[an-pdu01]
132+
simengine-cli model power-link -s41 -d6 # [an-ups02]==>[an-pdu02]
133+
134+
# Power up servers
135+
simengine-cli model power-link -s51 -d72 # [an-pdu01]={port-1}=>{psu-2}=>[an-a01n01]
136+
simengine-cli model power-link -s52 -d82 # [an-pdu01]={port-2}=>{psu-2}=>[an-a01n02]
137+
138+
simengine-cli model power-link -s61 -d71 # [an-pdu02]={port-1}=>{psu-1}=>[an-a01n01]
139+
simengine-cli model power-link -s62 -d81 # [an-pdu02]={port-2}=>{psu-1}=>[an-a01n02]
140+
141+
# Power Up Striker Servers
142+
simengine-cli model power-link -s58 -d91 # [an-pdu01]={port-1}=>{psu-2}=>[an-a01n01]
143+
simengine-cli model power-link -s68 -d101 # [an-pdu02]={port-1}=>{psu-1}=>[an-a01n01]
144+
145+
146+
147+
Re-start the daemon:
148+
`sudo systemctl start simengine-core`
149+
150+
You can verify that the simulators are running by issuing:
151+
`ps aux | grep snmpsimd # should show 4 instances`
152+
153+
`ps aux | grep ipmi_sim # should show 2 instances`
154+
155+
156+
## First Run
157+
158+
The front-end web-page will display assets overlaid on top of each other. You will need to position the assets in the preferred way and save their coordinates.
159+
160+
Here’s one way to arrange the assets (sandwich arrangement):
161+
162+
![](https://d2mxuefqeaa7sj.cloudfront.net/s_C5C75BF29B870479D1EC95201C69BB583A74A130BB1FC9890A125939ED904715_1534526372651_Screenshot+from+2018-08-17+13-15-48.png)
163+
164+
165+
Click on gear ⚙️ icon & choose ‘Save Layout’;
166+
167+
![](https://d2mxuefqeaa7sj.cloudfront.net/s_C5C75BF29B870479D1EC95201C69BB583A74A130BB1FC9890A125939ED904715_1534526478583_s.png)
168+
169+
# Management
170+
171+
**UPS**
172+
173+
UPSes’ SNMP interface can be reached at `192.168.124.3` & `192.168.124.4`
174+
175+
For example:
176+
177+
`snmpwalk -Cc -c public -v 1 192.168.124.3 .1.3.6.1.4.1.318.1.1.1.2.2`
178+
179+
`snmpwalk -Cc -c public -v 1 192.168.124.4 .1.3.6.1.4.1.318.1.1.1.2.2`
180+
181+
More documentation on UPS management can be found here: [link](https://simengine.readthedocs.io/en/latest/AssetsConfigurations/#ups);
182+
183+
184+
**PDU**
185+
186+
PDUs SNMP interface is accessible at `192.168.124.5` & `192.168.124.6`
187+
188+
For example:
189+
190+
`snmpwalk -Cc -c public -v 1 192.168.124.5`
191+
192+
`snmpwalk -Cc -c public -v 1 192.168.124.6`
193+
194+
**Server-BMC**
195+
196+
Servers that support BMC interface can be accessed from both host machine & the VMs:
197+
198+
Running from host example:
199+
200+
`ipmitool -H localhost -p 9001 -U ipmiusr -P test sdr list # server 7 (an-a01n01)`
201+
202+
`ipmitool -H localhost -p 9101 -U ipmiusr -P test sdr list # server 8 (an-a01n02)`
203+
204+
VM:
205+
206+
`sudo ipmitool sdr list`
207+
208+
**Power Management**
209+
You can retrieve status of individual assets by issuing:
210+
211+
`simengine-cli status -k1 # is out-1 up?`
212+
213+
And power them up/down:
214+
215+
`simengine-cli power down -k1 # out-1 is down`
216+
217+
More docs can be found here: [link](https://simengine.readthedocs.io/en/latest/PowerManagement/), see `simengine-cli status -h` and `simengine-cli power -h`
218+
219+
**Model Updates**
220+
You can update the existing model (for example, update UPS snmp ip address or server’s power consumption);
221+
222+
**Note** that any model changes require `simengine-core` service restart;
223+
224+
see `simengine-cli model update` for more information;

docs/SystemModeling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ There're 6 supported asset types at the moment: Outlet, PDU, UPS, Server, Server
55

66
*Note* that the main engine daemon will need to be reloaded before schema changes can take place (any `simengine model` commands require `simengine-core` restart).
77

8-
The first time you load the model in a web interface, the assets are going to be overlayed on top of each other. You will need to create your own layout by dragging the components around, clicking `Gear` icon located in the top bar and saving it by choosing `Save Layout` option.
8+
The first time you load the model in a web interface, the assets are going to be overlaid on top of each other. You will need to create your own layout by dragging the components around, clicking `Gear` icon located in the top bar and saving it by choosing `Save Layout` option.
99

1010
Note that the UI does not support system modelling tools at the moment.
1111

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The project exposes core assets’ functionalities through both GUI and UI thoug
99

1010
You can model your own set-up (see [System Modelling](./SystemModeling.md)) and automate/perform power-related tasks (see [Power Management](./PowerManagement.md)).
1111

12+
See [Anvil Model](./AnvilModel.md) for a real-world high-availability system example;
1213

1314
![](./server.png)
1415

0 commit comments

Comments
 (0)