push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / heat / resources / OS_Contrail_Network_Rule / inputs / network_policy_chain.yaml
1 heat_template_version: 2013-05-23
2
3 description: >
4   HOT template to creates two virtual network with one subnet each. 
5   Creates a network policy for applying service between two VNs created before.
6   Attach the network policy to two virtual networks
7 parameters:
8   policy_name:
9     type: string
10     description: Virtual network id
11   direction:
12     type: string
13     description: Direction of Policy
14   start_src_ports:
15     type: number
16     description: Start of src port
17   end_src_ports:
18     type: number
19     description: End of src port
20   start_dst_ports:
21     type: number
22     description: Start of dst port
23   end_dst_ports:
24     type: number
25     description: End of dst port
26   apply_service:
27     type: string
28     description: service to apply
29   private_net_1_name:
30     type: string
31     description: Name of private network to be created
32   private_net_1_cidr:
33     type: string
34     description: Private network address (CIDR notation)
35   private_net_1_gateway:
36     type: string
37     description: Private network gateway address
38   private_net_1_pool_start:
39     type: string
40     description: Start of private network IP address allocation pool
41   private_net_1_pool_end:
42     type: string
43     description: End of private network IP address allocation pool
44   private_net_2_name:
45     type: string
46     description: Name of private network to be created
47   private_net_2_cidr:
48     type: string
49     description: Private network address (CIDR notation)
50   private_net_2_gateway:
51     type: string
52     description: Private network gateway address
53   private_net_2_pool_start:
54     type: string
55     description: Start of private network IP address allocation pool
56   private_net_2_pool_end:
57     type: string
58     description: End of private network IP address allocation pool
59
60 resources:
61   private_net_1:
62     type: OS::Neutron::Net
63     properties:
64       name: { get_param: private_net_1_name }
65
66   private_net_2:
67     type: OS::Neutron::Net
68     properties:
69       name: { get_param: private_net_2_name }
70
71   private_subnet_1:
72     type: OS::Neutron::Subnet
73     properties:
74       network_id: { get_resource: private_net_1 }
75       cidr: { get_param: private_net_1_cidr }
76       gateway_ip: { get_param: private_net_1_gateway }
77       allocation_pools:
78         - start: { get_param: private_net_1_pool_start }
79           end: { get_param: private_net_1_pool_end }
80
81   private_subnet_2:
82     type: OS::Neutron::Subnet
83     properties:
84       network_id: { get_resource: private_net_2 }
85       cidr: { get_param: private_net_2_cidr }
86       gateway_ip: { get_param: private_net_2_gateway }
87       allocation_pools:
88         - start: { get_param: private_net_2_pool_start }
89           end: { get_param: private_net_2_pool_end }
90
91   private_policy:
92     type: OS::Contrail::NetworkPolicy
93     properties:
94       name: { get_param: policy_name }
95       entries:
96         policy_rule: [
97               { 
98                 "direction": { get_param: direction }, 
99                 "protocol": "any", 
100                 "src_ports": [{"start_port": {get_param: start_src_ports}, "end_port": {get_param: end_src_ports}}],
101                 "dst_ports": [{"start_port": {get_param: start_dst_ports}, "end_port": {get_param: end_dst_ports}}],
102                 "dst_addresses": [{ "virtual_network": {get_resource: private_net_1}}], 
103                 "action_list": {"apply_service": [{get_param: apply_service}]}, 
104                 "src_addresses": [{ "virtual_network": {get_resource: private_net_2}}] 
105               }, 
106         ]
107   private_policy_attach_net1:
108     type: OS::Contrail::AttachPolicy
109     properties:
110       network: { get_resource: private_net_1 }
111       policy: { get_attr: [private_policy, fq_name] }
112
113   private_policy_attach_net2:
114     type: OS::Contrail::AttachPolicy
115     properties:
116       network: { get_resource: private_net_2 }
117       policy: { get_attr: [private_policy, fq_name] }