Skip to content

Commit

Permalink
Merge pull request #12 from AeroFlorian/deletion
Browse files Browse the repository at this point in the history
Add deletion of objects handling
  • Loading branch information
AeroFlorian authored Jul 17, 2024
2 parents ab18f1d + d878e93 commit c7b5441
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 75 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

NetConfParser.log
Binary file added fs.ico
Binary file not shown.
179 changes: 137 additions & 42 deletions netconfparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,39 +204,77 @@ def get_type_from_endpoint(scs, dir):
return "DATA"

if low_level_rx_endpoints:
dict_to_display = {
"User Plane Configuration": {
"low-level-rx-endpoints": [
{
"name": rx_endpoint["name"],
"eaxc-id": get_value_if_exists_recurse(rx_endpoint, "eaxc-id"),
"type": get_type_from_endpoint(get_value_if_exists_recurse(rx_endpoint, "scs"), "ul")
}
for rx_endpoint in low_level_rx_endpoints[0]]
if get_value_if_exists_recurse(low_level_rx_endpoints[0][0], "eaxc-id") is None:
mode = "Deletion"
else:
mode = "Creation"
if mode == "Creation":
dict_to_display = {
"User Plane Configuration": {
"low-level-rx-endpoints": [
{
"name": rx_endpoint["name"],
"eaxc-id": get_value_if_exists_recurse(rx_endpoint, "eaxc-id"),
"type": get_type_from_endpoint(get_value_if_exists_recurse(rx_endpoint, "scs"), "ul")
}
for rx_endpoint in low_level_rx_endpoints[0]]
}
}
}
else:
dict_to_display = {
"User Plane Configuration": {
"low-level-rx-endpoints": [
{
"name": rx_endpoint["name"]
}
for rx_endpoint in low_level_rx_endpoints[0]]
}
}
operation = "Creates" if mode == "Creation" else "Deletes"
parent = analysis_box.insert('', 'end', text='', values=(
f"{message_id}", "Cell", "✅", f"O-DU Creates Low Level Rx-Endpoints", ""), tags=tags)
f"{message_id}", "Cell", "✅", f"O-DU {operation} Low Level Rx-Endpoints", ""), tags=tags)
json_tree(parent, dict_to_display, tags, box=analysis_box)
if low_level_tx_endpoints:
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-endpoints": [
{
"name": tx_endpoint["name"],
"eaxc-id": get_value_if_exists_recurse(tx_endpoint, "eaxc-id"),
"type": get_type_from_endpoint(get_value_if_exists_recurse(tx_endpoint, "scs"), "dl")
}
for tx_endpoint in low_level_tx_endpoints[0]]
if get_value_if_exists_recurse(low_level_tx_endpoints[0][0], "eaxc-id") is None:
mode = "Deletion"
else:
mode = "Creation"
if mode == "Creation":
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-endpoints": [
{
"name": tx_endpoint["name"],
"eaxc-id": get_value_if_exists_recurse(tx_endpoint, "eaxc-id"),
"type": get_type_from_endpoint(get_value_if_exists_recurse(tx_endpoint, "scs"), "dl")
}
for tx_endpoint in low_level_tx_endpoints[0]]
}
}
}
else:
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-endpoints": [
{
"name": tx_endpoint["name"]
}
for tx_endpoint in low_level_tx_endpoints[0]]
}
}

operation = "Creates" if mode == "Creation" else "Deletes"
parent = analysis_box.insert('', 'end', text='', values=(
f"{message_id}", "Cell", "✅", f"O-DU Creates Low Level Tx-Endpoints", ""), tags=tags)
f"{message_id}", "Cell", "✅", f"O-DU {operation} Low Level Tx-Endpoints", ""), tags=tags)
json_tree(parent, dict_to_display, tags, box=analysis_box)
if low_level_rx_links:
if type(low_level_rx_links[0]) is list:
low_level_rx_links = low_level_rx_links[0]
dict_to_display = {
if "rx-array-carrier" not in low_level_rx_links[0]:
mode = "Deletion"
else:
mode = "Creation"
if mode == "Creation":
dict_to_display = {
"User Plane Configuration": {
"low-level-rx-links": [
{
Expand All @@ -248,51 +286,94 @@ def get_type_from_endpoint(scs, dir):
for rx_link in low_level_rx_links]
}
}
else:
dict_to_display = {
"User Plane Configuration": {
"low-level-rx-links": [
{
"name": rx_link["name"],
"cell_id": str(compute_cell_id(rx_link["name"]))
}
for rx_link in low_level_rx_links]
}
}
cell_id = ', '.join(set([ll["cell_id"] for ll in dict_to_display["User Plane Configuration"]["low-level-rx-links"]]))
tags = f"cell_{cell_id}"
number_low_level_rx_links = len(dict_to_display["User Plane Configuration"]["low-level-rx-links"])
operation = "Creates" if mode == "Creation" else "Deletes"
parent = analysis_box.insert('', 'end', text='', values=(
f"{message_id}", f"Cell {cell_id}", "✅", f"O-DU Creates {number_low_level_rx_links} Low Level Rx Links for cell {cell_id}", ""), tags=tags)
f"{message_id}", f"Cell {cell_id}", "✅", f"O-DU {operation} {number_low_level_rx_links} Low Level Rx Links for cell {cell_id}", ""), tags=tags)
json_tree(parent, dict_to_display, tags, box=analysis_box)
if low_level_tx_links:
if type(low_level_tx_links[0]) is list:
low_level_tx_links = low_level_tx_links[0]
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-links": [
{
"name": tx_link["name"],
"tx-array-carrier": tx_link["tx-array-carrier"],
"low-level-tx-endpoint": tx_link["low-level-tx-endpoint"],
"cell_id": str(compute_cell_id(tx_link["name"]))
}
for tx_link in low_level_tx_links]
if "tx-array-carrier" not in low_level_tx_links[0]:
mode = "Deletion"
else:
mode = "Creation"

