GithubHelp home page GithubHelp logo

rocci-core's Introduction

rOCCI-core - A Ruby OCCI Framework

Build Status Dependency Status Gem Version Code Climate

Requirements

Ruby

  • Ruby 1.9.3 is required
  • RubyGems have to be installed
  • Rake has to be installed (e.g., gem install rake)

Dependencies

  • libxslt1-dev or libxslt-devel
  • libxml2-devor libxml2-devel

Examples

For distros based on Debian:

apt-get install ruby rubygems ruby-dev libxslt1-dev libxml2-dev
ruby -v

Unless you have Ruby >= 1.9.3, please, go to rOCCI-core#RVM and install RVM with a newer Ruby version.

For distros based on RHEL:

yum install libxml2-devel libxslt-devel ruby-devel openssl-devel gcc gcc-c++ ruby rubygems
ruby -v

Unless you have Ruby >= 1.9.3, please, go to rOCCI-core#RVM and install RVM with a newer Ruby version.

Installation

From RubyGems.org

To install the most recent stable version

gem install rake
gem install occi-core

To install the most recent beta version

gem install rake
gem install occi-core --pre

From source (dev)

Installation from source should never be your first choice! Especially, if you are not familiar with RVM, Bundler, Rake and other dev tools for Ruby!

However, if you wish to contribute to our project, this is the right way to start.

To build and install the bleeding edge version from master

git clone git://github.com/gwdg/rOCCI-core.git
cd rOCCI-core
gem install bundler
bundle install
bundle exec rake test
rake install

RVM

Notice: Follow the RVM installation guide linked below, we recommend using the default 'Single-User installation'.

Warning: NEVER install RVM as root! If you choose the 'Multi-User installation', use a different user account with sudo access instead!

rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default
ruby -v

Usage

Logging

The OCCI gem includes its own logging mechanism using a message queue. By default, no one is listening to that queue. A new OCCI Logger can be initialized by specifying the log destination (either a filename or an IO object like STDOUT) and the log level.

logger = Occi::Log.new STDOUT
logger.level = Occi::Log::INFO

You can create multiple Loggers to receive the log output.

You can always, even if there is no logger defined, log output using the class methods of OCCI::Log e.g.

Occi::Log.info("Test message")

Registering categories in the OCCI Model

Before the parser may be used, the available categories have to be registered in the OCCI Model.

For categories already specified by the OCCI WG a method exists in the OCCI Model class to register them:

model = Occi::Model.new
model.register_infrastructure

Further categories can either be registered from files which include OCCI collections in JSON formator or from parsed JSON objects (e.g. from the query interface of an OCCI service endpoint).

Parsing OCCI messages

The OCCI gem includes a Parser to easily parse OCCI messages. With a given media type (e.g. json, xml or plain text) the parser analyses the content of the message body and, if supplied, the message header. As the text/plain and text/occi media type do not clearly distinguish between a message with a category and a message with an entity which has a kind, it has to be specified if the message contains a category (e .g. for user defined mixins)

OCCI messages can be parsed to an OCCI collection for example like

media_type = 'text/plain'
body = %Q|Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"|
collection=Occi::Parser.parse(media_type, body)

Parsing OVF / OVA files

Parsing of OVF/OVA files is partly supported and will be improved in future versions.

The example in DMTF DSP 2021 is bundled with rOCCI and can be parsed to an OCCI collection with

require 'open-uri'
ova=open 'https://raw.github.com/gwdg/rOCCI/master/spec/occi/test.ova'
collection=Occi::Parser.ova(ova.read)

Currently only the following entries of OVF files are parsed

  • File in References
  • Disk in the DiskSection
  • Network in the NetworkSection
  • In the VirutalSystemSection:
    • Info
    • in the VirtualHardwareSection the items regarding
      • Processor
      • Memory
      • Ethernet Adapter
      • Parallel port

Using the OCCI model

The occi-core gem includes all OCCI Core classes necessary to handly arbitrary OCCI objects.

Changelog

Version 4.1

  • Dropped support for Rubies 1.8.x
  • Updated dependencies

Version 4.0

  • introduced compatibility mode (for OCCI-OS, on by default)
  • introduced new attribute handling for resources
  • completely rewrote OCCI parser
  • improved action and mixin handling
  • aligned with latest draft of OCCI Core and OCCI JSON specification
  • split the code into rOCCI-core, rOCCI-api and rOCCI-cli
  • internal changes, refactoring and some bugfixes

Version 3.1

  • added basic OS Keystone support
  • added support for PKCS12 credentials for X.509 authN
  • updated templates for plain output formatting
  • minor client API changes
  • several bugfixes

Version 3.0

  • many bugfixes
  • rewrote Core classes to use metaprogramming techniques
  • added VCR cassettes for reliable testing against prerecorded server responses
  • several updates to the OCCI Client
  • started work on an OCCI Client using AMQP as transport protocol
  • added support for keystone authentication to be used with the OpenStack OCCI server
  • updated dependencies
  • updated rspec tests
  • started work on cucumber features

Version 2.5

  • improved OCCI Client
  • improved documentation
  • several bugfixes

Version 2.4

  • Changed OCCI attribute properties from lowercase to first letter uppercase (e.g. type -> Type, default -> Default, ...)

Version 2.3

  • OCCI objects are now initialized with a list of attributes instead of a hash. Thus it is easier to check which attributes are expected by a class and helps prevent errors.
  • Parsing of a subset of the OVF specification is supported. Further parts of the specification will be covered in future versions of rOCCI.

Version 2.2

  • OCCI Client added. The client simplifies the execution of OCCI commands and provides shortcuts for often used steps.

Version 2.1

  • Several improvements to the gem structure and code documentation. First rSpec test were added. Readme has been extended to include instructions how the gem can be used.

Version 2.0

  • Starting with version 2.0 Florian Feldhaus and Piotr Kasprzak took over the development of the OCCI gem. The codebase was taken from the rOCCI framework and improved to be bundled as a standalone gem.

Version 1.X

  • Version 1.X of the OCCI gem has been developed by retr0h and served as a simple way to access the first OpenNebula OCCI implementation.

Development

Checkout latest version from git:

git clone git://github.com/gwdg/rOCCI-core.git

Change to rOCCI-core folder

cd rOCCI-core

Install dependencies

bundle install

Code Documentation

Code Documentation for rOCCI by YARD

Continuous integration

Continuous integration for rOCCI by Travis-CI

Contribute

  1. Fork it.
  2. Create a branch (git checkout -b my_markup)
  3. Commit your changes (git commit -am "My changes")
  4. Push to the branch (git push origin my_markup)
  5. Create an Issue with a link to your branch

rocci-core's People

Contributors

arax avatar pkasprzak avatar ffeldhaus avatar jheiss avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.