summaryrefslogtreecommitdiffstats
path: root/contrib/nettest/nettest/heat_2stcv.yaml
blob: 77c6e6e85d05912093b621508168434abecf219e (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
##############################################################################
# Copyright (c) 2018 Spirent Communications 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
##############################################################################

heat_template_version: 2016-10-14

description: Template for deploying 2 STCv and 1 labserver

parameters:
  public_net_name: {default: external, description: Public network to allocate floating IPs to VMs', type: string}
  #public_net_id: {description: public_network id for exernal connectivity,type: string}
  mgmt_net_name: {default: admin, description: Name of STCv mgmt network to be created, type: string}
  mgmt_net_cidr: {default: 10.10.10.0/24, description: STCv mgmt network CIDR,type: string}
  mgmt_net_gw: {default: 10.10.10.1, description: STCv mgmt network gateway address, type: string}
  mgmt_net_pool_start: {default: 10.10.10.10, description: Start of mgmt network IP address allocation pool, type: string}
  mgmt_net_pool_end: {default: 10.10.10.20, description: End of mgmt network IP address allocation pool, type: string}
  tst_net_name: {default: tst, description: Name of STCv private network to be created, type: string}
  tst_net_cidr: {default: 192.168.1.0/24, description: STCv private network CIDR,type: string}
  tst_net_gw: {default: 192.168.1.1, description: STCv private network gateway address, type: string}
  tst_net_pool_start: {default: 192.168.1.10, description: Start of private network IP address allocation pool, type: string}
  tst_net_pool_end: {default: 192.168.1.20, description: End of private network IP address allocation pool, type: string}
  stcv_image: {default: "stcv-4.79", description: Image name to use for STCv, type: string}
  stcv_flavor: {default: "m1.tiny", description: Flavor to use for STCv, type: string}
  #stcv_user_data: {default: "", description: user data such as ntp server ip for stcv, type: string}
  #stcv_config_file: {default: "stcv_config_file", description: user data such as ntp server ip for stcv, type: string}
  ntp_server_ip: {default: "", description: user data such as ntp server ip for stcv, type: string}
  stcv_sg_name: {default: stcv_sg, description: server group name, type: string}
  stcv_sg_affinity: {default: affinity, description: server group affinity for stcv, type: string}

resources:
  stcv_server_group:
    type: OS::Nova::ServerGroup
    properties:
      name: {get_param: stcv_sg_name}
      policies: [{get_param: stcv_sg_affinity}]
  mgmt_net:
    type: OS::Neutron::Net
    properties:
      name: {get_param: mgmt_net_name}
  mgmt_net_subnet:
    type: OS::Neutron::Subnet
    properties:
      allocation_pools:
        - end: {get_param: mgmt_net_pool_end}
          start: {get_param: mgmt_net_pool_start}
      cidr: {get_param: mgmt_net_cidr}
      gateway_ip: {get_param: mgmt_net_gw}
      network: {get_resource: mgmt_net}
  public_router:
    type: OS::Neutron::Router
    properties:
      external_gateway_info:
        network: {get_param: public_net_name}
  router_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router: {get_resource: public_router}
      subnet: {get_resource: mgmt_net_subnet}
  tst_net:
    type: OS::Neutron::Net
    properties:
      name: {get_param: tst_net_name}
  tst_subnet:
    type: OS::Neutron::Subnet
    properties:
      allocation_pools:
        - end: {get_param: tst_net_pool_end}
          start: {get_param: tst_net_pool_start}
      cidr: {get_param: tst_net_cidr}
      gateway_ip: {get_param: tst_net_gw}
      network: {get_resource: tst_net}
  stcv_1_port_1:
    type: OS::Neutron::Port
    properties:
      network: {get_resource: mgmt_net}
      fixed_ips:
      - subnet: {get_resource: mgmt_net_subnet}
  floating_ip1:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: {get_param: public_net_name}
      port_id: {get_resource: stcv_1_port_1}
  stcv_1_port_2:
    type: OS::Neutron::Port
    properties:
      network: {get_resource: tst_net}
      port_security_enabled: False
      fixed_ips:
      - subnet: {get_resource: tst_subnet}
  STCv_1:
    type: OS::Nova::Server
    properties:
      #availability_zone : {get_param: availability_zone_name}
      flavor: {get_param: stcv_flavor}
      image: {get_param: stcv_image}
      name: STCv_1
      user_data:
        str_replace:
          template: |
            #cloud-config
            spirent:
                ntp: $ntp_server_ip
          params:
            $ntp_server_ip: {get_param: ntp_server_ip}
      user_data_format: RAW
      config_drive: True
      scheduler_hints:
        group: {get_resource: stcv_server_group}
      networks:
      - port: {get_resource: stcv_1_port_1}
      - port: {get_resource: stcv_1_port_2}
  stcv_2_port_1:
    type: OS::Neutron::Port
    properties:
      network: {get_resource: mgmt_net}
      fixed_ips:
      - subnet: {get_resource: mgmt_net_subnet}
  floating_ip2:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: {get_param: public_net_name}
      port_id: {get_resource: stcv_2_port_1}
  stcv_2_port_2:
    type: OS::Neutron::Port
    properties:
      network: {get_resource: tst_net}
      port_security_enabled: False
      fixed_ips:
      - subnet: {get_resource: tst_subnet}
  STCv_2:
    type: OS::Nova::Server
    properties:
      #availability_zone : {get_param: availability_zone_name}
      flavor: {get_param: stcv_flavor}
      image: {get_param: stcv_image}
      name: STCv_2
      user_data:
        str_replace:
          template: |
            #cloud-config
            spirent:
                ntp: $ntp_server_ip
          params:
            $ntp_server_ip: {get_param: ntp_server_ip}
      user_data_format: RAW
      config_drive: True
      scheduler_hints:
        group: {get_resource: stcv_server_group}
      networks:
      - port: {get_resource: stcv_2_port_1}
      - port: {get_resource: stcv_2_port_2}
outputs:
  STCv_1_Mgmt_Ip:
     value: {get_attr: [floating_ip1, floating_ip_address]}
     description: STCv_1 Mgmt IP
  STCv_2_Mgmt_Ip:
     value: {get_attr: [floating_ip2, floating_ip_address]}
     description: STCv_2 Mgmt IP
  STCv_1_Tst_Ip:
     value: {get_attr: [stcv_1_port_2, fixed_ips]}
     description: STCv_1 Tst IP
  STCv_2_Tst_Ip:
     value: {get_attr: [stcv_2_port_2, fixed_ips]}
     description: STCv_2 Tst IP