Scott Baker | 6a4fd49 | 2018-06-19 08:12:42 -0700 | [diff] [blame] | 1 | {{/* vim: set filetype=mustache: */}} |
| 2 | {{/* |
| 3 | Copyright 2018-present Open Networking Foundation |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | */}} |
| 17 | {{- define "exampleservice.serviceTosca" -}} |
| 18 | tosca_definitions_version: tosca_simple_yaml_1_0 |
| 19 | |
| 20 | imports: |
| 21 | - custom_types/slice.yaml |
| 22 | - custom_types/site.yaml |
| 23 | - custom_types/image.yaml |
| 24 | - custom_types/flavor.yaml |
| 25 | - custom_types/network.yaml |
| 26 | - custom_types/networktemplate.yaml |
| 27 | - custom_types/networkslice.yaml |
| 28 | - custom_types/exampleservice.yaml |
| 29 | - custom_types/exampleserviceinstance.yaml |
| 30 | |
| 31 | description: configure exampleservice |
| 32 | |
| 33 | topology_template: |
| 34 | node_templates: |
| 35 | |
| 36 | # site, image, fully created in deployment.yaml |
| 37 | mysite: |
| 38 | type: tosca.nodes.Site |
| 39 | properties: |
| 40 | must-exist: true |
| 41 | name: {{ .cordSiteName }} |
| 42 | |
| 43 | m1.small: |
| 44 | type: tosca.nodes.Flavor |
| 45 | properties: |
| 46 | name: m1.small |
| 47 | must-exist: true |
| 48 | |
| 49 | trusty-server-multi-nic: |
| 50 | type: tosca.nodes.Image |
| 51 | properties: |
| 52 | name: "trusty-server-multi-nic" |
| 53 | container_format: "BARE" |
| 54 | disk_format: "QCOW2" |
| 55 | path: "https://github.com/opencord/platform-install/releases/download/vms/trusty-server-cloudimg-amd64-disk1.img.20170201" |
| 56 | |
| 57 | # private network template, fully created somewhere else |
| 58 | private: |
| 59 | type: tosca.nodes.NetworkTemplate |
| 60 | properties: |
| 61 | must-exist: true |
| 62 | name: Private |
| 63 | |
| 64 | # management networks, fully created in management-net.yaml |
| 65 | management_network: |
| 66 | type: tosca.nodes.Network |
| 67 | properties: |
| 68 | must-exist: true |
| 69 | name: management |
| 70 | |
| 71 | # public network, fully created somewhere else |
| 72 | public_network: |
| 73 | type: tosca.nodes.Network |
| 74 | properties: |
| 75 | must-exist: true |
| 76 | name: public |
| 77 | |
| 78 | exampleservice_network: |
| 79 | type: tosca.nodes.Network |
| 80 | properties: |
| 81 | name: exampleservice_network |
| 82 | labels: exampleservice_private_network |
| 83 | requirements: |
| 84 | - template: |
| 85 | node: private |
| 86 | relationship: tosca.relationships.BelongsToOne |
| 87 | - owner: |
| 88 | node: exampleservice_slice |
| 89 | relationship: tosca.relationships.BelongsToOne |
| 90 | |
| 91 | # ExampleService Slices |
| 92 | exampleservice_slice: |
| 93 | description: Example Service Slice |
| 94 | type: tosca.nodes.Slice |
| 95 | properties: |
| 96 | name: exampleservice |
| 97 | default_isolation: vm |
| 98 | network: noauto |
| 99 | requirements: |
| 100 | - site: |
| 101 | node: mysite |
| 102 | relationship: tosca.relationships.BelongsToOne |
| 103 | - service: |
| 104 | node: exampleservice |
| 105 | relationship: tosca.relationships.BelongsToOne |
| 106 | - default_image: |
| 107 | node: trusty-server-multi-nic |
| 108 | relationship: tosca.relationships.BelongsToOne |
| 109 | - default_flavor: |
| 110 | node: m1.small |
| 111 | relationship: tosca.relationships.BelongsToOne |
| 112 | |
| 113 | # ExampleService NetworkSlices |
| 114 | exampleservice_slice_management_network: |
| 115 | type: tosca.nodes.NetworkSlice |
| 116 | requirements: |
| 117 | - network: |
| 118 | node: management_network |
| 119 | relationship: tosca.relationships.BelongsToOne |
| 120 | - slice: |
| 121 | node: exampleservice_slice |
| 122 | relationship: tosca.relationships.BelongsToOne |
| 123 | |
| 124 | exampleservice_slice_public_network: |
| 125 | type: tosca.nodes.NetworkSlice |
| 126 | requirements: |
| 127 | - network: |
| 128 | node: public_network |
| 129 | relationship: tosca.relationships.BelongsToOne |
| 130 | - slice: |
| 131 | node: exampleservice_slice |
| 132 | relationship: tosca.relationships.BelongsToOne |
| 133 | |
| 134 | exampleservice_slice_exampleservice_network: |
| 135 | type: tosca.nodes.NetworkSlice |
| 136 | requirements: |
| 137 | - network: |
| 138 | node: exampleservice_network |
| 139 | relationship: tosca.relationships.BelongsToOne |
| 140 | - slice: |
| 141 | node: exampleservice_slice |
| 142 | relationship: tosca.relationships.BelongsToOne |
| 143 | |
| 144 | exampleservice: |
| 145 | type: tosca.nodes.ExampleService |
| 146 | properties: |
| 147 | name: exampleservice |
| 148 | public_key: {{ .publicKey | quote }} |
| 149 | private_key_fn: /opt/xos/services/exampleservice/keys/id_rsa |
| 150 | service_message: hello |
| 151 | |
| 152 | exampletenant1: |
| 153 | type: tosca.nodes.ExampleServiceInstance |
| 154 | properties: |
| 155 | name: exampletenant1 |
| 156 | tenant_message: world |
| 157 | requirements: |
| 158 | - owner: |
| 159 | node: exampleservice |
| 160 | relationship: tosca.relationships.BelongsToOne |
| 161 | {{- end -}} |