-
Type: Improvement
-
Status: Closed
-
Priority: Critical
-
Resolution: Unresolved
-
Affects Version/s: V1.1_CSD01
-
Fix Version/s: V1.1_CSD01
-
Component/s: Spec
-
Labels:None
-
Proposal:Hide
Actual link to attachment:
https://www.oasis-open.org/apps/org/workgroup/tosca-interop/email/archives/201306/msg00008/TOSCA-CapabilityRequirementMatchingProperties-TravisTripp.docxAttachment: TOSCA-CapabilityRequirementMatchingProperties-TravisTripp.docx
<?xml version="1.0" encoding="UTF-8"?>
<Definitions id="MachineMatchingTypes" targetNamespace="http://matchingsample.com/toscaTypes"; xmlns="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes";>
<!-- import properties -->
<Import importType="http://www.w3.org/2001/XMLSchema"; location="./Property-Types.xsd" namespace="http://sample/property-types"/><!-- Capabilities and their properties would be normative -->
<CapabilityType name="SoftwareHostCapability">
<documentation>Something capable of hosting software</documentation>
<PropertiesDefinition element="SystemResources"/>
</CapabilityType><CapabilityType name="ServletContainerCapability">
<documentation>Servlet Container</documentation>
<DerivedFrom typeRef="SoftwareHostCapability"/>
<PropertiesDefinition element="ServletSpecificationVersion"/>
</CapabilityType>
<!-- Capabilities and their properties would be normative --><!-- Requirements do not have to be normative, because they can reference normative capabilities -->
<RequirementType name="SoftwareHostRequirement" requiredCapabilityType="SoftwareHostCapability">
<documentation>Host Resource Requirements</documentation>
<PropertiesDefinition element="SystemResources"/>
</RequirementType><NodeType name="SoftwareType" abstract="true">
<documentation> </documentation>
<RequirementDefinitions>
<RequirementDefinition name="softwareHostRequirement" requirementType="SoftwareHostRequirement">
<Constraints>
<Constraint constraintType=""></Constraint>
</Constraints>
</RequirementDefinition>
<!-- OS Requirement would go here as well -->
</RequirementDefinitions>
<Interfaces>
<Interface name="lifecycle.basic">
<Operation name="install"/>
<Operation name="configure"/>
<Operation name="start"/>
<Operation name="stop"/>
<Operation name="uninstall"/>
</Interface>
</Interfaces>
</NodeType><NodeType name="ApacheTomcatType">
<documentation>ApacheTomcat</documentation>
<DerivedFrom typeRef="SoftwareType"/>
<CapabilityDefinitions>
<CapabilityDefinition name="servletContainer" capabilityType="ServletContainerCapability">
<!-- according to spec, can't put properties here, can only be in topology template Need help understanding constraint-->
</CapabilityDefinition>
</CapabilityDefinitions>
</NodeType><RelationshipType name="SoftwareHostedOn">
<documentation>Hosted on</documentation>
<DerivedFrom typeRef="ns1:HostedOn"/>
<ValidSource typeRef="SoftwareHostRequirement"/>
<ValidTarget typeRef="SoftwareHostCapability"/>
</RelationshipType><ServiceTemplate id="ApacheTomcatDeployment" name="Tomcat Template">
<TopologyTemplate>
<NodeTemplate id="Tomcat" name="Tomcat" type="ApacheTomcatType">
<Properties/>
<Requirements>
<Requirement id="TomcatDeployment_minimunHostServerRequirements" name="minimunHostServerRequirements" type="SoftwareHostRequirement">
<!-- User properties to specify mapping or use constraints?--><Properties>
<SystemResources>
<NumCpus>4</NumCpus>
<MemoryInMB>64000</MemoryInMB>
<DiskInGB>10</DiskInGB>
</SystemResources>
</Properties><PropertyConstraints>
<!-- How does xpath work in the property? Capability may not be defined here and the properties are defined external to the capability-->
<PropertyConstraint property="/SystemResources/NumCpus" constraintType="http://constraint/greater-or-equal"/>
<PropertyConstraint property="/SystemResources/MemoryInMB" constraintType="http://constraint/greater-or-equal"/>
<PropertyConstraint property="/SystemResources/DiskInGB" constraintType="http://constraint/greater-or-equal"/>
</PropertyConstraints>
</Requirement>
</Requirements>
</NodeTemplate><RelationshipTemplate id="Tomcat_SoftwareHostedOn_Host" name="hosted on" type="SoftwareHostedOn">
<SourceElement ref="minimunHostServerRequirements"/>
<TargetElement ref="SoftwareHostCapability"/>
</RelationshipTemplate></TopologyTemplate>
</ServiceTemplate><!-- Now a separately developed app - pretend it isn't in this file, but a different file or CSAR all together -->
<NodeType name="MyJavaWebAppType">
<DerivedFrom typeRef="SoftwareType"/>
<RequirementDefinitions>
<RequirementDefinition name="servletContainerRequirement" requirementType="ServletSpecificationVersion"/>
<RequirementDefinition name="softwareHostRequirement" requirementType="SoftwareHostRequirement"/>
<!-- OS Requirement would go here as well -->
</RequirementDefinitions>
</NodeType><ServiceTemplate id="MyAppDeployment" name="MyAppSimpleDeployment">
<TopologyTemplate>
<NodeTemplate id="myJavaWebApp" name="myJavaWebApp" type="MyJavaWebAppType">
<Requirements>
<Requirement id="myJavaWebApp_servletContainerRequirement" name="servletContainerRequirement" type="ServletContainerCapability">
<!-- User properties to specify mapping or use constraints?-->
<Properties>
<ServletSpecificationVersion>3.0</ServletSpecificationVersion>
</Properties><PropertyConstraints>
<!-- How does xpath work in the property? Capability may not be defined here and the properties are defined external to the capability-->
<PropertyConstraint property="/ServletSpecificationVersion" constraintType="http://constraint/greater-or-equal"/>
</PropertyConstraints>
</Requirement>
</Requirements>
</NodeTemplate><RelationshipTemplate id="MyApp_SoftwareHostedOn_Host" name="hosted on" type="SoftwareHostedOn">
<SourceElement ref="ServletContainerRequirement"/>
<TargetElement ref="ServletContainerCapability"/>
</RelationshipTemplate></TopologyTemplate>
</ServiceTemplate><!-- Just Extra Stuff -->
<tosca:NodeTypeImplementation name="ApacheTomcatTypeImplementation" nodeType="ApacheTomcatType">
<tosca:ImplementationArtifacts>
<tosca:ImplementationArtifact artifactRef="UUID-1" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="install"/>
<tosca:ImplementationArtifact artifactRef="UUID-2" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="start"/>
<tosca:ImplementationArtifact artifactRef="UUID-3" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="stop"/>
<tosca:ImplementationArtifact artifactRef="UUID-4" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="configure"/>
<tosca:ImplementationArtifact artifactRef="UUID-5" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="uninstall"/>
</tosca:ImplementationArtifacts>
</tosca:NodeTypeImplementation><ArtifactType name="ScriptArtifact">
<documentation>Script Artifact</documentation>
<DerivedFrom typeRef="tns:RootArtifactType"/>
<PropertiesDefinition element="tns:ScriptArtifactProperties"/>
</ArtifactType><ArtifactTemplate id="UUID-2" type="ScriptArtifact" name="start">
<Properties>
<TOS:ScriptArtifactProperties>
<TOS:PrimaryScript>scripts/start</TOS:PrimaryScript>
</TOS:ScriptArtifactProperties>
</Properties>
<ArtifactReferences>
<ArtifactReference reference="scripts/lifecyle.basic">
<Include pattern="start"/>
</ArtifactReference>
</ArtifactReferences>
</ArtifactTemplate><!--
<NodeType name="SoftwareHost" abstract="true">
<CapabilityDefinitions>
<CapabilityDefinition name="softwareHost" capabilityType="SoftwareHostCapability">
<Properties>
<SystemResources>
<NumCpus>4</NumCpus>
<MemoryInMB>64000</MemoryInMB>
<DiskInGB>10000</DiskInGB>
</SystemResources>
</Properties>
</CapabilityDefinition>
</CapabilityDefinitions>
</NodeType>
-->
</Definitions>ShowActual link to attachment: https://www.oasis-open.org/apps/org/workgroup/tosca-interop/email/archives/201306/msg00008/TOSCA-CapabilityRequirementMatchingProperties-TravisTripp.docx Attachment: TOSCA-CapabilityRequirementMatchingProperties-TravisTripp.docx <?xml version="1.0" encoding="UTF-8"?> <Definitions id="MachineMatchingTypes" targetNamespace="http://matchingsample.com/toscaTypes"; xmlns="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes";> <!-- import properties --> <Import importType="http://www.w3.org/2001/XMLSchema"; location="./Property-Types.xsd" namespace="http://sample/property-types"/> <!-- Capabilities and their properties would be normative --> <CapabilityType name="SoftwareHostCapability"> <documentation>Something capable of hosting software</documentation> <PropertiesDefinition element="SystemResources"/> </CapabilityType> <CapabilityType name="ServletContainerCapability"> <documentation>Servlet Container</documentation> <DerivedFrom typeRef="SoftwareHostCapability"/> <PropertiesDefinition element="ServletSpecificationVersion"/> </CapabilityType> <!-- Capabilities and their properties would be normative --> <!-- Requirements do not have to be normative, because they can reference normative capabilities --> <RequirementType name="SoftwareHostRequirement" requiredCapabilityType="SoftwareHostCapability"> <documentation>Host Resource Requirements</documentation> <PropertiesDefinition element="SystemResources"/> </RequirementType> <NodeType name="SoftwareType" abstract="true"> <documentation> </documentation> <RequirementDefinitions> <RequirementDefinition name="softwareHostRequirement" requirementType="SoftwareHostRequirement"> <Constraints> <Constraint constraintType=""> </Constraint> </Constraints> </RequirementDefinition> <!-- OS Requirement would go here as well --> </RequirementDefinitions> <Interfaces> <Interface name="lifecycle.basic"> <Operation name="install"/> <Operation name="configure"/> <Operation name="start"/> <Operation name="stop"/> <Operation name="uninstall"/> </Interface> </Interfaces> </NodeType> <NodeType name="ApacheTomcatType"> <documentation>ApacheTomcat</documentation> <DerivedFrom typeRef="SoftwareType"/> <CapabilityDefinitions> <CapabilityDefinition name="servletContainer" capabilityType="ServletContainerCapability"> <!-- according to spec, can't put properties here, can only be in topology template Need help understanding constraint--> </CapabilityDefinition> </CapabilityDefinitions> </NodeType> <RelationshipType name="SoftwareHostedOn"> <documentation>Hosted on</documentation> <DerivedFrom typeRef="ns1:HostedOn"/> <ValidSource typeRef="SoftwareHostRequirement"/> <ValidTarget typeRef="SoftwareHostCapability"/> </RelationshipType> <ServiceTemplate id="ApacheTomcatDeployment" name="Tomcat Template"> <TopologyTemplate> <NodeTemplate id="Tomcat" name="Tomcat" type="ApacheTomcatType"> <Properties/> <Requirements> <Requirement id="TomcatDeployment_minimunHostServerRequirements" name="minimunHostServerRequirements" type="SoftwareHostRequirement"> <!-- User properties to specify mapping or use constraints?--> <Properties> <SystemResources> <NumCpus>4</NumCpus> <MemoryInMB>64000</MemoryInMB> <DiskInGB>10</DiskInGB> </SystemResources> </Properties> <PropertyConstraints> <!-- How does xpath work in the property? Capability may not be defined here and the properties are defined external to the capability--> <PropertyConstraint property="/SystemResources/NumCpus" constraintType="http://constraint/greater-or-equal"/> <PropertyConstraint property="/SystemResources/MemoryInMB" constraintType="http://constraint/greater-or-equal"/> <PropertyConstraint property="/SystemResources/DiskInGB" constraintType="http://constraint/greater-or-equal"/> </PropertyConstraints> </Requirement> </Requirements> </NodeTemplate> <RelationshipTemplate id="Tomcat_SoftwareHostedOn_Host" name="hosted on" type="SoftwareHostedOn"> <SourceElement ref="minimunHostServerRequirements"/> <TargetElement ref="SoftwareHostCapability"/> </RelationshipTemplate> </TopologyTemplate> </ServiceTemplate> <!-- Now a separately developed app - pretend it isn't in this file, but a different file or CSAR all together --> <NodeType name="MyJavaWebAppType"> <DerivedFrom typeRef="SoftwareType"/> <RequirementDefinitions> <RequirementDefinition name="servletContainerRequirement" requirementType="ServletSpecificationVersion"/> <RequirementDefinition name="softwareHostRequirement" requirementType="SoftwareHostRequirement"/> <!-- OS Requirement would go here as well --> </RequirementDefinitions> </NodeType> <ServiceTemplate id="MyAppDeployment" name="MyAppSimpleDeployment"> <TopologyTemplate> <NodeTemplate id="myJavaWebApp" name="myJavaWebApp" type="MyJavaWebAppType"> <Requirements> <Requirement id="myJavaWebApp_servletContainerRequirement" name="servletContainerRequirement" type="ServletContainerCapability"> <!-- User properties to specify mapping or use constraints?--> <Properties> <ServletSpecificationVersion>3.0</ServletSpecificationVersion> </Properties> <PropertyConstraints> <!-- How does xpath work in the property? Capability may not be defined here and the properties are defined external to the capability--> <PropertyConstraint property="/ServletSpecificationVersion" constraintType="http://constraint/greater-or-equal"/> </PropertyConstraints> </Requirement> </Requirements> </NodeTemplate> <RelationshipTemplate id="MyApp_SoftwareHostedOn_Host" name="hosted on" type="SoftwareHostedOn"> <SourceElement ref="ServletContainerRequirement"/> <TargetElement ref="ServletContainerCapability"/> </RelationshipTemplate> </TopologyTemplate> </ServiceTemplate> <!-- Just Extra Stuff --> <tosca:NodeTypeImplementation name="ApacheTomcatTypeImplementation" nodeType="ApacheTomcatType"> <tosca:ImplementationArtifacts> <tosca:ImplementationArtifact artifactRef="UUID-1" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="install"/> <tosca:ImplementationArtifact artifactRef="UUID-2" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="start"/> <tosca:ImplementationArtifact artifactRef="UUID-3" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="stop"/> <tosca:ImplementationArtifact artifactRef="UUID-4" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="configure"/> <tosca:ImplementationArtifact artifactRef="UUID-5" artifactType="ScriptArtifact" interfaceName="lifecyle.basic" operationName="uninstall"/> </tosca:ImplementationArtifacts> </tosca:NodeTypeImplementation> <ArtifactType name="ScriptArtifact"> <documentation>Script Artifact</documentation> <DerivedFrom typeRef="tns:RootArtifactType"/> <PropertiesDefinition element="tns:ScriptArtifactProperties"/> </ArtifactType> <ArtifactTemplate id="UUID-2" type="ScriptArtifact" name="start"> <Properties> <TOS:ScriptArtifactProperties> <TOS:PrimaryScript>scripts/start</TOS:PrimaryScript> </TOS:ScriptArtifactProperties> </Properties> <ArtifactReferences> <ArtifactReference reference="scripts/lifecyle.basic"> <Include pattern="start"/> </ArtifactReference> </ArtifactReferences> </ArtifactTemplate> <!-- <NodeType name="SoftwareHost" abstract="true"> <CapabilityDefinitions> <CapabilityDefinition name="softwareHost" capabilityType="SoftwareHostCapability"> <Properties> <SystemResources> <NumCpus>4</NumCpus> <MemoryInMB>64000</MemoryInMB> <DiskInGB>10000</DiskInGB> </SystemResources> </Properties> </CapabilityDefinition> </CapabilityDefinitions> </NodeType> --> </Definitions>
Use case described in this SC email:
https://www.oasis-open.org/apps/org/workgroup/tosca-interop/email/archives/201306/msg00008.html
---- copied here below ----
I have attached a use case document on the topic of "Requirement and Capability Matching using Capability Properties".
A few months ago, I spent some time trying to figure out how to do part of the use case in TOSCA using the current spec and didn't feel that it was addressed properly in the spec for me to feel confident in how to accomplish it. I've attached that attempt in the xml (Tomcat-TOSCA-Declare-Resource-Requirements.xml), but please be aware that it was just some playing around that I did.
I'm more than happy to talk through this document at the next interop meeting that I can attend. As of now, I should be able to attend the next meeting.
Thanks, Travis