Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 1 | tosca_definitions_version: tosca_simple_yaml_1_0 |
| 2 | |
| 3 | imports: |
| 4 | - custom_types/xos.yaml |
| 5 | |
| 6 | description: Configures VTN networking for OpenStack compute nodes |
| 7 | |
| 8 | topology_template: |
| 9 | node_templates: |
| 10 | |
| 11 | # VTN ONOS app, fully defined in vtn-service.yaml |
| 12 | service#ONOS_CORD: |
| 13 | type: tosca.nodes.ONOSService |
| 14 | properties: |
| 15 | no-delete: true |
| 16 | no-create: true |
| 17 | no-update: true |
| 18 | |
| 19 | {% if use_fabric %} |
| 20 | # Fabric, fully defined in fabric.yaml |
| 21 | service#ONOS_Fabric: |
| 22 | type: tosca.nodes.ONOSService |
| 23 | properties: |
| 24 | no-delete: true |
| 25 | no-create: true |
| 26 | no-update: true |
| 27 | {% endif %} |
| 28 | |
| 29 | # VTN networking for OpenStack Compute Nodes |
Zack Williams | 5223dd9 | 2017-02-28 23:38:02 -0700 | [diff] [blame] | 30 | {% for node in groups['compute'] %} |
Zack Williams | 6ccbed2 | 2017-06-26 13:18:05 -0700 | [diff] [blame] | 31 | {% for ext_if in compute_external_interfaces %} |
| 32 | {% set ansible_ext_if = 'ansible_' ~ ext_if | regex_replace('\W', '_') %} |
| 33 | {% if hostvars[node][ansible_ext_if] is defined and 'ipv4' in hostvars[node][ansible_ext_if] %} |
| 34 | {% set node_interface = hostvars[node][ansible_ext_if] %} |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 35 | |
Zack Williams | 6ccbed2 | 2017-06-26 13:18:05 -0700 | [diff] [blame] | 36 | # Compute node: {{ node }}, with interface {{ ansible_ext_if }} |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 37 | {{ hostvars[node]['ansible_hostname'] }}: |
| 38 | type: tosca.nodes.Node |
| 39 | properties: |
| 40 | no-delete: true |
| 41 | no-create: true |
| 42 | no-update: true |
| 43 | |
| 44 | # VTN bridgeId field for node {{ hostvars[node]['ansible_hostname'] }} |
| 45 | {{ hostvars[node]['ansible_hostname'] }}_bridgeId_tag: |
| 46 | type: tosca.nodes.Tag |
| 47 | properties: |
| 48 | name: bridgeId |
Zack Williams | 2478b30 | 2017-02-14 10:42:55 -0700 | [diff] [blame] | 49 | value: of:0000{{ node_interface['macaddress'] | hwaddr('bare') }} |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 50 | requirements: |
| 51 | - target: |
| 52 | node: {{ hostvars[node]['ansible_hostname'] }} |
| 53 | relationship: tosca.relationships.TagsObject |
| 54 | - service: |
| 55 | node: service#ONOS_CORD |
| 56 | relationship: tosca.relationships.MemberOfService |
| 57 | |
| 58 | # VTN dataPlaneIntf field for node {{ hostvars[node]['ansible_hostname'] }} |
| 59 | {{ hostvars[node]['ansible_hostname'] }}_dataPlaneIntf_tag: |
| 60 | type: tosca.nodes.Tag |
| 61 | properties: |
| 62 | name: dataPlaneIntf |
| 63 | value: fabric |
| 64 | requirements: |
| 65 | - target: |
| 66 | node: {{ hostvars[node]['ansible_hostname'] }} |
| 67 | relationship: tosca.relationships.TagsObject |
| 68 | - service: |
| 69 | node: service#ONOS_CORD |
| 70 | relationship: tosca.relationships.MemberOfService |
| 71 | |
| 72 | # VTN dataPlaneIp field for node {{ hostvars[node]['ansible_hostname'] }} |
| 73 | {{ hostvars[node]['ansible_hostname'] }}_dataPlaneIp_tag: |
| 74 | type: tosca.nodes.Tag |
| 75 | properties: |
| 76 | name: dataPlaneIp |
Zack Williams | 2478b30 | 2017-02-14 10:42:55 -0700 | [diff] [blame] | 77 | value: {{ ( node_interface['ipv4']['address'] ~ '/' ~ node_interface['ipv4']['netmask'] ) | ipaddr('cidr') }} |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 78 | requirements: |
| 79 | - target: |
| 80 | node: {{ hostvars[node]['ansible_hostname'] }} |
| 81 | relationship: tosca.relationships.TagsObject |
| 82 | - service: |
| 83 | node: service#ONOS_CORD |
| 84 | relationship: tosca.relationships.MemberOfService |
| 85 | |
| 86 | {% if use_management_hosts %} |
| 87 | # VTN management interface field for node {{ hostvars[node]['ansible_hostname'] }} |
| 88 | {{ hostvars[node]['ansible_hostname'] }}_hostManagementIface_tag: |
| 89 | type: tosca.nodes.Tag |
| 90 | properties: |
| 91 | name: hostManagementIface |
| 92 | value: {{ vtn_management_host_net_interface }} |
| 93 | requirements: |
| 94 | - target: |
| 95 | node: {{ hostvars[node]['ansible_hostname'] }} |
| 96 | relationship: tosca.relationships.TagsObject |
| 97 | - service: |
| 98 | node: service#ONOS_CORD |
| 99 | relationship: tosca.relationships.MemberOfService |
| 100 | {% endif %} |
| 101 | |
| 102 | {% if use_fabric %} |
| 103 | # Fabric location field for node {{ hostvars[node]['ansible_hostname'] }} |
| 104 | {{ hostvars[node]['ansible_hostname'] }}_location_tag: |
| 105 | type: tosca.nodes.Tag |
| 106 | properties: |
| 107 | name: location |
| 108 | value: of:0000000000000001/1 |
| 109 | requirements: |
| 110 | - target: |
| 111 | node: {{ hostvars[node]['ansible_hostname'] }} |
| 112 | relationship: tosca.relationships.TagsObject |
| 113 | - service: |
| 114 | node: service#ONOS_Fabric |
| 115 | relationship: tosca.relationships.MemberOfService |
| 116 | {% endif %} |
Zack Williams | 6ccbed2 | 2017-06-26 13:18:05 -0700 | [diff] [blame] | 117 | |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 118 | {% endif %} |
| 119 | {% endfor %} |
Zack Williams | 6ccbed2 | 2017-06-26 13:18:05 -0700 | [diff] [blame] | 120 | {% endfor %} |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 121 | |