Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

FG UE Pol Manage Command fromJson #248

Open
maddenj-ie opened this issue Nov 17, 2023 · 2 comments
Open

FG UE Pol Manage Command fromJson #248

maddenj-ie opened this issue Nov 17, 2023 · 2 comments
Assignees
Labels

Comments

@maddenj-ie
Copy link

Hi,

I'm experimenting with the FG UE Policy Management Command to/from json functionality using the pytest below.

from pycrate_core.repr import show
from pycrate_mobile.TS24501_UEPOL import FGUEPOLManageUEPolicyCommand


class TestManageUePolicyCommandJson:

    def test_to_from_json(self):
        command_obj = FGUEPOLManageUEPolicyCommand(val={
            'UEPolSectionList': [
                {
                    'PLMN': '27201',
                    'Cont': [
                        {
                            'UPSC': 1,
                            'Cont': [
                                {
                                    'Type': 1,
                                    'Cont': [
                                        {
                                            'Precedence': 1,
                                            'TrafficDesc': [
                                                {
                                                    'Type': 16,
                                                    'Value':
                                                        {
                                                            'Addr': b'aaaa',
                                                            'Mask': b'BBBB'
                                                        }
                                                }
                                            ],
                                            'RouteSelectDescList': [
                                                {
                                                    'Precedence': 1,
                                                    'Cont': [
                                                        {
                                                            'Type': 16,
                                                            'Value':
                                                                {
                                                                    'Value': 1
                                                                }
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        })
        show(command_obj)
        generated_json = command_obj.to_json()
        print("generated JSON : " + generated_json)

        parsed_json_command = FGUEPOLManageUEPolicyCommand()
        parsed_json_command.from_json(generated_json)
        show(parsed_json_command)

Using the show command, the parsed command obj is as follows:

### 5GUEPOLManageUEPolicyCommand ###
 ### 5GUEPOLHeader ###
  <PTI : 0>
  <Type : 1 (MANAGE UE POLICY COMMAND message)>
 ### UEPolSectionList ###
  <L : 35>
  <V : 0x000700000000020000>

The toJson works as I'd expect but the fromJson does not.

This may be down to user error. ;-)

I'd appreciate any feedback. Thanks.

@p1-bmu p1-bmu self-assigned this Nov 22, 2023
@p1-bmu
Copy link
Contributor

p1-bmu commented Nov 23, 2023

Thank you for the bug report.
There is a custom routine to set specific IEs in NAS Layer 3 messages, and I guess I did not extend for proper JSON support; I think a good starting point for a patch would be here:

def set_val(self, vals):

I'll check what I can do to fix this in the following weeks.

@p1-bmu p1-bmu added the bug label Nov 23, 2023
@mitshell
Copy link
Contributor

mitshell commented Mar 1, 2024

A new repository has been setup, including new fixes. This repo will keep being maintained : https://github.com/pycrate-org/pycrate.
Please checkout the latest 0.7.1 version which provides extended JSON support for mobile NAS messages.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants