<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.openstack.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marcin+Spoczynski</id>
		<title>OpenStack - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.openstack.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marcin+Spoczynski"/>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/wiki/Special:Contributions/Marcin_Spoczynski"/>
		<updated>2026-07-10T11:48:42Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=78504</id>
		<title>Occi</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=78504"/>
				<updated>2015-04-29T10:40:09Z</updated>
		
		<summary type="html">&lt;p&gt;Marcin Spoczynski: Update network creation script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''https://github.com/tmetsch/occi-os appears to be the latest location for this content.'''&lt;br /&gt;
&lt;br /&gt;
* '''Launchpad Entry''': NovaSpec:bexar-open-cloud-compute-interface&lt;br /&gt;
* '''Created''': 11/10/2010&lt;br /&gt;
* '''Updated''': 17/04/2012&lt;br /&gt;
* '''Contributors''': [https://blueprints.launchpad.net/~tmetsch Thijs Metsch (tmetsch)], [https://launchpad.net/~andy-edmonds Andy Edmonds (dizz)], [https://launchpad.net/~u-marcin Marcin Spoczynski (sandlbn)]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
This will implement the Open Cloud Computing Interface (OCCI) within nova/api. OCCI is one of the first standards in Cloud Computing. The specification of OCCI can be found here: http://www.occi-wg.org&lt;br /&gt;
&lt;br /&gt;
A [http://occi-wg.org/2012/04/17/occi-openstack-demo/ demonstration of the implementation is also available].&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
The OCCI interface is integrated using an WSGI application - it can coexist to the current APIs but offers a rich, flexible interoperable way to interact with [[OpenStack]] through a standardized interface.&lt;br /&gt;
&lt;br /&gt;
This implements an [[OpenStack]] service that runs out of nova-api. It is implemented using both the [[OpenStack]] service and WSGI frameworks. On start it will serve its functionality over HTTP on port 8787 as described in the OCCI specifications. It is compliant as per the set of OCCI specifications (GFD.183, GFD.184 and GFD.185) and implements all mandatory features. It also leverages the OCCI core model to expose [[OpenStack]]-specific features in an OCCI fashion. There is further detail on its core and [[OpenStack]] specific usage at http://wiki.openstack.org/occi. The implementation is co-funded by Intel Labs Europe Cloud Services Lab and FI-ware.&lt;br /&gt;
&lt;br /&gt;
== How to use the OCCI interface ==&lt;br /&gt;
&lt;br /&gt;
This guide will explain what you can do with the current OCCI implementation for [[OpenStack]].&lt;br /&gt;
&lt;br /&gt;
If you are evaluating or playing with the implementation, it is best followed sequentially.&lt;br /&gt;
&lt;br /&gt;
== Running [[OpenStack]] with OCCI ==&lt;br /&gt;
&lt;br /&gt;
Below will show you how to create an [http://www.openstack.org OpenStack] environment that is [http://www.occi-wg.org OCCI] compliant.&lt;br /&gt;
&lt;br /&gt;
=== Creating a devstack Environment ===&lt;br /&gt;
&lt;br /&gt;
With your freshly created VM, install OCCI dependencies and [devstack](http://www.devstack.org) on it.&lt;br /&gt;
&lt;br /&gt;
A pre-requisite to this is the python dev tools: `sudo apt-get install python-pip python-dev build-essential`&lt;br /&gt;
&lt;br /&gt;
1. Install pyssf&lt;br /&gt;
&lt;br /&gt;
    pip install pyssf&lt;br /&gt;
&lt;br /&gt;
2. Install devstack&lt;br /&gt;
&lt;br /&gt;
    git clone git://github.com/openstack-dev/devstack.git&lt;br /&gt;
&lt;br /&gt;
3. Install OCCI&lt;br /&gt;
&lt;br /&gt;
* Visit the [https://github.com/tmetsch/occi-os OCCI-OS github repository] and [https://github.com/tmetsch/occi-os/blob/master/README.md follow the installation instructions]. The installation process is a matter of installing another python package.&lt;br /&gt;
* Note: you should not manually set the `nova.conf` file configuration yourself, rather use the method outlined in step 4.&lt;br /&gt;
&lt;br /&gt;
4. Set the contents of `local.conf` (you may have to create the file) to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    [[post-config|$NOVA_CONF]]&lt;br /&gt;
	[DEFAULT]&lt;br /&gt;
	api_rate_limit = False&lt;br /&gt;
	allow_resize_to_same_host=True&lt;br /&gt;
	libvirt_inject_password=True&lt;br /&gt;
	enabled_apis=ec2,occiapi,osapi_compute,metadata&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Run devstack&lt;br /&gt;
&lt;br /&gt;
   ./stack.sh&lt;br /&gt;
&lt;br /&gt;
The first run will be longer than successive runs if this is the first time executing the `stack.sh` command.&lt;br /&gt;
&lt;br /&gt;
For more configuration options of [http://www.devstack.org devstack] please see the [http://www.devstack.org devstack].&lt;br /&gt;
&lt;br /&gt;
The OCCI API will be available at http://$HOST_IP:8787/&lt;br /&gt;
&lt;br /&gt;
== Using OCCI with OpenStack ==&lt;br /&gt;
&lt;br /&gt;
=== Get Authentication Credentials from Keystone ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ export KID=`curl -i -s -H &amp;quot;Content-Type: application/json&amp;quot; -d '{&amp;quot;auth&amp;quot;:{&amp;quot;identity&amp;quot;:{&amp;quot;methods&amp;quot;:[&amp;quot;password&amp;quot;],&amp;quot;password&amp;quot;:{&amp;quot;user&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;},&amp;quot;password&amp;quot;:&amp;quot;mypass&amp;quot;}}},&amp;quot;scope&amp;quot;:{&amp;quot;project&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;demo&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;}}}}}' http://localhost:5000/v3/auth/tokens | grep &amp;quot;X-Subject-Token&amp;quot; | awk '{print $2}'`&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OCCI-ness ===&lt;br /&gt;
&lt;br /&gt;
The examples below use the OCCI header format for terseness, however the recommended format is the OCCI text body format (Content-Type: text/plain).&lt;br /&gt;
&lt;br /&gt;
==== See What Can be Provisioned ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note''': you can supply the admin password and/or public ssh key pairs in this request*&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the VM id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VM=d54b4344-16be-486a-9871-2c566ef2263d&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get a Listing of VMs ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get an Individual VM's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Stop Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=stop&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: stop; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Start Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: start; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create Some a Block Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/ -H 'Category: storage; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-OCCI-Attribute: occi.storage.size = 1.0'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL=1&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Show the Volume Details: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/$VOL -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Link and Associate that Volume to the New Instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/link/ -H 'X-Auth-Token: '$KID -H 'Category: storagelink; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'X-OCCI-Attribute: occi.core.target=&amp;quot;http://localhost:8787/storage/'$VOL'&amp;quot;' -H 'X-OCCI-Attribute: occi.storagelink.deviceid=&amp;quot;/dev/vdc&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL_LINK=aa49b313-9714-4cb3-92e3-13ab484235b&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Inspect the Storage Link ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/link/$VOL_LINK -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Unlink and disassociate that volume with the new instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/link/$VOL_LINK -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/$VOL -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scale Up a VM ====&lt;br /&gt;
Let's bump the current instance from itsy (128 RAM, 1 Core) to a bitsy flavour (256 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: bitsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Scale Down a VM ====&lt;br /&gt;
Let's reduce the current instance from bitsy (256 RAM, 1 Core) to a itsy flavour (128 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Delete a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Update a VM: Change the OS ====&lt;br /&gt;
As an example, let's use SmartOS as the new OS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: SmartOS; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* this is in effect a partial update.&lt;br /&gt;
* this destroys any data directly related to the VM. It does not destroy connected volumes&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;; rel=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#group&amp;quot;; location=&amp;quot;/mygroups/&amp;quot;' -X POST localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Follows the [[OpenStack]] model. Groups of rules are associated with a compute resource.&lt;br /&gt;
* A security group is associated with a compute. This is done by the addition or removal of a mixin to/from a compute instance&lt;br /&gt;
* Security rules can be added and removed to a security group (mixin). This is done by (dis)associating the rule with the group (mixin). Rules can be created and deleted.&lt;br /&gt;
&lt;br /&gt;
==== List Security Groups ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-type: text/occi' -H 'Accept: text/plain' -H 'Category: group; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X GET localhost:8787/-/ &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''''Note'''': this will only return the specified category in the request and not the related categories. This will be fixed in pyssf in the next release.&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Rule ====&lt;br /&gt;
To do so specify the rule parameters (as a Kind) and the group the rule (as a mixin) is to belong to. This associates the rule with the respective group. Let's add a rule for inbound SSH traffic to a security rule group. This group can then be supplied when provisioning VMs. The group can also be applied an already provisioned VM.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt; &lt;br /&gt;
    curl -v -X POST localhost:8787/network/security/rule/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: rule; scheme=&amp;quot;http://schemas.openstack.org/occi/infrastructure/network/security#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.protocol = &amp;quot;TCP&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.to = 22' -H 'X-OCCI-Attribute: occi.network.security.from = 22' -H 'X-OCCI-Attribute: occi.network.security.range = &amp;quot;0.0.0.0/24&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export RULE=1233323&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List the Associated Rules/Compute Resources to a Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/mygroups/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get Security Rule's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Rule ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X DELETE http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X DELETE localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Secured VM with a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Locate External Network ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
   curl -v -X GET  localhost:8787/network/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should get a list of the networks, you can query each network to check which one is external. Look at the X-OCCI-Attribute: occi.network.label=&amp;quot;internal&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
   export EXTERNAL_NET_URL=&amp;quot;http://localhost:8787/network/fe9df68f-a2a4-4496-a5f9-2ce496d78dd0&amp;quot;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Allocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST -H 'X-Auth-token: '$KID localhost:8787/network/interface/ -H 'Category: networkinterface; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'x-occi-attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'x-occi-attribute: occi.core.target=&amp;quot;'$EXTERNAL_NET_URL'&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export NETWORK_LINK=...&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deallocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE -H 'X-Auth-token: '$KID localhost:8787/'$NETWORK_LINK&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change VM Administrative (root) Password ====&lt;br /&gt;
Note to use this functionality the `libvirt_inject_password` parameter must be set to `True` in `/etc/nova/nova.conf`&lt;br /&gt;
&lt;br /&gt;
Issue the following action:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=chg_pwd&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: chg_pwd; scheme=&amp;quot;http://schemas.openstack.org/instance/action#&amp;quot;; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.credentials.admin_pwd=&amp;quot;new_pass&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Image from an Active VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=create_image&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID  -H 'Category: create_image; scheme=&amp;quot; http://schemas.openstack.org/instance/action#; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.snapshot.image_name=&amp;quot;awesome_ware&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Marcin Spoczynski</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=74361</id>
		<title>Occi</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=74361"/>
				<updated>2015-02-25T08:58:33Z</updated>
		
		<summary type="html">&lt;p&gt;Marcin Spoczynski: /* Get Authentication Credentials from Keystone */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''https://github.com/tmetsch/occi-os appears to be the latest location for this content.'''&lt;br /&gt;
&lt;br /&gt;
* '''Launchpad Entry''': NovaSpec:bexar-open-cloud-compute-interface&lt;br /&gt;
* '''Created''': 11/10/2010&lt;br /&gt;
* '''Updated''': 17/04/2012&lt;br /&gt;
* '''Contributors''': [https://blueprints.launchpad.net/~tmetsch Thijs Metsch (tmetsch)], [https://launchpad.net/~andy-edmonds Andy Edmonds (dizz)]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
This will implement the Open Cloud Computing Interface (OCCI) within nova/api. OCCI is one of the first standards in Cloud Computing. The specification of OCCI can be found here: http://www.occi-wg.org&lt;br /&gt;
&lt;br /&gt;
A [http://occi-wg.org/2012/04/17/occi-openstack-demo/ demonstration of the implementation is also available].&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
The OCCI interface is integrated using an WSGI application - it can coexist to the current APIs but offers a rich, flexible interoperable way to interact with [[OpenStack]] through a standardized interface.&lt;br /&gt;
&lt;br /&gt;
This implements an [[OpenStack]] service that runs out of nova-api. It is implemented using both the [[OpenStack]] service and WSGI frameworks. On start it will serve its functionality over HTTP on port 8787 as described in the OCCI specifications. It is compliant as per the set of OCCI specifications (GFD.183, GFD.184 and GFD.185) and implements all mandatory features. It also leverages the OCCI core model to expose [[OpenStack]]-specific features in an OCCI fashion. There is further detail on its core and [[OpenStack]] specific usage at http://wiki.openstack.org/occi. The implementation is co-funded by Intel Labs Europe Cloud Services Lab and FI-ware.&lt;br /&gt;
&lt;br /&gt;
== How to use the OCCI interface ==&lt;br /&gt;
&lt;br /&gt;
This guide will explain what you can do with the current OCCI implementation for [[OpenStack]].&lt;br /&gt;
&lt;br /&gt;
If you are evaluating or playing with the implementation, it is best followed sequentially.&lt;br /&gt;
&lt;br /&gt;
== Running [[OpenStack]] with OCCI ==&lt;br /&gt;
&lt;br /&gt;
Below will show you how to create an [http://www.openstack.org OpenStack] environment that is [http://www.occi-wg.org OCCI] compliant.&lt;br /&gt;
&lt;br /&gt;
=== Creating a devstack Environment ===&lt;br /&gt;
&lt;br /&gt;
With your freshly created VM, install OCCI dependencies and [devstack](http://www.devstack.org) on it.&lt;br /&gt;
&lt;br /&gt;
A pre-requisite to this is the python dev tools: `sudo apt-get install python-pip python-dev build-essential`&lt;br /&gt;
&lt;br /&gt;
1. Install pyssf&lt;br /&gt;
&lt;br /&gt;
    pip install pyssf&lt;br /&gt;
&lt;br /&gt;
2. Install devstack&lt;br /&gt;
&lt;br /&gt;
    git clone git://github.com/openstack-dev/devstack.git&lt;br /&gt;
&lt;br /&gt;
3. Install OCCI&lt;br /&gt;
&lt;br /&gt;
* Visit the [https://github.com/tmetsch/occi-os OCCI-OS github repository] and [https://github.com/tmetsch/occi-os/blob/master/README.md follow the installation instructions]. The installation process is a matter of installing another python package.&lt;br /&gt;
* Note: you should not manually set the `nova.conf` file configuration yourself, rather use the method outlined in step 4.&lt;br /&gt;
&lt;br /&gt;
4. Set the contents of `local.conf` (you may have to create the file) to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    [[post-config|$NOVA_CONF]]&lt;br /&gt;
	[DEFAULT]&lt;br /&gt;
	api_rate_limit = False&lt;br /&gt;
	allow_resize_to_same_host=True&lt;br /&gt;
	libvirt_inject_password=True&lt;br /&gt;
	enabled_apis=ec2,occiapi,osapi_compute,metadata&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Run devstack&lt;br /&gt;
&lt;br /&gt;
   ./stack.sh&lt;br /&gt;
&lt;br /&gt;
The first run will be longer than successive runs if this is the first time executing the `stack.sh` command.&lt;br /&gt;
&lt;br /&gt;
For more configuration options of [http://www.devstack.org devstack] please see the [http://www.devstack.org devstack].&lt;br /&gt;
&lt;br /&gt;
The OCCI API will be available at http://$HOST_IP:8787/&lt;br /&gt;
&lt;br /&gt;
== Using OCCI with OpenStack ==&lt;br /&gt;
&lt;br /&gt;
=== Get Authentication Credentials from Keystone ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ export KID=`curl -i -s -H &amp;quot;Content-Type: application/json&amp;quot; -d '{&amp;quot;auth&amp;quot;:{&amp;quot;identity&amp;quot;:{&amp;quot;methods&amp;quot;:[&amp;quot;password&amp;quot;],&amp;quot;password&amp;quot;:{&amp;quot;user&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;},&amp;quot;password&amp;quot;:&amp;quot;mypass&amp;quot;}}},&amp;quot;scope&amp;quot;:{&amp;quot;project&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;demo&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;}}}}}' http://localhost:5000/v3/auth/tokens | grep &amp;quot;X-Subject-Token&amp;quot; | awk '{print $2}'`&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OCCI-ness ===&lt;br /&gt;
&lt;br /&gt;
The examples below use the OCCI header format for terseness, however the recommended format is the OCCI text body format (Content-Type: text/plain).&lt;br /&gt;
&lt;br /&gt;
==== See What Can be Provisioned ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note''': you can supply the admin password and/or public ssh key pairs in this request*&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the VM id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VM=d54b4344-16be-486a-9871-2c566ef2263d&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get a Listing of VMs ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get an Individual VM's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Stop Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=stop&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: stop; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Start Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: start; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create Some a Block Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/ -H 'Category: storage; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-OCCI-Attribute: occi.storage.size = 1.0'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL=1&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Show the Volume Details: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/$VOL -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Link and Associate that Volume to the New Instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/link/ -H 'X-Auth-Token: '$KID -H 'Category: storagelink; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'X-OCCI-Attribute: occi.core.target=&amp;quot;http://localhost:8787/storage/'$VOL'&amp;quot;' -H 'X-OCCI-Attribute: occi.storagelink.deviceid=&amp;quot;/dev/vdc&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL_LINK=aa49b313-9714-4cb3-92e3-13ab484235b&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Inspect the Storage Link ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/link/$VOL_LINK -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Unlink and disassociate that volume with the new instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/link/$VOL_LINK -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/$VOL -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scale Up a VM ====&lt;br /&gt;
Let's bump the current instance from itsy (128 RAM, 1 Core) to a bitsy flavour (256 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: bitsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Scale Down a VM ====&lt;br /&gt;
Let's reduce the current instance from bitsy (256 RAM, 1 Core) to a itsy flavour (128 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Delete a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Update a VM: Change the OS ====&lt;br /&gt;
As an example, let's use SmartOS as the new OS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: SmartOS; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* this is in effect a partial update.&lt;br /&gt;
* this destroys any data directly related to the VM. It does not destroy connected volumes&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;; rel=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#group&amp;quot;; location=&amp;quot;/mygroups/&amp;quot;' -X POST localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Follows the [[OpenStack]] model. Groups of rules are associated with a compute resource.&lt;br /&gt;
* A security group is associated with a compute. This is done by the addition or removal of a mixin to/from a compute instance&lt;br /&gt;
* Security rules can be added and removed to a security group (mixin). This is done by (dis)associating the rule with the group (mixin). Rules can be created and deleted.&lt;br /&gt;
&lt;br /&gt;
==== List Security Groups ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-type: text/occi' -H 'Accept: text/plain' -H 'Category: group; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X GET localhost:8787/-/ &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''''Note'''': this will only return the specified category in the request and not the related categories. This will be fixed in pyssf in the next release.&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Rule ====&lt;br /&gt;
To do so specify the rule parameters (as a Kind) and the group the rule (as a mixin) is to belong to. This associates the rule with the respective group. Let's add a rule for inbound SSH traffic to a security rule group. This group can then be supplied when provisioning VMs. The group can also be applied an already provisioned VM.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt; &lt;br /&gt;
    curl -v -X POST localhost:8787/network/security/rule/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: rule; scheme=&amp;quot;http://schemas.openstack.org/occi/infrastructure/network/security#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.protocol = &amp;quot;TCP&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.to = 22' -H 'X-OCCI-Attribute: occi.network.security.from = 22' -H 'X-OCCI-Attribute: occi.network.security.range = &amp;quot;0.0.0.0/24&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export RULE=1233323&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List the Associated Rules/Compute Resources to a Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/mygroups/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get Security Rule's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Rule ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X DELETE http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X DELETE localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Secured VM with a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Allocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST -H 'X-Auth-token: '$KID localhost:8787/network/interface/ -H 'Category: networkinterface; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'x-occi-attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'x-occi-attribute: occi.core.target=&amp;quot;/network/public&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export NETWORK_LINK=...&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deallocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE -H 'X-Auth-token: '$KID localhost:8787/'$NETWORK_LINK&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change VM Administrative (root) Password ====&lt;br /&gt;
Note to use this functionality the `libvirt_inject_password` parameter must be set to `True` in `/etc/nova/nova.conf`&lt;br /&gt;
&lt;br /&gt;
Issue the following action:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=chg_pwd&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: chg_pwd; scheme=&amp;quot;http://schemas.openstack.org/instance/action#&amp;quot;; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.credentials.admin_pwd=&amp;quot;new_pass&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Image from an Active VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=create_image&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID  -H 'Category: create_image; scheme=&amp;quot; http://schemas.openstack.org/instance/action#; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.snapshot.image_name=&amp;quot;awesome_ware&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Marcin Spoczynski</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=74360</id>
		<title>Occi</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=Occi&amp;diff=74360"/>
				<updated>2015-02-25T08:33:21Z</updated>
		
		<summary type="html">&lt;p&gt;Marcin Spoczynski: /* Get Authentication Credentials from Keystone */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''https://github.com/tmetsch/occi-os appears to be the latest location for this content.'''&lt;br /&gt;
&lt;br /&gt;
* '''Launchpad Entry''': NovaSpec:bexar-open-cloud-compute-interface&lt;br /&gt;
* '''Created''': 11/10/2010&lt;br /&gt;
* '''Updated''': 17/04/2012&lt;br /&gt;
* '''Contributors''': [https://blueprints.launchpad.net/~tmetsch Thijs Metsch (tmetsch)], [https://launchpad.net/~andy-edmonds Andy Edmonds (dizz)]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
This will implement the Open Cloud Computing Interface (OCCI) within nova/api. OCCI is one of the first standards in Cloud Computing. The specification of OCCI can be found here: http://www.occi-wg.org&lt;br /&gt;
&lt;br /&gt;
A [http://occi-wg.org/2012/04/17/occi-openstack-demo/ demonstration of the implementation is also available].&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
The OCCI interface is integrated using an WSGI application - it can coexist to the current APIs but offers a rich, flexible interoperable way to interact with [[OpenStack]] through a standardized interface.&lt;br /&gt;
&lt;br /&gt;
This implements an [[OpenStack]] service that runs out of nova-api. It is implemented using both the [[OpenStack]] service and WSGI frameworks. On start it will serve its functionality over HTTP on port 8787 as described in the OCCI specifications. It is compliant as per the set of OCCI specifications (GFD.183, GFD.184 and GFD.185) and implements all mandatory features. It also leverages the OCCI core model to expose [[OpenStack]]-specific features in an OCCI fashion. There is further detail on its core and [[OpenStack]] specific usage at http://wiki.openstack.org/occi. The implementation is co-funded by Intel Labs Europe Cloud Services Lab and FI-ware.&lt;br /&gt;
&lt;br /&gt;
== How to use the OCCI interface ==&lt;br /&gt;
&lt;br /&gt;
This guide will explain what you can do with the current OCCI implementation for [[OpenStack]].&lt;br /&gt;
&lt;br /&gt;
If you are evaluating or playing with the implementation, it is best followed sequentially.&lt;br /&gt;
&lt;br /&gt;
== Running [[OpenStack]] with OCCI ==&lt;br /&gt;
&lt;br /&gt;
Below will show you how to create an [http://www.openstack.org OpenStack] environment that is [http://www.occi-wg.org OCCI] compliant.&lt;br /&gt;
&lt;br /&gt;
=== Creating a devstack Environment ===&lt;br /&gt;
&lt;br /&gt;
With your freshly created VM, install OCCI dependencies and [devstack](http://www.devstack.org) on it.&lt;br /&gt;
&lt;br /&gt;
A pre-requisite to this is the python dev tools: `sudo apt-get install python-pip python-dev build-essential`&lt;br /&gt;
&lt;br /&gt;
1. Install pyssf&lt;br /&gt;
&lt;br /&gt;
    pip install pyssf&lt;br /&gt;
&lt;br /&gt;
2. Install devstack&lt;br /&gt;
&lt;br /&gt;
    git clone git://github.com/openstack-dev/devstack.git&lt;br /&gt;
&lt;br /&gt;
3. Install OCCI&lt;br /&gt;
&lt;br /&gt;
* Visit the [https://github.com/tmetsch/occi-os OCCI-OS github repository] and [https://github.com/tmetsch/occi-os/blob/master/README.md follow the installation instructions]. The installation process is a matter of installing another python package.&lt;br /&gt;
* Note: you should not manually set the `nova.conf` file configuration yourself, rather use the method outlined in step 4.&lt;br /&gt;
&lt;br /&gt;
4. Set the contents of `local.conf` (you may have to create the file) to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    [[post-config|$NOVA_CONF]]&lt;br /&gt;
	[DEFAULT]&lt;br /&gt;
	api_rate_limit = False&lt;br /&gt;
	allow_resize_to_same_host=True&lt;br /&gt;
	libvirt_inject_password=True&lt;br /&gt;
	enabled_apis=ec2,occiapi,osapi_compute,metadata&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Run devstack&lt;br /&gt;
&lt;br /&gt;
   ./stack.sh&lt;br /&gt;
&lt;br /&gt;
The first run will be longer than successive runs if this is the first time executing the `stack.sh` command.&lt;br /&gt;
&lt;br /&gt;
For more configuration options of [http://www.devstack.org devstack] please see the [http://www.devstack.org devstack].&lt;br /&gt;
&lt;br /&gt;
The OCCI API will be available at http://$HOST_IP:8787/&lt;br /&gt;
&lt;br /&gt;
== Using OCCI with OpenStack ==&lt;br /&gt;
&lt;br /&gt;
=== Get Authentication Credentials from Keystone ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ export KID=`curl -i -s -H &amp;quot;Content-Type: application/json&amp;quot; -d '{&amp;quot;auth&amp;quot;:{&amp;quot;identity&amp;quot;:{&amp;quot;methods&amp;quot;:[&amp;quot;password&amp;quot;],&amp;quot;password&amp;quot;:{&amp;quot;user&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;admin&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;},&amp;quot;password&amp;quot;:&amp;quot;mypass&amp;quot;}}},&amp;quot;scope&amp;quot;:{&amp;quot;project&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;demo&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;default&amp;quot;}}}}}' http://localhost:5000/v3/auth/tokens | grep &amp;quot;X-Subject-Token&amp;quot; | awk '{print $2}'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OCCI-ness ===&lt;br /&gt;
&lt;br /&gt;
The examples below use the OCCI header format for terseness, however the recommended format is the OCCI text body format (Content-Type: text/plain).&lt;br /&gt;
&lt;br /&gt;
==== See What Can be Provisioned ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note''': you can supply the admin password and/or public ssh key pairs in this request*&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the VM id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VM=d54b4344-16be-486a-9871-2c566ef2263d&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get a Listing of VMs ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get an Individual VM's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Stop Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=stop&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: stop; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Execute a Start Action Upon a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: start; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/compute/action#&amp;quot;; class=&amp;quot;action&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create Some a Block Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/ -H 'Category: storage; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-OCCI-Attribute: occi.storage.size = 1.0'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL=1&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Show the Volume Details: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/$VOL -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Link and Associate that Volume to the New Instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/storage/link/ -H 'X-Auth-Token: '$KID -H 'Category: storagelink; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'X-OCCI-Attribute: occi.core.target=&amp;quot;http://localhost:8787/storage/'$VOL'&amp;quot;' -H 'X-OCCI-Attribute: occi.storagelink.deviceid=&amp;quot;/dev/vdc&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export VOL_LINK=aa49b313-9714-4cb3-92e3-13ab484235b&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Inspect the Storage Link ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/storage/link/$VOL_LINK -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Unlink and disassociate that volume with the new instance ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/link/$VOL_LINK -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete Storage Volume ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/storage/$VOL -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scale Up a VM ====&lt;br /&gt;
Let's bump the current instance from itsy (128 RAM, 1 Core) to a bitsy flavour (256 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: bitsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Scale Down a VM ====&lt;br /&gt;
Let's reduce the current instance from bitsy (256 RAM, 1 Core) to a itsy flavour (128 RAM, 1 Core).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* This is a partial update with respect to OCCI.&lt;br /&gt;
&lt;br /&gt;
==== Delete a VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Update a VM: Change the OS ====&lt;br /&gt;
As an example, let's use SmartOS as the new OS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: SmartOS; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
_Notes:_ &lt;br /&gt;
&lt;br /&gt;
* this is in effect a partial update.&lt;br /&gt;
* this destroys any data directly related to the VM. It does not destroy connected volumes&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;; rel=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#group&amp;quot;; location=&amp;quot;/mygroups/&amp;quot;' -X POST localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Follows the [[OpenStack]] model. Groups of rules are associated with a compute resource.&lt;br /&gt;
* A security group is associated with a compute. This is done by the addition or removal of a mixin to/from a compute instance&lt;br /&gt;
* Security rules can be added and removed to a security group (mixin). This is done by (dis)associating the rule with the group (mixin). Rules can be created and deleted.&lt;br /&gt;
&lt;br /&gt;
==== List Security Groups ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-type: text/occi' -H 'Accept: text/plain' -H 'Category: group; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure/security#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X GET localhost:8787/-/ &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''''Note'''': this will only return the specified category in the request and not the related categories. This will be fixed in pyssf in the next release.&lt;br /&gt;
&lt;br /&gt;
==== Create a Security Rule ====&lt;br /&gt;
To do so specify the rule parameters (as a Kind) and the group the rule (as a mixin) is to belong to. This associates the rule with the respective group. Let's add a rule for inbound SSH traffic to a security rule group. This group can then be supplied when provisioning VMs. The group can also be applied an already provisioned VM.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt; &lt;br /&gt;
    curl -v -X POST localhost:8787/network/security/rule/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: rule; scheme=&amp;quot;http://schemas.openstack.org/occi/infrastructure/network/security#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.protocol = &amp;quot;TCP&amp;quot;' -H 'X-OCCI-Attribute: occi.network.security.to = 22' -H 'X-OCCI-Attribute: occi.network.security.from = 22' -H 'X-OCCI-Attribute: occi.network.security.range = &amp;quot;0.0.0.0/24&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For ease of this OCCI exercise, place the volume id into a shell variable e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export RULE=1233323&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List the Associated Rules/Compute Resources to a Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X GET localhost:8787/mygroups/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get Security Rule's Details ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X GET http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Rule ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -X DELETE http://localhost:8787/network/security/rule/$RULE&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -H 'X-Auth-Token: '$KID -H 'Content-Type: text/occi' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -X DELETE localhost:8787/-/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Secured VM with a Security Group ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: itsy; scheme=&amp;quot;http://schemas.openstack.org/template/resource#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: cirros-0.3.0-x86_64-uec; scheme=&amp;quot;http://schemas.openstack.org/template/os#&amp;quot;; class=&amp;quot;mixin&amp;quot;' -H 'Category: my_grp; scheme=&amp;quot;http://www.mystuff.org/sec#&amp;quot;; class=&amp;quot;mixin&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Allocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X POST -H 'X-Auth-token: '$KID localhost:8787/network/interface/ -H 'Category: networkinterface; scheme=&amp;quot;http://schemas.ogf.org/occi/infrastructure#&amp;quot;; class=&amp;quot;kind&amp;quot;' -H 'x-occi-attribute: occi.core.source=&amp;quot;http://localhost:8787/compute/'$VM'&amp;quot;' -H 'x-occi-attribute: occi.core.target=&amp;quot;/network/public&amp;quot;' -H 'Content-Type: text/occi'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    export NETWORK_LINK=...&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Deallocate Floating IP to VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    curl -v -X DELETE -H 'X-Auth-token: '$KID localhost:8787/'$NETWORK_LINK&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change VM Administrative (root) Password ====&lt;br /&gt;
Note to use this functionality the `libvirt_inject_password` parameter must be set to `True` in `/etc/nova/nova.conf`&lt;br /&gt;
&lt;br /&gt;
Issue the following action:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=chg_pwd&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'Category: chg_pwd; scheme=&amp;quot;http://schemas.openstack.org/instance/action#&amp;quot;; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.credentials.admin_pwd=&amp;quot;new_pass&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Create a Image from an Active VM ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl -v -X POST &amp;quot;localhost:8787/compute/$VM?action=create_image&amp;quot; -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID  -H 'Category: create_image; scheme=&amp;quot; http://schemas.openstack.org/instance/action#; class=&amp;quot;action&amp;quot;' -H 'X-OCCI-Attribute: org.openstack.snapshot.image_name=&amp;quot;awesome_ware&amp;quot;'&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Marcin Spoczynski</name></author>	</entry>

	</feed>