Commit 6994db5c authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance demo6

parent 730da5c3
Loading
Loading
Loading
Loading
+5 −2
Changes for examples/demo6/golang/README.md: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -47,15 +47,17 @@ Optional commands:
        m: Get MEC application services list
        i: Get application instances list, c: Create a new application instance, C: Delete a new application instance
        u: Get UEs, x <index>: Increase UE, X <index>: Decrease UE
        T: Current status:
MEC 011 App Support:
        y: Send ConfirmReady, r: Send Registration, R: Send Deregistration
MEC 011 Service Management:
        v: Create new service, V: Delete service, g: Get list of MEC services
MEC 030:
        Y: Get V2X UU unicast setting', z: V2X Msg subscription, Z <subID>: Delete V2X subscription
        Y: Get V2X UU unicast setting', z: V2X Msg subscription, Z <subID>: Delete V2X subscription, Q <[latutudes] [longitudes] [timestamps]: Provide PredictedQoS
                [latitudes] is a set of latitudes separated by comma, [longitudes] is a set of longitudes separated by comma, [timestamps]
                E.g. 43.729416,43.732456 7.414853,7.418417 1653295620,1653299220
MEC 040:
        0: Get Federation Systems list', 1 <systemId>: Get Federation Services list, 2 <systemId> <serviceId>: Get Federation Service, 3: Subscribe, 4 [<subId>]: Get subscription, 5 <subId>: Delete subscription
        Q: Current status:
