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

FG UE Pol Manage Command fromJson #248

@maddenj-ie

Description

@maddenj-ie

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions