@@ -17,7 +17,8 @@ use gateway_types::{
1717 } ,
1818 component_details:: SpComponentDetails ,
1919 host:: { ComponentFirmwareHashStatus , HostStartupOptions } ,
20- ignition:: { IgnitionCommand , SpIgnitionInfo } ,
20+ ignition,
21+ //ignition::{IgnitionCommand, SpIgnitionInfo},
2122 rot:: { RotCfpa , RotCfpaSlot , RotCmpa , RotState } ,
2223 sensor:: SpSensorReading ,
2324 task_dump:: TaskDump ,
@@ -45,6 +46,7 @@ api_versions!([
4546 // | example for the next person.
4647 // v
4748 // (next_int, IDENT),
49+ ( 2 , COSMO ) ,
4850 ( 1 , INITIAL ) ,
4951] ) ;
5052
@@ -407,10 +409,43 @@ pub trait GatewayApi {
407409 #[ endpoint {
408410 method = GET ,
409411 path = "/ignition" ,
412+ operation_id = "ignition_list" ,
413+ versions = VERSION_INITIAL ..VERSION_COSMO
410414 } ]
411- async fn ignition_list (
415+ async fn ignition_list_v1 (
412416 rqctx : RequestContext < Self :: Context > ,
413- ) -> Result < HttpResponseOk < Vec < SpIgnitionInfo > > , HttpError > ;
417+ ) -> Result < HttpResponseOk < Vec < ignition:: v1:: SpIgnitionInfo > > , HttpError > ;
418+
419+ /// List SPs via Ignition
420+ ///
421+ /// Retreive information for all SPs via the Ignition controller. This is
422+ /// lower latency and has fewer possible failure modes than querying the SP
423+ /// over the management network.
424+ #[ endpoint {
425+ method = GET ,
426+ path = "/ignition" ,
427+ operation_id = "ignition_list" ,
428+ versions = VERSION_COSMO ..
429+ } ]
430+ async fn ignition_list_v2 (
431+ rqctx : RequestContext < Self :: Context > ,
432+ ) -> Result < HttpResponseOk < Vec < ignition:: v2:: SpIgnitionInfo > > , HttpError > ;
433+
434+ /// Get SP info via Ignition
435+ ///
436+ /// Retreive information for an SP via the Ignition controller. This is
437+ /// lower latency and has fewer possible failure modes than querying the SP
438+ /// over the management network.
439+ #[ endpoint {
440+ method = GET ,
441+ path = "/ignition/{type}/{slot}" ,
442+ operation_id = "ignition_get" ,
443+ versions = VERSION_INITIAL ..VERSION_COSMO
444+ } ]
445+ async fn ignition_get_v1 (
446+ rqctx : RequestContext < Self :: Context > ,
447+ path : Path < PathSp > ,
448+ ) -> Result < HttpResponseOk < ignition:: v1:: SpIgnitionInfo > , HttpError > ;
414449
415450 /// Get SP info via Ignition
416451 ///
@@ -420,11 +455,13 @@ pub trait GatewayApi {
420455 #[ endpoint {
421456 method = GET ,
422457 path = "/ignition/{type}/{slot}" ,
458+ operation_id = "ignition_get" ,
459+ versions = VERSION_COSMO ..
423460 } ]
424- async fn ignition_get (
461+ async fn ignition_get_v2 (
425462 rqctx : RequestContext < Self :: Context > ,
426463 path : Path < PathSp > ,
427- ) -> Result < HttpResponseOk < SpIgnitionInfo > , HttpError > ;
464+ ) -> Result < HttpResponseOk < ignition :: v2 :: SpIgnitionInfo > , HttpError > ;
428465
429466 /// Send an ignition command targeting a specific SP.
430467 ///
@@ -437,10 +474,31 @@ pub trait GatewayApi {
437474 #[ endpoint {
438475 method = POST ,
439476 path = "/ignition/{type}/{slot}/{command}" ,
477+ operation_id = "ignition_command" ,
478+ versions = VERSION_INITIAL ..VERSION_COSMO
440479 } ]
441- async fn ignition_command (
480+ async fn ignition_command_v1 (
442481 rqctx : RequestContext < Self :: Context > ,
443- path : Path < PathSpIgnitionCommand > ,
482+ path : Path < ignition:: v1:: PathSpIgnitionCommand > ,
483+ ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
484+
485+ /// Send an ignition command targeting a specific SP.
486+ ///
487+ /// This endpoint can be used to transition a target between A2 and A3 (via
488+ /// power-on / power-off) or reset it.
489+ ///
490+ /// The management network traffic caused by requests to this endpoint is
491+ /// between this MGS instance and its local ignition controller, _not_ the
492+ /// SP targeted by the command.
493+ #[ endpoint {
494+ method = POST ,
495+ path = "/ignition/{type}/{slot}/{command}" ,
496+ operation_id = "ignition_command" ,
497+ versions = VERSION_COSMO ..
498+ } ]
499+ async fn ignition_command_v2 (
500+ rqctx : RequestContext < Self :: Context > ,
501+ path : Path < ignition:: v2:: PathSpIgnitionCommand > ,
444502 ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
445503
446504 /// Get the current power state of a sled via its SP.
@@ -683,13 +741,3 @@ pub struct GetCfpaParams {
683741pub struct GetRotBootInfoParams {
684742 pub version : u8 ,
685743}
686-
687- #[ derive( Deserialize , JsonSchema ) ]
688- pub struct PathSpIgnitionCommand {
689- /// ID for the SP that the gateway service translates into the appropriate
690- /// port for communicating with the given SP.
691- #[ serde( flatten) ]
692- pub sp : SpIdentifier ,
693- /// Ignition command to perform on the targeted SP.
694- pub command : IgnitionCommand ,
695- }
0 commit comments