...@@ -45,6 +45,14 @@ repo: ...@@ -45,6 +45,14 @@ repo:
- -mod=vendor - -mod=vendor
codecov: true codecov: true
lint: true lint: true
meep-loc-serv:
src: go-apps/meep-loc-serv
bin: bin/meep-loc-serv
chart: charts/meep-loc-serv
build-flags:
- -mod=vendor
codecov: true
lint: true
meep-tc-engine: meep-tc-engine:
src: go-apps/meep-tc-engine src: go-apps/meep-tc-engine
bin: bin/meep-tc-engine bin: bin/meep-tc-engine
......
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
apiVersion: v1
appVersion: "1.0.0"
description: MEEP Location Service Helm chart for Kubernetes
name: meep-loc-serv
version: 1.0.0
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "meep-loc-serv.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "meep-loc-serv.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "meep-loc-serv.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: "{{ .Values.serviceAccount }}-{{ .Values.namespace }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount }}
namespace: {{ .Values.namespace }}
\ No newline at end of file
{{- if .Values.codecov.enabled}}
kind: PersistentVolume
apiVersion: v1
metadata:
name: meep-loc-serv-codecov-pv
spec:
storageClassName: meep-loc-serv-codecov-sc
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/home/englab/.meep/codecov/meep-loc-serv"
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: meep-loc-serv-codecov-sc
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: meep-loc-serv-codecov-pvc
spec:
storageClassName: meep-loc-serv-codecov-sc
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
{{- end}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "meep-loc-serv.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
app: {{ template "meep-loc-serv.name" . }}
chart: {{ template "meep-loc-serv.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
meepOrigin: {{ .Values.meepOrigin }}
spec:
replicas: {{ .Values.deployment.replicas }}
selector:
matchLabels:
app: {{ template "meep-loc-serv.name" . }}
release: {{ .Release.Name }}
template:
metadata:
namespace: {{ .Values.namespace }}
labels:
app: {{ template "meep-loc-serv.name" . }}
release: {{ .Release.Name }}
meepOrigin: {{ .Values.meepOrigin }}
spec:
serviceAccountName: {{ .Values.serviceAccount }}
{{- if .Values.codecov.enabled}}
volumes:
- name: codecov-storage
persistentVolumeClaim:
claimName: meep-loc-serv-codecov-pvc
{{- end}}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.codecov.enabled}}
command: [ "/meep-loc-serv" ]
args: [ "-test.coverprofile=/codecov/codecov-meep-loc-serv.out", "__DEVEL--code-cov" ]
{{- end}}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.deployment.port }}
protocol: {{ .Values.deployment.protocol }}
{{- if .Values.codecov.enabled}}
volumeMounts:
- name: codecov-storage
mountPath: /codecov
{{- end}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "meep-loc-serv.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
app: {{ template "meep-loc-serv.name" . }}
chart: {{ template "meep-loc-serv.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
meepOrigin: {{ .Values.meepOrigin }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ template "meep-loc-serv.name" . }}
release: {{ .Release.Name }}
ports:
- port: {{ .Values.deployment.port }}
targetPort: {{ .Values.service.targetPort }}
nodePort: {{ .Values.service.nodePort }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount }}
namespace: {{ .Values.namespace }}
# Default values for meep-loc-serv.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
namespace: default
serviceAccount: meep-loc-serv
deployment:
replicas: 1
port: 80
protocol: TCP
image:
repository: meep-loc-serv
tag: latest
pullPolicy: IfNotPresent
service:
type: NodePort
targetPort: 80
nodePort: 30007
codecov:
enabled: false
meepOrigin: core
...@@ -53,6 +53,7 @@ func getCorePodsList() map[string]bool { ...@@ -53,6 +53,7 @@ func getCorePodsList() map[string]bool {
"meep-webhook": false, "meep-webhook": false,
"meep-mg-manager": false, "meep-mg-manager": false,
"meep-mon-engine": false, "meep-mon-engine": false,
"meep-loc-serv": false,
"meep-tc-engine": false, "meep-tc-engine": false,
"meep-metricbeat": false, "meep-metricbeat": false,
"virt-engine": false, "virt-engine": false,
......
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
2.3.1
\ No newline at end of file
/*
* Copyright (c) 2019
* InterDigital Communications, Inc.
* All rights reserved.
*
* The information provided herein is the proprietary and confidential
* information of InterDigital Communications, Inc.
*/
package sbi
import (
"encoding/json"
"strings"
log "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/log"
db "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/redis2"
ceModel "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-ctrl-engine-model"
)
const basepathURL = "http://meep-loc-serv/etsi-013/location/v1/"
const moduleCtrlEngine string = "ctrl-engine"
const moduleLocServ string = "loc-serv"
const typeZone = "zone"
const typeAccessPoint = "accessPoint"
const typeUser = "user"
const typeActive = "active"
const channelCtrlActive string = moduleCtrlEngine + "-" + typeActive
const locServChannel string = moduleLocServ
// Init - Location Service initialization
func Init() (err error) {
// Connect to Redis DB
err = db.RedisDBConnect()
if err != nil {
log.Error("Failed connection to Active DB in sbi. Error: ", err)
return err
}
log.Info("Connected to Active DB in sbi")
// Subscribe to Pub-Sub events for MEEP Controller
// NOTE: Current implementation is RedisDB Pub-Sub
err = db.Subscribe(channelCtrlActive)
if err != nil {
log.Error("Failed to subscribe to Pub/Sub events. Error: ", err)
return err
}
go Run()
return nil
}
// Run - MEEP Location Service execution
func Run() {
// Listen for subscribed events. Provide event handler method.
_ = db.Listen(eventHandler)
}
func eventHandler(channel string, payload string) {
// Handle Message according to Rx Channel
switch channel {
// MEEP Ctrl Engine active scenario update Channel
case channelCtrlActive:
log.Debug("Event received on channel: ", channelCtrlActive)
processActiveScenarioUpdate()
default:
log.Warn("Unsupported channel")
}
}
func processActiveScenarioUpdate() {
// Retrieve active scenario from DB
jsonScenario, err := db.DBJsonGetEntry(moduleCtrlEngine+":"+typeActive, ".")
if err != nil {
log.Error(err.Error())
//scenario being terminated, we just clear every loc-service entries from the DB
db.RedisDBFlush(moduleLocServ)
return
}
// Unmarshal Active scenario
var scenario ceModel.Scenario
err = json.Unmarshal([]byte(jsonScenario), &scenario)
if err != nil {
log.Error(err.Error())
return
}
// Parse scenario
parseScenario(scenario)
}
func parseScenario(scenario ceModel.Scenario) {
log.Debug("parseScenario")
// Store scenario Name
//scenarioName := scenario.Name
// Parse Domains
for _, domain := range scenario.Deployment.Domains {
// Parse Zones
for _, zone := range domain.Zones {
nbZoneUsers := 0
nbAccessPoints := 0
// Parse Network Locations
for _, nl := range zone.NetworkLocations {
nbApUsers := 0
// Parse Physical locations
for _, pl := range nl.PhysicalLocations {
// Parse Processes
for _, proc := range pl.Processes {
switch pl.Type_ {
case "UE":
oldZoneId, oldApId := getCurrentUserLocation(proc.Name)
updateUserInfo(proc.Name, zone.Name, nl.Name, basepathURL + "users/" + proc.Name)
nbApUsers++
_ = db.RedisDBPublish(locServChannel, oldZoneId+":"+zone.Name+":"+oldApId+":"+nl.Name+":"+proc.Name)
default:
}
}
}
switch nl.Type_ {
case "POA":
updateAccessPointInfo(zone.Name, nl.Name, WIFI, SERVICEABLE, nbApUsers, basepathURL + "zones/" + zone.Name + "/accessPoints/" + nl.Name)
nbAccessPoints++
nbZoneUsers += nbApUsers
default:
}
}
updateZoneInfo(zone.Name, nbAccessPoints, 0, nbZoneUsers, basepathURL + "zones/" + zone.Name )
}
}
}
func createUserInfo(address string, zoneId string, accessPointId string, resourceName string) {
userInfo := new(UserInfo)
userInfo.Address = address
userInfo.ZoneId = zoneId
userInfo.AccessPointId = accessPointId
userInfo.ResourceURL = resourceName
//unsued optional attributes
//userInfo.LocationInfo.Latitude,
//userInfo.LocationInfo.Longitude,
//userInfo.LocationInfo.Altitude,
//userInfo.LocationInfo.Accuracy,
//userInfo.ContextLocationInfo,
//userInfo.AncillaryInfo)
//update DB
db.DbJsonSet(address, convertUserInfoToJson(userInfo), moduleLocServ+":"+typeUser)
}
func getCurrentUserLocation(resourceName string) (string, string) {
jsonUserInfo := db.DbJsonGet(resourceName, moduleLocServ+":"+typeUser)
if jsonUserInfo != "" {
// Unmarshal UserInfo
var userInfo UserInfo
err := json.Unmarshal([]byte(jsonUserInfo), &userInfo)
if err == nil {
return userInfo.ZoneId, userInfo.AccessPointId
} else {
log.Error(err.Error())
}
}
return "", ""
}
func updateUserInfo(address string, zoneId string, accessPointId string, resourceName string) {
//get from DB
jsonUserInfo := db.DbJsonGet(address, moduleLocServ+":"+typeUser)
if jsonUserInfo != "" {
// Unmarshal UserInfo
var userInfo UserInfo
if zoneId != "" {
userInfo.ZoneId = zoneId
}
if accessPointId != "" {
userInfo.AccessPointId = accessPointId
}
//updateDB
db.DbJsonSet(address, jsonUserInfo/*convertUserInfoToJson(&userInfo)*/, moduleLocServ+":"+typeUser)
} else {
createUserInfo(address, zoneId, accessPointId, resourceName)
}
}
/* unused
func deleteUserInfo(address string) {
//delete from DB
_ = db.DbJsonDelete(address, moduleLocServ + ":" + typeUser)
}
*/
func createZoneInfo(zoneId string, nbAccessPoints int, nbUnsrvAccessPoints int, nbUsers int, resourceName string) {
zoneInfo := new(ZoneInfo)
zoneInfo.ZoneId = zoneId
zoneInfo.ResourceURL = resourceName
zoneInfo.NumberOfAccessPoints = uint32(nbAccessPoints)
zoneInfo.NumberOfUnservicableAccessPoints = uint32(nbUnsrvAccessPoints)
zoneInfo.NumberOfUsers = uint32(nbUsers)
//update DB
db.DbJsonSet(zoneId, convertZoneInfoToJson(zoneInfo), moduleLocServ+":"+typeZone)
}
func updateZoneInfo(zoneId string, nbAccessPoints int, nbUnsrvAccessPoints int, nbUsers int, resourceName string) {
if zoneId != "" && !strings.Contains(zoneId, "-COMMON") {
//get from DB
jsonZoneInfo := db.DbJsonGet(zoneId, moduleLocServ+":"+typeZone)
if jsonZoneInfo != "" {
// Unmarshal UserInfo
var zoneInfo ZoneInfo
if nbAccessPoints != -1 {
zoneInfo.NumberOfAccessPoints = uint32(nbAccessPoints)
}
if nbUnsrvAccessPoints != -1 {
zoneInfo.NumberOfUnservicableAccessPoints = uint32(nbUnsrvAccessPoints)
}
if nbUsers != -1 {
zoneInfo.NumberOfUsers = uint32(nbUsers)
}
//updateDB
db.DbJsonSet(zoneId, convertZoneInfoToJson(&zoneInfo), moduleLocServ+":"+typeZone)
} else {
createZoneInfo(zoneId, nbAccessPoints, nbUnsrvAccessPoints, nbUsers, resourceName)
}
}
}
/* unused
func deleteZoneInfo(zoneId string) {
//delete from DB
_ = db.DbJsonDelete(zoneId, moduleLocServ + ":" + typeZone)
}
*/
func createAccessPointInfo(zoneId string, apId string, conType ConnectionType, opStatus OperationStatus, nbUsers uint32, resourceName string) {
apInfo := new(AccessPointInfo)
apInfo.AccessPointId = apId
apInfo.ResourceURL = resourceName
apInfo.ConnectionType = &conType
apInfo.OperationStatus = &opStatus
apInfo.NumberOfUsers = nbUsers
//unsued optional attributes
//apInfo.LocationInfo.Latitude
//apInfo.LocationInfo.Longitude
//apInfo.LocationInfo.Altitude
//apInfo.LocationInfo.Accuracy
//apInfo.Timezone
//apInfo.InterestRealm
//update DB
db.DbJsonSet(apId, convertAccessPointInfoToJson(apInfo), moduleLocServ+":"+typeZone+":"+zoneId+":"+typeAccessPoint)
}
func updateAccessPointInfo(zoneId string, apId string, conType ConnectionType, opStatus OperationStatus, nbUsers int, resourceName string) {
//get from DB
jsonApInfo := db.DbJsonGet(apId, moduleLocServ+":"+typeZone+":"+zoneId+":"+typeAccessPoint)
if jsonApInfo != "" {
// Unmarshal UserInfo
var apInfo AccessPointInfo
if opStatus != "" {
apInfo.OperationStatus = &opStatus
}
if nbUsers != -1 {
apInfo.NumberOfUsers = uint32(nbUsers)
}
//updateDB
db.DbJsonSet(apId, jsonApInfo/*convertAccessPointInfoToJson(&apInfo)*/, moduleLocServ+":"+typeZone+":"+zoneId+":"+typeAccessPoint)
} else {
//update DB
createAccessPointInfo(zoneId, apId, conType, opStatus, uint32(nbUsers), resourceName)
}
}
/* unused
func deleteAccessPointInfo(zoneId string, apId string) {
//delete from DB
_ = db.DbJsonDelete(apId, moduleLocServ + ":" + typeZone + ":" + zoneId + ":" + typeAccessPoint)
}
*/
# Copyright (c) 2019
# InterDigital Communications, Inc.
# All rights reserved.
#
# The information provided herein is the proprietary and confidential
# information of InterDigital Communications, Inc.
FROM debian:9.6-slim
COPY ./meep-loc-serv /meep-loc-serv
ENTRYPOINT /meep-loc-serv
This diff is collapsed.
module github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv
go 1.12
require (
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-ctrl-engine-model v0.0.0
github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client v0.0.0
github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db // indirect
github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351
github.com/flimzy/diff v0.1.5 // indirect
github.com/flimzy/kivik v1.8.1 // indirect
github.com/flimzy/testy v0.1.16 // indirect
github.com/go-kivik/couchdb v1.8.1 // indirect
github.com/go-redis/redis v6.15.2+incompatible
github.com/gogo/protobuf v1.2.1 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e // indirect
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.7.1
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/sirupsen/logrus v1.4.1
github.com/spf13/pflag v1.0.3 // indirect
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
k8s.io/api v0.0.0-20181204000039-89a74a8d264d // indirect
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93 // indirect
k8s.io/client-go v10.0.0+incompatible // indirect
k8s.io/klog v0.0.0-20181108234604-8139d8cb77af // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
)
replace github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-ctrl-engine-model => ../../go-packages/meep-ctrl-engine-model
replace github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-loc-serv-notification-client => ../../go-packages/meep-loc-serv-notification-client
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db h1:Zkf5kwhxdW0xV7WM/crqIcOP5LCFGnAmumWSFAewJ74=
github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db/go.mod h1:RU+6d0CNIRSp6yo1mXLIIrnFa/3LHhvcDVLVJyovptM=
github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351 h1:1u1XrfCBnY+GijnyU6O1k4odp5TnqZQTsp5v7+n/E4Y=
github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351/go.mod h1:HxwfbuElTuGf+/uKZfjJrCnv0BmmpkPJDI7gBwj1KkM=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/flimzy/diff v0.1.5/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
github.com/flimzy/kivik v1.8.1/go.mod h1:S2aPycbG0eDFll4wgXt9uacSNkXISPufutnc9sv+mdA=
github.com/flimzy/testy v0.1.16/go.mod h1:3szguN8NXqgq9bt9Gu8TQVj698PJWmyx/VY1frwwKrM=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-kivik/couchdb v1.8.1/go.mod h1:5XJRkAMpBlEVA4q0ktIZjUPYBjoBmRoiWvwUBzP3BOQ=
github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4=
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA=
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.1 h1:Dw4jY2nghMMRsh1ol8dv1axHkDwMQK2DHerMNJsIpJU=
github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a h1:Igim7XhdOpBnWPuYJ70XcNpq8q3BCACtVgNfoJxOV7g=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
k8s.io/api v0.0.0-20181204000039-89a74a8d264d h1:HQoGWsWUe/FmRcX9BU440AAMnzBFEf+DBo4nbkQlNzs=
k8s.io/api v0.0.0-20181204000039-89a74a8d264d/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93 h1:tT6oQBi0qwLbbZSfDkdIsb23EwaLY85hoAV4SpXfdao=
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/client-go v10.0.0+incompatible h1:F1IqCqw7oMBzDkqlcBymRq1450wD0eNqLE9jzUrIi34=
k8s.io/client-go v10.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/klog v0.0.0-20181108234604-8139d8cb77af h1:s6rm8OxBbyDNSRkpyAd5OL4icUdBICVw9+mFADa+t5E=
k8s.io/klog v0.0.0-20181108234604-8139d8cb77af/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
/*
* Copyright (c) 2019
* InterDigital Communications, Inc.
* All rights reserved.
*
* The information provided herein is the proprietary and confidential
* information of InterDigital Communications, Inc.
*/
package logmain
import (
log "github.com/sirupsen/logrus"
)
func MeepJSONLogInit() {
log.SetFormatter(&log.JSONFormatter{})
log.SetLevel(log.DebugLevel)
}
func Info(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Info(args...)
}
func Debug(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Debug(args...)
}
func Warn(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Warn(args...)
}
func Error(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Error(args...)
}
func Panic(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Panic(args...)
}
func Fatal(args ...interface{}) {
log.WithFields(log.Fields{
"meep.component": "loc-serv",
}).Fatal(args...)
}
func WithFields(fields log.Fields) *log.Entry {
return log.WithFields(fields)
}
/*
* Copyright (c) 2019
* InterDigital Communications, Inc.
* All rights reserved.
*
* The information provided herein is the proprietary and confidential
* information of InterDigital Communications, Inc.
*
************************ Based on ****************
*
* Location API
*
* The ETSI MEC ETSI MEC013 Location API described using OpenAPI. The API is based on the Open Mobile Alliance's specification RESTful Network API for Zonal Presence
*
* API version: 1.1.1
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package main
import (
"net/http"
"os"
"os/signal"
"syscall"
"time"
log "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/log"
server "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-loc-serv/server"
"github.com/gorilla/handlers"
)
func init() {
// Log as JSON instead of the default ASCII formatter.
log.MeepJSONLogInit()
}
func main() {
log.Info(os.Args)
log.Info("Starting Location Service")
run := true
go func() {
sigchan := make(chan os.Signal, 10)
signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)
<-sigchan
log.Info("Program killed !")
// do last actions and wait for all write operations to end
run = false
}()
go func() {
// Initialize Location Service
err := server.Init()
if err != nil {
log.Error("Failed to initialize Location Service")
run = false
return
}
// Start Location Service Event Handler thread
go server.Run()
// Start Location Service REST API Server
router := server.NewRouter()
methods := handlers.AllowedMethods([]string{"OPTIONS", "DELETE", "GET", "HEAD", "POST", "PUT"})
header := handlers.AllowedHeaders([]string{"content-type"})
log.Fatal(http.ListenAndServe(":80", handlers.CORS(methods, header)(router)))
run = false
}()
count := 0
for {
if !run {
log.Info("Ran for", count, "seconds")
break
}
time.Sleep(time.Second)
count++
}
}