Example #1
0
    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()
Example #2
0
def configure():
    """Configure HIL"""
    config_testsuite()
    config_merge(
            {'extensions': {'hil.ext.obm.ipmi': '', }, })

    config.load_extensions()
Example #3
0
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()
Example #4
0
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()
Example #5
0
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
Example #6
0
    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()
Example #7
0
def configure():
    """Set up the HIL configureation."""
    config_testsuite()
    config_merge({
        'devel': {
            'dry_run': None,
        },
    })
    config.load_extensions()
Example #8
0
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()
Example #9
0
def configure():
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.auth.mock': '',
            'hil.ext.auth.null': None,
        },
    })
    config.load_extensions()
Example #10
0
def configure():
    """Configure HIL"""
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.obm.ipmi': '',
        },
    })

    config.load_extensions()
Example #11
0
File: mock.py Project: CCI-MOC/hil
def configure():
    """Configure HIL"""
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.auth.mock': '',
            'hil.ext.auth.null': None,
        },
    })
    config.load_extensions()
Example #12
0
def configure():
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.switches.brocade': '',
            'hil.ext.switches.dell': '',
            'hil.ext.switches.nexus': '',
        },
    })
    config.load_extensions()
Example #13
0
File: ipmi.py Project: shwsun/haas
def configure():
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.obm.ipmi': ''
        },
        'devel': {
           'dry_run': None
        }
    })
    config.load_extensions()
Example #14
0
def configure():
    config_testsuite()
    config_merge({
        'hil.ext.switches.dell': {
            'save': 'True'
         },
        'hil.ext.switches.nexus': {
            'save': 'True'
        }
    })
    config.load_extensions()
Example #15
0
File: ipmi.py Project: djfinn14/hil
def configure():
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.obm.ipmi': ''
        },
        'devel': {
           'dry_run': None
        }
    })
    config.load_extensions()
Example #16
0
def configure():
    config_testsuite()
    config_merge({
        'hil.ext.switches.dell': {
            'save': 'True'
        },
        'hil.ext.switches.nexus': {
            'save': 'True'
        }
    })
    config.load_extensions()
Example #17
0
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()
Example #18
0
def configure():
    """Set up the HIL configureation."""
    config_testsuite()
    config_merge({
        'extensions': {
            'hil.ext.obm.mock': '',
        },
        'devel': {
            'dry_run': None,
        },
    })
    config.load_extensions()
Example #19
0
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()
Example #20
0
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()
Example #21
0
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()
Example #22
0
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()
Example #23
0
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()
Example #24
0
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()
Example #25
0
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()
Example #26
0
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()
Example #27
0
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()
Example #28
0
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()
Example #29
0
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()
Example #30
0
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()
Example #31
0
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()
Example #32
0
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()
Example #33
0
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()
Example #34
0
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()
Example #35
0
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()
Example #36
0
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()
Example #37
0
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()
Example #38
0
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()
Example #39
0
def configure():
    """Configure HIL."""
    config_testsuite()
    config.load_extensions()
Example #40
0
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()
Example #41
0
def configure():
    """Configure HIL"""
    config_testsuite()
    config.load_extensions()
Example #42
0
def configure():
    config_testsuite()
    config.load_extensions()
Example #43
0
def configure():
    config_testsuite()
    if not cfg.get('database', 'uri').startswith('postgresql:'):
        pytest.skip('Database migrations are only supported for postgresql.')
    init_db()
Example #44
0
def configure():
    """Fixture to load the HIL config."""
    config_testsuite()
    config.load_extensions()
Example #45
0
def configure():
    """Set up the HIL config."""
    config_testsuite()
    config.configure_logging()
    config.load_extensions()
Example #46
0
File: ipmi.py Project: shwsun/haas
def configure():
    config_testsuite()
    config.load_extensions()
Example #47
0
def configure():
    config_testsuite()
    config.configure_logging()
    config.load_extensions()
Example #48
0
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()
Example #49
0
def configure():
    config_testsuite()
    if not cfg.get('database', 'uri').startswith('postgresql:'):
        pytest.skip('Database migrations are only supported for postgresql.')
    init_db()