示例#1
0
 def test_grpc_init(self):
     jv=jvision.jvision()
     device=MagicMock()
     server=MagicMock()
     with self.assertRaises(Exception) as context:
         jv.grpc_init(server_handle=server,dut_handle=device)
     self.assertTrue('cannot generate pem file on server' in str(context.exception))
示例#2
0
 def test_kill_jvision_decoder(self):
     jv=jvision.jvision()
     server=MagicMock()
     jv.decoder_status={'grpc':False,'gnmi':True}
     jv.decoder_pid={'grpc':1234,'gnmi':6789}
     with self.assertRaises(Exception) as context:
         jv.kill_jvision_decoder(server_handle=server,decoder_type='grpc')
示例#3
0
 def test_gen_and_upload_json_gnmi(self):
     jv=jvision.jvision()
     jv.jv_db_server="abc"
     jv.decoder_port={'gnmi':1234}
     with self.assertRaises(Exception) as context:
         jv.gen_and_upload_json(sensor_params=self.sensor_data,gnmi_params=self.gnmi_data,eos=1,decoder_type='gnmi')
示例#4
0
 def test_jvision_init_mgmt_ip(self):
     jv=jvision.jvision()
     device=MagicMock()
     with self.assertRaises(Exception) as context:
         jv.jvision_init(device=device,interface='eth1',server_ip_address='10.48.40.226/24',dut_ip_address='10.48.40.85/24',mgmt_ip="True")
     self.assertTrue('expected string or bytes-like object' in str(context.exception))
示例#5
0
 def test_start_jvision_decoder(self):
     jv=jvision.jvision()
     jv.json_file='xyz'
     server=MagicMock()
     #self.assertTrue(jv.start_jvision_decoder(server_handle=server,type='python',decoder_type='grpc',decoder_command='./grpc'),True)
     jv.start_jvision_decoder(server_handle=server,type='python',decoder_type='grpc',decoder_command='./grpc')
示例#6
0
 def test_jvision_init_server_excptn(self):
     jv=jvision.jvision()
     device=MagicMock()
     with self.assertRaises(Exception) as context:
         jv.jvision_init(device=device,interface='eth1',server_ip_address='1.1.1.1/24',dut_ip_address='2.2.2.2/24')
     self.assertTrue('cannot configure IP address and route on server' in str(context.exception))
示例#7
0
 def test_jvision_init_device_excptn(self):
     jv=jvision.jvision()
     with self.assertRaises(Exception) as context:
         jv.jvision_init()
     self.assertTrue('server & dut information are mandatory arguments' in str(context.exception))