Commit 017e4339 authored by hardy's avatar hardy

brought cde line arg parsing out of main.py, into a separated module

parent 220445f1
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
# Python for CI of OAI-eNB + COTS-UE
#
# Required Python Version
# Python 3.x
#
# Required Python Package
# pexpect
#---------------------------------------------------------------------
#-----------------------------------------------------------
# Import Libs
#-----------------------------------------------------------
import sys # arg
import re # reg
import yaml
#-----------------------------------------------------------
# Parsing Command Line Arguements
#-----------------------------------------------------------
def ArgsParse(argvs,CiTestObj,RAN,HTML,ldpc,HELP):
py_param_file_present = False
py_params={}
while len(argvs) > 1:
myArgv = argvs.pop(1) # 0th is this file's name
#--help
if re.match('^\-\-help$', myArgv, re.IGNORECASE):
HELP.GenericHelp(CONST.Version)
sys.exit(0)
#--apply=<filename> as parameters file, to replace inline parameters
elif re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE)
py_params_file = matchReg.group(1)
with open(py_params_file,'r') as file:
# The FullLoader parameter handles the conversion from YAML
# scalar values to Python dictionary format
py_params = yaml.load(file,Loader=yaml.FullLoader)
py_param_file_present = True #to be removed once validated
#AssignParams(py_params) #to be uncommented once validated
#consider inline parameters
elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
mode = matchReg.group(1)
elif re.match('^\-\-eNBRepository=(.+)$|^\-\-ranRepository(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE)
else:
matchReg = re.match('^\-\-ranRepository=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ranRepository = matchReg.group(1)
RAN.ranRepository=matchReg.group(1)
HTML.ranRepository=matchReg.group(1)
ldpc.ranRepository=matchReg.group(1)
elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE)
else:
matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE)
doMerge = matchReg.group(1)
ldpc.ranAllowMerge=matchReg.group(1)
if ((doMerge == 'true') or (doMerge == 'True')):
CiTestObj.ranAllowMerge = True
RAN.ranAllowMerge=True
HTML.ranAllowMerge=True
elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE)
else:
matchReg = re.match('^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ranBranch = matchReg.group(1)
RAN.ranBranch=matchReg.group(1)
HTML.ranBranch=matchReg.group(1)
ldpc.ranBranch=matchReg.group(1)
elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE)
else:
matchReg = re.match('^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE)
CiTestObj.ranCommitID = matchReg.group(1)
RAN.ranCommitID=matchReg.group(1)
HTML.ranCommitID=matchReg.group(1)
ldpc.ranCommitID=matchReg.group(1)
elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE)
else:
matchReg = re.match('^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE)
CiTestObj.ranTargetBranch = matchReg.group(1)
RAN.ranTargetBranch=matchReg.group(1)
HTML.ranTargetBranch=matchReg.group(1)
ldpc.ranTargetBranch=matchReg.group(1)
elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBIPAddress=matchReg.group(1)
ldpc.eNBIpAddr=matchReg.group(1)
elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1IPAddress=matchReg.group(1)
elif re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2IPAddress=matchReg.group(1)
elif re.match('^\-\-eNBUserName=(.+)$|^\-\-eNB[1-2]UserName=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBUserName=matchReg.group(1)
ldpc.eNBUserName=matchReg.group(1)
elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1UserName=matchReg.group(1)
elif re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2UserName=matchReg.group(1)
elif re.match('^\-\-eNBPassword=(.+)$|^\-\-eNB[1-2]Password=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBPassword=matchReg.group(1)
ldpc.eNBPassWord=matchReg.group(1)
elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1Password=matchReg.group(1)
elif re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2Password=matchReg.group(1)
elif re.match('^\-\-eNBSourceCodePath=(.+)$|^\-\-eNB[1-2]SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBSourceCodePath=matchReg.group(1)
ldpc.eNBSourceCodePath=matchReg.group(1)
elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1SourceCodePath=matchReg.group(1)
elif re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2SourceCodePath=matchReg.group(1)
elif re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE)
EPC.IPAddress=matchReg.group(1)
elif re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE)
EPC.UserName=matchReg.group(1)
elif re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE)
EPC.Password=matchReg.group(1)
elif re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
EPC.SourceCodePath=matchReg.group(1)
elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE)
if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE):
EPC.Type=matchReg.group(1)
else:
sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)')
elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE)
EPC.ContainerPrefix=matchReg.group(1)
elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ADBIPAddress = matchReg.group(1)
elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ADBUserName = matchReg.group(1)
elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE)
if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE):
if re.match('distributed', matchReg.group(1), re.IGNORECASE):
CiTestObj.ADBCentralized = False
else:
CiTestObj.ADBCentralized = True
else:
sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)')
elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ADBPassword = matchReg.group(1)
elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.testXMLfiles.append(matchReg.group(1))
HTML.testXMLfiles=matchReg.group(1)
HTML.nbTestXMLfiles=HTML.nbTestXMLfiles+1
elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UEIPAddress = matchReg.group(1)
elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UEUserName = matchReg.group(1)
elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UEPassword = matchReg.group(1)
elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UESourceCodePath = matchReg.group(1)
elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
finalStatus = matchReg.group(1)
if ((finalStatus == 'true') or (finalStatus == 'True')):
CiTestObj.finalStatus = True
else:
HELP.GenericHelp(CONST.Version)
sys.exit('Invalid Parameter: ' + myArgv)
return py_param_file_present, py_params, mode
\ No newline at end of file
...@@ -3100,11 +3100,9 @@ def CheckClassValidity(xml_class_list,action,id): ...@@ -3100,11 +3100,9 @@ def CheckClassValidity(xml_class_list,action,id):
#assigning parameters to object instance attributes (even if the attributes do not exist !!) #assigning parameters to object instance attributes (even if the attributes do not exist !!)
def AssignParams(params_dict): def AssignParams(params_dict):
#--
mode=params_dict['mode']
#--
for key,value in params_dict.items(): for key,value in params_dict.items():
setattr(CITestObj, key, value) setattr(CiTestObj, key, value)
setattr(RAN, key, value) setattr(RAN, key, value)
setattr(HTML, key, value) setattr(HTML, key, value)
setattr(ldpc, key, value) setattr(ldpc, key, value)
...@@ -3330,191 +3328,193 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b ...@@ -3330,191 +3328,193 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b
#----------------------------------------------------------- #-----------------------------------------------------------
# Parameter Check # Parsing Command Line Arguments
#----------------------------------------------------------- #-----------------------------------------------------------
argvs = sys.argv import args_parse
argc = len(argvs) py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,ldpc,HELP)
cwd = os.getcwd()
py_param_file_present = False
while len(argvs) > 1:
myArgv = argvs.pop(1) # 0th is this file's name
#--help
if re.match('^\-\-help$', myArgv, re.IGNORECASE):
HELP.GenericHelp(CONST.Version)
sys.exit(0)
#--apply=<filename> as parameters file, to replace inline parameters #argvs = sys.argv
elif re.match('^\-\-apply=(.+)$', myArgv, re.IGNORECASE): #py_param_file_present = False
matchReg = re.match('^\-\-apply=(.+)$', myArgv, re.IGNORECASE) #
py_params_file = matchReg.group(1) #while len(argvs) > 1:
with open(py_params_file,'r') as file: # myArgv = argvs.pop(1) # 0th is this file's name
# The FullLoader parameter handles the conversion from YAML #
# scalar values to Python dictionary format # #--help
py_params = yaml.load(file,Loader=yaml.FullLoader) # if re.match('^\-\-help$', myArgv, re.IGNORECASE):
py_param_file_present = True #to be removed once validated # HELP.GenericHelp(CONST.Version)
#AssignParams(py_params) #to be uncommented once validated # sys.exit(0)
#
#consider inline parameters # #--apply=<filename> as parameters file, to replace inline parameters
elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-Apply=(.+)$', myArgv, re.IGNORECASE)
mode = matchReg.group(1) # py_params_file = matchReg.group(1)
elif re.match('^\-\-eNBRepository=(.+)$|^\-\-ranRepository(.+)$', myArgv, re.IGNORECASE): # with open(py_params_file,'r') as file:
if re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE): # # The FullLoader parameter handles the conversion from YAML
matchReg = re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE) # # scalar values to Python dictionary format
else: # py_params = yaml.load(file,Loader=yaml.FullLoader)
matchReg = re.match('^\-\-ranRepository=(.+)$', myArgv, re.IGNORECASE) # py_param_file_present = True #to be removed once validated
CiTestObj.ranRepository = matchReg.group(1) # #AssignParams(py_params) #to be uncommented once validated
RAN.ranRepository=matchReg.group(1) #
HTML.ranRepository=matchReg.group(1) # #consider inline parameters
ldpc.ranRepository=matchReg.group(1) # elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): # mode = matchReg.group(1)
matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) # elif re.match('^\-\-eNBRepository=(.+)$|^\-\-ranRepository(.+)$', myArgv, re.IGNORECASE):
else: # if re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBRepository=(.+)$', myArgv, re.IGNORECASE)
doMerge = matchReg.group(1) # else:
ldpc.ranAllowMerge=matchReg.group(1) # matchReg = re.match('^\-\-ranRepository=(.+)$', myArgv, re.IGNORECASE)
if ((doMerge == 'true') or (doMerge == 'True')): # CiTestObj.ranRepository = matchReg.group(1)
CiTestObj.ranAllowMerge = True # RAN.ranRepository=matchReg.group(1)
RAN.ranAllowMerge=True # HTML.ranRepository=matchReg.group(1)
HTML.ranAllowMerge=True # ldpc.ranRepository=matchReg.group(1)
elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): # if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE)
else: # else:
matchReg = re.match('^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ranBranch = matchReg.group(1) # doMerge = matchReg.group(1)
RAN.ranBranch=matchReg.group(1) # ldpc.ranAllowMerge=matchReg.group(1)
HTML.ranBranch=matchReg.group(1) # if ((doMerge == 'true') or (doMerge == 'True')):
ldpc.ranBranch=matchReg.group(1) # CiTestObj.ranAllowMerge = True
elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): # RAN.ranAllowMerge=True
if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): # HTML.ranAllowMerge=True
matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) # elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE):
else: # if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ranCommitID = matchReg.group(1) # else:
RAN.ranCommitID=matchReg.group(1) # matchReg = re.match('^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE)
HTML.ranCommitID=matchReg.group(1) # CiTestObj.ranBranch = matchReg.group(1)
ldpc.ranCommitID=matchReg.group(1) # RAN.ranBranch=matchReg.group(1)
elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): # HTML.ranBranch=matchReg.group(1)
if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): # ldpc.ranBranch=matchReg.group(1)
matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) # elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE):
else: # if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE)
CiTestObj.ranTargetBranch = matchReg.group(1) # else:
RAN.ranTargetBranch=matchReg.group(1) # matchReg = re.match('^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE)
HTML.ranTargetBranch=matchReg.group(1) # CiTestObj.ranCommitID = matchReg.group(1)
ldpc.ranTargetBranch=matchReg.group(1) # RAN.ranCommitID=matchReg.group(1)
elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): # HTML.ranCommitID=matchReg.group(1)
if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): # ldpc.ranCommitID=matchReg.group(1)
matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) # elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE):
RAN.eNBIPAddress=matchReg.group(1) # if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE):
ldpc.eNBIpAddr=matchReg.group(1) # matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE)
elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): # else:
matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE)
RAN.eNB1IPAddress=matchReg.group(1) # CiTestObj.ranTargetBranch = matchReg.group(1)
elif re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE): # RAN.ranTargetBranch=matchReg.group(1)
matchReg = re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE) # HTML.ranTargetBranch=matchReg.group(1)
RAN.eNB2IPAddress=matchReg.group(1) # ldpc.ranTargetBranch=matchReg.group(1)
elif re.match('^\-\-eNBUserName=(.+)$|^\-\-eNB[1-2]UserName=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE): # if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBUserName=matchReg.group(1) # RAN.eNBIPAddress=matchReg.group(1)
ldpc.eNBUserName=matchReg.group(1) # ldpc.eNBIpAddr=matchReg.group(1)
elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1UserName=matchReg.group(1) # RAN.eNB1IPAddress=matchReg.group(1)
elif re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB2IPAddress=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2UserName=matchReg.group(1) # RAN.eNB2IPAddress=matchReg.group(1)
elif re.match('^\-\-eNBPassword=(.+)$|^\-\-eNB[1-2]Password=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNBUserName=(.+)$|^\-\-eNB[1-2]UserName=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE): # if re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBUserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBPassword=matchReg.group(1) # RAN.eNBUserName=matchReg.group(1)
ldpc.eNBPassWord=matchReg.group(1) # ldpc.eNBUserName=matchReg.group(1)
elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1Password=matchReg.group(1) # RAN.eNB1UserName=matchReg.group(1)
elif re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB2UserName=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2Password=matchReg.group(1) # RAN.eNB2UserName=matchReg.group(1)
elif re.match('^\-\-eNBSourceCodePath=(.+)$|^\-\-eNB[1-2]SourceCodePath=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNBPassword=(.+)$|^\-\-eNB[1-2]Password=(.+)$', myArgv, re.IGNORECASE):
if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE): # if re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNBPassword=(.+)$', myArgv, re.IGNORECASE)
RAN.eNBSourceCodePath=matchReg.group(1) # RAN.eNBPassword=matchReg.group(1)
ldpc.eNBSourceCodePath=matchReg.group(1) # ldpc.eNBPassWord=matchReg.group(1)
elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB1SourceCodePath=matchReg.group(1) # RAN.eNB1Password=matchReg.group(1)
elif re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-eNB2Password=(.+)$', myArgv, re.IGNORECASE)
RAN.eNB2SourceCodePath=matchReg.group(1) # RAN.eNB2Password=matchReg.group(1)
elif re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-eNBSourceCodePath=(.+)$|^\-\-eNB[1-2]SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE) # if re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
EPC.IPAddress=matchReg.group(1) # matchReg = re.match('^\-\-eNBSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
elif re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE): # RAN.eNBSourceCodePath=matchReg.group(1)
matchReg = re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE) # ldpc.eNBSourceCodePath=matchReg.group(1)
EPC.UserName=matchReg.group(1) # elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE) # RAN.eNB1SourceCodePath=matchReg.group(1)
EPC.Password=matchReg.group(1) # elif re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-eNB2SourceCodePath=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE) # RAN.eNB2SourceCodePath=matchReg.group(1)
EPC.SourceCodePath=matchReg.group(1) # elif re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-EPCIPAddress=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE) # EPC.IPAddress=matchReg.group(1)
if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE): # elif re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE):
EPC.Type=matchReg.group(1) # matchReg = re.match('^\-\-EPCUserName=(.+)$', myArgv, re.IGNORECASE)
else: # EPC.UserName=matchReg.group(1)
sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)') # elif re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-EPCPassword=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE) # EPC.Password=matchReg.group(1)
EPC.ContainerPrefix=matchReg.group(1) # elif re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-EPCSourceCodePath=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE) # EPC.SourceCodePath=matchReg.group(1)
CiTestObj.ADBIPAddress = matchReg.group(1) # elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE) # if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE):
CiTestObj.ADBUserName = matchReg.group(1) # EPC.Type=matchReg.group(1)
elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE): # else:
matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE) # sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)')
if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE): # elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE):
if re.match('distributed', matchReg.group(1), re.IGNORECASE): # matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.ADBCentralized = False # EPC.ContainerPrefix=matchReg.group(1)
else: # elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE):
CiTestObj.ADBCentralized = True # matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE)
else: # CiTestObj.ADBIPAddress = matchReg.group(1)
sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)') # elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE) # CiTestObj.ADBUserName = matchReg.group(1)
CiTestObj.ADBPassword = matchReg.group(1) # elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE) # if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE):
CiTestObj.testXMLfiles.append(matchReg.group(1)) # if re.match('distributed', matchReg.group(1), re.IGNORECASE):
HTML.testXMLfiles=matchReg.group(1) # CiTestObj.ADBCentralized = False
HTML.nbTestXMLfiles=HTML.nbTestXMLfiles+1 # else:
elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE): # CiTestObj.ADBCentralized = True
matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE) # else:
CiTestObj.UEIPAddress = matchReg.group(1) # sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)')
elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UEUserName = matchReg.group(1) # CiTestObj.ADBPassword = matchReg.group(1)
elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE): # elif re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE) # matchReg = re.match('^\-\-XMLTestFile=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.UEPassword = matchReg.group(1) # CiTestObj.testXMLfiles.append(matchReg.group(1))
elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE): # HTML.testXMLfiles=matchReg.group(1)
matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE) # HTML.nbTestXMLfiles=HTML.nbTestXMLfiles+1
CiTestObj.UESourceCodePath = matchReg.group(1) # elif re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE):
elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE): # matchReg = re.match('^\-\-UEIPAddress=(.+)$', myArgv, re.IGNORECASE)
matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE) # CiTestObj.UEIPAddress = matchReg.group(1)
finalStatus = matchReg.group(1) # elif re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE):
if ((finalStatus == 'true') or (finalStatus == 'True')): # matchReg = re.match('^\-\-UEUserName=(.+)$', myArgv, re.IGNORECASE)
CiTestObj.finalStatus = True # CiTestObj.UEUserName = matchReg.group(1)
else: # elif re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE):
HELP.GenericHelp(CONST.Version) # matchReg = re.match('^\-\-UEPassword=(.+)$', myArgv, re.IGNORECASE)
sys.exit('Invalid Parameter: ' + myArgv) # CiTestObj.UEPassword = matchReg.group(1)
# elif re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE):
# matchReg = re.match('^\-\-UESourceCodePath=(.+)$', myArgv, re.IGNORECASE)
# CiTestObj.UESourceCodePath = matchReg.group(1)
# elif re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE):
# matchReg = re.match('^\-\-finalStatus=(.+)$', myArgv, re.IGNORECASE)
# finalStatus = matchReg.group(1)
# if ((finalStatus == 'true') or (finalStatus == 'True')):
# CiTestObj.finalStatus = True
# else:
# HELP.GenericHelp(CONST.Version)
# sys.exit('Invalid Parameter: ' + myArgv)
#----------------------------------------------------------- #-----------------------------------------------------------
...@@ -3524,6 +3524,14 @@ while len(argvs) > 1: ...@@ -3524,6 +3524,14 @@ while len(argvs) > 1:
if py_param_file_present == True: if py_param_file_present == True:
AssignParams(py_params) AssignParams(py_params)
#for debug
print(RAN.__dict__)
print(CiTestObj.__dict__)
print(HTML.__dict__)
print(ldpc.__dict__)
#for debug
#----------------------------------------------------------- #-----------------------------------------------------------
# COTS UE instanciation # COTS UE instanciation
#----------------------------------------------------------- #-----------------------------------------------------------
...@@ -3534,6 +3542,7 @@ COTS_UE=cls_cots_ue.CotsUe('oppo', CiTestObj.UEIPAddress, CiTestObj.UEUserName,C ...@@ -3534,6 +3542,7 @@ COTS_UE=cls_cots_ue.CotsUe('oppo', CiTestObj.UEIPAddress, CiTestObj.UEUserName,C
#----------------------------------------------------------- #-----------------------------------------------------------
# XML class (action) analysis # XML class (action) analysis
#----------------------------------------------------------- #-----------------------------------------------------------
cwd = os.getcwd()
if re.match('^TerminateeNB$', mode, re.IGNORECASE): if re.match('^TerminateeNB$', mode, re.IGNORECASE):
if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '': if RAN.eNBIPAddress == '' or RAN.eNBUserName == '' or RAN.eNBPassword == '':
...@@ -3851,6 +3860,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -3851,6 +3860,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
else: else:
logging.info('Testsuite passed after ' + str(CiTestObj.FailReportCnt) + ' time(s)') logging.info('Testsuite passed after ' + str(CiTestObj.FailReportCnt) + ' time(s)')
HTML.CreateHtmlTabFooter(True) HTML.CreateHtmlTabFooter(True)
elif re.match('^LoadParams$', mode, re.IGNORECASE):
pass
else: else:
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Invalid mode') sys.exit('Invalid mode')
......
mode : a
eNBRepository : b eNBRepository : b
ranRepository : c ranRepository : c
eNB_AllowMerge : eNB_AllowMerge :
......
eNBRepository : b
ranRepository : c
eNB_AllowMerge :
ranAllowMerge :
eNBBranch : f
ranBranch : g
eNBCommitID :
ranCommitID : i
eNBTargetBranch : j
ranTargetBranch : k
RAN:
RAN_inst_0:
name : RAN_1
nodes :
- type : eNB
IPAddress : 001.1.1
UserName : toto
Password : qwe
SourceCodePath : l
- type : gNB
IPAddress : 002.2.2
UserName : tata
Password : asd
SourceCodePath : m
- type : eNB
IPAddress : 003.3.3
UserName : titi
Password : zxc
SourceCodePath : n
- type : gNB
IPAddress : 004.4.4
UserName : caca
Password : pepe
SourceCodePath : o
RAN_inst_1:
name : RAN_2
nodes :
- type : eNB
IPAddress : 101.1.1
UserName : toto
Password : qwe
SourceCodePath : l
- type : gNB
IPAddress : 102.2.2
UserName : zaza
Password : asd
SourceCodePath : m
- type : eNB
IPAddress : 103.3.3
UserName : zizi
Password : zxc
SourceCodePath : n
- type : gNB
IPAddress : 104.4.4
UserName : aaaa
Password : pepe
SourceCodePath : o
EPC:
EPC_inst_0:
EPCIPAddress : p
EPCUserName : q
EPCPassword : r
EPCSourceCodePath : s
EPCType : t
EPCContainerPrefix : u
ADB:
ADBIPAddress : v
ADBUserName : w
ADBType : x
ADBPassword : y
UE:
UE_inst_0:
name : UE_1
type :
UEIPAddress : qqq
UEUserName : www
UEPassword : eee
UESourceCodePath : yyy
UE_inst_1:
name : UE_2
type :
UEIPAddress : bloblob
UEUserName : gwou
UEPassword : zebu
UESourceCodePath : pop
XMLTestFile : z
finalStatus : bbb
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment