forked from Unipisa/Simu5G
-
Notifications
You must be signed in to change notification settings - Fork 0
My research simulation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chzam1
wants to merge
418
commits into
master
Choose a base branch
from
My_Research_Simulation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t_ instead; remove unused member: mePlatform
…clearing from initialize() to constructor
…lass MecServiceBase::initialize()
…the same and different parts in initialize() with comments
…ecServiceBase Motivation: The MecServiceBase descendants UALCMPApp and ServiceRegistry are not used MecServiceBase::initialize(). The initialize in these modules contains some copyed code from MecServiceBase::initialize().
…ameter to componentCarrierModule parameter. old: The componentCarrierIndex specified the module carrierAggregation.componentCarrier[<componentCarrierIndex>] new: componentCarrierModule specifies the path to ComponentCarrier module
…ponentCarrierIndex NED parameter to componentCarrierModule parameter.'
…ifecycle support is unimplemented in module)
…, timeToLive, dscp, tos NED parameters
… c++ hard-coded value
…ed by MecAppBase.cc, moved these to MecAppBase.ned
…ed by these descendants: MecRnisTestApp and MECWarningAlertApp
…localPort ned parameters
…ntainingNicModule()
…apps by using pre-defined device application ids
…ket::connect() /simulations/NR/mec/multiMecHost -f omnetpp.ini -c MultiMec -r 0 (runtime error with exitcode=1: <!> Error: TcpSocket::connect(): connect() or listen() already called (need renewSocket()?) -- in module (simu5g::MECWarningAlertApp) MultiMecHost.mecHost1.MECWarningAlertApp)
changed by last few commits
seen when used with omnetpp-6.0.3
And adjusted includes/imports.
Used the following python script:
import os
import re
import shutil
import argparse
from pathlib import Path
def find_simple_modules(base_path):
"""Find all simple module definitions in .ned files"""
simple_modules = []
for ned_file in Path(base_path).rglob('*.ned'):
with open(ned_file, 'r', encoding='utf-8') as f:
content = f.read()
# Find simple module definitions
# Pattern matches: simple ModuleName [extends Something] {
matches = re.finditer(r'simple\s+(\w+)(?:\s+extends\s+\w+)?\s*{', content)
for match in matches:
module_name = match.group(1)
simple_modules.append({
'module_name': module_name,
'file_path': str(ned_file),
'directory': str(ned_file.parent)
})
return simple_modules
def find_cpp_implementations(base_path):
"""Find all C++ class implementations using Define_Module macro"""
cpp_modules = []
for cc_file in Path(base_path).rglob('*.cc'):
with open(cc_file, 'r', encoding='utf-8') as f:
content = f.read()
# Find Define_Module macro usages
matches = re.finditer(r'Define_Module\((\w+)\)', content)
for match in matches:
class_name = match.group(1)
# Also find the corresponding .h file
h_file = cc_file.parent / (cc_file.stem + '.h')
cpp_modules.append({
'class_name': class_name,
'cc_file': str(cc_file),
'h_file': str(h_file) if h_file.exists() else None,
'directory': str(cc_file.parent)
})
return cpp_modules
def find_mismatched_modules(base_path):
"""Find modules where .ned and .cc files are in different directories"""
simple_modules = find_simple_modules(base_path)
cpp_modules = find_cpp_implementations(base_path)
# Create lookup dictionary for C++ implementations
cpp_lookup = {m['class_name']: m for m in cpp_modules}
mismatches = []
for ned_module in simple_modules:
module_name = ned_module['module_name']
if module_name in cpp_lookup:
cpp_module = cpp_lookup[module_name]
if ned_module['directory'] != cpp_module['directory']:
mismatches.append({
'module_name': module_name,
'ned_file': ned_module['file_path'],
'ned_dir': ned_module['directory'],
'cc_file': cpp_module['cc_file'],
'h_file': cpp_module['h_file']
})
return mismatches
def move_files(mismatches):
"""Move mismatched files to their corresponding .ned locations"""
moved_files = []
for mm in mismatches:
ned_dir = mm['ned_dir']
# Move .cc file
cc_file = Path(mm['cc_file'])
new_cc_path = Path(ned_dir) / cc_file.name
try:
shutil.move(str(cc_file), str(new_cc_path))
moved_files.append(f"Moved {cc_file.name} to {ned_dir}")
except Exception as e:
print(f"Error moving {cc_file}: {e}")
# Move .h file if it exists
if mm['h_file']:
h_file = Path(mm['h_file'])
new_h_path = Path(ned_dir) / h_file.name
try:
shutil.move(str(h_file), str(new_h_path))
moved_files.append(f"Moved {h_file.name} to {ned_dir}")
except Exception as e:
print(f"Error moving {h_file}: {e}")
return moved_files
def main():
parser = argparse.ArgumentParser(description='Find and optionally move mismatched OMNeT++ module files')
parser.add_argument('--move', action='store_true', help='Move files to their corresponding .ned locations')
args = parser.parse_args()
base_path = os.path.dirname(os.path.abspath(__file__))
mismatches = find_mismatched_modules(base_path)
if not mismatches:
print("No mismatched module implementations found!")
return
print("Found mismatched module implementations:")
print("-" * 80)
for mm in mismatches:
print(f"Module: {mm['module_name']}")
print(f" NED file: {mm['ned_file']}")
print(f" C++ file: {mm['cc_file']}")
if mm['h_file']:
print(f" H file: {mm['h_file']}")
print("-" * 80)
if args.move:
print("\nMoving files to their corresponding .ned locations...")
moved = move_files(mismatches)
print("\nMoved files:")
for move in moved:
print(move)
if __name__ == '__main__':
main()
They are sensitive to modules being moved to a different package
It only occurred in these modules.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.