The Alloy API project is a restful api for Alloy functionality in the Crucible ecosystem. By default, alloy.api is available at localhost:4402, with the Swagger page at localhost:4402/swagger/index.html.
From the Alloy.Api folder ... $ dotnet ef migrations add --project ..\Alloy.Api.Migrations.PostgreSQL\Alloy.Api.Migrations.PostgreSQL.csproj
Guid IdGuid? ViewId(Player, a view eventTemplate)Guid? DirectoryId(Caster)Guid? ScenarioTemplateId(Steamfitter)string Namestring Descriptionint DurationHours
Guid IdGuid EventTemplateId(Alloy)Guid UserIdGuid? ViewId(Player)Guid? WorkspaceId(Caster)Guid? RunId(Caster)Guid? ScenarioId(Steamfitter)string Namestring DescriptionEventStatus StatusDateTime? LaunchDateDateTime? EndDateDateTime? ExpirationDate
Alloy will deploy a lab/odx as a Caster workspace, including the workspace specific variables file. Variables include:
- Player View ID
- Player Team Names
Then, Alloy will:
- Create a run
- Create a plan
- Apply the plan
Caster will write the ViewId and the TeamId from Player to each VM's guest info variables.
Alloy will get all authorized view/directories from caster.api.
Player.api must have an idea of an View eventTemplate. Alloy will get all authorized View eventTemplates from the player.api. Player.api must have a CreateViewFromViewEventTemplate endpoint.
Alloy will get all authorized scenarioTemplates from steamfitter.api. Alloy will call the CreateScenarioFromScenarioTemplate endpoint.
Determine if an event already exists that can be rejoined or if a new event needs to be created.
GET /eventTemplates/{eventTemplateId}/events/mine- check for
activestatus
If there is an active event, then present option to rejoin and skip launch.
- Create a new event from the eventTemplate.
POST /eventTemplates/{eventTemplateId}/events
- Clone the Player view.
- Deploy a new Caster workspace in the Caster directory.
CreateWorkspaceFromDirectory- Create a
Runfor the workspace - Wait for the
Runto bePlannedstatus - Apply the
Run - Wait for the
Runto beAppliedstatus
- Create a Steamfitter scenario from the scenarioTemplate.
- Set the Event status to
active.
- Set Player view to
Inactive. - End the Steamfitter scenario.
- Destroy the Caster workspace.
- Create an
isDestroyRunfor the workspace - Wait for the
Runto bePlannedstatus - Apply the
Run - Wait for the
Runto beAppliedstatus
- Create an
- Set the Event status to
endedorexpired.
The entire Launch and End processes will be single background tasks that poll the Caster API for each status change, update the event database record appropriately, and then move on to the next step in the process.
Think you found a bug? Please report all Crucible bugs - including bugs for the individual Crucible apps - in the cmu-sei/crucible issue tracker.
Include as much detail as possible including steps to reproduce, specific app involved, and any error messages you may have received.
Have a good idea for a new feature? Submit all new feature requests through the cmu-sei/crucible issue tracker.
Include the reasons why you're requesting the new feature and how it might benefit other Crucible users.
Copyright 2021 Carnegie Mellon University. See the LICENSE.md files for details.