Documentation
¶
Overview ¶
Package plugin implements a runtime for OpenBaton plugins.
Currently, only vim-drivers are supported; see the go-vimdriver-test repo for a sample implementation.
A new vim-driver plugin can be created by using the New() function together with a Driver instance:
var driver plugin.Driver = &myDriver{} params := &plugin.Params{ // insert your config here } plug, err := plugin.New(driver, params) if err != nil { panic("error: " + err.Error()) }
Ensure that your VIMDriver implements the plugin.Driver interface.
The new plugin.Plugin can then be started using its Serve() method, blocking the current goroutine. Use Stop() to stop the service and quit.
if err := plug.Serve(); err != nil { panic("error while setting up plugin: " + err.Error()) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotInitialised = errors.New("not connected yet. Retry later")
)
var (
ErrProtocolFail error = plugError{"protocol error, NFVO and plugin are out of sync"}
)
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { AddFlavour(vimInstance *catalogue.VIMInstance, deploymentFlavour *catalogue.DeploymentFlavour) (*catalogue.DeploymentFlavour, error) AddImage(vimInstance *catalogue.VIMInstance, image *catalogue.NFVImage, imageFile []byte) (*catalogue.NFVImage, error) AddImageFromURL(vimInstance *catalogue.VIMInstance, image *catalogue.NFVImage, imageURL string) (*catalogue.NFVImage, error) CopyImage(vimInstance *catalogue.VIMInstance, image *catalogue.NFVImage, imageFile []byte) (*catalogue.NFVImage, error) CreateNetwork(vimInstance *catalogue.VIMInstance, network *catalogue.Network) (*catalogue.Network, error) CreateSubnet(vimInstance *catalogue.VIMInstance, createdNetwork *catalogue.Network, subnet *catalogue.Subnet) (*catalogue.Subnet, error) DeleteFlavour(vimInstance *catalogue.VIMInstance, extID string) (bool, error) DeleteImage(vimInstance *catalogue.VIMInstance, image *catalogue.NFVImage) (bool, error) DeleteNetwork(vimInstance *catalogue.VIMInstance, extID string) (bool, error) DeleteServerByIDAndWait(vimInstance *catalogue.VIMInstance, id string) error DeleteSubnet(vimInstance *catalogue.VIMInstance, existingSubnetExtID string) (bool, error) LaunchInstance( vimInstance *catalogue.VIMInstance, name, image, Flavour, keypair string, network, secGroup []string, userData string) (*catalogue.Server, error) LaunchInstanceAndWait( vimInstance *catalogue.VIMInstance, hostname, image, extID, keyPair string, networks, securityGroups []string, s string) (*catalogue.Server, error) LaunchInstanceAndWaitWithIPs( vimInstance *catalogue.VIMInstance, hostname, image, extID, keyPair string, networks, securityGroups []string, s string, floatingIps map[string]string, keys []*catalogue.Key) (*catalogue.Server, error) ListFlavours(vimInstance *catalogue.VIMInstance) ([]*catalogue.DeploymentFlavour, error) ListImages(vimInstance *catalogue.VIMInstance) ([]*catalogue.NFVImage, error) ListNetworks(vimInstance *catalogue.VIMInstance) ([]*catalogue.Network, error) ListServer(vimInstance *catalogue.VIMInstance) ([]*catalogue.Server, error) NetworkByID(vimInstance *catalogue.VIMInstance, id string) (*catalogue.Network, error) Quota(vimInstance *catalogue.VIMInstance) (*catalogue.Quota, error) SubnetsExtIDs(vimInstance *catalogue.VIMInstance, networkExtID string) ([]string, error) Type(vimInstance *catalogue.VIMInstance) (string, error) UpdateFlavour(vimInstance *catalogue.VIMInstance, deploymentFlavour *catalogue.DeploymentFlavour) (*catalogue.DeploymentFlavour, error) UpdateImage(vimInstance *catalogue.VIMInstance, image *catalogue.NFVImage) (*catalogue.NFVImage, error) UpdateNetwork(vimInstance *catalogue.VIMInstance, network *catalogue.Network) (*catalogue.Network, error) UpdateSubnet(vimInstance *catalogue.VIMInstance, createdNetwork *catalogue.Network, subnet *catalogue.Subnet) (*catalogue.Subnet, error) }
Driver describes a VIMDriver. Every driver implementation must adhere to this interface and implements its methods.
type DriverError ¶
DriverError is a special error type that also specifies a catalogue.Server to be returned to the NFVO.
func (DriverError) Error ¶
func (e DriverError) Error() string
Error returns a description of the error.
type Params ¶
type Params struct { // BrokerAddress is the address at which the broker AMQP server can be reached. BrokerAddress string // Port of the AMQP broker. Port int // Username, Password for the AMQP broker. Username, Password string // LogFile contains the path to the log file. // Use "" to use defaults, or "-" to use stderr. LogFile string // Name is a parameter provided by the NFVO, usually "openbaton" Name string // Type is a string that identifies the type of this plugin. Type string // Workers determines how many workers the plugin will spawn. // Set this number according to your needs. Workers int // LogLevel sets the minimum logging level for the internal instance of logrus.Logger. LogLevel log.Level }
Params is a struct containing the plugin's configuration.
type Plugin ¶
type Plugin interface { // ChannelAccessor returns a closure that returns the underlying *amqp.Channel of this Plugin. ChannelAccessor() func() (*amqp.Channel, error) // Logger returns the internal logger of this Plugin. Logger() *log.Logger // Serve spawns the Plugin, blocking the current goroutine. // Serve only returns non-nil errors during the initialisation phase. // Check the log and the return value of Stop() for runtime and on-closing errors respectively. Serve() error // Stop() signals the event loop of the plugin to quit, and waits until either it shuts down or // it times out. Stop() error // Type() returns the type of this plugin, as specified by its parameters during construction. Type() string }
Plugin represents a plugin instance.