Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for grpc configuration for mock HSS at federated integ test #12406

Merged

Conversation

uri200
Copy link
Contributor

@uri200 uri200 commented Apr 6, 2022

…teg test

Signed-off-by: Oriol Batalla obatalla@fb.com

Summary

This PR adds support to configure mock HSS running on FEG through s1aptestr.

We had to subclass SubscriberDBGrpc object to be able to use it with either a subscriberDB grpc stub or with a mock HSS grpc stub.

Note this PR depends on #12391, #12387, #12345 (and part of this issue #11338)

Note this framework can be used to add support to configure mock PCRF and mock OCS we have on magma testcore

Test Plan

This log below shows the federated test running using mock hss. In that case the HSS is configured with two subscribers, updated with specific APN. Subscriber db remains unconfigured for this case

The second log shows how HSS is configured with those subscribers.

Third log shows s6a_proxy running on that setup showing authentication messages comming from HSS

vagrant@magma-test:~/magma/lte/gateway/python/integ_tests$ make integ_test TESTS=federated_tests/s1aptests/test_attach_detach.py
make: Warning: File 'defs.mk' has modification time 443954 s in the future
. /home/vagrant/build/python/bin/activate
echo "Running test: federated_tests/s1aptests/test_attach_detach.py"
Running test: federated_tests/s1aptests/test_attach_detach.py
timeout --foreground -k 930s 900s sudo -E PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin PYTHONPATH=:/home/vagrant/s1ap-tester/bin /home/vagrant/build/python/bin/nosetests --with-flaky --force-flaky --no-success-flaky-report --max-runs=1 --min-passes=1 --with-xunit --xunit-file=/var/tmp/test_results/test_attach_detach.xml -x -s federated_tests/s1aptests/test_attach_detach.py || (echo "fail" > /home/vagrant/magma/test_status.txt && exit 1)
Start time 19:45:52
tag: AUTH_TYPE tagVal: MILENAGE
************************* Enb tester config

**********************TPT open server******** 0

 Server Socket FD =[13]
************* Testing *Time elapsed(in usec): for timer expiry               :4043 usec
AGW is stateless
APN Correction configured
Health service is disabled
Using subscriber IMSI IMSI001010000000001
Using IMEI 3805468432113171
Using subscriber IMSI IMSI001010000000002
Using IMEI 3805468432113172
************************* UE device config for ue_id  1
************************* UE device config for ue_id  2
************************* Configuring IP block
************************* Waiting for IP changes to propagate
************************* S1 setup
************************* UE App config
************************* Running Federated End to End attach for UE id  1
ue id 1 found
PDN_TYPE: 1
IPv4 PDN_ADDRESS:192 168 128 12

*************NbUiNbuHdlUeRadioCapMsg: Send UE cap msg SUCCESS*********
************************* Running UE detach for UE id  1
Deleting Ue Context from Traffic Handler
************************* Running Federated End to End attach for UE id  2
ue id 2 found

*************NbUiNbuHdlUeRadioCapMsg: Send UE cap msg SUCCESS*********
PDN_TYPE: 1
IPv4 PDN_ADDRESS:192 168 128 13
************************* Running UE detach for UE id  2
Deleting Ue Context from Traffic Handler
************************* send SCTP SHUTDOWN
Keys left in Redis (list should be empty)[

]
Entries in s1ap_imsi_map (should be zero): 0
Entries left in hashtables (should be zero): 0
Entries in mme_ueip_imsi_map (should be zero): 0
.
----------------------------------------------------------------------
Ran 1 test in 8.597s

OK
sleep 1
make: warning:  Clock skew detected.  Your build may be incomplete.

mock hss grpc log


