Libraries started for chamberview tests

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-03-23 02:10:56 +05:30
parent 50c84b4d89
commit 0a6feed52e
2 changed files with 116 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""
Library to Run Dataplane Test: Using lf_cv_base class
"""
from lf_cv_base import ChamberViewBase
class DataPlaneTest(ChamberViewBase):
def __init__(self, lfclient_host="localhost", lfclient_port=8080, debug_=False):
super().__init__(_lfjson_host=lfclient_host, _lfjson_port=lfclient_port, _debug=debug_)
self.set_config()
def set_config(self):
blob_data = """show_events: 1 show_log: 0 port_sorting: 0 kpi_id: Dataplane Pkt-Size bg: 0xE0ECF8 test_rig: show_scan: 1 auto_helper: 0 skip_2: 0 skip_5: 0 skip_5b: 1 skip_dual: 0 skip_tri: 1 selected_dut: TIP duration: 15000 traffic_port: 1.1.136 sta00500 upstream_port: 1.1.2 eth2 path_loss: 10 speed: 85% speed2: 0Kbps min_rssi_bound: -150 max_rssi_bound: 0 channels: AUTO modes: Auto pkts: 60;142;256;512;1024;MTU spatial_streams: AUTO security_options: AUTObandw_options: AUTO traffic_types: UDP;TCP directions: DUT Transmit;DUT Receive txo_preamble: OFDM txo_mcs: 0 CCK, OFDM, HT, VHT txo_retries: No Retry txo_sgi: OFF txo_txpower: 15 attenuator: 0 attenuator2: 0 attenuator_mod: 255 attenuator_mod2: 255 attenuations: 0..+50..950 attenuations2: 0..+50..950 chamber: 0 tt_deg: 0..+45..359 cust_pkt_sz: show_bar_labels: 1 show_prcnt_tput: 0 show_3s: 0 show_ll_graphs: 1 show_gp_graphs: 1 show_1m: 1 pause_iter: 0 show_realtime: 1 operator: mconn: 1 mpkt: 1000 tos: 0 loop_iterations: 1"""
self.add_text_blobs(type="Plugin-Settings", name="dataplane-test-latest-shivam", data=blob_data)
pass
def set_params(self):
pass
def run_test(self):
pass
def wait_until_test_finishes(self):
pass
def collect_reports(self):
pass
def main():
obj = DataPlaneTest(lfclient_host="localhost", lfclient_port=8080, debug_=True)
if __name__ == '__main__':
main()

77
py-json/lf_cv_base.py Normal file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""
Base Class to be used for Chamber View Tests
Methods:
1.) Add a CV Profile
2.) Remove a CV Profile
3.) Add a DUT
4.) Show a CV Profile
"""
from LANforge.lfcli_base import LFCliBase
class ChamberViewBase(LFCliBase):
def __init__(self, _lfjson_host="localhost", _lfjson_port=8080, _debug=False):
super().__init__(_lfjson_host=_lfjson_host, _lfjson_port=_lfjson_port, _debug=_debug)
def remove_text_blobs(self):
pass
def add_text_blobs(self, type="", name="", data="", debug=False):
data = {'type': type,
'name': name,
"text": data
}
self.json_post("/cli-json/add_text_blob/", data, debug_=debug)
def get_text_blob(self, type="", name="", debug=False):
data = {'type': type,
'name': name,
}
return self.json_post("/cli-json/show_text_blob/", data, debug_=debug)
def add_dut(self):
"""
//for DUT
/cli-json/add_dut
(
{
"name": Dut name which we want to give,
"flags": "4098",
"img_file" : "NONE",
"sw_version" : "[BLANK]",
"hw_version": "[BLANK]",
"model_num":"[BLANK]",
"serial_num":"[BLANK]",
"serial_port":"[BLANK]",
"wan_port":"[BLANK]",
"lan_port": "[BLANK]",
"ssid1": SSIDname1,
"passwd1": SSIDpassword1,
"ssid2": SSIDname2,
"passwd2": SSIDpassword2,
"ssid3":"[BLANK]",
"passwd3" :"[BLANK]",
"mgt_ip" : "0.0.0.0",
"api_id": "0",
"flags_mask" : "NA",
"antenna_count1" : "0",
"antenna_count2":"0",
"antenna_count3":"0",
"bssid1" : "00:00:00:00:00:00",
"bssid2" : "00:00:00:00:00:00",
"bssid3" : "00:00:00:00:00:00",
"top_left_x": "0",
"top_left_y": "0",
"eap_id": "[BLANK]",
}
)
"""
pass