Configuring Mediation Rule for NF-Mediation
Extracting the group name and the trigger point from the URLs provided
below:
Note:
In rules, the "agenda-group" is used to categories the rule group using the group name and the trigger point that is provided in the URL.URL Type 1:
[http://{apiRoot}/nmediation-http/v1]
- The above URL does not have any group name or trigger point. So the rules that are without agenda-group are applicable on this.
- From the below reference
rules, the rule
default
will be applied.
URL Type 2:
[http://{apiRoot}/nmediation-http/v1/scp]
- The above URL has only the
group name. So the rules that are under the agenda-group
scp
is applicable. - From the below reference
rules, the rule
scp-rule-header-1
will be applied.
URL Type 3:
[http://{apiRoot}/nmediation-http/v1/scp/triggerpoint2]
- The above URL has both the
group name
scp
and the trigger pointtriggerpoint2
. So the rules that are under the agenda-groupscp-triggerpoint2
are applicable. - From the below reference
rules, the rule
scp-rule-header-2
andscp-rule-body-1
will be applied.
Add the below rules to the mediation rules:
rule "default"
when
m : NFHttpRequest(m.header("source") == "pcf")
then
m.header(m.DEL, "custom-header-bad")
end
rule "scp-rule-header-1"
salience 20
agenda-group "scp"
when
m : NFHttpRequest(m.header("custom-key") == "123")
then
m.header(m.ADD, "custom-value", "pcf-nrf")
m.header(m.UPDATE, "name", "nf","pcfnf")
end
rule "scp-rule-header-2"
salience 20
agenda-group "scp-triggerpoint2"
when
m : NFHttpRequest(m.header("custom-key") == "123")
then
m.header(m.ADD, "custom-value", "pcf-nrf")
m.header(m.UPDATE, "name", "nf","pcfnf")
end
rule "scp-rule-body-1"
salience 21
agenda-group "scp-triggerpoint2"
when
m : NFHttpRequest( (m.body("nfType") == "PCF") &&
(m.body("fqdn") matches "^(cisco).*") )
then
m.body(m.ADD, "pcfInfo:supiRangeList[1]:end", "2000000000")
m.body(m.ADD, "pcfInfo:supiRangeList[1]:start", "1000000000")
m.body(m.UPDATE, "nfServices[1]:ipEndPoints[1]:ipv4Address", "10.75.213.100")
m.body(m.DEL, "nfServices[1]:apiPrefix")
end