Skip to content

Commit

Permalink
Merge branch 'onf-release3.0.5' of github.com:omec-project/webconsole…
Browse files Browse the repository at this point in the history
… into dev-imsiData-lock
  • Loading branch information
Vijaya Rani committed Oct 6, 2021
2 parents 798017e + 3d5f88a commit b2c53d5
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 58 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ LABEL maintainer="ONF <omec-dev@opennetworking.org>"
#RUN apt remove cmdtest yarn
RUN apt-get update
RUN apt-get -y install apt-transport-https ca-certificates
RUN apt-get -y upgrade
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg > pubkey.gpg
RUN apt-key add pubkey.gpg
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
Expand Down
4 changes: 4 additions & 0 deletions backend/webui_service/webui_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"github.com/omec-project/webconsole/configapi"
"github.com/omec-project/webconsole/configmodels"
gServ "github.com/omec-project/webconsole/proto/server"
_ "net/http/pprof"
_ "net/http"
)

type WEBUI struct{}
Expand Down Expand Up @@ -220,6 +222,8 @@ func (webui *WEBUI) Start() {
// this is to fetch existing config
go fetchConfigAdapater()

http.ListenAndServe("0.0.0.0:5001", nil)

select {}
}

Expand Down
8 changes: 4 additions & 4 deletions configapi/api_slice_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func DeviceGroupDeleteHandler(c *gin.Context) bool {
msg.MsgMethod = configmodels.Delete_op
msg.DevGroupName = groupName
configChannel <- &msg
configLog.Infof("Successfully posted message for device group %v to main config thread", groupName)
configLog.Infof("Delete message for device group %v to main config thread, message %v ", groupName, msg)
return true

}
Expand Down Expand Up @@ -92,7 +92,7 @@ func DeviceGroupPostHandler(c *gin.Context, msgOp int) bool {
configLog.Infof("Group %v ", groupName)
msg.DevGroupName = groupName
configChannel <- &msg
configLog.Infof("Successfully posted message for device group %v to main config thread", groupName)
configLog.Infof("Post message for device group %v to main config thread, message %v ", groupName, msg)
return true
}

Expand All @@ -107,7 +107,7 @@ func NetworkSliceDeleteHandler(c *gin.Context) bool {
msg.MsgType = configmodels.Network_slice
msg.SliceName = sliceName
configChannel <- &msg
configLog.Infof("Slice Delete - Successfully posted message for slice %v to main config thread", sliceName)
configLog.Infof("Delete message for Slice %v to main config thread, message %v ", sliceName, msg)
return true
}

Expand Down Expand Up @@ -200,6 +200,6 @@ func NetworkSlicePostHandler(c *gin.Context, msgOp int) bool {
msg.Slice = &request
msg.SliceName = sliceName
configChannel <- &msg
configLog.Infof("Successfully posted message for slice %v to main config thread", sliceName)
configLog.Infof("Post message for Slice %v to main config thread, message %v ", sliceName, msg)
return true
}
3 changes: 3 additions & 0 deletions configapi/api_sub_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ func PostSubscriberByID(c *gin.Context) {
AuthSubData: &authSubsData,
Imsi: ueId}
configChannel <- &msg
logger.WebUILog.Infoln("Post Subscriber Data complete")
}

// Put subscriber by IMSI(ueId) and PlmnID(servingPlmnId)
Expand All @@ -410,6 +411,7 @@ func PutSubscriberByID(c *gin.Context) {
AuthSubData: &subsData.AuthenticationSubscription,
Imsi: ueId}
configChannel <- &msg
logger.WebUILog.Infoln("Put Subscriber Data complete")
}

// Patch subscriber by IMSI(ueId) and PlmnID(servingPlmnId)
Expand Down Expand Up @@ -475,6 +477,7 @@ func DeleteSubscriberByID(c *gin.Context) {
MsgMethod: configmodels.Delete_op,
Imsi: ueId}
configChannel <- &msg
logger.WebUILog.Infoln("Delete Subscriber Data complete")
}

