IBM Support

OSLC as a foundation for DevOps

Technical Blog Post


Abstract

OSLC as a foundation for DevOps

Body

There is currently considerable interest in DevOps. And well this might be since the goal of DevOps is increased responsiveness to your customers.  One of the basic tenets of DevOps is automation of processes : have code perform what was previously painstaking manual work,  which helps achieve faster and more frequent development/deployment cycles. But, you might have tens of tools installed in your environment, each with its own interface. We need to  programmatically orchestrate the work done by these  tools and do so in a consistent way. This is the objective of scenario "Schedule and Orchestrate any vendor's Automation Plan", the principal implementing product (TWS) and the OSLC Automation workgroup.

In this post, I’ll introduce you to the components of the OSL Automation specification. More details, of course, at the various links.

The Automation specification defines three(*) types of resources to handle the three basic steps in automating a process.
(*) really many more than 3 but this is a blog post, eh ?

What can I automate ?

 An <oslc_auto: AutomationPlan> resource represents a task that is available for execution. For example ( in RDF/XML format ) :

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#&#34;
  xmlns:dcterms="http://purl.org/dc/terms/&#34;
  xmlns:oslc="http://open-services.net/ns/core#&#34;
  xmlns:oslc_auto="http://open-services.net/ns/auto#"&gt;

    <oslc_auto:AutomationPlan
      rdf:about="http://example.org/autoplans/1234"&gt;

      <dcterms:title>Deploy the bankroll application</dcterms:title>
      <dcterms:creator rdf:resource="http://myserver/myapp/users/krzysztof&#34; />

      <oslc_auto:parameterDefinition>
            <oslc:name>databaseschema</oslc:name>
            <oslc:occurs>http://open-services.net/ns/core#Exactly-one</oslc:occurs&gt;
            <oslc:propertyDefinition rdf:resource="http://open-services.net/ns/auto#ParameterDefinition&#34; />
            <oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#string"/&gt;
            <oslc:allowedValue>production</oslc:allowedValue>
            <oslc:allowedValue>personal</oslc:allowedValue>
            <oslc:allowedValue>test</oslc:allowedValue>
      </oslc_auto:parameterDefinition>

    </oslc_auto:AutomationPlan>
</rdf:RDF>

 

By returning this payload to a client query, we show that, acting as an Automation service provider, we have a “Deploy the bankroll application” process that clients can execute and that this process requires a parameter “databaseschema”. Note that we make no assumptions about how the process is actually done. This is as it should be. We want to be consistent in the invocation of the process ; the implementation is left to the service provider.

Run it !  

You send an <oslc_auto:AutomationRequest> resource to an automation service provider to start the execution of an <oslc_auto:AutomationPlan>. For example ( in RDF/XML format ) :

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#&#34;
  xmlns:dcterms="http://purl.org/dc/terms/&#34;
  xmlns:oslc="http://open-services.net/ns/core#&#34;
  xmlns:oslc_auto="http://open-services.net/ns/auto#"&gt;

    <oslc_auto:AutomationRequest>

      <dcterms:title>Bank of Tuan deployment Request</dcterms:title>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/tuan&#34; />
      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>databaseschema</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value&gt;
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>

      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/&gt;

    </oslc_auto:AutomationRequest>
</rdf:RDF>

 

This is where we can customize the request specifically to our needs:

  • we set the value of the process parameter “databaseschema” via the <oslc_auto:inputParameter> property
  • we specify what process we want to execute via the <oslc_auto:executesAutomationPlan> property

What happened ?

An <oslc_auto:AutomationResult> resource represents the execution state of an <oslc_auto:AutomationRequest>. For example ( in RDF/XML format) :

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#&#34;
  xmlns:dcterms="http://purl.org/dc/terms/&#34;
  xmlns:oslc="http://open-services.net/ns/core#&#34;
  xmlns:oslc_auto="http://open-services.net/ns/auto#&#34;
  xmlns:my_ns="http://example.org/ns/my_ns#"&gt;

    <oslc_auto:AutomationResult
      rdf:about="http://example.org/autoresults/3456"&gt;

      <dcterms:title>Bank of Tuan deployment Result</dcterms:title>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/deployuser1&#34; />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value&gt;
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>

      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>hostmachine</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Virtual Host 1</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>

      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#complete"/&gt;
      <oslc_auto:verdict rdf:resource="http://open-services.net/ns/auto#pass"/&gt;

      <oslc_auto:reportsOnAutomationPlan rdf:resource="http://example.org/autoplans/1234"/&gt;
      <oslc_auto:producedByAutomationRequest rdf:resource="http://example.org/autoreqs/2345"/&gt;

    </oslc_auto:AutomationResult>
</rdf:RDF>

 

Note that we can get intermediate as well as final execution states. The Automation specification treats all requests as asynchronous. You send an <oslc_auto:AutomationRequest> to the service provider via an HTTP POST call and the response to that request can be a 201(Created) or a 204(No Content) in which case, you will query – via an HTTP GET – for the <oslc_auto:AutomationResult> based on the value of the <oslc_auto:producedByAutomationRequest> property. 

 

[{"Business Unit":{"code":"BU050","label":"BU NOT IDENTIFIED"},"Product":{"code":"SSHPN2","label":"Tivoli"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11275886