Provider::Static

The static provider of EnOSlib lets you use a bunch of resources of you own. For instance you have a bunch of Raspberry Pis and would like to run some experiments on them.

Hint

For a complete schema reference see Static Schema

Basic example

Assuming that you have two machines and a network, you can describe your infrastructure like the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from enoslib.infra.enos_static.provider import Static
from enoslib.infra.enos_static.configuration import Configuration

import logging
import os

logging.basicConfig(level=logging.INFO)

# Use existing resources
conf = (
    Configuration()
    .add_machine(
        roles=["control"],
        address="192.168.42.245",
        alias="static-0",
        user="root"
    )
    .add_machine(
        roles=["compute"],
        address="192.168.42.244",
        alias="static-1",
        user="root"
    )
    .add_network(
        roles=["mynetwork"],
        cidr="192.168.42.0/24",
        start="192.168.42.100",
        end="192.168.42.200",
        gateway="192.168.42.1",
        dns="8.8.8.8"
    )
    .finalize()
)

provider = Static(conf)

roles, networks = provider.init()
print(roles)
print(networks)

More generally, you’ll have to describe exhaustively what you have.

Advanced usage: combining EnOSlib projects

Let’s assume you want have access to two EnOSlib projects and you are using Grid’5000. You can use both projects using a single reservation by leveraging the static provider of each project. Here is a sketch of the workflow you can use:

  • merge the resource claim of both projects
  • make one call to the Grid’5000 provider
  • split the roles and networks given back by the provider
  • instantiate two static provider (one for each sub-project) with the corresponding resources description.