Skip to content

Commit

Permalink
v6.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
impratikjaiswal committed Jan 8, 2024
1 parent 2260f66 commit dff3db8
Show file tree
Hide file tree
Showing 32 changed files with 264 additions and 112 deletions.
15 changes: 6 additions & 9 deletions asn1_play/generated_code/asn1/asn1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def __init__(self, asn1_schema=None, asn1_object=None, asn1_object_alternate=Non
self.asn1_object_alternate = None
self.__set_asn1_object_alternate(asn1_object_alternate)
self.fetch_asn1_objects_list = True if fetch_asn1_objects_list is True else False
self.asn1_object_list = None
self.__set_asn1_object_list()
self.asn1_objects_list = None
self.__set_asn1_objects_list()

def __set_asn1_schema(self, asn1_schema):
if asn1_schema is None or not isinstance(asn1_schema, Asn1Schema):
Expand Down Expand Up @@ -67,11 +67,8 @@ def get_asn1_mapping(self):
def is_fetch_asn1_objects_list(self):
return self.fetch_asn1_objects_list

def get_asn1_object_list(self):
return self.asn1_object_list
def get_asn1_object_list(self, str_format=False):
return PhConstants.SEPERATOR_TWO_LINES.join(self.asn1_objects_list) if str_format else self.asn1_objects_list

def __set_asn1_object_list(self, str_decorated=True):
if self.fetch_asn1_objects_list is True:
self.asn1_object_list = [k for k in self.get_asn1_mapping().keys()]
if str_decorated:
self.asn1_object_list = PhConstants.SEPERATOR_TWO_LINES.join(self.asn1_object_list)
def __set_asn1_objects_list(self):
self.asn1_objects_list = list(self.get_asn1_mapping().keys())
4 changes: 4 additions & 0 deletions asn1_play/generated_code/asn1/asn1_families.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Asn1Family:
GSMA_SGP_22 = 'GSMA_SGP_22'
GSMA_SGP_32 = 'GSMA_SGP_32'
TCA_EPP = 'TCA_EPP'
22 changes: 16 additions & 6 deletions asn1_play/generated_code/asn1/asn1_versions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from asn1_play.generated_code.asn1.asn1_schema import Asn1Schema

from python_helpers.ph_util import PhUtil

class Asn1Family:
GSMA_SGP_22 = 'GSMA_SGP_22'
GSMA_SGP_32 = 'GSMA_SGP_32'
TCA_EPP = 'TCA_EPP'
from asn1_play.generated_code.asn1.asn1_families import Asn1Family
from asn1_play.generated_code.asn1.asn1_schema import Asn1Schema


class Asn1Versions:
Expand Down Expand Up @@ -54,3 +51,16 @@ class Asn1Versions:
TCA_EPP_v3_2 = Asn1Schema(asn1_family=Asn1Family.TCA_EPP, asn1_version='v3_2', asn1_class_name='PEDefinitions')
TCA_EPP_v3_3 = Asn1Schema(asn1_family=Asn1Family.TCA_EPP, asn1_version='v3_3', asn1_class_name='PEDefinitions')
TCA_EPP_v3_3_1 = Asn1Schema(asn1_family=Asn1Family.TCA_EPP, asn1_version='v3_3_1', asn1_class_name='PEDefinitions')

@classmethod
def _get_asn1_version(cls, version_string, error_handling=False):
if error_handling:
try:
return getattr(Asn1Versions, version_string)
except AttributeError:
return None
return getattr(Asn1Versions, version_string)

@classmethod
def _get_list_of_supported_versions(cls):
return PhUtil.get_obj_list(Asn1Versions, clean_name=True)
22 changes: 16 additions & 6 deletions asn1_play/main/asn1play.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from asn1_play.main.data_type.user_data import UserData
from asn1_play.main.helper.constants_config import ConfigConst
from asn1_play.main.helper.defaults import Defaults
from asn1_play.test.test import Test


def process_data(execution_mode, error_handling_mode):
Expand Down Expand Up @@ -69,17 +70,30 @@ def process_data(execution_mode, error_handling_mode):
#####
UnitTesting(),
]
test_generic = [
#####
# Unit Testing Generic
#####
Test(),
]
data_types_pool = {
PhExecutionModes.USER: data_type_user,
PhExecutionModes.DEV: data_type_dev,
PhExecutionModes.SAMPLE_GENERIC: data_types_sample_generic,
PhExecutionModes.SAMPLE_SPECIFIC: data_types_sample_specific,
PhExecutionModes.UNIT_TESTING: data_type_unit_testing,
PhExecutionModes.ALL: data_types_sample_generic + data_types_sample_specific + data_type_unit_testing + data_type_user,
PhExecutionModes.UNIT_TESTING: test_generic + data_type_unit_testing,
PhExecutionModes.ALL: data_types_sample_generic + data_types_sample_specific + test_generic + data_type_unit_testing + data_type_user,
}
data_types = data_types_pool.get(execution_mode, Defaults.EXECUTION_MODE)
for data_type in data_types:
PhUtil.print_heading(str_heading=str(data_type.__class__.__name__))
if isinstance(data_type, UnitTesting):
error_handling_mode = PhErrorHandlingModes.CONTINUE_ON_ERROR
if isinstance(data_type, Dev):
error_handling_mode = PhErrorHandlingModes.STOP_ON_ERROR
if isinstance(data_type, Test):
Test.test_data()
continue
data_type.set_print_input()
data_type.set_print_output()
data_type.set_print_info()
Expand All @@ -91,10 +105,6 @@ def process_data(execution_mode, error_handling_mode):
data_type.set_input_format()
data_type.set_asn1_element()
data_type.set_data_pool()
if isinstance(data_type, UnitTesting):
error_handling_mode = PhErrorHandlingModes.CONTINUE_ON_ERROR
if isinstance(data_type, Dev):
error_handling_mode = PhErrorHandlingModes.STOP_ON_ERROR
DataTypeMaster.parse_safe(data_type, error_handling_mode)


