mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
FIOEndpProfile create can now take a connections_per_port arg
This commit is contained in:
@@ -2452,9 +2452,10 @@ class FIOEndpProfile(LFCliBase):
|
||||
self.json_post(req_url, data)
|
||||
#pprint(data)
|
||||
|
||||
def create(self, ports=[], sleep_time=.5, debug_=False, suppress_related_commands_=None):
|
||||
def create(self, ports=[], connections_per_port=1, sleep_time=.5, debug_=False, suppress_related_commands_=None):
|
||||
cx_post_data = []
|
||||
for port_name in ports:
|
||||
for num_connection in range(connections_per_port):
|
||||
if len(self.local_realm.name_to_eid(port_name)) == 3:
|
||||
shelf = self.local_realm.name_to_eid(port_name)[0]
|
||||
resource = self.local_realm.name_to_eid(port_name)[1]
|
||||
@@ -2464,7 +2465,7 @@ class FIOEndpProfile(LFCliBase):
|
||||
if self.directory is None or self.server_mount is None or self.fs_type is None:
|
||||
raise ValueError("directory [%s], server_mount [%s], and type [%s] must not be None" % (self.directory, self.server_mount, self.fs_type))
|
||||
endp_data = {
|
||||
"alias": self.cx_prefix + name + "_fio",
|
||||
"alias": self.cx_prefix + name + "_" + str(num_connection) + "_fio" ,
|
||||
"shelf": shelf,
|
||||
"resource": resource,
|
||||
"port": name,
|
||||
@@ -2482,15 +2483,15 @@ class FIOEndpProfile(LFCliBase):
|
||||
}
|
||||
# Read direction is copy of write only directory
|
||||
if self.io_direction == "read":
|
||||
endp_data["prefix"] = "wo_" + name + "_fio"
|
||||
endp_data["directory"] = "/mnt/lf/wo_" + name + "_fio"
|
||||
endp_data["prefix"] = "wo_" + name + "_" + str(num_connection) + "_fio"
|
||||
endp_data["directory"] = "/mnt/lf/wo_" + name + "_" + str(num_connection) + "_fio"
|
||||
|
||||
url = "cli-json/add_file_endp"
|
||||
self.local_realm.json_post(url, endp_data, debug_=True, suppress_related_commands_=suppress_related_commands_)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
data = {
|
||||
"name": self.cx_prefix + name + "_fio",
|
||||
"name": self.cx_prefix + name + "_" + str(num_connection) + "_fio" ,
|
||||
"io_direction": self.io_direction,
|
||||
"num_files": 5
|
||||
}
|
||||
@@ -2499,21 +2500,21 @@ class FIOEndpProfile(LFCliBase):
|
||||
|
||||
self.local_realm.json_post("/cli-json/nc_show_endpoints", {"endpoint": "all"})
|
||||
for port_name in ports:
|
||||
for num_connection in range(connections_per_port):
|
||||
if len(self.local_realm.name_to_eid(port_name)) == 3:
|
||||
shelf = self.local_realm.name_to_eid(port_name)[0]
|
||||
resource = self.local_realm.name_to_eid(port_name)[1]
|
||||
name = self.local_realm.name_to_eid(port_name)[2]
|
||||
|
||||
endp_data = {
|
||||
"alias": "CX_" + self.cx_prefix + name + "_fio",
|
||||
"alias": "CX_" + self.cx_prefix + name + "_" + str(num_connection) + "_fio" ,
|
||||
"test_mgr": "default_tm",
|
||||
"tx_endp": self.cx_prefix + name + "_fio",
|
||||
"tx_endp": self.cx_prefix + name + "_" + str(num_connection) + "_fio" ,
|
||||
"rx_endp": "NA"
|
||||
}
|
||||
cx_post_data.append(endp_data)
|
||||
self.created_cx[self.cx_prefix + name + "_fio"] = "CX_" + self.cx_prefix + name + "_fio"
|
||||
self.created_cx[self.cx_prefix + name + "_" + str(num_connection) + "_fio" ] = "CX_" + self.cx_prefix + name + "_" + str(num_connection) + "_fio"
|
||||
|
||||
# time.sleep(3)
|
||||
for cx_data in cx_post_data:
|
||||
url = "/cli-json/add_cx"
|
||||
self.local_realm.json_post(url, cx_data, debug_=debug_, suppress_related_commands_=suppress_related_commands_)
|
||||
|
||||
Reference in New Issue
Block a user