Cherry Application LCM Step 4 - Create Config

Sequence Diagram

 Click here to view PlantUML Source

@startuml
Title Application LCM Step 4 - Create Instance Config
skinparam sequenceArrowThickness 2
skinparam ParticipantPadding 5
skinparam BoxPadding 10
skinparam ArrowColor #blue
autonumber

Box Personnel #lightblue
   Actor sOP as "SMO Operator" <<INT OTF>>
End box

Box "SMO" #gold
   Boundary MC as "Model Catalog" <<SMO MVC State Manager>>
   Boundary VI as "Virtual Inventory" <<SMO MVC State Manager>>
   Boundary IC as "Instance Config" <<SMO MVC State Manager>>
end box

== Configure ==

Note over MC,IC
In this step the VI frameworks is expected to be populated.
Normally the configuration would provide back the "definition" to enable a GUI
since we don't have a GUI the sOP has a predefined configuration instance.
end note

sOP -> IC : PUT ../serviceConfig/V1/serviceConfigurations/{serviceConfigLabel} {serviceInstanceConfig}

note left of IC
The Service Config is a container for resource configurations. As such there
Is nothing to modify therefore PUT is used for create since the user defines
The label. However there is no update allowed.
End note

IC -> IC :
Note Left : Check if Label already exists
Alt if ServiceConfigLabel already exists then
   IC --> sOP : 409 conflict: {ServiceConfigLabel} already exists.
End

IC -> MC : GET ..modelCatalof/v1/applications/{serviceInstanceConfig.applicationVersionID}
Alt if 404 not found then
   IC --> sOP : 412 Precondition failed: {appVersionID} not found.
Else if application.state is NOT Available then
   IC --> sOP : 412 Precondition failed: Application state Available expected but found {application.state}
end

IC -> MC : GET ..modelCatalof/v1/applications/{serviceInstanceConfig.applicationVersionID}/applicationServiceModels/{serviceInstanceConfig.serviceModelID}
Alt if 404 not found then
   IC --> sOP : 412 Precondition failed: {ServiceModelID} not found.
end

IC -> IC :
Note left: Create record, State=CREATING

IC --> sOP : return 202 created

Loop for each serviceResource in the ServiceModel
   sOP -> IC : PUT ../serviceConfig/V1/serviceConfigurations/{serviceConfigLabel}/resourceConfigurations/{resourceConfigLabel} {resourceConfig}

   IC -> IC :
   Alt if 404 not found then
      IC --> sOP : 412 Precondition failed: {serviceConfigLabel} not found.
   end
   Note left of IC
     serviceConfig = GET ../serviceConfigurations/{resourceConfig.ServiceConfigID}
   end note

   IC -> VI :
   Alt if 404 not found then
      IC --> sOP : 412 Precondition failed: {RICDeploymentID} not found.
   end
   Note left of IC
     managementFunction = GET ../deployments/v1/deployments/{resourceConfig.RICDeploymentID}
   end note

   IC -> MC :
   Alt if 404 not found then
      IC --> sOP : 412 Precondition failed: {ApplicationID}.{ServiceModelID} not found.
   end
   Note left of IC
     serviceModel = GET  ../modelCatalog/{resourceConfig.applicationID}/applicationServiceModels/{resourceConfig.serviceModelID}
   end note

   IC -> MC :
   Alt if 404 not found then
      IC --> sOP : 412 Precondition failed: {applicationID}.{serviceModelID}.{resourceID} not found.
   end
   Note left of IC
     resourceModel = GET  ../modelCatalog/{resourceConfig.applicationID}/applicationServiceModels/{resourceConfig.serviceModelID}/serviceResources/{resourceConfig.resourceID}
   end note

   alt if {managementFunction.appType} <> {resourceModel.resourceType} then
      IC --> sOP : 412 Precondition failed: expected {managementFunction.appType} but found {resourceModel.resourceType}
   end if

   IC -> IC :
   Note left: Create record, State=READY

   group serviceConfig State Check
      Note left of IC : Set serviceConfigTargetState = READY
      Loop For each resource in ServiceModelResources
         IC -> IC
         Note left: GET resourceConfig with resourceID={resource}
         Alt if 404 not found then
           Note left of IC
             Set serviceConfigTargetState = CREATING
             Exit loop
           End note
         End if
      End

      Alt If serviceConfig.State <> serviceConfigTargetState then
         IC -> IC :
         Note left: Update ServiceConfig State to READY
      End if
   End

   IC --> sOP : return 202 created

End

@enduml