Commit ea798204 authored by Bipin Adhikari's avatar Bipin Adhikari

Support for host node placeholder in ci_infra and relavent supporting code

parent 8abf975f
......@@ -228,13 +228,13 @@ lte_oai_ue_carabe:
MTU: 1500
rfsim5g_gnb_nos1:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-gnb ip a show dev oaitun_enb1
CmdPrefix: docker exec rfsim5g-oai-gnb
IF: oaitun_enb1
rfsim5g_ue:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue
IF: oaitun_ue1
......@@ -243,7 +243,7 @@ rfsim5g_ue:
MTU: 1500
rfsim5g_ue2:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue2 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue2
IF: oaitun_ue1
......@@ -252,7 +252,7 @@ rfsim5g_ue2:
MTU: 1500
rfsim5g_ue3:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue3 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue3
IF: oaitun_ue1
......@@ -261,7 +261,7 @@ rfsim5g_ue3:
MTU: 1500
rfsim5g_ue4:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue4 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue4
IF: oaitun_ue1
......@@ -270,7 +270,7 @@ rfsim5g_ue4:
MTU: 1500
rfsim5g_ue5:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue5 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue5
IF: oaitun_ue1
......@@ -279,7 +279,7 @@ rfsim5g_ue5:
MTU: 1500
rfsim5g_ue6:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue6 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue6
IF: oaitun_ue1
......@@ -288,7 +288,7 @@ rfsim5g_ue6:
MTU: 1500
rfsim5g_ue7:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue7 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue7
IF: oaitun_ue1
......@@ -297,7 +297,7 @@ rfsim5g_ue7:
MTU: 1500
rfsim5g_ue8:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue8 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue8
IF: oaitun_ue1
......@@ -306,7 +306,7 @@ rfsim5g_ue8:
MTU: 1500
rfsim5g_ue9:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue9 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue9
IF: oaitun_ue1
......@@ -315,7 +315,7 @@ rfsim5g_ue9:
MTU: 1500
rfsim5g_ue10:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-nr-ue10 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue10
IF: oaitun_ue1
......@@ -324,12 +324,12 @@ rfsim5g_ue10:
MTU: 1500
rfsim5g_ext_dn:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim5g-oai-ext-dn ip a show dev eth0
CmdPrefix: docker exec rfsim5g-oai-ext-dn
rfsim4g_ue:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim4g-oai-lte-ue0 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim4g-oai-lte-ue0
IF: oaitun_ue1
......@@ -338,30 +338,30 @@ rfsim4g_ue:
MTU: 1500
rfsim4g_ext_dn:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim4g-trf-gen ip a show dev eth0
CmdPrefix: docker exec rfsim4g-trf-gen
rfsim4g_enb_nos1:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim4g-oai-enb ip a show dev oaitun_enb1
CmdPrefix: docker exec rfsim4g-oai-enb
IF: oaitun_enb1
rfsim4g_enb_fembms:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim4g-oai-enb ip a show dev oaitun_enm1
CmdPrefix: docker exec rfsim4g-oai-enb
IF: oaitun_enm1
rfsim4g_ue_fembms:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec rfsim4g-oai-lte-ue0 ip a show dev oaitun_uem1
CmdPrefix: docker exec rfsim4g-oai-lte-ue0
IF: oaitun_uem1
l2sim5g_ue:
Host: localhost
Host: "%%current_host%%"
AttachScript: docker start l2sim-oai-nr-ue0
DetachScript: docker stop l2sim-oai-nr-ue0
NetworkScript: docker exec l2sim-oai-nr-ue0 ip a show dev oaitun_ue1
......@@ -370,12 +370,12 @@ l2sim5g_ue:
MTU: 1500
l2sim5g_ext_dn:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec l2sim-oai-ext-dn ip a show dev eth0
CmdPrefix: docker exec l2sim-oai-ext-dn
l2sim4g_ue:
Host: localhost
Host: "%%current_host%%"
AttachScript: docker start l2sim4g-oai-lte-ue1
DetachScript: docker stop l2sim4g-oai-lte-ue1
NetworkScript: docker exec l2sim4g-oai-lte-ue1 ip a show dev oaitun_ue1
......@@ -384,6 +384,6 @@ l2sim4g_ue:
MTU: 1500
l2sim4g_ext_dn:
Host: localhost
Host: "%%current_host%%"
NetworkScript: docker exec l2sim4g-trf-gen ip a show dev eth0
CmdPrefix: docker exec l2sim4g-trf-gen
......@@ -41,14 +41,21 @@ import cls_cmd
class Module_UE:
def __init__(self, module_name, filename="ci_infra.yaml"):
def __init__(self, module_name, node="", filename="ci_infra.yaml"):
with open(filename, 'r') as f:
all_ues = yaml.load(f, Loader=yaml.FullLoader)
m = all_ues.get(module_name)
if m is None:
raise Exception(f'no such module name "{module_name}" in "{filename}"')
self.module_name = module_name
self.host = m['Host']
if node !="" and m['Host'] !="%%current_host%%":
raise Exception(f'servername provided when host already present in "{filename}"')
elif m['Host']=="%%current_host%%" and node == "":
raise Exception(f'servername not provided when needed')
elif m['Host']=="%%current_host%%":
self.host = node
else:
self.host = m['Host']
self.cmd_dict = {
"attach": m.get('AttachScript'),
"detach": m.get('DetachScript'),
......
......@@ -283,6 +283,8 @@ class OaiCiTest():
self.clean_repository = True
self.air_interface=''
self.ue_ids = []
self.nodes = []
self.svr_node = None
self.svr_id = None
self.cmd_prefix = '' # prefix before {lte,nr}-uesoftmodem
......@@ -609,7 +611,12 @@ class OaiCiTest():
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
def AttachUE(self, HTML, RAN, EPC, CONTAINERS):
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
if self.ue_ids == []:
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)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(ue.attach) for ue in ues]
attached = [f.result() for f in futures]
......@@ -760,8 +767,10 @@ class OaiCiTest():
if self.ue_ids == []:
raise Exception("no module names in self.ue_ids provided")
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
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)]
else:
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
logging.debug(ues)
pingLock = Lock()
with concurrent.futures.ThreadPoolExecutor() as executor:
......@@ -857,9 +866,11 @@ class OaiCiTest():
if self.ue_ids == [] or self.svr_id == None:
raise Exception("no module names in self.ue_ids or/and self.svr_id provided")
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
svr = cls_module.Module_UE(self.svr_id)
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)]
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)
logging.debug(ues)
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(self.Iperf_Module, EPC, ue, svr, RAN, i, len(ues), CONTAINERS) for i, ue in enumerate(ues)]
......
......@@ -217,6 +217,8 @@ def GetParametersFromXML(action):
elif action == 'Initialize_UE' or action == 'Attach_UE' or action == 'Detach_UE' or action == 'Terminate_UE' or action == 'CheckStatusUE' or action == 'DataEnable_UE' or action == 'DataDisable_UE':
CiTestObj.ue_ids = test.findtext('id').split(' ')
CiTestObj.nodes = test.findtext('nodes').split(' ')
print('-----------------------------------set citestobj.nodes as ',test.findtext('nodes').split(' '), len(test.findtext('nodes').split(' ')))
elif action == 'Build_OAI_UE':
CiTestObj.Build_OAI_UE_args = test.findtext('Build_OAI_UE_args')
......@@ -263,12 +265,17 @@ def GetParametersFromXML(action):
CiTestObj.ping_args = test.findtext('ping_args')
CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
CiTestObj.ue_ids = test.findtext('id').split(' ')
CiTestObj.nodes = test.findtext('nodes').split(' ')
print('-----------------------------------set citestonj.nodes as ',test.findtext('nodes').split(' '), len(test.findtext('nodes').split(' ')))
ping_rttavg_threshold = test.findtext('ping_rttavg_threshold') or ''
elif action == 'Iperf':
CiTestObj.iperf_args = test.findtext('iperf_args')
CiTestObj.ue_ids = test.findtext('id').split(' ')
CiTestObj.svr_id = test.findtext('svr_id') or None
CiTestObj.nodes = test.findtext('nodes').split(' ')
CiTestObj.svr_node = test.findtext('svr_node') or None
print('-----------------------------------set citestonj.nodes as ',test.findtext('nodes').split(' '), len(test.findtext('nodes').split(' ')))
CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold')
CiTestObj.iperf_bitrate_threshold = test.findtext('iperf_bitrate_threshold') or '90'
CiTestObj.iperf_profile = test.findtext('iperf_profile') or 'balanced'
......
......@@ -98,12 +98,14 @@
<class>Attach_UE</class>
<desc>Attach OAI UE (Wait for IP)</desc>
<id>rfsim4g_ue</id>
<nodes>localhost</nodes>
</testCase>
<testCase id="020011">
<class>Ping</class>
<desc>Ping Traffic-Gen from LTE-UE</desc>
<id>rfsim4g_ue</id>
<nodes>localhost</nodes>
<ping_args> -c 20 192.168.61.11</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -113,6 +115,7 @@
<desc>Ping LTE-UE from Traffic-Gen</desc>
<id>rfsim4g_ext_dn</id>
<ping_args>-c 20 12.0.0.2</ping_args>
<nodes>localhost</nodes>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
......@@ -124,6 +127,8 @@
<iperf_args>-u -t 30 -b 2M -R</iperf_args>
<iperf_packetloss_threshold>25</iperf_packetloss_threshold>
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
<nodes>localhost</nodes>
<svr_node>localhost</svr_node>
</testCase>
<testCase id="030011">
......@@ -134,6 +139,8 @@
<iperf_args>-u -t 30 -b 1M</iperf_args>
<iperf_packetloss_threshold>25</iperf_packetloss_threshold>
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
<nodes>localhost</nodes>
<svr_node>localhost</svr_node>
</testCase>
<testCase id="100011">
......
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