Exemplo n.º 1
0
 def test_refresh_agent_connections(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     devices, device = self.gen_devices()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     test_connection_init.refresh_agent_connections(devices)
Exemplo n.º 2
0
 def test_create_agent(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     devices, device = self.gen_devices()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     test_connection_init.create_agent(device)
Exemplo n.º 3
0
 def test_create_agent(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     my_name = self.gen_container_name()
     devices, device = self.gen_devices()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              self.grpc_timeout,
                                              controller_endpoints, my_name)
     test_connection_init.create_agent(device)
Exemplo n.º 4
0
 def test_resolve_endpoint(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     host, port = test_connection_init.resolve_endpoint(
         endpoint=consul_endpoint)
     assert isinstance(port, int)
     assert isinstance(host, basestring)
Exemplo n.º 5
0
 def test_resolve_endpoint(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     my_name = self.gen_container_name()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              self.grpc_timeout,
                                              controller_endpoints, my_name)
     host, port = test_connection_init.resolve_endpoint(
         endpoint=consul_endpoint)
     assert isinstance(port, int)
     assert isinstance(host, basestring)
Exemplo n.º 6
0
 def startup_components(self):
     self.log.info('starting-internal-components')
     args = self.args
     self.connection_manager = yield ConnectionManager(
         args.consul, args.grpc_endpoint, args.controller, args.instance_id, \
         args.enable_tls, args.key_file, args.cert_file).start()
     self.log.info('started-internal-services')
Exemplo n.º 7
0
 def test_connection_mgr_init(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     self.assertEqual(test_connection_init.consul_endpoint, consul_endpoint)
     self.assertEqual(test_connection_init.voltha_endpoint, voltha_endpoint)
     self.assertEqual(test_connection_init.controller_endpoints,
                      controller_endpoints)
Exemplo n.º 8
0
 def test_connection_mgr_init(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     my_name = self.gen_container_name()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints, my_name)
     self.assertEqual(test_connection_init.consul_endpoint, consul_endpoint)
     self.assertEqual(test_connection_init.vcore_endpoint, voltha_endpoint)
     self.assertEqual(test_connection_init.controller_endpoints,
                      controller_endpoints)
Exemplo n.º 9
0
 def test_forward_packet_in(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     devices, device = self.gen_devices()
     packet_in = self.gen_packet_in()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     test_connection_init.create_agent(device)
     test_connection_init.forward_packet_in(device.id, packet_in)
Exemplo n.º 10
0
 def test_delete_agent(self):
     consul_endpoint, voltha_endpoint, controller_endpoints = self.gen_endpoints(
     )
     devices, device = self.gen_devices()
     test_connection_init = ConnectionManager(consul_endpoint,
                                              voltha_endpoint,
                                              controller_endpoints)
     test_connection_init.create_agent(device)
     with self.assertRaises(Exception) as context:
         test_connection_init.delete_agent(device.datapath_id)
     print context.exception
     self.assertTrue('\'NoneType\' object has no attribute \'disconnect\''
                     in context.exception)
Exemplo n.º 11
0
 def startup_components(self):
     self.log.info('starting-internal-components')
     args = self.args
     self.connection_manager = yield ConnectionManager(
         args.consul, args.grpc_endpoint, args.controller).start()
     self.log.info('started-internal-services')