Loading .meepctl-repocfg.yaml +0 −8 Original line number Diff line number Diff line Loading @@ -289,7 +289,6 @@ repo: - sandbox.go-apps.meep-sandbox-ctrl - sandbox.go-apps.meep-gis-engine - sandbox.go-apps.meep-loc-serv - packages.go-packages.meep-loc-serv-notification-client - sandbox.go-apps.meep-rnis - packages.go-packages.meep-rnis-notification-client - sandbox.go-apps.meep-wais Loading Loading @@ -660,13 +659,6 @@ repo: src: go-packages/meep-loc-serv-client # supports linting lint: false meep-loc-serv-notification-client: # location of source code src: go-packages/meep-loc-serv-notification-client # supports linting lint: false # location of API specification api: go-packages/meep-loc-serv-notification-client/api/swagger.yaml meep-logger: # location of source code src: go-packages/meep-logger Loading go-apps/meep-loc-serv/go.mod +0 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-gis-cache v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 Loading @@ -25,7 +24,6 @@ replace ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model => ../../go-packages/meep-data-model github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-gis-cache => ../../go-packages/meep-gis-cache github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger => ../../go-packages/meep-http-logger github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client => ../../go-packages/meep-loc-serv-notification-client github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger => ../../go-packages/meep-logger github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store => ../../go-packages/meep-metric-store github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model => ../../go-packages/meep-model Loading go-apps/meep-loc-serv/server/loc-serv.go +65 −62 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package server import ( "context" "bytes" "encoding/json" "errors" "fmt" Loading @@ -32,7 +32,6 @@ import ( sbi "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/sbi" dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr" httpLog "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger" clientNotifOMA "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" redis "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis" sm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" Loading Loading @@ -193,19 +192,6 @@ func Stop() (err error) { return sbi.Stop() } func createClient(notifyPath string) (*clientNotifOMA.APIClient, error) { // Create & store client for App REST API subsAppClientCfg := clientNotifOMA.NewConfiguration() subsAppClientCfg.BasePath = notifyPath subsAppClient := clientNotifOMA.NewAPIClient(subsAppClientCfg) if subsAppClient == nil { log.Error("Failed to create Subscription App REST API client: ", subsAppClientCfg.BasePath) err := errors.New("Failed to create Subscription App REST API client") return nil, err } return subsAppClient, nil } func deregisterZoneStatus(subsIdStr string) { subsId, err := strconv.Atoi(subsIdStr) if err != nil { Loading Loading @@ -392,7 +378,7 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn subscription := convertJsonToZoneStatusSubscription(jsonInfo) var zoneStatusNotif clientNotifOMA.ZoneStatusNotification var zoneStatusNotif ZoneStatusNotification zoneStatusNotif.ZoneId = zoneId if apWarning { zoneStatusNotif.AccessPointId = apId Loading @@ -401,8 +387,13 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn if zoneWarning { zoneStatusNotif.NumberOfUsersInZone = (int32)(nbUsersInZone) } zoneStatusNotif.Timestamp = time.Now() sendStatusNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zoneStatusNotif) seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zoneStatusNotif.Timestamp = ×tamp var inlineZoneStatusNotification InlineZoneStatusNotification inlineZoneStatusNotification.ZoneStatusNotification = &zoneStatusNotif sendStatusNotification(subscription.CallbackReference.NotifyURL, inlineZoneStatusNotification) if apWarning { log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInAPStr + " users in AP " + apId) } else { Loading Loading @@ -430,9 +421,12 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI subscription := convertJsonToUserSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.Address = userId zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator Loading @@ -442,20 +436,24 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI if userSubscriptionLeavingMap[subsId] != "" { zonal.ZoneId = oldZoneId zonal.CurrentAccessPointId = oldApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.LEAVING_UserEventType event := new(UserEventType) *event = LEAVING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + "Leaving event in zone " + oldZoneId + " for user " + userId) } } if userSubscriptionEnteringMap[subsId] != "" && newZoneId != "" { zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.ENTERING_UserEventType event := new(UserEventType) *event = ENTERING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + "Entering event in zone " + newZoneId + " for user " + userId) } Loading @@ -465,10 +463,12 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.PreviousAccessPointId = oldApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.TRANSFERRING_UserEventType event := new(UserEventType) *event = TRANSFERRING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + " Transferring event within zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId) } } Loading @@ -477,21 +477,15 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI } } func sendNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.TrackingNotification) { func sendZonalPresenceNotification(notifyUrl string, notification InlineZonalPresenceNotification) { startTime := time.Now() client, err := createClient(notifyUrl) jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err) return } jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err.Error()) } resp, err := client.NotificationsApi.PostTrackingNotification(ctx, subscriptionId, notification) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) _ = httpLog.LogTx(notifyUrl, "POST", string(jsonNotif), resp, startTime) if err != nil { log.Error(err) Loading @@ -500,21 +494,15 @@ func sendNotification(notifyUrl string, ctx context.Context, subscriptionId stri defer resp.Body.Close() } func sendStatusNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.ZoneStatusNotification) { func sendStatusNotification(notifyUrl string, notification InlineZoneStatusNotification) { startTime := time.Now() client, err := createClient(notifyUrl) jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err) return } jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err.Error()) } resp, err := client.NotificationsApi.PostZoneStatusNotification(ctx, subscriptionId, notification) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) _ = httpLog.LogTx(notifyUrl, "POST", string(jsonNotif), resp, startTime) if err != nil { log.Error(err) Loading Loading @@ -542,16 +530,21 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI if jsonInfo != "" { subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.ENTERING_UserEventType event := new(UserEventType) *event = ENTERING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Entering event in zone " + newZoneId + " for user " + userId) } } Loading @@ -564,17 +557,22 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI if jsonInfo != "" { subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.PreviousAccessPointId = oldApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.TRANSFERRING_UserEventType event := new(UserEventType) *event = TRANSFERRING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Transferring event in zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId) } } Loading @@ -590,16 +588,21 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = oldZoneId zonal.CurrentAccessPointId = oldApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.LEAVING_UserEventType event := new(UserEventType) *event = LEAVING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Leaving event in zone " + oldZoneId + " for user " + userId) } } Loading go-apps/meep-loc-serv/server/loc-serv_test.go +10 −10 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import ( "testing" "time" locNotif "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" ms "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store" mod "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model" Loading Loading @@ -1829,12 +1828,12 @@ func TestUserSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } var notification locNotif.TrackingNotification err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) var inlineZonalPresenceNotification InlineZonalPresenceNotification err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification := inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1951,12 +1950,12 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } var notification locNotif.TrackingNotification err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) var inlineZonalPresenceNotification InlineZonalPresenceNotification err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification := inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading @@ -1968,11 +1967,11 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification = inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading @@ -1984,11 +1983,12 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification = inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId2 != notification.ZoneId || expectedPoa2 != notification.CurrentAccessPointId || expectedAddr2 != notification.Address { t.Fatalf("Failed to get expected response") } Loading go-apps/meep-platform-ctrl/go.mod +2 −1 Original line number Diff line number Diff line Loading @@ -13,13 +13,14 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users v0.0.0 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/google/go-github v17.0.0+incompatible github.com/google/go-querystring v1.0.0 // indirect github.com/gorilla/handlers v1.4.0 github.com/gorilla/mux v1.7.4 github.com/roymx/viper v1.3.3-0.20190416163942-b9a223fc58a3 github.com/xanzy/go-gitlab v0.39.0 golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 google.golang.org/protobuf v1.25.0 // indirect ) replace ( Loading Loading
.meepctl-repocfg.yaml +0 −8 Original line number Diff line number Diff line Loading @@ -289,7 +289,6 @@ repo: - sandbox.go-apps.meep-sandbox-ctrl - sandbox.go-apps.meep-gis-engine - sandbox.go-apps.meep-loc-serv - packages.go-packages.meep-loc-serv-notification-client - sandbox.go-apps.meep-rnis - packages.go-packages.meep-rnis-notification-client - sandbox.go-apps.meep-wais Loading Loading @@ -660,13 +659,6 @@ repo: src: go-packages/meep-loc-serv-client # supports linting lint: false meep-loc-serv-notification-client: # location of source code src: go-packages/meep-loc-serv-notification-client # supports linting lint: false # location of API specification api: go-packages/meep-loc-serv-notification-client/api/swagger.yaml meep-logger: # location of source code src: go-packages/meep-logger Loading
go-apps/meep-loc-serv/go.mod +0 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-gis-cache v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 Loading @@ -25,7 +24,6 @@ replace ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model => ../../go-packages/meep-data-model github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-gis-cache => ../../go-packages/meep-gis-cache github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger => ../../go-packages/meep-http-logger github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client => ../../go-packages/meep-loc-serv-notification-client github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger => ../../go-packages/meep-logger github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store => ../../go-packages/meep-metric-store github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model => ../../go-packages/meep-model Loading
go-apps/meep-loc-serv/server/loc-serv.go +65 −62 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package server import ( "context" "bytes" "encoding/json" "errors" "fmt" Loading @@ -32,7 +32,6 @@ import ( sbi "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/sbi" dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr" httpLog "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger" clientNotifOMA "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" redis "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis" sm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" Loading Loading @@ -193,19 +192,6 @@ func Stop() (err error) { return sbi.Stop() } func createClient(notifyPath string) (*clientNotifOMA.APIClient, error) { // Create & store client for App REST API subsAppClientCfg := clientNotifOMA.NewConfiguration() subsAppClientCfg.BasePath = notifyPath subsAppClient := clientNotifOMA.NewAPIClient(subsAppClientCfg) if subsAppClient == nil { log.Error("Failed to create Subscription App REST API client: ", subsAppClientCfg.BasePath) err := errors.New("Failed to create Subscription App REST API client") return nil, err } return subsAppClient, nil } func deregisterZoneStatus(subsIdStr string) { subsId, err := strconv.Atoi(subsIdStr) if err != nil { Loading Loading @@ -392,7 +378,7 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn subscription := convertJsonToZoneStatusSubscription(jsonInfo) var zoneStatusNotif clientNotifOMA.ZoneStatusNotification var zoneStatusNotif ZoneStatusNotification zoneStatusNotif.ZoneId = zoneId if apWarning { zoneStatusNotif.AccessPointId = apId Loading @@ -401,8 +387,13 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn if zoneWarning { zoneStatusNotif.NumberOfUsersInZone = (int32)(nbUsersInZone) } zoneStatusNotif.Timestamp = time.Now() sendStatusNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zoneStatusNotif) seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zoneStatusNotif.Timestamp = ×tamp var inlineZoneStatusNotification InlineZoneStatusNotification inlineZoneStatusNotification.ZoneStatusNotification = &zoneStatusNotif sendStatusNotification(subscription.CallbackReference.NotifyURL, inlineZoneStatusNotification) if apWarning { log.Info("Zone Status Notification" + "(" + subsIdStr + "): " + "For event in zone " + zoneId + " which has " + nbUsersInAPStr + " users in AP " + apId) } else { Loading Loading @@ -430,9 +421,12 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI subscription := convertJsonToUserSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.Address = userId zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator Loading @@ -442,20 +436,24 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI if userSubscriptionLeavingMap[subsId] != "" { zonal.ZoneId = oldZoneId zonal.CurrentAccessPointId = oldApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.LEAVING_UserEventType event := new(UserEventType) *event = LEAVING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + "Leaving event in zone " + oldZoneId + " for user " + userId) } } if userSubscriptionEnteringMap[subsId] != "" && newZoneId != "" { zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.ENTERING_UserEventType event := new(UserEventType) *event = ENTERING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + "Entering event in zone " + newZoneId + " for user " + userId) } Loading @@ -465,10 +463,12 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.PreviousAccessPointId = oldApId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.TRANSFERRING_UserEventType event := new(UserEventType) *event = TRANSFERRING_EVENT zonal.UserEventType = event sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("User Notification" + "(" + subsIdStr + "): " + " Transferring event within zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId) } } Loading @@ -477,21 +477,15 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI } } func sendNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.TrackingNotification) { func sendZonalPresenceNotification(notifyUrl string, notification InlineZonalPresenceNotification) { startTime := time.Now() client, err := createClient(notifyUrl) jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err) return } jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err.Error()) } resp, err := client.NotificationsApi.PostTrackingNotification(ctx, subscriptionId, notification) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) _ = httpLog.LogTx(notifyUrl, "POST", string(jsonNotif), resp, startTime) if err != nil { log.Error(err) Loading @@ -500,21 +494,15 @@ func sendNotification(notifyUrl string, ctx context.Context, subscriptionId stri defer resp.Body.Close() } func sendStatusNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.ZoneStatusNotification) { func sendStatusNotification(notifyUrl string, notification InlineZoneStatusNotification) { startTime := time.Now() client, err := createClient(notifyUrl) jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err) return } jsonNotif, err := json.Marshal(notification) if err != nil { log.Error(err.Error()) } resp, err := client.NotificationsApi.PostZoneStatusNotification(ctx, subscriptionId, notification) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonNotif)) _ = httpLog.LogTx(notifyUrl, "POST", string(jsonNotif), resp, startTime) if err != nil { log.Error(err) Loading Loading @@ -542,16 +530,21 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI if jsonInfo != "" { subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.ENTERING_UserEventType event := new(UserEventType) *event = ENTERING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Entering event in zone " + newZoneId + " for user " + userId) } } Loading @@ -564,17 +557,22 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI if jsonInfo != "" { subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = newZoneId zonal.CurrentAccessPointId = newApId zonal.PreviousAccessPointId = oldApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.TRANSFERRING_UserEventType event := new(UserEventType) *event = TRANSFERRING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Transferring event in zone " + newZoneId + " for user " + userId + " from Ap " + oldApId + " to " + newApId) } } Loading @@ -590,16 +588,21 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI subscription := convertJsonToZonalSubscription(jsonInfo) var zonal clientNotifOMA.TrackingNotification var zonal ZonalPresenceNotification zonal.ZoneId = oldZoneId zonal.CurrentAccessPointId = oldApId zonal.Address = userId event := new(clientNotifOMA.UserEventType) *event = clientNotifOMA.LEAVING_UserEventType event := new(UserEventType) *event = LEAVING_EVENT zonal.UserEventType = event zonal.Timestamp = time.Now() seconds := time.Now().Unix() var timestamp TimeStamp timestamp.Seconds = int32(seconds) zonal.Timestamp = ×tamp zonal.CallbackData = subscription.ClientCorrelator sendNotification(subscription.CallbackReference.NotifyURL, context.TODO(), subsIdStr, zonal) var inlineZonal InlineZonalPresenceNotification inlineZonal.ZonalPresenceNotification = &zonal sendZonalPresenceNotification(subscription.CallbackReference.NotifyURL, inlineZonal) log.Info("Zonal Notify Leaving event in zone " + oldZoneId + " for user " + userId) } } Loading
go-apps/meep-loc-serv/server/loc-serv_test.go +10 −10 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import ( "testing" "time" locNotif "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" ms "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store" mod "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model" Loading Loading @@ -1829,12 +1828,12 @@ func TestUserSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } var notification locNotif.TrackingNotification err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) var inlineZonalPresenceNotification InlineZonalPresenceNotification err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification := inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1951,12 +1950,12 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } var notification locNotif.TrackingNotification err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) var inlineZonalPresenceNotification InlineZonalPresenceNotification err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification := inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading @@ -1968,11 +1967,11 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification = inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId != notification.ZoneId || expectedPoa != notification.CurrentAccessPointId || expectedAddr != notification.Address { t.Fatalf("Failed to get expected response") } Loading @@ -1984,11 +1983,12 @@ func TestZoneSubscriptionNotification(t *testing.T) { t.Fatalf("Failed to get metric") } err = json.Unmarshal([]byte(httpLog[0].Body), ¬ification) err = json.Unmarshal([]byte(httpLog[0].Body), &inlineZonalPresenceNotification) if err != nil { t.Fatalf("Failed to get expected response") } notification = inlineZonalPresenceNotification.ZonalPresenceNotification if expectedZoneId2 != notification.ZoneId || expectedPoa2 != notification.CurrentAccessPointId || expectedAddr2 != notification.Address { t.Fatalf("Failed to get expected response") } Loading
go-apps/meep-platform-ctrl/go.mod +2 −1 Original line number Diff line number Diff line Loading @@ -13,13 +13,14 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users v0.0.0 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/google/go-github v17.0.0+incompatible github.com/google/go-querystring v1.0.0 // indirect github.com/gorilla/handlers v1.4.0 github.com/gorilla/mux v1.7.4 github.com/roymx/viper v1.3.3-0.20190416163942-b9a223fc58a3 github.com/xanzy/go-gitlab v0.39.0 golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 google.golang.org/protobuf v1.25.0 // indirect ) replace ( Loading