Recipe Requirements

This module defines the lnst.Controller.Requirements.DeviceReq and lnst.Controller.Requirements.HostReq classes, which can be used to create a global description of Requirements for a network test. You can use these to define class attributes of a lnst.Controller.Recipe.BaseRecipe derived class to specify “general” requirements for that Recipe, or you can add them to an instance of a Recipe derived class based on it’s parameters to define requirements “specific” for that single test run.

The module also specifies a lnst.Controller.Requirements._Requirements class (currently for internal use only) which serves as a container for HostReq objects, while HostReq classes also serve as containers for DeviceReq objects. The object tree created this way is translated to a dictionary used by the internal LNST matching algorithm against available machines.

class lnst.Controller.Requirements.HostReq(**kwargs)

Specifies a Agent machine requirement

To define a Host requirement you assign a HostReq instance to a class attribute of a BaseRecipe derived class.

Parameters:

kwargs (Dict[str, Any]) –

any argument will be treated as arbitrary string parameters that will be matched to parameters of Agent machines which can define their parameter values based on the implementation of the AgentMachineParser

A special case is the use of a lnst.Controller.Requirements.RecipeParam instance as value. This is used to link to a value provided as a Parameter to the Recipe.

Example:

class MyRecipe(BaseRecipe):
    m1 = HostReq()
    m2 = HostReq(architecture="x86_64")
class lnst.Controller.Requirements.DeviceReq(label, **kwargs)

Specifies a static test network Device requirement

This will be used to find a matching test machine in the configured agent machine pools, specifically this will be used to match against a test device on an agent machine that is “statically” present on the machine. In other words an actual REAL network device connected to a network usable for testing.

To define a Device requirement you assign a DeviceReq instance to a HostReq instance in a BaseRecipe derived class.

Parameters:
  • label (string) – string value indicating the network the Device is connected to

  • kwargs (Dict[str, Any]) – any other arguments will be treated as arbitrary string parameters that will be matched to parameters of Agent machines which can define their parameter values based on the implementation of the AgentMachineParser

Example:

class MyRecipe(BaseRecipe):
    m1 = HostReq()
    m1.eth0 = DeviceReq(label="net1")