aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/config/states/networks
blob: e0d2aeea37c401c516c70429d0af89c17bf78fc2 (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
#!/bin/bash -e
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x

source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"

PUBLIC_NET=$(get_nova_compute_pillar_data 'opnfv_net_public')
PUBLIC_NET_GATEWAY=$(get_nova_compute_pillar_data 'opnfv_net_public_gw')
POOL_START_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_start')
POOL_END_IP=$(get_nova_compute_pillar_data 'opnfv_net_public_pool_end')

# Default values
PUBLIC_NET="${PUBLIC_NET:-10.16.0.0/24}"
PUBLIC_NET_GATEWAY="${PUBLIC_NET_GATEWAY:-10.16.0.1}"
POOL_START_IP="${POOL_START_IP:-10.16.0.130}"
POOL_END_IP="${POOL_END_IP:-10.16.0.254}"

# Print openstack status and setup network
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
  openstack compute service list; \
  openstack network agent list; \
  openstack stack list; \
  openstack volume service list"
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
  openstack network create --external --default --provider-network-type flat \
  --provider-physical-network physnet1 floating_net"
salt -C 'I@nova:controller and *01*' cmd.run ". /root/keystonercv3; \
  openstack subnet create --gateway ${PUBLIC_NET_GATEWAY} --no-dhcp \
  --allocation-pool start=${POOL_START_IP},end=${POOL_END_IP} \
  --network floating_net --subnet-range ${PUBLIC_NET} floating_subnet"

# Discover compute hosts after they are registered
salt -C 'I@nova:controller and *01*' state.sls_id nova_controller_discover_hosts nova

# Set datapath type to netdev for public bridge
((MCP_DPDK_MODE)) && salt -I 'nova:compute' cmd.run 'ovs-vsctl set bridge br-floating datapath_type=netdev' || /bin/true