def test_get_management_interface(self, mock_sysinvclient_init):
     interface = FakeInterface('interface', 'mgmt')
     mock_sysinvclient_init.return_value = None
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.iinterface.list = mock.MagicMock()
     sysinv_client.sysinv_client.iinterface.list.return_value = [interface]
     management_interface = sysinv_client.get_management_interface(
         'hostname')
     self.assertEqual(interface, management_interface)
 def test_get_controller_hosts(self, mock_sysinvclient_init):
     controller_list = ['controller-0', 'controller-1']
     mock_sysinvclient_init.return_value = None
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.ihost.list_personality = mock.MagicMock()
     sysinv_client.sysinv_client.ihost.list_personality.return_value = \
         controller_list
     controllers = sysinv_client.get_controller_hosts()
     self.assertEqual(controller_list, controllers)
Ejemplo n.º 3
0
 def test_create_route(self, mock_sysinvclient_init):
     mock_sysinvclient_init.return_value = None
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.route.create = mock.MagicMock()
     sysinv_client.create_route(
         'uuid', 'network', 'prefix', 'gateway', 'metric')
     sysinv_client.sysinv_client.route.create.assert_called_with(
         interface_uuid='uuid', network='network', prefix='prefix',
         gateway='gateway', metric='metric')
 def test_get_management_address_pool(self, mock_sysinvclient_init):
     network = FakeNetwork('mgmt', 'uuid')
     pool = FakeAddressPool('uuid')
     mock_sysinvclient_init.return_value = None
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.network.list = mock.MagicMock()
     sysinv_client.sysinv_client.network.list.return_value = [network]
     sysinv_client.sysinv_client.address_pool.get = mock.MagicMock()
     sysinv_client.sysinv_client.address_pool.get.return_value = pool
     management_pool = sysinv_client.get_management_address_pool()
     self.assertEqual(pool, management_pool)
Ejemplo n.º 5
0
 def test_delete_route(self, mock_sysinvclient_init):
     mock_sysinvclient_init.return_value = None
     route = FakeRoute('uuid', 'network', 'prefix', 'gateway', 'metric')
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.route.list_by_interface = mock.MagicMock()
     sysinv_client.sysinv_client.route.delete = mock.MagicMock()
     sysinv_client.sysinv_client.route.list_by_interface.return_value = \
         [route]
     sysinv_client.delete_route(
         'uuid', 'network', 'prefix', 'gateway', 'metric')
     sysinv_client.sysinv_client.route.delete.assert_called_with('uuid')
 def test_create_route(self, value, mock_sysinvclient_init):
     fake_route = utils.create_route_dict(value)
     mock_sysinvclient_init.return_value = None
     sysinv_client = sysinv_v1.SysinvClient(consts.DEFAULT_REGION_NAME,
                                            None)
     sysinv_client.sysinv_client = mock.MagicMock()
     sysinv_client.sysinv_client.route.create = mock.MagicMock()
     sysinv_client.create_route(fake_route['uuid'], fake_route['network'],
                                fake_route['prefix'], fake_route['gateway'],
                                fake_route['metric'])
     sysinv_client.sysinv_client.route.create.assert_called_with(
         interface_uuid=fake_route['uuid'],
         network=fake_route['network'],
         prefix=fake_route['prefix'],
         gateway=fake_route['gateway'],
         metric=fake_route['metric'])