q: Quit
Enter your choice:
```
@@ -121,6 +123,7 @@ Theses commands provides some example of access to the MEC services available wi

### MEC Service Managenment (MEC 011 service)


### Get V2X UU unicast setting (MEC 030 service)

- The option (Y) retrieves the UU Unicast settings from the MEC 030 service. To use it, the V2X network scenario shall be activated (see [Activate a network scenario](#activate_a_network_scenario)).
+229 −16
Changes for examples/demo6/golang/main.go: 229 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -97,8 +97,16 @@ type TransportInfo struct {
	Type_        *string                     `json:"type"`
	Protocol     string                      `json:"protocol"`
	Version      string                      `json:"version"`
	SecurityInfo *SecurityInfo               `json:"securityInfo"`
	Endpoint     *OneOfTransportInfoEndpoint `json:"endpoint"`
}
type SecurityInfo struct {
	OAuth2Info *SecurityInfoOAuth2Info `json:"oAuth2Info,omitempty"`
}
type SecurityInfoOAuth2Info struct {
	GrantTypes    []string `json:"grantTypes"`
	TokenEndpoint string   `json:"tokenEndpoint"`
}
type OneOfTransportInfoEndpoint struct {
	EndPointInfoUris
	EndPointInfoFqdn
@@ -148,6 +156,69 @@ type V2xMsgSubscriptionFilterCriteria struct {
	StdOrganization string   `json:"stdOrganization"`
}

type Plmn struct {
	Mcc string `json:"mcc"`
	Mnc string `json:"mnc"`
}

type CellId struct {
	CellId string `json:"cellId"`
}

type Ecgi struct {
	CellId *CellId `json:"cellId"`
	Plmn   *Plmn   `json:"plmn"`
}

type LocationInfoGeoArea struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

type LocationInfo struct {
	Ecgi    *Ecgi                `json:"ecgi,omitempty"`
	GeoArea *LocationInfoGeoArea `json:"geoArea,omitempty"`
}

type RouteInfo struct {
	Location *LocationInfo `json:"location"`
	Time     *TimeStamp    `json:"time,omitempty"`
}

type Routes struct {
	RouteInfo []RouteInfo `json:"routeInfo"`
}

type PredictionArea struct {
	Center *LocationInfo `json:"center"`
	Radius string        `json:"radius"`
}

type QosKpi struct {
	Confidence string `json:"confidence,omitempty"`
	KpiName    string `json:"kpiName"`
	KpiValue   string `json:"kpiValue"`
}

type Stream struct {
	StreamId string   `json:"streamId"`
	QosKpi   []QosKpi `json:"qosKpi"`
}

type Qos struct {
	Stream []Stream `json:"stream"`
}

type PredictedQos struct {
	LocationGranularity string          `json:"locationGranularity"`
	NoticePeriod        *TimeStamp      `json:"noticePeriod,omitempty"`
	PredictionArea      *PredictionArea `json:"predictionArea,omitempty"`
	PredictionTarget    string          `json:"predictionTarget"`
	Qos                 *Qos            `json:"qos"`
	Routes              []Routes        `json:"routes,omitempty"`
	TimeGranularity     *TimeStamp      `json:"timeGranularity,omitempty"`
}

// MEC 040
type SystemUpdateNotificationSubscription struct {
	SubscriptionType  string     `json:"subscriptionType"`
@@ -231,13 +302,14 @@ const (
	MEC030_UU_SETTINGS    = "Y"
	MEC030_V2X_SUB        = "z"
	MEC030_V2X_DEL_SUB    = "Z"
	MEC030_V2X_QOS        = "Q"
	MEC040_FED_SYS_GET    = "0"
	MEC040_FED_SRVS_GET   = "1"
	MEC040_FED_SRV_GET    = "2"
	MEC040_FED_SUB_POST   = "3"
	MEC040_FED_SUB_GET    = "4"
	MEC040_FED_SUB_DEL    = "5"
	STATUS                = "Q"
	STATUS                = "T"
	QUIT                  = "q"
)

@@ -256,17 +328,19 @@ func menu(message string) []string {
			"\t%s: Get MEC application services list\n"+
			"\t%s: Get application instances list, %s: Create a new application instance, %s: Delete a new application instance\n"+
			"\t%s: Get UEs, %s <index>: Increase UE, %s <index>: Decrease UE\n"+
			"\t%s: Current status:\n"+
			"MEC 011 App Support:\n"+
			"\t%s: Send ConfirmReady, %s: Send Registration, %s: Send Deregistration\n"+
			"MEC 011 Service Management:\n"+
			"\t%s: Create new service, %s: Delete service, %s: Get list of MEC services\n"+
			"MEC 030:\n"+
			"\t%s: Get V2X UU unicast setting', %s: V2X Msg subscription, %s <subID>: Delete V2X subscription\n"+
			"\t%s: Get V2X UU unicast setting', %s: V2X Msg subscription, %s <subID>: Delete V2X subscription, %s <[latutudes] [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: Current status:\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, MEC011_CONFIRM_READY, MEC011_REGISTRATION, MEC011_DEREGISTRATION, MEC011_CREATE_SVC, MEC011_DELETE_SVC, MEC011_GET_SVC, MEC030_UU_SETTINGS, MEC030_V2X_SUB, MEC030_V2X_DEL_SUB, MEC040_FED_SYS_GET, MEC040_FED_SRVS_GET, MEC040_FED_SRV_GET, MEC040_FED_SUB_POST, MEC040_FED_SUB_GET, MEC040_FED_SUB_DEL, STATUS, 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, 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)
	if message != "" {
		fmt.Println("Last message: ", message)
	}
@@ -425,6 +499,8 @@ func terminateScenario(scenarioId string) error {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == "" {
		return errors.New("No network scenario available")
	}

	_, err := cl.SandboxNetworkScenariosApi.SandboxNetworkScenarioDELETE(context.TODO(), sandboxName, scenarioId)
@@ -441,6 +517,8 @@ func getListOfMECServices() ([]client.SandboxMecServices, error) {
	// Sanity checks
	if sandboxName == "" {
		return nil, errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return nil, errors.New("No network scenario available")
	}

	services, _, err := cl.SandboxMECServicesApi.SandboxMecServicesGET(context.TODO(), sandboxName)
@@ -457,6 +535,8 @@ func getListOfMECAppInstIds() ([]client.ApplicationInfo, error) {
	// Sanity checks
	if sandboxName == "" {
		return nil, errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return nil, errors.New("No network scenario available")
	}

	appsInfos, _, err := cl.SandboxAppInstancesApi.SandboxAppInstancesGET(context.TODO(), sandboxName)
@@ -473,6 +553,8 @@ func createMECAppInstId(appInfo client.ApplicationInfo) error {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	}

	_, _, err := cl.SandboxAppInstancesApi.SandboxAppInstancesPOST(context.TODO(), appInfo, sandboxName)
@@ -489,6 +571,8 @@ func deleteMECAppInstId() error {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	}
	if appsInfo.Id == "" {
		return errors.New("No App instance available")
@@ -520,6 +604,8 @@ func getListOfUes() (ues []UeContext, err error) {
	// Sanity checks
	if sandboxName == "" {
		return ues, errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return nil, errors.New("No network scenario available")
	}

	u, _, err := cl.SandboxUEControllerApi.SandboxUeControllerGET(context.TODO(), sandboxName)
@@ -542,6 +628,8 @@ func increaseUE(idx int) error {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	}

	if ues[idx].v == 4 {
@@ -563,6 +651,8 @@ func decreaseUE(idx int) error {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	}

	if ues[idx].v == 0 {
@@ -583,6 +673,8 @@ func mec011_send_confirm_ready() (subId string, response *http.Response, err err
	// 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 App instance available")
	}
@@ -651,6 +743,8 @@ func delete_termination_subscription() (err error) {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	} else if appsInfo.Id == "" {
		return errors.New("No App instance available")
	} else if terminationSubscriptionID == "" {
@@ -679,6 +773,8 @@ func mec011_send_registration() (body []byte, response *http.Response, err error
	// 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 App instance available")
	}
@@ -721,6 +817,8 @@ func mec011_send_deregistration() (response *http.Response, err error) {
	// 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 App instance available")
	}
@@ -746,6 +844,8 @@ func mec011_create_service() (resId string, response *http.Response, err error)
	// 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 App instance available")
	} else if appServiceInfo.SerInstanceId != "" {
@@ -760,7 +860,7 @@ func mec011_create_service() (resId string, response *http.Response, err error)
	appServiceInfo = ServiceInfo{
		SerName: "demo6 MEC Service",
		SerCategory: &CategoryRef{
			Href:    callbackUrl + "/demo6svc/v1/Demo",
			Href:    callbackUrl + "/statistic/v1/quantity",
			Id:      uuid.New().String(),
			Name:    "Demo",
			Version: "1.0.0",
@@ -768,16 +868,17 @@ func mec011_create_service() (resId string, response *http.Response, err error)
		Version: "1.0.0",
		State:   "ACTIVE",
		TransportInfo: TransportInfo{
			Id:       "transport",
			Name:     "REST",
			Id:           uuid.New().String(),
			Name:         "HTTP REST API",
			Type_:        &transportType,
			Protocol:     "HTTP",
			Version:      "2.0",
			SecurityInfo: &SecurityInfo{},
			Endpoint:     &OneOfTransportInfoEndpoint{},
		},
		Serializer: "JSON",
	}
	appServiceInfo.TransportInfo.Endpoint.Uris = append(appServiceInfo.TransportInfo.Endpoint.Uris, callbackUrl+"/demo6svc/v1")
	appServiceInfo.TransportInfo.Endpoint.Uris = append(appServiceInfo.TransportInfo.Endpoint.Uris, callbackUrl+"/statistic/v1/quantity")
	json_body, err := json.Marshal(appServiceInfo)
	if err != nil {
		return "", nil, err
@@ -816,6 +917,8 @@ func mec011_delete_service() (err error) {
	// Sanity checks
	if sandboxName == "" {
		return errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return errors.New("No network scenario available")
	} else if appsInfo.Id == "" {
		return errors.New("No App instance available")
	} else if appServiceInfo.SerInstanceId == "" {
@@ -842,6 +945,8 @@ func mec011_get_mec_services() (body []byte, response *http.Response, err error)
	// 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 App instance available")
	}
@@ -866,6 +971,8 @@ func send_mec_service_request(method string, path string, body io.Reader, vars u
	if sandboxName == "" {
		err = errors.New("No sandbox available")
		return nil, nil, err
	} else if scenarioId == -1 {
		return nil, nil, errors.New("No network scenario available")
	}

	// Setup path and query parameters
@@ -935,6 +1042,8 @@ func mec030_get_v2x_uu_unicast_setting() (body []byte, response *http.Response,
	// 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")
	}

	url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/vis/v2/queries/uu_unicast_provisioning_info?location_info=ecgi,268708941961,268711972264"
@@ -954,6 +1063,8 @@ func mec030_subscribe_v2x_messages() (body []byte, response *http.Response, err
	// 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
@@ -995,6 +1106,8 @@ func mec030_delete_v2x_messages_subscription(choice string) (response *http.Resp
	// Sanity checks
	if sandboxName == "" {
		return nil, errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return nil, errors.New("No network scenario available")
	}
	if choice == "" {
		return nil, errors.New("Wrong parameter")
@@ -1012,9 +1125,77 @@ func mec030_delete_v2x_messages_subscription(choice string) (response *http.Resp
	return response, nil
}

func v2x_msg_notification(w http.ResponseWriter, r *http.Request) {
	fmt.Println(">>> v2x_msg_notification: ", r)
	w.WriteHeader(http.StatusOK)
// https://www.calculatorsoup.com/calculators/conversions/convert-decimal-degrees-to-degrees-minutes-seconds.php
// https://www.latlong.net/degrees-minutes-seconds-to-decimal-degrees
func mec030_predicted_qos(latitudes string, longitudes string, timestamps string) (body []byte, response *http.Response, err error) {
	// 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 latitudes == "" || longitudes == "" || timestamps == "" {
		return nil, nil, errors.New("Wrong parameters")
	}

	// Set URL
	url := mecUrl + "/" + sandboxName + "/" + mecPlateform + "/vis/v2/provide_predicted_qos"
	fmt.Println("mec030_predicted_qos: url: " + url)
	// Build message body
	// 1. Split arguments into slices
	lats := strings.Split(latitudes, ",")
	longs := strings.Split(longitudes, ",")
	ts := strings.Split(timestamps, ",")
	if len(lats) != len(longs) || len(ts) != len(lats) || len(ts) != len(longs) {
		return nil, nil, errors.New("Wrong lenght in parameters")
	}
	// 2. Build routes
	var routes = Routes{}
	for i, _ := range lats {
		lat, err := strconv.ParseFloat(lats[i], 32)
		if err != nil {
			return nil, nil, errors.New("Wrong latitude value: " + lats[i])
		}
		long, err := strconv.ParseFloat(longs[i], 32)
		if err != nil {
			return nil, nil, errors.New("Wrong longitude value: " + longs[i])
		}
		sec, err := strconv.Atoi(ts[i])
		if err != nil {
			return nil, nil, errors.New("Wrong timestamp value: " + ts[i])
		}
		var routeInfo = RouteInfo{
			Location: &LocationInfo{
				GeoArea: &LocationInfoGeoArea{
					Latitude:  float32(lat),
					Longitude: float32(long),
				},
			},
			Time: &TimeStamp{
				NanoSeconds: 0,
				Seconds:     int32(sec),
			},
		}
		routes.RouteInfo = append(routes.RouteInfo, routeInfo)
	}
	// 3. Build PredictedQos
	var predictedQos = PredictedQos{
		PredictionTarget:    "SINGLE_UE_PREDICTION",
		LocationGranularity: "30",
	}
	predictedQos.Routes = append(predictedQos.Routes, routes)
	json_body, err := json.Marshal(predictedQos)
	if err != nil {
		return nil, nil, err
	}
	fmt.Println("mec030_predicted_qos: json_body: " + string(json_body))
	io_body := bytes.NewReader(json_body)
	// Send request and await response
	body, response, err = send_mec_service_request(http.MethodPost, url, io_body, nil, nil, nil)
	if err != nil {
		return nil, nil, err
	}

	return body, response, nil
}

func mec40_get_systems_list() (body []byte, response *http.Response, err error) {
@@ -1023,6 +1204,8 @@ func mec40_get_systems_list() (body []byte, response *http.Response, err error)
	// 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
@@ -1044,6 +1227,8 @@ func mec40_get_services_list(choice string) (body []byte, response *http.Respons
	// 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")
	}
	if choice == "" {
		return nil, nil, errors.New("Wrong parameter")
@@ -1067,6 +1252,8 @@ func mec40_get_service_list(systemId string, serviceId string) (body []byte, res
	// 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")
	}
	if systemId == "" || serviceId == "" {
		return nil, nil, errors.New("Wrong parameter")
@@ -1090,6 +1277,8 @@ func mec40_create_subscription() (body []byte, response *http.Response, err erro
	// 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
@@ -1127,6 +1316,8 @@ func mec40_get_subscriptions(choice []string) (body []byte, response *http.Respo
	// 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
@@ -1151,6 +1342,8 @@ func mec40_delete_subscriptions(choice string) (response *http.Response, err err
	// Sanity checks
	if sandboxName == "" {
		return nil, errors.New("No sandbox available")
	} else if scenarioId == -1 {
		return nil, errors.New("No network scenario available")
	}
	if choice == "" {
		return nil, errors.New("Wrong parameter")
@@ -1168,11 +1361,6 @@ func mec40_delete_subscriptions(choice string) (response *http.Response, err err
	return response, nil
}

func fed_notification(w http.ResponseWriter, r *http.Request) {
	fmt.Println(">>> fed_notification: ", r)
	w.WriteHeader(http.StatusOK)
}

func app_status() (resp string) {
	resp = ""
	if sandboxName != "" {
@@ -1183,6 +1371,7 @@ func app_status() (resp string) {
	}
	if appServiceInfo.SerInstanceId != "" {
		resp += ", SerInstanceId: " + appServiceInfo.SerInstanceId
		resp += "- uri: " + appServiceInfo.Links.Self.Href
	}
	if terminationSubscriptionID != "" {
		resp += ", Subscription: " + terminationSubscriptionID
@@ -1241,6 +1430,21 @@ func delete_subscription_from_list(url string) {
	}
}

func v2x_msg_notification(w http.ResponseWriter, r *http.Request) {
	fmt.Println(">>> v2x_msg_notification: ", r)
	w.WriteHeader(http.StatusOK)
}

func fed_notification(w http.ResponseWriter, r *http.Request) {
	fmt.Println(">>> fed_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)
}

func main() {
	if len(os.Args) < 2 {
		// no config argument
@@ -1568,6 +1772,15 @@ func process_choice(choice []string) string {
			return err.Error()
		}
		message = fmt.Sprintf("response body:  Subscription %s deleted", choice[1])
	} else if strings.Compare(choice[0], MEC030_V2X_QOS) == 0 {
		if len(choice) != 4 {
			return "Invalid entries for this command"
		}
		body, _, err := mec030_predicted_qos(choice[1], choice[2], choice[3])
		if err != nil {
			return err.Error()
		}
		message = fmt.Sprintf("response body:  %s", body)
	} else if strings.Compare(choice[0], MEC040_FED_SYS_GET) == 0 {
		body, _, err := mec40_get_systems_list()
		if err != nil {
+12 −6
Changes for examples/demo6/golang/routers.go: 12 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -30,14 +30,14 @@ import (
	"github.com/gorilla/mux"
)

type Route struct {
type HttpRoute struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type Routes []Route
type HttpRoutes []HttpRoute

func NewRouter() *mux.Router {
	var handler http.Handler
@@ -58,23 +58,29 @@ func Index(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello World!")
}

var routes = Routes{
	Route{
var routes = HttpRoutes{
	HttpRoute{
		"Index",
		"GET",
		"/",
		Index,
	},
	Route{
	HttpRoute{
		"Index",
		"POST",
		"/vis/v2/v2x_msg_notification",
		v2x_msg_notification,
	},
	Route{
	HttpRoute{
		"Index",
		"POST",
		"/fed/v1/notification",
		fed_notification,
	},
	HttpRoute{
		"Index",
		"GET",
		"/statistic/v1/quantity",
		mec011_service_statistic_get,
	},
}

examples/demo6/python/Dockerfile

deleted100644 → 0
+0 −26
Changes for examples/demo6/python/Dockerfile: 0 added lines, 26 removed lines.
Original line number Diff line number Diff line
# Copyright (c) 2022  The AdvantEDGE Authors
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang


# Some ENV variables
ENV SERVICE_NAME = "demo6"

COPY ./demo6 /demo6
COPY entrypoint.sh / 

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
+0 −21
Changes for examples/demo6/python/build-demo6.sh: 0 added lines, 21 removed lines.
Original line number Diff line number Diff line
#!/bin/bash

set -e
set -x

# Get full path to script directory
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

DEMOBIN=$BASEDIR/bin/demo6

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Building Demo 6 Go MEC APP"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""

python3 ./demo6.py -o $DEMOBIN .

echo ""
echo ">>> Demo Service build completed"
Loading