Documentation ¶
Overview ¶
Package v2 contains common functions for creating compute-based resources for use in acceptance tests. See the `*_test.go` files for example usages.
Package v2 package contains acceptance tests for the Openstack Compute V2 service.
Index ¶
- func AssociateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, ...) error
- func AssociateFloatingIPWithFixedIP(t *testing.T, client *gophercloud.ServiceClient, ...) error
- func CreateBootableVolumeServer(t *testing.T, client *gophercloud.ServiceClient, ...) (*servers.Server, error)
- func CreateDefaultRule(t *testing.T, client *gophercloud.ServiceClient) (dsr.DefaultRule, error)
- func CreateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, ...) (*floatingips.FloatingIP, error)
- func CreateKeyPair(t *testing.T, client *gophercloud.ServiceClient) (*keypairs.KeyPair, error)
- func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (secgroups.SecurityGroup, error)
- func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, securityGroupID string) (secgroups.Rule, error)
- func CreateServer(t *testing.T, client *gophercloud.ServiceClient, ...) (*servers.Server, error)
- func CreateServerGroup(t *testing.T, client *gophercloud.ServiceClient, policy string) (*servergroups.ServerGroup, error)
- func CreateServerInServerGroup(t *testing.T, client *gophercloud.ServiceClient, ...) (*servers.Server, error)
- func CreateServerWithPublicKey(t *testing.T, client *gophercloud.ServiceClient, ...) (*servers.Server, error)
- func CreateVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, ...) (*volumeattach.VolumeAttachment, error)
- func DeleteDefaultRule(t *testing.T, client *gophercloud.ServiceClient, defaultRule dsr.DefaultRule)
- func DeleteFloatingIP(t *testing.T, client *gophercloud.ServiceClient, ...)
- func DeleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, keyPair *keypairs.KeyPair)
- func DeleteSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, ...)
- func DeleteSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, rule secgroups.Rule)
- func DeleteServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server)
- func DeleteServerGroup(t *testing.T, client *gophercloud.ServiceClient, ...)
- func DeleteVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, ...)
- func DisassociateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, ...)
- func GetNetworkIDFromNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error)
- func GetNetworkIDFromTenantNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error)
- func ImportPublicKey(t *testing.T, client *gophercloud.ServiceClient, publicKey string) (*keypairs.KeyPair, error)
- func PrintDefaultRule(t *testing.T, defaultRule *dsr.DefaultRule)
- func PrintFlavor(t *testing.T, flavor *flavors.Flavor)
- func PrintFloatingIP(t *testing.T, floatingIP *floatingips.FloatingIP)
- func PrintImage(t *testing.T, image images.Image)
- func PrintKeyPair(t *testing.T, keypair *keypairs.KeyPair)
- func PrintNetwork(t *testing.T, network *networks.Network)
- func PrintQuotaSet(t *testing.T, quotaSet *quotasets.QuotaSet)
- func PrintSecurityGroup(t *testing.T, securityGroup *secgroups.SecurityGroup)
- func PrintServer(t *testing.T, server *servers.Server)
- func PrintServerGroup(t *testing.T, serverGroup *servergroups.ServerGroup)
- func PrintTenantNetwork(t *testing.T, network *tenantnetworks.Network)
- func PrintVolumeAttachment(t *testing.T, volumeAttachment *volumeattach.VolumeAttachment)
- func ResizeServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server, ...) error
- func WaitForComputeStatus(client *gophercloud.ServiceClient, server *servers.Server, status string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssociateFloatingIP ¶
func AssociateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP, server *servers.Server) error
AssociateFloatingIP will associate a floating IP with an instance. An error will be returned if the floating IP was unable to be associated.
func AssociateFloatingIPWithFixedIP ¶
func AssociateFloatingIPWithFixedIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP, server *servers.Server, fixedIP string) error
AssociateFloatingIPWithFixedIP will associate a floating IP with an instance's specific fixed IP. An error will be returend if the floating IP was unable to be associated.
func CreateBootableVolumeServer ¶
func CreateBootableVolumeServer(t *testing.T, client *gophercloud.ServiceClient, blockDevices []bootfromvolume.BlockDevice, choices *clients.AcceptanceTestChoices) (*servers.Server, error)
CreateBootableVolumeServer works like CreateServer but is configured with one or more block devices defined by passing in []bootfromvolume.BlockDevice. An error will be returned if a server was unable to be created.
func CreateDefaultRule ¶
func CreateDefaultRule(t *testing.T, client *gophercloud.ServiceClient) (dsr.DefaultRule, error)
CreateDefaultRule will create a default security group rule with a random port range between 80 and 90. An error will be returned if a default rule was unable to be created.
func CreateFloatingIP ¶
func CreateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, choices *clients.AcceptanceTestChoices) (*floatingips.FloatingIP, error)
CreateFloatingIP will allocate a floating IP. An error will be returend if one was unable to be allocated.
func CreateKeyPair ¶
func CreateKeyPair(t *testing.T, client *gophercloud.ServiceClient) (*keypairs.KeyPair, error)
CreateKeyPair will create a KeyPair with a random name. An error will occur if the keypair failed to be created. An error will be returned if the keypair was unable to be created.
func CreateSecurityGroup ¶
func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (secgroups.SecurityGroup, error)
CreateSecurityGroup will create a security group with a random name. An error will be returned if one was failed to be created.
func CreateSecurityGroupRule ¶
func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, securityGroupID string) (secgroups.Rule, error)
CreateSecurityGroupRule will create a security group rule with a random name and a random TCP port range between port 80 and 99. An error will be returned if the rule failed to be created.
func CreateServer ¶
func CreateServer(t *testing.T, client *gophercloud.ServiceClient, choices *clients.AcceptanceTestChoices) (*servers.Server, error)
CreateServer creates a basic instance with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image will be the value of the OS_IMAGE_ID environment variable. The instance will be launched on the network specified in OS_NETWORK_NAME. An error will be returned if the instance was unable to be created.
func CreateServerGroup ¶
func CreateServerGroup(t *testing.T, client *gophercloud.ServiceClient, policy string) (*servergroups.ServerGroup, error)
CreateServerGroup will create a server with a random name. An error will be returned if the server group failed to be created.
func CreateServerInServerGroup ¶
func CreateServerInServerGroup(t *testing.T, client *gophercloud.ServiceClient, choices *clients.AcceptanceTestChoices, serverGroup *servergroups.ServerGroup) (*servers.Server, error)
CreateServerInServerGroup works like CreateServer but places the instance in a specified Server Group.
func CreateServerWithPublicKey ¶
func CreateServerWithPublicKey(t *testing.T, client *gophercloud.ServiceClient, choices *clients.AcceptanceTestChoices, keyPairName string) (*servers.Server, error)
CreateServerWithPublicKey works the same as CreateServer, but additionally configures the server with a specified Key Pair name.
func CreateVolumeAttachment ¶
func CreateVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, server *servers.Server, volume *volumes.Volume) (*volumeattach.VolumeAttachment, error)
CreateVolumeAttachment will attach a volume to a servert. An error will be returned if the volume failed to attach.
func DeleteDefaultRule ¶
func DeleteDefaultRule(t *testing.T, client *gophercloud.ServiceClient, defaultRule dsr.DefaultRule)
DeleteDefaultRule deletes a default security group rule. A fatal error will occur if the rule failed to delete. This works best when using it as a deferred function.
func DeleteFloatingIP ¶
func DeleteFloatingIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP)
DeleteFloatingIP will de-allocate a floating IP. A fatal error will occur if the floating IP failed to de-allocate. This works best when using it as a deferred function.
func DeleteKeyPair ¶
func DeleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, keyPair *keypairs.KeyPair)
DeleteKeyPair will delete a specified keypair. A fatal error will occur if the keypair failed to be deleted. This works best when used as a deferred function.
func DeleteSecurityGroup ¶
func DeleteSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, securityGroup secgroups.SecurityGroup)
DeleteSecurityGroup will delete a security group. A fatal error will occur if the group failed to be deleted. This works best as a deferred function.
func DeleteSecurityGroupRule ¶
func DeleteSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, rule secgroups.Rule)
DeleteSecurityGroupRule will delete a security group rule. A fatal error will occur if the rule failed to be deleted. This works best when used as a deferred function.
func DeleteServer ¶
func DeleteServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server)
DeleteServer deletes an instance via its UUID. A fatal error will occur if the instance failed to be destroyed. This works best when using it as a deferred function.
func DeleteServerGroup ¶
func DeleteServerGroup(t *testing.T, client *gophercloud.ServiceClient, serverGroup *servergroups.ServerGroup)
DeleteServerGroup will delete a server group. A fatal error will occur if the server group failed to be deleted. This works best when used as a deferred function.
func DeleteVolumeAttachment ¶
func DeleteVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, server *servers.Server, volumeAttachment *volumeattach.VolumeAttachment)
DeleteVolumeAttachment will disconnect a volume from an instance. A fatal error will occur if the volume failed to detach. This works best when used as a deferred functino.
func DisassociateFloatingIP ¶
func DisassociateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP, server *servers.Server)
DisassociateFloatingIP will disassociate a floating IP from an instance. A fatal error will occur if the floating IP failed to disassociate. This works best when using it as a deferred function.
func GetNetworkIDFromNetworks ¶
func GetNetworkIDFromNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error)
GetNetworkIDFromNetworks will return the network ID from a specified network UUID using the os-networks API extension. An error will be returned if the network could not be retrieved.
func GetNetworkIDFromTenantNetworks ¶
func GetNetworkIDFromTenantNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error)
GetNetworkIDFromTenantNetworks will return the network UUID for a given network name using the os-tenant-networks API extension. An error will be returned if the network could not be retrieved.
func ImportPublicKey ¶
func ImportPublicKey(t *testing.T, client *gophercloud.ServiceClient, publicKey string) (*keypairs.KeyPair, error)
ImportPublicKey will create a KeyPair with a random name and a specified public key. An error will be returned if the keypair failed to be created.
func PrintDefaultRule ¶
func PrintDefaultRule(t *testing.T, defaultRule *dsr.DefaultRule)
PrintDefaultRule will print a default security group rule and all of its attributes.
func PrintFlavor ¶
PrintFlavor will print a flavor and all of its attributes.
func PrintFloatingIP ¶
func PrintFloatingIP(t *testing.T, floatingIP *floatingips.FloatingIP)
PrintFloatingIP will print a floating IP and all of its attributes.
func PrintImage ¶
PrintImage will print an image and all of its attributes.
func PrintKeyPair ¶
PrintKeyPair will print keypair and all of its attributes.
func PrintNetwork ¶
PrintNetwork will print an os-networks based network and all of its attributes.
func PrintQuotaSet ¶
PrintQuotaSet will print a quota set and all of its attributes.
func PrintSecurityGroup ¶
func PrintSecurityGroup(t *testing.T, securityGroup *secgroups.SecurityGroup)
PrintSecurityGroup will print a security group and all of its attributes and rules.
func PrintServer ¶
PrintServer will print an instance and all of its attributes.
func PrintServerGroup ¶
func PrintServerGroup(t *testing.T, serverGroup *servergroups.ServerGroup)
PrintServerGroup will print a server group and all of its attributes.
func PrintTenantNetwork ¶
func PrintTenantNetwork(t *testing.T, network *tenantnetworks.Network)
PrintTenantNetwork will print an os-tenant-networks based network and all of its attributes.
func PrintVolumeAttachment ¶
func PrintVolumeAttachment(t *testing.T, volumeAttachment *volumeattach.VolumeAttachment)
PrintVolumeAttachment will print a volume attachment and all of its attributes.
func ResizeServer ¶
func ResizeServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server, choices *clients.AcceptanceTestChoices) error
ResizeServer performs a resize action on an instance. An error will be returned if the instance failed to resize. The new flavor that the instance will be resized to is specified in OS_FLAVOR_ID_RESIZE.
func WaitForComputeStatus ¶
func WaitForComputeStatus(client *gophercloud.ServiceClient, server *servers.Server, status string) error
WaitForComputeStatus will poll an instance's status until it either matches the specified status or the status becomes ERROR.
Types ¶
This section is empty.