Add license headers where missing
[fuel.git] / mcp / config / states / networks
1 #!/bin/bash -x
2 ##############################################################################
3 # Copyright (c) 2017 Mirantis Inc., Enea AB and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 # Determine public network based on external IPs from compute node
11 # NOTE: mask currently hardcoded to /24
12 PUBLIC_NET=$(salt --out yaml 'cmp*' pillar.get _param:external_address | \
13   awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
14
15 [ -n "${PUBLIC_NET}" ] || PUBLIC_NET=$(salt --out yaml 'cmp*' \
16   pillar.get _param:openstack_compute_node01_external_address | \
17   awk --re-interval '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $2; exit}')
18
19 [ -n "${PUBLIC_NET}" ] && PUBLIC_NET="${PUBLIC_NET%.*}.0/24" || PUBLIC_NET="10.16.0.0/24"
20
21 salt 'ctl01*' cmd.run ". /root/keystonercv3; \
22   openstack compute service list; \
23   openstack network agent list; \
24   openstack stack list; \
25   openstack volume service list"
26 salt 'ctl01*' cmd.run ". /root/keystonercv3; \
27   openstack network create --external --default --provider-network-type flat \
28     --provider-physical-network physnet1 floating_net"
29 salt 'ctl01*' cmd.run ". /root/keystonercv3; \
30   openstack subnet create --gateway ${PUBLIC_NET%.*}.1 --no-dhcp \
31     --allocation-pool start=${PUBLIC_NET%.*}.130,end=${PUBLIC_NET%.*}.254 \
32     --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"