def self.data
@data ||= Hash.new do |hash, key|
hash[key] = begin
compute_pool_id = Fog.credentials[:ecloud_compute_pool_id] || Fog::Mock.random_numbers(3).to_i
environment_id = Fog.credentials[:ecloud_environment_id] || Fog::Mock.random_numbers(3).to_i
public_ip_id = Fog.credentials[:ecloud_public_ip_id] || Fog::Mock.random_numbers(6).to_i
internet_service_id = Fog::Mock.random_numbers(6).to_i
node_service_id = Fog::Mock.random_numbers(6).to_i
environment_name = Fog.credentials[:ecloud_environment_name] || Fog::Mock.random_letters(12)
location_id = Fog::Mock.random_numbers(4).to_i
network_id = Fog.credentials[:ecloud_network_id] || Fog::Mock.random_numbers(6).to_i
network_ip = Fog::Ecloud.ip_address
public_ip = Fog.credentials[:ecloud_public_ip_name] || Fog::Ecloud.ip_address
ip_address_id = Fog::Ecloud.ip_address
ip_address2_id = Fog::Ecloud.ip_address
operating_system_id = Fog::Mock.random_numbers(7).to_i
operating_system_family_id = Fog::Mock.random_numbers(7).to_i
organization_id = Fog::Mock.random_numbers(7).to_i
organization_name = Fog::Mock.random_letters(7)
template_id = Fog.credentials[:ecloud_template_id] || Fog::Mock.random_numbers(7).to_i
ssh_key_id = Fog.credentials[:ecloud_ssh_key_id] || Fog::Mock.random_numbers(4).to_i
ssh_key_name = Fog.credentials[:ecloud_ssh_key_name] || "root"
environment = {
:id => environment_id,
:href => "/cloudapi/ecloud/environments/#{environment_id}",
:name => environment_name,
:type => "application/vnd.tmrk.cloud.environment"
}
organization = {
:href => "/cloudapi/ecloud/organizations/#{organization_id}",
:type => "application/vnd.tmrk.cloud.organization",
:name => organization_name,
:Links => {
:Link => [
Fog::Ecloud.keep(environment, :href, :name, :type),
{
:href => "/cloudapi/ecloud/admin/organizations/#{organization_id}",
:name => organization_name,
:type => "application/vnd.tmrk.cloud.admin.organization",
:rel => "alternate",
},
{
:href => "/cloudapi/ecloud/devicetags/organizations/#{organization_id}",
:type => "application/vnd.tmrk.cloud.deviceTag; type=collection",
:rel => "down",
},
{
:href => "/cloudapi/ecloud/alerts/organizations/#{organization_id}",
:type => "application/vnd.tmrk.cloud.alertLog",
:rel => "down",
},
],
},
:Locations => {
:Location => [
{
:href => "/cloudapi/ecloud/locations/#{location_id}",
:name => organization_name,
:Catalog => {
:href => "/cloudapi/ecloud/admin/catalog/organizations/#{organization_id}/locations/#{location_id}",
:type => "application/vnd.tmrk.cloud.admin.catalogEntry; type=collection"
},
:Environments => { :Environment => [environment] }
}
]
}
}
environment.merge!(
:Links => {
:Link => [ Fog::Ecloud.keep(organization, :href, :name, :type), ]
}
)
admin_organization = {
:id => organization_id,
:href => "/cloudapi/ecloud/admin/organizations/#{organization_id}",
:type => "application/vnd.tmrk.cloud.admin.organization",
:name => organization_name,
:Links => {
:Link => [
Fog::Ecloud.keep(organization, :href, :type, :name)
],
},
:organization_id => organization_id,
}
compute_pool = {
:id => compute_pool_id,
:href => "/cloudapi/ecloud/computepools/#{compute_pool_id}",
:name => Fog::Mock.random_letters(12),
:type => "application/vnd.tmrk.cloud.computePool",
:environment_id => environment_id,
:Links => {
:Link => [
Fog::Ecloud.keep(organization, :href, :name, :type),
Fog::Ecloud.keep(environment, :href, :name, :type),
]
}
}
public_ip = {
:id => public_ip_id,
:href => "/cloudapi/ecloud/publicips/#{public_ip_id}",
:name => public_ip,
:type => "application/vnd.tmrk.cloud.publicIp",
:IpType => "none",
:environment_id => environment_id,
:Links => {
:Link => [
Fog::Ecloud.keep(environment, :href, :name, :type),
],
},
:InternetServices => {
:InternetService => [
],
},
}
internet_service = {
:id => internet_service_id,
:href => "/cloudapi/ecloud/internetservices/#{internet_service_id}",
:name => Fog::Mock.random_letters(6),
:type => "application/vnd.tmrk.cloud.internetService",
:public_ip_id => public_ip_id,
:Links => {
:Link => [
Fog::Ecloud.keep(public_ip, :href, :name, :type),
],
},
:NodeServices => {
:NodeService => [
]
},
}
node_service = {
:id => node_service_id,
:href => "/cloudapi/ecloud/nodeservices/#{node_service_id}",
:name => Fog::Mock.random_letters(6),
:type => "application/vnd.tmrk.cloud.nodeService",
:internet_service_id => internet_service_id,
:Links => {
:Link => [
Fog::Ecloud.keep(internet_service, :href, :name, :type)
],
},
}
internet_service[:NodeServices][:NodeService].push(node_service)
public_ip[:InternetServices][:InternetService].push(internet_service)
network = {
:id => network_id,
:href => "/cloudapi/ecloud/networks/#{network_id}",
:name => "#{network_ip}/#{Fog::Mock.random_numbers(2)}",
:type => "application/vnd.tmrk.cloud.network",
:Address => network_ip,
:NetworkType => "Dmz",
:BroadcastAddress => network_ip,
:GatewayAddress => network_ip,
:environment_id => environment_id,
:Links => {
:Link => [
Fog::Ecloud.keep(environment, :href, :name, :type),
]
},
:IpAddresses => {
:IpAddress => [],
},
}
ip_address = {
:id => ip_address_id,
:href => "/cloudapi/ecloud/ipaddresses/networks/#{network_id}/#{ip_address_id}",
:name => ip_address_id,
:type => "application/vnd.tmrk.cloud.ipAddress",
:network_id => network_id,
:Links => {
:Link => [ Fog::Ecloud.keep(network, :href, :name, :type), ],
},
:Reserved => "false",
:Host => nil,
:DetectedOn => nil,
}
ip_address2 = ip_address.dup.merge(:id => ip_address2_id, :href => "/cloudapi/ecloud/ipaddresses/networks/#{network_id}/#{ip_address2_id}", :name => ip_address2_id)
network[:IpAddresses][:IpAddress].push(ip_address).push(ip_address2)
short_name = "solaris10_64guest"
operating_system = {
:short_name => short_name,
:compute_pool_id => compute_pool_id,
:href => "/cloudapi/ecloud/operatingsystems/#{short_name}/computepools/#{compute_pool_id}",
:name => "Sun Solaris 10 (64-bit)",
:type => "application/vnd.tmrk.cloud.operatingSystem",
:FamilyName => "Solaris",
:Links => {
:Link => Fog::Ecloud.keep(compute_pool, :href, :name, :type),
},
:ConfigurationOptions => {
:Processor => {
:Minimum => "1",
:Maximum => "8",
:StepFactor => "1"
},
:Memory => {
:MinimumSize => {
:Unit => "MB",
:Value => "800"
},
:MaximumSize => {
:Unit => "MB",
:Value => "16384"
},
:StepFactor => {
:Unit => "MB",
:Value => "4"
}
},
:Disk => {
:Minimum => "1",
:Maximum => "15",
:SystemDisk => {
:ResourceCapacityRange => {
:MinimumSize => {
:Unit => "GB",
:Value => "1"
},
:MaximumSize => {
:Unit => "GB",
:Value => "512"
},
:StepFactor => {
:Unit => "GB",
:Value => "1"}
},
:MonthlyCost => "0"
},
:DataDisk => {
:ResourceCapacityRange => {
:MinimumSize => {
:Unit => "GB",
:Value => "1"
},
:MaximumSize => {
:Unit => "GB",
:Value => "512"
},
:StepFactor => {
:Unit => "GB",
:Value => "1"
}
},
:MonthlyCost => "0"
}
},
:NetworkAdapter=> {
:Minimum => "1",
:Maximum => "4",
:StepFactor => "1"
}
}
}
template = {
:id => template_id,
:href => "/cloudapi/ecloud/templates/#{template_id}/computepools/#{compute_pool_id}",
:type => "application/vnd.tmrk.cloud.template",
:name => "Sun Solaris 10 (x64)",
:compute_pool_id => compute_pool_id,
:OperatingSystem => Fog::Ecloud.keep(operating_system, :href, :name, :type),
:Memory => {
:MinimumSize => {
:Unit => "MB",
:Value => "800"
},
:MaximumSize => {
:Unit => "MB",
:Value => "16384"
},
:StepFactor => {
:Unit => "MB",
:Value => "4"
}
},
:Storage => {
:Size => {
:Unit => "GB",
:Value => "7"
}
},
:NetworkAdapters => "1",
:Links => {
:Link => [
Fog::Ecloud.keep(compute_pool, :href, :name, :type),
]
}
}
operating_system_family = {
:id => operating_system_family_id,
:compute_pool_id => compute_pool_id,
:OperatingSystemFamily => {
:Name => "Linux",
:OperatingSystems => {
:OperatingSystem => [Fog::Ecloud.keep(operating_system, :href, :name, :type)],
}
},
:Links => {
:Link => [
Fog::Ecloud.keep(compute_pool, :href, :name, :type),
]
}
}
ssh_key = {
:id => ssh_key_id,
:href => "/cloudapi/ecloud/admin/sshKeys/#{ssh_key_id}",
:name => ssh_key_name,
:admin_organization_id => organization_id,
:Links => {
:Link => [
Fog::Ecloud.keep(admin_organization, :href, :name, :type),
Fog::Ecloud.keep(organization, :href, :name, :type),
]
},
:Default => "true",
:FingerPrint => Fog::Ecloud.mac_address
}
layout = {
:id => environment_id,
:href => "/cloudapi/ecloud/layout/environments/#{environment_id}",
:type => "application/vnd.tmrk.cloud.deviceLayout",
:Links => {
:Link => [
Fog::Ecloud.keep(environment, :name, :href, :type),
],
},
:Rows => {
:Row => [
],
},
:environment_id => environment_id
}
{
:compute_pools => {compute_pool_id => compute_pool},
:environments => {environment_id => environment},
:public_ips => {public_ip_id => public_ip},
:internet_services => {internet_service_id => internet_service},
:node_services => {node_service_id => node_service},
:networks => {network_id => network},
:organizations => {organization_id => organization},
:admin_organizations => {organization_id => admin_organization},
:operating_systems => {operating_system_id => operating_system},
:operating_system_families => {operating_system_family_id => operating_system_family},
:servers => {},
:tasks => {},
:templates => {template_id => template},
:ssh_keys => {ssh_key_id => ssh_key},
:detached_disks => {},
:template_href => (Fog.credentials[:ecloud_template_href] || "/cloudapi/ecloud/templates/#{template_id}/computepools/#{compute_pool_id}"),
:rows => {},
:groups => {},
:layouts => {environment_id => layout},
}
end
end
end