diff --git a/go-apps/meep-sss/api/swagger.yaml b/go-apps/meep-sss/api/swagger.yaml index e996e3457f92046ec7d773daff885f99e0e110c8..ab90949cdd44215806e980964d04ce377a31237f 100644 --- a/go-apps/meep-sss/api/swagger.yaml +++ b/go-apps/meep-sss/api/swagger.yaml @@ -411,7 +411,7 @@ paths: description: "This method shall support the URI query parameter, request and\ \ response data structures, and response codes, as specified in Tables 7.7.3.1-1\ \ and 7.7.3.1-2" - operationId: SensorStatusIndividualSubscriptionGET + operationId: SensorStatusSubscriptionGET parameters: - name: sensorIdentifier in: query @@ -510,7 +510,7 @@ paths: summary: The GET method is used to retrieve information about this subscription description: "This method shall support the request and response data structures,\ \ and response codes, as specified in Tables 7.8.3.1-1 and 7.8.3.1-2" - operationId: SensorSatusIndividualSubscriptionGET + operationId: SensorStatusIndividualSubscriptionGET parameters: - name: subscriptionId in: path diff --git a/go-apps/meep-sss/sbi/sss-sbi.go b/go-apps/meep-sss/sbi/sss-sbi.go index 85656a895cdd9c5131c73711174dec24147b58c4..c6f9f28bbb1342bed5bb80514da5ffe45b429fae 100644 --- a/go-apps/meep-sss/sbi/sss-sbi.go +++ b/go-apps/meep-sss/sbi/sss-sbi.go @@ -28,21 +28,43 @@ import ( const moduleName string = "meep-sss-sbi" -// var redisAddr string = "meep-redis-master.default.svc.cluster.local:6379" -// var influxAddr string = "http://meep-influxdb.default.svc.cluster.local:8086" +type Point struct { + Latitude float64 + Longitude float64 +} + +type SensorCharacteristic struct { + CharacteristicName string + CharacteristicValue string + CharacteristicUnitOfMeasure *string +} + +type SensorDiscoveryInfo struct { + SensorIdentifier string + SensorType string + SensorPropertyList []string + SensorCharacteristicList []SensorCharacteristic + SensorPosition *Point +} + +type SensorStatusInfo struct { + SensorIdentifier string + SensorStatusType string + ErrorInformation string +} type SbiCfg struct { - ModuleName string - SandboxName string - IotBroker string - IotTopic string - MepName string - RedisAddr string - InfluxAddr string - Locality []string - IotNotify func(string, string) - ScenarioNameCb func(string) - CleanUpCb func() + ModuleName string + SandboxName string + MepName string + RedisAddr string + InfluxAddr string + Locality []string + DiscoveryNotify func() + StatusNotify func() + DataNotify func() + ScenarioNameCb func(string) + CleanUpCb func() } type SssSbi struct { @@ -56,7 +78,10 @@ type SssSbi struct { handlerId int apiMgr *sam.SwaggerApiMgr activeModel *mod.Model - iotMgr *tm.IotMgr + sssMgr *tm.SssMgr + discoveryNotify func() + statusNotify func() + dataNotify func() updateScenarioNameCB func(string) cleanUpCB func() mutex sync.Mutex @@ -64,7 +89,7 @@ type SssSbi struct { var sbi *SssSbi -// Init - IOT Service SBI initialization +// Init - SSS Service SBI initialization func Init(cfg SbiCfg) (err error) { // Create new SBI instance @@ -78,6 +103,9 @@ func Init(cfg SbiCfg) (err error) { sbi.scenarioName = "" sbi.updateScenarioNameCB = cfg.ScenarioNameCb sbi.cleanUpCB = cfg.CleanUpCb + sbi.discoveryNotify = cfg.DiscoveryNotify + sbi.statusNotify = cfg.StatusNotify + sbi.dataNotify = cfg.DataNotify // Fill locality map if len(cfg.Locality) > 0 { @@ -120,13 +148,13 @@ func Init(cfg SbiCfg) (err error) { return err } - // Connect to IOT Manager - sbi.iotMgr, err = tm.NewOneM2MMgr(sbi.moduleName, sbi.sandboxName) + // Connect to SSS Manager + sbi.sssMgr, err = tm.NewSssMgr(sbi.moduleName, sbi.sandboxName, sbi.discoveryNotify, sbi.statusNotify, sbi.dataNotify) if err != nil { - log.Error("Failed connection to OneM2M Manager: ", err) + log.Error("Failed connection to SSS Manager: ", err) return err } - log.Info("Connected to OneM2M Manager") + log.Info("Connected to SSS Manager") // Initialize service processActiveScenarioUpdate() @@ -134,7 +162,7 @@ func Init(cfg SbiCfg) (err error) { return nil } -// Run - MEEP IOT execution +// Run - MEEP SSS execution func Run() (err error) { // Start Swagger API Manager (provider) @@ -182,9 +210,9 @@ func Stop() (err error) { } } - // Delete IOT Manager - if sbi.iotMgr != nil { - err = sbi.iotMgr.DeleteIotMgr() + // Delete SSS Manager + if sbi.sssMgr != nil { + err = sbi.sssMgr.DeleteSssMgr() if err != nil { log.Error(err.Error()) return err @@ -245,3 +273,78 @@ func processActiveScenarioUpdate() { // } } } + +func SensorDiscoveryInfoAll() (sensors []SensorDiscoveryInfo, err error) { + log.Info("sbi.SensorDiscoveryInfoAll") + + s, err := sbi.sssMgr.SensorDiscoveryInfoAll() + if err != nil { + return nil, err + } + //log.Info("sbi.SensorDiscoveryInfoAll: s: ", s) + + sensors = convertSensorDiscoveryInfoListFromSssMgr(s) + log.Info("sbi.SensorDiscoveryInfoAll: sensors: ", sensors) + + return sensors, nil +} + +func GetSensorStatus(sensorIdentifier string) (status SensorStatusInfo, err error) { + log.Info("sbi.GetSensorStatus") + + s, err := sbi.sssMgr.GetSensor(sensorIdentifier) + if err != nil { + return status, err + } + log.Info("sbi.GetSensorStatus: s: ", s) + + sensor := convertSensorDiscoveryInfoFromSssMgr(s) + log.Info("sbi.GetSensorStatus: sensors: ", sensor) + + // FIXME FSCOM CHeck status of the sensor??? + status = SensorStatusInfo{ + SensorIdentifier: sensor.SensorIdentifier, + SensorStatusType: "ONLINE", + ErrorInformation: "", + } + + return status, nil +} + +func convertSensorDiscoveryInfoListFromSssMgr(s []tm.SensorDiscoveryInfo) (sensors []SensorDiscoveryInfo) { + sensors = make([]SensorDiscoveryInfo, len(s)) + for i, val := range s { + sensors[i] = convertSensorDiscoveryInfoFromSssMgr(val) + } // End of 'for' statement + + return sensors +} + +func convertSensorDiscoveryInfoFromSssMgr(s tm.SensorDiscoveryInfo) (sensor SensorDiscoveryInfo) { + sensor = SensorDiscoveryInfo{ + SensorIdentifier: s.SensorIdentifier, + SensorType: s.SensorType, + } + if len(s.SensorPropertyList) != 0 { + sensor.SensorPropertyList = make([]string, len(s.SensorPropertyList)) + copy(sensor.SensorPropertyList, s.SensorPropertyList) + } + if len(s.SensorCharacteristicList) != 0 { + sensor.SensorCharacteristicList = make([]SensorCharacteristic, len(s.SensorCharacteristicList)) + for i, val := range s.SensorCharacteristicList { + sensor.SensorCharacteristicList[i] = SensorCharacteristic{ + CharacteristicName: val.CharacteristicName, + CharacteristicValue: val.CharacteristicValue, + CharacteristicUnitOfMeasure: val.CharacteristicUnitOfMeasure, + } + } // End of 'for' statement + } + if s.SensorPosition != nil { + sensor.SensorPosition = &Point{ + Latitude: s.SensorPosition.Latitude, + Longitude: s.SensorPosition.Longitude, + } + } + + return sensor +} diff --git a/go-apps/meep-sss/server/api_sensor_data_subscription.go b/go-apps/meep-sss/server/api_sensor_data_subscription.go index 8f63d00de39acc0a169e61e9b90d9063f9257faf..900b4450b0323c96b495b94e8bb71d375c09348c 100644 --- a/go-apps/meep-sss/server/api_sensor_data_subscription.go +++ b/go-apps/meep-sss/server/api_sensor_data_subscription.go @@ -14,23 +14,19 @@ import ( ) func SensorDataIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDataIndividualSubscriptionGET(w, r) } func SensorDataSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDataSubscriptionDELETE(w, r) } func SensorDataSubscriptionGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDataSubscriptionGET(w, r) } func SensorDataSubscriptionPOST(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDataSubscriptionPOST(w, r) } func SensorDataSubscriptionPUT(w http.ResponseWriter, r *http.Request) { diff --git a/go-apps/meep-sss/server/api_sensor_discovery_subscription.go b/go-apps/meep-sss/server/api_sensor_discovery_subscription.go index 3f551787d77a438bdce164f0f1d326fa2f8bb28a..208f1f98e73f525e02fa7725ec0ce411120fbb05 100644 --- a/go-apps/meep-sss/server/api_sensor_discovery_subscription.go +++ b/go-apps/meep-sss/server/api_sensor_discovery_subscription.go @@ -14,13 +14,11 @@ import ( ) func SensorDiscoveryIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDiscoveryIndividualSubscriptionGET(w, r) } func SensorDiscoverySubscriptionDELETE(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDiscoverySubscriptionDELETE(w, r) } func SensorDiscoverySubscriptionGET(w http.ResponseWriter, r *http.Request) { @@ -28,8 +26,7 @@ func SensorDiscoverySubscriptionGET(w http.ResponseWriter, r *http.Request) { } func SensorDiscoverySubscriptionPOST(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorDiscoverySubscriptionPOST(w, r) } func SensorDiscoverySubscriptionPUT(w http.ResponseWriter, r *http.Request) { diff --git a/go-apps/meep-sss/server/api_sensor_status_lookup.go b/go-apps/meep-sss/server/api_sensor_status_lookup.go index 4ca30c59f2b5eba2b20fa85ca087eed312bd5f66..3c6d79cc9618637e68e93e4339133f2752d66c10 100644 --- a/go-apps/meep-sss/server/api_sensor_status_lookup.go +++ b/go-apps/meep-sss/server/api_sensor_status_lookup.go @@ -14,6 +14,5 @@ import ( ) func SensorStatusLookupGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorStatusLookupGET(w, r) } diff --git a/go-apps/meep-sss/server/api_sensor_status_subscription.go b/go-apps/meep-sss/server/api_sensor_status_subscription.go index 9e0cae6e3f1ad336ce56160b9c84ab114a604093..fbd66aa3de2acd05e50f891171789b650fab9278 100644 --- a/go-apps/meep-sss/server/api_sensor_status_subscription.go +++ b/go-apps/meep-sss/server/api_sensor_status_subscription.go @@ -13,19 +13,12 @@ import ( "net/http" ) -func SensorSatusIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) -} - func SensorStatusIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorStatusIndividualSubscriptionGET(w, r) } func SensorStatusSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorStatusSubscriptionDELETE(w, r) } func SensorStatusSubscriptionPUT(w http.ResponseWriter, r *http.Request) { diff --git a/go-apps/meep-sss/server/api_status_status_subscription.go b/go-apps/meep-sss/server/api_status_status_subscription.go index 17b96aed6f9eb23f71dad1cc6d07ed795b019c45..f7d79405636c4488904ff5e62bc84fbd0c887ba0 100644 --- a/go-apps/meep-sss/server/api_status_status_subscription.go +++ b/go-apps/meep-sss/server/api_status_status_subscription.go @@ -13,7 +13,10 @@ import ( "net/http" ) +func SensorStatusSubscriptionGET(w http.ResponseWriter, r *http.Request) { + sensorStatusSubscriptionGET(w, r) +} + func SensorStatusSubscriptionPOST(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) + sensorStatusSubscriptionPOST(w, r) } diff --git a/go-apps/meep-sss/server/convert.go b/go-apps/meep-sss/server/convert.go index 611aaef890805964d915ef5ec0a803c358fcf921..0671a0cc1262fb012aeb122daea7b3b15e838dfb 100644 --- a/go-apps/meep-sss/server/convert.go +++ b/go-apps/meep-sss/server/convert.go @@ -31,3 +31,21 @@ func convertProblemDetailstoJson(probdetails *ProblemDetails) string { } return string(jsonInfo) } + +func convertSensorDiscoveryInfoListToJson(sensors []SensorDiscoveryInfo) string { + jsonInfo, err := json.Marshal(sensors) + if err != nil { + log.Error(err.Error()) + return "" + } + return string(jsonInfo) +} + +func convertSensorStatusToJson(status SensorStatusInfo) string { + jsonInfo, err := json.Marshal(status) + if err != nil { + log.Error(err.Error()) + return "" + } + return string(jsonInfo) +} diff --git a/go-apps/meep-sss/server/meep-sss.go b/go-apps/meep-sss/server/meep-sss.go index c99c45c39de8ca55e73549b4c1888c9f9e6177cf..00cf66b4f1fd2766f17f8f59bc1d7b3570eb9dbd 100644 --- a/go-apps/meep-sss/server/meep-sss.go +++ b/go-apps/meep-sss/server/meep-sss.go @@ -17,16 +17,18 @@ package server import ( + "bytes" "context" "encoding/json" "errors" "fmt" + "io/ioutil" "net/http" "net/url" "os" - "reflect" "strconv" "strings" + "sync" "time" sbi "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-sss/sbi" @@ -34,9 +36,11 @@ import ( dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr" httpLog "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" + met "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metrics" redis "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis" scc "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-ctrl-client" smc "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-service-mgmt-client" + "github.com/gorilla/mux" //uuid "github.com/google/uuid" ) @@ -45,8 +49,8 @@ const moduleName = "meep-sss" const sssBasePath = "sens/v1/" const sssKey = "sens" -const serviceName = "IOT Service" -const serviceCategory = "IOT" +const serviceName = "SSS Service" +const serviceCategory = "SSS" const defaultMepName = "global" const defaultScopeOfLocality = "MEC_SYSTEM" const defaultConsumedLocalOnly = true @@ -87,6 +91,27 @@ var sbxCtrlClient *scc.APIClient var registrationTicker *time.Ticker +const SENS_DISCOVERY = "SensorDiscoveryEventSubscription" +const SENS_STATUS = "SensorStatusSubscription" +const SENS_DATA = "SensorDataSubscription" + +const SENS_DISCOVERY_NOTIF = "SensorDiscoveryEventNotification" +const SENS_SATUS_NOTIF = "SensorStatusNotification" +const SENS_DATA_NOTIF = "SensorDataNotification" + +const TEST_NOTIF = "TestNotification" +const NOTIFY_EXPIRY = "ExpiryNotification" + +var sensorDiscoveryEventSubscriptionMap = map[int]*SensorDiscoveryEventSubscription{} +var sensorStatusSubscriptionMap = map[int]*SensorStatusSubscription{} +var sensorDataSubscriptionMap = map[int]*SensorDataSubscription{} + +var subscriptionExpiryMap = map[int][]int{} + +var mutex sync.Mutex +var expiryTicker *time.Ticker +var nextSubscriptionIdAvailable int + func getAppInstanceId() (id string, err error) { var appInfo scc.ApplicationInfo appInfo.Id = instanceId @@ -244,7 +269,7 @@ func mec011AppTerminationPost(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) } -// Init - IOT Service initialization +// Init - SSS Service initialization func Init() (err error) { // Retrieve Instance ID from environment variable if present @@ -342,16 +367,26 @@ func Init() (err error) { return err } _ = rc.DBFlush(baseKey) - log.Info("Connected to Redis DB, IOT service table") + log.Info("Connected to Redis DB, SSS service table") + + expiryTicker = time.NewTicker(time.Second) + go func() { + for range expiryTicker.C { + checkForExpiredSubscriptions() + } + }() // Initialize SBI sbiCfg := sbi.SbiCfg{ - ModuleName: moduleName, - SandboxName: sandboxName, - RedisAddr: redisAddr, - Locality: locality, - ScenarioNameCb: updateStoreName, - CleanUpCb: cleanUp, + ModuleName: moduleName, + SandboxName: sandboxName, + RedisAddr: redisAddr, + Locality: locality, + ScenarioNameCb: updateStoreName, + CleanUpCb: cleanUp, + DiscoveryNotify: discoveryNotify, + StatusNotify: statusNotify, + DataNotify: dataNotify, } if mepName != defaultMepName { sbiCfg.MepName = mepName @@ -393,11 +428,11 @@ func Init() (err error) { log.Info("Create App Enablement Service Management REST API client") } - log.Info("IOT successfully initialized") + log.Info("SSS successfully initialized") return nil } -// Run - Start IOT +// Run - Start SSS func Run() (err error) { // Start MEC Service registration ticker if appEnablementEnabled { @@ -406,7 +441,7 @@ func Run() (err error) { return sbi.Run() } -// Stop - Stop IOT +// Stop - Stop SSS func Stop() (err error) { // Stop MEC Service registration ticker if appEnablementEnabled { @@ -508,6 +543,10 @@ func cleanUp() { // Reset metrics store name updateStoreName("") + + sensorDiscoveryEventSubscriptionMap = map[int]*SensorDiscoveryEventSubscription{} + sensorStatusSubscriptionMap = map[int]*SensorStatusSubscription{} + sensorDataSubscriptionMap = map[int]*SensorDataSubscription{} } func updateStoreName(storeName string) { @@ -550,31 +589,1282 @@ func sensorDiscoveryLookupGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") - vars := mux.Vars(r) - log.Debug("sensorDiscoveryLookupGET: vars: ", vars) - - iotPlatformIdParamStr := vars["registeredIotPlatformId"] - log.Debug("sensorDiscoveryLookupGET: iotPlatformIdParamStr: ", iotPlatformIdParamStr) - // Validate query parameters u, _ := url.Parse(r.URL.String()) q := u.Query() log.Debug("sensorDiscoveryLookupGET: q: ", q) + if len(q) == 0 { + err := errors.New("Invalid query parameters") + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } log.Debug("sensorDiscoveryLookupGET: q[type][0]: ", q["type"][0]) - log.Debug("sensorDiscoveryLookupGET: q[sensorCharacteristicList][0]: ", q["sensorCharacteristicList"][0]) - log.Debug("sensorDiscoveryLookupGET: type(q[sensorCharacteristicList][0]): ", reflect.TypeOf(q["sensorCharacteristicList"][0])) + // log.Debug("sensorDiscoveryLookupGET: q[sensorCharacteristicList][0]: ", q["sensorCharacteristicList"][0]) + // log.Debug("sensorDiscoveryLookupGET: type(q[sensorCharacteristicList][0]): ", reflect.TypeOf(q["sensorCharacteristicList"][0])) //q: map[geographicalArea:[[object Object]] sensorCharacteristicList:[[object Object]] sensorPropertyList:[string1,string2] type:[string]]","time":"2025-02-04T08:35:35Z"} + // /sens/v1/queries/sensor_discovery?type=4&sensorPropertyList=%5B%22con%22%5D&sensorCharacteristicList=%5B%7B%22characteristicName%22%3A%22pi%22%2C%22characteristicUnitOfMeasure%22%3A%22ae_parent%22%7D%5D&geographicalArea=%5B%7B%22shape%22%3A0%2C%22radius%22%3A6%2C%22points%22%3A%5B%7B%22latitude%22%3A0.8008281904610115%2C%22longitude%22%3A6.027456183070403%7D%2C%7B%22latitude%22%3A0.8008281904610115%2C%22longitude%22%3A6.027456183070403%7D%5D%7D%5D' \ + s, err := sbi.SensorDiscoveryInfoAll() // FIXME FSCOM Useless whentimer will be used in sssmgr + if err != nil { + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + if len(s) == 0 { + err := errors.New("No sensor found") + errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) + return + } + sensors := convertSensorDiscoveryInfoListFromSbi_with_filter(s, q) + if len(sensors) == 0 { + err := errors.New("No sensor found") + errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) + return + } + + // Prepare response and send + jsonResponse := convertSensorDiscoveryInfoListToJson(sensors) + if jsonResponse == "" { + log.Error("Marshalling failure") + errHandlerProblemDetails(w, "Marshalling failure", http.StatusInternalServerError) + return + } + log.Info("sensorDiscoveryLookupGET: jsonResponse: ", jsonResponse) + fmt.Fprint(w, jsonResponse) + w.WriteHeader(http.StatusOK) +} + +func sensorStatusLookupGET(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorStatusLookupGET: ", r) - //w.WriteHeader(http.StatusOK) - err := errors.New("Not implemented") - errHandlerProblemDetails(w, err.Error(), http.StatusNotImplemented) + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + + // Validate query parameters + u, _ := url.Parse(r.URL.String()) + q := u.Query() + log.Debug("sensorStatusLookupGET: q: ", q) + if _, ok := q["sensorIdentifier"]; !ok { + err := errors.New("Invalid query parameters") + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } + log.Debug("sensorStatusLookupGET: q[sensorIdentifier][0]: ", q["sensorIdentifier"][0]) + + s, err := sbi.GetSensorStatus(q["sensorIdentifier"][0]) + if err != nil { + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + log.Debug("sensorStatusLookupGET: s: ", s) + + // Prepare response and send + jsonResponse := convertSensorStatusToJson(convertSensorStatusInfoFromSbi(s)) + if jsonResponse == "" { + log.Error("Marshalling failure") + errHandlerProblemDetails(w, "Marshalling failure", http.StatusInternalServerError) + return + } + log.Info("sensorDiscoveryLookupGET: jsonResponse: ", jsonResponse) + fmt.Fprint(w, jsonResponse) + w.WriteHeader(http.StatusOK) } func sensorDiscoverySubscriptionGET(w http.ResponseWriter, r *http.Request) { log.Debug(">>> sensorDiscoverySubscriptionGET: ", r) + subscriptionsGET(SENS_DISCOVERY, w, r) +} + +func sensorStatusSubscriptionGET(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorStatusSubscriptionPOST: ", r) + + subscriptionsGET(SENS_STATUS, w, r) +} + +func sensorDataSubscriptionGET(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorDataSubscriptionGET: ", r) + + subscriptionsGET(SENS_DATA, w, r) +} +func sensorDiscoverySubscriptionPOST(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorDiscoverySubscriptionPOST: ", r) + + subscriptionsPOST(SENS_DISCOVERY, w, r) +} + +func sensorStatusSubscriptionPOST(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorStatusSubscriptionPOST: ", r) + + subscriptionsPOST(SENS_STATUS, w, r) +} + +func sensorDataSubscriptionPOST(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> sensorDataSubscriptionPOST: ", r) + + subscriptionsPOST(SENS_DATA, w, r) +} + +func sensorDiscoveryIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { + subscriptionsByIdGET(SENS_DISCOVERY, w, r) +} + +func sensorStatusIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { + subscriptionsByIdGET(SENS_STATUS, w, r) +} + +func sensorDataIndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { + subscriptionsByIdGET(SENS_DATA, w, r) +} + +func sensorDiscoverySubscriptionDELETE(w http.ResponseWriter, r *http.Request) { + subscriptionDelete(w, r) +} + +func sensorStatusSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { + subscriptionDelete(w, r) +} + +func sensorDataSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { + subscriptionDelete(w, r) +} + +func subscriptionsPOST(subType string, w http.ResponseWriter, r *http.Request) { + log.Debug(">>> subscriptionsPOST: ", subType) + + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + + var subscriptionCommon SubscriptionCommon + // Read JSON input stream provided in the Request, and stores it in the bodyBytes as bytes + bodyBytes, _ := ioutil.ReadAll(r.Body) + log.Info("subscriptionsPost: bodyBytes: ", string(bodyBytes)) + // Unmarshal function to converts a JSON-formatted string into a SubscriptionCommon struct and store it in extractSubType + err := json.Unmarshal(bodyBytes, &subscriptionCommon) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + log.Info("subscriptionsPost: subscriptionCommon: ", subscriptionCommon) + + // Validating mandatory parameters provided in the request body + if subscriptionCommon.SubscriptionType == "" { + log.Error("Mandatory SubscriptionType parameter should be present") + errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) + return + } + + if subscriptionCommon.SubscriptionType != SENS_DISCOVERY && subscriptionCommon.SubscriptionType != SENS_STATUS && subscriptionCommon.SubscriptionType != SENS_DATA { + log.Error("Invalid SubscriptionType") + errHandlerProblemDetails(w, "Invalid SubscriptionType", http.StatusBadRequest) + return + } + + if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig == nil { + log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") + errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) + return + } + + // extract subscription type + subscriptionType := subscriptionCommon.SubscriptionType + + // subscriptionId will be generated sequentially + newSubsId := nextSubscriptionIdAvailable + nextSubscriptionIdAvailable++ + subsIdStr := strconv.Itoa(newSubsId) + + // create a unique link for every subscription and concatenate subscription to it + link := new(SubscriptionLinks) + self := new(LinkType) + self.Href = hostUrl.String() + basePath + "subscriptions/" + subsIdStr + link.Self = self + + // switch statement is based on provided subscriptionType in the request body + var jsonResponse string + switch subscriptionType { + case SENS_DISCOVERY: + var sensorDiscoveryEventSubscription SensorDiscoveryEventSubscription + jsonResponse, err = processSensorDiscoveryEventSubscription(bodyBytes, link, subsIdStr, &sensorDiscoveryEventSubscription) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Location", sensorDiscoveryEventSubscription.Links.Self.Href) + + case SENS_STATUS: + var sensorStatusSubscription SensorStatusSubscription + jsonResponse, err = processSensorStatusSubscription(bodyBytes, link, subsIdStr, &sensorStatusSubscription) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Location", sensorStatusSubscription.Links.Self.Href) + + case SENS_DATA: + var sensorDataSubscription SensorDataSubscription + jsonResponse, err = processSensorDataSubscription(bodyBytes, link, subsIdStr, &sensorDataSubscription) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Location", sensorDataSubscription.Links.Self.Href) + + default: + log.Error("Unsupported subscriptionType") + return + } + log.Info("subscriptionsPost: jsonResponse: ", jsonResponse) + + // Prepare & send response + w.WriteHeader(http.StatusCreated) + fmt.Fprint(w, jsonResponse) + + if subscriptionCommon.RequestTestNotification { + links := new(TestNotificationLinks) + links.Subscription = self + testNotification := TestNotification{ + Links: links, + NotificationType: TEST_NOTIF, + } + log.Info("subscriptionsPost: testNotification: ", testNotification) + sendTestNotification(subscriptionCommon.CallbackReference, testNotification) + } +} + +/* + * subscriptionsGET is to retrieve information about all existing subscriptions at /subscriptions endpoint + * @param {struct} w HTTP write reference + * @param {struct} r contains the HTTP request + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7 + */ +func subscriptionsGET(subType string, w http.ResponseWriter, r *http.Request) { + log.Debug(">>> subscriptionsGET: ", r) + + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + + // get & validate query param values for sensorIdentifier + u, _ := url.Parse(r.URL.String()) + log.Info("url: ", u.RequestURI()) + q := u.Query() + sensorIdentifier := q.Get("sensorIdentifier") + log.Debug("subscriptionsGET: sensorIdentifier: ", sensorIdentifier) + sensorIdentifiers := strings.Split(sensorIdentifier, ",") + log.Debug("subscriptionsGET: sensorIdentifiers: ", sensorIdentifiers) + + // get the response against particular subscription type + response := createSubscriptionLinkList(subType, sensorIdentifiers) + + // prepare & send response + jsonResponse, err := json.Marshal(response) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + + // success response code + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, string(jsonResponse)) +} + +/* + * subscriptionsByIdGET is to retrieve information about all existing subscriptions at /subscriptions endpoint + * @param {struct} w HTTP write reference + * @param {struct} r contains the HTTP request + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7 + */ +func subscriptionsByIdGET(subType string, w http.ResponseWriter, r *http.Request) { + log.Debug(">>> subscriptionsByIdGET: ", r) + + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + + // get & validate query param values for sensorIdentifier + u, _ := url.Parse(r.URL.String()) + log.Info("url: ", u.RequestURI()) + + vars := mux.Vars(r) + subsIdStr := vars["subscriptionId"] + log.Info("subsIdStr: ", subsIdStr) + + q := u.Query() + sensorIdentifier := q.Get("sensorIdentifier") + log.Debug("subscriptionsByIdGET: sensorIdentifier: ", sensorIdentifier) + sensorIdentifiers := strings.Split(sensorIdentifier, ",") + log.Debug("subscriptionsByIdGET: sensorIdentifiers: ", sensorIdentifiers) + + // Find subscription entry in Redis DB + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("subscriptionsByIdGET: keyName: ", keyName) + subscription, err := rc.JSONGetEntry(keyName, ".") + if err != nil { + err = errors.New("subscription not found against the provided subscriptionId") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) + return + } + log.Info("subscriptionsByIdGET: subscription: ", subscription) + + var jsonResponse []byte + if subType == SENS_DISCOVERY && isSubscriptionIdRegisteredSensorDiscoveryEvent(subsIdStr) { + var subResp SensorDiscoveryEventSubscription + err = json.Unmarshal([]byte(subscription), &subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + if *subResp.SubscriptionType != SENS_DISCOVERY { + err = errors.New("subscriptionType mismatch") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } + // prepare response + jsonResponse, err = json.Marshal(&subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + } else if subType == SENS_STATUS && isSubscriptionIdRegisteredSensorStatus(subsIdStr) { + var subResp SensorStatusSubscription + err = json.Unmarshal([]byte(subscription), &subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + if *subResp.SubscriptionType != SENS_STATUS { + err = errors.New("subscriptionType mismatch") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } + // prepare response + jsonResponse, err = json.Marshal(&subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + } else if subType == SENS_DATA && isSubscriptionIdRegisteredSensorData(subsIdStr) { + var subResp SensorDataSubscription + err = json.Unmarshal([]byte(subscription), &subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + if *subResp.SubscriptionType != SENS_DATA { + err = errors.New("subscriptionType mismatch") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } + // prepare response + jsonResponse, err = json.Marshal(&subResp) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + } else { + err = errors.New("subscriptionType does not exist") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest) + return + } + log.Info("subscriptionsByIdGET: jsonResponse: ", string(jsonResponse)) + + // send response + w.WriteHeader(http.StatusOK) + fmt.Fprint(w, string(jsonResponse)) +} + +func subscriptionDelete(w http.ResponseWriter, r *http.Request) { + log.Debug(">>> subscriptionDelete: ", r) + w.Header().Set("Content-Type", "application/json; charset=UTF-8") - err := errors.New("Not implemented") - errHandlerProblemDetails(w, err.Error(), http.StatusNotImplemented) + u, _ := url.Parse(r.URL.String()) + log.Info("url: ", u.RequestURI()) + + vars := mux.Vars(r) + subsIdStr := vars["subscriptionId"] + log.Info("subsIdStr: ", subsIdStr) + + // Find subscriptionInfo entry in redis DB + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("subscriptionDelete: keyName: ", keyName) + subscription, err := rc.JSONGetEntry(keyName, ".") + if err != nil { + err = errors.New("subscription not found against the provided subscriptionId") + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) + return + } + + // Delete subscriptionInfo entry from redis DB + err = delSubscription(subsIdStr, subscription, false) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } + + // Send response on successful deletion of subscription resource + w.WriteHeader(http.StatusNoContent) +} + +/* + * processSensorDiscoveryEventSubscription is to create subscription at /subscriptions endpoint + * @param {struct} w HTTP write reference + * @param {struct} r contains the HTTP request + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7.4.3.4 POST + */ +func processSensorDiscoveryEventSubscription(bodyBytes []byte, link *SubscriptionLinks, subsIdStr string, sensorDiscoveryEventSubscription *SensorDiscoveryEventSubscription) (string, error) { + + err := json.Unmarshal(bodyBytes, sensorDiscoveryEventSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + + // Validating mandatory parameters provided in the request body + if sensorDiscoveryEventSubscription.SubscriptionType != nil && *sensorDiscoveryEventSubscription.SubscriptionType != SENSOR_DISCOVERY_EVENT_SUBSCRIPTION { + err = errors.New("SubscriptionType attribute shall be present in request body") + log.Error(err.Error()) + return "", err + } + + if sensorDiscoveryEventSubscription.Links != nil { + err = errors.New("Links attribute should not be present in request body") + log.Error(err.Error()) + return "", err + } + + // FIXME FSCOM Check filter values + + if sensorDiscoveryEventSubscription.WebsockNotifConfig == nil && sensorDiscoveryEventSubscription.CallbackReference == "" { + err = errors.New("Mandatory CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + if sensorDiscoveryEventSubscription.CallbackReference == "" { + err = errors.New("CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + if sensorDiscoveryEventSubscription.WebsockNotifConfig != nil { + err = errors.New("WebsockNotifConfig not supported") + log.Error(err.Error()) + return "", err + } + + registerSensorDiscoveryEventSubscription(subsIdStr, nil, sensorDiscoveryEventSubscription) + + sensorDiscoveryEventSubscription.Links = link + + // Store subscription key in redis + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("processSensorDiscoveryEventSubscription: keyName: ", keyName) + log.Info("processSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: ", sensorDiscoveryEventSubscription) + jsonResponse, err := json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + jsonResponse_str := string(jsonResponse) + err = rc.JSONSetEntry(keyName, ".", jsonResponse_str) + if err != nil { + log.Error(err.Error()) + return "", err + } + + return jsonResponse_str, nil +} + +/* + * registerSensorDiscoveryEventSubscription to register new sensorDiscoveryEventSubscription + * @param {string} subsIdStr contains an Id to uniquely subscription + * @param {struct} currentSensorDiscoveryEventSubscription contains the existing SensorDiscoveryEventSubscription + * @param {struct} sensorDiscoveryEventSubscription contains request body send to /subscriptions endpoint + */ +func registerSensorDiscoveryEventSubscription(subId string, currentSensorDiscoveryEventSubscription *SensorDiscoveryEventSubscription, sensorDiscoveryEventSubscription *SensorDiscoveryEventSubscription) { + log.Debug(">>> registerSensorDiscoveryEventSubscription: subId: ", subId) + log.Debug(">>> registerSensorDiscoveryEventSubscription: currentSensorDiscoveryEventSubscription: ", currentSensorDiscoveryEventSubscription) + log.Debug(">>> registerSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: ", sensorDiscoveryEventSubscription) + + subsId, _ := strconv.Atoi(subId) + log.Info("registerSensorDiscoveryEventSubscription: subsId: ", subsId) + mutex.Lock() + defer mutex.Unlock() + + log.Info("registerSensorDiscoveryEventSubscription: Before subscriptionExpiryMap: ", subscriptionExpiryMap) + // Replace the current subscription by the new one + sensorDiscoveryEventSubscriptionMap[subsId] = sensorDiscoveryEventSubscription + if currentSensorDiscoveryEventSubscription != nil { + // Update the subscriptionExpiryMap + // 1. Find the old one if any + if currentSensorDiscoveryEventSubscription.ExpiryDeadline != nil { + if *currentSensorDiscoveryEventSubscription.ExpiryDeadline != *sensorDiscoveryEventSubscription.ExpiryDeadline { + // 1.1 Remove the existing one + intList := subscriptionExpiryMap[int(currentSensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] + // TODO FSCOM Common code with delSubscription, create a function to remove an expiruDeadline from the subscriptionExpiryMap + for i, subsIndex := range intList { + log.Info("registerSensorDiscoveryEventSubscription: i: ", i) + log.Info("registerSensorDiscoveryEventSubscription: subsIndex: ", subsIndex) + if subsIndex == subsId { + // + log.Info("registerSensorDiscoveryEventSubscription: found index, delete entry") + // Remove item and update subscriptionExpiryMap + subscriptionExpiryMap[int(currentSensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] = append(intList[:i], intList[i+1:]...) + break + } + } // End of 'for' statement + log.Info("delSubscription: After removal: subscriptionExpiryMap: ", subscriptionExpiryMap) + + // 1.2 And add the new one + subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] = append(subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)], subsId) + } + } else { + // 2. Add new expiry if any + if sensorDiscoveryEventSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] = intList + } + } + } else { // First registration + if sensorDiscoveryEventSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorDiscoveryEventSubscription.ExpiryDeadline.Seconds)] = intList + } + } + log.Info("registerSensorDiscoveryEventSubscription: After subscriptionExpiryMap: ", subscriptionExpiryMap) + log.Info("New registration: ", subsId, " type: ", SENS_DISCOVERY) +} + +/* + * isSubscriptionIdRegisteredSensorDiscoveryEvent to verify if subscription is already registered + * @param {string} subsIdStr contains an Id to uniquely subscription + * @return {bool} true on success, false otherwise + */ +func isSubscriptionIdRegisteredSensorDiscoveryEvent(subsIdStr string) bool { + var returnVal bool + subsId, _ := strconv.Atoi(subsIdStr) + mutex.Lock() + defer mutex.Unlock() + + if sensorDiscoveryEventSubscriptionMap[subsId] != nil { + returnVal = true + } else { + returnVal = false + } + return returnVal +} + +/* + * processSensorDiscoveryEventSubscription is to create subscription at /subscriptions endpoint + * @param {struct} w HTTP write reference + * @param {struct} r contains the HTTP request + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7.7.3.4 POST + */ +func processSensorStatusSubscription(bodyBytes []byte, link *SubscriptionLinks, subsIdStr string, sensorStatusSubscription *SensorStatusSubscription) (string, error) { + + err := json.Unmarshal(bodyBytes, sensorStatusSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + + // Validating mandatory parameters provided in the request body + if sensorStatusSubscription.SubscriptionType != nil && *sensorStatusSubscription.SubscriptionType != SENSOR_STATUS_SUBSCRIPTION { + err = errors.New("SubscriptionType attribute shall be present in request body") + log.Error(err.Error()) + return "", err + } + + if sensorStatusSubscription.Links != nil { + err = errors.New("Links attribute should not be present in request body") + log.Error(err.Error()) + return "", err + } + + // FIXME FSCOM Check filter values + + if sensorStatusSubscription.WebsockNotifConfig == nil && sensorStatusSubscription.CallbackReference == "" { + err = errors.New("Mandatory CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + if sensorStatusSubscription.WebsockNotifConfig != nil { + err = errors.New("WebsockNotifConfig not supported") + log.Error(err.Error()) + return "", err + } + if sensorStatusSubscription.CallbackReference == "" { + err = errors.New("CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + + registerSensorStatusSubscription(subsIdStr, nil, sensorStatusSubscription) + + sensorStatusSubscription.Links = link + + // Store subscription key in redis + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("processSensorStatusSubscription: keyName: ", keyName) + log.Info("processSensorStatusSubscription: sensorStatusSubscription: ", sensorStatusSubscription) + jsonResponse, err := json.Marshal(sensorStatusSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + jsonResponse_str := string(jsonResponse) + err = rc.JSONSetEntry(keyName, ".", jsonResponse_str) + if err != nil { + log.Error(err.Error()) + return "", err + } + + return jsonResponse_str, nil +} + +/* + * registerSensorStatusSubscription to register new sensorStatusSubscription + * @param {string} subsIdStr contains an Id to uniquely subscription + * @param {struct} currentSensorStatusSubscription contains the existing SensorStatusSubscription + * @param {struct} sensorStatusSubscription contains request body send to /subscriptions endpoint + */ +func registerSensorStatusSubscription(subId string, currentSensorStatusSubscription *SensorStatusSubscription, sensorStatusSubscription *SensorStatusSubscription) { + log.Debug(">>> registerSensorStatusSubscription: subId: ", subId) + log.Debug(">>> registerSensorStatusSubscription: currentSensorStatusSubscription: ", currentSensorStatusSubscription) + log.Debug(">>> registerSensorStatusSubscription: sensorStatusSubscription: ", sensorStatusSubscription) + + subsId, _ := strconv.Atoi(subId) + log.Info("registerSensorStatusSubscription: subsId: ", subsId) + mutex.Lock() + defer mutex.Unlock() + + log.Info("registerSensorStatusSubscription: Before subscriptionExpiryMap: ", subscriptionExpiryMap) + // Replace the current subscription by the new one + sensorStatusSubscriptionMap[subsId] = sensorStatusSubscription + if currentSensorStatusSubscription != nil { + // Update the subscriptionExpiryMap + // 1. Find the old one if any + if currentSensorStatusSubscription.ExpiryDeadline != nil { + if *currentSensorStatusSubscription.ExpiryDeadline != *sensorStatusSubscription.ExpiryDeadline { + // 1.1 Remove the existing one + intList := subscriptionExpiryMap[int(currentSensorStatusSubscription.ExpiryDeadline.Seconds)] + // TODO FSCOM Common code with delSubscription, create a function to remove an expiruDeadline from the subscriptionExpiryMap + for i, subsIndex := range intList { + log.Info("registerSensorStatusSubscription: i: ", i) + log.Info("registerSensorStatusSubscription: subsIndex: ", subsIndex) + if subsIndex == subsId { + // + log.Info("registerSensorStatusSubscription: found index, delete entry") + // Remove item and update subscriptionExpiryMap + subscriptionExpiryMap[int(currentSensorStatusSubscription.ExpiryDeadline.Seconds)] = append(intList[:i], intList[i+1:]...) + break + } + } // End of 'for' statement + log.Info("delSubscription: After removal: subscriptionExpiryMap: ", subscriptionExpiryMap) + + // 1.2 And add the new one + subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)] = append(subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)], subsId) + } + } else { + // 2. Add new expiry if any + if sensorStatusSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)] = intList + } + } + } else { // First registration + if sensorStatusSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorStatusSubscription.ExpiryDeadline.Seconds)] = intList + } + } + log.Info("registerSensorStatusSubscription: After subscriptionExpiryMap: ", subscriptionExpiryMap) + log.Info("New registration: ", subsId, " type: ", SENS_DISCOVERY) +} + +/* + * isSubscriptionIdRegisteredSensorStatus to verify if subscription is already registered + * @param {string} subsIdStr contains an Id to uniquely subscription + * @return {bool} true on success, false otherwise + */ +func isSubscriptionIdRegisteredSensorStatus(subsIdStr string) bool { + var returnVal bool + subsId, _ := strconv.Atoi(subsIdStr) + mutex.Lock() + defer mutex.Unlock() + + if sensorStatusSubscriptionMap[subsId] != nil { + returnVal = true + } else { + returnVal = false + } + return returnVal +} + +/* + * func processSensorDataSubscription(bodyBytes []byte, link *SubscriptionLinks, subsIdStr string, sensorDataSubscription *SensorDataSubscription) (string, error) { + is to create subscription at /subscriptions endpoint + * @param {struct} w HTTP write reference + * @param {struct} r contains the HTTP request + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7.10.3.4 POST +*/ +func processSensorDataSubscription(bodyBytes []byte, link *SubscriptionLinks, subsIdStr string, sensorDataSubscription *SensorDataSubscription) (string, error) { + + err := json.Unmarshal(bodyBytes, sensorDataSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + + // Validating mandatory parameters provided in the request body + if sensorDataSubscription.SubscriptionType != nil && *sensorDataSubscription.SubscriptionType != SENSOR_DATA_SUBSCRIPTION { + err = errors.New("SubscriptionType attribute shall be present in request body") + log.Error(err.Error()) + return "", err + } + + if sensorDataSubscription.Links != nil { + err = errors.New("Links attribute should not be present in request body") + log.Error(err.Error()) + return "", err + } + + // FIXME FSCOM Check filter values + + if sensorDataSubscription.WebsockNotifConfig == nil && sensorDataSubscription.CallbackReference == "" { + err = errors.New("Mandatory CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + if sensorDataSubscription.WebsockNotifConfig != nil { + err = errors.New("WebsockNotifConfig not supported") + log.Error(err.Error()) + return "", err + } + if sensorDataSubscription.CallbackReference == "" { + err = errors.New("CallbackReference parameter should be present") + log.Error(err.Error()) + return "", err + } + + registerSensorDataSubscription(subsIdStr, nil, sensorDataSubscription) + + sensorDataSubscription.Links = link + + // Store subscription key in redis + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("processSensorDataSubscription: keyName: ", keyName) + log.Info("processSensorDataSubscription: sensorDataSubscription: ", sensorDataSubscription) + jsonResponse, err := json.Marshal(sensorDataSubscription) + if err != nil { + log.Error(err.Error()) + return "", err + } + jsonResponse_str := string(jsonResponse) + err = rc.JSONSetEntry(keyName, ".", jsonResponse_str) + if err != nil { + log.Error(err.Error()) + return "", err + } + + return jsonResponse_str, nil +} + +/* + * registerSensorDataSubscription to register new sensorDataSubscription + * @param {string} subsIdStr contains an Id to uniquely subscription + * @param {struct} currentSensorDataSubscription contains the existing SensorDataSubscription + * @param {struct} sensorDataSubscription contains request body send to /subscriptions endpoint + */ +func registerSensorDataSubscription(subId string, currentSensorDataSubscription *SensorDataSubscription, sensorDataSubscription *SensorDataSubscription) { + log.Debug(">>> registerSensorDataSubscription: subId: ", subId) + log.Debug(">>> registerSensorDataSubscription: currentSensorDataSubscription: ", currentSensorDataSubscription) + log.Debug(">>> registerSensorDataSubscription: sensorDataSubscription: ", sensorDataSubscription) + + subsId, _ := strconv.Atoi(subId) + log.Info("registerSensorDataSubscription: subsId: ", subsId) + mutex.Lock() + defer mutex.Unlock() + + log.Info("registerSensorDataSubscription: Before subscriptionExpiryMap: ", subscriptionExpiryMap) + // Replace the current subscription by the new one + sensorDataSubscriptionMap[subsId] = sensorDataSubscription + if currentSensorDataSubscription != nil { + // Update the subscriptionExpiryMap + // 1. Find the old one if any + if currentSensorDataSubscription.ExpiryDeadline != nil { + if *currentSensorDataSubscription.ExpiryDeadline != *sensorDataSubscription.ExpiryDeadline { + // 1.1 Remove the existing one + intList := subscriptionExpiryMap[int(currentSensorDataSubscription.ExpiryDeadline.Seconds)] + // TODO FSCOM Common code with delSubscription, create a function to remove an expiruDeadline from the subscriptionExpiryMap + for i, subsIndex := range intList { + log.Info("registerSensorDataSubscription: i: ", i) + log.Info("registerSensorDataSubscription: subsIndex: ", subsIndex) + if subsIndex == subsId { + // + log.Info("registerSensorDataSubscription: found index, delete entry") + // Remove item and update subscriptionExpiryMap + subscriptionExpiryMap[int(currentSensorDataSubscription.ExpiryDeadline.Seconds)] = append(intList[:i], intList[i+1:]...) + break + } + } // End of 'for' statement + log.Info("delSubscription: After removal: subscriptionExpiryMap: ", subscriptionExpiryMap) + + // 1.2 And add the new one + subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)] = append(subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)], subsId) + } + } else { + // 2. Add new expiry if any + if sensorDataSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)] = intList + } + } + } else { // First registration + if sensorDataSubscription.ExpiryDeadline != nil { + intList := subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)] + intList = append(intList, subsId) + subscriptionExpiryMap[int(sensorDataSubscription.ExpiryDeadline.Seconds)] = intList + } + } + log.Info("registerSensorDataSubscription: After subscriptionExpiryMap: ", subscriptionExpiryMap) + log.Info("New registration: ", subsId, " type: ", SENS_DISCOVERY) +} + +/* + * isSubscriptionIdRegisteredSensorData to verify if subscription is already registered + * @param {string} subsIdStr contains an Id to uniquely subscription + * @return {bool} true on success, false otherwise + */ +func isSubscriptionIdRegisteredSensorData(subsIdStr string) bool { + var returnVal bool + subsId, _ := strconv.Atoi(subsIdStr) + mutex.Lock() + defer mutex.Unlock() + + if sensorDataSubscriptionMap[subsId] != nil { + returnVal = true + } else { + returnVal = false + } + return returnVal +} + +func createSubscriptionLinkList(subType string, sensorIdentifiers []string) *SubscriptionLinkList { + log.Debug(">>> createSubscriptionLinkList: subType: ", subType) + log.Debug(">>> createSubscriptionLinkList: sensorIdentifiers: ", sensorIdentifiers) + + log.Debug("createSubscriptionLinkList: sensorDiscoveryEventSubscriptionMap: ", sensorDiscoveryEventSubscriptionMap) + log.Debug("createSubscriptionLinkList: sensorStatusSubscriptionMap: ", sensorStatusSubscriptionMap) + log.Debug("createSubscriptionLinkList: sensorDataSubscriptionMap: ", sensorDataSubscriptionMap) + + subscriptionLinkList := new(SubscriptionLinkList) + + links := new(SubscriptionLinkListLinks) + self := new(LinkType) + self.Href = hostUrl.String() + basePath + "subscriptions" + + links.Self = self + + //loop through all different types of subscription + mutex.Lock() + defer mutex.Unlock() + + if subType == SENS_DISCOVERY { + for _, discoveryEventSubscription := range sensorDiscoveryEventSubscriptionMap { + if discoveryEventSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = discoveryEventSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_DISCOVERY + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + } else if subType == SENS_STATUS { + for _, statusSubscription := range sensorStatusSubscriptionMap { + if statusSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = statusSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_STATUS + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + } else if subType == SENS_DATA { + for _, dataSubscription := range sensorDataSubscriptionMap { + if dataSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = dataSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_DATA_NOTIF + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + } else { // Build complete list + for _, discoveryEventSubscription := range sensorDiscoveryEventSubscriptionMap { + if discoveryEventSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = discoveryEventSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_DISCOVERY + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + for _, statusSubscription := range sensorStatusSubscriptionMap { + if statusSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = statusSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_STATUS + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + for _, dataSubscription := range sensorDataSubscriptionMap { + if dataSubscription != nil { + var subscriptions SubscriptionLinkListSubscription + subscriptions.Href = dataSubscription.Links.Self.Href + subscriptions.SubscriptionType = SENS_DATA + links.Subscriptions = append(links.Subscriptions, subscriptions) + } + } // End of 'for' statement + } + log.Debug("createSubscriptionLinkList: links.Subscriptions: ", links.Subscriptions) + + subscriptionLinkList.Links = links + + return subscriptionLinkList +} + +/* + * checkForExpiredSubscriptions delete those subscriptions whose expiryTime is reached + */ +func checkForExpiredSubscriptions() { + //log.Debug(">>> checkForExpiredSubscriptions") + + nowTime := int(time.Now().Unix()) + mutex.Lock() + defer mutex.Unlock() + for expiryTime, subsIndexList := range subscriptionExpiryMap { + if expiryTime <= nowTime { + subscriptionExpiryMap[expiryTime] = nil + for _, subsId := range subsIndexList { + subsIdStr := strconv.Itoa(subsId) + keyName := baseKey + "subscriptions:" + subsIdStr + log.Info("checkForExpiredSubscriptions: keyName: ", keyName) + subscription, err := rc.JSONGetEntry(keyName, ".") + if err != nil { + log.Error(err.Error()) + continue + } + cbRef := "" + var notif = ExpiryNotification{} + if strings.Contains(subscription, SENS_DISCOVERY) { + if sensorDiscoveryEventSubscriptionMap[subsId] != nil { + cbRef = sensorDiscoveryEventSubscriptionMap[subsId].CallbackReference + notif.NotificationType = SENS_DISCOVERY_NOTIF + } else { + continue + } + } else if strings.Contains(subscription, SENS_STATUS) { + if sensorStatusSubscriptionMap[subsId] != nil { + cbRef = sensorStatusSubscriptionMap[subsId].CallbackReference + notif.NotificationType = SENS_SATUS_NOTIF + } else { + continue + } + } else if strings.Contains(subscription, SENS_DATA) { + if sensorDataSubscriptionMap[subsId] != nil { + cbRef = sensorDataSubscriptionMap[subsId].CallbackReference + notif.NotificationType = SENS_DATA_NOTIF + } else { + continue + } + } + + var expiryTimeStamp TimeStamp + expiryTimeStamp.Seconds = int32(expiryTime) + + link := new(ExpiryNotificationLinks) + link.Subscription.Href = cbRef + notif.Links = link + + notif.ExpiryDeadline = &expiryTimeStamp + sendExpiryNotification(link.Subscription.Href, notif) + + // Delete subscription + err = delSubscription(subsIdStr, "", true) + if err != nil { + log.Error(err.Error()) + } + } // End of 'for' statement + } + } // End of 'for' statement +} + +/* + * delSubscription delete expired subscriptions from redis DB + */ +func delSubscription(subsId string, subscription string, mutexTaken bool) error { + log.Debug(">>> delSubscription: ", subsId) + + keyName := baseKey + "subscriptions:" + subsId + log.Info("delSubscription: keyName: ", keyName) + err := rc.JSONDelEntry(keyName, ".") + if err != nil { + log.Error(err.Error()) + return err + } + log.Info("delSubscription: Before removal: subscriptionExpiryMap: ", subscriptionExpiryMap) + for i, subsIndexList := range subscriptionExpiryMap { + log.Info("delSubscription: subsIndexList: ", subsIndexList) + for j, subsIndex := range subsIndexList { + log.Info("delSubscription: j: ", j) + log.Info("delSubscription: subsIndex: ", subsIndex) + if strings.Compare(strconv.Itoa(subsIndex), subsId) == 0 { + // FIXME FSCOM How to manage it subscriptionExpiryMap + log.Info("delSubscription: found index, delete entry") + subscriptionExpiryMap[i] = append(subscriptionExpiryMap[i][:j], subscriptionExpiryMap[i][j+1:]...) + break + } + } // End of 'for' statement + } // End of 'for' statement + log.Info("delSubscription: After removal: subscriptionExpiryMap: ", subscriptionExpiryMap) + + if strings.Contains(subscription, SENS_DISCOVERY) { + deregisterSensorDiscoveryEventSubscription(subsId, mutexTaken) + } else if strings.Contains(subscription, SENS_STATUS) { + deregisterSensorStatusSubscription(subsId, mutexTaken) + } else if strings.Contains(subscription, SENS_DATA) { + deregisterSensorDataSubscription(subsId, mutexTaken) + } + + return nil +} + +func deregisterSensorDiscoveryEventSubscription(subsIdStr string, mutexTaken bool) { + log.Debug(">>> deregisterSensorDiscoveryEventSubscription: subsId: ", subsIdStr) + + subsId, _ := strconv.Atoi(subsIdStr) + if !mutexTaken { + mutex.Lock() + defer mutex.Unlock() + } + log.Info("deregisterSensorDiscoveryEventSubscription: Before sensorDiscoveryEventSubscriptionMap", sensorDiscoveryEventSubscriptionMap) + delete(sensorDiscoveryEventSubscriptionMap, subsId) + log.Info("deregisterSensorDiscoveryEventSubscription: After sensorDiscoveryEventSubscriptionMap", sensorDiscoveryEventSubscriptionMap) + + log.Info("deregisterSensorDiscoveryEventSubscription: ", subsId, " type: ", SENS_DISCOVERY) +} + +func deregisterSensorStatusSubscription(subsIdStr string, mutexTaken bool) { + log.Debug(">>> deregisterSensorStatusSubscription: subsId: ", subsIdStr) + + subsId, _ := strconv.Atoi(subsIdStr) + if !mutexTaken { + mutex.Lock() + defer mutex.Unlock() + } + log.Info("deregisterSensorStatusSubscription: Before sensorStatusSubscriptionMap", sensorStatusSubscriptionMap) + delete(sensorStatusSubscriptionMap, subsId) + log.Info("deregisterSensorStatusSubscription: After sensorStatusSubscriptionMap", sensorStatusSubscriptionMap) + + log.Info("deregisterSensorStatusSubscription: ", subsId, " type: ", SENS_STATUS) +} + +func deregisterSensorDataSubscription(subsIdStr string, mutexTaken bool) { + log.Debug(">>> deregisterSensorDataSubscription: subsId: ", subsIdStr) + + subsId, _ := strconv.Atoi(subsIdStr) + if !mutexTaken { + mutex.Lock() + defer mutex.Unlock() + } + log.Info("deregisterSensorDataSubscription: Before sensorDataSubscriptionMap", sensorDataSubscriptionMap) + delete(sensorDataSubscriptionMap, subsId) + log.Info("deregisterSensorDataSubscription: After sensorDataSubscriptionMap", sensorDataSubscriptionMap) + + log.Info("deregisterSensorDataSubscription: ", subsId, " type: ", SENS_DATA) +} + +/* + * sendTestNotification sends test notification to validate callback URI + * @param {string} notifyUrl contains the call reference address + * @param {struct} notification contains the test notification + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 6 + */ +func sendTestNotification(notifyUrl string, notification TestNotification) { + log.Debug(">>> sendTestNotification: notifyUrl: ", notifyUrl) + + startTime := time.Now() + jsonNotif, err := json.Marshal(notification) + if err != nil { + log.Error(err) + return + } + log.Info("sendTestNotification: jsonNotif: ", string(jsonNotif)) + + resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) + log.Info("sendTestNotification: resp: ", resp) + duration := float64(time.Since(startTime).Microseconds()) / 1000.0 + _ = httpLog.LogNotification(notifyUrl, "POST", "", "", string(jsonNotif), resp, startTime) + if err != nil { + log.Error(err) + met.ObserveNotification(sandboxName, serviceName, notification.NotificationType, notifyUrl, nil, duration) + return + } + met.ObserveNotification(sandboxName, serviceName, notification.NotificationType, notifyUrl, resp, duration) + defer resp.Body.Close() +} + +/* + * sendExpiryNotification send expiry notification to the the corresponding callback reference address + * @param {string} notifyUrl contains callback reference address of service consumer + * @param {struct} notification struct of type ExpiryNotification + */ +func sendExpiryNotification(notifyUrl string, notification ExpiryNotification) { + startTime := time.Now() + jsonNotif, err := json.Marshal(notification) + if err != nil { + log.Error(err.Error()) + } + + resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) + duration := float64(time.Since(startTime).Microseconds()) / 1000.0 + _ = httpLog.LogNotification(notifyUrl, "POST", "", "", string(jsonNotif), resp, startTime) + if err != nil { + log.Error(err) + met.ObserveNotification(sandboxName, serviceName, notification.NotificationType, notifyUrl, nil, duration) + return + } + met.ObserveNotification(sandboxName, serviceName, notification.NotificationType, notifyUrl, resp, duration) + defer resp.Body.Close() +} + +/* + * discoveryNotify sends notification to the call reference address + * @param {string} notifyUrl contains the call reference address + * @param {struct} notification contains notification body of type SensorDiscoveryEventNotification + * @see ETSI GS MEC 046 V3.1.1 (2024-04) Clause 7 + */ +func discoveryNotify() { + log.Debug(">>> sendTestNotification: discoveryNotify") + +} + +func statusNotify() { + log.Debug(">>> sendTestNotification: statusNotify") + +} + +func dataNotify() { + log.Debug(">>> sendTestNotification: dataNotify") + +} + +// func convertSensorDiscoveryInfoListFromSbi(s []sbi.SensorDiscoveryInfo) (sensors []SensorDiscoveryInfo) { +// sensors = make([]SensorDiscoveryInfo, len(s)) +// for i, val := range s { +// sensors[i] = convertSensorDiscoveryInfoFromSbi(val) +// } // End of 'for' statement + +// return sensors +// } + +func convertSensorDiscoveryInfoListFromSbi_with_filter(s []sbi.SensorDiscoveryInfo, filter url.Values) (sensors []SensorDiscoveryInfo) { + log.Debug(">>> convertSensorDiscoveryInfoListFromSbi_with_filter: filter: ", filter) + + sensors = make([]SensorDiscoveryInfo, 0) + for _, val := range s { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: processing val: ", val.SensorPropertyList) + if filter["type"][0] != val.SensorType { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: ", filter["type"][0], " not found, discard it") + continue // Discard it + } else { + if len(val.SensorPropertyList) != 0 { + if f, ok := filter["sensorPropertyList"]; ok { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: f: ", f) + found := 0 + for _, fu := range f { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: processing fu: ", fu) + l := strings.Split(fu, ",") + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: l: ", l) + for _, s := range l { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: processing s: ", s) + for _, v := range val.SensorPropertyList { + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: processing v: ", v) + if v == s { + found += 1 + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: matching: ", found) + break // Exit loop on sensor SensorPropertyList + } + } // End of 'for' statement + } // End of 'for' statement + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: found: ", found, " compared to ", len(l)) + if found == len(l) { // All filter iems found + sensors = append(sensors, convertSensorDiscoveryInfoFromSbi(val)) + } else { + break // Exit loop on filter list + } + } // End of 'for' statement + // FIXME FSCOM Add filtering + } else { + sensors = append(sensors, convertSensorDiscoveryInfoFromSbi(val)) + } + } else { + sensors = append(sensors, convertSensorDiscoveryInfoFromSbi(val)) + } + } + + } // End of 'for' statement + log.Debug("convertSensorDiscoveryInfoListFromSbi_with_filter: sensors: ", sensors) + + return sensors +} + +func convertSensorDiscoveryInfoFromSbi(s sbi.SensorDiscoveryInfo) (sensor SensorDiscoveryInfo) { + sensor = SensorDiscoveryInfo{ + SensorIdentifier: s.SensorIdentifier, + SensorType: s.SensorType, + } + if len(s.SensorPropertyList) != 0 { + copy(sensor.SensorPropertyList, s.SensorPropertyList) + } + if len(s.SensorCharacteristicList) != 0 { + sensor.SensorCharacteristicList = make([]SensorCharacteristic, len(s.SensorCharacteristicList)) + for i, val := range s.SensorCharacteristicList { + sensor.SensorCharacteristicList[i] = SensorCharacteristic{ + CharacteristicName: val.CharacteristicName, + CharacteristicValue: val.CharacteristicValue, + // TODO FSCOM CharacteristicUnitOfMeasure: val.CharacteristicUnitOfMeasure, + } + } // End of 'for' statement + } + if s.SensorPosition != nil { + sensor.SensorPosition = &Point{ + Latitude: s.SensorPosition.Latitude, + Longitude: s.SensorPosition.Longitude, + } + } + + return sensor +} + +func convertSensorStatusInfoFromSbi(s sbi.SensorStatusInfo) (status SensorStatusInfo) { + status = SensorStatusInfo{ + SensorIdentifier: s.SensorIdentifier, + SensorStatusType: s.SensorStatusType, + ErrorInformation: s.ErrorInformation, + } + + return status } diff --git a/go-apps/meep-sss/server/meep-sss_test.go b/go-apps/meep-sss/server/meep-sss_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7e875ba0c097c0dc59178586550ac4682b501b8b --- /dev/null +++ b/go-apps/meep-sss/server/meep-sss_test.go @@ -0,0 +1,1868 @@ +/* + * Copyright (c) 2025 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 ance "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 ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/http/httptest" + "os" + "strings" + "testing" + "time" + + log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" + // met "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metrics" + mod "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model" + mq "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq" + + "github.com/gorilla/mux" +) + +const testScenario string = ` + { + "version":"1.5.3", + "name":"test-scenario", + "deployment":{ + "netChar":{ + "latency":50, + "latencyVariation":5, + "throughputDl":1000, + "throughputUl":1000 + }, + "domains":[ + { + "id":"PUBLIC", + "name":"PUBLIC", + "type":"PUBLIC", + "netChar":{ + "latency":6, + "latencyVariation":2, + "throughputDl":1000000, + "throughputUl":1000000 + }, + "zones":[ + { + "id":"PUBLIC-COMMON", + "name":"PUBLIC-COMMON", + "type":"COMMON", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughput":1000000 + }, + "networkLocations":[ + { + "id":"PUBLIC-COMMON-DEFAULT", + "name":"PUBLIC-COMMON-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":50000, + "throughputUl":50000, + "packetLoss":1 + } + } + ] + } + ] + }, + { + "id":"4da82f2d-1f44-4945-8fe7-00c0431ef8c7", + "name":"operator-cell1", + "type":"OPERATOR-CELLULAR", + "netChar":{ + "latency":6, + "latencyVariation":2, + "throughputDl":1000, + "throughputUl":1000 + }, + "cellularDomainConfig":{ + "mnc":"456", + "mcc":"123", + "defaultCellId":"1234567" + }, + "zones":[ + { + "id":"operator-cell1-COMMON", + "name":"operator-cell1-COMMON", + "type":"COMMON", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughput":1000 + }, + "networkLocations":[ + { + "id":"operator-cell1-COMMON-DEFAULT", + "name":"operator-cell1-COMMON-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + }, + { + "id":"0836975f-a7ea-41ec-b0e0-aff43178194d", + "name":"zone1", + "type":"ZONE", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughput":1000 + }, + "networkLocations":[ + { + "id":"zone1-DEFAULT", + "name":"zone1-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "physicalLocations":[ + { + "id":"97b80da7-a74a-4649-bb61-f7fa4fbb2d76", + "name":"zone1-edge1", + "type":"EDGE", + "connected":true, + "processes":[ + { + "id":"fcf1269c-a061-448e-aa80-6dd9c2d4c548", + "name":"zone1-edge1-iperf", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/iperf-server", + "commandArguments":"-c, export; iperf -s -p $IPERF_SERVICE_PORT", + "commandExe":"/bin/bash", + "serviceConfig":{ + "name":"zone1-edge1-iperf", + "meSvcName":"iperf", + "ports":[ + { + "protocol":"UDP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + }, + { + "id":"35697e68-c627-4b8d-9cd7-ad8b8e226aee", + "name":"zone1-edge1-svc", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/demo-server", + "environment":"MGM_GROUP_NAME=svc, MGM_APP_ID=zone1-edge1-svc, MGM_APP_PORT=80", + "serviceConfig":{ + "name":"zone1-edge1-svc", + "meSvcName":"svc", + "ports":[ + { + "protocol":"TCP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ], + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + }, + { + "id":"7a6f8077-b0b3-403d-b954-3351e21afeb7", + "name":"zone1-poa-cell1", + "type":"POA-4G", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "poa4GConfig":{ + "cellId":"2345678" + }, + "geoData": { + "location": { + "type": "Point", + "coordinates": [ + 7.423547, + 43.731724 + ] + }, + "radius": 400, + "path": null, + "eopMode": null, + "velocity": null + }, + "physicalLocations":[ + { + "id":"32a2ced4-a262-49a8-8503-8489a94386a2", + "name":"ue1", + "type":"UE", + "connected":true, + "wireless":true, + "processes":[ + { + "id":"9bdd6acd-f6e4-44f6-a26c-8fd9abd338a7", + "name":"ue1-iperf", + "type":"UE-APP", + "image":"meep-docker-registry:30001/iperf-client", + "commandArguments":"-c, export; iperf -u -c $IPERF_SERVICE_HOST -p $IPERF_SERVICE_PORT\n-t 3600 -b 50M;", + "commandExe":"/bin/bash", + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ], + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + }, + { + "id":"b1851da5-c9e1-4bd8-ad23-5925c82ee127", + "name":"zone1-fog1", + "type":"FOG", + "connected":true, + "processes":[ + { + "id":"c2f2fb5d-4053-4cee-a0ee-e62bbb7751b6", + "name":"zone1-fog1-iperf", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/iperf-server", + "commandArguments":"-c, export; iperf -s -p $IPERF_SERVICE_PORT;", + "commandExe":"/bin/bash", + "serviceConfig":{ + "name":"zone1-fog1-iperf", + "meSvcName":"iperf", + "ports":[ + { + "protocol":"UDP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + }, + { + "id":"53b5806b-e213-4c5a-a181-f1c31c24287b", + "name":"zone1-fog1-svc", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/demo-server", + "environment":"MGM_GROUP_NAME=svc, MGM_APP_ID=zone1-fog1-svc, MGM_APP_PORT=80", + "serviceConfig":{ + "name":"zone1-fog1-svc", + "meSvcName":"svc", + "ports":[ + { + "protocol":"TCP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ], + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + }, + { + "id":"7ff90180-2c1a-4c11-b59a-3608c5d8d874", + "name":"zone1-poa-cell2", + "type":"POA-4G", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "poa4GConfig":{ + "cellId":"3456789" + }, + "geoData": { + "location": { + "type": "Point", + "coordinates": [ + 7.423547, + 43.731724 + ] + }, + "radius": 400, + "path": null, + "eopMode": null, + "velocity": null + } + } + ] + }, + { + "id":"d1f06b00-4454-4d35-94a5-b573888e7ea9", + "name":"zone2", + "type":"ZONE", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughput":1000 + }, + "networkLocations":[ + { + "id":"zone2-DEFAULT", + "name":"zone2-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "physicalLocations":[ + { + "id":"fb130d18-fd81-43e0-900c-c584e7190302", + "name":"zone2-edge1", + "type":"EDGE", + "connected":true, + "processes":[ + { + "id":"5c8276ba-0b78-429d-a0bf-d96f35ba2c77", + "name":"zone2-edge1-iperf", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/iperf-server", + "commandArguments":"-c, export; iperf -s -p $IPERF_SERVICE_PORT;", + "commandExe":"/bin/bash", + "serviceConfig":{ + "name":"zone2-edge1-iperf", + "meSvcName":"iperf", + "ports":[ + { + "protocol":"UDP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + }, + { + "id":"53fa28f0-80e2-414c-8841-86db9bd37d51", + "name":"zone2-edge1-svc", + "type":"EDGE-APP", + "image":"meep-docker-registry:30001/demo-server", + "environment":"MGM_GROUP_NAME=svc, MGM_APP_ID=zone2-edge1-svc, MGM_APP_PORT=80", + "serviceConfig":{ + "name":"zone2-edge1-svc", + "meSvcName":"svc", + "ports":[ + { + "protocol":"TCP", + "port":80 + } + ] + }, + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ], + "netChar":{ + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + }, + { + "id":"c44b8937-58af-44b2-acdb-e4d1c4a1510b", + "name":"zone2-poa1", + "type":"POA", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":20, + "throughputUl":20 + } + } + ] + } + ] + }, + { + "id":"e29138fb-cf03-4372-8335-fd2665b77a11", + "name":"operator1", + "type":"OPERATOR", + "netChar":{ + "latency":6, + "latencyVariation":2, + "throughputDl":1000, + "throughputUl":1000 + }, + "zones":[ + { + "id":"operator1-COMMON", + "name":"operator1-COMMON", + "type":"COMMON", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "networkLocations":[ + { + "id":"operator1-COMMON-DEFAULT", + "name":"operator1-COMMON-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + }, + { + "id":"7d8bee73-6d5c-4c5a-a3a0-49ebe3cd2c71", + "name":"zone3", + "type":"ZONE", + "netChar":{ + "latency":5, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + }, + "networkLocations":[ + { + "id":"zone3-DEFAULT", + "name":"zone3-DEFAULT", + "type":"DEFAULT", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + } + }, + { + "id":"ecc2a41b-7381-4108-a037-52862c520733", + "name":"poa1", + "type":"POA", + "netChar":{ + "latency":1, + "latencyVariation":1, + "throughputDl":1000, + "throughputUl":1000 + } + } + ] + } + ] + } + ] + } + } + ` + +const redisTestAddr = "localhost:30380" +const influxTestAddr = "http://localhost:30986" +const testScenarioName = "testScenario" + +var m *mod.Model +var mqLocal *mq.MsgQueue + +// func TestSensorDiscoveryLookupGET(t *testing.T) { +// fmt.Println("--- ", t.Name()) +// log.MeepTextLogInit(t.Name()) +// initializeVars() +// err := Init() +// if err != nil { +// t.Fatalf("Error initializing test basic procedure") +// } +// err = Run() +// if err != nil { +// t.Fatalf("Error running test basic procedure") +// } +// fmt.Println("Set a scenario") +// initialiseScenario(testScenario) +// time.Sleep(1000 * time.Millisecond) +// updateScenario("mobility1") + +// /****************************** +// * expected response section +// ******************************/ + +// /****************************** +// * request queries section +// ******************************/ +// queries := make(map[string]string) // Mandatory filter +// queries["type"] = "4" + +// /****************************** +// * request body section +// ******************************/ + +// /****************************** +// * request execution section +// ******************************/ +// rr, err := sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusOK, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Respone: rr: ", rr) +// var sensors []SensorDiscoveryInfo +// err = json.Unmarshal([]byte(rr), &sensors) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// if len(sensors) == 0 { +// t.Fatalf("SensorDiscoveryInfo list expected") +// } + +// fmt.Println("Received expected response") +// /****************************** +// * back to initial state section +// ******************************/ +// terminateScenario() +// } + +// func TestSensorDiscoveryLookupGET_with_opt_filter(t *testing.T) { +// fmt.Println("--- ", t.Name()) +// log.MeepTextLogInit(t.Name()) +// initializeVars() +// err := Init() +// if err != nil { +// t.Fatalf("Error initializing test basic procedure") +// } +// err = Run() +// if err != nil { +// t.Fatalf("Error running test basic procedure") +// } +// fmt.Println("Set a scenario") +// initialiseScenario(testScenario) +// time.Sleep(1000 * time.Millisecond) +// updateScenario("mobility1") + +// /****************************** +// * request queries section +// ******************************/ +// queries := make(map[string]string) // Mandatory filter +// queries["type"] = "4" + +// /****************************** +// * request body section +// ******************************/ + +// /****************************** +// * request execution section +// ******************************/ +// rr, err := sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusOK, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Respone: rr: ", rr) +// var ref_sensors []SensorDiscoveryInfo +// err = json.Unmarshal([]byte(rr), &ref_sensors) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// if len(ref_sensors) == 0 { +// t.Fatalf("SensorDiscoveryInfo list expected") +// } +// fmt.Println("Received expected response") + +// queries = make(map[string]string) +// queries["type"] = "4" +// queries["sensorPropertyList"] = "rn,cnf,con" +// rr, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusOK, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Respone: rr: ", rr) +// var sensors []SensorDiscoveryInfo +// err = json.Unmarshal([]byte(rr), &sensors) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// if len(sensors) != len(ref_sensors) { +// t.Fatalf("SensorDiscoveryInfo list length invalid") +// } +// fmt.Println("Received expected response") + +// queries = make(map[string]string) +// queries["type"] = "4" +// queries["sensorPropertyList"] = "john,doe" +// _, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusNotFound, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Received expected response") + +// queries = make(map[string]string) +// queries["type"] = "4" +// queries["sensorPropertyList"] = "rn,john,doe" +// _, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusNotFound, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Received expected response") + +// /****************************** +// * back to initial state section +// ******************************/ +// terminateScenario() +// } + +// func TestSensorDiscoveryLookupGET_Fail(t *testing.T) { +// fmt.Println("--- ", t.Name()) +// log.MeepTextLogInit(t.Name()) +// initializeVars() +// err := Init() +// if err != nil { +// t.Fatalf("Error initializing test basic procedure") +// } +// err = Run() +// if err != nil { +// t.Fatalf("Error running test basic procedure") +// } +// fmt.Println("Set a scenario") +// initialiseScenario(testScenario) +// time.Sleep(1000 * time.Millisecond) +// updateScenario("mobility1") + +// /****************************** +// * request queries section +// ******************************/ +// // queries := make(map[string]string) // No queries +// // queries["type"] = "4" + +// _, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, nil, nil, http.StatusBadRequest, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Received expected response") + +// queries := make(map[string]string) // No queries +// queries["type"] = "5" +// _, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusNotFound, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Received expected response") + +// /****************************** +// * back to initial state section +// ******************************/ +// terminateScenario() +// } + +// func TestSensorStatusLookupGET(t *testing.T) { +// fmt.Println("--- ", t.Name()) +// log.MeepTextLogInit(t.Name()) +// initializeVars() +// err := Init() +// if err != nil { +// t.Fatalf("Error initializing test basic procedure") +// } +// err = Run() +// if err != nil { +// t.Fatalf("Error running test basic procedure") +// } +// fmt.Println("Set a scenario") +// initialiseScenario(testScenario) +// time.Sleep(1000 * time.Millisecond) +// updateScenario("mobility1") + +// queries := make(map[string]string) // Mandatory filter +// queries["type"] = "4" +// rr, err := sendRequest(http.MethodGet, "/sens/v1/queries/sensor_discovery", nil, nil, queries, nil, http.StatusOK, SensorDiscoveryLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Respone: rr: ", rr) +// var sensors []SensorDiscoveryInfo +// err = json.Unmarshal([]byte(rr), &sensors) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// if len(sensors) == 0 { +// t.Fatalf("SensorDiscoveryInfo list expected") +// } +// fmt.Println("Received expected response") + +// queries = make(map[string]string) +// queries["sensorIdentifier"] = sensors[0].SensorIdentifier +// rr, err = sendRequest(http.MethodGet, "/sens/v1/queries/sensor_status", nil, nil, queries, nil, http.StatusOK, SensorStatusLookupGET) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// fmt.Println("Respone: rr: ", rr) +// var status SensorStatusInfo +// err = json.Unmarshal([]byte(rr), &status) +// if err != nil { +// t.Fatalf(err.Error()) +// } +// if status.SensorIdentifier != sensors[0].SensorIdentifier { +// t.Fatalf("SensorIdentifier mismatch") +// } +// fmt.Println("Received expected response") +// /****************************** +// * back to initial state section +// ******************************/ +// terminateScenario() +// } + +func TestSensorDiscoveryEventSubscriptionPOST_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + /****************************** + * expected response section + ******************************/ + subscriptionType := SENSOR_DISCOVERY_EVENT_SUBSCRIPTION + var expected = SensorDiscoveryEventSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + jsonInfo, err := json.Marshal(&expected) + if err != nil { + t.Fatalf(err.Error()) + } + expected_response := string(jsonInfo) + fmt.Println("expected_response: ", expected_response) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + var sensorDiscoveryEventSubscription = SensorDiscoveryEventSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_discovery", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorDiscoverySubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SensorDiscoveryEventSubscription + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + if !validateSensorDiscoveryEventSubscription(expected, resp) { + t.Fatalf("handler returned unexpected body: got %v want %v", rr, expected_response) + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorDiscoveryEventSubscription(resp) + terminateScenario() +} + +func TestSensorDiscoveryEventSubscriptionPOST_Fail(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + /****************************** + * expected response section + ******************************/ + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + var sensorDiscoveryEventSubscription = SensorDiscoveryEventSubscription{ + // SubscriptionType: &subscriptionType, // No subscription type + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + _, err = sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_discovery", bytes.NewBuffer(body), nil, nil, nil, http.StatusBadRequest, SensorDiscoverySubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Received expected response") + + /****************************** + * request body section + ******************************/ + subscriptionType := SENSOR_DISCOVERY_EVENT_SUBSCRIPTION + sensorDiscoveryEventSubscription = SensorDiscoveryEventSubscription{ + SubscriptionType: &subscriptionType, + //CallbackReference: "http://test.org", // No callback + } + body, err = json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + _, err = sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_discovery", bytes.NewBuffer(body), nil, nil, nil, http.StatusBadRequest, SensorDiscoverySubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Received expected response") + + /****************************** + * request body section + ******************************/ + sensorDiscoveryEventSubscription = SensorDiscoveryEventSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", // callback + WebsockNotifConfig: &WebsockNotifConfig{ // And WebsockNotifConfig + WebsocketUri: "ws://test.org", + RequestWebsocketUri: true, + }, + } + body, err = json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + _, err = sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_discovery", bytes.NewBuffer(body), nil, nil, nil, http.StatusInternalServerError, SensorDiscoverySubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Received expected response") + + /****************************** + * back to initial state section + ******************************/ + terminateScenario() +} + +func TestSensorDiscoveryEventSubscriptionGET_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + sensorDiscoveryEventSubscription, err := createSensorDiscoveryEventSubscription_no_query() + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("sensorDiscoveryEventSubscription: ", sensorDiscoveryEventSubscription) + + /****************************** + * expected response section + ******************************/ + var expected = SubscriptionLinkList{ + Links: &SubscriptionLinkListLinks{ + Self: &LinkType{ + Href: "http://localhost/testScenario/sens/v1/subscriptions", + }, + }, + } + expected.Links.Subscriptions = append(expected.Links.Subscriptions, SubscriptionLinkListSubscription{Href: "http://localhost/testScenario/sens/v1/subscriptions/2", SubscriptionType: "SensorDiscoveryEventSubscription"}) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodGet, "/sens/v1/subscriptions/sensor_discovery", nil, nil, nil, nil, http.StatusOK, SensorDiscoverySubscriptionGET) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SubscriptionLinkList + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("resp", resp) + if !validateSubscriptionLinkList(expected, resp) { + t.Fatalf("SubscriptionLinkList mismatch") + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorDiscoveryEventSubscription(sensorDiscoveryEventSubscription) + terminateScenario() +} + +func TestSensorDiscoveryEventSubscriptionDELETE(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + sensorDiscoveryEventSubscription, err := createSensorDiscoveryEventSubscription_no_query() + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("sensorDiscoveryEventSubscription: ", sensorDiscoveryEventSubscription) + selfUrl := strings.Split(sensorDiscoveryEventSubscription.Links.Self.Href, "/") + subscriptionId := selfUrl[len(selfUrl)-1] + fmt.Println("subscriptionId = ", subscriptionId) + + /****************************** + * expected response section + ******************************/ + + /****************************** + * request vars section + ******************************/ + vars := make(map[string]string) + vars["subscriptionId"] = subscriptionId + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + + /****************************** + * request execution section + ******************************/ + _, err = sendRequest(http.MethodDelete, "/sens/v1/subscriptions/sensor_discovery", nil, vars, nil, nil, http.StatusNoContent, SensorDiscoverySubscriptionDELETE) + if err != nil { + t.Fatalf(err.Error()) + } + + fmt.Println("Received expected response") + + _, err = sendRequest(http.MethodGet, "/sens/v1/subscriptions/sensor_discovery", nil, vars, nil, nil, http.StatusNotFound, SensorDiscoveryIndividualSubscriptionGET) + if err != nil { + t.Fatalf(err.Error()) + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + terminateScenario() +} + +func TestSensorDiscoveryEventSubscriptionByIdGET_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + /****************************** + * expected response section + ******************************/ + expected, err := createSensorDiscoveryEventSubscription_no_query() + if err != nil { + t.Fatalf(err.Error()) + } + jsonInfo, err := json.Marshal(&expected) + if err != nil { + t.Fatalf(err.Error()) + } + expected_response := string(jsonInfo) + fmt.Println("expected_response: ", expected_response) + selfUrl := strings.Split(expected.Links.Self.Href, "/") + subscriptionId := selfUrl[len(selfUrl)-1] + fmt.Println("subscriptionId = ", subscriptionId) + + /****************************** + * request vars section + ******************************/ + vars := make(map[string]string) + vars["subscriptionId"] = subscriptionId + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodGet, "/sens/v1/subscriptions/sensor_discovery", nil, vars, nil, nil, http.StatusOK, SensorDiscoveryIndividualSubscriptionGET) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SensorDiscoveryEventSubscription + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + if !validateSensorDiscoveryEventSubscription(expected, resp) { + t.Fatalf("handler returned unexpected body: got %v want %v", rr, expected_response) + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorDiscoveryEventSubscription(expected /*resp*/) + terminateScenario() +} + +func createSensorDiscoveryEventSubscription_no_query() (sensorDiscoveryEventSubscription SensorDiscoveryEventSubscription, err error) { + subscriptionType := SENSOR_DISCOVERY_EVENT_SUBSCRIPTION + sensorDiscoveryEventSubscription = SensorDiscoveryEventSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorDiscoveryEventSubscription) + if err != nil { + return sensorDiscoveryEventSubscription, err + } + + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_discovery", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorDiscoverySubscriptionPOST) + if err != nil { + return sensorDiscoveryEventSubscription, err + } + err = json.Unmarshal([]byte(rr), &sensorDiscoveryEventSubscription) + if err != nil { + return sensorDiscoveryEventSubscription, err + } + + return sensorDiscoveryEventSubscription, nil +} + +func deleteSensorDiscoveryEventSubscription(sensorDiscoveryEventSubscription SensorDiscoveryEventSubscription) (err error) { + + selfUrl := strings.Split(sensorDiscoveryEventSubscription.Links.Self.Href, "/") + subscriptionId := selfUrl[len(selfUrl)-1] + fmt.Println("subscriptionId = ", subscriptionId) + + vars := make(map[string]string) + vars["subscriptionId"] = subscriptionId + + _, err = sendRequest(http.MethodDelete, "/sens/v1/subscriptions/sensor_discovery", nil, vars, nil, nil, http.StatusNoContent, SensorDiscoverySubscriptionDELETE) + if err != nil { + return err + } + + return nil +} + +func validateSensorDiscoveryEventSubscription(expected SensorDiscoveryEventSubscription, resp SensorDiscoveryEventSubscription) bool { + fmt.Println(">>> validateSensorDiscoveryEventSubscription: expected: ", expected) + fmt.Println(">>> validateSensorDiscoveryEventSubscription: resp: ", resp) + + if *expected.SubscriptionType != *resp.SubscriptionType { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.CallbackReference != resp.CallbackReference { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.RequestTestNotification != resp.RequestTestNotification { + fmt.Println("expected.RequestTestNotification != resp.RequestTestNotification") + return false + } + + return true +} + +func TestSensorStatusSubscriptionPOST_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + /****************************** + * expected response section + ******************************/ + subscriptionType := SENSOR_STATUS_SUBSCRIPTION + var expected = SensorStatusSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + jsonInfo, err := json.Marshal(&expected) + if err != nil { + t.Fatalf(err.Error()) + } + expected_response := string(jsonInfo) + fmt.Println("expected_response: ", expected_response) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + var sensorStatusSubscription = SensorStatusSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorStatusSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_status", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorStatusSubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SensorStatusSubscription + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + if !validateSensorStatusSubscription(expected, resp) { + t.Fatalf("handler returned unexpected body: got %v want %v", rr, expected_response) + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorStatusSubscription(resp) + terminateScenario() +} + +func TestSensorStatusSubscriptionGET_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + sensorStatusSubscription, err := createSensorStatusSubscription_no_query() + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("sensorStatusSubscription: ", sensorStatusSubscription) + + /****************************** + * expected response section + ******************************/ + var expected = SubscriptionLinkList{ + Links: &SubscriptionLinkListLinks{ + Self: &LinkType{ + Href: "http://localhost/testScenario/sens/v1/subscriptions", + }, + }, + } + expected.Links.Subscriptions = append(expected.Links.Subscriptions, SubscriptionLinkListSubscription{Href: "http://localhost/testScenario/sens/v1/subscriptions/6", SubscriptionType: "SensorStatusSubscription"}) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodGet, "/sens/v1/subscriptions/sensor_status", nil, nil, nil, nil, http.StatusOK, SensorStatusSubscriptionGET) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SubscriptionLinkList + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("resp", resp) + if !validateSubscriptionLinkList(expected, resp) { + t.Fatalf("SubscriptionLinkList mismatch") + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorStatusSubscription(sensorStatusSubscription) + terminateScenario() +} + +func createSensorStatusSubscription_no_query() (sensorStatusSubscription SensorStatusSubscription, err error) { + subscriptionType := SENSOR_STATUS_SUBSCRIPTION + sensorStatusSubscription = SensorStatusSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorStatusSubscription) + if err != nil { + return sensorStatusSubscription, err + } + + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_status", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorStatusSubscriptionPOST) + if err != nil { + return sensorStatusSubscription, err + } + err = json.Unmarshal([]byte(rr), &sensorStatusSubscription) + if err != nil { + return sensorStatusSubscription, err + } + + return sensorStatusSubscription, nil +} + +func deleteSensorStatusSubscription(sensorStatusSubscription SensorStatusSubscription) (err error) { + + selfUrl := strings.Split(sensorStatusSubscription.Links.Self.Href, "/") + subscriptionId := selfUrl[len(selfUrl)-1] + fmt.Println("subscriptionId = ", subscriptionId) + + vars := make(map[string]string) + vars["subscriptionId"] = subscriptionId + + _, err = sendRequest(http.MethodDelete, "/sens/v1/subscriptions/sensor_status", nil, vars, nil, nil, http.StatusNoContent, SensorDiscoverySubscriptionDELETE) + if err != nil { + return err + } + + return nil +} + +func validateSensorStatusSubscription(expected SensorStatusSubscription, resp SensorStatusSubscription) bool { + fmt.Println(">>> validateSensorStatusSubscription: expected: ", expected) + fmt.Println(">>> validateSensorStatusSubscription: resp: ", resp) + + if *expected.SubscriptionType != *resp.SubscriptionType { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.CallbackReference != resp.CallbackReference { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.RequestTestNotification != resp.RequestTestNotification { + fmt.Println("expected.RequestTestNotification != resp.RequestTestNotification") + return false + } + + return true +} + +func TestSensorDataSubscriptionPOST_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + /****************************** + * expected response section + ******************************/ + subscriptionType := SENSOR_STATUS_SUBSCRIPTION + var expected = SensorDataSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + jsonInfo, err := json.Marshal(&expected) + if err != nil { + t.Fatalf(err.Error()) + } + expected_response := string(jsonInfo) + fmt.Println("expected_response: ", expected_response) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + var sensorDataSubscription = SensorDataSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorDataSubscription) + if err != nil { + t.Fatalf(err.Error()) + } + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_data", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorDataSubscriptionPOST) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SensorDataSubscription + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + if !validateSensorDataSubscription(expected, resp) { + t.Fatalf("handler returned unexpected body: got %v want %v", rr, expected_response) + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorDataSubscription(resp) + terminateScenario() +} + +func TestSensorDataSubscriptionGET_no_query(t *testing.T) { + fmt.Println("--- ", t.Name()) + log.MeepTextLogInit(t.Name()) + initializeVars() + err := Init() + if err != nil { + t.Fatalf("Error initializing test basic procedure") + } + err = Run() + if err != nil { + t.Fatalf("Error running test basic procedure") + } + fmt.Println("Set a scenario") + initialiseScenario(testScenario) + time.Sleep(1000 * time.Millisecond) + updateScenario("mobility1") + + sensorDataSubscription, err := createSensorDataSubscription_no_query() + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("sensorDataSubscription: ", sensorDataSubscription) + + /****************************** + * expected response section + ******************************/ + var expected = SubscriptionLinkList{ + Links: &SubscriptionLinkListLinks{ + Self: &LinkType{ + Href: "http://localhost/testScenario/sens/v1/subscriptions", + }, + }, + } + expected.Links.Subscriptions = append(expected.Links.Subscriptions, SubscriptionLinkListSubscription{Href: "http://localhost/testScenario/sens/v1/subscriptions/8", SubscriptionType: "SensorDataSubscription"}) + + /****************************** + * request vars section + ******************************/ + //vars := make(map[string]string) + //vars["subscriptionId"] = subscription_id + + /****************************** + * request queries section + ******************************/ + //queries := make(map[string]string) + //queries["sensorIdentifier"] = "4,5,6" + + /****************************** + * request body section + ******************************/ + + /****************************** + * request execution section + ******************************/ + rr, err := sendRequest(http.MethodGet, "/sens/v1/subscriptions/sensor_data", nil, nil, nil, nil, http.StatusOK, SensorDataSubscriptionGET) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("Respone: rr: ", rr) + var resp SubscriptionLinkList + err = json.Unmarshal([]byte(rr), &resp) + if err != nil { + t.Fatalf(err.Error()) + } + fmt.Println("resp", resp) + if !validateSubscriptionLinkList(expected, resp) { + t.Fatalf("SubscriptionLinkList mismatch") + } + + fmt.Println("Received expected response") + /****************************** + * back to initial state section + ******************************/ + _ = deleteSensorDataSubscription(sensorDataSubscription) + terminateScenario() +} + +func createSensorDataSubscription_no_query() (sensorDataSubscription SensorDataSubscription, err error) { + subscriptionType := SENSOR_DATA_SUBSCRIPTION + sensorDataSubscription = SensorDataSubscription{ + SubscriptionType: &subscriptionType, + CallbackReference: "http://test.org", + } + body, err := json.Marshal(sensorDataSubscription) + if err != nil { + return sensorDataSubscription, err + } + + rr, err := sendRequest(http.MethodPost, "/sens/v1/subscriptions/sensor_data", bytes.NewBuffer(body), nil, nil, nil, http.StatusCreated, SensorDataSubscriptionPOST) + if err != nil { + return sensorDataSubscription, err + } + err = json.Unmarshal([]byte(rr), &sensorDataSubscription) + if err != nil { + return sensorDataSubscription, err + } + + return sensorDataSubscription, nil +} + +func deleteSensorDataSubscription(sensorDataSubscription SensorDataSubscription) (err error) { + + selfUrl := strings.Split(sensorDataSubscription.Links.Self.Href, "/") + subscriptionId := selfUrl[len(selfUrl)-1] + fmt.Println("subscriptionId = ", subscriptionId) + + vars := make(map[string]string) + vars["subscriptionId"] = subscriptionId + + _, err = sendRequest(http.MethodDelete, "/sens/v1/subscriptions/sensor_data", nil, vars, nil, nil, http.StatusNoContent, SensorDiscoverySubscriptionDELETE) + if err != nil { + return err + } + + return nil +} + +func validateSensorDataSubscription(expected SensorDataSubscription, resp SensorDataSubscription) bool { + fmt.Println(">>> validateSensorDataSubscription: expected: ", expected) + fmt.Println(">>> validateSensorDataSubscription: resp: ", resp) + + if *expected.SubscriptionType != *resp.SubscriptionType { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.CallbackReference != resp.CallbackReference { + fmt.Println("expected.SubscriptionType != resp.SubscriptionType") + return false + } + if expected.RequestTestNotification != resp.RequestTestNotification { + fmt.Println("expected.RequestTestNotification != resp.RequestTestNotification") + return false + } + + return true +} + +func validateSubscriptionLinkList(expected SubscriptionLinkList, resp SubscriptionLinkList) bool { + fmt.Println(">>> validateSubscriptionLinkList: expected: ", expected) + fmt.Println(">>> validateSubscriptionLinkList: resp: ", resp) + + if expected.Links.Self.Href != resp.Links.Self.Href { + fmt.Println("expected.Links.Self.Href != resp.Links.Self.Href") + return false + } + if len(expected.Links.Subscriptions) != len(resp.Links.Subscriptions) { + fmt.Println("expected.Links.Subscriptions length mismatch") + fmt.Println("len(expected.Links.Subscriptions): ", len(expected.Links.Subscriptions)) + fmt.Println("len(resp.Links.Subscriptions: ", len(resp.Links.Subscriptions)) + return false + } else { + for i, sub := range expected.Links.Subscriptions { + if sub.Href != resp.Links.Subscriptions[i].Href { + fmt.Println("sub.Href != resp.Links.Subscriptions[i].Href") + return false + } + if sub.SubscriptionType != resp.Links.Subscriptions[i].SubscriptionType { + fmt.Println("sub.SubscriptionType != resp.Links.Subscriptions[i].SubscriptionType") + fmt.Println("Index: ", i) + fmt.Println("sub.SubscriptionType: ", sub.SubscriptionType) + fmt.Println("resp.Links.Subscriptions[i].SubscriptionType: ", resp.Links.Subscriptions[i].SubscriptionType) + return false + } + } + } + + return true +} + +func initializeVars() { + mod.DbAddress = redisTestAddr + redisAddr = redisTestAddr + influxAddr = influxTestAddr + sandboxName = testScenarioName + os.Setenv("MEEP_PREDICT_MODEL_SUPPORTED", "true") + os.Setenv("MEEP_SANDBOX_NAME", testScenarioName) + os.Setenv("MEEP_PUBLIC_URL", "http://localhost") +} + +func initialiseScenario(testScenario string) { + + //clear DB + cleanUp() + + cfg := mod.ModelCfg{ + Name: testScenarioName, + Namespace: sandboxName, + Module: "test-mod", + UpdateCb: nil, + DbAddr: redisAddr, + } + var err error + m, err = mod.NewModel(cfg) + if err != nil { + log.Error("Failed to create model: ", err) + return + } + fmt.Println("initialiseScenario: model created") + + // Create message queue + mqLocal, err = mq.NewMsgQueue(mq.GetLocalName(testScenarioName), "test-mod", testScenarioName, redisAddr) + if err != nil { + log.Error("Failed to create Message Queue with error: ", err) + return + } + fmt.Println("Message Queue created") + + fmt.Println("Set Model") + err = m.SetScenario([]byte(testScenario)) + if err != nil { + log.Error("Failed to set model: ", err) + return + } + + err = m.Activate() + if err != nil { + log.Error("Failed to activate scenario with err: ", err.Error()) + return + } + + msg := mqLocal.CreateMsg(mq.MsgScenarioActivate, mq.TargetAll, testScenarioName) + err = mqLocal.SendMsg(msg) + if err != nil { + log.Error("Failed to send message: ", err) + return + } + + time.Sleep(100 * time.Millisecond) + +} + +func updateScenario(testUpdate string) { + + switch testUpdate { + case "mobility1": + // mobility event of ue1 to zone2-poa1 + elemName := "ue1" + destName := "zone2-poa1" + + _, _, err := m.MoveNode(elemName, destName, nil) + if err != nil { + log.Error("Error sending mobility event") + } + + msg := mqLocal.CreateMsg(mq.MsgScenarioUpdate, mq.TargetAll, testScenarioName) + err = mqLocal.SendMsg(msg) + if err != nil { + log.Error("Failed to send message: ", err) + } + case "mobility2": + // mobility event of ue1 to zone2-poa1 + elemName := "ue1" + destName := "zone1-poa-cell1" + + _, _, err := m.MoveNode(elemName, destName, nil) + if err != nil { + log.Error("Error sending mobility event") + } + + msg := mqLocal.CreateMsg(mq.MsgScenarioUpdate, mq.TargetAll, testScenarioName) + err = mqLocal.SendMsg(msg) + if err != nil { + log.Error("Failed to send message: ", err) + } + case "mobility3": + // mobility event of ue1 to zone1-poa-cell2 + elemName := "ue1" + destName := "zone1-poa-cell2" + + _, _, err := m.MoveNode(elemName, destName, nil) + if err != nil { + log.Error("Error sending mobility event") + } + + msg := mqLocal.CreateMsg(mq.MsgScenarioUpdate, mq.TargetAll, testScenarioName) + err = mqLocal.SendMsg(msg) + if err != nil { + log.Error("Failed to send message: ", err) + } + default: + } + time.Sleep(100 * time.Millisecond) +} + +func terminateScenario() { + if mqLocal != nil { + _ = Stop() + msg := mqLocal.CreateMsg(mq.MsgScenarioTerminate, mq.TargetAll, testScenarioName) + err := mqLocal.SendMsg(msg) + if err != nil { + log.Error("Failed to send message: ", err) + } + time.Sleep(100 * time.Millisecond) + } +} + +func sendRequest(method string, url string, body io.Reader, vars map[string]string, query map[string]string, location *string, code int, f http.HandlerFunc) (string, error) { + req, err := http.NewRequest(method, url, body) + if err != nil || req == nil { + return "", err + } + if vars != nil { + req = mux.SetURLVars(req, vars) + } + if query != nil { + q := req.URL.Query() + for k, v := range query { + q.Add(k, v) + } + req.URL.RawQuery = q.Encode() + } + // We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response. + rr := httptest.NewRecorder() + handler := http.HandlerFunc(f) + + // Our handlers satisfy http.Handler, so we can call their ServeHTTP method + // directly and pass in our Request and ResponseRecorder. + handler.ServeHTTP(rr, req) + + time.Sleep(50 * time.Millisecond) + + // Check the status code is what we expect. + if status := rr.Code; status != code { + s := fmt.Sprintf("Wrong status code - got %v want %v", status, code) + return "", errors.New(s) + } + + // Set Location header in case of POST + if location != nil { + s := rr.Header().Get("Location") + if rr == nil { + return "", fmt.Errorf("Header Location expected") + } else if !strings.Contains(s, *location) { + s := fmt.Sprintf("Wrong Header Location - got %s want %s", s, *location) + return "", errors.New(s) + } + } + + return string(rr.Body.String()), nil +} diff --git a/go-apps/meep-sss/server/model_expiry_notification.go b/go-apps/meep-sss/server/model_expiry_notification.go new file mode 100644 index 0000000000000000000000000000000000000000..d9bcbff72c94e110107570d4d6493bc97d10d958 --- /dev/null +++ b/go-apps/meep-sss/server/model_expiry_notification.go @@ -0,0 +1,32 @@ +/* + * 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. + * + * AdvantEDGE WLAN Access Information API + * + * WLAN Access Information Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC028 WAI API](http://www.etsi.org/deliver/etsi_gs/MEC/001_099/028/02.02.01_60/gs_MEC028v020201p.pdf)

[Copyright (c) ETSI 2020](https://forge.etsi.org/etsi-forge-copyright-notice.txt)

**Micro-service**
[meep-wais](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-wais)

**Type & Usage**
Edge Service used by edge applications that want to get information about WLAN access information in the network

**Note**
AdvantEDGE supports a selected subset of WAI API subscription types.

Supported subscriptions:

- AssocStaSubscription

- StaDataRateSubscription + * + * API version: 3.2.2 + * Contact: AdvantEDGE@InterDigital.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package server + +type ExpiryNotification struct { + Links *ExpiryNotificationLinks `json:"_links"` + + ExpiryDeadline *TimeStamp `json:"expiryDeadline"` + // Shall be set to \"ExpiryNotification\". + NotificationType string `json:"notificationType"` +} diff --git a/go-apps/meep-sss/server/model_expiry_notification__links.go b/go-apps/meep-sss/server/model_expiry_notification__links.go new file mode 100644 index 0000000000000000000000000000000000000000..81fd074ecdc5a80749f3f870eee1531175baea5b --- /dev/null +++ b/go-apps/meep-sss/server/model_expiry_notification__links.go @@ -0,0 +1,29 @@ +/* + * 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. + * + * AdvantEDGE WLAN Access Information API + * + * WLAN Access Information Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC028 WAI API](http://www.etsi.org/deliver/etsi_gs/MEC/001_099/028/02.02.01_60/gs_MEC028v020201p.pdf)

[Copyright (c) ETSI 2020](https://forge.etsi.org/etsi-forge-copyright-notice.txt)

**Micro-service**
[meep-wais](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-wais)

**Type & Usage**
Edge Service used by edge applications that want to get information about WLAN access information in the network

**Note**
AdvantEDGE supports a selected subset of WAI API subscription types.

Supported subscriptions:

- AssocStaSubscription

- StaDataRateSubscription + * + * API version: 3.2.2 + * Contact: AdvantEDGE@InterDigital.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package server + +// Hyperlink related to the resource. +type ExpiryNotificationLinks struct { + Subscription *LinkType `json:"subscription"` +} diff --git a/go-apps/meep-sss/server/model_test_notification.go b/go-apps/meep-sss/server/model_test_notification.go new file mode 100644 index 0000000000000000000000000000000000000000..c38a63a1519d5b9e57a09f3b66769156942b5bdc --- /dev/null +++ b/go-apps/meep-sss/server/model_test_notification.go @@ -0,0 +1,30 @@ +/* + * 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 V2X Information Service REST API + * + * V2X Information Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC030 V2XI API](.https://www.etsi.org/deliver/etsi_gs/MEC/001_099/030/03.02.01_60/etsi.org/etsi-forge-copyright-notice.txt)

**Micro-service**
[meep-vis](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-vis)

**Type & Usage**
Edge Service used by edge applications that want to get information about radio conditions in the network

**Note**
AdvantEDGE supports a selected subset of VIS API endpoints (see below) and a subset of subscription types. + * + * API version: 3.2.2 + * Contact: cti_support@etsi.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package server + +type TestNotification struct { + Links *TestNotificationLinks `json:"_links"` + // Shall be set to \"TestNotification\". + NotificationType string `json:"notificationType"` +} diff --git a/go-apps/meep-sss/server/model_test_notification__links.go b/go-apps/meep-sss/server/model_test_notification__links.go new file mode 100644 index 0000000000000000000000000000000000000000..6300eeac2bc3933c390a39b8734a918711fc4818 --- /dev/null +++ b/go-apps/meep-sss/server/model_test_notification__links.go @@ -0,0 +1,29 @@ +/* + * 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 V2X Information Service REST API + * + * V2X Information Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC030 V2XI API](.https://www.etsi.org/deliver/etsi_gs/MEC/001_099/030/03.02.01_60/yright (c) ETSI 2024](https://forge.etsi.org/etsi-forge-copyright-notice.txt)

**Micro-service**
[meep-vis](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-vis)

**Type & Usage**
Edge Service used by edge applications that want to get information about radio conditions in the network

**Note**
AdvantEDGE supports a selected subset of VIS API endpoints (see below) and a subset of subscription types. + * + * API version: 3.2.2 + * Contact: cti_support@etsi.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package server + +// Hyperlink related to the resource. +type TestNotificationLinks struct { + Subscription *LinkType `json:"subscription"` +} diff --git a/go-apps/meep-sss/server/out.txt b/go-apps/meep-sss/server/out.txt new file mode 100644 index 0000000000000000000000000000000000000000..b17e814afeaae9c90a114591c211e6a9f43e1ce8 --- /dev/null +++ b/go-apps/meep-sss/server/out.txt @@ -0,0 +1,993 @@ +=== RUN TestSensorDiscoveryEventSubscriptionPOST_no_query +--- TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.939+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:32.94+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.94+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.94+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:32.94+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.94+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.94+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:32.941+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Message Queue created" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:32.941+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="model.go:161" +time="2025-02-25T14:00:32.941+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.941+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:32.942+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.942+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:32.942+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.942+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:32.943+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.943+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.943+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.943+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:32.943+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.943+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.945+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.945+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.945+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.945+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:32.945+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.045+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.045+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:33.045+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +Set a scenario +time="2025-02-25T14:00:33.045+01:00" level=info msg="Terminate all" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.045+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:33.045+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:33.045+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.045+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:33.046+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.046+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.046+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:33.046+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.046+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:33.046+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.046+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:33.046+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:33.047+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:33.047+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:34.147+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:34.148+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:34.148+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +expected_response: {"subscriptionType":"SensorDiscoveryEventSubscription","callbackReference":"http://test.org"} +time="2025-02-25T14:00:34.248+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 93 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:688" +time="2025-02-25T14:00:34.248+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:34.248+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false http://test.org }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: subId: 0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:1095" +time="2025-02-25T14:00:34.248+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: currentSensorDiscoveryEventSubscription: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:1096" +time="2025-02-25T14:00:34.248+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc0003318c0 http://test.org false [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:1097" +time="2025-02-25T14:00:34.248+01:00" level=info msg="registerSensorDiscoveryEventSubscription: subsId: 0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="registerSensorDiscoveryEventSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="registerSensorDiscoveryEventSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="New registration: 0 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="processSensorDiscoveryEventSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="processSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc0003318c0 http://test.org false 0xc0002903f0 [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.248+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/0\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +Respone: rr: {"subscriptionType":"SensorDiscoveryEventSubscription","callbackReference":"http://test.org","_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions/0"}}} +>>> validateSensorDiscoveryEventSubscription: expected: {0xc000331250 http://test.org false [] [] } +>>> validateSensorDiscoveryEventSubscription: resp: {0xc000331e40 http://test.org false 0xc0002903f8 [] [] } +Received expected response +subscriptionId = 0 +time="2025-02-25T14:00:34.299+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0003b8fc0}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:34.299+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="subsIdStr: 0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=debug msg=">>> delSubscription: 0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:34.299+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=debug msg=">>> deregisterSensorDiscoveryEventSubscription: subsId: 0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="meep-sss.go:1655" +time="2025-02-25T14:00:34.299+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: Before sensorDiscoveryEventSubscriptionMapmap[0:0xc00038f960]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: After sensorDiscoveryEventSubscriptionMapmap[]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.299+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: 0 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query +time="2025-02-25T14:00:34.349+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDiscoveryEventSubscriptionPOST_no_query (1.51s) +=== RUN TestSensorDiscoveryEventSubscriptionPOST_Fail +--- TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.45+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.451+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:93" +time="2025-02-25T14:00:34.451+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.451+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Message Queue created" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.451+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="model.go:161" +time="2025-02-25T14:00:34.451+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.451+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:34.452+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.452+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:553" +time="2025-02-25T14:00:34.452+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.452+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.452+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.452+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.452+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.452+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="metric-store.go:120" +time="2025-02-25T14:00:34.453+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.453+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.454+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.454+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.454+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.454+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.454+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.554+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.554+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:34.554+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +Set a scenario +time="2025-02-25T14:00:34.554+01:00" level=info msg="Terminate all" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.554+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:93" +time="2025-02-25T14:00:34.554+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:553" +time="2025-02-25T14:00:34.554+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.554+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.555+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.555+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.555+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:34.555+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.555+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="db.go:69" +time="2025-02-25T14:00:34.555+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.555+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:34.555+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +Message Queue created +Set Model +time="2025-02-25T14:00:34.556+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:34.556+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:35.656+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="model.go:1393" +time="2025-02-25T14:00:35.657+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:35.657+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:35.757+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":null,\"callbackReference\":\"http://test.org\"}} 0x709a20 63 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:688" +time="2025-02-25T14:00:35.757+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:730" +time="2025-02-25T14:00:35.757+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":null,\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.757+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { false http://test.org }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.757+01:00" level=error msg="Mandatory SubscriptionType parameter should be present" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:749" +Received expected response +time="2025-02-25T14:00:35.807+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\"}} 0x709a20 55 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:688" +time="2025-02-25T14:00:35.807+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:730" +time="2025-02-25T14:00:35.807+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\"}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.807+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.807+01:00" level=error msg="At least one of CallbackReference and WebsockNotifConfig parameters should be present" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:761" +Received expected response +time="2025-02-25T14:00:35.858+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"websockNotifConfig\":{\"websocketUri\":\"ws://test.org\",\"requestWebsocketUri\":true}}} 0x709a20 174 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:688" +time="2025-02-25T14:00:35.858+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:730" +time="2025-02-25T14:00:35.858+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"websockNotifConfig\":{\"websocketUri\":\"ws://test.org\",\"requestWebsocketUri\":true}}" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.858+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false http://test.org 0xc000416f00 }" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail +time="2025-02-25T14:00:35.858+01:00" level=error msg="WebsockNotifConfig not supported" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:1061" +time="2025-02-25T14:00:35.858+01:00" level=error msg="WebsockNotifConfig not supported" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="meep-sss.go:787" +Received expected response +time="2025-02-25T14:00:35.908+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDiscoveryEventSubscriptionPOST_Fail meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDiscoveryEventSubscriptionPOST_Fail (1.56s) +=== RUN TestSensorDiscoveryEventSubscriptionGET_no_query +--- TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.009+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:36.009+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.009+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.01+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Message Queue created" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.01+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="model.go:161" +time="2025-02-25T14:00:36.01+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.01+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:36.011+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.011+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:36.011+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.011+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.011+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.011+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.011+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.011+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:36.012+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.012+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.013+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.013+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.013+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.013+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.014+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.114+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.114+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:36.114+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +Set a scenario +time="2025-02-25T14:00:36.114+01:00" level=info msg="Terminate all" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.114+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:36.115+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:36.115+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.115+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:36.115+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:36.115+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:36.115+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:36.116+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:36.116+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:37.216+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:37.218+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:37.218+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:37.318+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 93 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:688" +time="2025-02-25T14:00:37.318+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:37.318+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false http://test.org }" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: subId: 2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1095" +time="2025-02-25T14:00:37.318+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: currentSensorDiscoveryEventSubscription: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1096" +time="2025-02-25T14:00:37.318+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc000476650 http://test.org false [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1097" +time="2025-02-25T14:00:37.318+01:00" level=info msg="registerSensorDiscoveryEventSubscription: subsId: 2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="registerSensorDiscoveryEventSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="registerSensorDiscoveryEventSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="New registration: 2 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="processSensorDiscoveryEventSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="processSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc000476650 http://test.org false 0xc000290010 [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.318+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/2\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +sensorDiscoveryEventSubscription: {0xc000476110 http://test.org false 0xc000290018 [] [] } +time="2025-02-25T14:00:37.368+01:00" level=debug msg=">>> sensorDiscoverySubscriptionGET: &{GET /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:671" +time="2025-02-25T14:00:37.368+01:00" level=debug msg=">>> subscriptionsGET: &{GET /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:842" +time="2025-02-25T14:00:37.369+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.369+01:00" level=debug msg="subscriptionsGET: sensorIdentifier: " meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:851" +time="2025-02-25T14:00:37.369+01:00" level=debug msg="subscriptionsGET: sensorIdentifiers: []" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:853" +time="2025-02-25T14:00:37.369+01:00" level=debug msg=">>> createSubscriptionLinkList: subType: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1469" +time="2025-02-25T14:00:37.369+01:00" level=debug msg=">>> createSubscriptionLinkList: sensorIdentifiers: []" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1470" +time="2025-02-25T14:00:37.369+01:00" level=debug msg="createSubscriptionLinkList: sensorDiscoveryEventSubscriptionMap: map[2:0xc000470540]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1472" +time="2025-02-25T14:00:37.369+01:00" level=debug msg="createSubscriptionLinkList: sensorStatusSubscriptionMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1473" +time="2025-02-25T14:00:37.369+01:00" level=debug msg="createSubscriptionLinkList: sensorDataSubscriptionMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1474" +time="2025-02-25T14:00:37.369+01:00" level=debug msg="createSubscriptionLinkList: links.Subscriptions: [{http://localhost/testScenario/sens/v1/subscriptions/2 SensorDiscoveryEventSubscription}]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1541" +Respone: rr: {"_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions"},"subscriptions":[{"href":"http://localhost/testScenario/sens/v1/subscriptions/2","subscriptionType":"SensorDiscoveryEventSubscription"}]}} +resp {0xc000416de0} +>>> validateSubscriptionLinkList: expected: {0xc000416620} +>>> validateSubscriptionLinkList: resp: {0xc000416de0} +Received expected response +subscriptionId = 2 +time="2025-02-25T14:00:37.419+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc000473530}" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:37.419+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="subsIdStr: 2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=debug msg=">>> delSubscription: 2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:37.419+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=debug msg=">>> deregisterSensorDiscoveryEventSubscription: subsId: 2" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="meep-sss.go:1655" +time="2025-02-25T14:00:37.419+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: Before sensorDiscoveryEventSubscriptionMapmap[2:0xc000470540]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: After sensorDiscoveryEventSubscriptionMapmap[]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.419+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: 2 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query +time="2025-02-25T14:00:37.469+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDiscoveryEventSubscriptionGET_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDiscoveryEventSubscriptionGET_no_query (1.56s) +=== RUN TestSensorDiscoveryEventSubscriptionDELETE +--- TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.57+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.571+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:93" +time="2025-02-25T14:00:37.571+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.571+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Message Queue created" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.571+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.572+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="model.go:161" +time="2025-02-25T14:00:37.572+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:37.572+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:553" +time="2025-02-25T14:00:37.572+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.572+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.572+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="metric-store.go:120" +time="2025-02-25T14:00:37.573+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.573+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.574+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.574+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.574+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.574+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.574+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.674+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.674+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:37.674+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +Set a scenario +time="2025-02-25T14:00:37.674+01:00" level=info msg="Terminate all" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.674+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:93" +time="2025-02-25T14:00:37.674+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:553" +time="2025-02-25T14:00:37.674+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.674+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.675+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.675+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.675+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:37.675+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.675+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="db.go:69" +time="2025-02-25T14:00:37.675+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.675+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:37.675+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +Message Queue created +Set Model +time="2025-02-25T14:00:37.676+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:37.676+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:38.776+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="model.go:1393" +time="2025-02-25T14:00:38.777+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:38.777+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:38.877+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 93 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:688" +time="2025-02-25T14:00:38.877+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:730" +time="2025-02-25T14:00:38.877+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false http://test.org }" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: subId: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:1095" +time="2025-02-25T14:00:38.877+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: currentSensorDiscoveryEventSubscription: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:1096" +time="2025-02-25T14:00:38.877+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc0003309c0 http://test.org false [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:1097" +time="2025-02-25T14:00:38.877+01:00" level=info msg="registerSensorDiscoveryEventSubscription: subsId: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="registerSensorDiscoveryEventSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="registerSensorDiscoveryEventSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="New registration: 3 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="processSensorDiscoveryEventSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="processSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc0003309c0 http://test.org false 0xc0002901a8 [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.877+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/3\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +sensorDiscoveryEventSubscription: {0xc0003306f0 http://test.org false 0xc0002901b8 [] [] } +subscriptionId = 3 +time="2025-02-25T14:00:38.928+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc00038f770}" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:986" +time="2025-02-25T14:00:38.928+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="subsIdStr: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=debug msg=">>> delSubscription: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:38.928+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=debug msg=">>> deregisterSensorDiscoveryEventSubscription: subsId: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:1655" +time="2025-02-25T14:00:38.928+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: Before sensorDiscoveryEventSubscriptionMapmap[3:0xc00049d1f0]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: After sensorDiscoveryEventSubscriptionMapmap[]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.928+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: 3 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +Received expected response +time="2025-02-25T14:00:38.978+01:00" level=debug msg=">>> subscriptionsByIdGET: &{GET /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc000530db0}" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:878" +time="2025-02-25T14:00:38.978+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.978+01:00" level=info msg="subsIdStr: 3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.978+01:00" level=debug msg="subscriptionsByIdGET: sensorIdentifier: " meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:892" +time="2025-02-25T14:00:38.978+01:00" level=debug msg="subscriptionsByIdGET: sensorIdentifiers: []" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:894" +time="2025-02-25T14:00:38.978+01:00" level=info msg="subscriptionsByIdGET: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:3" meep.component=TestSensorDiscoveryEventSubscriptionDELETE +time="2025-02-25T14:00:38.979+01:00" level=error msg="subscription not found against the provided subscriptionId" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="meep-sss.go:902" +Received expected response +time="2025-02-25T14:00:39.031+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDiscoveryEventSubscriptionDELETE meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDiscoveryEventSubscriptionDELETE (1.56s) +=== RUN TestSensorDiscoveryEventSubscriptionByIdGET_no_query +--- TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.135+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:39.135+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.135+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.136+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Message Queue created" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.136+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="model.go:161" +time="2025-02-25T14:00:39.136+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.136+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:39.137+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.137+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:39.137+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.137+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.137+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.137+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.137+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.137+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:39.138+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.138+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.139+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.139+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.139+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.139+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.139+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.239+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.239+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:39.239+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +Set a scenario +time="2025-02-25T14:00:39.239+01:00" level=info msg="Terminate all" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.239+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:39.239+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:39.239+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.239+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.24+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.24+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.24+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:39.24+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.24+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:39.24+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.24+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:39.24+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:39.241+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:39.241+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:40.341+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:40.342+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:40.342+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:40.442+01:00" level=debug msg=">>> sensorDiscoverySubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 93 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:688" +time="2025-02-25T14:00:40.442+01:00" level=debug msg=">>> subscriptionsPOST: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:40.442+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDiscoveryEventSubscription false http://test.org }" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: subId: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:1095" +time="2025-02-25T14:00:40.442+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: currentSensorDiscoveryEventSubscription: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:1096" +time="2025-02-25T14:00:40.442+01:00" level=debug msg=">>> registerSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc000434ef0 http://test.org false [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:1097" +time="2025-02-25T14:00:40.442+01:00" level=info msg="registerSensorDiscoveryEventSubscription: subsId: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="registerSensorDiscoveryEventSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="registerSensorDiscoveryEventSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="New registration: 4 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="processSensorDiscoveryEventSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="processSensorDiscoveryEventSubscription: sensorDiscoveryEventSubscription: &{0xc000434ef0 http://test.org false 0xc000290020 [] [] }" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.442+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/4\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +expected_response: {"subscriptionType":"SensorDiscoveryEventSubscription","callbackReference":"http://test.org","_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions/4"}}} +subscriptionId = 4 +time="2025-02-25T14:00:40.493+01:00" level=debug msg=">>> subscriptionsByIdGET: &{GET /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc00032e060}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:878" +time="2025-02-25T14:00:40.493+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.493+01:00" level=info msg="subsIdStr: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.493+01:00" level=debug msg="subscriptionsByIdGET: sensorIdentifier: " meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:892" +time="2025-02-25T14:00:40.493+01:00" level=debug msg="subscriptionsByIdGET: sensorIdentifiers: []" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:894" +time="2025-02-25T14:00:40.493+01:00" level=info msg="subscriptionsByIdGET: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.493+01:00" level=info msg="subscriptionsByIdGET: subscription: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/4\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.493+01:00" level=info msg="subscriptionsByIdGET: jsonResponse: {\"subscriptionType\":\"SensorDiscoveryEventSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/4\"}}}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +Respone: rr: {"subscriptionType":"SensorDiscoveryEventSubscription","callbackReference":"http://test.org","_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions/4"}}} +>>> validateSensorDiscoveryEventSubscription: expected: {0xc000434bf0 http://test.org false 0xc000010008 [] [] } +>>> validateSensorDiscoveryEventSubscription: resp: {0xc0002e45d0 http://test.org false 0xc000010028 [] [] } +Received expected response +subscriptionId = 4 +time="2025-02-25T14:00:40.543+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_discovery HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc00032e5d0}" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:40.543+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_discovery" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.543+01:00" level=info msg="subsIdStr: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.543+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.543+01:00" level=debug msg=">>> delSubscription: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:40.543+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.544+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.544+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.544+01:00" level=debug msg=">>> deregisterSensorDiscoveryEventSubscription: subsId: 4" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="meep-sss.go:1655" +time="2025-02-25T14:00:40.544+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: Before sensorDiscoveryEventSubscriptionMapmap[4:0xc000170cb0]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.544+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: After sensorDiscoveryEventSubscriptionMapmap[]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.544+01:00" level=info msg="deregisterSensorDiscoveryEventSubscription: 4 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query +time="2025-02-25T14:00:40.594+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDiscoveryEventSubscriptionByIdGET_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDiscoveryEventSubscriptionByIdGET_no_query (1.56s) +=== RUN TestSensorStatusSubscriptionPOST_no_query +--- TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.695+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:40.695+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.695+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.696+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Message Queue created" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.696+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="model.go:161" +time="2025-02-25T14:00:40.696+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.696+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:40.697+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:40.697+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.697+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:40.697+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.697+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.698+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.698+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.698+01:00" level=info msg="SBI Initialized" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.698+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.698+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.798+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:40.799+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorStatusSubscriptionPOST_no_query +Set a scenario +time="2025-02-25T14:00:40.799+01:00" level=info msg="Terminate all" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:40.799+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:40.799+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.799+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:40.799+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.799+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:40.8+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.8+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:40.8+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorStatusSubscriptionPOST_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:40.8+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:40.8+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:41.9+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:41.901+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:41.901+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +expected_response: {"subscriptionType":"SensorStatusSubscription","callbackReference":"http://test.org"} +time="2025-02-25T14:00:42.001+01:00" level=debug msg=">>> sensorStatusSubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 85 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:694" +time="2025-02-25T14:00:42.002+01:00" level=debug msg=">>> subscriptionsPOST: SensorStatusSubscription" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:42.002+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorStatusSubscription false http://test.org }" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=debug msg=">>> registerSensorStatusSubscription: subId: 5" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:1244" +time="2025-02-25T14:00:42.002+01:00" level=debug msg=">>> registerSensorStatusSubscription: currentSensorStatusSubscription: " meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:1245" +time="2025-02-25T14:00:42.002+01:00" level=debug msg=">>> registerSensorStatusSubscription: sensorStatusSubscription: &{0xc000476740 http://test.org false }" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:1246" +time="2025-02-25T14:00:42.002+01:00" level=info msg="registerSensorStatusSubscription: subsId: 5" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="registerSensorStatusSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="registerSensorStatusSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="New registration: 5 type: SensorDiscoveryEventSubscription" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="processSensorStatusSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:5" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="processSensorStatusSubscription: sensorStatusSubscription: &{0xc000476740 http://test.org false 0xc0002901c8 }" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.002+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/5\"}}}" meep.component=TestSensorStatusSubscriptionPOST_no_query +Respone: rr: {"subscriptionType":"SensorStatusSubscription","callbackReference":"http://test.org","_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions/5"}}} +>>> validateSensorStatusSubscription: expected: {0xc000476400 http://test.org false } +>>> validateSensorStatusSubscription: resp: {0xc000572a90 http://test.org false 0xc0000e4008 } +Received expected response +subscriptionId = 5 +time="2025-02-25T14:00:42.052+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc000530bd0}" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:42.052+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_status" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.052+01:00" level=info msg="subsIdStr: 5" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.052+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:5" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.052+01:00" level=debug msg=">>> delSubscription: 5" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:42.052+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:5" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.053+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.053+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.053+01:00" level=debug msg=">>> deregisterSensorStatusSubscription: subsId: 5" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="meep-sss.go:1670" +time="2025-02-25T14:00:42.053+01:00" level=info msg="deregisterSensorStatusSubscription: Before sensorStatusSubscriptionMapmap[5:0xc0003fad80]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.053+01:00" level=info msg="deregisterSensorStatusSubscription: After sensorStatusSubscriptionMapmap[]" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.053+01:00" level=info msg="deregisterSensorStatusSubscription: 5 type: SensorStatusSubscription" meep.component=TestSensorStatusSubscriptionPOST_no_query +time="2025-02-25T14:00:42.103+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorStatusSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorStatusSubscriptionPOST_no_query (1.51s) +=== RUN TestSensorStatusSubscriptionGET_no_query +--- TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.204+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:42.204+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.204+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.205+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Message Queue created" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.205+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="model.go:161" +time="2025-02-25T14:00:42.205+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.205+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:42.206+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:42.206+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.206+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:42.206+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.206+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.207+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.207+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.207+01:00" level=info msg="SBI Initialized" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.207+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.208+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:42.308+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorStatusSubscriptionGET_no_query +Set a scenario +time="2025-02-25T14:00:42.308+01:00" level=info msg="Terminate all" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:42.308+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:42.308+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.308+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:42.308+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.308+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:42.309+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.309+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:42.309+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorStatusSubscriptionGET_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:42.309+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:42.309+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:43.41+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:43.41+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:43.41+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:43.51+01:00" level=debug msg=">>> sensorStatusSubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 85 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:694" +time="2025-02-25T14:00:43.511+01:00" level=debug msg=">>> subscriptionsPOST: SensorStatusSubscription" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:43.511+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorStatusSubscription false http://test.org }" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=debug msg=">>> registerSensorStatusSubscription: subId: 6" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1244" +time="2025-02-25T14:00:43.511+01:00" level=debug msg=">>> registerSensorStatusSubscription: currentSensorStatusSubscription: " meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1245" +time="2025-02-25T14:00:43.511+01:00" level=debug msg=">>> registerSensorStatusSubscription: sensorStatusSubscription: &{0xc00023e1f0 http://test.org false }" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1246" +time="2025-02-25T14:00:43.511+01:00" level=info msg="registerSensorStatusSubscription: subsId: 6" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="registerSensorStatusSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="registerSensorStatusSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="New registration: 6 type: SensorDiscoveryEventSubscription" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="processSensorStatusSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:6" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.511+01:00" level=info msg="processSensorStatusSubscription: sensorStatusSubscription: &{0xc00023e1f0 http://test.org false 0xc0000a6020 }" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.512+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/6\"}}}" meep.component=TestSensorStatusSubscriptionGET_no_query +sensorStatusSubscription: {0xc00023ea70 http://test.org false 0xc000290008 } +time="2025-02-25T14:00:43.562+01:00" level=debug msg=">>> sensorStatusSubscriptionPOST: &{GET /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:677" +time="2025-02-25T14:00:43.562+01:00" level=debug msg=">>> subscriptionsGET: &{GET /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:842" +time="2025-02-25T14:00:43.562+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_status" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.562+01:00" level=debug msg="subscriptionsGET: sensorIdentifier: " meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:851" +time="2025-02-25T14:00:43.562+01:00" level=debug msg="subscriptionsGET: sensorIdentifiers: []" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:853" +time="2025-02-25T14:00:43.562+01:00" level=debug msg=">>> createSubscriptionLinkList: subType: SensorStatusSubscription" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1469" +time="2025-02-25T14:00:43.562+01:00" level=debug msg=">>> createSubscriptionLinkList: sensorIdentifiers: []" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1470" +time="2025-02-25T14:00:43.562+01:00" level=debug msg="createSubscriptionLinkList: sensorDiscoveryEventSubscriptionMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1472" +time="2025-02-25T14:00:43.562+01:00" level=debug msg="createSubscriptionLinkList: sensorStatusSubscriptionMap: map[6:0xc0002be680]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1473" +time="2025-02-25T14:00:43.562+01:00" level=debug msg="createSubscriptionLinkList: sensorDataSubscriptionMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1474" +time="2025-02-25T14:00:43.562+01:00" level=debug msg="createSubscriptionLinkList: links.Subscriptions: [{http://localhost/testScenario/sens/v1/subscriptions/6 SensorStatusSubscription}]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1541" +Respone: rr: {"_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions"},"subscriptions":[{"href":"http://localhost/testScenario/sens/v1/subscriptions/6","subscriptionType":"SensorStatusSubscription"}]}} +resp {0xc0000b4040} +>>> validateSubscriptionLinkList: expected: {0xc00000e060} +>>> validateSubscriptionLinkList: resp: {0xc0000b4040} +Received expected response +subscriptionId = 6 +time="2025-02-25T14:00:43.612+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_status HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0004f6390}" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:43.612+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_status" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.612+01:00" level=info msg="subsIdStr: 6" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.612+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:6" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=debug msg=">>> delSubscription: 6" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:43.613+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:6" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=debug msg=">>> deregisterSensorStatusSubscription: subsId: 6" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="meep-sss.go:1670" +time="2025-02-25T14:00:43.613+01:00" level=info msg="deregisterSensorStatusSubscription: Before sensorStatusSubscriptionMapmap[6:0xc0002be680]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=info msg="deregisterSensorStatusSubscription: After sensorStatusSubscriptionMapmap[]" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.613+01:00" level=info msg="deregisterSensorStatusSubscription: 6 type: SensorStatusSubscription" meep.component=TestSensorStatusSubscriptionGET_no_query +time="2025-02-25T14:00:43.663+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorStatusSubscriptionGET_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorStatusSubscriptionGET_no_query (1.56s) +=== RUN TestSensorDataSubscriptionPOST_no_query +--- TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.764+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.782+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:43.782+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.782+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Message Queue created" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.782+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.783+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.783+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.783+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="model.go:161" +time="2025-02-25T14:00:43.783+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.783+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:43.783+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.783+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:43.783+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.783+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.783+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.784+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.784+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.784+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:43.784+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.784+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.785+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.785+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.785+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.785+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.785+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.885+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:43.886+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDataSubscriptionPOST_no_query +Set a scenario +time="2025-02-25T14:00:43.886+01:00" level=info msg="Terminate all" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:93" +time="2025-02-25T14:00:43.886+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:43.886+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.886+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:43.886+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.886+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="db.go:69" +time="2025-02-25T14:00:43.887+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.887+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:43.887+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDataSubscriptionPOST_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:43.887+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:43.887+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:44.988+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:44.988+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:44.988+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="sss-sbi.go:258" +expected_response: {"subscriptionType":"SensorStatusSubscription","callbackReference":"http://test.org"} +time="2025-02-25T14:00:45.088+01:00" level=debug msg=">>> sensorDataSubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_data HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 85 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:700" +time="2025-02-25T14:00:45.089+01:00" level=debug msg=">>> subscriptionsPOST: SensorDataSubscription" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:45.089+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorStatusSubscription false http://test.org }" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=debug msg=">>> registerSensorStatusSubscription: subId: 7" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:1244" +time="2025-02-25T14:00:45.089+01:00" level=debug msg=">>> registerSensorStatusSubscription: currentSensorStatusSubscription: " meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:1245" +time="2025-02-25T14:00:45.089+01:00" level=debug msg=">>> registerSensorStatusSubscription: sensorStatusSubscription: &{0xc0002e51c0 http://test.org false }" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:1246" +time="2025-02-25T14:00:45.089+01:00" level=info msg="registerSensorStatusSubscription: subsId: 7" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="registerSensorStatusSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="registerSensorStatusSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="New registration: 7 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="processSensorStatusSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:7" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="processSensorStatusSubscription: sensorStatusSubscription: &{0xc0002e51c0 http://test.org false 0xc000290060 }" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.089+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorStatusSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/7\"}}}" meep.component=TestSensorDataSubscriptionPOST_no_query +Respone: rr: {"subscriptionType":"SensorStatusSubscription","callbackReference":"http://test.org","_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions/7"}}} +>>> validateSensorDataSubscription: expected: {0xc0002e4e80 http://test.org false } +>>> validateSensorDataSubscription: resp: {0xc00023fed0 http://test.org false 0xc0000a6260 } +Received expected response +subscriptionId = 7 +time="2025-02-25T14:00:45.139+01:00" level=debug msg=">>> subscriptionDelete: &{DELETE /sens/v1/subscriptions/sensor_data HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc000427e30}" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:986" +time="2025-02-25T14:00:45.139+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_data" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.139+01:00" level=info msg="subsIdStr: 7" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.139+01:00" level=info msg="subscriptionDelete: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:7" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.139+01:00" level=debug msg=">>> delSubscription: 7" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:1618" +time="2025-02-25T14:00:45.139+01:00" level=info msg="delSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:7" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.14+01:00" level=info msg="delSubscription: Before removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.14+01:00" level=info msg="delSubscription: After removal: subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.14+01:00" level=debug msg=">>> deregisterSensorStatusSubscription: subsId: 7" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="meep-sss.go:1670" +time="2025-02-25T14:00:45.14+01:00" level=info msg="deregisterSensorStatusSubscription: Before sensorStatusSubscriptionMapmap[7:0xc0003fa400]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.14+01:00" level=info msg="deregisterSensorStatusSubscription: After sensorStatusSubscriptionMapmap[]" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.14+01:00" level=info msg="deregisterSensorStatusSubscription: 7 type: SensorStatusSubscription" meep.component=TestSensorDataSubscriptionPOST_no_query +time="2025-02-25T14:00:45.19+01:00" level=debug msg="TX MSG: Message[API-UPDATE] Src[testScenario:meep-sss-sbi] Dst[testScenario:meep-sandbox-ctrl] Scope[mq:testScenario] Payload[map[apilist: mep: module:meep-sss]]" meep.component=TestSensorDataSubscriptionPOST_no_query meep.from="swagger-api-mgr.go:221" +--- PASS: TestSensorDataSubscriptionPOST_no_query (1.53s) +=== RUN TestSensorDataSubscriptionGET_no_query +--- TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.29+01:00" level=info msg="MEEP_INSTANCE_ID: " meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.29+01:00" level=info msg="MEEP_POD_NAME: meep-sss" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.29+01:00" level=info msg="MEEP_SANDBOX_NAME: testScenario" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_HOST_URL: http://localhost" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_MEP_NAME: global" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_APP_ENABLEMENT: " meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_SCOPE_OF_LOCALITY: MEC_SYSTEM" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_CONSUMED_LOCAL_ONLY: true" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="MEEP_LOCALITY: []" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.291+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:45.291+01:00" level=info msg="Connected to Redis DB, SSS service table" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.291+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.292+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Message Queue created" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="MEEP_HOST_URL: " meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="MEEP_SVC_PATH: " meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Service URL: /testScenario" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Created Swagger API Manager" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Swagger API Manager created" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.292+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=debug msg="[meep-sss-sbi] Model created activeScenario" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="model.go:161" +time="2025-02-25T14:00:45.292+01:00" level=info msg="Connected to SSS Manager" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.292+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:45.293+01:00" level=info msg="processActiveScenarioUpdate: Entering in then" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.293+01:00" level=debug msg=">>> updateStoreName: test-scenario" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:45.293+01:00" level=info msg="Reinitialisation of http logger with: test-scenario for meep-sss" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.293+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.293+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.293+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.293+01:00" level=info msg="Connected to Metrics Redis DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.293+01:00" level=debug msg="InfluxDB Connector connecting to http://localhost:30986" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="metric-store.go:120" +time="2025-02-25T14:00:45.294+01:00" level=info msg="InfluxDB Connector connected to http://localhost:30986 version: 1.8.0" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.294+01:00" level=info msg="Connected to Metrics Influx DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.294+01:00" level=info msg="Store name set to: testScenario_test_scenario" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.295+01:00" level=info msg="Successfully create Metric Store" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.295+01:00" level=info msg="SBI Initialized" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.295+01:00" level=info msg="SSS successfully initialized" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.295+01:00" level=info msg="Subscription Message: subscribe to channel mq:testScenario. Total subscriptions: 1" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.395+01:00" level=info msg="Swagger API Manager started" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.395+01:00" level=error msg="Failed to read API dir with error: open /api: no such file or directory" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="swagger-api-mgr.go:162" +time="2025-02-25T14:00:45.395+01:00" level=info msg="Swagger APIs successfully added" meep.component=TestSensorDataSubscriptionGET_no_query +Set a scenario +time="2025-02-25T14:00:45.395+01:00" level=info msg="Terminate all" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.395+01:00" level=debug msg="DBFlush module: data:sbox:testScenario:sens:mep:global:" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:93" +time="2025-02-25T14:00:45.395+01:00" level=debug msg=">>> updateStoreName: " meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:553" +time="2025-02-25T14:00:45.395+01:00" level=info msg="Reinitialisation of http logger with: for meep-sss" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.395+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.396+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.396+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.396+01:00" level=debug msg="[test-mod] Model created testScenario" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="model.go:161" +initialiseScenario: model created +time="2025-02-25T14:00:45.396+01:00" level=info msg="Creating new MsgQueue" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.396+01:00" level=debug msg="Redis Connector connecting to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="db.go:69" +time="2025-02-25T14:00:45.396+01:00" level=info msg="Redis Connector connected to localhost:30380" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.396+01:00" level=info msg="Successfully connected to DB" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:45.396+01:00" level=info msg="Connected to Message Queue Redis DB" meep.component=TestSensorDataSubscriptionGET_no_query +Message Queue created +Set Model +time="2025-02-25T14:00:45.397+01:00" level=debug msg="RX MSG: Message[SCENARIO-ACTIVATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="sss-sbi.go:229" +time="2025-02-25T14:00:45.397+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:46.497+01:00" level=debug msg="Found PL & destination. Updating PL location." meep.component=TestSensorDataSubscriptionGET_no_query meep.from="model.go:1393" +time="2025-02-25T14:00:46.498+01:00" level=debug msg="RX MSG: Message[SCENARIO-UPDATE] Src[testScenario:test-mod] Dst[testScenario:all] Scope[mq:testScenario] Payload[map[]]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="sss-sbi.go:232" +time="2025-02-25T14:00:46.498+01:00" level=debug msg=processActiveScenarioUpdate meep.component=TestSensorDataSubscriptionGET_no_query meep.from="sss-sbi.go:258" +time="2025-02-25T14:00:46.598+01:00" level=debug msg=">>> sensorDataSubscriptionPOST: &{POST /sens/v1/subscriptions/sensor_data HTTP/1.1 1 1 map[] {{\"subscriptionType\":\"SensorDataSubscription\",\"callbackReference\":\"http://test.org\"}} 0x709a20 83 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:700" +time="2025-02-25T14:00:46.598+01:00" level=debug msg=">>> subscriptionsPOST: SensorDataSubscription" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:730" +time="2025-02-25T14:00:46.598+01:00" level=info msg="subscriptionsPost: bodyBytes: {\"subscriptionType\":\"SensorDataSubscription\",\"callbackReference\":\"http://test.org\"}" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="subscriptionsPost: subscriptionCommon: { SensorDataSubscription false http://test.org }" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=debug msg=">>> registerSensorDataSubscription: subId: 8" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1394" +time="2025-02-25T14:00:46.598+01:00" level=debug msg=">>> registerSensorDataSubscription: currentSensorDataSubscription: " meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1395" +time="2025-02-25T14:00:46.598+01:00" level=debug msg=">>> registerSensorDataSubscription: sensorDataSubscription: &{0xc0005722f0 http://test.org false }" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1396" +time="2025-02-25T14:00:46.598+01:00" level=info msg="registerSensorDataSubscription: subsId: 8" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="registerSensorDataSubscription: Before subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="registerSensorDataSubscription: After subscriptionExpiryMap: map[]" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="New registration: 8 type: SensorDiscoveryEventSubscription" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="processSensorDataSubscription: keyName: data:sbox:testScenario:sens:mep:global:subscriptions:8" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="processSensorDataSubscription: sensorDataSubscription: &{0xc0005722f0 http://test.org false 0xc000290010 }" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.598+01:00" level=info msg="subscriptionsPost: jsonResponse: {\"subscriptionType\":\"SensorDataSubscription\",\"callbackReference\":\"http://test.org\",\"_links\":{\"self\":{\"href\":\"http://localhost/testScenario/sens/v1/subscriptions/8\"}}}" meep.component=TestSensorDataSubscriptionGET_no_query +sensorDataSubscription: {0xc000572000 http://test.org false 0xc000290018 } +time="2025-02-25T14:00:46.649+01:00" level=debug msg=">>> sensorDataSubscriptionGET: &{GET /sens/v1/subscriptions/sensor_data HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:683" +time="2025-02-25T14:00:46.649+01:00" level=debug msg=">>> subscriptionsGET: &{GET /sens/v1/subscriptions/sensor_data HTTP/1.1 1 1 map[] 0 [] false map[] map[] map[] 0xc0000a4010}" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:842" +time="2025-02-25T14:00:46.649+01:00" level=info msg="url: /sens/v1/subscriptions/sensor_data" meep.component=TestSensorDataSubscriptionGET_no_query +time="2025-02-25T14:00:46.649+01:00" level=debug msg="subscriptionsGET: sensorIdentifier: " meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:851" +time="2025-02-25T14:00:46.649+01:00" level=debug msg="subscriptionsGET: sensorIdentifiers: []" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:853" +time="2025-02-25T14:00:46.649+01:00" level=debug msg=">>> createSubscriptionLinkList: subType: SensorDataSubscription" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1469" +time="2025-02-25T14:00:46.649+01:00" level=debug msg=">>> createSubscriptionLinkList: sensorIdentifiers: []" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1470" +time="2025-02-25T14:00:46.649+01:00" level=debug msg="createSubscriptionLinkList: sensorDiscoveryEventSubscriptionMap: map[]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1472" +time="2025-02-25T14:00:46.649+01:00" level=debug msg="createSubscriptionLinkList: sensorStatusSubscriptionMap: map[]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1473" +time="2025-02-25T14:00:46.649+01:00" level=debug msg="createSubscriptionLinkList: sensorDataSubscriptionMap: map[8:0xc0003fa2c0]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1474" +time="2025-02-25T14:00:46.649+01:00" level=debug msg="createSubscriptionLinkList: links.Subscriptions: [{http://localhost/testScenario/sens/v1/subscriptions/8 SensorDataNotification}]" meep.component=TestSensorDataSubscriptionGET_no_query meep.from="meep-sss.go:1541" +Respone: rr: {"_links":{"self":{"href":"http://localhost/testScenario/sens/v1/subscriptions"},"subscriptions":[{"href":"http://localhost/testScenario/sens/v1/subscriptions/8","subscriptionType":"SensorDataNotification"}]}} +resp {0xc0003a6000} +>>> validateSubscriptionLinkList: expected: {0xc00000e480} +>>> validateSubscriptionLinkList: resp: {0xc0003a6000} +sub.SubscriptionType != resp.Links.Subscriptions[i].SubscriptionType +sub.SubscriptionType: SensorDataSubscription +sub.SubscriptionType: SensorDataNotification + meep-sss_test.go:1595: SubscriptionLinkList mismatch +--- FAIL: TestSensorDataSubscriptionGET_no_query (1.41s) +FAIL +coverage: 37.1% of statements +FAIL github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-sss/server 13.765s +FAIL diff --git a/go-apps/meep-sss/server/routers.go b/go-apps/meep-sss/server/routers.go index aa27a304f5ea8ce5844772895185d4e8cba2ff61..35b06a0dbc8d6ef324419a306f9265eb16458575 100644 --- a/go-apps/meep-sss/server/routers.go +++ b/go-apps/meep-sss/server/routers.go @@ -179,17 +179,17 @@ var routes = Routes{ }, Route{ - "SensorSatusIndividualSubscriptionGET", + "SensorStatusIndividualSubscriptionGET", strings.ToUpper("Get"), "/sens/v1/subscriptions/sensor_status/{subscriptionId}", - SensorSatusIndividualSubscriptionGET, + SensorStatusIndividualSubscriptionGET, }, Route{ "SensorStatusIndividualSubscriptionGET", strings.ToUpper("Get"), "/sens/v1/subscriptions/sensor_status", - SensorStatusIndividualSubscriptionGET, + SensorStatusSubscriptionGET, }, Route{ @@ -206,6 +206,13 @@ var routes = Routes{ SensorStatusSubscriptionPUT, }, + Route{ + "SensorStatusSubscriptionGET", + strings.ToUpper("Get"), + "/sens/v1/subscriptions/sensor_status", + SensorStatusSubscriptionGET, + }, + Route{ "SensorStatusSubscriptionPOST", strings.ToUpper("Post"), diff --git a/go-apps/meep-sss/server/subscriptionCommon.go b/go-apps/meep-sss/server/subscriptionCommon.go new file mode 100644 index 0000000000000000000000000000000000000000..059567bf6d66933fbe1f97fece3c90eafa9459b3 --- /dev/null +++ b/go-apps/meep-sss/server/subscriptionCommon.go @@ -0,0 +1,34 @@ +/* + * 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 V2X Information Service REST API + * + * V2X Information Service is AdvantEDGE's implementation of [ETSI MEC ISG MEC030 V2XI API](.https://www.etsi.org/deliver/etsi_gs/MEC/001_099/030/03.02.01_60/) ETSI 2024](https://forge.etsi.org/etsi-forge-copyright-notice.txt)

**Micro-service**
[meep-vis](https://github.com/InterDigitalInc/AdvantEDGE/tree/master/go-apps/meep-vis)

**Type & Usage**
Edge Service used by edge applications that want to get information about radio conditions in the network

**Note**
AdvantEDGE supports a selected subset of VIS API endpoints (see below) and a subset of subscription types. + * + * API version: 3.2.2 + * Contact: AdvantEDGE@InterDigital.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package server + +type SubscriptionCommon struct { + Links *SubscriptionLinks `json:"_links,omitempty"` + // URI selected by the service consumer, to receive notifications on the subscribed RNIS information. This shall be included in the request and response. + SubscriptionType string `json:"subscriptionType"` + RequestTestNotification bool `json:"requestTestNotification"` + CallbackReference string `json:"callbackReference"` + WebsockNotifConfig *WebsockNotifConfig `json:"websockNotifConfig,omitempty"` + ExpiryDeadline *TimeStamp `json:"expiryDeadline,omitempty"` +}