fog05 package

Submodules

fog05.DLogger module

class fog05.DLogger.DLogger(file_name=None, debug_flag=False)

Bases: object

debug(caller, message)
disable()
enable()
enabled = True
error(caller, message)
info(caller, message)
instance = None
warning(caller, message)

fog05.PluginLoader module

class fog05.PluginLoader.PluginLoader(plugin_path)

Bases: object

get_plugins()
install_requirements(requirements)
load_plugin(name)
locate_plugin(name)

fog05.Schemas module

fog05.Schemas.readFile(file_path)

fog05.api module

class fog05.api.API(sysid=0)

Bases: object

This class allow the interaction with fog05 using simple Python3 API Need the distributed store

class Entity(store=None)

Bases: object

This class encapsulates the api for interaction with entities

add(manifest, node_uuid=None, wait=False)

define, configure and run an entity all in one shot :param manifest: manifest rapresenting the entity :param node_uuid: optional uuid of the node in which the entity will be added :param wait: flag for wait that everything is started before returing :return: the instance uuid

clean(entity_uuid, node_uuid, instance_uuid, wait=False)

Clean an atomic entity instance, this will destroy the instance

Parameters:
  • entity_uuid – entity for which you want to clean an instance
  • node_uuid – destionation node
  • instance_uuid – instance you want to clean
  • wait – optional wait before returning
Returns:

boolean

configure(entity_uuid, node_uuid, instance_uuid=None, wait=False)

Configure an atomic entity, creation of the instance

Parameters:
  • entity_uuid – entity you want to configure
  • node_uuid – destination node
  • instance_uuid – optional if preset will use that uuid for the atomic entity instance otherwise will generate a new one
  • wait – optional wait before returning
Returns:

intstance uuid or none in case of error

define(manifest, node_uuid, wait=False)

Defines an atomic entity in a node, this method will check the manifest before sending the definition to the node

Parameters:
  • manifest – dictionary representing the atomic entity manifest
  • node_uuid – destination node uuid
  • wait – if wait that the definition is complete before returning
Returns:

boolean

migrate(entity_uuid, instance_uuid, node_uuid, destination_node_uuid, wait=False)

Live migrate an atomic entity instance between two nodes

The migration is issued when this command is sended, there is a little overhead for the copy of the base image and the disk image

Parameters:
  • entity_uuid – ntity for which you want to migrate the instance
  • instance_uuid – instance you want to migrate
  • node_uuid – source node for the instance
  • destination_node_uuid – destination node for the instance
  • wait – optional wait before returning
Returns:

boolean

pause(entity_uuid, node_uuid, instance_uuid, wait=False)

Pause the exectution of an atomic entity instance

Parameters:
  • entity_uuid – entity for which you want to pause the instance
  • node_uuid – destination node
  • instance_uuid – instance you want to pause
  • wait – optional wait before returning
Returns:

boolean

remove(entity_uuid, node_uuid=None, wait=False)

stop, clean and undefine entity all in one shot

Parameters:
  • entity_uuid
  • node_uuid
  • wait
Returns:

the instance uuid

resume(entity_uuid, node_uuid, instance_uuid, wait=False)

resume the exectution of an atomic entity instance

Parameters:
  • entity_uuid – entity for which you want to resume the instance
  • node_uuid – destination node
  • instance_uuid – instance you want to resume
  • wait – optional wait before returning
Returns:

boolean

run(entity_uuid, node_uuid, instance_uuid, wait=False)

Starting and atomic entity instance

Parameters:
  • entity_uuid – entity for which you want to run the instance
  • node_uuid – destination node
  • instance_uuid – instance you want to start
  • wait – optional wait before returning
Returns:

boolean

search(search_dict, node_uuid=None)
stop(entity_uuid, node_uuid, instance_uuid, wait=False)

Shutting down an atomic entity instance

Parameters:
  • entity_uuid – entity for which you want to shutdown the instance
  • node_uuid – destination node
  • instance_uuid – instance you want to shutdown
  • wait – optional wait before returning
Returns:

boolean

undefine(entity_uuid, node_uuid, wait=False)

This method undefine an atomic entity in a node

Parameters:
  • entity_uuid – atomic entity you want to undefine
  • node_uuid – destination node
  • wait – if wait before returning that the entity is undefined
Returns:

boolean

class Flavor(store=None)

Bases: object

This class encapsulates the action on flavors

add(manifest, node_uuid=None)

Add a computing flavor to a node or all nodes

