Skip to content

Commit

Permalink
fix: flow rules and & add Precedence attribute (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn authored May 25, 2023
1 parent 12bce4f commit 14b9be3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 31 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ run:
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- "api_.*\\.go$"
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,18 @@ let subModalSchema = {
$ref: "#/definitions/IPFilter",
title: "IP Filter"
},
precedence: {
type: "integer",
title: "Precedence",
minimum: 1,
maximum: 256,
default: 128,
},
"5qi": {
type: "integer",
minimum: 0,
maximum: 255,
title: "5QI"
title: "5QI",
},
gbrUL: {
$ref: "#/definitions/bitRate",
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/pages/Subscribers/SubscriberOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ class SubscriberOverview extends Component {
let i = 0;
subscriber.QosFlows.forEach(QosFlow => {
if (QosFlow.snssai === FlowRule.snssai &&
QosFlow.dnn === FlowRule.dnn &&
QosFlow["5qi"] === FlowRule.qfi) {
QosFlow.dnn === FlowRule.dnn &&
QosFlow["5qi"] === FlowRule.qfi)
{
if (origiData.QosFlows[i].flowRules === undefined) {
origiData.QosFlows[i].flowRules = [];
}
origiData.QosFlows[i].flowRules.push(Object.assign({ precedence: FlowRule.precedence, filter: FlowRule.filter }))
origiData.QosFlows[i].flowRules.push(Object.assign(
{
precedence: FlowRule.precedence,
filter: FlowRule.filter,
},
FlowRule
))
}
i++;
})
Expand Down
65 changes: 39 additions & 26 deletions frontend/src/pages/Subscribers/components/SubscriberModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,35 +93,50 @@ function smDatasFromSliceConfiguration(sliceConfiguration) {

function qosFlowsFromSliceConfiguration(sliceConfigurations) {
var qosFlows = [];
sliceConfigurations.forEach(slice => {
slice.dnnConfigurations.forEach(dnn => {
if (dnn.qosFlows !== undefined) {
dnn.qosFlows.forEach(qosFlow => {
sliceConfigurations.forEach(sliceConfiguration => {
sliceConfiguration.dnnConfigurations.forEach(dnnConfiguration => {
if (dnnConfiguration.flowRules !== undefined) {
dnnConfiguration.flowRules.forEach(flowRule => {
qosFlows.push(
Object.assign({ snssai: snssaiToString(slice.snssai), dnn: dnn.dnn, qfi: qosFlow["5qi"] },
qosFlow))
Object.assign(
{
snssai: snssaiToString(sliceConfiguration.snssai),
dnn: dnnConfiguration.dnn,
qfi: flowRule["5qi"]
},
flowRule
)
)
})
}
})
})

return qosFlows
}

function flowRulesFromSliceConfiguration(sliceConfigurations) {
var flowRules = []
sliceConfigurations.forEach(slice => {
slice.dnnConfigurations.forEach(dnn => {
if (dnn.qosFlows !== undefined) {
dnn.qosFlows.forEach(qosFlow => {
if (qosFlow.flowRules !== undefined) {
qosFlow.flowRules.forEach(flowRule => {
flowRules.push(Object.assign({ snssai: snssaiToString(slice.snssai), dnn: dnn.dnn, qfi: qosFlow["5qi"] }, flowRule))
})
}
sliceConfigurations.forEach(sliceConfiguration => {
sliceConfiguration.dnnConfigurations.forEach(dnnConfiguration => {
if (dnnConfiguration.flowRules !== undefined){
dnnConfiguration.flowRules.forEach(flowRule => {
flowRules.push(
Object.assign(
{
filter: flowRule.filter,
precedence: flowRule.precedence,
snssai: snssaiToString(sliceConfiguration.snssai),
dnn: dnnConfiguration.dnn,
qfi: flowRule["5qi"],
}
)
)
})
}
})
})

return flowRules
}

Expand Down Expand Up @@ -156,10 +171,10 @@ function sliceConfigurationsFromSubscriber(subscriber) {
const dnnConfigs = sessionManagementSubscriptionData.find(data => data.singleNssai.sst === sliceConf.snssai.sst && data.singleNssai.sd === sliceConf.snssai.sd).dnnConfigurations;
sliceConf.dnnConfigurations = Object.keys(dnnConfigs).map(dnn => {

let qosFlows = [];
let flowRules = [];
const qosFlowsData = subscriber["QosFlows"];
if (qosFlowsData && qosFlowsData.length !== 0) {
qosFlows = qosFlowsData
flowRules = qosFlowsData
.filter(rule => rule.snssai === snssaiToString(sliceConf.snssai) && dnn === rule.dnn)
.map(rule => {
return {
Expand All @@ -168,14 +183,12 @@ function sliceConfigurationsFromSubscriber(subscriber) {
gbrDL: rule.gbrDL,
mbrUL: rule.mbrUL,
mbrDL: rule.mbrDL,
flowRules: rule.flowRules
precedence: rule.flowRules[0].precedence,
filter: rule.flowRules[0].filter
}
})
}




let staticIps = "";
const staticIpAddress = dnnConfigs[dnn].staticIpAddress
if (staticIpAddress && staticIpAddress.length !== 0) {
Expand All @@ -190,7 +203,7 @@ function sliceConfigurationsFromSubscriber(subscriber) {
uplinkAmbr: dnnConfigs[dnn].sessionAmbr.uplink,
downlinkAmbr: dnnConfigs[dnn].sessionAmbr.downlink,
"5qi": dnnConfigs[dnn]["5gQosProfile"]["5qi"],
qosFlows: qosFlows,
flowRules: flowRules, // new
upSecurityChk: true,
upIntegrity: dnnConfigs[dnn].upSecurity.upIntegr,
upConfidentiality: dnnConfigs[dnn].upSecurity.upConfid
Expand All @@ -202,11 +215,11 @@ function sliceConfigurationsFromSubscriber(subscriber) {
uplinkAmbr: dnnConfigs[dnn].sessionAmbr.uplink,
downlinkAmbr: dnnConfigs[dnn].sessionAmbr.downlink,
"5qi": dnnConfigs[dnn]["5gQosProfile"]["5qi"],
qosFlows: qosFlows
flowRules: flowRules // new
};
});
});

return sliceConfigurations;
}

Expand Down Expand Up @@ -344,8 +357,8 @@ class SubscriberModal extends Component {
"subscribedSnssaiInfos": _.fromPairs(
_.map(formData["sliceConfigurations"], slice => [snssaiToString(slice.snssai),
{
"dnnInfos": _.map(slice.dnnConfigurations, dnnCofig => {
return { "dnn": dnnCofig.dnn }
"dnnInfos": _.map(slice.dnnConfigurations, dnnConfig => {
return { "dnn": dnnConfig.dnn }
})
}]))
},
Expand Down

0 comments on commit 14b9be3

Please sign in to comment.