xiaodongwang 36a7843d6d support testmode in chef
Change-Id: I9c43ff2aaf3ae96aa4ef826e0a0caddffffbaba2
2014-04-18 18:19:03 +00:00

268 lines
11 KiB
Plaintext

import simplejson as json
ADAPTERS = [
{'name': 'CentOS_openstack', 'os': 'CentOS', 'target_system': 'openstack'},
]
ROLES = [
{'name': 'os-single-controller', 'target_system': 'openstack'},
{'name': 'os-network', 'target_system': 'openstack'},
{'name': 'os-compute-worker', 'target_system': 'openstack'},
]
SWITCHES = [
{'ip': '1.2.3.4', 'vendor_info': 'huawei', 'credential_data': json.dumps({'version': 'v2c', 'community': 'public'})},
]
MACHINES_BY_SWITCH = {
'1.2.3.4': [
{'mac': '00:00:01:02:03:04', 'port': 1, 'vlan': 1},
],
}
CLUSTERS = [
{
'name': 'cluster1',
'adapter': 'CentOS_openstack',
'mutable': False,
'security_config': json.dumps({
'server_credentials': {
'username': 'root', 'password': 'huawei'
},
'service_credentials': {
'username': 'service', 'password': 'huawei'
},
'console_credentials': {
'username': 'admin', 'password': 'huawei'
}
}),
'networking_config': json.dumps({
'interfaces': {
'management': {
'nic': 'eth0',
'promisc': 0,
'netmask': '255.255.255.0',
'ip_end': '192.168.20.200',
'gateway': '',
'ip_start': '192.168.20.100'
},
'storage': {
'nic': 'eth0',
'promisc': 0,
'netmask': '255.255.254.0',
'ip_end': '10.145.88.200',
'gateway': '10.145.88.1',
'ip_start': '10.145.88.100'
},
'public': {
'nic': 'eth2',
'promisc': 1,
'netmask': '255.255.254.0',
'ip_end': '10.145.88.255',
'gateway': '10.145.88.1',
'ip_start': '10.145.88.100'
},
'tenant': {
'nic': 'eth0',
'promisc': 0,
'netmask': '255.255.254.0',
'ip_end': '10.145.88.120',
'gateway': '10.145.88.1',
'ip_start': '10.145.88.100'
}
},
'global': {
'nameservers': '192.168.20.254',
'proxy': 'http://192.168.20.254:3128',
'ntp_server': '192.168.20.254',
'search_path': 'ods.com',
'gateway': '10.145.88.1'
},
}),
'partition_config': json.dumps('/home 20%%;/tmp 10%%;/var 30%%;'),
},
]
HOSTS_BY_CLUSTER = {
'cluster1': [
{
'hostname': 'host1',
'mac': '00:00:01:02:03:04',
'mutable': False,
'config_data': json.dumps({
'netwoon.dumps(king': {
'interfaces': {
'management': {
'ip': '192.168.20.100',
},
},
},
'roles': ["os-dashboard"],
}),
},
],
}
cobbler_MOCK = {
'host_configs': []
}
chef_MOCK = {
'configs': {
'openstack': {
'env_default': {
'all_roles': {
'os-single-controller': 'openstack controller node',
'os-network': 'openstack network node',
'os-compute-worker': 'openstack nova node'
},
'config_mapping': {
'/credential/identity/users/admin': '/security/console_credentials',
'/credential/identity/users/compute': '/security/service_credentials',
'/credential/identity/users/image': '/security/service_credentials',
'/credential/identity/users/metering': '/security/service_credentials',
'/credential/identity/users/network': '/security/service_credentials',
'/credential/identity/users/object-store': '/security/service_credentials',
'/credential/identity/users/volume': '/security/service_credentials',
'/credential/mysql/compute': '/security/service_credentials',
'/credential/mysql/dashboard': '/security/service_credentials',
'/credential/mysql/identity': '/security/service_credentials',
'/credential/mysql/image': '/security/service_credentials',
'/credential/mysql/metering': '/security/service_credentials',
'/credential/mysql/network': '/security/service_credentials',
'/credential/mysql/volume': '/security/service_credentials',
'/credential/mysql/super/password': '/security/service_credentials/password',
'/networking/control/interface': '/networking/interfaces/management/nic',
'/ntp/ntpserver': '/networking/global/ntp_server',
'/networking/storage/interface': '/networking/interfaces/storage/nic',
'/networking/public/interface': '/networking/interfaces/public/nic',
'/networking/tenant/interface': '/networking/interfaces/tenant/nic',
'/networking/plugins/ovs/gre/local_ip_interface': '/networking/interfaces/tenant/nic',
},
'role_mapping': {
'os-single-controller': {
'/db/mysql/bind_address': '/networking/interfaces/management/ip',
'/mq/rabbitmq/bind_address': '/networking/interfaces/management/ip',
'/endpoints/compute/metadata/host': '/networking/interfaces/management/ip',
'/endpoints/compute/novnc/host': '/networking/interfaces/management/ip',
'/endpoints/compute/service/host': '/networking/interfaces/management/ip',
'/endpoints/compute/xvpvnc/host': '/networking/interfaces/management/ip',
'/endpoints/ec2/admin/host': '/networking/interfaces/management/ip',
'/endpoints/ec2/service/host': '/networking/interfaces/management/ip',
'/endpoints/identity/admin/host': '/networking/interfaces/management/ip',
'/endpoints/identity/service/host': '/networking/interfaces/management/ip',
'/endpoints/image/registry/host': '/networking/interfaces/management/ip',
'/endpoints/image/service/host': '/networking/interfaces/management/ip',
'/endpoints/metering/service/host': '/networking/interfaces/management/ip',
'/endpoints/network/service/host': '/networking/interfaces/management/ip',
'/endpoints/volume/service/host': '/networking/interfaces/management/ip'
},
'os-network': {
},
'os-compute-worker': {
}
},
'dashboard_roles': ['os-single-controller', 'os-dashboard'],
'role_assign_policy': {
'default':{
'bundles': [],
'exclusives': ['os-single-controller', 'os-network'],
'roles': ['os-single-controller', 'os-network', 'os-compute-worker'],
'default_min': 1,
'default_max': 1,
'maxs': {'os-compute-worker':-1}
},
'policy_by_host_numbers':{
'1': {
'bundles': [['os-single-controller', 'os-network', 'os-compute-worker']],
'exclusives':[]
},
'2': {
'bundles': [['os-network', 'os-compute-worker']],
'exclusives':['os-single-controller']
},
},
},
},
},
},
}
cobbler_EXPECTED = {
'expected_host_configs': [{
'profile': 'CentOS',
'name_servers_search': '1.ods.com ods.com',
'name': 'host1.1',
'hostname': 'host1',
'modify_interface': {
'dnsname-eth2': 'floating-host1.1.ods.com',
'dnsname-eth0': u'host1.1.ods.com',
'ipaddress-eth2': '10.145.88.100',
'static-eth2': True,
'static-eth0': True,
'netmask-eth0': '255.255.255.0',
'ipaddress-eth0': u'192.168.20.100',
'netmask-eth2': '255.255.254.0',
'macaddress-eth0': '00:00:01:02:03:04',
'management-eth2': False,
'management-eth0': True
},
'name_servers': '192.168.20.254',
'gateway': '10.145.88.1',
'ksmeta': {
'username': u'root',
'promisc_nics': 'eth2',
'chef_url': 'https://localhost/',
'tool': 'chef',
'partition': '/home 20%%;/tmp 10%%;/var 30%%;',
'proxy': 'http://192.168.20.254:3128',
'ignore_proxy': '127.0.0.1,localhost,host1.1,192.168.20.100',
'ntp_server': '192.168.20.254',
'chef_client_name': 'host1.1',
'chef_node_name': u'host1.1'
},
}],
}
chef_EXPECTED = {
'expected_configs': {
'host1.1': {
'roles_per_target_system': {
'openstack': ['os-dashboard'],
},
'cluster': '1',
'run_list': ['role[os-dashboard]']
},
'openstack': {
'1': {
'credential': {
'identity': {
'users': {
'compute': {'username': 'service', 'password': 'huawei'},
'network': {'username': 'service', 'password': 'huawei'},
'admin': {'username': 'admin', 'password': 'huawei'},
'image': {'username': 'service', 'password': 'huawei'},
'metering': {'username': 'service', 'password': 'huawei'},
'volume': {'username': 'service', 'password': 'huawei'},
'object-store': {'username': 'service', 'password': 'huawei'}
}
},
'mysql': {
'compute': {'username': 'service', 'password': 'huawei'},
'network': {'username': 'service', 'password': 'huawei'},
'image': {'username': 'service', 'password': 'huawei'},
'metering': {'username': 'service', 'password': 'huawei'},
'volume': {'username': 'service', 'password': 'huawei'},
'dashboard': {'username': 'service', 'password': 'huawei'},
'super': {'password': 'huawei'},
'identity': {'username': 'service', 'password': 'huawei'}
}
},
'networking': {
'control': {'interface': 'eth0'},
'storage': {'interface': 'eth0'},
'public': {'interface': 'eth2'},
'tenant': {'interface': 'eth0'}
},
'ntp': {'ntpserver': '192.168.20.254'},
},
},
},
}