if mode == "Creation":
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-links": [
{
"name": tx_link["name"],
"tx-array-carrier": tx_link["tx-array-carrier"],
"low-level-tx-endpoint": tx_link["low-level-tx-endpoint"],
"cell_id": str(compute_cell_id(tx_link["name"]))
}
for tx_link in low_level_tx_links]
}
}
else:
dict_to_display = {
"User Plane Configuration": {
"low-level-tx-links": [
{
"name": tx_link["name"],
"cell_id": str(compute_cell_id(tx_link["name"]))
}
for tx_link in low_level_tx_links]
}
}
}
cell_id = ', '.join(set([ll["cell_id"] for ll in dict_to_display["User Plane Configuration"]["low-level-tx-links"]]))
tags = f"cell_{cell_id}"
number_low_level_tx_links = len(dict_to_display["User Plane Configuration"]["low-level-tx-links"])
operation = "Creates" if mode == "Creation" else "Deletes"
parent = analysis_box.insert('', 'end', text='', values=(
f"{message_id}", f"Cell {cell_id}", "✅", f"O-DU Creates {number_low_level_tx_links} Low Level Tx Links for cell {cell_id}", ""), tags=tags)
f"{message_id}", f"Cell {cell_id}", "✅", f"O-DU {operation} {number_low_level_tx_links} Low Level Tx Links for cell {cell_id}", ""), tags=tags)
json_tree(parent, dict_to_display, tags, box=analysis_box)
if rx_array_carriers:
if type(rx_array_carriers[0]) is list:
rx_array_carriers = rx_array_carriers[0]

if get_value_if_exists_recurse(rx_array_carriers[0], "active") == "ACTIVE":
mode = "Activation"
elif get_value_if_exists_recurse(rx_array_carriers[0], "type") is not None:
elif get_value_if_exists_recurse(rx_array_carriers[0], "type") is not None or get_value_if_exists_recurse(rx_array_carriers[0], "channel-bandwidth") is not None:
mode = "Creation"
else:
elif get_value_if_exists_recurse(rx_array_carriers[0], "active") == "INACTIVE":
mode = "Deactivation"
else:
mode = "Deletion"
if mode == "Creation":
dict_to_display = {
"User Plane Configuration": {
"rx-array-carriers": [
{
"name": array_carrier["name"],
"active": get_value_if_exists_recurse(array_carrier, "active"),
"type": get_value_if_exists_recurse(array_carrier, "type"),
"type": "N/A" if get_value_if_exists_recurse(array_carrier, "type") is None else get_value_if_exists_recurse(array_carrier, "type"),
"cell_id": str(compute_cell_id(array_carrier["name"]))
}
for array_carrier in rx_array_carriers]
}
}
elif mode == "Deletion":
dict_to_display = {
"User Plane Configuration": {
"rx-array-carriers": [
{
"name": array_carrier["name"],
"cell_id": str(compute_cell_id(array_carrier["name"]))
}
for array_carrier in rx_array_carriers]
Expand Down Expand Up @@ -325,18 +406,32 @@ def get_type_from_endpoint(scs, dir):

if get_value_if_exists_recurse(tx_array_carriers[0], "active") == "ACTIVE":
mode = "Activation"
elif get_value_if_exists_recurse(tx_array_carriers[0], "type") is not None:
elif get_value_if_exists_recurse(tx_array_carriers[0], "type") is not None or get_value_if_exists_recurse(tx_array_carriers[0], "channel-bandwidth") is not None:
mode = "Creation"
else:
elif get_value_if_exists_recurse(tx_array_carriers[0], "active") == "INACTIVE":
mode = "Deactivation"
else:
mode = "Deletion"
if mode == "Creation":

dict_to_display = {
"User Plane Configuration": {
"tx-array-carriers": [
{
"name": array_carrier["name"],
"active": get_value_if_exists_recurse(array_carrier, "active"),
"type": get_value_if_exists_recurse(array_carrier, "type"),
"type": "N/A" if get_value_if_exists_recurse(array_carrier, "type") is None else get_value_if_exists_recurse(array_carrier, "type"),
"cell_id": str(compute_cell_id(array_carrier["name"]))
}
for array_carrier in tx_array_carriers]
}
}
elif mode == "Deletion":
dict_to_display = {
"User Plane Configuration": {
"tx-array-carriers": [
{
"name": array_carrier["name"],
"cell_id": str(compute_cell_id(array_carrier["name"]))
}
for array_carrier in tx_array_carriers]
Expand Down
71 changes: 38 additions & 33 deletions netconfparser.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,42 @@
block_cipher = None


a = Analysis(['netconfparser.py'],
pathex=[],
binaries=[],
datas=[('fs_ico_encoded', '.')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
a = Analysis(
['netconfparser.py'],
pathex=[],
binaries=[],
datas=[('fs_ico_encoded', '.')],
hiddenimports=[],
hookspath=['.'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='netconfparser',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None , icon='fs.ico')
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='netconfparser',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='fs.ico',
)

0 comments on commit c7b5441

Please sign in to comment.