summaryrefslogtreecommitdiffstats
path: root/rubbos/rubbos_scripts/1-1-1/nsFile.txt
blob: 00c73f3da62e7011e885e8a773b9f0e367df6907 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
set ns [new Simulator]
source tb_compat.tcl


set node1 [$ns node]
tb-set-node-os $node1 FC4-RUBBoS
tb-set-hardware $node1 pc3000

set node2 [$ns node]
tb-set-node-os $node2 FC4-RUBBoS
tb-set-hardware $node2 pc3000

set node3 [$ns node]
tb-set-node-os $node3 FC4-RUBBoS
tb-set-hardware $node3 pc3000

set node4 [$ns node]
tb-set-node-os $node4 FC4-RUBBoS
tb-set-hardware $node4 pc3000

set node5 [$ns node]
tb-set-node-os $node5 FC4-RUBBoS
tb-set-hardware $node5 pc3000

set node6 [$ns node]
tb-set-node-os $node6 FC4-RUBBoS
tb-set-hardware $node6 pc3000

set node7 [$ns node]
tb-set-node-os $node7 FC4-RUBBoS
tb-set-hardware $node7 pc3000

set node8 [$ns node]
tb-set-node-os $node8 FC4-RUBBoS
tb-set-hardware $node8 pc3000

set node9 [$ns node]
tb-set-node-os $node9 FC4-RUBBoS
tb-set-hardware $node9 pc3000

set lan1 [$ns make-lan "$node1 $node2 $node3 $node4 $node5 $node6 $node7 " 1000Mb 0ms]
set lan2 [$ns make-lan "$node7 $node8 " 1000Mb 0ms]
set lan4 [$ns make-lan "$node8 $node9 " 1000Mb 0ms]


$ns rtproto Static
$ns run
d is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## # This will generate a openstack-style config drive image suitable for # use with cloud-init. You may optionally pass in an ssh public key # (using the -k/--ssh-key option) and a user-data blog (using the # -u/--user-data option). CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x usage () { echo "usage: ${0##*/}: [--ssh-key <pubkey>] [--vendor-data <file>] [--user-data <file>] [--hostname <hostname>] <imagename>" } ARGS=$(getopt \ -o k:u:v:h: \ --long help,hostname:,ssh-key:,user-data:,vendor-data: -n "${0##*/}" \ -- "$@") # shellcheck disable=SC2181 if [ $? -ne 0 ]; then usage >&2 exit 2 fi eval set -- "$ARGS" while :; do case "$1" in --help) usage exit 0 ;; -k|--ssh-key) ssh_key="$2" shift 2 ;; -u|--user-data) user_data="$2" shift 2 ;; -v|--vendor-data) vendor_data="$2" shift 2 ;; -h|--hostname) hostname="$2" shift 2 ;; --) shift break ;; esac done config_image=$1 shift if [ "${ssh_key}" ] && [ -f "${ssh_key}" ]; then echo "adding pubkey from ${ssh_key}" ssh_key_data=$(cat "${ssh_key}") fi uuid=$(uuidgen) if ! [ "${hostname}" ]; then hostname="${uuid}" fi trap 'rm -rf $config_dir' EXIT config_dir=$(mktemp -t -d configXXXXXX) if [ "${user_data}" ] && [ -f "${user_data}" ]; then echo "adding user data from ${user_data}" cp "${user_data}" "${config_dir}/user-data" else touch "${config_dir}/user-data" fi if [ "${vendor_data}" ] && [ -f "${vendor_data}" ]; then echo "adding vendor data from ${vendor_data}" cp "${vendor_data}" "${config_dir}/vendor-data" fi cat > "${config_dir}/meta-data" <<-EOF instance-id: ${uuid} hostname: ${hostname} local-hostname: ${hostname} EOF if [ "${ssh_key_data}" ]; then cat >> "${config_dir}/meta-data" <<-EOF public-keys: - | ${ssh_key_data} EOF fi #PS1="debug> " bash --norc echo "generating configuration image at ${config_image}" if ! mkisofs -o "${config_image}" -V cidata -r -J --quiet "${config_dir}"; then echo "ERROR: failed to create ${config_image}" >&2 exit 1 fi chmod a+r "${config_image}"