This is a brief instruction on how to deploy pm-mapper in docker env and how to configure filters in pm-mapper
Prerequisite
- Docker
- make
- bash
- linux(ubuntu 18+)
...
Code Block | ||||
---|---|---|---|---|
| ||||
cd tools/development |
install dmappdmaap-dr, cbs, consul, files-publisher and dmaap-mr:
Code Block | ||||
---|---|---|---|---|
| ||||
make setup-local |
install pm-mapper:
Code Block | ||||
---|---|---|---|---|
| ||||
make run-pm-mapper |
After successful installation, we should see the docker containers:
...
Code Block | ||||
---|---|---|---|---|
| ||||
./send-meas-collec.sh A20181002.0000-1000-0015-1000_5G.xml.gz |
Configure filters
Clean env
...
Check logs on dmaap-mr:
Code Block | ||||
---|---|---|---|---|
| ||||
make clean-env |
Now we have network plugin enabled in k8s cluster, we can then apply network policy to NONRTRIC.
...
| |
docker logs mr-simulator |
We should be able to see a message like below:
After formatting:
Code Block | ||||
---|---|---|---|---|
| ||||
kubectl apply -f https://raw.githubusercontent.com/yanhuanwang/k8s/master/statefulset/nosdnc.yml |
after deployment, you should be able to see nonrtric services/pods are up and running:
pay attention to the labels above, in this demo we will use labels to define the network-policy rules.
Apply network-policy
| ||||||
{
"event":{
"commonEventHeader":{
"domain":"perf3gpp",
"eventId":"c1907362-1c65-41a1-b464-34b43fec7af1",
"sequence":0,
| ||||||
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
$ cat <<EOF | kubectl apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: test-network-policy namespace: nonrtric spec: podSelector: matchLabels: app: a1-sim policyTypes: - Ingress ingress: - from: "eventName":"perf3gpp_gnb-Nokia_pmMeasResult", "sourceName":"oteNB5309", - podSelector: "reportingEntityName":"", matchLabels:"priority":"Normal", app: policy-agent-container"startEpochMicrosec":951912000000, - from: - podSelector"lastEpochMicrosec":951912900000, matchLabels:"version":"4.0", app: a1-sim EOF |
The example policy above applies a rule on endpoint with lable "a1-sim", it only allows traffic coming from pod with labels "policy-agent-container" and "a1-sim".
Feel free to change the labels and apply it.
After successfully applying above policy, we login to pod "policy-agent-container-xxxxxx", command:
Code Block | ||
---|---|---|
| ||
kubectl -n nonrtric exec -it policy-agent-container-78d6b988c9-jnw42 -- sh
curl a1-interface-osc-0.a1-sim |
We should be able to see:
If we update labels in the above policy, for exemple:
Code Block | ||
---|---|---|
| ||
$ cat <<EOF | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: nonrtric
spec:
podSelector:
matchLabels:
app: a1-sim
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: policy-xxxx-container
- from:
- podSelector:
matchLabels:
app: a1-sim
EOF |
After applying this changed policy, we cannot access "a1-sim" endpoints from "policy-agent-container" anymore because the labels do not match.
...
"vesEventListenerVersion":"7.1",
"timeZoneOffset":"UTC+05.00"
},
"perf3gppFields":{
"perf3gppFieldsVersion":"1.0",
"measDataCollection":{
"granularityPeriod":951912870000,
"measuredEntityUserName":"RNC Telecomville",
"measuredEntityDn":"SubNetwork=CountryNN,MeContext=MEC-Gbg-1,ManagedElement=RNC-Gbg-1",
"measuredEntitySoftwareVersion":"",
"measInfoList":[
{
"measInfoId":{
"sMeasInfoId":""
},
"measTypes":{
"sMeasTypesList":[
"attTCHSeizures",
"succTCHSeizures",
"attImmediateAssignProcs",
"succImmediateAssignProcs"
]
},
"measValuesList":[
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-997",
"suspectFlag":"false",
"measResults":[
{
"p":1,
"sValue":"234"
},
{
"p":2,
"sValue":"345"
},
{
"p":3,
"sValue":"567"
},
{
"p":4,
"sValue":"789"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-998",
"suspectFlag":"false",
"measResults":[
{
"p":1,
"sValue":"890"
},
{
"p":2,
"sValue":"901"
},
{
"p":3,
"sValue":"123"
},
{
"p":4,
"sValue":"234"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-999",
"suspectFlag":"true",
"measResults":[
{
"p":1,
"sValue":"456"
},
{
"p":2,
"sValue":"567"
},
{
"p":3,
"sValue":"678"
},
{
"p":4,
"sValue":"789"
}
]
}
]
},
{
"measInfoId":{
"sMeasInfoId":"ENodeBFunction"
},
"measTypes":{
"sMeasTypesList":[
"attTCHSeizures1",
"succTCHSeizures2",
"attImmediateAssignProcs3",
"succImmediateAssignProcs4"
]
},
"measValuesList":[
{
"measObjInstId":"ManagedElement=RNC-Gbg-1,ENodeBFunction=1",
"suspectFlag":"false",
"measResults":[
{
"p":1,
"sValue":"4"
},
{
"p":2,
"sValue":"86,87,2,6,77,96,75,33,24"
},
{
"p":3,
"sValue":"40"
},
{
"p":4,
"sValue":"90"
}
]
}
]
},
{
"measInfoId":{
"sMeasInfoId":""
},
"measTypes":{
"sMeasTypesList":[
"attTCHSeizures5",
"succTCHSeizures6",
"attImmediateAssignProcs7",
"succImmediateAssignProcs8"
]
},
"measValuesList":[
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-997",
"suspectFlag":"false",
"measResults":[
{
"p":1,
"sValue":"238"
},
{
"p":2,
"sValue":"344"
},
{
"p":3,
"sValue":"563"
},
{
"p":4,
"sValue":"787"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-998",
"suspectFlag":"false",
"measResults":[
{
"p":1,
"sValue":"898"
},
{
"p":2,
"sValue":"905"
},
{
"p":3,
"sValue":"127"
},
{
"p":4,
"sValue":"238"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-999",
"suspectFlag":"true",
"measResults":[
{
"p":1,
"sValue":"454"
},
{
"p":2,
"sValue":"569"
},
{
"p":3,
"sValue":"672"
},
{
"p":4,
"sValue":"785"
}
]
}
]
}
]
}
}
}
} |
Pay attention to the "measTypes", we can see all four types now because we didn't configure any filters yet:
Configure filters
edit file "pm-mapper/tools/development/resources/config.json"
update the filters like below:
Code Block | ||||
---|---|---|---|---|
| ||||
"pm-mapper-filter": {
"filters":[{
"pmDefVsn": "1.0",
"nfType": "gnb",
"vendor": "Nokia",
"measTypes": ["succImmediateAssignProcs"]
}
]
} |
This filter will only receive pm counters with type "succImmediateAssignProcs"
Make the filter effective:
Code Block | ||||
---|---|---|---|---|
| ||||
curl 'http://localhost:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @config.json |
Wait for 60 seconds. pm-mapper reads the configuration from consul regularly every 60 seconds.
Then do the file publish again, and check logs:
Code Block | ||||
---|---|---|---|---|
| ||||
./send-meas-collec.sh A20181002.0000-1000-0015-1000_5G.xml.gz
docker logs mr-simulator |
Now we should see a different message like below:
After formatting:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{
"event":{
"commonEventHeader":{
"domain":"perf3gpp",
"eventId":"8ecb373a-0fc2-4a80-9eda-2a128f3ac727",
"sequence":0,
"eventName":"perf3gpp_gnb-Nokia_pmMeasResult",
"sourceName":"oteNB5309",
"reportingEntityName":"",
"priority":"Normal",
"startEpochMicrosec":951912000000,
"lastEpochMicrosec":951912900000,
"version":"4.0",
"vesEventListenerVersion":"7.1",
"timeZoneOffset":"UTC+05.00"
},
"perf3gppFields":{
"perf3gppFieldsVersion":"1.0",
"measDataCollection":{
"granularityPeriod":951912870000,
"measuredEntityUserName":"RNC Telecomville",
"measuredEntityDn":"SubNetwork=CountryNN,MeContext=MEC-Gbg-1,ManagedElement=RNC-Gbg-1",
"measuredEntitySoftwareVersion":"",
"measInfoList":[
{
"measInfoId":{
"sMeasInfoId":""
},
"measTypes":{
"sMeasTypesList":[
"succImmediateAssignProcs"
]
},
"measValuesList":[
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-997",
"suspectFlag":"false",
"measResults":[
{
"p":4,
"sValue":"789"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-998",
"suspectFlag":"false",
"measResults":[
{
"p":4,
"sValue":"234"
}
]
},
{
"measObjInstId":"RncFunction=RF-1,UtranCell=Gbg-999",
"suspectFlag":"true",
"measResults":[
{
"p":4,
"sValue":"789"
}
]
}
]
}
]
}
}
}
} |
Pay attention to the measTypes, we can only see the info with "succImmediateAssignProcs".
Clean env
clean env
Code Block | ||||
---|---|---|---|---|
| ||||
make clean-env |