Commit 38f37623 authored by Yann Garcia's avatar Yann Garcia
Browse files

Finalyze MEC-016 support; Cleanup logs

parent e07bfdc1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ cp -Rp $DEMOBIN $MEEPDAI_ONBOARDEDAPP_PATH

if [ "$REBUILD_DAI" != "" ]; then
    echo ">>> Building DAI micro-service"
    meepctl build meep-dai --nolint
    meepctl build meep-dai #--nolint
    echo ">>> Dockerizing DAI micro-service with new onboarded MEC applications"
    meepctl dockerize meep-dai
fi
+0 −1
Original line number Diff line number Diff line
@@ -32,4 +32,3 @@ func DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) {
func DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) {
	demo4DaiAppLocationAvailabilityPOST(w, r)
}
+5 −23
Original line number Diff line number Diff line
@@ -248,7 +248,6 @@ func Init(envPath string, envName string) (port string, err error) {
// }

func getApplicationInfo(appId string) (appInfo sbx.ApplicationInfo, err error) {
	log.Info(">>> getApplicationInfo: ", appId)
	appInfo, resp, err := sandBoxClient.ApplicationsApi.ApplicationsAppInstanceIdGET(context.TODO(), appId)
	if err != nil {
		log.Info("Failed to retrieve mec application resource ", err)
@@ -261,20 +260,16 @@ func getApplicationInfo(appId string) (appInfo sbx.ApplicationInfo, err error) {
}

// func getAllApplicationInfo() (appInfo []sbx.ApplicationInfo, err error) {
// 	log.Info(">>> getAllApplicationInfo")
// 	appInfo, resp, err := sandBoxClient.ApplicationsApi.ApplicationsGET(context.TODO(), nil)
// 	if err != nil {
// 		log.Info("Failed to retrieve mec application resource ", err)
// 		return appInfo, err
// 	}
// 	log.Debug("getAllApplicationInfo: Receive confirmation acknowlegement ", resp.Status)
// 	log.Debug("getAllApplicationInfo: appInfo: ", appInfo)

// 	return appInfo, nil
// }

func demo4Register() (err error) {
	log.Info(">>> demo4Register: ", appEnabled)

	mutex.Lock()
	defer mutex.Unlock()
@@ -394,7 +389,6 @@ func demo4Register() (err error) {

// Channel sync consume channel listen for app termination
func Run(msg chan bool) {
	log.Info(">>> run: ", appEnabled)

	err := demo4Register()
	if err != nil {
@@ -406,7 +400,6 @@ func Run(msg chan bool) {

// Terminate by deleting all resources allocated on MEC platform & mec app
func Terminate() {
	log.Info(">>> Terminate: ", terminated)

	// Only invoke graceful termination if not terminated (triggerd by mec platform)
	if !terminated {
@@ -545,7 +538,6 @@ func serviceAvailNotificationCallback(w http.ResponseWriter, r *http.Request) {

// Client request to notify mec platform of mec app
func sendReadyConfirmation(appInstanceId string) error {
	log.Info(">>> sendReadyConfirmation: ", appInstanceId)

	var appReady asc.AppReadyConfirmation
	appReady.Indication = "READY"
@@ -565,7 +557,6 @@ func sendReadyConfirmation(appInstanceId string) error {

// Client request to retrieve list of mec service resources on sandbox
func getMecServices() ([]smc.ServiceInfo, error) {
	log.Info(">>> getMecServices")

	appServicesResponse, _, err := srvMgmtClient.MecServiceMgmtApi.ServicesGET(context.TODO(), nil)
	if err != nil {
@@ -573,7 +564,6 @@ func getMecServices() ([]smc.ServiceInfo, error) {
		return nil, err
	}

	log.Info("<<< getMecServices: ", appServicesResponse)
	return appServicesResponse, nil
}

@@ -713,8 +703,7 @@ func unregisterService(appInstanceId string, serviceId string) error {

// Client request to delete app-termination subscriptions
func delAppTerminationSubscription(appInstanceId string, subscriptionId string) error {
	log.Debug(">>> delAppTerminationSubscription: appInstanceId: ", appInstanceId)
	log.Debug(">>> delAppTerminationSubscription: subscriptionId: ", subscriptionId)

	resp, err := appSupportClient.MecAppSupportApi.ApplicationsSubscriptionDELETE(context.TODO(), appInstanceId, subscriptionId)
	status := strconv.Itoa(resp.StatusCode)
	if err != nil {
@@ -729,8 +718,7 @@ func delAppTerminationSubscription(appInstanceId string, subscriptionId string)

// Client request to delete subscription of service-availability notifications
func delsubscribeAvailability(appInstanceId string, subscriptionId string) error {
	log.Debug(">>> delsubscribeAvailability: appInstanceId: ", appInstanceId)
	log.Debug(">>> delsubscribeAvailability: subscriptionId: ", subscriptionId)

	resp, err := srvMgmtClient.MecServiceMgmtApi.ApplicationsSubscriptionDELETE(context.TODO(), appInstanceId, subscriptionId)
	status := strconv.Itoa(resp.StatusCode)
	if err != nil {
@@ -820,8 +808,6 @@ const (

// REST API sends ping request and get response
func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> demo4DaiDoPingGET: ", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	// Check if a MEC application context is existing
@@ -935,8 +921,6 @@ func demo4DaiDoPingPOST(w http.ResponseWriter, r *http.Request) {

// REST API creates an existing instance of an onboarded MEC application
func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> demo4DaiDoPingDELETE: ", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	log.Debug("demo4DaiDoPingDELETE: appContexts= ", appContexts)
@@ -988,8 +972,6 @@ func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) {

// REST API retrieve location constraints of an existing instance of an onboarded MEC application
func demo4DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) {
	log.Info(">>> demo4DaiAppLocationAvailabilityPOST: ", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	// Check if a MEC application context is existing
+0 −2
Original line number Diff line number Diff line
@@ -21,14 +21,12 @@ const (
)

func main() {
	log.Printf(">>> main")
	err := server.Init()
	if err != nil {
		log.Fatal("Failed to initalize onboarded-demo4 ", err)
	}

	// Channel sync pass channel listen for app termination
	log.Printf("main: Run")
	server.Run()

	FrontendApiService := server.NewFrontendApiService()
+0 −61
Original line number Diff line number Diff line
{
    "appList":
        [
            {
                "appInfoList":
                    [
                        {
                            "appDId": "appDId1",
                            "appName": "appName1",
                            "appProvider": "appProvider1",
                            "appSoftVersion": "appSoftVersion1",
                            "appDVersion": "appDVersion1",
                            "appDescription": "appDescription1",
                            "appLocation":
                                [
                                    {
                                        "area":
                                            {
                                                "coordinates":
                                                    [
                                                        [
                                                            [7.43166,43.736156],[7.431723,43.736115],[7.431162,43.735607],[7.430685,43.73518]
                                                        ]
                                                    ]
                                            },
                                        "countryCode": "countryCode1"
                                    },
                                    {
                                        "civicAddressElement": 
                                            [
                                                {
                                                    "caType": 2,
                                                    "caValue": "Value2"
                                                },
                                                {
                                                    "caType": 20,
                                                    "caValue": "Value20"
                                                }
                                            ]
                                    }
                                ],
                            "appCharcs":
                                [
                                    {
                                        "memory": 2048,
                                        "storage": 2048,
                                        "latency": 2048,
                                        "bandwidth": 2048,
                                        "serviceCont": 1
                                    }
                                ],
                            "cmd": "uptime",
                            "args":null
                        }
                    ],
                    "vendorSpecificExt": {
                        "vendorId": "vendorId1"
                    }
            }
        ]
}
Loading