Expand Down
2 changes: 1 addition & 1 deletion asn1_play/main/convert/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def parse_config(config_data):
if not v:
continue
if k in [PhKeys.ASN1_SCHEMA]:
asn1_schema = getattr(Asn1Versions, v)
asn1_schema = Asn1Versions._get_asn1_version(v)
continue
if k in [PhKeys.ASN1_OBJECT]:
asn1_object = v
Expand Down
2 changes: 1 addition & 1 deletion asn1_play/main/convert/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def decode_encode_asn(raw_data=PhConstants.STR_EMPTY, parse_only=True, input_for
offset = 0
if asn1_element and isinstance(asn1_element, Asn1):
if asn1_element.is_fetch_asn1_objects_list():
return asn1_element.get_asn1_object_list()
return asn1_element.get_asn1_object_list(str_format=True)
if not raw_data:
raise ValueError(PhExceptionHelper(msg_key=Constants.RAW_DATA_MISSING, function_name=func_name))
if input_format not in FormatsGroup.INPUT_FORMATS:
Expand Down
2 changes: 1 addition & 1 deletion asn1_play/main/helper/constants_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ConfigConst:
TOOL_VERSION = '6.1.0'
TOOL_VERSION = '6.1.2'
TOOL_VERSION_DETAILED = f'v{TOOL_VERSION}'
TOOL_NAME = 'asn1play'
52 changes: 46 additions & 6 deletions asn1_play/test/log/pycharm_SGP22_v2_4-epp_v3_2.log
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ User Name is Pratik Jaiswal
--------------------------------------------------------------------------------
User Account is impra
--------------------------------------------------------------------------------
Time Stamp is Monday, Jan 01 2024, 17:32:09:530357, IST (GMT+0530)
Time Stamp is Monday, Jan 08 2024, 10:44:20:165872, IST (GMT+0530)
--------------------------------------------------------------------------------
IPV4 is 49.37.241.88
IPV6 is 2405:201:d005:d029:500e:fdc1:9fe9:1756
IPV4 is 152.58.194.72
IPV6 is 2409:40f2:104b:e0da:68f4:f398:f058:6938
--------------------------------------------------------------------------------
pythonHelpers version is v3.0.1
pythonHelpers version is v3.0.2
--------------------------------------------------------------------------------
asn1play version is v6.1.0
asn1play version is v6.1.2
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
tlvPlay version is v3.0.0
tlvPlay version is v3.1.0
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SGP22 compile_time version is v2_4
Expand Down Expand Up @@ -4847,6 +4847,46 @@ Input Data:
}
Output Data: 3007a0058000810163
--------------------------------------------------------------------------------
--------------------------------------------------------- Test ---------------------------------------------------------
************************************************ Welcome To AsnPlay !!! ************************************************
Remarks List Generated: Welcome To AsnPlay !!!
Info => Conversion_Mode; Input Format: ascii; Output Format: hex
Input Data: Welcome To AsnPlay !!!
Output Data: 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
raw_data Welcome To AsnPlay !!!
input_format ascii
output_format hex
output_data 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
All Supported Versions:
GSMA_SGP_22_v1_0
GSMA_SGP_22_v1_1
GSMA_SGP_22_v1_2
GSMA_SGP_22_v2_0
GSMA_SGP_22_v2_1
GSMA_SGP_22_v2_2
GSMA_SGP_22_v2_2_1
GSMA_SGP_22_v2_2_2
GSMA_SGP_22_v2_3
GSMA_SGP_22_v2_4
GSMA_SGP_22_v2_4_sgp23_1_11
GSMA_SGP_22_v2_5
GSMA_SGP_22_v3_0_0
GSMA_SGP_22_v3_1
GSMA_SGP_32_v1_0
GSMA_SGP_32_v1_0_1
TCA_EPP_v1_0
TCA_EPP_v2_0
TCA_EPP_v2_1
TCA_EPP_v2_2
TCA_EPP_v2_3
TCA_EPP_v2_3_1
TCA_EPP_v3_0
TCA_EPP_v3_1
TCA_EPP_v3_2
TCA_EPP_v3_3
TCA_EPP_v3_3_1
------------------------------------------------------ UnitTesting -----------------------------------------------------
******************************** ..\..\Data\UserData\Generic\ASCII\hex_to_ascii_exp.yml ********************************
Remarks List: HexInput; AsciiOutput; YmlOutput; ExportKeyword
Expand Down
52 changes: 46 additions & 6 deletions asn1_play/test/log/pycharm_SGP22_v3_0_0-epp_v3_1.log
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ User Name is Pratik Jaiswal
--------------------------------------------------------------------------------
User Account is impra
--------------------------------------------------------------------------------
Time Stamp is Monday, Jan 01 2024, 17:32:49:474304, IST (GMT+0530)
Time Stamp is Monday, Jan 08 2024, 10:44:53:212284, IST (GMT+0530)
--------------------------------------------------------------------------------
IPV4 is 49.37.241.88
IPV6 is 2405:201:d005:d029:500e:fdc1:9fe9:1756
IPV4 is 152.58.194.72
IPV6 is 2409:40f2:104b:e0da:68f4:f398:f058:6938
--------------------------------------------------------------------------------
pythonHelpers version is v3.0.1
pythonHelpers version is v3.0.2
--------------------------------------------------------------------------------
asn1play version is v6.1.0
asn1play version is v6.1.2
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
tlvPlay version is v3.0.0
tlvPlay version is v3.1.0
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
SGP22 compile_time version is v3_0_0
Expand Down Expand Up @@ -4847,6 +4847,46 @@ Input Data:
}
Output Data: 3007a0058000810163
--------------------------------------------------------------------------------
--------------------------------------------------------- Test ---------------------------------------------------------
************************************************ Welcome To AsnPlay !!! ************************************************
Remarks List Generated: Welcome To AsnPlay !!!
Info => Conversion_Mode; Input Format: ascii; Output Format: hex
Input Data: Welcome To AsnPlay !!!
Output Data: 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
raw_data Welcome To AsnPlay !!!
input_format ascii
output_format hex
output_data 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
All Supported Versions:
GSMA_SGP_22_v1_0
GSMA_SGP_22_v1_1
GSMA_SGP_22_v1_2
GSMA_SGP_22_v2_0
GSMA_SGP_22_v2_1
GSMA_SGP_22_v2_2
GSMA_SGP_22_v2_2_1
GSMA_SGP_22_v2_2_2
GSMA_SGP_22_v2_3
GSMA_SGP_22_v2_4
GSMA_SGP_22_v2_4_sgp23_1_11
GSMA_SGP_22_v2_5
GSMA_SGP_22_v3_0_0
GSMA_SGP_22_v3_1
GSMA_SGP_32_v1_0
GSMA_SGP_32_v1_0_1
TCA_EPP_v1_0
TCA_EPP_v2_0
TCA_EPP_v2_1
TCA_EPP_v2_2
TCA_EPP_v2_3
TCA_EPP_v2_3_1
TCA_EPP_v3_0
TCA_EPP_v3_1
TCA_EPP_v3_2
TCA_EPP_v3_3
TCA_EPP_v3_3_1
------------------------------------------------------ UnitTesting -----------------------------------------------------
******************************** ..\..\Data\UserData\Generic\ASCII\hex_to_ascii_exp.yml ********************************
Remarks List: HexInput; AsciiOutput; YmlOutput; ExportKeyword
Expand Down
50 changes: 45 additions & 5 deletions asn1_play/test/log/pycharm_SGP22_v3_0_0-epp_v3_2.log
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ User Name is Pratik Jaiswal
--------------------------------------------------------------------------------
User Account is impra
--------------------------------------------------------------------------------
Time Stamp is Monday, Jan 01 2024, 18:13:23:089717, IST (GMT+0530)
Time Stamp is Monday, Jan 08 2024, 10:45:13:713594, IST (GMT+0530)
--------------------------------------------------------------------------------
IPV4 is 49.37.241.88
IPV6 is 2405:201:d005:d029:500e:fdc1:9fe9:1756
IPV4 is 152.58.194.72
IPV6 is 2409:40f2:104b:e0da:68f4:f398:f058:6938
--------------------------------------------------------------------------------
pythonHelpers version is v3.0.1
pythonHelpers version is v3.0.2
--------------------------------------------------------------------------------
asn1play version is v6.1.0
asn1play version is v6.1.2
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
tlvPlay version is v3.1.0
Expand Down Expand Up @@ -4847,6 +4847,46 @@ Input Data:
}
Output Data: 3007a0058000810163
--------------------------------------------------------------------------------
--------------------------------------------------------- Test ---------------------------------------------------------
************************************************ Welcome To AsnPlay !!! ************************************************
Remarks List Generated: Welcome To AsnPlay !!!
Info => Conversion_Mode; Input Format: ascii; Output Format: hex
Input Data: Welcome To AsnPlay !!!
Output Data: 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
raw_data Welcome To AsnPlay !!!
input_format ascii
output_format hex
output_data 57656c636f6d6520546f2041736e506c617920212121
--------------------------------------------------------------------------------
All Supported Versions:
GSMA_SGP_22_v1_0
GSMA_SGP_22_v1_1
GSMA_SGP_22_v1_2
GSMA_SGP_22_v2_0
GSMA_SGP_22_v2_1
GSMA_SGP_22_v2_2
GSMA_SGP_22_v2_2_1
GSMA_SGP_22_v2_2_2
GSMA_SGP_22_v2_3
GSMA_SGP_22_v2_4
GSMA_SGP_22_v2_4_sgp23_1_11
GSMA_SGP_22_v2_5
GSMA_SGP_22_v3_0_0
GSMA_SGP_22_v3_1
GSMA_SGP_32_v1_0
GSMA_SGP_32_v1_0_1
TCA_EPP_v1_0
TCA_EPP_v2_0
TCA_EPP_v2_1
TCA_EPP_v2_2
TCA_EPP_v2_3
TCA_EPP_v2_3_1
TCA_EPP_v3_0
TCA_EPP_v3_1
TCA_EPP_v3_2
TCA_EPP_v3_3
TCA_EPP_v3_3_1
------------------------------------------------------ UnitTesting -----------------------------------------------------
******************************** ..\..\Data\UserData\Generic\ASCII\hex_to_ascii_exp.yml ********************************
Remarks List: HexInput; AsciiOutput; YmlOutput; ExportKeyword
Expand Down
31 changes: 21 additions & 10 deletions asn1_play/test/test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
from python_helpers.ph_modes_error_handling import PhErrorHandlingModes
from python_helpers.ph_util import PhUtil