hss              | I0405 23:50:59.539818       1 impl.go:51] Mconfig refresh succeeded from: /var/opt/magma/configs/gateway.mconfig
hss              | 2022/04/05 23:52:30 Received ListSubscribers
hss              | I0405 23:52:30.078017       1 logcodec.go:96] Sending: *protos.SubscriberIDSet: {
hss              | 	"sids": [
hss              | 	]
hss              | }
hss              | 2022/04/05 23:52:30 Received ListSubscribers
hss              | I0405 23:52:30.078934       1 logcodec.go:96] Sending: *protos.SubscriberIDSet: {
hss              | 	"sids": [
hss              | 	]
hss              | }
hss              | I0405 23:52:32.434674       1 logcodec.go:96] Received: *protos.SubscriberData: {
hss              | 	"sid": {
hss              | 		"id": "001010000000001",
hss              | 		"type": "IMSI"
hss              | 	},
hss              | 	"gsm": null,
hss              | 	"lte": {
hss              | 		"state": "ACTIVE",
hss              | 		"auth_algo": "MILENAGE",
hss              | 		"auth_key": "AAECAwQFBgcICQoLDA0ODw==",
hss              | 		"auth_opc": null,
hss              | 		"assigned_base_names": [
hss              | 		],
hss              | 		"assigned_policies": [
hss              | 		]
hss              | 	},
hss              | 	"network_id": null,
hss              | 	"state": {
hss              | 		"lte_auth_next_seq": "1",
hss              | 		"tgpp_aaa_server_name": "",
hss              | 		"tgpp_aaa_server_registered": false
hss              | 	},
hss              | 	"sub_profile": "",
hss              | 	"non_3gpp": null,
hss              | 	"sub_network": null
hss              | }
hss              | 2022/04/05 23:52:32 Received AddSubscriber
hss              | I0405 23:52:32.436879       1 logcodec.go:96] Received: *protos.SubscriberData: {
hss              | 	"sid": {
hss              | 		"id": "001010000000002",
hss              | 		"type": "IMSI"
hss              | 	},
hss              | 	"gsm": null,
hss              | 	"lte": {
hss              | 		"state": "ACTIVE",
hss              | 		"auth_algo": "MILENAGE",
hss              | 		"auth_key": "AAECAwQFBgcICQoLDA0ODw==",
hss              | 		"auth_opc": null,
hss              | 		"assigned_base_names": [
hss              | 		],
hss              | 		"assigned_policies": [
hss              | 		]
hss              | 	},
hss              | 	"network_id": null,
hss              | 	"state": {
hss              | 		"lte_auth_next_seq": "1",
hss              | 		"tgpp_aaa_server_name": "",
hss              | 		"tgpp_aaa_server_registered": false
hss              | 	},
hss              | 	"sub_profile": "",
hss              | 	"non_3gpp": null,
hss              | 	"sub_network": null
hss              | }
hss              | 2022/04/05 23:52:32 Received AddSubscriber
hss              | I0405 23:52:32.439213       1 logcodec.go:96] Received: *protos.SubscriberUpdate: {
hss              | 	"data": {
hss              | 		"sid": {
hss              | 			"id": "001010000000001",
hss              | 			"type": "IMSI"
hss              | 		},
hss              | 		"gsm": null,
hss              | 		"lte": null,
hss              | 		"network_id": null,
hss              | 		"state": null,
hss              | 		"sub_profile": "",
hss              | 		"non_3gpp": {
hss              | 			"msisdn": "",
hss              | 			"non_3gpp_ip_access": "NON_3GPP_SUBSCRIPTION_ALLOWED",
hss              | 			"non_3gpp_ip_access_apn": "NON_3GPP_APNS_ENABLE",
hss              | 			"ambr": null,
hss              | 			"apn_config": [
hss              | 				{
hss              | 					"context_id": 0,
hss              | 					"service_selection": "magma.ipv4",
hss              | 					"qos_profile": {
hss              | 						"class_id": 9,
hss              | 						"priority_level": 15,
hss              | 						"preemption_capability": true,
hss              | 						"preemption_vulnerability": false
hss              | 					},
hss              | 					"ambr": {
hss              | 						"max_bandwidth_ul": 200000000,
hss              | 						"max_bandwidth_dl": 100000000,
hss              | 						"br_unit": "BPS"
hss              | 					},
hss              | 					"pdn": "IPV4",
hss              | 					"assigned_static_ip": "",
hss              | 					"resource": null
hss              | 				}
hss              | 			],
hss              | 			"access_net_id": "HRPD",
hss              | 			"subscriber_apn_config": [
hss              | 			]
hss              | 		},
hss              | 		"sub_network": null
hss              | 	},
hss              | 	"mask": {
hss              | 		"paths": [
hss              | 			"non_3gpp"
hss              | 		]
hss              | 	}
hss              | }
hss              | 2022/04/05 23:52:32 Received UpdateSubscriber
hss              | 2022/04/05 23:52:32 Received ListSubscribers
hss              | I0405 23:52:32.439918       1 logcodec.go:96] Sending: *protos.SubscriberIDSet: {
hss              | 	"sids": [
hss              | 		{
hss              | 			"id": "001010000000001",
hss              | 			"type": "IMSI"
hss              | 		},
hss              | 		{
hss              | 			"id": "001010000000002",
hss              | 			"type": "IMSI"
hss              | 		}
hss              | 	]
hss              | }
hss              | I0405 23:52:32.441666       1 logcodec.go:96] Received: *protos.SubscriberUpdate: {
hss              | 	"data": {
hss              | 		"sid": {
hss              | 			"id": "001010000000002",
hss              | 			"type": "IMSI"
hss              | 		},
hss              | 		"gsm": null,
hss              | 		"lte": null,
hss              | 		"network_id": null,
hss              | 		"state": null,
hss              | 		"sub_profile": "",
hss              | 		"non_3gpp": {
hss              | 			"msisdn": "",
hss              | 			"non_3gpp_ip_access": "NON_3GPP_SUBSCRIPTION_ALLOWED",
hss              | 			"non_3gpp_ip_access_apn": "NON_3GPP_APNS_ENABLE",
hss              | 			"ambr": null,
hss              | 			"apn_config": [
hss              | 				{
hss              | 					"context_id": 0,
hss              | 					"service_selection": "magma.ipv4",
hss              | 					"qos_profile": {
hss              | 						"class_id": 9,
hss              | 						"priority_level": 15,
hss              | 						"preemption_capability": true,
hss              | 						"preemption_vulnerability": false
hss              | 					},
hss              | 					"ambr": {
hss              | 						"max_bandwidth_ul": 200000000,
hss              | 						"max_bandwidth_dl": 100000000,
hss              | 						"br_unit": "BPS"
hss              | 					},
hss              | 					"pdn": "IPV4",
hss              | 					"assigned_static_ip": "",
hss              | 					"resource": null
hss              | 				}
hss              | 			],
hss              | 			"access_net_id": "HRPD",
hss              | 			"subscriber_apn_config": [
hss              | 			]
hss              | 		},
hss              | 		"sub_network": null
hss              | 	},
hss              | 	"mask": {
hss              | 		"paths": [
hss              | 			"non_3gpp"
hss              | 		]
hss              | 	}
hss              | }

