
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


tosca_definitions_version: tosca_simple_yaml_1_0

description: Persist xos-sample-gui-extension

imports:
  - custom_types/slice.yaml
  - custom_types/network.yaml
  - custom_types/networkslice.yaml
  - custom_types/networktemplate.yaml
  - custom_types/site.yaml
  - custom_types/image.yaml
  - custom_types/service.yaml
  - custom_types/serviceinstance.yaml
  - custom_types/serviceinstancelink.yaml

topology_template:
  node_templates:

    service#mcord:
      type: tosca.nodes.Service
      properties:
        name: mcord

    test1:
      type: tosca.nodes.ServiceInstance
      properties:
        name: test1

    test2:
      type: tosca.nodes.ServiceInstance
      properties:
        name: test2

    link1:
      type: tosca.nodes.ServiceInstanceLink
      requirements:
        - provider_service_instance:
            node: test1
            relationship: tosca.relationships.BelongsToOne
        - subscriber_service_instance:
            node: test2
            relationship: tosca.relationships.BelongsToOne

    link2:
      type: tosca.nodes.ServiceInstanceLink
      requirements:
        - subscriber_service:
            node: service#mcord
            relationship: tosca.relationships.BelongsToOne
        - provider_service_instance:
            node: test2
            relationship: tosca.relationships.BelongsToOne

    # Site
    mysite:
      type: tosca.nodes.Site
      properties:
        must-exist: true
        name: mysite

    # Images
    image#trusty-server-multi-nic:
      type: tosca.nodes.Image
      properties:
        must-exist: true
        name: trusty-server-multi-nic

    # slices
    slice#slice1:
      type: tosca.nodes.Slice
      properties:
        name: mysite_slice1
      requirements:
        - site:
            node: mysite
            relationship: tosca.relationships.BelongsToOne
        - default_image:
            node: image#trusty-server-multi-nic
            relationship: tosca.relationships.BelongsToOne

    slice#slice2:
      type: tosca.nodes.Slice
      properties:
        name: mysite_slice2
      requirements:
        - site:
            node: mysite
            relationship: tosca.relationships.BelongsToOne
        - default_image:
            node: image#trusty-server-multi-nic
            relationship: tosca.relationships.BelongsToOne

    # networks

    shared_template:
      type: tosca.nodes.NetworkTemplate
      properties:
        must-exist: true
        name: shared_template

    network#network1:
      type: tosca.nodes.Network
      properties:
        name: network1
      requirements:
        - template:
            node: shared_template
            relationship: tosca.relationships.BelongsToOne
        - owner:
            node: slice#slice1
            relationship: tosca.relationships.BelongsToOne

    network#network2:
      type: tosca.nodes.Network
      properties:
        name: network2
      requirements:
        - template:
            node: shared_template
            relationship: tosca.relationships.BelongsToOne
        - owner:
            node: slice#slice2
            relationship: tosca.relationships.BelongsToOne

    networkslice#slice1_network2:
      type: tosca.nodes.NetworkSlice
      requirements:
        - network:
            node: network#network2
            relationship: tosca.relationships.BelongsToOne
        - slice:
            node: slice#slice1
            relationship: tosca.relationships.BelongsToOne

    networkslice#slice2_network1:
      type: tosca.nodes.NetworkSlice
      requirements:
        - network:
            node: network#network1
            relationship: tosca.relationships.BelongsToOne
        - slice:
            node: slice#slice2
            relationship: tosca.relationships.BelongsToOne

