Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev configpod logs #47

Merged
merged 2 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions configapi/api_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
package configapi

import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/omec-project/webconsole/backend/logger"
"github.com/omec-project/webconsole/configmodels"
"net/http"
)

// DeviceGroupGroupNameDelete -
func DeviceGroupGroupNameDelete(c *gin.Context) {
logger.ConfigLog.Infof("DeviceGroupGroupNameDelete")
logger.ConfigLog.Debugf("DeviceGroupGroupNameDelete")
if ret := DeviceGroupDeleteHandler(c); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand All @@ -33,7 +34,7 @@ func DeviceGroupGroupNameDelete(c *gin.Context) {

// DeviceGroupGroupNamePut -
func DeviceGroupGroupNamePut(c *gin.Context) {
logger.ConfigLog.Infof("DeviceGroupGroupNamePut")
logger.ConfigLog.Debugf("DeviceGroupGroupNamePut")
if ret := DeviceGroupPostHandler(c, configmodels.Put_op); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand All @@ -43,13 +44,13 @@ func DeviceGroupGroupNamePut(c *gin.Context) {

// DeviceGroupGroupNamePatch -
func DeviceGroupGroupNamePatch(c *gin.Context) {
logger.ConfigLog.Infof("DeviceGroupGroupNamePatch")
logger.ConfigLog.Debugf("DeviceGroupGroupNamePatch")
c.JSON(http.StatusOK, gin.H{})
}

// DeviceGroupGroupNamePost -
func DeviceGroupGroupNamePost(c *gin.Context) {
logger.ConfigLog.Infof("DeviceGroupGroupNamePost")
logger.ConfigLog.Debugf("DeviceGroupGroupNamePost")
if ret := DeviceGroupPostHandler(c, configmodels.Post_op); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand All @@ -59,7 +60,7 @@ func DeviceGroupGroupNamePost(c *gin.Context) {

// NetworkSliceSliceNameDelete -
func NetworkSliceSliceNameDelete(c *gin.Context) {
logger.ConfigLog.Infof("Received NetworkSliceSliceNameDelete ")
logger.ConfigLog.Debugf("Received NetworkSliceSliceNameDelete ")
if ret := NetworkSliceDeleteHandler(c); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand All @@ -69,7 +70,7 @@ func NetworkSliceSliceNameDelete(c *gin.Context) {

// NetworkSliceSliceNamePost -
func NetworkSliceSliceNamePost(c *gin.Context) {
logger.ConfigLog.Infof("Received NetworkSliceSliceNamePost ")
logger.ConfigLog.Debugf("Received NetworkSliceSliceNamePost ")
if ret := NetworkSlicePostHandler(c, configmodels.Post_op); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand All @@ -79,7 +80,7 @@ func NetworkSliceSliceNamePost(c *gin.Context) {

// NetworkSliceSliceNamePut -
func NetworkSliceSliceNamePut(c *gin.Context) {
logger.ConfigLog.Infof("Received NetworkSliceSliceNamePut ")
logger.ConfigLog.Debugf("Received NetworkSliceSliceNamePut ")
if ret := NetworkSlicePostHandler(c, configmodels.Put_op); ret == true {
c.JSON(http.StatusOK, gin.H{})
} else {
Expand Down
42 changes: 25 additions & 17 deletions configapi/api_slice_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
package configapi

import (
"encoding/json"
"strings"

"github.com/free5gc/http_wrapper"
"github.com/gin-gonic/gin"
"github.com/omec-project/webconsole/backend/logger"
"github.com/omec-project/webconsole/configmodels"
Expand All @@ -32,14 +32,14 @@ func DeviceGroupDeleteHandler(c *gin.Context) bool {
var groupName string
var exists bool
if groupName, exists = c.Params.Get("group-name"); exists {
configLog.Infof("Received group %v", groupName)
configLog.Infof("Received Delete Group %v from Roc/simapp", groupName)
}
var msg configmodels.ConfigMessage
msg.MsgType = configmodels.Device_group
msg.MsgMethod = configmodels.Delete_op
msg.DevGroupName = groupName
configChannel <- &msg
configLog.Infof("Delete message for device group %v to main config thread, message %v ", groupName, msg)
configLog.Infof("Suuccessfully Added Device Group [%v] with delete_op to config channel.", groupName)
return true

}
Expand All @@ -62,54 +62,58 @@ func DeviceGroupPostHandler(c *gin.Context, msgOp int) bool {
configLog.Infof(" err ", err)
return false
}
configLog.Infof("Printing request full after binding : %v", request)
req := http_wrapper.NewRequest(c.Request, request)
//configLog.Infof("Printing request full after binding : %v", request)
//req := http_wrapper.NewRequest(c.Request, request)

configLog.Infof("Printing request full : %+v", req)
thakurajayL marked this conversation as resolved.
Show resolved Hide resolved
/*configLog.Infof("Printing request full : %+v", req)
configLog.Infof("params : %v", req.Params)
configLog.Infof("Header : %v", req.Header)
configLog.Infof("Query : %v", req.Query)
configLog.Infof("Printing request body : %v", req.Body)
configLog.Infof("URL : %v ", req.URL)

procReq := req.Body.(configmodels.DeviceGroups)
ipdomain := procReq.IpDomainExpanded
configLog.Infof("Imsis.size : %v", len(procReq.Imsis))

for i := 0; i < len(procReq.Imsis); i++ {
configLog.Infof("Imsis : %v", procReq.Imsis[i])
}
configLog.Infof("IP Domain Name : %v", procReq.IpDomainName)
ipdomain := procReq.IpDomainExpanded
configLog.Infof("IP Domain details %v", ipdomain)
configLog.Infof(" dnn name : %v", ipdomain.Dnn)
configLog.Infof(" ue pool : %v", ipdomain.UeIpPool)
configLog.Infof(" dns Primary : %v", ipdomain.DnsPrimary)
configLog.Infof(" dns Secondary : %v", ipdomain.DnsSecondary)
configLog.Infof(" ip mtu : %v", ipdomain.Mtu)

configLog.Infof("Group %v ", groupName)
*/
var msg configmodels.ConfigMessage
msg.MsgType = configmodels.Device_group
msg.MsgMethod = msgOp
msg.DevGroup = &request
configLog.Infof("Group %v ", groupName)
msg.DevGroupName = groupName
b, err := json.MarshalIndent(msg, "", " ")
configLog.Infof("======== Device Group Msg Start========")
configLog.Infof(string(b))
configLog.Infof("======== Device Group Msg End========")
configChannel <- &msg
configLog.Infof("Post message for device group %v to main config thread, message %v ", groupName, msg)
configLog.Infof("Suuccessfully Added Device Group [%v] to config channel.", groupName)
return true
}

func NetworkSliceDeleteHandler(c *gin.Context) bool {
var sliceName string
var exists bool
if sliceName, exists = c.Params.Get("slice-name"); exists {
configLog.Infof("Received slice : %v", sliceName)
configLog.Infof("Received Deleted slice : %v from Roc/simapp", sliceName)
}
var msg configmodels.ConfigMessage
msg.MsgMethod = configmodels.Delete_op
msg.MsgType = configmodels.Network_slice
msg.SliceName = sliceName
configChannel <- &msg
configLog.Infof("Delete message for Slice %v to main config thread, message %v ", sliceName, msg)
configLog.Infof("Suuccessfully Added Device Group [%v] with delete_op to config channel.", sliceName)
return true
}

Expand All @@ -131,17 +135,16 @@ func NetworkSlicePostHandler(c *gin.Context, msgOp int) bool {
configLog.Infof(" err ", err)
return false
}
configLog.Infof("Printing request full after binding : %v ", request)
//configLog.Infof("Printing request full after binding : %v ", request)

req := http_wrapper.NewRequest(c.Request, request)
//req := http_wrapper.NewRequest(c.Request, request)

configLog.Infof("Printing request full : %v", req)
vthiruveedula marked this conversation as resolved.
Show resolved Hide resolved
/*configLog.Infof("Printing request full : %v", req)
configLog.Infof("params : %v ", req.Params)
configLog.Infof("Header : %v ", req.Header)
configLog.Infof("Query : %v ", req.Query)
configLog.Infof("Printing request body : %v ", req.Body)
configLog.Infof("URL : %v ", req.URL)

procReq := req.Body.(configmodels.Slice)

slice := procReq.SliceId
Expand Down Expand Up @@ -195,13 +198,18 @@ func NetworkSlicePostHandler(c *gin.Context, msgOp int) bool {
configLog.Infof("Site UPF : %v", site.Upf)
configLog.Infof(" upf-name : %v", site.Upf["upf-name"])
configLog.Infof(" upf-port : %v", site.Upf["upf-port"])
*/

var msg configmodels.ConfigMessage
msg.MsgMethod = msgOp
msg.MsgType = configmodels.Network_slice
msg.Slice = &request
msg.SliceName = sliceName
b, err := json.MarshalIndent(msg, "", " ")
configLog.Infof("======== Slice Info Start========")
configLog.Infof(string(b))
configLog.Infof("======== Slice Info End========")
configChannel <- &msg
configLog.Infof("Post message for Slice %v to main config thread, message %v ", sliceName, msg)
configLog.Infof("Suuccessfully Added Slice [%v] to config channel.", sliceName)
return true
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.14

require (
github.com/antonfisher/nested-logrus-formatter v1.3.0
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/free5gc/MongoDBLibrary v1.0.0
github.com/free5gc/http2_util v1.0.0
github.com/free5gc/logger_conf v1.0.0
Expand Down
Loading