diff --git a/configs/examples/5gc-sepp1-999-70.yaml.in b/configs/examples/5gc-sepp1-999-70.yaml.in index 1bf052c94..536fec39b 100644 --- a/configs/examples/5gc-sepp1-999-70.yaml.in +++ b/configs/examples/5gc-sepp1-999-70.yaml.in @@ -350,9 +350,9 @@ pcf: - address: 127.0.1.13 port: 9090 policy: - - plmn_id: - mcc: 001 - mnc: 01 + - supi_range: + - 001010000000001-001019999999999 + - 315010000000001-315010999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -428,85 +428,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 315 - mnc: 010 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/examples/5gc-sepp2-001-01.yaml.in b/configs/examples/5gc-sepp2-001-01.yaml.in index 67a604e6c..5637ae6ac 100644 --- a/configs/examples/5gc-sepp2-001-01.yaml.in +++ b/configs/examples/5gc-sepp2-001-01.yaml.in @@ -351,9 +351,9 @@ pcf: - address: 127.0.2.13 port: 9090 policy: - - plmn_id: - mcc: 999 - mnc: 70 + - supi_range: + - 999700000000001-999709999999999 + - 315010000000001-315010999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -429,85 +429,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 315 - mnc: 010 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/examples/5gc-sepp3-315-010.yaml.in b/configs/examples/5gc-sepp3-315-010.yaml.in index d37817813..7f6bd606e 100644 --- a/configs/examples/5gc-sepp3-315-010.yaml.in +++ b/configs/examples/5gc-sepp3-315-010.yaml.in @@ -351,9 +351,9 @@ pcf: - address: 127.0.3.13 port: 9090 policy: - - plmn_id: - mcc: 999 - mnc: 70 + - supi_range: + - 999700000000001-999709999999999 + - 001010000000001-001019999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -429,85 +429,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 001 - mnc: 01 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/examples/5gc-tls-sepp1-999-70.yaml.in b/configs/examples/5gc-tls-sepp1-999-70.yaml.in index a06648ca9..dd35d4cb7 100644 --- a/configs/examples/5gc-tls-sepp1-999-70.yaml.in +++ b/configs/examples/5gc-tls-sepp1-999-70.yaml.in @@ -355,9 +355,9 @@ pcf: - address: 127.0.1.13 port: 9090 policy: - - plmn_id: - mcc: 001 - mnc: 01 + - supi_range: + - 001010000000001-001019999999999 + - 315010000000001-315010999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -433,85 +433,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 315 - mnc: 010 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/examples/5gc-tls-sepp2-001-01.yaml.in b/configs/examples/5gc-tls-sepp2-001-01.yaml.in index 952eca531..dfaa87bc8 100644 --- a/configs/examples/5gc-tls-sepp2-001-01.yaml.in +++ b/configs/examples/5gc-tls-sepp2-001-01.yaml.in @@ -356,9 +356,9 @@ pcf: - address: 127.0.2.13 port: 9090 policy: - - plmn_id: - mcc: 999 - mnc: 70 + - supi_range: + - 999700000000001-999709999999999 + - 315010000000001-315010999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -434,85 +434,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 315 - mnc: 010 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/examples/5gc-tls-sepp3-315-010.yaml.in b/configs/examples/5gc-tls-sepp3-315-010.yaml.in index 6f2d2cc6a..82183cc69 100644 --- a/configs/examples/5gc-tls-sepp3-315-010.yaml.in +++ b/configs/examples/5gc-tls-sepp3-315-010.yaml.in @@ -356,9 +356,9 @@ pcf: - address: 127.0.3.13 port: 9090 policy: - - plmn_id: - mcc: 999 - mnc: 70 + - supi_range: + - 999700000000001-999709999999999 + - 001010000000001-001010999999999 slice: - sst: 1 # 1,2,3,4 default_indicator: true @@ -434,85 +434,6 @@ pcf: uplink: value: 802 unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - plmn_id: - mcc: 001 - mnc: 01 - slice: - - sst: 1 # 1,2,3,4 - default_indicator: true - session: - - name: internet - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 - qos: - index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - - name: ims - type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 - ambr: - downlink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 1 - unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - qos: - index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - pcc_rule: - - qos: - index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled - pre_emption_capability: 1 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 82 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - - qos: - index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 - arp: - priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled - pre_emption_capability: 2 # 1: Disabled, 2:Enabled - mbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - gbr: - downlink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - uplink: - value: 802 - unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps - nssf: sbi: server: diff --git a/configs/open5gs/pcf.yaml.in b/configs/open5gs/pcf.yaml.in index 10fd43faf..4c5d103f9 100644 --- a/configs/open5gs/pcf.yaml.in +++ b/configs/open5gs/pcf.yaml.in @@ -25,73 +25,85 @@ pcf: port: 9090 ################################################################################ -# Locally configured policy -# - The PCF in the VPLMN uses locally configured policies -# according to the roaming agreement with the HPLMN operator -# as input for PCC Rule generation. +# PCF Policy Configuration: UE Home PLMN and SUPI Range Based Policies ################################################################################ # -# o You don't have to use MongoDB if you use the policy configuration as below. +# This configuration applies policies based on the UE's home PLMN ID and +# SUPI range. When both supi_range and plmn_id are specified in a policy, +# the policy is applied only if both conditions are met. +# +# supi_range: Specifies one or more ranges of SUPIs. A maximum of 16 ranges +# can be defined. +# plmn_id : Specifies the UE's home PLMN using MCC and MNC. +# +# Example: # # policy: -# - plmn_id: +# - supi_range: # Filter policies by SUPI +# - 999700000000001-999709999999999 +# - 315010000000001-315010999999999 +# plmn_id: # Filter policies by home PLMN-ID # mcc: 999 # mnc: 70 -# slice: -# - sst: 1 # 1,2,3,4 +# slice: # Specify slice configuration +# - sst: 1 # Allowed values: 1, 2, 3, 4 # default_indicator: true -# session: +# session: # Define session based on DNN # - name: internet -# type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 # ambr: # downlink: # value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 3 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps # uplink: # value: 1 # unit: 3 # qos: -# index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 +# index: 9 # Allowed values: 1,2,3,4,65,66,67,75,71,72, +# # 73,74,76,5,6,7,8,9,69,70,79,80,82,83, +# # 84,85,86 # arp: -# priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled +# priority_level: 8 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled # - name: ims -# type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 # ambr: # downlink: # value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 3 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps # uplink: # value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 3 # qos: -# index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 +# index: 5 # Allowed values: 1,2,3,4,65,66,67,75,71,72, +# # 73,74,76,5,6,7,8,9,69,70,79,80,82,83, +# # 84,85,86 # arp: -# priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled +# priority_level: 1 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled # pcc_rule: # - qos: -# index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 +# index: 1 # Allowed values as above # arp: -# priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled +# priority_level: 1 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled # mbr: # downlink: # value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps # uplink: # value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # gbr: # downlink: # value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # uplink: # value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # flow: # - direction: 2 # description: "permit out icmp from any to assigned" @@ -102,48 +114,48 @@ pcf: # - direction: 1 # description: "permit out udp from 10.200.136.98/32 1-65535 to assigned 50021" # - qos: -# index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 +# index: 2 # Allowed values as above # arp: -# priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled -# pre_emption_capability: 2 # 1: Disabled, 2:Enabled +# priority_level: 4 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 2 # 1: Disabled, 2: Enabled +# pre_emption_capability: 2 # 1: Disabled, 2: Enabled # mbr: # downlink: # value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # uplink: # value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # gbr: # downlink: # value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 1 # uplink: # value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# - plmn_id: -# mcc: 001 -# mnc: 01 -# slice: -# - sst: 1 # 1,2,3,4 +# unit: 1 +# +# - supi_range: # Filter policies by SUPI only +# - 001010000000001-001019999999999 +# slice: # Specify slice configuration +# - sst: 1 # Allowed values: 1, 2, 3, 4 # sd: 000001 # default_indicator: true -# session: +# session: # Define session based on DNN # - name: internet -# type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 # ambr: # downlink: # value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# unit: 3 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps # uplink: # value: 1 # unit: 3 # qos: -# index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 +# index: 9 # Allowed values as above # arp: -# priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled +# priority_level: 8 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled # ################################################################################ # SBI Server diff --git a/configs/open5gs/pcrf.yaml.in b/configs/open5gs/pcrf.yaml.in index 2fca942c2..f9afb314c 100644 --- a/configs/open5gs/pcrf.yaml.in +++ b/configs/open5gs/pcrf.yaml.in @@ -16,90 +16,119 @@ pcrf: port: 9090 ################################################################################ -# Locally configured policy +# PCRF Policy Configuration: SUPI Range Based Policies ################################################################################ # -# o You don't have to use MongoDB if you use the policy configuration as below. +# This configuration applies policies based solely on the UE's SUPI range. # -# session: -# - name: internet -# type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 -# ambr: -# downlink: -# value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 1 -# unit: 3 -# qos: -# index: 9 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 -# arp: -# priority_level: 8 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled -# - name: ims -# type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6 -# ambr: -# downlink: -# value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 1 -# unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# qos: -# index: 5 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 -# arp: -# priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled -# pcc_rule: -# - qos: -# index: 1 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 -# arp: -# priority_level: 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled -# pre_emption_capability: 1 # 1: Disabled, 2:Enabled -# mbr: -# downlink: -# value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# gbr: -# downlink: -# value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 82 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# flow: -# - direction: 2 -# description: "permit out icmp from any to assigned" -# - direction: 1 -# description: "permit out icmp from any to assigned" -# - direction: 2 -# description: "permit out udp from 10.200.136.98/32 23455 to assigned 1-65535" -# - direction: 1 -# description: "permit out udp from 10.200.136.98/32 1-65535 to assigned 50021" -# - qos: -# index: 2 # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86 -# arp: -# priority_level: 4 # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -# pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled -# pre_emption_capability: 2 # 1: Disabled, 2:Enabled -# mbr: -# downlink: -# value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# gbr: -# downlink: -# value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps -# uplink: -# value: 802 -# unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps +# supi_range: Specifies one or more ranges of SUPIs. +# session: Defines the session configuration for each DNN. # +# Example: +# +# policy: +# - supi_range: # Filter policies by SUPI +# - 999700000000001-999709999999999 +# - 315010000000001-315010999999999 +# session: # Define session based on DNN +# - name: internet +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 +# ambr: +# downlink: +# value: 1 +# unit: 3 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps +# uplink: +# value: 1 +# unit: 3 +# qos: +# index: 9 # Allowed values: 1,2,3,4,65,66,67,75,71,72, +# # 73,74,76,5,6,7,8,9,69,70,79,80,82,83, +# # 84,85,86 +# arp: +# priority_level: 8 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled +# - name: ims +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 +# ambr: +# downlink: +# value: 1 +# unit: 3 +# uplink: +# value: 1 +# unit: 3 +# qos: +# index: 5 # Allowed values as above +# arp: +# priority_level: 1 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled +# pcc_rule: +# - qos: +# index: 1 # Allowed values as above +# arp: +# priority_level: 1 +# pre_emption_vulnerability: 1 +# pre_emption_capability: 1 +# mbr: +# downlink: +# value: 82 +# unit: 1 # 0: bps, 1: Kbps, 2: Mbps, 3: Gbps, 4: Tbps +# uplink: +# value: 82 +# unit: 1 +# gbr: +# downlink: +# value: 82 +# unit: 1 +# uplink: +# value: 82 +# unit: 1 +# flow: +# - direction: 2 +# description: "permit out icmp from any to assigned" +# - direction: 1 +# description: "permit out icmp from any to assigned" +# - direction: 2 +# description: "permit out udp from 10.200.136.98/32 23455 to assigned 1-65535" +# - direction: 1 +# description: "permit out udp from 10.200.136.98/32 1-65535 to assigned 50021" +# - qos: +# index: 2 # Allowed values as above +# arp: +# priority_level: 4 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 2 # 1: Disabled, 2: Enabled +# pre_emption_capability: 2 # 1: Disabled, 2: Enabled +# mbr: +# downlink: +# value: 802 +# unit: 1 +# uplink: +# value: 802 +# unit: 1 +# gbr: +# downlink: +# value: 802 +# unit: 1 +# uplink: +# value: 802 +# unit: 1 +# +# - supi_range: # Filter policies by SUPI only +# - 001010000000001-001019999999999 +# session: # Define session based on DNN +# - name: internet +# type: 3 # 1: IPv4, 2: IPv6, 3: IPv4v6 +# ambr: +# downlink: +# value: 1 +# unit: 3 +# uplink: +# value: 1 +# unit: 3 +# qos: +# index: 9 # Allowed values as above +# arp: +# priority_level: 8 # Allowed values: 1 to 15 +# pre_emption_vulnerability: 1 # 1: Disabled, 2: Enabled +# pre_emption_capability: 1 # 1: Disabled, 2: Enabled diff --git a/docs/_docs/guide/02-building-open5gs-from-sources.md b/docs/_docs/guide/02-building-open5gs-from-sources.md index 2c12d44ac..6b5de348f 100644 --- a/docs/_docs/guide/02-building-open5gs-from-sources.md +++ b/docs/_docs/guide/02-building-open5gs-from-sources.md @@ -64,9 +64,9 @@ Install the common dependencies for building the source code. $ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev meson ``` -Install libidn-dev or libidn11-dev Depending on Your System +Install libidn-dev or libidn11-dev depending on your system ```bash -if apt-cache show libidn-dev > /dev/null 2>&1; then +$ if apt-cache show libidn-dev > /dev/null 2>&1; then sudo apt-get install -y --no-install-recommends libidn-dev else sudo apt-get install -y --no-install-recommends libidn11-dev diff --git a/lib/app/ogs-config.c b/lib/app/ogs-config.c index 3a64af097..d9a970b04 100644 --- a/lib/app/ogs-config.c +++ b/lib/app/ogs-config.c @@ -753,9 +753,83 @@ int ogs_app_parse_sockopt_config( return OGS_OK; } +/*---------------------------------------------------------------------- + * Function: ogs_app_parse_supi_range_conf + * + * Parse the supi_range configuration from a YAML iterator. + * + * The expected YAML format is: + * + * supi_range: + * - 999700000000001-999700000099999 + * - 310789000000005-310789000000888 + * + * Both start and end must be provided. + * + * Returns: + * OGS_OK on success, OGS_ERROR on failure. + *----------------------------------------------------------------------*/ +int ogs_app_parse_supi_range_conf( + ogs_yaml_iter_t *parent, ogs_supi_range_t *supi_range) +{ + ogs_yaml_iter_t range_iter; + + ogs_assert(parent); + ogs_assert(supi_range); + + memset(supi_range, 0, sizeof(ogs_supi_range_t)); + + /* Recurse into the supi_range array node */ + ogs_yaml_iter_recurse(parent, &range_iter); + ogs_assert(ogs_yaml_iter_type(&range_iter) != YAML_MAPPING_NODE); + + do { + char *v = NULL; + char *start_str = NULL, *end_str = NULL; + + if (ogs_yaml_iter_type(&range_iter) == YAML_SEQUENCE_NODE) { + if (!ogs_yaml_iter_next(&range_iter)) + break; + } + + v = (char *)ogs_yaml_iter_value(&range_iter); + + if (v) { + ogs_assert(supi_range->num < OGS_MAX_NUM_OF_SUPI_RANGE); + + /* Split the string on '-' */ + start_str = strsep(&v, "-"); + if (start_str == NULL || strlen(start_str) == 0) { + ogs_error("Invalid supi_range starter bound: %s", v); + return OGS_ERROR; + } + + end_str = v; + if (end_str == NULL || strlen(end_str) == 0) { + ogs_error("Invalid supi_range upper bound: %s", v); + return OGS_ERROR; + } + + supi_range->start[supi_range->num] = + ogs_uint64_from_string_decimal(start_str); + supi_range->end[supi_range->num] = + ogs_uint64_from_string_decimal(end_str); + + supi_range->num++; + } + + } while (ogs_yaml_iter_type(&range_iter) == YAML_SEQUENCE_NODE); + + return OGS_OK; +} + static int parse_br_conf(ogs_yaml_iter_t *parent, ogs_bitrate_t *br) { ogs_yaml_iter_t br_iter; + + ogs_assert(parent); + ogs_assert(br); + ogs_yaml_iter_recurse(parent, &br_iter); while (ogs_yaml_iter_next(&br_iter)) { @@ -1191,11 +1265,12 @@ int ogs_app_parse_session_conf( return OGS_OK; } -ogs_app_policy_conf_t *ogs_app_policy_conf_add(ogs_plmn_id_t *plmn_id) +ogs_app_policy_conf_t *ogs_app_policy_conf_add( + ogs_supi_range_t *supi_range, ogs_plmn_id_t *plmn_id) { ogs_app_policy_conf_t *policy_conf = NULL; - ogs_assert(plmn_id); + ogs_assert(supi_range || plmn_id); ogs_pool_alloc(&policy_conf_pool, &policy_conf); if (!policy_conf) { @@ -1205,7 +1280,25 @@ ogs_app_policy_conf_t *ogs_app_policy_conf_add(ogs_plmn_id_t *plmn_id) } memset(policy_conf, 0, sizeof *policy_conf); - memcpy(&policy_conf->plmn_id, plmn_id, sizeof(ogs_plmn_id_t)); + if (supi_range) { + int i; + + memcpy(&policy_conf->supi_range, supi_range, sizeof(ogs_supi_range_t)); + + ogs_info("SUPI[%d]", policy_conf->supi_range.num); + for (i = 0; i < policy_conf->supi_range.num; i++) + ogs_info(" START[%lld]-END[%lld]", + (long long)policy_conf->supi_range.start[i], + (long long)policy_conf->supi_range.end[i]); + + } + if (plmn_id) { + policy_conf->plmn_id_valid = true; + memcpy(&policy_conf->plmn_id, plmn_id, sizeof(ogs_plmn_id_t)); + ogs_info("PLMN_ID[MCC:%03d.MNC:%03d]", + ogs_plmn_id_mcc(&policy_conf->plmn_id), + ogs_plmn_id_mnc(&policy_conf->plmn_id)); + } ogs_list_init(&policy_conf->slice_list); @@ -1216,19 +1309,60 @@ ogs_app_policy_conf_t *ogs_app_policy_conf_add(ogs_plmn_id_t *plmn_id) return policy_conf; } -ogs_app_policy_conf_t *ogs_app_policy_conf_find_by_plmn_id( - ogs_plmn_id_t *plmn_id) +ogs_app_policy_conf_t *ogs_app_policy_conf_find( + char *supi, ogs_plmn_id_t *plmn_id) { - ogs_app_policy_conf_t *policy_conf = NULL; + ogs_app_policy_conf_t *policy_conf; + int i; - ogs_assert(plmn_id); + char *supi_type = NULL; + char *supi_id = NULL; + uint64_t supi_decimal; + + ogs_assert(supi); + + supi_type = ogs_id_get_type(supi); + ogs_assert(supi_type); + supi_id = ogs_id_get_value(supi); + ogs_assert(supi_id); + + supi_decimal = ogs_uint64_from_string_decimal(supi_id); + + ogs_free(supi_type); + ogs_free(supi_id); ogs_list_for_each(&local_conf.policy_list, policy_conf) { - if (memcmp(&policy_conf->plmn_id, plmn_id, sizeof(ogs_plmn_id_t)) == 0) - break; + /* If supi_range is set, check if supi_decimal falls within + * any of the defined ranges. + */ + if (policy_conf->supi_range.num > 0) { + int in_range = 0; + for (i = 0; i < policy_conf->supi_range.num; i++) { + if ((supi_decimal >= policy_conf->supi_range.start[i]) && + (supi_decimal <= policy_conf->supi_range.end[i])) { + in_range = 1; + break; + } + } + if (!in_range) { + continue; + } + } + + /* If a plmn_id is set and it does not match the + * current policy's plmn_id, skip this policy. + */ + if (policy_conf->plmn_id_valid && + memcmp(&policy_conf->plmn_id, plmn_id, + sizeof(ogs_plmn_id_t)) != 0) { + continue; + } + + /* Both conditions met; return this policy configuration */ + return policy_conf; } - return policy_conf; + return NULL; } void ogs_app_policy_conf_remove(ogs_app_policy_conf_t *policy_conf) { @@ -1427,29 +1561,26 @@ void ogs_app_session_conf_remove_all(ogs_app_slice_conf_t *slice_conf) } int ogs_app_config_session_data( - ogs_plmn_id_t *plmn_id, ogs_s_nssai_t *s_nssai, char *dnn, + char *supi, ogs_plmn_id_t *plmn_id, ogs_s_nssai_t *s_nssai, char *dnn, ogs_session_data_t *session_data) { ogs_app_policy_conf_t *policy_conf = NULL; ogs_app_slice_conf_t *slice_conf = NULL; ogs_app_session_conf_t *session_conf = NULL; + ogs_assert(supi); ogs_assert(dnn); ogs_assert(session_data); - if (plmn_id) { - policy_conf = ogs_app_policy_conf_find_by_plmn_id(plmn_id); - if (!policy_conf) { - ogs_error("No POLICY [MCC:%03d,MNC:%03d]", - ogs_plmn_id_mcc(plmn_id), ogs_plmn_id_mnc(plmn_id)); - return OGS_ERROR; - } - } else { - policy_conf = ogs_list_first(&ogs_local_conf()->policy_list); - if (!policy_conf) { - ogs_error("No default POLICY for EPC"); - return OGS_ERROR; - } + policy_conf = ogs_app_policy_conf_find(supi, plmn_id); + if (!policy_conf) { + if (plmn_id) + ogs_error("No POLICY [SUPI:%s] [MCC:%03d,MNC:%03d]", + supi, ogs_plmn_id_mcc(plmn_id), ogs_plmn_id_mnc(plmn_id)); + else + ogs_error("No POLICY [SUPI:%s]", supi); + + return OGS_ERROR; } if (s_nssai) { diff --git a/lib/app/ogs-config.h b/lib/app/ogs-config.h index 6f98a7c66..13c30b8c4 100644 --- a/lib/app/ogs-config.h +++ b/lib/app/ogs-config.h @@ -144,9 +144,24 @@ typedef struct ogs_local_conf_s { } ogs_app_local_conf_t; +/* Structure for SUPI-range */ +typedef struct { + int num; +#define OGS_MAX_NUM_OF_SUPI_RANGE 16 + uint64_t start[OGS_MAX_NUM_OF_SUPI_RANGE]; + uint64_t end[OGS_MAX_NUM_OF_SUPI_RANGE]; +} ogs_supi_range_t; + + +/* Policy configuration structure. In a real system, additional fields + * (e.g., for plmn_id, slice list, etc.) would be added. + */ typedef struct ogs_app_policy_conf_s { ogs_lnode_t lnode; + ogs_supi_range_t supi_range; + + bool plmn_id_valid; ogs_plmn_id_t plmn_id; ogs_list_t slice_list; @@ -183,13 +198,17 @@ int ogs_app_parse_local_conf(const char *local); int ogs_app_parse_sockopt_config( ogs_yaml_iter_t *parent, ogs_sockopt_t *option); +int ogs_app_parse_supi_range_conf( + ogs_yaml_iter_t *parent, ogs_supi_range_t *supi_range); + int ogs_app_check_policy_conf(void); int ogs_app_parse_session_conf( ogs_yaml_iter_t *parent, ogs_app_slice_conf_t *slice_conf); -ogs_app_policy_conf_t *ogs_app_policy_conf_add(ogs_plmn_id_t *plmn_id); -ogs_app_policy_conf_t *ogs_app_policy_conf_find_by_plmn_id( - ogs_plmn_id_t *plmn_id); +ogs_app_policy_conf_t *ogs_app_policy_conf_add( + ogs_supi_range_t *supi_range, ogs_plmn_id_t *plmn_id); +ogs_app_policy_conf_t *ogs_app_policy_conf_find( + char *supi, ogs_plmn_id_t *plmn_id); void ogs_app_policy_conf_remove(ogs_app_policy_conf_t *policy_conf); void ogs_app_policy_conf_remove_all(void); @@ -209,7 +228,7 @@ void ogs_app_session_conf_remove_all( ogs_app_slice_conf_t *slice_conf); int ogs_app_config_session_data( - ogs_plmn_id_t *plmn_id, ogs_s_nssai_t *s_nssai, char *dnn, + char *supi, ogs_plmn_id_t *plmn_id, ogs_s_nssai_t *s_nssai, char *dnn, ogs_session_data_t *session_data); #ifdef __cplusplus diff --git a/lib/core/ogs-conv.c b/lib/core/ogs-conv.c index f4d3fa188..5b11f7177 100644 --- a/lib/core/ogs-conv.c +++ b/lib/core/ogs-conv.c @@ -214,17 +214,17 @@ char *ogs_uint64_to_string(uint64_t x) return dup; } -ogs_uint24_t ogs_uint24_from_string(char *str) +ogs_uint24_t ogs_uint24_from_string(char *str, int base) { ogs_uint24_t x; ogs_assert(str); - x.v = ogs_uint64_from_string(str); + x.v = ogs_uint64_from_string(str, base); return x; } -uint64_t ogs_uint64_from_string(char *str) +uint64_t ogs_uint64_from_string(char *str, int base) { uint64_t x; @@ -234,7 +234,7 @@ uint64_t ogs_uint64_from_string(char *str) return 0; errno = 0; - x = strtoll(str, NULL, 16); + x = strtoll(str, NULL, base); if ((errno == ERANGE && (x == LONG_MAX || x == LONG_MIN)) || (errno != 0 && x == 0)) { diff --git a/lib/core/ogs-conv.h b/lib/core/ogs-conv.h index 0374aaf82..b79bd74cd 100644 --- a/lib/core/ogs-conv.h +++ b/lib/core/ogs-conv.h @@ -53,8 +53,17 @@ char *ogs_uint36_to_0string(uint64_t x); char *ogs_uint64_to_0string(uint64_t x); char *ogs_uint64_to_string(uint64_t x); -ogs_uint24_t ogs_uint24_from_string(char *str); -uint64_t ogs_uint64_from_string(char *str); +#define ogs_uint24_from_string_decimal(str) \ + ogs_uint24_from_string((str), 10) +#define ogs_uint24_from_string_hexadecimal(str) \ + ogs_uint24_from_string((str), 16) +ogs_uint24_t ogs_uint24_from_string(char *str, int base); + +#define ogs_uint64_from_string_decimal(str) \ + ogs_uint64_from_string((str), 10) +#define ogs_uint64_from_string_hexadecimal(str) \ + ogs_uint64_from_string((str), 16) +uint64_t ogs_uint64_from_string(char *str, int base); double *ogs_alloc_double(double value); diff --git a/lib/pfcp/context.c b/lib/pfcp/context.c index f84fbec44..439de9a24 100644 --- a/lib/pfcp/context.c +++ b/lib/pfcp/context.c @@ -650,7 +650,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote) if (v) { e_cell_id[ num_of_e_cell_id] = - ogs_uint64_from_string( + ogs_uint64_from_string_hexadecimal( (char*)v); num_of_e_cell_id++; } @@ -686,7 +686,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote) if (v) { nr_cell_id[ num_of_nr_cell_id] = - ogs_uint64_from_string( + ogs_uint64_from_string_hexadecimal( (char*)v); num_of_nr_cell_id++; } diff --git a/lib/proto/types.c b/lib/proto/types.c index c678bfffb..62f48136f 100644 --- a/lib/proto/types.c +++ b/lib/proto/types.c @@ -398,7 +398,7 @@ ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex) if (hex == NULL) return sd; - return ogs_uint24_from_string((char *)hex); + return ogs_uint24_from_string_hexadecimal((char *)hex); } int ogs_fqdn_build(char *dst, const char *src, int length) diff --git a/lib/sbi/conv.c b/lib/sbi/conv.c index 8e133a4dd..99ba98335 100644 --- a/lib/sbi/conv.c +++ b/lib/sbi/conv.c @@ -1070,7 +1070,7 @@ bool ogs_sbi_s_nssai_from_string(ogs_s_nssai_t *s_nssai, char *str) ogs_error("ogs_strdup[%s:%s] failed", str, token); goto cleanup; } - s_nssai->sd = ogs_uint24_from_string(sd); + s_nssai->sd = ogs_uint24_from_string_hexadecimal(sd); } rc = true; @@ -1414,7 +1414,7 @@ bool ogs_sbi_parse_nr_location(ogs_5gs_tai_t *tai, ogs_nr_cgi_t *nr_cgi, if (Tai->plmn_id) ogs_sbi_parse_plmn_id(&tai->plmn_id, Tai->plmn_id); if (Tai->tac) - tai->tac = ogs_uint24_from_string(Tai->tac); + tai->tac = ogs_uint24_from_string_hexadecimal(Tai->tac); } Ncgi = NrLocation->ncgi; @@ -1422,7 +1422,8 @@ bool ogs_sbi_parse_nr_location(ogs_5gs_tai_t *tai, ogs_nr_cgi_t *nr_cgi, if (Ncgi->plmn_id) ogs_sbi_parse_plmn_id(&nr_cgi->plmn_id, Ncgi->plmn_id); if (Ncgi->nr_cell_id) - nr_cgi->cell_id = ogs_uint64_from_string(Ncgi->nr_cell_id); + nr_cgi->cell_id = ogs_uint64_from_string_hexadecimal( + Ncgi->nr_cell_id); } diff --git a/lib/sbi/message.c b/lib/sbi/message.c index 375e15a62..e747fed35 100644 --- a/lib/sbi/message.c +++ b/lib/sbi/message.c @@ -875,7 +875,7 @@ int ogs_sbi_parse_request( char *v = ogs_hash_this_val(hi); if (v) { discovery_option->requester_features = - ogs_uint64_from_string(v); + ogs_uint64_from_string_hexadecimal(v); discovery_option_presence = true; } } @@ -3369,7 +3369,7 @@ void ogs_sbi_discovery_option_parse_tai( if (Tai->plmn_id) ogs_sbi_parse_plmn_id(&tai.plmn_id, Tai->plmn_id); if (Tai->tac) - tai.tac = ogs_uint24_from_string(Tai->tac); + tai.tac = ogs_uint24_from_string_hexadecimal(Tai->tac); ogs_sbi_discovery_option_set_tai(discovery_option, &tai); diff --git a/lib/sbi/nnrf-handler.c b/lib/sbi/nnrf-handler.c index 2cddbdf14..81c14c121 100644 --- a/lib/sbi/nnrf-handler.c +++ b/lib/sbi/nnrf-handler.c @@ -472,7 +472,7 @@ static void handle_smf_info( nr_tai = &nf_info->smf.nr_tai[nf_info->smf.num_of_nr_tai]; ogs_assert(nr_tai); ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id); - nr_tai->tac = ogs_uint24_from_string(TaiItem->tac); + nr_tai->tac = ogs_uint24_from_string_hexadecimal(TaiItem->tac); nf_info->smf.num_of_nr_tai++; } @@ -507,11 +507,13 @@ static void handle_smf_info( nf_info->smf.nr_tai_range [nf_info->smf.num_of_nr_tai_range]. start[tac_index] = - ogs_uint24_from_string(TacRangeItem->start); + ogs_uint24_from_string_hexadecimal( + TacRangeItem->start); nf_info->smf.nr_tai_range [nf_info->smf.num_of_nr_tai_range]. end[tac_index] = - ogs_uint24_from_string(TacRangeItem->end); + ogs_uint24_from_string_hexadecimal( + TacRangeItem->end); nf_info->smf.nr_tai_range [nf_info->smf.num_of_nr_tai_range]. @@ -703,8 +705,10 @@ static void handle_amf_info( &nf_instance->nf_info_list, OpenAPI_nf_type_AMF); ogs_assert(nf_info); - nf_info->amf.amf_set_id = ogs_uint64_from_string(AmfInfo->amf_set_id); - nf_info->amf.amf_region_id = ogs_uint64_from_string(AmfInfo->amf_region_id); + nf_info->amf.amf_set_id = ogs_uint64_from_string_hexadecimal( + AmfInfo->amf_set_id); + nf_info->amf.amf_region_id = ogs_uint64_from_string_hexadecimal( + AmfInfo->amf_region_id); GuamiList = AmfInfo->guami_list; OpenAPI_list_for_each(GuamiList, node) { @@ -739,7 +743,7 @@ static void handle_amf_info( nr_tai = &nf_info->amf.nr_tai[nf_info->amf.num_of_nr_tai]; ogs_assert(nr_tai); ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id); - nr_tai->tac = ogs_uint24_from_string(TaiItem->tac); + nr_tai->tac = ogs_uint24_from_string_hexadecimal(TaiItem->tac); nf_info->amf.num_of_nr_tai++; } } @@ -774,10 +778,12 @@ static void handle_amf_info( nf_info->amf.nr_tai_range [nf_info->amf.num_of_nr_tai_range].start[tac_index] = - ogs_uint24_from_string(TacRangeItem->start); + ogs_uint24_from_string_hexadecimal( + TacRangeItem->start); nf_info->amf.nr_tai_range [nf_info->amf.num_of_nr_tai_range].end[tac_index] = - ogs_uint24_from_string(TacRangeItem->end); + ogs_uint24_from_string_hexadecimal( + TacRangeItem->end); nf_info->amf.nr_tai_range [nf_info->amf.num_of_nr_tai_range].num_of_tac_range++; @@ -962,7 +968,8 @@ void ogs_nnrf_nfm_handle_nf_status_subscribe( /* SBI Features */ if (SubscriptionData->nrf_supported_features) { subscription_data->nrf_supported_features = - ogs_uint64_from_string(SubscriptionData->nrf_supported_features); + ogs_uint64_from_string_hexadecimal( + SubscriptionData->nrf_supported_features); } else { subscription_data->nrf_supported_features = 0; } diff --git a/src/amf/context.c b/src/amf/context.c index 1f6954826..6880c9604 100644 --- a/src/amf/context.c +++ b/src/amf/context.c @@ -759,7 +759,7 @@ int amf_context_parse_config(void) s_nssai->sst = atoi(sst); if (sd) s_nssai->sd = - ogs_uint24_from_string( + ogs_uint24_from_string_hexadecimal( (char*)sd); else s_nssai->sd.v = diff --git a/src/amf/npcf-handler.c b/src/amf/npcf-handler.c index ff59e977a..71b90b0fc 100644 --- a/src/amf/npcf-handler.c +++ b/src/amf/npcf-handler.c @@ -149,7 +149,8 @@ int amf_npcf_am_policy_control_handle_create( PCF_AM_POLICY_STORE(amf_ue, header.uri, message.h.resource.component[1]); /* SBI Features */ - supported_features = ogs_uint64_from_string(PolicyAssociation->supp_feat); + supported_features = ogs_uint64_from_string_hexadecimal( + PolicyAssociation->supp_feat); amf_ue->am_policy_control_features &= supported_features; OpenAPI_list_for_each(PolicyAssociation->triggers, node) { diff --git a/src/bsf/nbsf-handler.c b/src/bsf/nbsf-handler.c index c391500a6..1c58237c2 100644 --- a/src/bsf/nbsf-handler.c +++ b/src/bsf/nbsf-handler.c @@ -195,7 +195,8 @@ bool bsf_nbsf_management_handle_pcf_binding( if (RecvPcfBinding->supp_feat) { uint64_t supported_features = - ogs_uint64_from_string(RecvPcfBinding->supp_feat); + ogs_uint64_from_string_hexadecimal( + RecvPcfBinding->supp_feat); sess->management_features &= supported_features; if (sess->management_features != supported_features) { diff --git a/src/mme/mme-context.c b/src/mme/mme-context.c index 426ea274a..fb824af1b 100644 --- a/src/mme/mme-context.c +++ b/src/mme/mme-context.c @@ -889,7 +889,7 @@ int mme_context_parse_config(void) if (v) { e_cell_id[ num_of_e_cell_id] = - ogs_uint64_from_string( + ogs_uint64_from_string_hexadecimal( (char*)v); num_of_e_cell_id++; } @@ -1118,7 +1118,7 @@ int mme_context_parse_config(void) if (v) { e_cell_id[ num_of_e_cell_id] = - ogs_uint64_from_string( + ogs_uint64_from_string_hexadecimal( (char*)v); num_of_e_cell_id++; } diff --git a/src/nrf/nnrf-handler.c b/src/nrf/nnrf-handler.c index d82a5040d..544f081c6 100644 --- a/src/nrf/nnrf-handler.c +++ b/src/nrf/nnrf-handler.c @@ -499,7 +499,8 @@ bool nrf_nnrf_handle_nf_status_subscribe( if (SubscriptionData->requester_features) { subscription_data->requester_features = - ogs_uint64_from_string(SubscriptionData->requester_features); + ogs_uint64_from_string_hexadecimal( + SubscriptionData->requester_features); /* No need to send SubscriptionData->requester_features to the NF */ ogs_free(SubscriptionData->requester_features); diff --git a/src/pcf/context.c b/src/pcf/context.c index 41f1779bd..67a6ed46a 100644 --- a/src/pcf/context.c +++ b/src/pcf/context.c @@ -209,6 +209,9 @@ static int parse_policy_conf(ogs_yaml_iter_t *parent) do { const char *mnc = NULL, *mcc = NULL; ogs_app_policy_conf_t *policy_conf = NULL; + ogs_supi_range_t supi_range; + + memset(&supi_range, 0, sizeof(ogs_supi_range_t)); OGS_YAML_ARRAY_NEXT(&policy_array, &policy_iter); while (ogs_yaml_iter_next(&policy_iter)) { @@ -227,21 +230,31 @@ static int parse_policy_conf(ogs_yaml_iter_t *parent) mnc = ogs_yaml_iter_value(&plmn_id_iter); } } - + } else if (!strcmp(policy_key, "supi_range")) { + rv = ogs_app_parse_supi_range_conf(&policy_iter, &supi_range); + if (rv != OGS_OK) { + ogs_error("ogs_app_parse_supi_range_conf() failed"); + return rv; + } } } - if (mcc && mnc) { + if (supi_range.num || (mcc && mnc)) { ogs_plmn_id_t plmn_id; - ogs_plmn_id_build(&plmn_id, atoi(mcc), atoi(mnc), strlen(mnc)); - policy_conf = ogs_app_policy_conf_add(&plmn_id); + if (mcc && mnc) + ogs_plmn_id_build(&plmn_id, atoi(mcc), atoi(mnc), strlen(mnc)); + policy_conf = ogs_app_policy_conf_add( + supi_range.num ? &supi_range : NULL, + (mcc && mnc) ? &plmn_id : NULL); if (!policy_conf) { ogs_error("ogs_app_policy_conf_add() failed " - "[MCC:%s,MNC:%s]", mcc, mnc); + "[supi_range.num:%d] [MCC:%s, MNC:%s]", + supi_range.num, mcc, mnc); return OGS_ERROR; } } else { - ogs_error("No PLMN-ID [MCC:%s, MNC:%s]", mcc, mnc); + ogs_error("No SUPI Range[%d] OR PLMN-ID [MCC:%s, MNC:%s]", + supi_range.num, mcc, mnc); return OGS_ERROR; } @@ -807,14 +820,10 @@ int pcf_db_qos_data(char *supi, memset(session_data, 0, sizeof(*session_data)); - if (plmn_id) - policy_conf = ogs_app_policy_conf_find_by_plmn_id(plmn_id); - else - ogs_warn("No PLMN_ID"); - + policy_conf = ogs_app_policy_conf_find(supi, plmn_id); if (policy_conf) { rv = ogs_app_config_session_data( - plmn_id, s_nssai, dnn, session_data); + supi, plmn_id, s_nssai, dnn, session_data); if (rv != OGS_OK) ogs_error("ogs_app_config_session_data() failed - " "MCC[%d] MNC[%d] SST[%d] SD[0x%x] DNN[%s]", diff --git a/src/pcf/nbsf-handler.c b/src/pcf/nbsf-handler.c index 14efee5e6..2f4c39794 100644 --- a/src/pcf/nbsf-handler.c +++ b/src/pcf/nbsf-handler.c @@ -70,7 +70,7 @@ bool pcf_nbsf_management_handle_register( PcfBinding = recvmsg->PcfBinding; if (PcfBinding->supp_feat) { uint64_t supported_features = - ogs_uint64_from_string(PcfBinding->supp_feat); + ogs_uint64_from_string_hexadecimal(PcfBinding->supp_feat); sess->management_features &= supported_features; } diff --git a/src/pcf/npcf-handler.c b/src/pcf/npcf-handler.c index dadbdf273..930567ffc 100644 --- a/src/pcf/npcf-handler.c +++ b/src/pcf/npcf-handler.c @@ -118,7 +118,8 @@ bool pcf_npcf_am_policy_control_handle_create(pcf_ue_t *pcf_ue, ogs_freeaddrinfo(addr6); supported_features = - ogs_uint64_from_string(PolicyAssociationRequest->supp_feat); + ogs_uint64_from_string_hexadecimal( + PolicyAssociationRequest->supp_feat); pcf_ue->am_policy_control_features &= supported_features; if (PolicyAssociationRequest->gpsi) { @@ -328,7 +329,8 @@ bool pcf_npcf_smpolicycontrol_handle_create(pcf_sess_t *sess, if (SmPolicyContextData->supp_feat) { uint64_t supported_features = - ogs_uint64_from_string(SmPolicyContextData->supp_feat); + ogs_uint64_from_string_hexadecimal( + SmPolicyContextData->supp_feat); sess->smpolicycontrol_features &= supported_features; } else { sess->smpolicycontrol_features = 0; @@ -703,7 +705,8 @@ bool pcf_npcf_policyauthorization_handle_create(pcf_sess_t *sess, goto cleanup; } - supported_features = ogs_uint64_from_string(AscReqData->supp_feat); + supported_features = ogs_uint64_from_string_hexadecimal( + AscReqData->supp_feat); sess->policyauthorization_features &= supported_features; if (sess->policyauthorization_features != supported_features) { diff --git a/src/pcrf/pcrf-context.c b/src/pcrf/pcrf-context.c index 3d70edaf6..19f69056e 100644 --- a/src/pcrf/pcrf-context.c +++ b/src/pcrf/pcrf-context.c @@ -92,38 +92,12 @@ static int pcrf_context_validation(void) return OGS_OK; } -static int session_conf_prepare(void) +static int policy_conf_prepare(void) { - ogs_app_policy_conf_t *policy_conf = NULL; - ogs_app_slice_conf_t *slice_conf = NULL; - - ogs_plmn_id_t plmn_id; - ogs_s_nssai_t s_nssai; - - ogs_plmn_id_build(&plmn_id, 999, 70, 2); - - s_nssai.sst = 1; - s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; - - /* Added Dummy POLICY for EPC */ - policy_conf = ogs_app_policy_conf_add(&plmn_id); - if (!policy_conf) { - ogs_error("ogs_app_policy_conf_add() failed"); - return OGS_ERROR; - } - - /* Added Dummy SLICE for EPC */ - slice_conf = ogs_app_slice_conf_add(policy_conf, &s_nssai); - if (!slice_conf) { - ogs_error("ogs_app_slice_conf_add() failed"); - return OGS_ERROR; - } - slice_conf->data.default_indicator = true; - return OGS_OK; } -static int session_conf_validation(void) +static int policy_conf_validation(void) { int rv; @@ -136,27 +110,77 @@ static int session_conf_validation(void) return OGS_OK; } -static int parse_session_conf(ogs_yaml_iter_t *parent) +static int parse_policy_conf(ogs_yaml_iter_t *parent) { int rv; - ogs_app_policy_conf_t *policy_conf = NULL; - ogs_app_slice_conf_t *slice_conf = NULL; + ogs_yaml_iter_t policy_array, policy_iter; ogs_assert(parent); - rv = session_conf_prepare(); + rv = policy_conf_prepare(); if (rv != OGS_OK) return rv; - policy_conf = ogs_list_first(&ogs_local_conf()->policy_list); - ogs_assert(policy_conf); + ogs_yaml_iter_recurse(parent, &policy_array); + do { + ogs_app_policy_conf_t *policy_conf = NULL; + ogs_app_slice_conf_t *slice_conf = NULL; + ogs_supi_range_t supi_range; + ogs_s_nssai_t s_nssai; - slice_conf = ogs_list_first(&policy_conf->slice_list); - ogs_assert(slice_conf); + memset(&supi_range, 0, sizeof(ogs_supi_range_t)); - rv = ogs_app_parse_session_conf(parent, slice_conf); - if (rv != OGS_OK) return rv; + OGS_YAML_ARRAY_NEXT(&policy_array, &policy_iter); + while (ogs_yaml_iter_next(&policy_iter)) { + const char *policy_key = ogs_yaml_iter_key(&policy_iter); + ogs_assert(policy_key); + if (!strcmp(policy_key, "supi_range")) { + rv = ogs_app_parse_supi_range_conf(&policy_iter, &supi_range); + if (rv != OGS_OK) { + ogs_error("ogs_app_parse_supi_range_conf() failed"); + return rv; + } + } + } - rv = session_conf_validation(); + if (supi_range.num) { + policy_conf = ogs_app_policy_conf_add( + supi_range.num ? &supi_range : NULL, NULL); + if (!policy_conf) { + ogs_error("ogs_app_policy_conf_add() failed " + "[supi_range.num:%d]", supi_range.num); + return OGS_ERROR; + } + + s_nssai.sst = 1; + s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE; + + slice_conf = ogs_app_slice_conf_add(policy_conf, &s_nssai); + if (!slice_conf) { + ogs_error("ogs_app_slice_conf_add() failed"); + return OGS_ERROR; + } + slice_conf->data.default_indicator = true; + } else { + ogs_error("No SUPI Range"); + return OGS_ERROR; + } + + OGS_YAML_ARRAY_RECURSE(&policy_array, &policy_iter); + while (ogs_yaml_iter_next(&policy_iter)) { + const char *policy_key = ogs_yaml_iter_key(&policy_iter); + ogs_assert(policy_key); + if (!strcmp(policy_key, OGS_SESSION_STRING)) { + rv = ogs_app_parse_session_conf(&policy_iter, slice_conf); + if (rv != OGS_OK) { + ogs_error("parse_session_conf() failed"); + return rv; + } + } + } + + } while (ogs_yaml_iter_type(&policy_array) == YAML_SEQUENCE_NODE); + + rv = policy_conf_validation(); if (rv != OGS_OK) return rv; return OGS_OK; @@ -338,17 +362,17 @@ int pcrf_context_parse_config(void) ogs_warn("unknown key `%s`", fd_key); } } - } else if (!strcmp(pcrf_key, OGS_SESSION_STRING)) { - rv = parse_session_conf(&pcrf_iter); - if (rv != OGS_OK) { - ogs_error("parse_session_conf() failed"); - return rv; - } } else if (!strcmp(pcrf_key, "diameter_stats_interval")) { const char *v = ogs_yaml_iter_value(&pcrf_iter); if (v) self.diam_config->stats.interval_sec = atoi(v); } else if (!strcmp(pcrf_key, "metrics")) { /* handle config in metrics library */ + } else if (!strcmp(pcrf_key, OGS_POLICY_STRING)) { + rv = parse_policy_conf(&pcrf_iter); + if (rv != OGS_OK) { + ogs_error("parse_policy_conf() failed"); + return rv; + } } else ogs_warn("unknown key `%s`", pcrf_key); } @@ -381,12 +405,12 @@ int pcrf_db_qos_data( supi = ogs_msprintf("%s-%s", OGS_ID_SUPI_TYPE_IMSI, imsi_bcd); ogs_assert(supi); - policy_conf = ogs_list_first(&ogs_local_conf()->policy_list); + policy_conf = ogs_app_policy_conf_find(supi, NULL); if (policy_conf) slice_conf = ogs_list_first(&policy_conf->slice_list); if (slice_conf) { - rv = ogs_app_config_session_data(NULL, NULL, apn, session_data); + rv = ogs_app_config_session_data(supi, NULL, NULL, apn, session_data); if (rv != OGS_OK) ogs_error("ogs_app_config_session_data() failed for APN(%s)", apn); } else { diff --git a/src/scp/sbi-path.c b/src/scp/sbi-path.c index 817bdcfa2..943cadce6 100644 --- a/src/scp/sbi-path.c +++ b/src/scp/sbi-path.c @@ -293,7 +293,7 @@ static int request_handler(ogs_sbi_request_t *request, void *data) OGS_SBI_CUSTOM_DISCOVERY_REQUESTER_FEATURES)) { if (val) discovery_option->requester_features = - ogs_uint64_from_string(val); + ogs_uint64_from_string_hexadecimal(val); } else { /* ':scheme' and ':authority' will be automatically filled in later */ } diff --git a/src/sepp/n32c-handler.c b/src/sepp/n32c-handler.c index 0a091eaf0..3cd926e5a 100644 --- a/src/sepp/n32c-handler.c +++ b/src/sepp/n32c-handler.c @@ -140,7 +140,8 @@ bool sepp_n32c_handshake_handle_security_capability_request( if (SecNegotiateReqData->supported_features) { uint64_t supported_features = - ogs_uint64_from_string(SecNegotiateReqData->supported_features); + ogs_uint64_from_string_hexadecimal( + SecNegotiateReqData->supported_features); sepp_node->supported_features &= supported_features; } else { sepp_node->supported_features = 0; @@ -209,7 +210,8 @@ bool sepp_n32c_handshake_handle_security_capability_response( if (SecNegotiateRspData->supported_features) { uint64_t supported_features = - ogs_uint64_from_string(SecNegotiateRspData->supported_features); + ogs_uint64_from_string_hexadecimal( + SecNegotiateRspData->supported_features); sepp_node->supported_features &= supported_features; } else { sepp_node->supported_features = 0; diff --git a/src/smf/context.c b/src/smf/context.c index 2d38061cd..0686a4fee 100644 --- a/src/smf/context.c +++ b/src/smf/context.c @@ -706,7 +706,7 @@ int smf_context_parse_config(void) s_nssai->sst = atoi(sst); if (sd) s_nssai->sd = - ogs_uint24_from_string( + ogs_uint24_from_string_hexadecimal( (char*)sd); else s_nssai->sd.v = diff --git a/src/smf/npcf-handler.c b/src/smf/npcf-handler.c index 237c46add..9c5d5810a 100644 --- a/src/smf/npcf-handler.c +++ b/src/smf/npcf-handler.c @@ -377,7 +377,7 @@ bool smf_npcf_smpolicycontrol_handle_create( /* SBI Features */ if (SmPolicyDecision->supp_feat) { uint64_t supported_features = - ogs_uint64_from_string(SmPolicyDecision->supp_feat); + ogs_uint64_from_string_hexadecimal(SmPolicyDecision->supp_feat); sess->smpolicycontrol_features &= supported_features; } else { sess->smpolicycontrol_features = 0; diff --git a/tests/af/npcf-handler.c b/tests/af/npcf-handler.c index 796762377..0a561be19 100644 --- a/tests/af/npcf-handler.c +++ b/tests/af/npcf-handler.c @@ -116,7 +116,8 @@ void af_npcf_policyauthorization_handle_create( PCF_APP_SESSION_STORE(sess, header.uri, message.h.resource.component[1]); - supported_features = ogs_uint64_from_string(AscReqData->supp_feat); + supported_features = ogs_uint64_from_string_hexadecimal( + AscReqData->supp_feat); sess->policyauthorization_features &= supported_features; cleanup: diff --git a/tests/common/context.c b/tests/common/context.c index 3aa4ef1a9..b36a6086a 100644 --- a/tests/common/context.c +++ b/tests/common/context.c @@ -626,7 +626,7 @@ int test_context_parse_config(void) s_nssai->sst = atoi(sst); if (sd) s_nssai->sd = - ogs_uint24_from_string( + ogs_uint24_from_string_hexadecimal( (char*)sd); else s_nssai->sd.v = diff --git a/tests/core/conv-test.c b/tests/core/conv-test.c index 62621aee5..f08ac5d27 100644 --- a/tests/core/conv-test.c +++ b/tests/core/conv-test.c @@ -168,104 +168,104 @@ static void conv_test8(abts_case *tc, void *data) x = 0; str = ogs_uint64_to_string(0); ABTS_STR_EQUAL(tc, "", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string("0")); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal("0")); ogs_free(str); x = 1; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "1", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x12; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "12", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x1234; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "1234", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x12345; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "12345", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x1234567; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "1234567", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x12345678; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "12345678", str); - ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string(str)); + ABTS_INT_EQUAL(tc, x, ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789a; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789a", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789ab; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789ab", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789abc; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789abc", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789abcd; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789abcd", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789abcde; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789abcde", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x123456789abcdef; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "123456789abcdef", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); x = 0x120456789abcdef0; str = ogs_uint64_to_string(x); ABTS_STR_EQUAL(tc, "120456789abcdef0", str); - ABTS_TRUE(tc, x == ogs_uint64_from_string(str)); + ABTS_TRUE(tc, x == ogs_uint64_from_string_hexadecimal(str)); ogs_free(str); }