Loading examples/demo6/golang/app_instance.yaml +2 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,6 @@ localurl: 'http://' # Set host port number of demo-6. Example field: '8093' port: '80' # Callback base URL callbackUrl: 'http://mec-platform2.etsi.org' callbackUrl: 'http://lab-oai.etsi.org' # Callback port for listener callbackPort: '31111' callbackPort: '80' examples/demo6/golang/main.go +199 −4 Original line number Diff line number Diff line Loading @@ -324,6 +324,13 @@ const ( MEC040_FED_SUB_POST = "3" MEC040_FED_SUB_GET = "4" MEC040_FED_SUB_DEL = "5" CAPIF_GET_ALL_SVCS = "10" CAPIF_GET_SVC = "11" CAPIF_CREATE_SVC = "12" CAPIF_DELETE_SVC = "13" CAPIF_SUB_POST = "14" CAPIF_SUB_GET = "15" CAPIF_SUB_DELETE = "16" STATUS = "T" QUIT = "q" ) Loading @@ -349,15 +356,17 @@ func menu(message string) []string { "MEC 011 Service Management:\n"+ "\t%s: Create new service, %s: Delete service, %s: Get list of MEC services\n"+ "MEC 013:\n"+ "\t%s <ue address>: Get UE location', %s <ue address>: UE location subscription, %s <subID>: UE location subscription\n"+ "\t%s <ue address>: Get UE location, %s <ue address>: UE location subscription, %s <subID>: UE location subscription\n"+ "MEC 030:\n"+ "\t%s: Get V2X UU unicast setting', %s: V2X Msg subscription, %s <subID>: Delete V2X subscription, %s <[latitudes] [longitudes] [timestamps]: Provide PredictedQoS\n"+ "\t%s: Get V2X UU unicast setting, %s: V2X Msg subscription, %s <subID>: Delete V2X subscription, %s <[latitudes] [longitudes] [timestamps]: Provide PredictedQoS\n"+ "\t\t[latitudes] is a set of latitudes separated by comma, [longitudes] is a set of longitudes separated by comma, [timestamps]\n"+ "\t\tE.g. 43.729416,43.732456 7.414853,7.418417 1653295620,1653299220\n"+ "MEC 040:\n"+ "\t%s: Get Federation Systems list', %s <systemId>: Get Federation Services list, %s <systemId> <serviceId>: Get Federation Service, %s: Subscribe, %s [<subId>]: Get subscription, %s <subId>: Delete subscription\n"+ "\t%s: Get Federation Systems list, %s <systemId>: Get Federation Services list, %s <systemId> <serviceId>: Get Federation Service, %s: Subscribe, %s [<subId>]: Get subscription, %s <subId>: Delete subscription\n"+ "MEC CAPIF:\n"+ "\t%s: Get all services, %s: Get service for the current application instance\n"+ "%s: Quit\n", LOGIN, NAMESPACE, LOGOUT, LIST_SC, ACTIVATE, DEACTIVATE, SC, LIST_SERVICES, LIST_APP, CREATE_APP, DELETE_APP, LIST_UES, INC_UE, DEC_UE, STATUS, MEC011_CONFIRM_READY, MEC011_REGISTRATION, MEC011_DEREGISTRATION, MEC011_CREATE_SVC, MEC011_DELETE_SVC, MEC011_GET_SVC, MEC013_UE_LOC, MEC013_UE_LOC_SUB, MEC013_UE_LOC_DEL_SUB, MEC030_UU_SETTINGS, MEC030_V2X_SUB, MEC030_V2X_DEL_SUB, MEC030_V2X_QOS, MEC040_FED_SYS_GET, MEC040_FED_SRVS_GET, MEC040_FED_SRV_GET, MEC040_FED_SUB_POST, MEC040_FED_SUB_GET, MEC040_FED_SUB_DEL, QUIT) LOGIN, NAMESPACE, LOGOUT, LIST_SC, ACTIVATE, DEACTIVATE, SC, LIST_SERVICES, LIST_APP, CREATE_APP, DELETE_APP, LIST_UES, INC_UE, DEC_UE, STATUS, MEC011_CONFIRM_READY, MEC011_REGISTRATION, MEC011_DEREGISTRATION, MEC011_CREATE_SVC, MEC011_DELETE_SVC, MEC011_GET_SVC, MEC013_UE_LOC, MEC013_UE_LOC_SUB, MEC013_UE_LOC_DEL_SUB, MEC030_UU_SETTINGS, MEC030_V2X_SUB, MEC030_V2X_DEL_SUB, MEC030_V2X_QOS, MEC040_FED_SYS_GET, MEC040_FED_SRVS_GET, MEC040_FED_SRV_GET, MEC040_FED_SUB_POST, MEC040_FED_SUB_GET, MEC040_FED_SUB_DEL, CAPIF_GET_ALL_SVCS, CAPIF_GET_SVC, QUIT) if message != "" { fmt.Println("Last message: ", message) } Loading Loading @@ -1481,6 +1490,139 @@ func mec40_delete_subscriptions(choice string) (response *http.Response, err err return response, nil } func capif_get_all_svcs() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_all_svcs") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/service-apis/v1/allServiceAPIs" fmt.Println("capif_get_all_svcs: url: " + url) // Send request and await response body, response, err = send_mec_service_request(http.MethodGet, url, nil, nil, nil, nil) if err != nil { return nil, nil, err } defer response.Body.Close() return body, response, nil } func capif_get_svc() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_svc") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No appInstanceId available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/published-apis/v1/" + appsInfo.Id + "/service-apis" fmt.Println("capif_get_svc: url: " + url) // Send request and await response body, response, err = send_mec_service_request(http.MethodGet, url, nil, nil, nil, nil) if err != nil { return nil, nil, err } defer response.Body.Close() return body, response, nil } func capif_create_svc() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_create_svc") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No network scenario available") } return nil, nil, errors.New("Not implemented") } func capif_delete_svc(choice string) (response *http.Response, err error) { fmt.Println(">>> capif_delete_svc: ", choice) // Sanity checks if sandboxName == "" { return nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, errors.New("No appInstanceId available") } if choice == "" { return nil, errors.New("Wrong parameter") } return nil, errors.New("Not implemented") } func capif_create_subscription() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_create_subscription") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No network scenario available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/service-apis/v1/" + appsInfo.Id + "/subscriptions" fmt.Println("capif_create_subscription: url: " + url) return nil, nil, errors.New("Not implemented") } func capif_get_subscriptions() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_subscriptions") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No appInstanceId available") } return nil, nil, errors.New("Not implemented") } func capif_delete_subscriptions(choice string) (response *http.Response, err error) { fmt.Println(">>> capif_delete_subscriptions: ", choice) // Sanity checks if sandboxName == "" { return nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, errors.New("No appInstanceId available") } if choice == "" { return nil, errors.New("Wrong parameter") } return nil, errors.New("Not implemented") } func app_status() (resp string) { resp = "" if sandboxName != "" { Loading Loading @@ -1565,6 +1707,11 @@ func fed_notification(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) } func capif_notification(w http.ResponseWriter, r *http.Request) { fmt.Println(">>> capif_notification: ", r) w.WriteHeader(http.StatusOK) } func mec011_service_statistic_get(w http.ResponseWriter, r *http.Request) { fmt.Println(">>> mec011_service_statistic_get: ", r) w.WriteHeader(http.StatusOK) Loading Loading @@ -1980,6 +2127,54 @@ func process_choice(choice []string) string { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], CAPIF_GET_ALL_SVCS) == 0 { body, _, err := capif_get_all_svcs() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_GET_SVC) == 0 { body, _, err := capif_get_svc() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_CREATE_SVC) == 0 { body, _, err := capif_create_svc() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_DELETE_SVC) == 0 { if len(choice) == 1 { return "apiId is not set" } response, err := capif_delete_svc(choice[1]) if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], CAPIF_SUB_POST) == 0 { body, _, err := capif_create_subscription() if err != nil { return err.Error() } message = fmt.Sprintf("response body: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_SUB_GET) == 0 { body, _, err := capif_get_subscriptions() if err != nil { return err.Error() } message = fmt.Sprintf("response body: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_SUB_DELETE) == 0 { if len(choice) == 1 { return "Subscription ID is not set" } response, err := capif_delete_subscriptions(choice[1]) if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], STATUS) == 0 { resp := app_status() message = fmt.Sprintf("Current status: %s", resp) Loading examples/demo6/golang/routers.go +6 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,12 @@ var routes = HttpRoutes{ "/fed/v1/notification", fed_notification, }, HttpRoute{ "capif_notification", "POST", "/mec_capif_mgmt/v1/notification", capif_notification, }, HttpRoute{ "mec011_service_statistic_get", "GET", Loading Loading
examples/demo6/golang/app_instance.yaml +2 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,6 @@ localurl: 'http://' # Set host port number of demo-6. Example field: '8093' port: '80' # Callback base URL callbackUrl: 'http://mec-platform2.etsi.org' callbackUrl: 'http://lab-oai.etsi.org' # Callback port for listener callbackPort: '31111' callbackPort: '80'
examples/demo6/golang/main.go +199 −4 Original line number Diff line number Diff line Loading @@ -324,6 +324,13 @@ const ( MEC040_FED_SUB_POST = "3" MEC040_FED_SUB_GET = "4" MEC040_FED_SUB_DEL = "5" CAPIF_GET_ALL_SVCS = "10" CAPIF_GET_SVC = "11" CAPIF_CREATE_SVC = "12" CAPIF_DELETE_SVC = "13" CAPIF_SUB_POST = "14" CAPIF_SUB_GET = "15" CAPIF_SUB_DELETE = "16" STATUS = "T" QUIT = "q" ) Loading @@ -349,15 +356,17 @@ func menu(message string) []string { "MEC 011 Service Management:\n"+ "\t%s: Create new service, %s: Delete service, %s: Get list of MEC services\n"+ "MEC 013:\n"+ "\t%s <ue address>: Get UE location', %s <ue address>: UE location subscription, %s <subID>: UE location subscription\n"+ "\t%s <ue address>: Get UE location, %s <ue address>: UE location subscription, %s <subID>: UE location subscription\n"+ "MEC 030:\n"+ "\t%s: Get V2X UU unicast setting', %s: V2X Msg subscription, %s <subID>: Delete V2X subscription, %s <[latitudes] [longitudes] [timestamps]: Provide PredictedQoS\n"+ "\t%s: Get V2X UU unicast setting, %s: V2X Msg subscription, %s <subID>: Delete V2X subscription, %s <[latitudes] [longitudes] [timestamps]: Provide PredictedQoS\n"+ "\t\t[latitudes] is a set of latitudes separated by comma, [longitudes] is a set of longitudes separated by comma, [timestamps]\n"+ "\t\tE.g. 43.729416,43.732456 7.414853,7.418417 1653295620,1653299220\n"+ "MEC 040:\n"+ "\t%s: Get Federation Systems list', %s <systemId>: Get Federation Services list, %s <systemId> <serviceId>: Get Federation Service, %s: Subscribe, %s [<subId>]: Get subscription, %s <subId>: Delete subscription\n"+ "\t%s: Get Federation Systems list, %s <systemId>: Get Federation Services list, %s <systemId> <serviceId>: Get Federation Service, %s: Subscribe, %s [<subId>]: Get subscription, %s <subId>: Delete subscription\n"+ "MEC CAPIF:\n"+ "\t%s: Get all services, %s: Get service for the current application instance\n"+ "%s: Quit\n", LOGIN, NAMESPACE, LOGOUT, LIST_SC, ACTIVATE, DEACTIVATE, SC, LIST_SERVICES, LIST_APP, CREATE_APP, DELETE_APP, LIST_UES, INC_UE, DEC_UE, STATUS, MEC011_CONFIRM_READY, MEC011_REGISTRATION, MEC011_DEREGISTRATION, MEC011_CREATE_SVC, MEC011_DELETE_SVC, MEC011_GET_SVC, MEC013_UE_LOC, MEC013_UE_LOC_SUB, MEC013_UE_LOC_DEL_SUB, MEC030_UU_SETTINGS, MEC030_V2X_SUB, MEC030_V2X_DEL_SUB, MEC030_V2X_QOS, MEC040_FED_SYS_GET, MEC040_FED_SRVS_GET, MEC040_FED_SRV_GET, MEC040_FED_SUB_POST, MEC040_FED_SUB_GET, MEC040_FED_SUB_DEL, QUIT) LOGIN, NAMESPACE, LOGOUT, LIST_SC, ACTIVATE, DEACTIVATE, SC, LIST_SERVICES, LIST_APP, CREATE_APP, DELETE_APP, LIST_UES, INC_UE, DEC_UE, STATUS, MEC011_CONFIRM_READY, MEC011_REGISTRATION, MEC011_DEREGISTRATION, MEC011_CREATE_SVC, MEC011_DELETE_SVC, MEC011_GET_SVC, MEC013_UE_LOC, MEC013_UE_LOC_SUB, MEC013_UE_LOC_DEL_SUB, MEC030_UU_SETTINGS, MEC030_V2X_SUB, MEC030_V2X_DEL_SUB, MEC030_V2X_QOS, MEC040_FED_SYS_GET, MEC040_FED_SRVS_GET, MEC040_FED_SRV_GET, MEC040_FED_SUB_POST, MEC040_FED_SUB_GET, MEC040_FED_SUB_DEL, CAPIF_GET_ALL_SVCS, CAPIF_GET_SVC, QUIT) if message != "" { fmt.Println("Last message: ", message) } Loading Loading @@ -1481,6 +1490,139 @@ func mec40_delete_subscriptions(choice string) (response *http.Response, err err return response, nil } func capif_get_all_svcs() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_all_svcs") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/service-apis/v1/allServiceAPIs" fmt.Println("capif_get_all_svcs: url: " + url) // Send request and await response body, response, err = send_mec_service_request(http.MethodGet, url, nil, nil, nil, nil) if err != nil { return nil, nil, err } defer response.Body.Close() return body, response, nil } func capif_get_svc() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_svc") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No appInstanceId available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/published-apis/v1/" + appsInfo.Id + "/service-apis" fmt.Println("capif_get_svc: url: " + url) // Send request and await response body, response, err = send_mec_service_request(http.MethodGet, url, nil, nil, nil, nil) if err != nil { return nil, nil, err } defer response.Body.Close() return body, response, nil } func capif_create_svc() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_create_svc") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No network scenario available") } return nil, nil, errors.New("Not implemented") } func capif_delete_svc(choice string) (response *http.Response, err error) { fmt.Println(">>> capif_delete_svc: ", choice) // Sanity checks if sandboxName == "" { return nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, errors.New("No appInstanceId available") } if choice == "" { return nil, errors.New("Wrong parameter") } return nil, errors.New("Not implemented") } func capif_create_subscription() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_create_subscription") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No network scenario available") } // Set URL url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/service-apis/v1/" + appsInfo.Id + "/subscriptions" fmt.Println("capif_create_subscription: url: " + url) return nil, nil, errors.New("Not implemented") } func capif_get_subscriptions() (body []byte, response *http.Response, err error) { fmt.Println(">>> capif_get_subscriptions") // Sanity checks if sandboxName == "" { return nil, nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, nil, errors.New("No appInstanceId available") } return nil, nil, errors.New("Not implemented") } func capif_delete_subscriptions(choice string) (response *http.Response, err error) { fmt.Println(">>> capif_delete_subscriptions: ", choice) // Sanity checks if sandboxName == "" { return nil, errors.New("No sandbox available") } else if scenarioId == -1 { return nil, errors.New("No network scenario available") } else if appsInfo.Id == "" { return nil, errors.New("No appInstanceId available") } if choice == "" { return nil, errors.New("Wrong parameter") } return nil, errors.New("Not implemented") } func app_status() (resp string) { resp = "" if sandboxName != "" { Loading Loading @@ -1565,6 +1707,11 @@ func fed_notification(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) } func capif_notification(w http.ResponseWriter, r *http.Request) { fmt.Println(">>> capif_notification: ", r) w.WriteHeader(http.StatusOK) } func mec011_service_statistic_get(w http.ResponseWriter, r *http.Request) { fmt.Println(">>> mec011_service_statistic_get: ", r) w.WriteHeader(http.StatusOK) Loading Loading @@ -1980,6 +2127,54 @@ func process_choice(choice []string) string { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], CAPIF_GET_ALL_SVCS) == 0 { body, _, err := capif_get_all_svcs() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_GET_SVC) == 0 { body, _, err := capif_get_svc() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_CREATE_SVC) == 0 { body, _, err := capif_create_svc() if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_DELETE_SVC) == 0 { if len(choice) == 1 { return "apiId is not set" } response, err := capif_delete_svc(choice[1]) if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], CAPIF_SUB_POST) == 0 { body, _, err := capif_create_subscription() if err != nil { return err.Error() } message = fmt.Sprintf("response body: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_SUB_GET) == 0 { body, _, err := capif_get_subscriptions() if err != nil { return err.Error() } message = fmt.Sprintf("response body: %s", string(body)) } else if strings.Compare(choice[0], CAPIF_SUB_DELETE) == 0 { if len(choice) == 1 { return "Subscription ID is not set" } response, err := capif_delete_subscriptions(choice[1]) if err != nil { return err.Error() } message = fmt.Sprintf("response: %s", response.Status) } else if strings.Compare(choice[0], STATUS) == 0 { resp := app_status() message = fmt.Sprintf("Current status: %s", resp) Loading
examples/demo6/golang/routers.go +6 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,12 @@ var routes = HttpRoutes{ "/fed/v1/notification", fed_notification, }, HttpRoute{ "capif_notification", "POST", "/mec_capif_mgmt/v1/notification", capif_notification, }, HttpRoute{ "mec011_service_statistic_get", "GET", Loading