1 <!-- Licensed under the Apache License, Version 2.0 (the "License");
2 you may not use this file except in compliance with the License.
3 You may obtain a copy of the License at
4 http://www.apache.org/licenses/LICENSE-2.0
6 Unless required by applicable law or agreed to in writing, software
7 distributed under the License is distributed on an "AS IS" BASIS,
8 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 See the License for the specific language governing permissions and limitations under the License.
11 <xsl:stylesheet version="1.0" xmlns:ns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:y="urn:ietf:params:xml:ns:yang:ietf-vdus" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="t">
12 <xsl:output indent="no" method ="text"/>
14 <xsl:variable name="tosca_general">
15 <entry key="tosca_definitions_version">tosca_definitions_version:tosca_simple_yaml_1_0_0</entry>
16 <entry key="tosca_default_namespace">tosca_default_namespace:tosca_simple_yaml_1_0_0</entry>
17 <entry key="template_name">template_name:</entry>
18 <entry key="description">description:</entry>
19 <entry key="template_author">template_author:</entry>
20 <entry key="template_version">template_version:</entry>
21 <entry key="derived">derived_from:tosca.nodes.Root</entry>
22 <entry key="import">import:</entry>
24 <xsl:variable name="nodeTypes">
25 <entry key="generalvdus">type:tosca.nodes.general.vdus</entry>
26 <entry key="compute">type:tosca.nodes.compute</entry>
27 <entry key="storage">type:tosca.nodes.block.Storage</entry>
28 <entry key="network">type:tosca.nodes.network</entry>
29 <entry key="security">type:tosca.nodes.security</entry>
30 <entry key="policy">type:tosca.nodes.policy</entry>
33 <xsl:template match="ns:module">
34 <xsl:value-of select="concat(document('')//xsl:variable[@name='tosca_general']/entry[@key='tosca_definitions_version'] ,'
')" />
35 <xsl:value-of select="concat(document('')//xsl:variable[@name='tosca_general']/entry[@key='description'],'
	',ns:description/node()/text(),'
')" />
36 <xsl:value-of select="concat(document('')//xsl:variable[@name='tosca_general']/entry[@key='import'],'
	',ns:import/@module,'
')" />
38 ID:<xsl:value-of select="@name"/>
39 Vendor:<xsl:value-of select="ns:organization/node()/text()"/>
41 <xsl:for-each select="ns:container">
42 dsl_definitions:<xsl:for-each select="ns:list">
43 compute_props_host_<xsl:value-of select="@name"/>:<text disable-output-escaping="yes"><![CDATA[&]]>compute_props_host_</text><xsl:value-of select="@name"/>
44 <xsl:for-each select="ns:container"><xsl:if test="@name = 'resource'"><xsl:for-each select="ns:container"><xsl:if test="@name = 'cpu'"><xsl:variable name="num_cpu" select="ns:leaf/ns:type/ns:range/@value"/>
45 num_cpu:<xsl:value-of select="$num_cpu"/>
47 <xsl:if test="@name='memory'">
48 <xsl:variable name="memory" select="ns:leaf/ns:type/ns:range/@value"/>
49 mem_size:<xsl:value-of select="$memory"></xsl:value-of>
55 node_types:<xsl:for-each select="ns:list">
56 tosca.nodes.compute.<xsl:value-of select="@name"/>:
57 derived_from:tosca.nodes.compute
60 # a description of the topology template
62 <xsl:value-of select="ns:description/node()/text()"/>
65 type:scalar-unit.size<xsl:for-each select="ns:list"><xsl:if test="@name = 'ellis'">
66 <xsl:for-each select="ns:container"><xsl:if test="@name = 'resource'"><xsl:for-each select="ns:container"><xsl:if test="@name = 'disk'">
67 default:<xsl:value-of select="ns:leaf/ns:type/ns:range/@value"/>
68 description:<xsl:value-of select="ns:description/node()/text()"/>
69 </xsl:if></xsl:for-each></xsl:if></xsl:for-each>
70 </xsl:if></xsl:for-each>
74 Block storage mount point (filesystem path).
75 node_templates:<xsl:for-each select="ns:list">
76 <xsl:text>
		</xsl:text>
77 <xsl:value-of select="@name"/>:
78 type:tosca.nodes.Compute
87 properties:*compute_props_host_<xsl:value-of select="@name"/>
90 min_instances:<xsl:for-each select="ns:leaf"><xsl:if test="@name = 'instance-num'">
91 <xsl:value-of select="ns:default/@value"/>
92 </xsl:if></xsl:for-each>
93 default_instances:<xsl:for-each select="ns:leaf"><xsl:if test="@name = 'instance-num'">
94 <xsl:value-of select="ns:default/@value"/>
95 </xsl:if></xsl:for-each>
98 node:<xsl:value-of select="@name"/>_BlockStorage
102 location:{ get_input:storage_location }
104 Standard:<xsl:for-each select="ns:container">
105 <xsl:if test="@name = 'workflow-script'">
106 <xsl:for-each select="ns:leaf">
108 <xsl:when test="@name = 'init'">
110 implementation:<xsl:value-of select="ns:default/@value"/>
112 <xsl:when test="@name='terminate'">
114 implementaion:<xsl:value-of select="ns:default/@value"/>
116 <xsl:when test="@name='graceful-shutdown'">
118 implementaion:<xsl:value-of select="ns:default/@value"/>
124 <xsl:text>
		</xsl:text>
125 <xsl:variable name="vdu" select = "@name"/>
126 <xsl:value-of select="$vdu"/>_BlockStorage:
127 type:tosca.nodes.BlockStorage
129 size:{ get_input:storage_size }</xsl:for-each><xsl:for-each select="ns:list"><xsl:for-each select="ns:container"><xsl:if test="@name = 'resource'"><xsl:for-each select="ns:container">
130 <xsl:if test="@name='vnic'">
131 <xsl:variable name="vnic" select="ns:leaf/ns:type/ns:range/@value"/>
132 <xsl:call-template name="nic.loop">
133 <xsl:with-param name="from" select="1"/>
134 <xsl:with-param name="to" select="$vnic"/>
143 <xsl:template name="nic.loop">
144 <xsl:param name="from"/>
145 <xsl:param name="to"/>
146 <xsl:if test="$from <= $to">
147 <xsl:text>
	</xsl:text>
148 <xsl:value-of select="../../../@name"/>_network<xsl:value-of select="$from"/>:
149 type:tosca.nodes.network.Network
152 <xsl:value-of select="../../@name"/>_port<xsl:value-of select="$from"/>:
153 type:tosca.nodes.network.Port
156 node:<xsl:value-of select="../../@name"/>
158 node:<xsl:value-of select="../../../@name"/>_network<xsl:value-of select="$from"/>
159 <xsl:call-template name="nic.loop">
160 <xsl:with-param name="from" select="$from + 1"/>
161 <xsl:with-param name="to" select="$to"/>