push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / services / heattotosca / contrail2serviceinstance / sameServiceTemplate / inputfiles / OCS-fw.yml
1 heat_template_version: 2013-05-23
2
3 description: >
4   Based on the following reference for the HOT-DMZ-FW template:
5   Version 3.5 8-10-2015 (Authors: Art Mishurov,am254u & Johhny Chen, jc3066) - HOT-DMZ-FW template that creates two DMZ networks (direct and protected) with a scaled out firewall service between the two.
6
7 parameters:
8   HSL_direct_net_id:
9     type: string
10     description: Name of HSL (Logging) network
11   prefix_0:
12     type: string
13   prefix_1:
14     type: string
15   prefix_2:
16     type: string
17   HSL_direct_net_cidr:
18     type: string
19     description: HSL (Logging) network address (CIDR notation)
20   HSL_direct_net_gateway:
21     type: string
22     description: HSL (Logging) network gateway address
23   oam_mgmt_net_0_id:
24     type: string
25     description: Name of OAM network
26   oam_mgmt_net_1_id:
27     type: string
28     description: Name of OAM network
29   Cricket_OCS_direct_net_id:
30     type: string
31     description: Name of Cricket OCS network
32   Cricket_OCS_protected_net_id:
33     type: string
34     description: Name of Cricket OCS network
35   service_instance_name:
36     type: string
37     description: Service instance name
38   service_policy_name:
39     type: string
40     description: Policy Name
41   service_policy_direction:
42     type: string
43     description: Direction of Policy
44   start_src_ports:
45     type: number
46     description: Start of src port
47   end_src_ports:
48     type: number
49     description: End of src port
50   start_dst_ports:
51     type: number
52     description: Start of dst port
53   end_dst_ports:
54     type: number
55     description: End of dst port
56   st_name:
57     type: string
58     description: Name of service template
59   st_mode:
60     type: string
61     description: service mode
62   st_type:
63     type: string
64     description: service type
65   st_image:
66     type: string
67     description: Name of the image
68   st_image_name:
69     type: string
70     description: Name of the image
71   st_flavor:
72     type: string
73     description: Flavor
74   st_service_interface_type_list:
75     type: string
76     description: List of interface types
77   st_shared_ip_list:
78     type: string
79     description: List of shared ip enabled-disabled
80   st_static_routes_list:
81     type: string
82     description: List of static routes enabled-disabled
83   st_scaling:
84     type: string
85     description: Indicates whether service scaling is enabled
86   max_num_fw_instances:
87     type: number
88     description: maximum number of firewall instances for scaling
89   availability_zone_1:
90     type: string
91     description: availability zone
92
93 resources:
94
95   hsl_direct_net1:
96     type: OS::Contrail::VirtualNetwork
97     properties:
98       name: { get_param: HSL_direct_net_id }
99 #      external: True
100
101   hsl_direct_net2:
102     type: OS::Contrail::VirtualNetwork
103     properties:
104       name: { get_param: HSL_direct_net_id }
105 #      external: True
106
107   hsl_ip_subnet:
108     type: OS::Neutron::Subnet
109     properties:
110       network_id: { get_resource: hsl_direct_net1 }
111       cidr: { get_param: HSL_direct_net_cidr }
112       gateway_ip: { get_param: HSL_direct_net_gateway }
113
114   service_template:
115     type: OS::Contrail::ServiceTemplate
116     properties:
117       name: { get_param: st_name }
118       service_mode: { get_param: st_mode }
119       service_type: { get_param: st_type }
120       image_name: { get_param: st_image }
121       flavor: { get_param: st_flavor }
122       service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] }
123       shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] }
124       static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] }
125       service_scaling: { get_param: st_scaling }
126
127   service_instance_1:
128                type: OS::Contrail::ServiceInstance
129                depends_on: [ hsl_ip_subnet]
130                properties:
131                  name: { get_param: service_instance_name }
132                  availability_zone: { get_param: availability_zone_1 }
133                  service_template: { get_resource: service_template }
134                  interface_list: [
135                      {
136                          virtual_network: { get_param: oam_mgmt_net_0_id }
137                      },
138                      {
139                          virtual_network: { get_param: Cricket_OCS_direct_net_id }
140                      },
141                      {
142                          virtual_network: { get_resource: hsl_direct_net1 }
143                      },
144                      {
145                          virtual_network: {get_param: oam_mgmt_net_1_id},
146                                            static_routes: [
147                                            { "prefix": {get_param: prefix_0} },
148                                            { "prefix": {get_param: prefix_1} },
149                                           { "prefix": {get_param: prefix_2} },
150                                ],
151                      }
152                      ]
153
154   service_instance_2:
155                type: OS::Contrail::ServiceInstance
156                depends_on: [ hsl_ip_subnet]
157                properties:
158                  name: { get_param: service_instance_name }
159                  availability_zone: { get_param: availability_zone_1 }
160                  service_template: { get_resource: service_template }
161                  scale_out:
162                    max_instances: {get_param: max_num_fw_instances}
163                  interface_list: [
164                      {
165                          virtual_network: { get_param: oam_mgmt_net_0_id }
166                      },
167                      {
168                          virtual_network: { get_param: Cricket_OCS_direct_net_id }
169                      },
170                      {
171                          virtual_network: { get_resource: hsl_direct_net2 }
172                      },
173                      {
174                          virtual_network: {get_param: oam_mgmt_net_1_id},
175                                            static_routes: [
176                                            { "prefix": {get_param: prefix_0} },
177                                            { "prefix": {get_param: prefix_1} },
178                                           { "prefix": {get_param: prefix_2} },
179                                ],
180                      }
181                      ]
182
183   service_policy:
184     type: OS::Contrail::NetworkPolicy
185     depends_on: [ service_instance_1 ]
186     properties:
187       name: { get_param: service_policy_name }
188       entries:
189         policy_rule: [
190           {
191             "direction": { get_param: service_policy_direction },
192             "protocol": "any",
193             "src_ports": [{"start_port": {get_param: start_src_ports}, "end_port": {get_param: end_src_ports}}],
194             "dst_ports": [{"start_port": {get_param: start_dst_ports}, "end_port": {get_param: end_dst_ports}}],
195             "dst_addresses": [{ "virtual_network": { get_param: Cricket_OCS_direct_net_id }}],
196             "action_list": { "apply_service": [{ get_resource: service_instance_1 }]},
197             "src_addresses": [{ "virtual_network": { get_param: Cricket_OCS_protected_net_id }}],
198           },
199           ]
200
201   service_policy_attach_direct_net:
202     type: OS::Contrail::AttachPolicy
203     depends_on: [ service_policy ]
204     properties:
205       network: { get_param: Cricket_OCS_direct_net_id }
206       policy: { get_attr: [service_policy, fq_name] }
207
208   service_policy_attach_protected_net:
209     type: OS::Contrail::AttachPolicy
210     depends_on: [ service_policy ]
211     properties:
212       network: { get_param: Cricket_OCS_protected_net_id }
213       policy: { get_attr: [service_policy, fq_name] }