Loading examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +18 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import ( "encoding/json" "errors" "fmt" "io/ioutil" "net/http" "strconv" "strings" Loading Loading @@ -817,7 +818,7 @@ const ( simu_appPackageSource = "appPackageSource1" ) // REST API retrieves the list of the onboarded MEC application // REST API sends ping request and get response func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading @@ -837,24 +838,28 @@ func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { } // End of 'for' statement } appActivityLogs = append(appActivityLogs, "demo4DaiDoPingGET: appContextId: " + appContextId) log.Debug("demo4DaiDoPingGET: appContextId: ", appContextId) log.Debug("demo4DaiDoPingGET: Reference URL: len(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo): ", len(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo)) log.Debug("demo4DaiDoPingGET: Reference URL: appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI: ", appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI) // Send the ping request // TODO // Send resp err := errors.New("Not implemented yet") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingGET: "+err.Error()) resp, err := http.Get(strings.TrimSuffix(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI, "/") + "/ping") if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) /*jsonResponse, err := json.Marshal(demoAppInfo) return } bodyBytes, _ := ioutil.ReadAll(r.Body) log.Debug("demo4DaiDoPingGET: resp: ", string(bodyBytes)) // Send resp statusCode, err := strconv.Atoi(resp.Status) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprintf(w, string(jsonResponse))*/ w.WriteHeader(statusCode) fmt.Fprintf(w, string(bodyBytes)) } // REST API creates a new instance of an onboarded MEC application Loading examples/demo4-ue/src/onboarded-demo/main.go +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import ( ) const ( port = ":31123" port = ":31124" ) func main() { Loading examples/demo4-ue/src/onboarded-demo/onboarded-demo4.yaml 0 → 100644 +41 −0 Original line number Diff line number Diff line { "appList": [ { "appInfoList": [ { "appDId": "onboarded-demo4", "appName": "onboarded-demo4", "appProvider": "ETSI", "appSoftVersion": "v0.1.0", "appDVersion": "v0.1.0", "appDescription": "Basic HTTP Ping Pong", "appLocation": [ { "area": null, "civicAddressElement": null, "countryCode": "33" } ], "appCharcs": [ { "memory": 1024, "storage": 1024, "latency": 1024, "bandwidth": 1024, "serviceCont": 0 } ], "cmd": "/onboardedapp/onboarded-demo/onboarded-demo4", "args":null } ], "vendorSpecificExt": { "vendorId": "ETSI" } } ] } examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ const ( // FIXME confoguration file required sandboxUrl = "yannsb" mep = "mep1" localUrl = "mec-platform.etsi.org" localPort = ":31123" localPort = ":31124" mecUrl = "sandbox-mec.etsi.org" appNameBase = "onboarded-demo4" ) Loading go-apps/meep-dai/sbi/dai-sbi.go +19 −15 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ const postgresPwd = "pwd" type SbiCfg struct { ModuleName string SandboxName string HostUrl string MepName string RedisAddr string InfluxAddr string Loading @@ -60,6 +61,7 @@ type SbiCfg struct { type DaiSbi struct { moduleName string sandboxName string hostUrl string mepName string scenarioName string localityEnabled bool Loading Loading @@ -88,6 +90,7 @@ func Init(cfg SbiCfg) (err error) { sbi = new(DaiSbi) sbi.moduleName = cfg.ModuleName sbi.sandboxName = cfg.SandboxName sbi.hostUrl = cfg.HostUrl sbi.mepName = cfg.MepName sbi.scenarioName = "" sbi.updateAppInfoCB = cfg.AppInfoList Loading @@ -95,6 +98,7 @@ func Init(cfg SbiCfg) (err error) { sbi.cleanUpCB = cfg.CleanUpCb redisAddr = cfg.RedisAddr influxAddr = cfg.InfluxAddr log.Info("SbiCfg: ", *sbi) // Fill locality map if len(cfg.Locality) > 0 { Loading Loading @@ -165,7 +169,7 @@ func Init(cfg SbiCfg) (err error) { } log.Info("Created new DAI DB tables") err = sbi.daiMgr.SimulateExistingApplication() err = sbi.daiMgr.LoadOnboardedMecApplications() if err != nil { log.Error("Failed to load simulating data: ", err) return err Loading Loading @@ -376,7 +380,7 @@ func GetApplicationListAppList(appNames []string, appProviders []string, appSoft return appListSbi, nil } func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appName := range appNames { log.Debug("filterAppNames: Processing appName: ", appName) Loading @@ -396,7 +400,7 @@ func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) ( return filteredAppListSbi } func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appProvider := range appProviders { log.Debug("filterAppProviders: Processing appProvider: ", appProvider) Loading @@ -416,7 +420,7 @@ func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInf return filteredAppListSbi } func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appSoftVersion := range appSoftVersions { log.Debug("filterAppSoftVersions: Processing appSoftVersion: ", appSoftVersion) Loading @@ -436,7 +440,7 @@ func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm. return filteredAppListSbi } func filterServiceConts(serviceConts []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterServiceConts(serviceConts []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, serviceCount := range serviceConts { log.Debug("filterServiceConts: Processing serviceCount: ", serviceCount) Loading Loading @@ -540,7 +544,7 @@ func GetAllListAppList() (appListSbi *map[string]*tm.AppInfoList, err error) { func CreateAppContext(appContextSbi *tm.AppContext) (appContextSbi_ *tm.AppContext, err error) { appContextSbi_, err = sbi.daiMgr.CreateAppContext(appContextSbi) appContextSbi_, err = sbi.daiMgr.CreateAppContext(appContextSbi, sbi.hostUrl, sbi.sandboxName) if err != nil { log.Error(err.Error()) return nil, err Loading Loading
examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +18 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import ( "encoding/json" "errors" "fmt" "io/ioutil" "net/http" "strconv" "strings" Loading Loading @@ -817,7 +818,7 @@ const ( simu_appPackageSource = "appPackageSource1" ) // REST API retrieves the list of the onboarded MEC application // REST API sends ping request and get response func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading @@ -837,24 +838,28 @@ func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { } // End of 'for' statement } appActivityLogs = append(appActivityLogs, "demo4DaiDoPingGET: appContextId: " + appContextId) log.Debug("demo4DaiDoPingGET: appContextId: ", appContextId) log.Debug("demo4DaiDoPingGET: Reference URL: len(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo): ", len(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo)) log.Debug("demo4DaiDoPingGET: Reference URL: appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI: ", appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI) // Send the ping request // TODO // Send resp err := errors.New("Not implemented yet") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingGET: "+err.Error()) resp, err := http.Get(strings.TrimSuffix(appContexts[appContextId].app.AppInfo.UserAppInstanceInfo[0].ReferenceURI, "/") + "/ping") if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) /*jsonResponse, err := json.Marshal(demoAppInfo) return } bodyBytes, _ := ioutil.ReadAll(r.Body) log.Debug("demo4DaiDoPingGET: resp: ", string(bodyBytes)) // Send resp statusCode, err := strconv.Atoi(resp.Status) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprintf(w, string(jsonResponse))*/ w.WriteHeader(statusCode) fmt.Fprintf(w, string(bodyBytes)) } // REST API creates a new instance of an onboarded MEC application Loading
examples/demo4-ue/src/onboarded-demo/main.go +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import ( ) const ( port = ":31123" port = ":31124" ) func main() { Loading
examples/demo4-ue/src/onboarded-demo/onboarded-demo4.yaml 0 → 100644 +41 −0 Original line number Diff line number Diff line { "appList": [ { "appInfoList": [ { "appDId": "onboarded-demo4", "appName": "onboarded-demo4", "appProvider": "ETSI", "appSoftVersion": "v0.1.0", "appDVersion": "v0.1.0", "appDescription": "Basic HTTP Ping Pong", "appLocation": [ { "area": null, "civicAddressElement": null, "countryCode": "33" } ], "appCharcs": [ { "memory": 1024, "storage": 1024, "latency": 1024, "bandwidth": 1024, "serviceCont": 0 } ], "cmd": "/onboardedapp/onboarded-demo/onboarded-demo4", "args":null } ], "vendorSpecificExt": { "vendorId": "ETSI" } } ] }
examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ const ( // FIXME confoguration file required sandboxUrl = "yannsb" mep = "mep1" localUrl = "mec-platform.etsi.org" localPort = ":31123" localPort = ":31124" mecUrl = "sandbox-mec.etsi.org" appNameBase = "onboarded-demo4" ) Loading
go-apps/meep-dai/sbi/dai-sbi.go +19 −15 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ const postgresPwd = "pwd" type SbiCfg struct { ModuleName string SandboxName string HostUrl string MepName string RedisAddr string InfluxAddr string Loading @@ -60,6 +61,7 @@ type SbiCfg struct { type DaiSbi struct { moduleName string sandboxName string hostUrl string mepName string scenarioName string localityEnabled bool Loading Loading @@ -88,6 +90,7 @@ func Init(cfg SbiCfg) (err error) { sbi = new(DaiSbi) sbi.moduleName = cfg.ModuleName sbi.sandboxName = cfg.SandboxName sbi.hostUrl = cfg.HostUrl sbi.mepName = cfg.MepName sbi.scenarioName = "" sbi.updateAppInfoCB = cfg.AppInfoList Loading @@ -95,6 +98,7 @@ func Init(cfg SbiCfg) (err error) { sbi.cleanUpCB = cfg.CleanUpCb redisAddr = cfg.RedisAddr influxAddr = cfg.InfluxAddr log.Info("SbiCfg: ", *sbi) // Fill locality map if len(cfg.Locality) > 0 { Loading Loading @@ -165,7 +169,7 @@ func Init(cfg SbiCfg) (err error) { } log.Info("Created new DAI DB tables") err = sbi.daiMgr.SimulateExistingApplication() err = sbi.daiMgr.LoadOnboardedMecApplications() if err != nil { log.Error("Failed to load simulating data: ", err) return err Loading Loading @@ -376,7 +380,7 @@ func GetApplicationListAppList(appNames []string, appProviders []string, appSoft return appListSbi, nil } func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appName := range appNames { log.Debug("filterAppNames: Processing appName: ", appName) Loading @@ -396,7 +400,7 @@ func filterAppNames(appNames []string, appListSbi *map[string]*tm.AppInfoList) ( return filteredAppListSbi } func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appProvider := range appProviders { log.Debug("filterAppProviders: Processing appProvider: ", appProvider) Loading @@ -416,7 +420,7 @@ func filterAppProviders(appProviders []string, appListSbi *map[string]*tm.AppInf return filteredAppListSbi } func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, appSoftVersion := range appSoftVersions { log.Debug("filterAppSoftVersions: Processing appSoftVersion: ", appSoftVersion) Loading @@ -436,7 +440,7 @@ func filterAppSoftVersions(appSoftVersions []string, appListSbi *map[string]*tm. return filteredAppListSbi } func filterServiceConts(serviceConts []string, appListSbi *map[string]*tm.AppInfoList) (map[string]*tm.AppInfoList) { func filterServiceConts(serviceConts []string, appListSbi *map[string]*tm.AppInfoList) map[string]*tm.AppInfoList { filteredAppListSbi := make(map[string]*tm.AppInfoList) for _, serviceCount := range serviceConts { log.Debug("filterServiceConts: Processing serviceCount: ", serviceCount) Loading Loading @@ -540,7 +544,7 @@ func GetAllListAppList() (appListSbi *map[string]*tm.AppInfoList, err error) { func CreateAppContext(appContextSbi *tm.AppContext) (appContextSbi_ *tm.AppContext, err error) { appContextSbi_, err = sbi.daiMgr.CreateAppContext(appContextSbi) appContextSbi_, err = sbi.daiMgr.CreateAppContext(appContextSbi, sbi.hostUrl, sbi.sandboxName) if err != nil { log.Error(err.Error()) return nil, err Loading