def setUp(self): from hil.ext.switches.mock import LOCAL_STATE self.LOCAL_STATE = LOCAL_STATE fail_on_log_warnings() # Configure HIL: config_testsuite() config_merge({ 'extensions': { 'hil.ext.switches.mock': '', 'hil.ext.obm.ipmi': '', 'hil.ext.obm.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-200', }, }) config.load_extensions() newDB() # Initialize the db schema initial_db() # Populate the db with objects # Sanity check the start state: assert self.LOCAL_STATE['stock_switch_0']['free_port_0'] == {} self.request_context = app.test_request_context() self.request_context.push()
def configure(): """Configure HIL""" config_testsuite() config_merge( {'extensions': {'hil.ext.obm.ipmi': '', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.mock': '', 'hil.ext.switches.mock': '', 'hil.ext.obm.ipmi': '', 'hil.ext.obm.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '40-80', }, 'maintenance': { 'maintenance_project': 'maintenance', # Keystone url acts as dummy for posting 'url': 'http://127.0.0.1:9999/test/' } }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.switches.mock': '', 'hil.ext.obm.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '1001-1040', }, 'devel': { # Disable dry_run, so we can talk to obmd. Note: We register # several "real" switches in this module, but never actually # preform any "real" network operations on them, so a proper # switch setup is still not necessary. 'dry_run': None, }, }) config.load_extensions()
def configure(): """Configure HIL. The tests in this module require two separate sessions, so if the configuration specifies an in-memory sqlite database, we use a temporary file instead. """ config_testsuite() additional_config = { 'extensions': { 'hil.ext.obm.mock': '' } } # if we are using sqlite's in memory db, then change uri to a db on disk uri = config.cfg.get('database', 'uri') if uri == 'sqlite:///:memory:': with tempfile.NamedTemporaryFile() as temp_db: uri = 'sqlite:///' + temp_db.name additional_config['database'] = {'uri': uri} config_merge(additional_config) config.load_extensions() yield else: config_merge(additional_config) config.load_extensions() yield
def setUp(self): from hil.ext.switches.mock import LOCAL_STATE self.LOCAL_STATE = LOCAL_STATE fail_on_log_warnings() # Configure HIL: config_testsuite() config_merge({ 'extensions': { 'hil.ext.switches.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-200', }, }) config.load_extensions() newDB() # Initialize the db schema initial_db() # Populate the db with objects # Sanity check the start state: assert self.LOCAL_STATE['stock_switch_0']['free_port_0'] == {} self.request_context = app.test_request_context() self.request_context.push()
def configure(): """Set up the HIL configureation.""" config_testsuite() config_merge({ 'devel': { 'dry_run': None, }, }) config.load_extensions()
def configure(): """Configure HIL, and test which db we're using. Skips the test unless we're using postgres. """ config_testsuite() if not cfg.get('database', 'uri').startswith('postgresql:'): pytest.skip('Database migrations are only supported for postgresql.') init_db()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.auth.mock': '', 'hil.ext.auth.null': None, }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.obm.ipmi': '', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.auth.mock': '', 'hil.ext.auth.null': None, }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.switches.brocade': '', 'hil.ext.switches.dell': '', 'hil.ext.switches.nexus': '', }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.obm.ipmi': '' }, 'devel': { 'dry_run': None } }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'hil.ext.switches.dell': { 'save': 'True' }, 'hil.ext.switches.nexus': { 'save': 'True' } }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.obm.ipmi': '' }, 'devel': { 'dry_run': None } }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'hil.ext.switches.dell': { 'save': 'True' }, 'hil.ext.switches.nexus': { 'save': 'True' } }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '' }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-104, 300, 702', # Arbitrary list }, }) load_extensions()
def configure(): """Set up the HIL configureation.""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.obm.mock': '', }, 'devel': { 'dry_run': None, }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '' }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-104, 300, 702', # Arbitrary list }, }) load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.auth.mock': '', # This extension is enabled by default in the tests, so we need to # disable it explicitly: 'hil.ext.auth.null': None, 'hil.ext.switches.mock': '', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-105', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'extensions': { 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '100-105', }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'extensions': { 'hil.ext.auth.mock': '', # This extension is enabled by default in the tests, so we need to # disable it explicitly: 'hil.ext.auth.null': None, 'hil.ext.switches.mock': '', }, }) config.load_extensions()
def database_authentication(): """setup the config file for using database authentication. This fixture is only used by Test_user class""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.database': '', }, }) config.load_extensions()
def database_authentication(): """setup the config file for using database authentication. This fixture is only used by Test_user class""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.database': '', }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'auth': { # The tests in this module are checking the specific authorization # requirements of the API calls. as such, we don't want things to # fail due to complete lack of authentication, where they should # fail later when the specific authorization checks we're testing # for happen. 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.database': '', 'hil.ext.auth.null': None, }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'auth': { # The tests in this module are checking the specific authorization # requirements of the API calls. as such, we don't want things to # fail due to complete lack of authentication, where they should # fail later when the specific authorization checks we're testing # for happen. 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.database': '', 'hil.ext.auth.null': None, }, }) config.load_extensions()
def configure(): """Confgure HIL.""" config_testsuite() config_merge({ 'hil.ext.switches.dell': { 'save': 'True' }, 'hil.ext.switches.nexus': { 'save': 'True' }, 'hil.ext.switches.n3000': { 'save': 'True' }, 'hil.ext.switches.dellnos9': { 'save': 'True' } }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.switches.mock': '', 'hil.ext.obm.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '1001-1040', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'True', }, 'extensions': { 'hil.ext.auth.null': '', 'hil.ext.switches.dellnos9': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '40-80', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'True', }, 'extensions': { 'hil.ext.auth.null': '', 'hil.ext.switches.dellnos9': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '40-80', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'True', }, 'extensions': { 'hil.ext.switches.brocade': '', 'hil.ext.switches.dell': '', }, 'hil.ext.switches.brocade': { 'save': 'True' }, 'hil.ext.switches.dell': { 'save': 'False' } }) config.load_extensions()
def configure(): """Fixture which setups up hil.cfg, and loads extensions and such.""" tc.config_testsuite() tc.config_merge({ 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.keystone': '', }, 'hil.ext.auth.keystone': { 'auth_url': 'http://127.0.0.1:35357/v3', 'auth_protocol': 'http', 'username': '******', 'password': '******', 'project_name': 'admin', 'admin_user': '******', 'admin_password': '******', }, }) # the keystone client library actually bombs out if we don't configure # logging: config.configure_logging() config.load_extensions()
def configure(): """Fixture which setups up hil.cfg, and loads extensions and such.""" tc.config_testsuite() tc.config_merge({ 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.keystone': '', }, 'hil.ext.auth.keystone': { 'auth_url': 'http://127.0.0.1:35357/v3', 'auth_protocol': 'http', 'username': '******', 'password': '******', 'project_name': 'admin', 'admin_user': '******', 'admin_password': '******', }, }) # the keystone client library actually bombs out if we don't configure # logging: config.configure_logging() config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.database': '', 'hil.ext.switches.mock': '', 'hil.ext.switches.nexus': '', 'hil.ext.switches.dell': '', 'hil.ext.switches.brocade': '', 'hil.ext.obm.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '1001-1040', }, }) config.load_extensions()
def configure(): config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.database': '', 'hil.ext.switches.mock': '', 'hil.ext.switches.nexus': '', 'hil.ext.switches.dell': '', 'hil.ext.switches.brocade': '', 'hil.ext.obm.mock': '', 'hil.ext.obm.ipmi': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '1001-1040', }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.switches.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '1001-1040', }, 'devel': { # Disable dry_run, so we can talk to obmd. Note: We register # several "real" switches in this module, but never actually # preform any "real" network operations on them, so a proper # switch setup is still not necessary. 'dry_run': None, }, }) config.load_extensions()
def configure(): """Configure HIL""" config_testsuite() config_merge({ 'auth': { 'require_authentication': 'False', }, 'extensions': { 'hil.ext.auth.null': None, 'hil.ext.auth.mock': '', 'hil.ext.switches.mock': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '40-80', }, 'maintenance': { 'maintenance_project': 'maintenance', # Keystone url acts as dummy for posting 'url': 'http://127.0.0.1:9999/test/' } }) config.load_extensions()
def configure(): """Configure HIL.""" config_testsuite() config.load_extensions()
def test_validate_config(): """Test validing a HIL config file.""" config_testsuite() config_merge({ 'general': { 'log_level': 'debug', }, 'auth': { 'require_authentication': 'True', }, 'headnode': { 'trunk_nic': 'eth0', 'libvirt_endpoint': 'qemu:///system', }, 'client': { 'endpoint': 'http://127.0.0.1:5000', }, 'maintenance': { 'maintenance_project': 'maintenance', 'url': 'http://test.xyz', 'shutdown': '', }, 'extensions': { 'hil.ext.switches.dell': '', 'hil.ext.switches.dellnos9': '', 'hil.ext.switches.brocade': '', 'hil.ext.switches.n3000': '', 'hil.ext.switches.nexus': '', 'hil.ext.auth.null': None, 'hil.ext.auth.keystone': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '12, 13-20, 100-200', }, 'hil.ext.switches.dell': { 'save': 'True', }, 'hil.ext.switches.dellnos9': { 'save': 'False', }, 'hil.ext.switches.brocade': { 'save': 'True', }, 'hil.ext.switches.n3000': { 'save': 'False', }, 'hil.ext.switches.nexus': { 'save': 'True', }, 'hil.ext.auth.keystone': { 'auth_url': 'https://website:35357/v3', 'auth_protocol': 'http', 'username': '******', 'password': '******', 'project_name': 'project', 'admin_user': '******', 'admin_password': '******', } }) config.load_extensions() config.validate_config()
def configure(): """Configure HIL""" config_testsuite() config.load_extensions()
def configure(): config_testsuite() config.load_extensions()
def configure(): config_testsuite() if not cfg.get('database', 'uri').startswith('postgresql:'): pytest.skip('Database migrations are only supported for postgresql.') init_db()
def configure(): """Fixture to load the HIL config.""" config_testsuite() config.load_extensions()
def configure(): """Set up the HIL config.""" config_testsuite() config.configure_logging() config.load_extensions()
def configure(): config_testsuite() config.load_extensions()
def configure(): config_testsuite() config.configure_logging() config.load_extensions()
def test_validate_config(): """Test validing a HIL config file.""" config_testsuite() config_merge({ 'general': { 'log_level': 'debug', }, 'auth': { 'require_authentication': 'True', }, 'headnode': { 'trunk_nic': 'eth0', 'libvirt_endpoint': 'qemu:///system', }, 'client': { 'endpoint': 'http://127.0.0.1:5000', }, 'maintenance': { 'maintenance_project': 'maintenance', 'url': 'http://test.xyz', 'shutdown': '', }, 'extensions': { 'hil.ext.switches.dell': '', 'hil.ext.switches.dellnos9': '', 'hil.ext.switches.brocade': '', 'hil.ext.switches.n3000': '', 'hil.ext.switches.nexus': '', 'hil.ext.auth.null': None, 'hil.ext.auth.keystone': '', 'hil.ext.network_allocators.null': None, 'hil.ext.network_allocators.vlan_pool': '', }, 'hil.ext.network_allocators.vlan_pool': { 'vlans': '12, 13-20, 100-200', }, 'hil.ext.switches.dell': { 'save': 'True', }, 'hil.ext.switches.dellnos9': { 'save': 'False', }, 'hil.ext.switches.brocade': { 'save': 'True', }, 'hil.ext.switches.n3000': { 'save': 'False', }, 'hil.ext.switches.nexus': { 'save': 'True', }, 'hil.ext.auth.keystone': { 'auth_url': 'https://website:35357/v3', 'auth_protocol': 'http', 'username': '******', 'password': '******', 'project_name': 'project', 'admin_user': '******', 'admin_password': '******', } }) config.load_extensions() config.validate_config()
def configure(): config_testsuite() if not cfg.get('database', 'uri').startswith('postgresql:'): pytest.skip('Database migrations are only supported for postgresql.') init_db()