OCCInterface is a generic application which let you explore and modify the resources of an OCCI server. Its aims are multiple:
A demo is avalaible here : http://occinterface.herokuapp.com/
If you have Docker installed (if not, you can find how to do so here), and don't want to mess with your pre-existing dev environment, you may prefer this to the next section ("How to build and run it locally").
git clone https://github.com/occiware/occiware-ozwillo.git
cd occiware-ozwillo/docker/occinterface
sudo docker build -t occinterface .
sudo docker run -p 3000:3000 occinterface
Requirement : (some versions bellow should work too but have not been tested)
NB. an easy way to install both, whatever the version of node you already have, is to install nvm :
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
nvm install v6.2.0
Build and run :
git clone https://github.com/occiware/OCCInterface.git
npm install
npm run dev
You can go to http://localhost:3000/.
Then, you need to enter the URL of the OCCI server on the input at the top of the page (without "/" at the end)
TODO
How to know the exact requests (and responses) sent by OCCInterface to the Cloud backend ?
Simple : use an in-browser Javascript debug tool. If your browser is Firefox for instance, you can install Firebug, start it and then go in its Console (or Network) tab, where you can right-click on requests and see everything - and even "copy for curl".
What is the syntax of executable REST samples ?
Short answer : see examples in src/readings such as GettingStarted.md. Long answer : read below.
What is a playground link and how to create it ?
A playground link is a clickable link that make a GET request on the API and displays its content in the codeview.
To do so, create a classic link in markdown, and make your URL begin with "/"
example:
[/resources/compute](/resources/compute)
What is a sample link and how to create it ?
A sample link is a link that post datas onto the current server when clicking on it. The formating is as follow (in markdown):
text before %{
"text": "sampleLink",
"post": {
"address": "/compute",
"datas": {
"kind":"http://schemas.ogf.org/occi/infrastructure#compute",
"attributes": {
"occi.compute.hostname" : "test",
"occi.compute.state" : "inactive"
},
"id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
}
}
}% text after
It will result into a clickable link, which will post or put datas on click:
<p>text before <a>sampleLink</a> text after</p>
You can post an array instead of an object (in the "datas" attribute). It can be put instead of posted, by using the "put" key instead of the "post" one.
If you want your sample link to post to different categories, just put an array instead of an object inside the "post" attribute. Example :
%{
"text": "sampleLink",
"post": [
{
"address": "/compute",
"kind":"http://schemas.ogf.org/occi/infrastructure#compute",
"datas": {
"attributes": {
"occi.compute.hostname" : "test",
"occi.compute.state" : "inactive"
},
"id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
}
},
{
"address": "/storage",
"datas": [
{
"kind":"http://schemas.ogf.org/occi/infrastructure#storage",
"attributes": {
"occi.storage.size" : 1000
},
"id": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
},
{
"kind":"http://schemas.ogf.org/occi/infrastructure#storage",
"attributes": {
"occi.storage.size" : 500
},
"id": "6df690d2-3158-40c4-88fb-d1c41584d689"
}
]
}
]
}%
%{
"text": "my sample link",
"del": "/6df690d2-3158-40c4-88fb-d1c41584d6e7"
}%
text before %{
"text": "my sample action link",
"post": {
"address": "/compute/6df690d2-3158-40c4-88fb-d1c41584d6e5?action=stop",
"datas": {
"action":"http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
"attributes": {
"method": "graceful"
}
}
}
}% text after
#need to be done once
heroku git:remote -a herokiRepo
npm run build
git commit -am "deployment message"
git push heroku master
Follow the instructions of the MART server : check it out, then do
mvn initialize
mvn clean install
mvn exec:java
Beware, there are several differences between MART and erocci, though OCCInterface does its best to work with both.
How to configure your Erocci Server :
Follow the instructions of erocci
Then, you need to edit the config/sys.config file. Find the "backend" section, and modify it that way :
{backends,
[
{root, erocci_backend_mnesia,
[{schema, "/path/to/config.xml"}],
<<"/">>}
]
}
Copy locally and use this file as the config.xml file.
Then, you can start the server with
./start.sh