Пример #1
0
 def setup_class(klass):
     """This method is run once for each class before any tests are run"""
     klass.ns = NetworkSettings('../config/network/network_settings.yaml')
     klass.ns_vlans = NetworkSettings(
         '../config/network/network_settings_vlans.yaml')
     klass.ns_ipv6 = NetworkSettings(
         '../config/network/network_settings_v6.yaml')
Пример #2
0
 def test_config_gateway(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # set the gateway ip to None to force _config_gateway to generate one
     ns['networks'][EXTERNAL_NETWORK][0]['gateway'] = None
     # Now rebuild network settings object and check for a repopulated value
     ns = NetworkSettings(ns)
     assert_equal(ns['networks'][EXTERNAL_NETWORK][0]['gateway'],
                  '192.168.37.1')
Пример #3
0
 def test_init_admin_disabled_or_missing(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # remove admin, apex section will re-add it
     ns['networks'].pop('admin', None)
     assert_raises(NetworkSettingsException, NetworkSettings, ns)
     # remove admin and apex
     ns.pop('apex', None)
     ns['networks'].pop('admin', None)
     assert_raises(NetworkSettingsException, NetworkSettings, ns)
Пример #4
0
 def test_config_ip(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # set the provisioner ip to None to force _gen_ip to generate one
     ns['networks'][ADMIN_NETWORK]['installer_vm']['ip'] = None
     ns['networks'][EXTERNAL_NETWORK][0]['installer_vm']['ip'] = None
     # Now rebuild network settings object and check for repopulated values
     ns = NetworkSettings(ns)
     assert_equal(ns['networks'][ADMIN_NETWORK]['installer_vm']['ip'],
                  '192.0.2.1')
     assert_equal(ns['networks'][EXTERNAL_NETWORK][0]['installer_vm']['ip'],
                  '192.168.37.1')
Пример #5
0
 def test_netenv_settings_api_network_vlans(self):
     ns = copy(self.ns_vlans)
     ns['networks'][API_NETWORK]['enabled'] = True
     ns = NetworkSettings(ns)
     # test vlans
     ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
     assert_equal(ne['parameter_defaults']['InternalApiNetworkVlanID'], 101)
Пример #6
0
 def test_invalid_nic_members(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     storage_net_nicmap = ns['networks'][STORAGE_NETWORK]['nic_mapping']
     # set duplicate nic
     storage_net_nicmap['compute']['members'][0] = 'nic1'
     assert_raises(NetworkSettingsException, NetworkSettings, ns)
     # remove nic members
     storage_net_nicmap['compute']['members'] = []
     assert_raises(NetworkSettingsException, NetworkSettings, ns)
Пример #7
0
 def test_get_network_settings(self):
     ns = NetworkSettings('../config/network/network_settings.yaml')
     assert_is_instance(ns, NetworkSettings)
     for role in ['controller', 'compute']:
         nic_index = 1
         print(ns.nics)
         for network in ns.enabled_network_list:
             nic = 'nic' + str(nic_index)
             assert_equal(ns.nics[role][network], nic)
             nic_index += 1
Пример #8
0
 def test_get_enabled_networks(self):
     ns = NetworkSettings('../config/network/network_settings.yaml')
     assert_is_instance(ns.enabled_network_list, list)
Пример #9
0
 def test_dump_bash(self):
     ns = NetworkSettings('../config/network/network_settings.yaml')
     assert_equal(ns.dump_bash(), None)
     assert_equal(ns.dump_bash(path='/dev/null'), None)
Пример #10
0
 def test_init_missing_dns_domain(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # remove storage
     ns.pop('dns-domain', None)
     assert_is_instance(NetworkSettings(ns), NetworkSettings)
Пример #11
0
 def test_init_collapse_storage(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # remove storage
     ns['networks'].pop('storage', None)
     assert_is_instance(NetworkSettings(ns), NetworkSettings)
Пример #12
0
 def test_init_vlans(self):
     assert_is_instance(
         NetworkSettings(files_dir + 'network_settings_vlans.yaml'),
         NetworkSettings)
Пример #13
0
 def test_admin_fail_auto_detect(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     # remove cidr and installer_vm to fail autodetect
     ns['networks'][ADMIN_NETWORK].pop('cidr', None)
     ns['networks'][ADMIN_NETWORK].pop('installer_vm', None)
     assert_raises(NetworkSettingsException, NetworkSettings, ns)
Пример #14
0
 def test_missing_vlan(self):
     ns = NetworkSettings(files_dir + 'network_settings.yaml')
     storage_net_nicmap = ns['networks'][STORAGE_NETWORK]['nic_mapping']
     # remove vlan from storage net
     storage_net_nicmap['compute'].pop('vlan', None)
     assert_is_instance(NetworkSettings(ns), NetworkSettings)