push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / services / heattotosca / contrail2serviceinstance / diffServiceTemplate / 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   count:
93     type: integer
94
95 resources:
96
97   hsl_direct_net:
98     type: OS::Contrail::VirtualNetwork
99     properties:
100       name: { get_param: HSL_direct_net_id }
101 #      external: True
102
103   hsl_ip_subnet:
104     type: OS::Neutron::Subnet
105     properties:
106       network_id: { get_resource: hsl_direct_net }
107       cidr: { get_param: HSL_direct_net_cidr }
108       gateway_ip: { get_param: HSL_direct_net_gateway }
109
110   service_template_1:
111     type: OS::Contrail::ServiceTemplate
112     properties:
113       name: { get_param: st_name }
114       service_mode: { get_param: st_mode }
115       service_type: { get_param: st_type }
116       image_name: { get_param: st_image }
117       flavor: { get_param: st_flavor }
118       service_interface_type_list: { "Fn::Split" : [ ",", "management,left,right,other" ] }
119       shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] }
120       static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] }
121       service_scaling: n
122
123   service_instance_1:
124     type: OS::Contrail::ServiceInstance
125     depends_on: [ hsl_ip_subnet]
126     properties:
127       name: { get_param: service_instance_name }
128       availability_zone: { get_param: availability_zone_1 }
129       service_template: { get_resource: service_template_1 }
130       scale_out:
131         max_instances: {get_param: max_num_fw_instances}
132       interface_list: [
133           {
134               virtual_network: { get_param: oam_mgmt_net_0_id }
135           },
136           {
137               virtual_network: { get_param: Cricket_OCS_direct_net_id }
138           },
139           {
140               virtual_network: { get_resource: hsl_direct_net }
141           },
142           {
143               virtual_network: {get_param: oam_mgmt_net_1_id},
144                                 static_routes: [
145                                 { "prefix": {get_param: prefix_0} },
146                                 { "prefix": {get_param: prefix_1} },
147                                { "prefix": {get_param: prefix_2} },
148                     ],
149           }
150           ]
151
152   service_template_2:
153     type: OS::Contrail::ServiceTemplate
154     properties:
155       name: { get_param: st_name }
156       service_mode: { get_param: st_mode }
157       service_type: { get_param: st_type }
158       image_name: { get_param: st_image_name }
159       flavor: { get_param: st_flavor }
160       service_interface_type_list: { "Fn::Split" : [ ",", Ref: st_service_interface_type_list ] }
161       shared_ip_list: { "Fn::Split" : [ ",", Ref: st_shared_ip_list ] }
162       static_routes_list: { "Fn::Split" : [ ",", Ref: st_static_routes_list ] }
163
164   service_instance_2:
165     type: OS::Contrail::ServiceInstance
166     depends_on: [ hsl_ip_subnet]
167     properties:
168       name: { get_param: service_instance_name }
169       availability_zone: { get_param: availability_zone_1 }
170       service_template: { get_resource: service_template_2 }
171       scale_out:
172         max_instances: 9
173       interface_list: [
174           {
175               virtual_network: { get_param: oam_mgmt_net_0_id }
176           },
177           {
178               virtual_network: { get_param: Cricket_OCS_direct_net_id }
179           }
180           ]
181
182   service_policy:
183     type: OS::Contrail::NetworkPolicy
184     depends_on: [ service_instance_1 ]
185     properties:
186       name: { get_param: service_policy_name }
187       entries:
188         policy_rule: [
189           {
190             "direction": { get_param: service_policy_direction },
191             "protocol": "any",
192             "src_ports": [{"start_port": {get_param: start_src_ports}, "end_port": {get_param: end_src_ports}}],
193             "dst_ports": [{"start_port": {get_param: start_dst_ports}, "end_port": {get_param: end_dst_ports}}],
194             "dst_addresses": [{ "virtual_network": { get_param: Cricket_OCS_direct_net_id }}],
195             "action_list": { "apply_service": [{ get_resource: service_instance_1 }]},
196             "src_addresses": [{ "virtual_network": { get_param: Cricket_OCS_protected_net_id }}],
197             "metadata": {get_attr: [service_instance_2, name]}
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] }