Commit 392e882d authored by Ikram Haq's avatar Ikram Haq
Browse files

Add new serive CAPIF mgmt, update client side packages and implement GET...

Add new serive CAPIF mgmt, update client side packages and implement GET method to get the all services
parent c5907bed
Loading
Loading
Loading
Loading
+1383 −0

File added.

Preview size limit exceeded, changes collapsed.

+13 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import (
	"sync"

	as "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-app-enablement/server/app-support"
	cm "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-app-enablement/server/capif-mgmt"
	sm "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-app-enablement/server/service-mgmt"
	httpLog "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger"
	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
@@ -125,6 +126,12 @@ func Init() (err error) {
	}
	log.Info("Service Management created")

	// Initialize Capif Management
	err = cm.Init(sandboxName, mepName, hostUrl, mqLocal, redisAddr, &mutex)
	if err != nil {
		return err
	}
	log.Info("Service Management created")
	// Initialize App Support
	err = as.Init(sandboxName, mepName, hostUrl, mqLocal, redisAddr, &mutex)
	if err != nil {
@@ -144,6 +151,11 @@ func Run() (err error) {
		return err
	}

	err = cm.Run()
	if err != nil {
		return err
	}

	err = as.Run()
	if err != nil {
		return err
@@ -189,6 +201,7 @@ func Stop() {
	}

	_ = sm.Stop()
	_ = cm.Stop()
	_ = as.Stop()

	// Remove APIs
+25 −0
Original line number Diff line number Diff line
# Go API Server for server

MEC Service Management Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC011 Application Enablement API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/011/02.02.01_60/gs_MEC011v020201p.pdf) <p>[Copyright (c) ETSI 2024](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-app-enablement](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-app-enablement/server/service-mgmt) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about services in the network <p>**Note**<br>AdvantEDGE supports all of Service Management API endpoints (see below).

## Overview
This server was generated by the [swagger-codegen]
(https://github.com/swagger-api/swagger-codegen) project.  
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.  
-

To see how to make this your own, look here:

[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 3.1.1
- Build date: 2024-03-25T08:32:22.065107-05:00


### Running the server
To run the server, follow these simple steps:

```
go run main.go
```
+84 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2024  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.
 *
 * AdvantEDGE Service Management API
 *
 * MEC Service Management Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC011 Application Enablement API](https://www.etsi.org/deliver/etsi_gs/MEC/001_099/011/03.01.01_60/gs_MEC011v030101p.pdf) <p>[Copyright (c) ETSI 2024](https://forge.etsi.org/etsi-forge-copyright-notice.txt) <p>**Micro-service**<br>[meep-app-enablement](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-app-enablement/server/service-mgmt) <p>**Type & Usage**<br>Edge Service used by edge applications that want to get information about services in the network <p>**Note**<br>AdvantEDGE supports all of Service Management API endpoints (see below).
 *
 * API version: 3.1.1
 * Contact: AdvantEDGE@InterDigital.com
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package server

import (
	"net/http"
)

func AppServicesGET(w http.ResponseWriter, r *http.Request) {
	appServicesGET(w, r)
}

func AppServicesPOST(w http.ResponseWriter, r *http.Request) {
	appServicesPOST(w, r)
}

func AppServicesServiceIdDELETE(w http.ResponseWriter, r *http.Request) {
	appServicesByIdDELETE(w, r)
}

func AppServicesServiceIdGET(w http.ResponseWriter, r *http.Request) {
	appServicesByIdGET(w, r)
}

func AppServicesServiceIdPUT(w http.ResponseWriter, r *http.Request) {
	appServicesByIdPUT(w, r)
}

func ApplicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) {
	applicationsSubscriptionDELETE(w, r)
}

func ApplicationsSubscriptionGET(w http.ResponseWriter, r *http.Request) {
	applicationsSubscriptionGET(w, r)
}

func ApplicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) {
	applicationsSubscriptionsGET(w, r)
}

func ApplicationsSubscriptionsPOST(w http.ResponseWriter, r *http.Request) {
	applicationsSubscriptionsPOST(w, r)
}

func ServicesGET(w http.ResponseWriter, r *http.Request) {
	servicesGET(w, r)
}

func ServicesServiceIdGET(w http.ResponseWriter, r *http.Request) {
	servicesByIdGET(w, r)
}

func GetIndividualMECService(w http.ResponseWriter, r *http.Request) {
	getIndividualMECService(w, r)
}

func PatchIndividualMECService(w http.ResponseWriter, r *http.Request) {
	patchIndividualMECService(w, r)
}

func TransportsGET(w http.ResponseWriter, r *http.Request) {
	transportsGET(w, r)
}
+115 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2024  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.
 */

package server

import (
	"encoding/json"

	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
)

func convertServiceInfoToJson(obj *ServiceInfo) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertJsonToServiceInfo(jsonInfo string) *ServiceInfo {
	var obj ServiceInfo
	err := json.Unmarshal([]byte(jsonInfo), &obj)
	if err != nil {
		log.Error(err.Error())
		return nil
	}
	return &obj
}

func convertSerAvailabilityNotifSubToJson(obj *SerAvailabilityNotificationSubscription) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertJsonToSerAvailabilityNotifSub(jsonData string) *SerAvailabilityNotificationSubscription {
	var obj SerAvailabilityNotificationSubscription
	err := json.Unmarshal([]byte(jsonData), &obj)
	if err != nil {
		log.Error(err.Error())
		return nil
	}
	return &obj
}

func convertServiceAvailabilityNotifToJson(obj *ServiceAvailabilityNotification) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertProblemDetailsToJson(obj *ProblemDetails) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertSubscriptionLinkListToJson(obj *SubscriptionLinkList) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

func convertServiceLivenessInfoToJson(obj *ServiceLivenessInfo) string {
	jsonInfo, err := json.Marshal(*obj)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}

// func convertMecServiceMgmtApiSubscriptionLinkListToJson(obj *MecServiceMgmtApiSubscriptionLinkList) string {
// 	jsonInfo, err := json.Marshal(*obj)
// 	if err != nil {
// 		log.Error(err.Error())
// 		return ""
// 	}
// 	return string(jsonInfo)
// }

func convertProblemDetailstoJson(probdetails *ProblemDetails) string {
	jsonInfo, err := json.Marshal(*probdetails)
	if err != nil {
		log.Error(err.Error())
		return ""
	}
	return string(jsonInfo)
}
Loading