Orchestrator API

components Package

«  dispatcher Package   ::   Contents   ::   lib Package  »

components Package

api Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

Description

Base file where parent routines are defined and from where these will be inherited.

class dispatcher.components.api.VMManageAPI[source]

Bases: flask.views.MethodView

Abstract response class, used to have global implementation for unused methods.

delete(*args, **kwargs)[source]
get(*args, **kwargs)[source]
methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
options(*args, **kwargs)[source]
patch(*args, **kwargs)[source]
post(*args, **kwargs)[source]
put(*args, **kwargs)[source]

api_v1 Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

Description

API level v1 blueprint

This blueprint provides V.1 API dialect to specific functions:

  • RunAndStopVM provides start and stop VMs facilities
  • AssignReleaseVM provides facilities to reserve and release VMs for users and applications
  • SystemStatus to have always the system under control

In api_call_examples file there are several examples about how to use and deal with the middleware.

class dispatcher.components.api_v1.AssignReleaseVM[source]

Bases: dispatcher.components.api.VMManageAPI

Assign / Release VM to user

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
put(action, cloud='default')[source]

Assign or Release resources

class dispatcher.components.api_v1.AssignmentStatusVM[source]

Bases: dispatcher.components.api.VMManageAPI

Assignment status for remote clouds

get(cloud='default')[source]

Support remote resources

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
class dispatcher.components.api_v1.AuthAPI[source]

Bases: dispatcher.components.api.VMManageAPI

Authentication endpoint class, used to get auth token

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
post()[source]
class dispatcher.components.api_v1.CisternConnection(cloud)[source]

Bases: object

Service Class to route queries over CISTERN API

get_all_active_nodes()[source]

Get all nodes an then filter by activity. No extra params needed.

get_all_nodes(with_faulty_nodes=True)[source]

Get all nodes from cistern

get_node_by_field(field, value)[source]

Get all nodes an then filter by a field.

get_page(url, **kwargs)[source]

Make a request to cistern.

  • url is the url to contact, protocol and servername is added on the fly with what has been specified on initialization of the object

  • kwargs is an attribute of optional key/value pairs, should be:
    • method, the way to contact the server, default is ‘get’,
    • payload, is a dictionary structure containing additional payload useful to the request
class dispatcher.components.api_v1.CloudConnection[source]

Bases: object

Service Class, used to serve queries on demand routed over clouds.

This Class is designed to provide an uniformed layer to get

static fetch_object_by_field(cloud, method, id_obj, field)[source]

General fetching routine filtered by field

static fetch_object_by_id(cloud, method, id_obj)[source]

General fetch routine by some ids

static get_image(cloud, id_obj)[source]

get a particular image by id from your favorite cloud

static get_node(cloud, **kwargs)[source]

get a particular node by id from your favorite cloud

kwargs should contain data, a dictionary structured as

{
    "node" : 42,
    "hostname" : "this is an hostname"
}

node and hostname are complementary, is strictly necessary only one of these.

static get_size(cloud, id_obj)[source]

get a particular flavor by id from your favorite cloud

static make_query(cloud, method, **kwargs)[source]

Abstraction to make cloud queries only here. method is something like ‘list_nodes’.

This could be a good place to implement a different routine to choose which cloud to work with.

class dispatcher.components.api_v1.CloudServed[source]

Bases: dispatcher.components.api.VMManageAPI

Provides a list of the served cloud pool

get()[source]

Routine to have a list of served clouds

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
class dispatcher.components.api_v1.FooClass[source]

Bases: dispatcher.components.api.VMManageAPI

test foo class

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
put(*args, **kwargs)[source]
class dispatcher.components.api_v1.HomeAPI[source]

Bases: dispatcher.components.api.VMManageAPI

Generic root endpoint class

get()[source]
methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
post()[source]
class dispatcher.components.api_v1.ManageFirewall[source]

Bases: dispatcher.components.api.VMManageAPI

Firewall management class, used to open and close ports

get()[source]
methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
post()[source]
put()[source]
class dispatcher.components.api_v1.ManageStorage[source]

Bases: dispatcher.components.api.VMManageAPI

ToDo class

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
class dispatcher.components.api_v1.RunAndStopVM[source]

Bases: dispatcher.components.api.VMManageAPI

Provides start and stop routines to launch VMs in the cloud

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
post(cloud='default')[source]

Used to launch a new VM

request.data is the payload in JSON and should contain :

  • image : the image identifier, a string like “3c725bdb-b575-4e0f-b21b-67b0d089867d”
  • size : the size/flavor identifier, same thing as images
  • metadata : custom Key/Value metadata dictionary t0o associate with a node
  • keyname : A string containing the name of existing public key to inject into instance

Depending cloud provider needs this class could be enhanced and extended, each cloud takes his own attributes

put(cloud='default')[source]

Used to stop a VM, this is the shutdown process

class dispatcher.components.api_v1.SystemStatus[source]

Bases: dispatcher.components.api.VMManageAPI

Status management class, used to get the status of VMs

get(action, cloud='default')[source]

Factory GET routine, it accepts:

action: {flavors,images,nodes}

cloud: the source where we get data from, if not specified “default” is choosen

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
class dispatcher.components.api_v1.VMSystemMonitor[source]

Bases: dispatcher.components.api.VMManageAPI

List instances or get a single instance status

get(action)[source]
methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']

api_v2 Module

copyright:© 2015 by CRS4.
license:gpl-2, see License for more details.

Description

API level v2 blueprint

This module is a mere template for future developments.

class dispatcher.components.api_v2.VMManageAPIV2[source]

Bases: dispatcher.components.api.VMManageAPI

methods = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']

«  dispatcher Package   ::   Contents   ::   lib Package  »