cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
s001_create_networks.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# @COPYRIGHT_begin
3
#
4
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
#
18
# @COPYRIGHT_end
19
20
# Debian base image
21
import
os
22
from
settings
import
SERVICES_TMP, BASIC_IMAGE, SSH_KEY, SYSTEM_VERSION
23
24
# Prepare network definitions for libvirt
25
wi_clm_network =
"""
26
<network>
27
<name>wi_clm</name>
28
<uuid>716d4a4c-68f5-f8bd-6565-00c121e36401</uuid>
29
<bridge name='wi_clm' stp='on' delay='0' />
30
<forward mode='nat'/>
31
<mac address='52:54:00:20:B2:01'/>
32
<ip address='10.101.0.1' netmask='255.255.255.0'>
33
<dhcp>
34
<range start='10.101.0.2' end='10.101.0.16' />
35
<host mac='00:00:00:00:01:02' name='wi' ip='10.101.0.2' />
36
<host mac='00:00:00:00:01:03' name='clm' ip='10.101.0.3' />
37
</dhcp>
38
</ip>
39
</network>
40
"""
41
42
clm_cm_network =
"""
43
<network>
44
<name>clm_cm</name>
45
<uuid>716d4a4c-68f5-f8bd-6565-00c121e36402</uuid>
46
<bridge name='clm_cm' stp='on' delay='0' />
47
<forward mode='nat'/>
48
<mac address='52:54:00:20:B2:02'/>
49
<ip address='10.102.0.1' netmask='255.255.255.0'>
50
<dhcp>
51
<range start='10.102.0.2' end='10.102.0.16' />
52
<host mac='00:00:00:00:02:02' name='clm' ip='10.102.0.2' />
53
<host mac='00:00:00:00:02:03' name='cm' ip='10.102.0.3' />
54
</dhcp>
55
</ip>
56
</network>
57
"""
58
59
cm_cluster_network =
"""
60
<network>
61
<name>cm_cluster</name>
62
<uuid>716d4a4c-68f5-f8bd-6565-00c121e36403</uuid>
63
<bridge name='cm_cluster' stp='on' delay='0' />
64
<forward mode='nat'/>
65
<mac address='52:54:00:20:B2:03'/>
66
<ip address='10.103.0.1' netmask='255.255.255.0'>
67
<dhcp>
68
<range start='10.103.0.2' end='10.103.0.16' />
69
<host mac='00:00:00:00:03:02' name='cm' ip='10.103.0.2' />
70
<host mac='00:00:00:00:03:03' name='rm' ip='10.103.0.3' />
71
<host mac='00:00:00:00:03:04' name='node04' ip='10.103.0.4' />
72
<host mac='00:00:00:00:03:05' name='node05' ip='10.103.0.5' />
73
</dhcp>
74
</ip>
75
</network>
76
"""
77
78
# Save configurations in temporary directory
79
if
not
os.path.exists(SERVICES_TMP):
80
os.mkdir(SERVICES_TMP)
81
open(
'%s/net_wi_clm.xml'
% SERVICES_TMP,
'w'
).write(wi_clm_network)
82
open(
'%s/net_clm_cm.xml'
% SERVICES_TMP,
'w'
).write(clm_cm_network)
83
open(
'%s/net_cm_cluster.xml'
% SERVICES_TMP,
'w'
).write(cm_cluster_network)
84
85
86
# Define tests
87
actions = []
88
89
# Create new networks
90
actions.append({
'type'
:
'exec'
,
91
'command'
:
'virsh'
,
92
'args'
: [
'-c'
,
'qemu:///system'
,
'net-create'
,
'%s/net_wi_clm.xml'
% SERVICES_TMP]})
93
actions.append({
'type'
:
'exec'
,
94
'command'
:
'virsh'
,
95
'args'
: [
'-c'
,
'qemu:///system'
,
'net-create'
,
'%s/net_clm_cm.xml'
% SERVICES_TMP]})
96
actions.append({
'type'
:
'exec'
,
97
'command'
:
'virsh'
,
98
'args'
: [
'-c'
,
'qemu:///system'
,
'net-create'
,
'%s/net_cm_cluster.xml'
% SERVICES_TMP]})
99
100
clm
old-tests
scripts
s001_create_networks.py
Generated on Wed Jun 18 2014 13:32:54 for cc1 by
1.8.1.2