neels has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-pfcp/+/30248 )

Change subject: PFCP: add Network Instance IE in PDI IE
......................................................................

PFCP: add Network Instance IE in PDI IE

So far the optional Network Instance IE in PDI IEs was not coded by
libosmo-pfcp. Add it.

Test it by adding Network Instance IEs in pfcp_test.c.

osmo-upf needs this, because we are about to add support for Network
Instance in PDI IEs, to determine which local interface to use for GTP
tunnel mapping and encapsulation/decapsulation.

Related: SYS#6192
Change-Id: I162299e70b4fb0c3fef8039d693ac7d3fe4df16a
---
M src/libosmo-pfcp/gen__pfcp_ies_auto.c
M tests/libosmo-pfcp/pfcp_test.c
M tests/libosmo-pfcp/pfcp_test.ok
3 files changed, 23 insertions(+), 6 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/libosmo-pfcp/gen__pfcp_ies_auto.c 
b/src/libosmo-pfcp/gen__pfcp_ies_auto.c
index 0dfb43c..5649fe3 100644
--- a/src/libosmo-pfcp/gen__pfcp_ies_auto.c
+++ b/src/libosmo-pfcp/gen__pfcp_ies_auto.c
@@ -99,6 +99,7 @@
 static const struct osmo_gtlv_gen_ie_o ies_in_pdi[] = {
        Ms(source_iface),
        O(f_teid, "local_f_teid"),
+       O(ALL_FROM_NAME, "network_inst"),
        O(ALL_FROM_NAME, "ue_ip_address"),
        Os(traffic_endpoint_id),
        O(iface_type, "source_iface_type"),
diff --git a/tests/libosmo-pfcp/pfcp_test.c b/tests/libosmo-pfcp/pfcp_test.c
index b204a9f..801932c 100644
--- a/tests/libosmo-pfcp/pfcp_test.c
+++ b/tests/libosmo-pfcp/pfcp_test.c
@@ -205,6 +205,10 @@
                                        .precedence = 255,
                                        .pdi = {
                                                .source_iface = 
OSMO_PFCP_SOURCE_IFACE_CORE,
+                                               .network_inst_present = true,
+                                               .network_inst = {
+                                                       .str = "foo",
+                                               },
                                                .ue_ip_address_present = true,
                                                .ue_ip_address = {
                                                        .ip_is_destination = 
true,
@@ -224,6 +228,10 @@
                                                .source_iface = 
OSMO_PFCP_SOURCE_IFACE_ACCESS,
                                                .local_f_teid_present = true,
                                                .local_f_teid = 
f_teid_access_local,
+                                               .network_inst_present = true,
+                                               .network_inst = {
+                                                       .str = "bar",
+                                               },
                                        },
                                        .outer_header_removal_present = true,
                                        .outer_header_removal = {
@@ -318,6 +326,10 @@
                                                .source_iface = 
OSMO_PFCP_SOURCE_IFACE_ACCESS,
                                                .local_f_teid_present = true,
                                                .local_f_teid = 
f_teid_access_local,
+                                               .network_inst_present = true,
+                                               .network_inst = {
+                                                       .str = "baz",
+                                               },
                                        },
                                        .outer_header_removal_present = true,
                                        .outer_header_removal = {
@@ -349,6 +361,10 @@
                                                .source_iface = 
OSMO_PFCP_SOURCE_IFACE_ACCESS,
                                                .local_f_teid_present = true,
                                                .local_f_teid = 
f_teid_access_local,
+                                               .network_inst_present = true,
+                                               .network_inst = {
+                                                       .str = "moo",
+                                               },
                                        },
                                        .outer_header_removal_present = true,
                                        .outer_header_removal = {
diff --git a/tests/libosmo-pfcp/pfcp_test.ok b/tests/libosmo-pfcp/pfcp_test.ok
index 23ce16d..b8eddb9 100644
--- a/tests/libosmo-pfcp/pfcp_test.ok
+++ b/tests/libosmo-pfcp/pfcp_test.ok
@@ -67,10 +67,10 @@
 
 === start test_enc_dec[6]
 encoding: SESSION_EST_REQ
-PFCPv1 SESSION_EST_REQ hdr={seq=7 SEID=0x0} ies={ 'Node ID'=v4:127.0.0.1 
'F-SEID'=0x1234567890abcdef,v4:10.9.8.7 'Create PDR'={ { 'PDR ID'=1 
'Precedence'=255 'PDI'={ 'Source Interface'=Core 'UE IP 
Address'=,dst,v4:192.168.0.23 } 'FAR ID'=1 }, { 'PDR ID'=2 'Precedence'=255 
'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 } 'Outer Header 
Removal'=GTP_U_UDP_IPV4 'FAR ID'=2 } } 'Create FAR'={ { 'FAR ID'=1 'Apply 
Action'=( FORW ) 'Forwarding Parameters'={ 'Destination Interface'=Access 
'Outer Header Creation'=( GTP_U_UDP_IPV4 ),TEID:0xabcdef,v4:10.9.8.7 } }, { 
'FAR ID'=2 'Apply Action'=( FORW ) 'Forwarding Parameters'={ 'Destination 
Interface'=Core } } } }
+PFCPv1 SESSION_EST_REQ hdr={seq=7 SEID=0x0} ies={ 'Node ID'=v4:127.0.0.1 
'F-SEID'=0x1234567890abcdef,v4:10.9.8.7 'Create PDR'={ { 'PDR ID'=1 
'Precedence'=255 'PDI'={ 'Source Interface'=Core 'Network Instance'="foo" 'UE 
IP Address'=,dst,v4:192.168.0.23 } 'FAR ID'=1 }, { 'PDR ID'=2 'Precedence'=255 
'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 'Network Instance'="bar" } 
'Outer Header Removal'=GTP_U_UDP_IPV4 'FAR ID'=2 } } 'Create FAR'={ { 'FAR 
ID'=1 'Apply Action'=( FORW ) 'Forwarding Parameters'={ 'Destination 
Interface'=Access 'Outer Header Creation'=( GTP_U_UDP_IPV4 
),TEID:0xabcdef,v4:10.9.8.7 } }, { 'FAR ID'=2 'Apply Action'=( FORW ) 
'Forwarding Parameters'={ 'Destination Interface'=Core } } } }
 osmo_pfcp_msg_encode() rc = 0
-21 32 00 c3 00 00 00 00 00 00 00 00 00 00 07 00 00 3c 00 05 00 7f 00 00 01 00 
39 00 0d 02 12 34 56 78 90 ab cd ef 0a 09 08 07 00 01 00 28 00 38 00 02 00 01 
00 1d 00 04 00 00 00 ff 00 02 00 0e 00 14 00 01 01 00 5d 00 05 06 c0 a8 00 17 
00 6c 00 04 00 00 00 01 00 01 00 29 00 38 00 02 00 02 00 1d 00 04 00 00 00 ff 
00 02 00 0a 00 14 00 01 00 00 15 00 01 05 00 5f 00 01 00 00 6c 00 04 00 00 00 
02 00 03 00 25 00 6c 00 04 00 00 00 01 00 2c 00 02 02 00 00 04 00 13 00 2a 00 
01 00 00 54 00 0a 01 00 00 ab cd ef 0a 09 08 07 00 03 00 17 00 6c 00 04 00 00 
00 02 00 2c 00 02 02 00 00 04 00 05 00 2a 00 01 01 .
-osmo_pfcp_msg_decode_header() rc = 199
+21 32 00 d1 00 00 00 00 00 00 00 00 00 00 07 00 00 3c 00 05 00 7f 00 00 01 00 
39 00 0d 02 12 34 56 78 90 ab cd ef 0a 09 08 07 00 01 00 2f 00 38 00 02 00 01 
00 1d 00 04 00 00 00 ff 00 02 00 15 00 14 00 01 01 00 16 00 03 66 6f 6f 00 5d 
00 05 06 c0 a8 00 17 00 6c 00 04 00 00 00 01 00 01 00 30 00 38 00 02 00 02 00 
1d 00 04 00 00 00 ff 00 02 00 11 00 14 00 01 00 00 15 00 01 05 00 16 00 03 62 
61 72 00 5f 00 01 00 00 6c 00 04 00 00 00 02 00 03 00 25 00 6c 00 04 00 00 00 
01 00 2c 00 02 02 00 00 04 00 13 00 2a 00 01 00 00 54 00 0a 01 00 00 ab cd ef 
0a 09 08 07 00 03 00 17 00 6c 00 04 00 00 00 02 00 2c 00 02 02 00 00 04 00 05 
00 2a 00 01 01 .
+osmo_pfcp_msg_decode_header() rc = 213
 rc == msgb_length()
 osmo_pfcp_msg_decode_tlv() rc = 0
 parsed == orig
@@ -89,10 +89,10 @@

 === start test_enc_dec[8]
 encoding: SESSION_MOD_REQ
-PFCPv1 SESSION_MOD_REQ hdr={seq=9 SEID=0x0} ies={ 'Remove PDR'={ { 'PDR ID'=1 
} } 'Remove FAR'={ { 'FAR ID'=1 } } 'Create PDR'={ { 'PDR ID'=3 
'Precedence'=255 'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 } 'Outer 
Header Removal'=GTP_U_UDP_IPV4 'FAR ID'=3 } } 'Create FAR'={ { 'FAR ID'=3 
'Apply Action'=( FORW ) 'Forwarding Parameters'={ 'Destination 
Interface'=Access 'Outer Header Creation'=( GTP_U_UDP_IPV4 
),TEID:0xabcdef,v4:10.9.8.7 } } } 'Update PDR'={ { 'PDR ID'=1 'Outer Header 
Removal'=GTP_U_UDP_IPV4 'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 } 
'FAR ID'=1 } } 'Update FAR'={ { 'FAR ID'=1 'Update Forwarding Parameters'={ 
'Network Instance'="internet" } } } }
+PFCPv1 SESSION_MOD_REQ hdr={seq=9 SEID=0x0} ies={ 'Remove PDR'={ { 'PDR ID'=1 
} } 'Remove FAR'={ { 'FAR ID'=1 } } 'Create PDR'={ { 'PDR ID'=3 
'Precedence'=255 'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 'Network 
Instance'="baz" } 'Outer Header Removal'=GTP_U_UDP_IPV4 'FAR ID'=3 } } 'Create 
FAR'={ { 'FAR ID'=3 'Apply Action'=( FORW ) 'Forwarding Parameters'={ 
'Destination Interface'=Access 'Outer Header Creation'=( GTP_U_UDP_IPV4 
),TEID:0xabcdef,v4:10.9.8.7 } } } 'Update PDR'={ { 'PDR ID'=1 'Outer Header 
Removal'=GTP_U_UDP_IPV4 'PDI'={ 'Source Interface'=Access 'F-TEID'=CHOOSE-v4 
'Network Instance'="moo" } 'FAR ID'=1 } } 'Update FAR'={ { 'FAR ID'=1 'Update 
Forwarding Parameters'={ 'Network Instance'="internet" } } } }
 osmo_pfcp_msg_encode() rc = 0
-21 34 00 b9 00 00 00 00 00 00 00 00 00 00 09 00 00 0f 00 06 00 38 00 02 00 01 
00 10 00 08 00 6c 00 04 00 00 00 01 00 01 00 29 00 38 00 02 00 03 00 1d 00 04 
00 00 00 ff 00 02 00 0a 00 14 00 01 00 00 15 00 01 05 00 5f 00 01 00 00 6c 00 
04 00 00 00 03 00 03 00 25 00 6c 00 04 00 00 00 03 00 2c 00 02 02 00 00 04 00 
13 00 2a 00 01 00 00 54 00 0a 01 00 00 ab cd ef 0a 09 08 07 00 09 00 21 00 38 
00 02 00 01 00 5f 00 01 00 00 02 00 0a 00 14 00 01 00 00 15 00 01 05 00 6c 00 
04 00 00 00 01 00 0a 00 18 00 6c 00 04 00 00 00 01 00 0b 00 0c 00 16 00 08 69 
6e 74 65 72 6e 65 74 .
-osmo_pfcp_msg_decode_header() rc = 189
+21 34 00 c7 00 00 00 00 00 00 00 00 00 00 09 00 00 0f 00 06 00 38 00 02 00 01 
00 10 00 08 00 6c 00 04 00 00 00 01 00 01 00 30 00 38 00 02 00 03 00 1d 00 04 
00 00 00 ff 00 02 00 11 00 14 00 01 00 00 15 00 01 05 00 16 00 03 62 61 7a 00 
5f 00 01 00 00 6c 00 04 00 00 00 03 00 03 00 25 00 6c 00 04 00 00 00 03 00 2c 
00 02 02 00 00 04 00 13 00 2a 00 01 00 00 54 00 0a 01 00 00 ab cd ef 0a 09 08 
07 00 09 00 28 00 38 00 02 00 01 00 5f 00 01 00 00 02 00 11 00 14 00 01 00 00 
15 00 01 05 00 16 00 03 6d 6f 6f 00 6c 00 04 00 00 00 01 00 0a 00 18 00 6c 00 
04 00 00 00 01 00 0b 00 0c 00 16 00 08 69 6e 74 65 72 6e 65 74 .
+osmo_pfcp_msg_decode_header() rc = 203
 rc == msgb_length()
 osmo_pfcp_msg_decode_tlv() rc = 0
 parsed == orig

--
To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/30248
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-pfcp
Gerrit-Branch: master
Gerrit-Change-Id: I162299e70b4fb0c3fef8039d693ac7d3fe4df16a
Gerrit-Change-Number: 30248
Gerrit-PatchSet: 3
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to