from asn1_play.generated_code.asn1.asn1_versions import Asn1Versions
from asn1_play.main.data_type.data_type_master import DataTypeMaster
from asn1_play.main.helper.data import Data

raw_data = 'Welcome To AsnPlay !!!'
input_format = 'ascii'
output_format = 'hex'

data_type = DataTypeMaster()
data_type.set_data_pool(data_pool=[Data(raw_data=raw_data, input_format=input_format, output_format=output_format)])
data_type.parse_safe(PhErrorHandlingModes.CONTINUE_ON_ERROR)
print(f'raw_data {raw_data}')
print(f'input_format {input_format}')
print(f'output_format {output_format}')
print(f'output_data {data_type.meta_data_pool[0]}')
class Test():

@classmethod
def test_data(self):
raw_data = 'Welcome To AsnPlay !!!'
input_format = 'ascii'
output_format = 'hex'

data_type = DataTypeMaster()
data_type.set_data_pool(
data_pool=[Data(raw_data=raw_data, input_format=input_format, output_format=output_format)])
data_type.parse_safe(PhErrorHandlingModes.CONTINUE_ON_ERROR)
print(f'raw_data {raw_data}')
print(f'input_format {input_format}')
print(f'output_format {output_format}')
print(f'output_data {data_type.get_output_data()}')
PhUtil.print_separator()
data = Asn1Versions._get_list_of_supported_versions()
PhUtil.print_iter(data, header='All Supported Versions')
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ output:
bf2582031c5a0a989209012143658709f591095350204e616d652031921a4f7065726174696f6e616c2050726f66696c65204e616d6520319301019482029089504e470d0a1a0a0000000d49484452000000400000004008040000000060b9550000000774494d4507e00b091007364c956f97000000097048597300000b1200000b1201d2dd7efc0000000467414d410000b18f0bfc61050000021f4944415478daed99cd1583200c803d32000b3004abb00ecbb0822338578af559223f49b0a8175f2ec023e1238410db09a667e5e1e55f80bf00f686060b1e66b80420c02a32550d0e966e8cc6f0128d193460635fa66a3b7d511db48dd94788b655d7815071ba26e61b9000acc711841085eb398d84c0cd94f921ebe2ddab18db6b5005b055c3bc752b4038745c5339449cd4950248100e1d4528fac207b228e3101a4bd4ae52ba96a603808b05d44c27adab2af8807a00a6184b228014807566eca13538e5008ac890bf06be809e4dbebe0b808a842a009ffd7b010436af06b04f034c8d47ea46004703e034e4d95b90a98a447300dc353c9f07a843404d9b2d904bca84f62480a7013c39351431225b722de9f6ad591a0047c194e5ae19bd865afc1a26976f088603c0a7ac9117fce131f64200bcdfed8e290ee058906c46f2fad09dac885ab1550c68d2a8b426dcf69b8e71f76d195b15cd368207463513fd2dea6648476b2500eb999b6250fa5dc0499e0b88b921f2bbaf782e877588930370724e4d3f0dd01d49dbe7e92cb940423172008f3ed3c6011c03b1396bce6ec24800c703b862682480a20142250b8c05c081385186cd65009607d059dd772b80ae3cb963010205b054436414808abb0ff237752480a996fb3702d8334fda0bf002bc002fc0488053b5f5380005dc0a1703f03ffdfdc433a6fa010cf1ef4165c831e602b40134844c66e67fa4c1000618e5ab8f6008c03faab7028c9117e0036baf44917035af0e0000000049454e44ae426082b621301f800204f0811974657374736d6470706c7573312e6578616d706c652e636f6db705800392f91899020640bf220f300d8003883710a1060404c1020304bf230f300d8003883711a106040402020202
output_version:
Python: v3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
pythonHelpers: v3.0.1
asn1play: v6.1.0
pythonHelpers: v3.0.2
asn1play: v6.1.2
SGP22: v2_4
SGP32: v1_0_1
eUICC_Profile_Package: v3_2
time_stamp: Monday, Jan 01 2024, 17:32:11:037606, IST (GMT+0530)
time_stamp: Monday, Jan 08 2024, 10:44:21:881007, IST (GMT+0530)
Loading

0 comments on commit dff3db8

Please sign in to comment.