This introduces a code for cataloging available instance sizes and using a new property called capacity_hints where instance_type is the field that can be specified. This addresses #40 .
For setting instance sizes vs. capacities two things should be possible: (a) set capacity_hints in request to the
desired instance size and have the orchestrator fill in the allocated_capacities field and (b) set capacities field
in request and have the orchestrator fill in capacity_hints and allocated_capacities field accordingly. In either case the
AM can use capacity_hints.instance_type to request the VM.
(a):
t = fu.ExperimentTopology()
n1 = t.add_node(name='n1', site='RENC')
caphint = fu.CapacityHints().set_fields(instance_type='fabric.c4.m16.d10')
n1.set_properties(capacity_hints=caphint)
... some time later after slice is provisioned
t.nodes['n1'].get_property('allocated_capacities') # will return Capacities object core=4, ram=16, disk=10
On orchestrator side you would then:
from fim.slivers.instance_catalog import InstanceCatalog
from fim.slivers.capacities_labels import Capacities
caphint=topo.nodes['n1'].get_property('capacity_hints')
cata = InstanceCatalog()
caps = cata.get_instance_capacities(instance_type=caphint.instance_type)
topo.nodes['n1'].set_properties(capacities=caps, allocated_capacities=caps)
# use caphint.instance_type when you get to AM
or (b):
t = fu.ExperimentTopology()
n1 = t.add_node(name='n1', site='RENC')
cap = Capacities().set_fields(core=3, ram=10, disk=10)
n1.set_properties(capacities=cap)
... some time later after slice is provisioned
t.nodes['n1'].get_property('allocated_capacities') # will return Capacities object core=4, ram=16, disk=10
t.nodes['n1'].get_property('capacity_hints') # will return CapacityHints object with instance_type='fabric.c4.m16.d10'
On orchestrator side instance size catalog can be used as follows:
from fim.slivers.instance_catalog import InstanceCatalog
from fim.slivers.capacities_labels import Capacities
cap = topo.nodes['n1'].get_property('capacities')
cata = InstanceCatalog()
it = cata.map_capacities_to_instance(cap=cap)
c_cap = cata.get_instance_capacities(instance_type=it)
caphints = CapacityHints().set_fields(instance_type=it)
topo.nodes['n1'].set_properties(capacity_hints=caphints, allocated_capacities=c_cap)
This introduces a code for cataloging available instance sizes and using a new property called
capacity_hints
whereinstance_type
is the field that can be specified. This addresses #40 .For setting instance sizes vs. capacities two things should be possible: (a) set
capacity_hints
in request to the desired instance size and have the orchestrator fill in theallocated_capacities
field and (b) setcapacities
field in request and have the orchestrator fill incapacity_hints
andallocated_capacities
field accordingly. In either case the AM can usecapacity_hints.instance_type
to request the VM.(a):
On orchestrator side you would then:
or (b):
On orchestrator side instance size catalog can be used as follows:
PyPi fabric_fim==0.53