Parameters:
  • manifest – dictionary representing the manifest for the flavor
  • node_uuid – optional node in which add the flavor
Returns:

boolean

remove(flavor_uuid, node_uuid=None)

Remove a flavor from all nodes or a specified node

Parameters:
  • flavor_uuid – flavor to remove
  • node_uuid – optional node from which remove the flavor
Returns:

boolean

search(search_dict, node_uuid=None)
class Image(store=None)

Bases: object

This class encapsulates the action on images

add(manifest, node_uuid=None)

Adding an image to a node or to all nodes

Parameters:
  • manifest – dictionary representing the manifest for the image
  • node_uuid – optional node in which add the image
Returns:

boolean

remove(image_uuid, node_uuid=None)

remove an image for a node or all nodes

Parameters:
  • image_uuid – image you want to remove
  • node_uuid – optional node from which remove the image
Returns:

boolean

search(search_dict, node_uuid=None)
class Manifest(store=None)

Bases: object

This class encapsulates API for manifests

class Type

Bases: enum.Enum

Manifest types

ENTITY = 0
FLAVOR = 3
IMAGE = 1
NETWORK = 4
PLUGIN = 5
check(manifest, manifest_type)

This method allow you to check if a manifest is write in the correct way

Parameters:
  • manifest – a dictionary rapresenting the JSON manifest
  • manifest_type – the manifest type from API.Manifest.Type
Returns:

boolean

class Network(store=None)

Bases: object

This class encapsulates the command for Network element interaction

add(manifest, node_uuid=None)

Add a network element to a node o to all nodes

Parameters:
  • manifest – dictionary representing the manifest of that network element
  • node_uuid – optional the node uuid in which add the network element
Returns:

boolean

list(node_uuid=None)

List all network element available in the system/teneant or in a specified node

Parameters:node_uuid – optional node uuid
Returns:dictionary {node uuid: network element list}
remove(net_uuid, node_uuid=None)

Remove a network element form one or all nodes

Parameters:
  • net_uuid – uuid of the network you want to remove
  • node_uuid – optional node from which remove the network element
Returns:

boolean

search(search_dict, node_uuid=None)

Will search for a network element matching the dictionary in a single node or in all nodes

Parameters:
  • search_dict – dictionary contains all information to match
  • node_uuid – optional node uuid in which search
Returns:

a dictionary with {node_uuid, network element uuid list} with matches

class Node(store=None)

Bases: object

This class encapsulates the command for Node interaction

info(node_uuid)

Provide all information about a specific node

Parameters:node_uuid – the uuid of the node you want info
Returns:a dictionary with all information about the node
list()

Get all nodes in the current system/tenant

Returns:list of tuples (uuid, hostname)
plugins(node_uuid)

Get the list of plugin installed on the specified node

Parameters:node_uuid – the uuid of the node you want info
Returns:a list of the plugins installed in the node with detailed informations
search(search_dict)

Will search for a node that match information provided in the parameter

Parameters:search_dict – dictionary contains all information to match
Returns:a list of node matching the dictionary
class Plugin(store=None)

Bases: object

This class encapsulates the commands for Plugin interaction

add(manifest, node_uuid=None)

Add a plugin to a node or to all node in the system/tenant

Parameters:
  • manifest – the dictionary representing the plugin manifes
  • node_uuid – optional the node in which add the plugin
Returns:

boolean

list(node_uuid=None)

Same as API.Node.Plugins but can work for all node un the system, return a dictionary with key node uuid and value the plugin list

Parameters:node_uuid – can be none
Returns:dictionary {node_uuid, plugin list }
remove(plugin_uuid, node_uuid=None)

Will remove a plugin for a node or all nodes

Parameters:
  • plugin_uuid – the plugin you want to remove
  • node_uuid – optional the node that will remove the plugin
Returns:

boolean

search(search_dict, node_uuid=None)

Will search for a plugin matching the dictionary in a single node or in all nodes

Parameters:
  • search_dict – dictionary contains all information to match
  • node_uuid – optional node uuid in which search
Returns:

a dictionary with {node_uuid, plugin uuid list} with matches

class fog05.api.FOSStore(aroot, droot, home)

Bases: object

Helper class to interact with the Store

close()

Close the store

Returns:None

fog05.fosagent module

class fog05.fosagent.FosAgent(debug=True, plugins_path=None)

Bases: fog05.interfaces.Agent.Agent

get_network_plugin(cnetwork_uuid)
get_os_plugin()
run()
stop()

Module contents