def test_T1Detail_2(): t1_detail_text_2 = """ ***** w1g1: T1 Rx Alarms (Framer) ***** ALOS: OFF | LOS: OFF RED: OFF | AIS: OFF LOF: OFF | RAI: OFF ***** w1g1: T1 Rx Alarms (LIU) ***** Short Circuit: OFF Open Circuit: OFF Loss of Signal: OFF ***** w1g1: T1 Tx Alarms ***** AIS: OFF | YEL: OFF ***** w1g1: T1 Performance Monitoring Counters ***** Line Code Violation : 0 Bit Errors (CRC6/Ft/Fs) : 16 Out of Frame Errors : 7 Sync Errors : 0 Rx Level : -7.5db to -10db """ expected = { 'AIS': 'OFF', 'ALOS': 'OFF', 'Bit_Errors_CRC6/Ft/Fs': '16', 'LOF': 'OFF', 'LOS': 'OFF', 'Line_Code_Violation': '0', 'Loss_of_Signal': 'OFF', 'Open_Circuit': 'OFF', 'Out_of_Frame_Errors': '7', 'RAI': 'OFF', 'RED': 'OFF', 'Rx_Level_High': '-7.5', 'Rx_Level_Low': '-10', 'Short_Circuit': 'OFF', 'Sync_Errors': '0', 'TxAIS': 'OFF', 'YEL': 'OFF' } t = Linux.T1Detail(debug=True) output = t1_detail_text_2.splitlines() json_dict = t.convert_to_json(output) assert json_dict == expected
def run(self, local_info, router_context, gql_token, fp): """ """ test_info = self.test_info(local_info, router_context) self.output.test_start(test_info, status=Output.Status.OK) params = self.get_params() if self.check_user("root") != Output.Status.OK: return self.output.test_end(fp) self.output.progress_start(fp) router_context.query_node_info() json_data = {} error_lines = [] t1_detail = Linux.T1Detail(debug=self.debug, progobj=self) # Ugly.... self.fp = fp shell_status = t1_detail.run_linux_args(local_info, router_context, params['node_type'], params['namespace'], params['linux_device'], error_lines, json_data) # Ugly... self.fp = None # reset results for multi-router invocation self.results = [] if len(error_lines) == 0: # This should return a list of all entry_test entries which FAIL # These will be passed to test.output engine = EntryTest.Parser(debug=False) engine.eval_tests_by_entry(json_data, params['entry_tests'], self) else: self.output.proc_run_linux_error(shell_status, error_lines[0]) return self.output.test_end(fp) command = t1_detail.get_command(params['namespace'], params['linux_device']) self.output.proc_test_result(self.results, params, command) return self.output.test_end(fp)