Commit f3033533 authored by Bipin's avatar Bipin Committed by Raphael Defosseux

moving module id and node checks to parameter checks

parent db1f2649
...@@ -608,10 +608,7 @@ class OaiCiTest(): ...@@ -608,10 +608,7 @@ class OaiCiTest():
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS) self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
def AttachUE(self, HTML, RAN, EPC, CONTAINERS): def AttachUE(self, HTML, RAN, EPC, CONTAINERS):
if len(self.ue_ids) == len(self.nodes): ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(ue.attach) for ue in ues] futures = [executor.submit(ue.attach) for ue in ues]
attached = [f.result() for f in futures] attached = [f.result() for f in futures]
...@@ -626,10 +623,7 @@ class OaiCiTest(): ...@@ -626,10 +623,7 @@ class OaiCiTest():
self.AutoTerminateUEandeNB(HTML, RAN, EPC, CONTAINERS) self.AutoTerminateUEandeNB(HTML, RAN, EPC, CONTAINERS)
def DetachUE(self, HTML): def DetachUE(self, HTML):
if len(self.ue_ids) == len(self.nodes): ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(ue.detach) for ue in ues] futures = [executor.submit(ue.detach) for ue in ues]
[f.result() for f in futures] [f.result() for f in futures]
...@@ -769,10 +763,7 @@ class OaiCiTest(): ...@@ -769,10 +763,7 @@ class OaiCiTest():
if self.ue_ids == []: if self.ue_ids == []:
raise Exception("no module names in self.ue_ids provided") raise Exception("no module names in self.ue_ids provided")
if len(self.ue_ids) == len(self.nodes): ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
logging.debug(ues) logging.debug(ues)
pingLock = Lock() pingLock = Lock()
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
...@@ -861,10 +852,7 @@ class OaiCiTest(): ...@@ -861,10 +852,7 @@ class OaiCiTest():
if self.ue_ids == [] or self.svr_id == None: if self.ue_ids == [] or self.svr_id == None:
raise Exception("no module names in self.ue_ids or/and self.svr_id provided") raise Exception("no module names in self.ue_ids or/and self.svr_id provided")
if len(self.ue_ids) == len(self.nodes): ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
svr = cls_module.Module_UE(self.svr_id,self.svr_node) svr = cls_module.Module_UE(self.svr_id,self.svr_node)
logging.debug(ues) logging.debug(ues)
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
......
...@@ -222,6 +222,8 @@ def GetParametersFromXML(action): ...@@ -222,6 +222,8 @@ def GetParametersFromXML(action):
if len(CiTestObj.ue_ids) != len(CiTestObj.nodes): if len(CiTestObj.ue_ids) != len(CiTestObj.nodes):
logging.error('Number of Nodes are not equal to the total number of UEs') logging.error('Number of Nodes are not equal to the total number of UEs')
sys.exit("Mismatch in number of Nodes and UIs") sys.exit("Mismatch in number of Nodes and UIs")
else:
CiTestObj.nodes = [None] * len(CiTestObj.ue_ids)
elif action == 'Build_OAI_UE': elif action == 'Build_OAI_UE':
CiTestObj.Build_OAI_UE_args = test.findtext('Build_OAI_UE_args') CiTestObj.Build_OAI_UE_args = test.findtext('Build_OAI_UE_args')
...@@ -273,6 +275,8 @@ def GetParametersFromXML(action): ...@@ -273,6 +275,8 @@ def GetParametersFromXML(action):
if len(CiTestObj.ue_ids) != len(CiTestObj.nodes): if len(CiTestObj.ue_ids) != len(CiTestObj.nodes):
logging.error('Number of Nodes are not equal to the total number of UEs') logging.error('Number of Nodes are not equal to the total number of UEs')
sys.exit("Mismatch in number of Nodes and UIs") sys.exit("Mismatch in number of Nodes and UIs")
else:
CiTestObj.nodes = [None] * len(CiTestObj.ue_ids)
ping_rttavg_threshold = test.findtext('ping_rttavg_threshold') or '' ping_rttavg_threshold = test.findtext('ping_rttavg_threshold') or ''
elif action == 'Iperf' or action == 'Iperf2_Unidir': elif action == 'Iperf' or action == 'Iperf2_Unidir':
...@@ -284,6 +288,8 @@ def GetParametersFromXML(action): ...@@ -284,6 +288,8 @@ def GetParametersFromXML(action):
if len(CiTestObj.ue_ids) != len(CiTestObj.nodes): if len(CiTestObj.ue_ids) != len(CiTestObj.nodes):
logging.error('Number of Nodes are not equal to the total number of UEs') logging.error('Number of Nodes are not equal to the total number of UEs')
sys.exit("Mismatch in number of Nodes and UIs") sys.exit("Mismatch in number of Nodes and UIs")
else:
CiTestObj.nodes = [None] * len(CiTestObj.ue_ids)
if test.findtext('svr_node'): if test.findtext('svr_node'):
CiTestObj.svr_node = test.findtext('svr_node') CiTestObj.svr_node = test.findtext('svr_node')
CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold') CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold')
......
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