s6a_proxy log showing authentication AVP and grpc protos

s6a_proxy        | Update-Location-Answer (ULA)
s6a_proxy        | {Code:316,Flags:0x40,Version:0x1,Length:576,ApplicationId:16777251,HopByHopId:0x4522165a,EndToEndId:0xb299f797}
s6a_proxy        | 	Session-Id {Code:263,Flags:0x40,Length:60,VendorId:0,Value:UTF8String{string-s6a;14109053113800215333;2073675763;a4e7d9d0},Padding:1}
s6a_proxy        | 	Result-Code {Code:268,Flags:0x40,Length:12,VendorId:0,Value:Unsigned32{2001}}
s6a_proxy        | 	Origin-Host {Code:264,Flags:0x40,Length:32,VendorId:0,Value:DiameterIdentity{magma-fedgw.magma.com},Padding:3}
s6a_proxy        | 	Origin-Realm {Code:296,Flags:0x40,Length:20,VendorId:0,Value:DiameterIdentity{magma.com},Padding:3}
s6a_proxy        | 	Origin-State-Id {Code:278,Flags:0x40,Length:12,VendorId:0,Value:Unsigned32{1649203845}}
s6a_proxy        | 	Vendor-Specific-Application-Id {Code:260,Flags:0x40,Length:32,VendorId:0,Value:Grouped{
s6a_proxy        | 		Vendor-Id {Code:266,Flags:0x40,Length:12,VendorId:0,Value:Unsigned32{10415}},
s6a_proxy        | 		Auth-Application-Id {Code:258,Flags:0x40,Length:12,VendorId:0,Value:Unsigned32{16777251}},
s6a_proxy        | 	}}
s6a_proxy        | 	Auth-Session-State {Code:277,Flags:0x40,Length:12,VendorId:0,Value:Enumerated{1}}
s6a_proxy        | 	ULA-Flags {Code:1406,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{0}}
s6a_proxy        | 	Subscription-Data {Code:1400,Flags:0xc0,Length:360,VendorId:10415,Value:Grouped{
s6a_proxy        | 		MSISDN {Code:701,Flags:0xc0,Length:20,VendorId:10415,Value:OctetString{0x3132333435},Padding:3},
s6a_proxy        | 		Access-Restriction-Data {Code:1426,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{47}},
s6a_proxy        | 		Subscriber-Status {Code:1424,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{0}},
s6a_proxy        | 		Network-Access-Mode {Code:1417,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{2}},
s6a_proxy        | 		APN-Configuration-Profile {Code:1429,Flags:0xc0,Length:236,VendorId:10415,Value:Grouped{
s6a_proxy        | 			Context-Identifier {Code:1423,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{0}},
s6a_proxy        | 			All-APN-Configurations-Included-Indicator {Code:1428,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{0}},
s6a_proxy        | 			APN-Configuration {Code:1430,Flags:0xc0,Length:192,VendorId:10415,Value:Grouped{
s6a_proxy        | 				Context-Identifier {Code:1423,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{0}},
s6a_proxy        | 				PDN-Type {Code:1456,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{0}},
s6a_proxy        | 				Unknown-493-0 {Code:493,Flags:0x40,Length:16,VendorId:0,Value:Unknown{0x6f61692e69707634},Padding:0} (Could not find AVP uint32(493) for Vendor: 0),
s6a_proxy        | 				EPS-Subscribed-QoS-Profile {Code:1431,Flags:0xc0,Length:88,VendorId:10415,Value:Grouped{
s6a_proxy        | 					QoS-Class-Identifier {Code:1028,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{9}},
s6a_proxy        | 					Allocation-Retention-Priority {Code:1034,Flags:0xc0,Length:60,VendorId:10415,Value:Grouped{
s6a_proxy        | 						Priority-Level {Code:1046,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{15}},
s6a_proxy        | 						Pre-emption-Capability {Code:1047,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{1}},
s6a_proxy        | 						Pre-emption-Vulnerability {Code:1048,Flags:0xc0,Length:16,VendorId:10415,Value:Enumerated{0}},
s6a_proxy        | 					}}
s6a_proxy        | 				}}
s6a_proxy        | 					AMBR {Code:1435,Flags:0xc0,Length:44,VendorId:10415,Value:Grouped{
s6a_proxy        | 						Max-Requested-Bandwidth-DL {Code:515,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{20000000}},
s6a_proxy        | 						Max-Requested-Bandwidth-UL {Code:516,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{10000000}},
s6a_proxy        | 					}}
s6a_proxy        | 			}}
s6a_proxy        | 		}}
s6a_proxy        | 			AMBR {Code:1435,Flags:0xc0,Length:44,VendorId:10415,Value:Grouped{
s6a_proxy        | 				Max-Requested-Bandwidth-DL {Code:515,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{20000000}},
s6a_proxy        | 				Max-Requested-Bandwidth-UL {Code:516,Flags:0xc0,Length:16,VendorId:10415,Value:Unsigned32{10000000}},
s6a_proxy        | 			}}
s6a_proxy        | 	}}
s6a_proxy        |
s6a_proxy        | I0406 00:10:45.365679       1 logcodec.go:96] Sending: *protos.UpdateLocationAnswer: {
s6a_proxy        | 	"error_code": "UNDEFINED",
s6a_proxy        | 	"default_context_id": 0,
s6a_proxy        | 	"total_ambr": {
s6a_proxy        | 		"max_bandwidth_ul": 10000000,
s6a_proxy        | 		"max_bandwidth_dl": 20000000,
s6a_proxy        | 		"unit": "BPS"
s6a_proxy        | 	},
s6a_proxy        | 	"all_apns_included": true,
s6a_proxy        | 	"apn": [
s6a_proxy        | 		{
s6a_proxy        | 			"context_id": 0,
s6a_proxy        | 			"service_selection": "oai.ipv4",
s6a_proxy        | 			"qos_profile": {
s6a_proxy        | 				"class_id": 9,
s6a_proxy        | 				"priority_level": 15,
s6a_proxy        | 				"preemption_capability": false,
s6a_proxy        | 				"preemption_vulnerability": true
s6a_proxy        | 			},
s6a_proxy        | 			"ambr": {
s6a_proxy        | 				"max_bandwidth_ul": 10000000,
s6a_proxy        | 				"max_bandwidth_dl": 20000000,
s6a_proxy        | 				"unit": "BPS"
s6a_proxy        | 			},
s6a_proxy        | 			"pdn": "IPV4",
s6a_proxy        | 			"charging_characteristics": ""
s6a_proxy        | 		}
s6a_proxy        | 	],
s6a_proxy        | 	"default_charging_characteristics": "",
s6a_proxy        | 	"msisdn": "MTIzNDU=",
s6a_proxy        | 	"network_access_mode": "ONLY_PACKET",
s6a_proxy        | 	"regional_subscription_zone_code": [
s6a_proxy        | 	],
s6a_proxy        | 	"feature_list_id_2": null,
s6a_proxy        | 	"feature_list_id_1": null
s6a_proxy        | }
s6a_proxy        | I0406 00:10:45.452530       1 logcodec.go:96] Received: *protos.PurgeUERequest: {
s6a_proxy        | 	"user_name": "001010000000002"
s6a_proxy        | }

Additional Information

  • This change is backwards-breaking

@pull-request-size pull-request-size bot added the size/L Denotes a Pull Request that changes 100-499 lines. label Apr 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added component: agw Access gateway-related issue component: feg FEG-gateway related issues labels Apr 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

feg-workflow

    2 files  202 suites   39s ⏱️
371 tests 371 ✔️ 0 💤 0
385 runs  385 ✔️ 0 💤 0

Results for commit 1821e48.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

cloud-workflow

    7 files  356 suites   2m 52s ⏱️
974 tests 974 ✔️ 0 💤 0

Results for commit 1821e48.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

agw-workflow

     77 files     122 suites   7m 42s ⏱️
1 158 tests 1 149 ✔️ 9 💤 0
1 159 runs  1 150 ✔️ 9 💤 0

Results for commit 1821e48.

♻️ This comment has been updated with latest results.

@uri200 uri200 force-pushed the s1aptest_add_support_for_grpc_hss_remote_config branch from d93b400 to 20585df Compare April 11, 2022 17:36
@github-actions
Copy link
Contributor

github-actions bot commented Apr 11, 2022

Oops! Looks like you failed the Python Format Check.

Howto

♻️ Updated: ✅ The check is passing the Python Format Check after the last commit.

from lte.protos.subscriberdb_pb2 import (
LTESubscription,
SubscriberData,
SubscriberID,
SubscriberState,
SubscriberUpdate,
)
from feg.protos.hss_service_pb2_grpc import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we import single class Parenthesis not needed.

