Documentation Index
Fetch the complete documentation index at: https://mintlify.com/markitobonito/cloud_repositorio/llms.txt
Use this file to discover all available pages before exploring further.
OrchestratorAPI is the primary entry point for managing slices programmatically. It coordinates the Database, DeploymentAPI, VMLauncher, and VLANManager to provide a high-level interface for the full VM lifecycle — from slice creation and topology design through deployment and teardown.
Constructor
__init__(db, deployment_api)
A
Database instance used for all persistence operations (slices, users, ID counters).A
DeploymentAPI instance. Its .executor attribute is used internally to construct VMLauncher and VLANManager.workers_list from the database to initialise the round-robin worker selector. If workers_list is absent the default list ["10.0.10.1", "10.0.10.2", "10.0.10.3"] is used.
Methods
create_slice(username, slice_name, topology_type="custom") → (bool, dict | str)
Creates a new slice record in the database and registers it on the given user.
Must match an existing user in the database. Returns
(False, "User not found") otherwise.Human-readable label returned in the success payload. Not persisted in the database — the slice is identified by its numeric
slice_id.Topology descriptor stored on the
Slice object (e.g. "custom", "linear", "star").(True, {"slice_id": int, "name": str})— slice created successfully.(False, error_str)— user not found or unexpected exception.
slice_id at creation time (see Slice).
add_vm_to_slice(username, slice_id, vm_name, flavor_name, data_interfaces_count, internet_enabled=False) → (bool, dict | str)
Creates a VM object (with QCOW2 backing image) and appends it to the named slice.
Must own the slice. Returns
(False, "Not authorized") otherwise.Numeric slice identifier returned by
create_slice.Human-readable VM name, used as the QCOW2 filename prefix (
{vm_name}_img.qcow2).Must be
"cirros" or "ubuntu". Any other value returns (False, "Invalid flavor").Number of data interfaces to create (
eth1, eth2, …). These are created without a VLAN assignment and become available for linking.When
True, eth0 is assigned to VLAN 400 and given an IP in the 10.60.7.0/24 management range. When False, eth0 is created with no VLAN.(True, vm_dict)—vm_dictis the full serialized VM object includingvm_id,vnc_port,worker_ip,interfaces, andqcow_image.(False, error_str)— user/slice not found, quota exceeded, invalid flavor, QCOW creation failure, or unexpected exception.
used_vms counter is incremented by 1 on success.
create_link(username, slice_id, vm1_id, vm1_interface, vm2_id, vm2_interface) → (bool, dict | str)
Creates a Layer-2 link between two VM interfaces by assigning the next available VLAN from the slice pool and recording it on both interfaces.
Must own the slice.
Slice that contains both VMs.
ID of the first VM.
Interface name on the first VM, e.g.
"eth1".ID of the second VM.
Interface name on the second VM, e.g.
"eth1".(True, link_dict)— includeslink_id,vlan_id,vm1_id,vm1_interface,vm2_id,vm2_interface.(False, "VLAN pool exhausted")— all 20 VLANs in the slice pool are in use.(False, error_str)— slice not found, not authorized, or unexpected exception.
vlan_id and link_id fields updated in the database before returning.
deploy_slice(username, slice_id) → (bool, str)
Deploys a slice by configuring VLANs on the network node and launching all VMs on their assigned workers.
Must own the slice.
Slice to deploy. Must be in
"design" status; returns an error if already "running".Internet VLAN
If any VM interface has
vlan_id == 400, calls VLANManager.create_vlan_with_gateway(400, "10.60.7.0/24", "10.60.7.1") followed by enable_internet_for_vlan(400, "10.60.7.0/24").Per-link VLANs
For each link in the slice, derives
cidr = "192.168.{vlan_id % 256}.0/24" and calls create_vlan_with_gateway(vlan_id, cidr, gateway_ip, dhcp_enabled=True). Fails fast on the first VLAN configuration error.(True, "Slice deployed successfully")— all VLANs configured and all VMs running.(False, error_str)— first failure encountered during any step.
"running" in the database only if all steps succeed.
delete_slice(username, slice_id) → (bool, str)
Tears down a slice and frees all associated resources.
Must own the slice.
Slice to delete.
- If running: stops each VM via
VMLauncher.stop_vm()(kills QEMU, removes TAP devices from OVS), then deletes each link VLAN viaVLANManager.delete_vlan(). - Always: deletes QCOW2 images via
DeploymentAPI.delete_vm_dict()for each VM. - Always: removes the slice record from the database, removes
slice_idfromuser["slices"], and decrementsuser["used_vms"]by the VM count (floored at 0).
(True, "Slice deleted")(False, error_str)— slice not found, not authorized, or unexpected exception.
get_next_worker() → str
Returns the IP address of the next worker node using a round-robin strategy. The internal round_robin_idx counter is incremented on each call.
This is an internal method called automatically by
add_vm_to_slice. The worker list is populated from database.yaml under the key workers_list. Update that list to change which nodes receive new VMs.