1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation 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 ##############################################################################
10 ##############################################################################
12 # MANAGEMENT: used for management
13 # STORAGE: used for storage access
14 # EXTERNAL: tenant public/floating IP associated network
15 # PUBLICAPI: used for horizon access, openstack API access
16 # TENANT: used for tenant access, vlan and VxLan supported, default VxLan
17 # HEARTBEAT: used for heartbeat, requires a dedicated interface
18 ##############################################################################
22 network-config-metadata:
23 title: 'Deployment Adapter for baremetal POD'
25 created: 'Nov 22 2017'
26 comment: 'For Daisy initial'
28 {%- set mapping = {'HEARTBEAT': 'admin',
33 'EXTERNAL': 'public'} -%}
35 {%- if "idf" in conf and ("daisy" in conf["idf"] or "fuel" in conf["idf"]) -%}
36 {%- if "daisy" in conf["idf"] -%}
37 {%- set installer = "daisy" -%}
39 {%- set installer = "fuel" -%}
44 {%- set networks = {} -%}
45 {%- for key in mapping -%}
46 {%- set net_data = conf['net_config'][mapping[key]] -%}
47 {%- set interface = net_data['interface'] -%}
48 {%- set interface_name = conf.idf[installer].network.node[0].interfaces[interface] -%}
49 {%- set bus_addr = conf.idf[installer].network.node[0].busaddr[interface] -%}
50 {%- set vlan = net_data['vlan'] -%}
51 {%- if vlan == "native" or vlan == None -%}
52 {%- set vlan = "null" -%}
54 {%- set network = net_data['network'] -%}
55 {%- set ips = network.split(".") -%}
56 {%- set mask = net_data['mask'] -%}
57 {%- if 'ip-range' in net_data -%}
58 {%- set ip_range = net_data['ip-range'] -%}
59 {%- set (start, end) = ip_range.split("-") -%}
61 {%- set start = ".".join([ips[0], ips[1], ips[2], "10"]) -%}
62 {%- set end = ".".join([ips[0], ips[1], ips[2], "200"]) -%}
64 {%- set vip = start -%}
66 {%- if 'gateway' in net_data -%}
67 {%- set gateway = net_data.gateway -%}
69 {%- set gateway = ".".join([ips[0], ips[1], ips[2], "1"]) -%}
72 {%- set networks = networks.update({key: {'interface_name': interface_name,
84 - cidr: '{{ network }}/{{ mask }}'
85 gateway: '{{ gateway }}'
87 - 'start': '{{ start }}'
94 {%- for key in mapping %}
96 interface: '{{ networks[key].interface_name }}'
99 internal_vip: '{{ networks['MANAGEMENT'].vip }}'
100 public_vip: '{{ networks['PUBLICAPI'].vip }}'