func GetRegisteredUEContext(c *gin.Context) {
Expand Down
47 changes: 47 additions & 0 deletions configmodels/model_application_filtering_rules.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
//
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

/*
* Connectivity Service Configuration
*
* APIs to configure connectivity service in Aether Network
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package configmodels

type SliceApplicationFilteringRules struct {

// Rule name
RuleName string `json:"rule-name,omitempty"`

//priority
Priority int32 `json:"priority,omitempty"`

//action
Action string `json:"action,omitempty"`

// Application Desination IP or network
Endpoint string `json:"endpoint,omitempty"`

//protocol
Protocol int32 `json:"protocol,omitempty"`

// port range start
StartPort int32 `json:"start-port,omitempty"`

// port range end
EndPort int32 `json:"end-port,omitempty"`

AppMbrUplink int32 `json:"app-mbr-uplink,omitempty"`

AppMbrDownlink int32 `json:"app-mbr-downlink,omitempty"`

TrafficClass string `json:"traffic-class,omitempty"`

RuleTrigger string `json:"rule-trigger,omitempty"`
}
3 changes: 2 additions & 1 deletion configmodels/model_device_groups_ip_domain_expanded.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package configmodels

// DeviceGroupsIpDomainExpanded - This is APN for device
type DeviceGroupsIpDomainExpanded struct {

Dnn string `json:"dnn,omitempty"`

UeIpPool string `json:"ue-ip-pool,omitempty"`

DnsPrimary string `json:"dns-primary,omitempty"`

Mtu int32 `json:"mtu,omitempty"`

ApnQos ApnAmbrQosInfo `json:"dnn-qos,omitempty"`
}
5 changes: 4 additions & 1 deletion configmodels/model_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
package configmodels

type Slice struct {

SliceId SliceSliceId `json:"slice-id,omitempty"`

Qos SliceQos `json:"qos,omitempty"`

ApnQos ApnAmbrQosInfo `json:"apn-ambr-qos,omitempty"`

SiteDeviceGroup []string `json:"site-device-group,omitempty"`

SiteInfo SliceSiteInfo `json:"site-info,omitempty"`

ApplicationFilteringRules []SliceApplicationFilteringRules `json:"application-filtering-rules,omitempty"`

DenyApplications []string `json:"deny-applications,omitempty"`

PermitApplications []string `json:"permit-applications,omitempty"`
Expand Down
21 changes: 21 additions & 0 deletions configmodels/model_slice_apn_ambr_qos.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
//
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

/*
* Connectivity Service Configuration
*
* APIs to configure connectivity service in Aether Network
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package configmodels

type ApnAmbrQosInfo struct {
Uplink int32 `json:"uplink-mbr,omitempty"`
Downlink int32 `json:"downlink-mbr,omitempty"`
TrafficClass string `json:"traffic-class,omitempty"`
}
134 changes: 86 additions & 48 deletions proto/server/clientEvtHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type selectionKeys struct {

type subSelectionRule struct {
Keys selectionKeys `json:"keys,omitempty"`
Priority int `json:"priority,omitempty"`
Priority int32 `json:"priority,omitempty"`
SelectedQoSProfile string `json:"selected-qos-profile,omitempty"`
SelectedUserPlaneProfile string `json:"selected-user-plane-profile,omitempty"`
SelectedApnProfile string `json:"selected-apn-profile,omitempty"`
Expand All @@ -96,8 +96,8 @@ type userPlaneProfile struct {
}

type qosProfile struct {
Qci int `json:"qci,omitempty"`
Arp int `json:"arp,omitempty"`
Qci int32 `json:"qci,omitempty"`
Arp int32 `json:"arp,omitempty"`
Ambr []int32 `json:"apn-ambr,omitempty"`
}

Expand Down Expand Up @@ -129,13 +129,13 @@ type ruleFlowInfo struct {
}

type arpInfo struct {
Priority int `json:"Priority-Level,omitempty"`
PreEmptCap int `json:"Pre-emption-Capability,omitempty"`
PreEmpVulner int `json:"Pre-emption-Vulnerability,omitempty"`
Priority int32 `json:"Priority-Level,omitempty"`
PreEmptCap int32 `json:"Pre-emption-Capability,omitempty"`
PreEmpVulner int32 `json:"Pre-emption-Vulnerability,omitempty"`
}

type ruleQosInfo struct {
Qci int `json:"QoS-Class-Identifier,omitempty"`
Qci int32 `json:"QoS-Class-Identifier,omitempty"`
Mbr_ul int32 `json:"Max-Requested-Bandwidth-UL,omitempty"`
Mbr_dl int32 `json:"Max-Requested-Bandwidth-DL,omitempty"`
Gbr_ul int32 `json:"Guaranteed-Bitrate-UL,omitempty"`
Expand All @@ -157,8 +157,8 @@ type pcrfRules struct {
}

type pcrfServices struct {
Qci int `json:"qci,omitempty"`
Arp int `json:"arp,omitempty"`
Qci int32 `json:"qci,omitempty"`
Arp int32 `json:"arp,omitempty"`
Ambr_ul int32 `json:"AMBR_UL,omitempty"`
Ambr_dl int32 `json:"AMBR_DL,omitempty"`
Rules []string `json:"service-activation-rules,omitempty"`
Expand Down Expand Up @@ -344,7 +344,7 @@ func clientEventMachine(client *clientNF) {
}

case configMsg := <-client.outStandingPushConfig:
client.clientLog.Infof("Received new configuration for Client %v ", client.id)
client.clientLog.Infof("Received new configuration for Client %v ", configMsg)
var lastDevGroup *configmodels.DeviceGroups

// update config snapshot
Expand Down Expand Up @@ -389,11 +389,17 @@ func clientEventMachine(client *clientNF) {
postConfigHss(client, lastDevGroup)
}
} else if client.id == "mme-app" || client.id == "mme-s1ap" {
postConfigMme(client)
if configMsg.Slice != nil || configMsg.DevGroup != nil {
postConfigMme(client)
}
} else if client.id == "pcrf" {
postConfigPcrf(client)
if configMsg.Slice != nil || configMsg.DevGroup != nil {
postConfigPcrf(client)
}
} else if client.id == "spgw" {
postConfigSpgw(client)
if configMsg.Slice != nil || configMsg.DevGroup != nil {
postConfigSpgw(client)
}
}
}

Expand Down Expand Up @@ -605,8 +611,7 @@ func postConfigHss(client *clientNF, lastDevGroup *configmodels.DeviceGroups) {
}
// qos profile
sqos := sliceConfig.Qos
config.Qci = 9
config.Arp = 1
config.Qci, config.Arp = parseTrafficClass(devGroup.IpDomainExpanded.ApnQos.TrafficClass)
config.AmbrUl = sqos.Uplink
config.AmbrDl = sqos.Downlink
client.clientLog.Infoln("DeviceGroup ", devGroup)
Expand Down Expand Up @@ -669,6 +674,21 @@ func postConfigHss(client *clientNF, lastDevGroup *configmodels.DeviceGroups) {
}
}

func parseTrafficClass(traffic string) (int32, int32) {
switch traffic {
case "silver":
return 9, 0x7D
case "platinum":
return 8, 0x7D
case "gold":
return 7, 0x7D
case "diamond":
return 6, 0x7D
default:
return 9, 0x7D
}
}

func postConfigPcrf(client *clientNF) {
client.clientLog.Infoln("Post configuration to Pcrf")
config := configPcrf{}
Expand All @@ -689,7 +709,6 @@ func postConfigPcrf(client *clientNF) {
rule := subSelectionRule{}
rule.Priority = 1
//apn profile
sqos := sliceConfig.Qos
for _, d := range sliceConfig.SiteDeviceGroup {
devGroup := client.devgroupsConfigClient[d]
if devGroup == nil {
Expand All @@ -702,38 +721,57 @@ func postConfigPcrf(client *clientNF) {
sgroup.Def_service = append(sgroup.Def_service, pcrfServiceName)
config.Policies.ServiceGroups[devGroup.IpDomainExpanded.Dnn] = sgroup
pcrfService := &pcrfServices{}
pcrfService.Qci = 9 /* map traffic class to QCI, ARP */
pcrfService.Arp = 1
pcrfService.Ambr_ul = sqos.Uplink
pcrfService.Ambr_dl = sqos.Downlink
ruleName := d + "-rule"
pcrfService.Rules = append(pcrfService.Rules, ruleName)
client.clientLog.Infoln("pcrf Service ", pcrfService.Rules)
config.Policies.Services[pcrfServiceName] = pcrfService
pcrfRule := &pcrfRules{}
ruledef := &pcrfRuledef{}
pcrfRule.Definitions = ruledef
ruledef.RuleName = ruleName
ruledef.FlowStatus = 2
ruleQInfo := &ruleQosInfo{}
ruledef.QosInfo = ruleQInfo
ruleQInfo.Qci = 9
ruleQInfo.Mbr_ul = sqos.Uplink
ruleQInfo.Mbr_dl = sqos.Downlink
ruleQInfo.Gbr_ul = 0
ruleQInfo.Gbr_dl = 0
ruleQInfo.ApnAmbrUl = sqos.Uplink
ruleQInfo.ApnAmbrDl = sqos.Downlink
arp := &arpInfo{}
arp.Priority = 1
arp.PreEmptCap = 1
arp.PreEmpVulner = 1
ruleQInfo.Arp = arp
ruleFInfo := &ruleFlowInfo{}
ruleFInfo.FlowDesc = "permit out ip from 0.0.0.0/0 to assigned"
ruleFInfo.FlowDir = 3
ruledef.FlowInfo = ruleFInfo
config.Policies.Rules[ruleName] = pcrfRule
pcrfService.Qci, pcrfService.Arp = parseTrafficClass(devGroup.IpDomainExpanded.ApnQos.TrafficClass) /* map traffic class to QCI, ARP */
pcrfService.Ambr_ul = devGroup.IpDomainExpanded.ApnQos.Uplink
pcrfService.Ambr_dl = devGroup.IpDomainExpanded.ApnQos.Downlink
if len(sliceConfig.ApplicationFilteringRules) == 0 {
app := configmodels.SliceApplicationFilteringRules{RuleName: "rule1", Priority: 1, Action: "permit", Endpoint: "0.0.0.0/0"}
sliceConfig.ApplicationFilteringRules = append(sliceConfig.ApplicationFilteringRules, app)
}
for _, app := range sliceConfig.ApplicationFilteringRules {
ruleName := d + app.RuleName
client.clientLog.Infoln("rulename ", ruleName)
pcrfService.Rules = append(pcrfService.Rules, ruleName)
client.clientLog.Infoln("pcrf Service ", pcrfService.Rules)
config.Policies.Services[pcrfServiceName] = pcrfService
pcrfRule := &pcrfRules{}
ruledef := &pcrfRuledef{}
pcrfRule.Definitions = ruledef
ruledef.RuleName = ruleName
ruledef.FlowStatus = 3 // disabled by default
if app.Action == "permit" {
ruledef.FlowStatus = 2
}
ruleQInfo := &ruleQosInfo{}
ruledef.QosInfo = ruleQInfo
var arpi int32
ruleQInfo.Qci, arpi = parseTrafficClass(app.TrafficClass)
ruleQInfo.Mbr_ul = app.AppMbrUplink
ruleQInfo.Mbr_dl = app.AppMbrDownlink
ruleQInfo.Gbr_ul = 0
ruleQInfo.Gbr_dl = 0
ruleQInfo.ApnAmbrUl = devGroup.IpDomainExpanded.ApnQos.Uplink
ruleQInfo.ApnAmbrDl = devGroup.IpDomainExpanded.ApnQos.Downlink
arp := &arpInfo{}
arp.Priority = (arpi & 0x3c) >> 2
arp.PreEmptCap = (arpi & 0x40) >> 6
arp.PreEmpVulner = arpi & 0x1
ruleQInfo.Arp = arp
ruleFInfo := &ruleFlowInfo{}
// permit out udp from 8.8.8.8/32 to assigned sport-dport
var desc string
if app.Protocol == 6 {
desc = "permit out tcp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
} else if app.Protocol == 17 {
desc = "permit out udp from " + app.Endpoint + " to assigned " + strconv.FormatInt(int64(app.StartPort), 10) + "-" + strconv.FormatInt(int64(app.EndPort), 10)
} else {
desc = "permit out ip from " + app.Endpoint + " to assigned"
}
ruleFInfo.FlowDesc = desc
ruleFInfo.FlowDir = 3
ruledef.FlowInfo = ruleFInfo
config.Policies.Rules[ruleName] = pcrfRule
}
}
}

Expand Down

0 comments on commit b2c53d5

Please sign in to comment.