@@ -18,14 +18,17 @@
import time

import grpc
from integ_tests.gateway.rpc import get_gateway_hw_id, get_rpc_channel
from integ_tests.gateway.rpc import get_gateway_hw_id, get_rpc_channel, get_hss_rpc_channel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a Python format check complains about order of import statements, please follow as it suggested.

#
#
# Sample configuration
#subscribers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space between # and comment as linter suggested.

Copy link
Contributor

@GANESH-WAVELABS GANESH-WAVELABS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left Minot comments, PR LGTM.

Copy link
Member

@themarwhal themarwhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamping the feg component, will delegate to other reviewers for other parts :D

@uri200 uri200 force-pushed the s1aptest_add_support_for_grpc_hss_remote_config branch from 20585df to c40e1a6 Compare April 29, 2022 20:02
@uri200 uri200 force-pushed the s1aptest_add_support_for_grpc_hss_remote_config branch 3 times, most recently from c101701 to ae1511f Compare April 29, 2022 22:26
@uri200 uri200 enabled auto-merge (squash) April 29, 2022 22:29
Copy link
Contributor

@GANESH-WAVELABS GANESH-WAVELABS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR LGTM from FeG side!!

@uri200 uri200 requested a review from ardzoht May 2, 2022 17:30
@uri200 uri200 disabled auto-merge May 2, 2022 17:33
@uri200 uri200 changed the title feat: Add support for grpc configuration for mock HSS at federated in… feat: Add support for grpc configuration for mock HSS at federated integ test May 2, 2022
Copy link
Contributor

@ardzoht ardzoht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just had a minor nit on param naming, otherwise LGTM

"""

def __init__(self):
def __init__(self, grpcStub):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def __init__(self, grpcStub):
def __init__(self, grpc_stub):

…teg test

Signed-off-by: Oriol Batalla <obatalla@fb.com>
@uri200 uri200 force-pushed the s1aptest_add_support_for_grpc_hss_remote_config branch from ae1511f to 1821e48 Compare May 3, 2022 22:54
@uri200 uri200 enabled auto-merge (squash) May 3, 2022 22:54
@uri200 uri200 merged commit 30a79ec into magma:master May 4, 2022
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: agw Access gateway-related issue component: feg FEG-gateway related issues size/L Denotes a Pull Request that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants