Commit fc20d03d authored by Yann Garcia's avatar Yann Garcia
Browse files

Main app issues fixed

parent 1d304b4a
Loading
Loading
Loading
Loading
+17 −33
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ func mec011_delete_service() (err error) {
	url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/mec_service_mgmt/v1/applications/" + appsInfo.Id + "/services/" + appServiceInfo.serInstanceId
	fmt.Println(">>> mec011_delete_service: url: " + url)
	// Send request and await response
	_, _, err := send_mec_service_request(http.MethodDelete, url, nil, nil, nil, nil)
	_, _, err = send_mec_service_request(http.MethodDelete, url, nil, nil, nil, nil)
	if err != nil {
		return err
	}
@@ -755,8 +755,7 @@ func process_choice(choice []string) string {
	} else if strings.Compare(choice[0], LOGOUT) == 0 {
		err := logout()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = "Sandbox terminated"
	} else if strings.Compare(choice[0], LIST_SC) == 0 {
@@ -765,8 +764,7 @@ func process_choice(choice []string) string {
	} else if strings.Compare(choice[0], SC) == 0 {
		idx, err := verify_idx_len(choice[1], len(scenarios))
		if err != nil {
			message = fmt.Sprintf("Invalid index: %s", err.Error())
			return
			return fmt.Sprintf("Invalid index: %s", err.Error())
		}
		scenario, _ = getScenario(scenarios[idx].Id)
		message = fmt.Sprintf("Scenario %s:", fmt.Sprint(scenario))
@@ -774,20 +772,17 @@ func process_choice(choice []string) string {
		var err error
		scenarioId, err = verify_idx_len(choice[1], len(scenarios))
		if err != nil {
			message = fmt.Sprintf("Invalid index: %s", err.Error())
			return
			return fmt.Sprintf("Invalid index: %s", err.Error())
		}
		err = activateScenario(scenarios[scenarioId].Id)
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("Scenario %s activated (wait some seconds before the next command)", scenarios[scenarioId].Id)
	} else if strings.Compare(choice[0], DEACTIVATE) == 0 {
		err := terminateScenario(scenarios[scenarioId].Id)
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("Scenario %s terminated (wait some seconds before the next command)", scenarios[scenarioId].Id)
		scenarioId = -1
@@ -795,21 +790,18 @@ func process_choice(choice []string) string {
		var err error
		services, err = getListOfMECServices()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("Services:  %s", fmt.Sprint(services))
	} else if strings.Compare(choice[0], LIST_APP) == 0 {
		appsInfos, err := getListOfMECAppInstIds()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("AppInstIds:  %s", fmt.Sprint(appsInfos))
	} else if strings.Compare(choice[0], CREATE_APP) == 0 {
		if appsInfo.Id != "" {
			message = fmt.Sprintf("App instance id already created: %s", appsInfo.Id)
			return
			return fmt.Sprintf("App instance id already created: %s", appsInfo.Id)
		}
		appsInfo = client.ApplicationInfo{
			Id:       uuid.New().String(),
@@ -820,15 +812,13 @@ func process_choice(choice []string) string {
		}
		err := createMECAppInstId(&appsInfo)
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("appsInfo:  %s created", fmt.Sprint(appsInfo.Id))
	} else if strings.Compare(choice[0], DELETE_APP) == 0 {
		err := deleteMECAppInstId()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("appsInfo:  %s deleted", fmt.Sprint(appsInfo.Id))
		appsInfo.Id = ""
@@ -836,39 +826,34 @@ func process_choice(choice []string) string {
		var err error
		body, _, err := mec011_send_confirm_ready()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", string(body))
	} else if strings.Compare(choice[0], MEC011_REGISTRATION) == 0 {
		var err error
		body, _, err := mec011_send_registration()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", string(body))
	} else if strings.Compare(choice[0], MEC011_DEREGISTRATION) == 0 {
		var err error
		body, _, err := mec011_send_deregistration()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", string(body))
	} else if strings.Compare(choice[0], MEC011_CREATE_SVC) == 0 {
		var err error
		body, _, err := mec011_create_service()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", string(body))
	} else if strings.Compare(choice[0], MEC011_DELETE_SVC) == 0 {
		err := mec011_delete_service()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("MEC Service deleted:  %s", appServiceInfo.serInstanceId)
		appServiceInfo.serInstanceId = ""
@@ -876,8 +861,7 @@ func process_choice(choice []string) string {
		var err error
		body, _, err := mec030_get_v2x_uu_unicast_setting()
		if err != nil {
			message = err.Error()
			return
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", string(body))
	} else {