@startuml
/' SPDX-License-Identifier: Apache-2.0
   Copyright (c) 2020 Intel Corporation
'/
skinparam monochrome false
skinparam roundcorner 20
skinparam defaultFontName "Intel Clear"
skinparam defaultFontSize 20
skinparam maxmessagesize 300
skinparam sequenceArrowThickness 3

header Intel Corporation
footer Proprietary and Confidential

title Traffic Influence Notification(UP_PATH_CHANGE) flow between OpenNESS and 5G core


actor "Consumer" as user
participant "CLI" as CLI 
participant "Af Microservice" as AF 
participant "NEF" as NEF
participant "NGC CP Function" as 5GC

box "OpenNESS Controller Components" #LightBlue
	participant CLI
    participant AF
end box

box "5G Core Components" #LightGreen
	participant NEF
    participant 5GC
    note over NEF 
        OpenNESS provided 
        Core component with 
        limited functionality
    end note    

end box

group Traffic Influence - Notification(UP_PATH_CHANGE) flow

    user -> AF : /af/v1/subscriptions POST
    AF -> NEF : /3gpp-traffic-influence/v1/{afId}/subscriptions POST
    NEF -> 5GC: {Open: 3rd party NGC integration with OpenNESS(NEF)}

    5GC --> NEF : 201 Created: subscriptionId\ ERROR 
    NEF --> AF : 201 Created: subscriptionId\ ERROR 
    AF --> user : 201 Created: subscriptionId \ ERROR 
    group Variant Websocket
    user <--> AF: Establish websocket
    end
    5GC -> NEF: /3gpp-traffic-influence/v1/notification/upf POST\nNsmf_EventExposure_Notify\n(UP_PATH_CHANGE)
    NEF -> 5GC: 204 No Content
    NEF -> AF: /af/v1/notifications POST\nNsmf_EventExposure_Notify\n(UP_PATH_CHANGE)
    AF -> NEF: 204 No Content
    group Variant Websocket
    AF --> user: Afnotification (UP_PATH_CHANGE)\n
    end

    group Variant HTTP(s)
    AF --> user: Afnotification (UP_PATH_CHANGE)\n as HTTP POST
    user --> AF: Success 2xx
    end

    user -> AF : /af/v1/subscriptions/{subscriptionId} PUT
    AF -> NEF : /3gpp-traffic-influence/v1/{afId}/subscriptions/{subscriptionId} PUT
    NEF -> 5GC : {Open: 3rd party NGC integration with OpenNESS(NEF)}

    5GC --> NEF : 200 OK or 204 No Content : subscription information \ ERROR 
    NEF --> AF : 200 OK or 204 No Content : subscription information\ ERROR
    AF --> user : 200 OK or 204 No Content : subscription information\ ERROR 
    
    5GC -> NEF: /3gpp-traffic-influence/v1/notification/upf POST\nNsmf_EventExposure_Notify\n(UP_PATH_CHANGE)
    NEF -> 5GC: 204 No Content
    NEF -> AF: /af/v1/notifications POST\nNsmf_EventExposure_Notify\n(UP_PATH_CHANGE)
    AF -> NEF: 204 No Content
    group Variant Websocket
    AF --> user: Afnotification (UP_PATH_CHANGE)\n
    end

    group Variant HTTP(s)
    AF --> user: Afnotification (UP_PATH_CHANGE)\n as HTTP POST
    user --> AF: Success 2xx
    end


end
@enduml