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

SDCORE-841: Staging 5G UE is not getteing IP Address #25

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Changes from all commits
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
45 changes: 38 additions & 7 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"os/exec"
"os/signal"
"strconv"
"strings"
"sync"
"syscall"

Expand Down Expand Up @@ -434,13 +435,12 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p
//getting from sessionrule
qos.MaxbrUl = sessionRule.AuthSessAmbr.Uplink
qos.MaxbrDl = sessionRule.AuthSessAmbr.Downlink
qos.DefQosFlowIndication = true
}
rule.RefQosData = append(rule.RefQosData, qos.QosId)
if pccPolicy.QosDecs == nil {
pccPolicy.QosDecs = make(map[string]*models.QosData)
}
pccPolicy.QosDecs[qos.QosId] = &qos
//rule.RefQosData = append(rule.RefQosData, qos.QosId)
//if pccPolicy.QosDecs == nil {
// pccPolicy.QosDecs = make(map[string]*models.QosData)
//}
//pccPolicy.QosDecs[qos.QosId] = &qos
}
for _, pflow := range pccrule.FlowInfos {
var flow models.FlowInformation
Expand All @@ -458,15 +458,20 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p
} else if pflow.FlowDir == protos.PccFlowDirection_UNSPECIFIED {
flow.FlowDirection = models.FlowDirectionRm_UNSPECIFIED
}
if strings.HasSuffix(flow.FlowDescription, "any to assigned") ||
strings.HasSuffix(flow.FlowDescription, "any to assigned ") {
qos.DefQosFlowIndication = true
}
//traffic control info set based on flow at present
var tcData models.TrafficControlData
tcData.TcId = "TcId-" + pccrule.RuleId
tcData.TcId = "TcId-" + strconv.FormatInt(id, 10)

if pflow.FlowStatus == protos.PccFlowStatus_ENABLED {
tcData.FlowStatus = models.FlowStatus_ENABLED
} else if pflow.FlowStatus == protos.PccFlowStatus_DISABLED {
tcData.FlowStatus = models.FlowStatus_DISABLED
}

rule.RefTcData = append(rule.RefTcData, tcData.TcId)
if pccPolicy.TraffContDecs == nil {
pccPolicy.TraffContDecs = make(map[string]*models.TrafficControlData)
Expand All @@ -475,6 +480,15 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p

rule.FlowInfos = append(rule.FlowInfos, flow)
}
if pccPolicy.QosDecs == nil {
pccPolicy.QosDecs = make(map[string]*models.QosData)
}
if ok, q := findQosData(pccPolicy.QosDecs, qos); ok {
rule.RefQosData = append(rule.RefQosData, q.QosId)
} else {
rule.RefQosData = append(rule.RefQosData, qos.QosId)
pccPolicy.QosDecs[qos.QosId] = &qos
}
if pccPolicy.PccRules == nil {
pccPolicy.PccRules = make(map[string]*models.PccRule)
}
Expand All @@ -484,6 +498,23 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p
return
}

func findQosData(qosdecs map[string]*models.QosData, qos models.QosData) (bool, *models.QosData) {
for _, q := range qosdecs {
if q.Var5qi == qos.Var5qi && q.MaxbrUl == qos.MaxbrUl && q.MaxbrDl == qos.MaxbrDl &&
q.GbrUl == qos.GbrUl && q.GbrDl == qos.GbrDl && q.Qnc == qos.Qnc &&
q.PriorityLevel == qos.PriorityLevel && q.AverWindow == qos.AverWindow &&
q.MaxDataBurstVol == qos.MaxDataBurstVol && q.ReflectiveQos == qos.ReflectiveQos &&
q.SharingKeyDl == qos.SharingKeyDl && q.SharingKeyUl == qos.SharingKeyUl &&
q.MaxPacketLossRateDl == qos.MaxPacketLossRateDl && q.MaxPacketLossRateUl == qos.MaxPacketLossRateUl &&
q.DefQosFlowIndication == qos.DefQosFlowIndication {
if q.Arp != nil && qos.Arp != nil && *q.Arp == *qos.Arp {
return true, q
}
}
}
return false, nil
}

func UpdatePcfSubsriberPolicyData(slice *protos.NetworkSlice) {
self := context.PCF_Self()
sliceid := slice.Nssai.Sst + slice.Nssai.Sd
Expand Down