Skip to content

Commit

Permalink
add codes to integrate RANFusion Simulator, and implement AI-Fuzzing …
Browse files Browse the repository at this point in the history
…using genetic algorithms
  • Loading branch information
tangecemsu committed Mar 22, 2024
1 parent 9751a4b commit c911bcc
Show file tree
Hide file tree
Showing 15 changed files with 1,630 additions and 14 deletions.
2 changes: 2 additions & 0 deletions actor/src/action_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
from actions.action_executor import ActionExecutor
import actions.actions_vr
import actions.actions_srsue
import actions.actions_ai_fuzzing

def get_action_executor(action):
for cls in ActionExecutor.__subclasses__():
logger.debug("--------------------------" + cls.__name__)
# print("--------------------------" + cls.__name__ + ": " + cls.ACTION_NAME)
if cls.ACTION_NAME == action.name:
return cls(action)

Expand Down
Empty file.
158 changes: 158 additions & 0 deletions actor/src/actions/Config_files/cell_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"cells": [
{
"cell_id": "Ax1242",
"sectorCount": "3",
"trackingArea": "TA1",
"gnodeb_id": "W1140",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "BX1453",
"sectorCount": "3",
"trackingArea": "TA2",
"gnodeb_id": "W1140",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"

},
{
"cell_id": "CX1352",
"sectorCount": "3",
"trackingArea": "TA3",
"gnodeb_id": "W1140",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "AX1112",
"sectorCount": "3",
"trackingArea": "TA1",
"gnodeb_id": "W1320",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "BX1334",
"sectorCount": "3",
"trackingArea": "TA2",
"gnodeb_id": "W1320",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "CX1873",
"sectorCount": "3",
"trackingArea": "TA3",
"gnodeb_id": "W1320",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "AX9980",
"sectorCount": "3",
"trackingArea": "TA1",
"gnodeb_id": "W2018",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "BX1230",
"sectorCount": "3",
"trackingArea": "TA2",
"gnodeb_id": "W2018",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
},
{
"cell_id": "CX5103",
"sectorCount": "3",
"trackingArea": "TA3",
"gnodeb_id": "W2018",
"frequencyBand": "n78",
"duplexMode": "TDD",
"tx_power": 20,
"bandwidth": 20,
"ssbPeriodicity": 20,
"ssbOffset": 2,
"maxConnectUes": 10,
"max_throughput": 100,
"channelModel": "UMa",
"is_active": true,
"technology": "5G"
}
]
}
53 changes: 53 additions & 0 deletions actor/src/actions/Config_files/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
import json

class Config:
def __init__(self, base_dir):
self.base_dir = base_dir
self.gNodeBs_config = self.load_json_config('gNodeB_config.json')
self.cells_config = self.load_json_config('cell_config.json')
self.sectors_config = self.load_json_config('sector_config.json')
self.ue_config = self.load_json_config('ue_config.json')
# Load or generate the network map and assign it to the network_map_data attribute
self.network_map_data = self.load_or_generate_network_map()

def load_json_config(self, filename):
file_path = os.path.join(self.base_dir, 'Config_files', filename)
with open(file_path, 'r') as file:
return json.load(file)

def load_or_generate_network_map(self):
network_map_path = os.path.join(self.base_dir, 'Config_files', 'network_map.json')
if os.path.exists(network_map_path):
with open(network_map_path, 'r') as file:
return json.load(file)
else:
# If the network_map.json does not exist, generate and save it
return self.generate_and_save_network_map()

def generate_and_save_network_map(self):
network_map = {
"gNodeBs": []
}
for gnodeb in self.gNodeBs_config['gNodeBs']:
gnodeb_entry = {
"gNodeBId": gnodeb['gnodeb_id'],
"cells": []
}
associated_cells = [cell for cell in self.cells_config['cells'] if cell['gnodeb_id'] == gnodeb['gnodeb_id']]
for cell in associated_cells:
sectors_for_cell = [{"sectorId": sector['sector_id']}
for sector in self.sectors_config['sectors']
if sector['cell_id'] == cell['cell_id']]
cell_entry = {
"cellId": cell['cell_id'],
"sectors": sectors_for_cell
}
gnodeb_entry["cells"].append(cell_entry)
network_map["gNodeBs"].append(gnodeb_entry)

# Save the network map to a JSON file in the Config_files directory
output_file_path = os.path.join(self.base_dir, 'Config_files', 'network_map.json')
with open(output_file_path, 'w') as file:
json.dump(network_map, file, indent=2)
return network_map
128 changes: 128 additions & 0 deletions actor/src/actions/Config_files/core_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"hlr": {
"id": "hlr1",
"database": {
"subscribers": [
{
"imsi": "12345678912345",
"services": [
"voice",
"sms",
"data"
],
"authentication": {
"key": "AABBCCDDEEFF0011223344",
"algorithm": "A3A8"
}
}
]
},
"interfaces": {
"map": {
"version": 2
},
"diameter": {
"hss_address": "1.1.1.1"
},
"ldap": {}
}
},
"msc": {
"id": "msc1",
"vm_capacity": 10000,
"interfaces": {
"map": {
"version": 2
},
"isup": {}
},
"controllers": [
{
"id": "ctr1",
"channels": 100
}
]
},
"sgsn": {
"id": "sgsn1",
"gtpc": {
"addresses": [
"1.1.1.2",
"1.1.1.3"
]
},
"capacity": 500000,
"interfaces": {
"gtpv1": {},
"radius": {},
"map": {
"version": 2
}
}
},
"ggsn": {
"id": "ggsn1",
"apn_config": [
{
"apn": "internet",
"pdp_type": "ipv4",
"pdp_address": "2.2.2.2"
}
],
"ipv4_pool": {
"start": "192.168.1.1",
"end": "192.168.1.254"
},
"ipv6_pool": {
"start": "2001:db8::1",
"end": "2001:db8::ffff"
}
},
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4"
],
"records": [
{
"name": "google.com",
"type": "A",
"address": "142.250.190.78"
}
]
},
"aaa": {
"servers": [
{
"id": "aaa1",
"address": "1.1.1.5",
"protocols": [
"radius",
"diameter"
]
}
],
"users": [
{
"username": "user1",
"password": "pass123"
}
]
},
"pcrf": {
"id": "pcrf1",
"policy_rules": [
{
"rule_id": 1,
"flow": "permit out udp/80",
"charging": {
"type": "offline"
}
}
],
"gx_intf": {
"protocol": "diameter",
"server": "1.1.1.6"
}
}
}
Loading

0 comments on commit c911bcc

Please sign in to comment.