Installing SNAPS¶
Install Dependencies¶
A few packages need to installed onto your system, before you can install SNAPS.
Git is used to download the snaps source from the OPNFV Gerrit repository.
Python, GCC and additional libraries are required to compile and install the packages used by SNAPS. These dependencies need to be installed whether or not a virtual Python environment is used.
Note: SNAPS-OO works best under Python 2.7; however, all of the code except in snaps.openstack.provisioning.ansible should work properly within a Python 3.4.4 runtime. Ansible support will not work in any Python 3.x when the Ansible version is 2.3.0 or prior. No indications when this support will be added as of 5 May 2017.
CentOS 7¶
sudo yum -y update
sudo yum install -y epel-release
sudo yum install -y git gcc python-pip python-devel openssl-devel
sudo pip install --upgrade pip
Ubuntu 14.04¶
sudo apt-get install git python2.7-dev libssl-dev python-pip
sudo apt-get install corkscrew (optional for SSH over an HTTP proxy)
Ubuntu 16.04¶
sudo apt install python git python2.7-dev libssl-dev python-pip
sudo apt install corkscrew (optional for SSH over an HTTP proxy)
Windows Server 2012¶
Install Python 2.7.x
Install Git
Install Microsoft Visual C++ Compiler for Python 2.7
Cannot SSH from behind a proxy in the 'cmd' shell as corkscrew is only available for Cygwin
Ansible functionality is not working on windows as an exception is being thrown while importing the packages
Optional: Setup a Python virtual environment¶
- Python 2.7 (recommend leveraging a Virtual Python runtime, e.g.
- Virtualenv, in your development environment)
Install SNAPS dependencies¶
The “pip” command below needs to be executed as root, if you are not using a virtual Python environment.
git clone https://gerrit.opnfv.org/gerrit/snaps
sudo pip install -e <path to repo>/snaps/
(note: on CentOS 7 and Ubuntu 14.04 you may have to try the previous command several times)
The install should now be complete and you can start using the SNAPS-OO libraries.
Try an example¶
Use launcher.py to deploy and clean up example environments. These examples are described in YAML files.
Add your OpenStack connection information to the deploy-complex-network.yaml.
Edit <path to repo>/examples/complex-network/deploy-complex-network.yaml
- openstack: the top level tag that denotes configuration for the OpenStack components
- connection: - contains the credentials and endpoints required to connect with OpenStack
- username: - the project’s user (required)
- password: - the tentant’s user password (required)
- auth_url: - the URL to the OpenStack APIs (required)
- project_name: - the name of the OpenStack project for the user (required)
- http_proxy: - the {{ host }}:{{ port }} of the proxy server the HTTPPhotoman01(optional)
Go to the examples directory.
cd <snaps repo>/examples/
Deploy the launcher.
python launch.py -t ./complex-network/deploy-complex-network.yaml -d
Clean the deployment.
python launch.py -t ./complex-network/deploy-complex-network.yaml -c
Customize the deployment by changing the yaml file.
The configuration file used to deploy and provision a virtual environment has been designed to describe the required images, networks, SSH public and private keys, associated VMs, as well as any required post deployment provisioning tasks.
- openstack: the top level tag that denotes configuration for the
OpenStack components
- connection: - contains the credentials and endpoints required to connect with OpenStack
- username: - the project’s user (required)
- password: - the tentant’s user password (required)
- auth_url: - the URL to the OpenStack APIs (required)
- project_name: - the name of the OpenStack project for the user (required)
- http_proxy: - the {{ host }}:{{ port }} of the proxy server the HTTPPhotoman01(optional)
- images: - describes each image
- image:
- name: The unique image name. If the name already exists for your project, a new one will not be created (required)
- format: The format type of the image i.e. qcow2 (required)
- download_url: The HTTP download location of the image file (required)
- nic_config_pb_loc: The file location relative to the CWD (python directory) to the Ansible Playbook used to configure VMs with more than one port. VMs get their first NIC configured for free while subsequent ones are not. This value/script will only be leveraged when necessary. Centos has been supported with “provisioning/ansible/centos-network-setup/configure_host.yml”.
- networks:
- network:
- name: The name of the network to be created. If one already exists, a new one will not be created (required)
- admin_state_up: T|F (default True)
- shared: (optional)
- project_name: Name of the project who owns the network. Note: only administrative users can specify projects other than their own (optional)
- external: T|F whether or not network is external (default False)
- network_type: The type of network to create. (optional)
- subnets:
- subnet:
- name: The name of the network to be created. If one already exists, a new one will not be created. Note: although OpenStack allows for multiple subnets to be applied to any given network, we have not included support as our current use cases does not utilize this functionality (required)
- cidr: The subnet mask value (required)
- dns_nameservers: A list of IP values used for DNS resolution (default: 8.8.8.8)
- ip_version: 4|6 (default: 4)
- project_name: Name of the project who owns the network. Note: only administrative users can specify projects other than their own (optional)
- start: The start address for allocation_pools (optional)
- end: The ending address for allocation_pools (optional)
- gateway_ip: The IP address to the gateway (optional)
- enable_dhcp: T|F (optional)
- dns_nameservers: List of DNS server IPs
- host_routes: A list of host route dictionaries (optional)
i.e.:
yaml "host_routes":[ { "destination":"0.0.0.0/0", "nexthop":"123.456.78.9" }, { "destination":"192.168.0.0/24", "nexthop":"192.168.0.1" } ]
- destination: The destination for a static route (optional)
- nexthop: The next hop for the destination (optional)
- ipv6_ra_mode: Valid values: “dhcpv6-stateful”, “dhcpv6-stateless”, and “slaac” (optional)
- ipv6_address_mode: Valid values: “dhcpv6-stateful”, “dhcpv6-stateless”, and “slaac” (optional)
- routers:
- router:
- name: The name of the router to be created. If one already exists, a new one will not be created (required)
- project_name: Name of the project who owns the network. Note: only administrative users can specify projects other than their own (optional)
- internal_subnets: A list of subnet names on which the router will be placed (optional)
- external_gateway: A dictionary containing the external gateway parameters: “network_id”, “enable_snat”, “external_fixed_ips” (optional)
- interfaces: A list of port interfaces to create to other
subnets (optional)
- port (Leverages the same class/structure as port objects on
VM instances. See port definition below for a
full accounting of the port attributes. The ones listed
below are generally used for routers)
- name: The name given to the new port (must be unique for project) (required)
- network_name: The name of the new port’s network (required)
- ip_addrs: A list of k/v pairs (optional)
- subnet_name: the name of a subnet that is on the port’s network
- ip: An IP address of the associated subnet to assign to the new port (optional but generally required for router interfaces)
- port (Leverages the same class/structure as port objects on
VM instances. See port definition below for a
full accounting of the port attributes. The ones listed
below are generally used for routers)
- keypairs:
- keypair:
- name: The name of the keypair to be created. If one already exists, a new one will not be created but simply loaded from its configured file location (required)
- public_filepath: The path to where the generated public key will be stored if it does not exist (optional but really required for provisioning purposes)
- private_filepath: The path to where the generated private key will be stored if it does not exist (optional but really required for provisioning purposes)
- instances:
- instance:
- name: The unique instance name for project. (required)
- flavor: Must be one of the preconfigured flavors (required)
- imageName: The name of the image to be used for deployment (required)
- keypair_name: The name of the keypair to attach to instance (optional but required for NIC configuration and Ansible provisioning)
- sudo_user: The name of a sudo_user that is attached to the keypair (optional but required for NIC configuration and Ansible provisioning)
- vm_boot_timeout: The number of seconds to block waiting for an instance to deploy and boot (default 900)
- vm_delete_timeout: The number of seconds to block waiting for an instance to be deleted (default 300)
- ssh_connect_timeout: The number of seconds to block waiting for an instance to achieve an SSH connection (default 120)
- ports: A list of port configurations (should contain at least one)
- port: Denotes the configuration of a NIC
- name: The unique port name for project (required)
- network_name: The name of the network to which the port is attached (required)
- ip_addrs: Static IP addresses to be added to the port by subnet (optional)
- subnet_name: The name of the subnet
- ip: The assigned IP address (when null, OpenStack will assign an IP to the port)
- admin_state_up: T|F (default True)
- project_name: The name of the project who owns the network. Only administrative users can specify a the project ID other than their own (optional)
- mac_address: The desired MAC for the port (optional)
- fixed_ips: A dictionary that allows one to specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port. If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the specified address to the port. (optional)
- seurity_groups: A list of security group IDs (optional)
- allowed_address_pairs: A dictionary containing a set of zero or more allowed address pairs. An address pair contains an IP address and MAC address. (optional)
- opt_value: The extra DHCP option value (optional)
- opt_name: The extra DHCP option name (optional)
- device_owner: The ID of the entity that uses this port. For example, a DHCP agent (optional)
- device_id: The ID of the device that uses this port. For example, a virtual server (optional)
- floating_ips: list of floating_ip configurations (optional)
- floating_ip:
- name: Must be unique for VM instance (required)
- port_name: The name of the port requiring access to the external network (required)
- subnet_name: The name of the subnet contains the IP address on the port on which to create the floating IP (optional)
- router_name: The name of the router connected to an external network used to attach the floating IP (required)
- provisioning: (True|False) Denotes whether or not this IP can be used for Ansible provisioning (default True)
- ansible: Each set of attributes below are contained in a list
- playbook_location: Full path or relative to the directory in which the deployment file resides (required)
- hosts: A list of hosts to which the playbook will be executed (required)
- variables: Should your Ansible scripts require any substitution values to be applied with Jinga2templates, the values defined here will be used to for substitution
- tag name = substitution variable names. For instance, for any file
being pushed to the host being provisioned containing a value such
as {{ foo }}, you must specify a tag name of “foo”
- vm_name:
- type: string|port|os_creds|vm-attr (note: will need to make changes to deploy_venv.py#__get_variable_value() for additional support)
- when type == string, an tag name “value” must exist and its value will be used for template substituion
- when type == port, custom code has been written to extract
certain assigned values to the port:
- vm_name: must correspond to a VM’s name as configured in this file
- port_name: The name of the port from which to extract the substitution values (required)
- port_value: The port value. Currently only supporting “mac_address” and “ip_address” (only the first)
- when type == os_creds, custom code has been written to extract
the file’s connection values:
- username: connection’s user
- password: connection’s password
- auth_url: connection’s URL
- project_name: connection’s project
- when type == vm-attr, custom code has been written to extract
the following attributes from the vm:
- vm_name: must correspond to a VM’s name as configured in this file
- value -> floating_ip: is currently the only vm-attr supported
Running Unit Test Suite¶
Execute the tests¶
cd <path to repo>
python snaps/test_runner.py -e <path to RC file> -n <external network name>
SNAPS-OO Library Usage¶
The pattern used within the SNAPS-OO library for creating OpenStack instances have been made as consistent as possible amongst the different instance types. Each consists of a constructor that takes in a credentials object and generally takes in a single “settings” (configuration) object. The only exception to this rule is with the OpenStackVMInstance (creates an OpenStack Server) where it takes in the additional settings used for the associated image and SSH key-pairs credentials as those objects contain additional attributes required of SNAPS, primarily when one needs to obtain remote access. After instantiation, the create() method must be called to initiate all of the necessary remote API calls to OpenStack required for proper instance creation.
SNAPS Credentials¶
As communicating with OpenStack is performed via secure remote RESTful API calls, any function or method performing any type of query or CRUD operation must know how to connect to the NFVI. The class *OSCreds* defined in snaps.openstack.os_credentials.py contains everything required to connect to any Keystone v2.0 or v3 authorization server. The attributes are listed below:
- username
- password
- auth_url
- project_name (aka. tenant_name)
- identity_api_version (for obtaining Keystone authorization token. Versions 2.0 & v3 only validated.)
- image_api_version (Glance version 1 & 2 only validated)
- network_api_version (Neutron version 2 currently only validated)
- compute_api_version (Nova version 2 currently only validated)
- heat_api_version (Heat version 1 currently only validated)
- user_domain_id (default=’default’)
- user_domain_name (default=’default’)
- project_domain_id (default=’default’)
- project_domain_name (default=’default’)
- interface (default=’admin’, used to specify the endpoint type for keystone: public, admin, internal)
- cacert (default=False, expected values T|F to denote server certificate verification, else value contains the path to an HTTPS certificate)
- region_name (The region name default=None)
- proxy_settings
- host (the HTTP proxy host)
- port (the HTTP proxy port)
- https_host (the HTTPS proxy host, default value of host)
- https_port (the HTTPS proxy port, default value of port)
- ssh_proxy_cmd (same as the value placed into ssh -o ProxyCommand=’<this config value>’)
Create OS Credentials Object¶
from snaps.openstack.os_credentials import OSCreds
os_creds=OSCreds(username='admin', password='admin',
auth_url='http://localhost:5000/v3', project_name='admin',
identity_api_version=3)
SNAPS Object Creators¶
Each creator minimally requires an OSCreds object for connecting to the NFVI, associated *Settings object for instance configuration, create() method to make the necessary remote API calls and create all of the necessary OpenStack instances required, and clean() method that is responsible for deleting all associated OpenStack instances. Please see the class diagram here. Below is a textual representation of the requirements of each creator classes with their associated setting classes and a sample code snippet on how to use the code.
Create User¶
- User - snaps.openstack.create_user.OpenStackUser
- snaps.openstack.create_user.UserSettings
- name - the username (required)
- password - the user’s password (required)
- project_name - the name of the project to associated to this user (optional)
- domain_name - the user’s domain (default=’default’)
- email - the user’s email address (optional)
- enabled - flag to determine whether or not the user should be enabled (default=True)
- snaps.openstack.create_user.UserSettings
from snaps.openstack.create_user import UserSettings, OpenStackUser
user_settings = UserSettings(name='username', password='password')
user_creator = OpenStackUser(os_creds, user_settings)
user_creator.create()
# Retrieve OS creds for new user for creating other OpenStack instance
user_creds = user_creator.get_os_creds(os_creds.project_name)
# Perform logic
...
# Cleanup
user_creator.clean()
Create Project¶
- Project - snaps.openstack.create_project.OpenStackProject
- snaps.openstack.create_project.ProjectSettings
- name - the project name (required)
- domain - the project’s domain (default=’default’)
- description - the project’s description (optional)
- enables - flag to determine whether or not the project should be enabled (default=True)
- snaps.openstack.create_project.ProjectSettings
from snaps.openstack.create_project import ProjectSettings, OpenStackProject
project_settings = ProjectSettings(name='username', password='password')
project_creator = OpenStackProject(os_creds, project_settings)
project_creator.create()
# Perform logic
...
# Cleanup
project_creator.clean()
Create Flavor¶
- Flavor - snaps.openstack.create_flavor.OpenStackFlavor
- snaps.openstack.create_flavor.FlavorSettings
- name - the flavor name (required)
- flavor_id - the flavor’s string ID (default=’auto’)
- ram - memory in MB to allocate to VM (required)
- disk - disk storage in GB (required)
- vcpus - the number of CPUs to allocate to VM (required)
- ephemeral - the size of the ephemeral disk in GB (default=0)
- swap - the size of the swap disk in GB (default=0)
- rxtx_factor - the receive/transmit factor to be set on ports if backend supports QoS extension (default=1.0)
- is_public - flag that denotes whether or not other projects can access image (default=True)
- snaps.openstack.create_flavor.FlavorSettings
from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor
flavor_settings = FlavorSettings(name='flavor-name', ram=4, disk=10, vcpus=2)
flavor_creator = OpenStackFlavor(os_creds, flavor_settings)
flavor_creator.create()
# Perform logic
...
# Cleanup
flavor_creator.clean()
Create Image¶
- Image - snaps.openstack.create_image.OpenStackImage
- snaps.openstack.create_image.ImageSettings
- name - the image name (required)
- image_user - the default image user generally used by OpenStackVMInstance class for obtaining an SSH connection (required)
- img_format - the image’s format (i.e. qcow2) (required)
- url - the download URL to obtain the image file (this or image_file must be configured, not both)
- image_file - the location of the file to be sourced from the local filesystem (this or url must be configured, not both)
- nic_config_pb_loc - the location of the ansible playbook that can configure additional NICs. Floating IPs are required to perform this operation. (optional)
- snaps.openstack.create_image.ImageSettings
from snaps.openstack.create_image import ImageSettings, OpenStackImage
image_settings = ImageSettings(name='image-name', image_user='ubuntu', img_format='qcow2',
url='http://uec-images.ubuntu.com/releases/trusty/14.04/ubuntu-14.04-server-cloudimg-amd64-disk1.img')
image_creator = OpenStackImage(os_creds, image_settings)
image_creator.create()
# Perform logic
...
# Cleanup
image_creator.clean()
Create Keypair¶
- Keypair - snaps.openstack.create_keypair.OpenStackKeypair
- snaps.openstack.create_keypair.KeypairSettings
- name - the keypair name (required)
- public_filepath - the file location to where the public key is to be written or currently resides (optional)
- private_filepath - the file location to where the private key file is to be written or currently resides (optional but highly recommended to leverage or the private key will be lost forever)
- snaps.openstack.create_keypair.KeypairSettings
from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair
keypair_settings = KeypairSettings(name='kepair-name', private_filepath='/tmp/priv-kp')
keypair_creator = OpenStackKeypair(os_creds, keypair_settings)
keypair_creator.create()
# Perform logic
...
# Cleanup
keypair_creator.clean()
Create Network¶
- Network - snaps.openstack.create_network.OpenStackNetwork
- snaps.openstack.create_network.NetworkSettings
- name - the name of the network (required)
- admin_state_up - flag denoting the administrative status of the network (True = up, False = down)
- shared - flag indicating whether the network can be shared across projects/tenants (default=True)
- project_name - the name of the project (optional - can only be set by admin users)
- external - flag determining if network has external access (default=False)
- network_type - the type of network (i.e. vlan|vxlan|flat)
- physical_network - the name of the physical network (required when network_type is ‘flat’)
- subnet_settings (list of optional
snaps.openstack.create_network.SubnetSettings objects)
- cidr - the subnet’s CIDR (required)
- ip_version - 4 or 6 (default=4)
- name - the subnet name (required)
- project_name - the name of the project (optional - can only be set by admin users)
- start - the start address for the allocation pools
- end - the end address for the allocation pools
- gateway_ip - the gateway IP
- enable_dhcp - flag to determine whether or not to enable DHCP (optional)
- dns_nameservers - a list of DNS nameservers
- host_routes - list of host route dictionaries for subnet (optional, see pydoc and Neutron API for more details)
- destination - the destination for static route (optional)
- nexthop - the next hop for the destination (optional)
- ipv6_ra_mode - valid values include: ‘dhcpv6-stateful’, ‘dhcp6v-stateless’, ‘slaac’ (optional)
- ipvc_address_mode - valid values include: ‘dhcpv6-stateful’, ‘dhcp6v-stateless’, ‘slaac’ (optional)
- snaps.openstack.create_network.NetworkSettings
from snaps.openstack.create_network import NetworkSettings, SubnetSettings, OpenStackNetwork
subnet_settings = SubnetSettings(name='subnet-name', cidr='10.0.0.0/24')
network_settings = NetworkSettings(name='network-name', subnet_settings=[subnet_settings])
network_creator = OpenStackNetwork(os_creds, network_settings)
network_creator.create()
# Perform logic
...
# Cleanup
network_creator.clean()
Create Security Group¶
- Security Group -
snaps.openstack.create_security_group.OpenStackSecurityGroup
- snaps.openstack.create_security_group.SecurityGroupSettings
- name - the security group’s name (required)
- description - the description (optional)
- project_name - the name of the project (optional - can only be set by admin users)
- rule_settings (list of
optional snaps.openstack.create_security_group.SecurityGroupRuleSettings
objects)
- sec_grp_name - the name of the associated security group (required)
- description - the description (optional)
- direction - enum snaps.openstack.create_security_group.Direction (required)
- remote_group_id - the group ID to associate with this rule
- protocol - enum snaps.openstack.create_security_group.Protocol (optional)
- ethertype - enum snaps.openstack.create_security_group.Ethertype (optional)
- port_range_min - the max port number in the range that is matched by the security group rule (optional)
- port_range_max - the min port number in the range that is matched by the security group rule (optional)
- sec_grp_rule - the rule object to a security group rule object to associate (note: does not work currently)
- remote_ip_prefix - the remote IP prefix to associate with this metering rule packet (optional)
- snaps.openstack.create_security_group.SecurityGroupSettings
from snaps.openstack.create_security_group import SecurityGroupSettings, SecurityGroupRuleSettings, Direction, OpenStackSecurityGroup
rule_settings = SubnetSettings(name='subnet-name', cidr='10.0.0.0/24')
network_settings = NetworkSettings(name='network-name', subnet_settings=[subnet_settings])
sec_grp_name = 'sec-grp-name'
rule_settings = SecurityGroupRuleSettings(name=sec_grp_name, direction=Direction.ingress)
security_group_settings = SecurityGroupSettings(name=sec_grp_name, rule_settings=[rule_settings])
security_group_creator = OpenStackSecurityGroup(os_creds, security_group_settings)
security_group_creator.create()
# Perform logic
...
# Cleanup
security_group_creator.clean()
Create Router¶
- Router - snaps.openstack.create_router.OpenStackRouter
- snaps.openstack.create_router.RouterSettings
- name - the router name (required)
- project_name - the name of the project (optional - can only be set by admin users)
- external_gateway - the name of the external network (optional)
- admin_state_up - flag to denote the administrative status of the router (default=True)
- external_fixed_ips - dictionary containing the IP address parameters (parameter not tested)
- internal_subnets - list of subnet names to which this router will connect (optional)
- port_settings (list of optional
snaps.openstack.create_router.PortSettings objects) - creates
custom ports to internal subnets (similar to internal_subnets
with more control)
- name
- network_name
- admin_state_up
- project_name - the name of the project (optional - can only be set by admin users)
- mac_address
- ip_addrs
- fixed_ips
- security_groups
- allowed_address_pairs
- opt_value
- opt_name
- device_owner
- device_id
- snaps.openstack.create_router.RouterSettings
from snaps.openstack.create_router import RouterSettings, OpenStackRouter
router_settings = RouterSettings(name='router-name', external_gateway='external')
router_creator = OpenStackRouter(os_creds, router_settings)
router_creator.create()
# Perform logic
...
# Cleanup
router_creator.clean()
Create VM Instance¶
- VM Instances - snaps.openstack.create_instance.OpenStackVmInstance
- snaps.openstack.create_instance.VmInstanceSettings
- name - the name of the VM (required)
- flavor - the name of the flavor (required)
- port_settings - list of snaps.openstack.create_network.PortSettings objects where each denote a NIC (see above in create router section for details) API does not require, but newer NFVIs now require VMs have at least one network
- security_group_names - a list of security group names to apply to VM
- floating_ip_settings (list of
snaps.openstack_create_instance.FloatingIpSettings objects)
- name - a name to a floating IP for easy lookup
- port_name - the name of the VM port on which the floating IP should be applied (required)
- router_name - the name of the router to the external network (required)
- subnet_name - the name of the subnet on which to attach the floating IP (optional)
- provisioning - when true, this floating IP will be used for provisioning which will come into play once we are able to get multiple floating IPs working.
- sudo_user - overrides the image_settings.image_user value when attempting to connect via SSH
- vm_boot_timeout - the number of seconds that the thread will block when querying the VM’s status when building (default=900)
- vm_delete_timeout - the number of seconds that the thread will block when querying the VM’s status when deleting (default=300)
- ssh_connect_timeout - the number of seconds that the thread will block when attempting to obtain an SSH connection (default=180)
- availability_zone - the name of the compute server on which to deploy the VM (optional must be admin)
- userdata - the cloud-init script to execute after VM has been started
- image_settings - see snaps.openstack.create_image.ImageSettings above (required)
- keypair_settings - see snaps.openstack.create_keypairs.KeypairSettings above (optional)
- snaps.openstack.create_instance.VmInstanceSettings
from snaps.openstack.create_instance import VmInstanceSettings, FloatingIpSettings, OpenStackVmInstance
from snaps.openstack.create_network import PortSettings
port_settings = PortSettings(name='port-name', network_name=network_settings.name)
floating_ip_settings = FloatingIpSettings(name='fip1', port_name=port_settings.name, router_name=router_settings.name)
instance_settings = VmInstanceSettings(name='vm-name', flavor='flavor_settings.name', port_settings=[port_settings],
floating_ip_settings=[floating_ip_settings])
instance_creator = OpenStackVmInstance(os_creds, instance_settings, image_settings, kepair_settings)
instance_creator.create()
# Perform logic
...
ssh_client = instance_creator.ssh_client()
...
# Cleanup
instance_creator.clean()
Ansible Provisioning¶
Being able to easily create OpenStack instances such as virtual networks and VMs is a good start to the problem of NFV; however, an NFVI is useless unless there is some software performing some function. This is why we added Ansible playbook support to SNAPS-OO which can be located in snaps.provisioning.ansible_utils#apply_playbook. See below for a description of that function’s parameters:
- playbook_path - the file location of the ansible playbook
- hosts_inv - a list of hosts/IP addresses to which the playbook will be applied
- host_user - the user (preferably sudo) to use for applying the playbook
- ssh_priv_key_file_path - the location to the private key file used for SSH
- variables - a dict() of substitution values for Jinga2 templates leveraged by Ansible
- proxy_setting - used to extract the SSH proxy command (optional)
Apply Ansible Playbook Utility¶
from snaps.provisioning import ansible_utils
ansible_utils.apply_playbook(playbook_path='provisioning/tests/playbooks/simple_playbook.yml',
hosts_inv=[ip], host_user=user, ssh_priv_key_file_path=priv_key,
proxy_setting=self.os_creds.proxy_settings)
OpenStack Utilities¶
For those who do like working procedurally, SNAPS-OO also leverages utilitarian functions for nearly every query or request made to OpenStack. This pattern will make it easier to deal with API version changes as they would all be made in one place. (see keystone_utils for an example of this pattern as this is the only API where SNAPS is supporting more than one version)
- snaps.openstack.utils.keystone_utils - for calls to the Keystone APIs
- snaps.openstack.utils.glance_utils - for calls to the Glance APIs
- snaps.openstack.utils.neutron_utils - for calls to the Neutron APIs
- snaps.openstack.utils.nova_utils - for calls to the Nova APIs
SNAPS OpenStack API Testing¶
Tests designated as component tests extend the snaps.openstack.tests.OSComponentTestCase class and must be exercised with OpenStack credentials for all as well as an external network for many. When leveraging the unit_test_suite.py application, the -e argument and -n arguments will suffice. When attempting to execute these tests within your IDE of choice (tested on IntelliJ), you will need to edit the [repo_dir]/snaps/openstack/tests/conf/os_env.yaml file as well as ensuring that your run configuration’s working directory is set to [repo_dir]/snaps.
The Test Classes¶
glance_utils_tests.py - GlanceSmokeTests¶
Ensures that a Glance client can be obtained as well as the proper exceptions thrown with the wrong credentials.
keystone_utils_tests.py - KeystoneSmokeTests¶
Ensures that a Keystone client can be obtained as well as the proper exceptions thrown with the wrong credentials.
neutron_utils_tests.py - NeutronSmokeTests¶
Ensures that a Neutron client can be obtained as well as the proper exceptions thrown with the wrong credentials.
nova_utils_tests.py - NovaSmokeTests¶
Ensures that a Nova client can be obtained as well as the proper exceptions thrown with the wrong credentials.
heat_utils_tests.py - HeatSmokeTests¶
Ensures that a Heat client can be obtained as well as the proper exceptions thrown with the wrong credentials.
keystone_utils_tests.py - KeystoneUtilsTests¶
Test Name | Keystone API | Description |
---|---|---|
test_create_user_minimal | 2 & 3 | Tests the creation of a user with minimal configuration settings via the utility functions |
test_create_project_minimal | 2 & 3 | Tests the creation of a project with minimal configuration settings via the utility functions |
test_get_endpoint_success | 2 & 3 | Tests to ensure that proper credentials and proper service type can succeed |
test_get_endpoint_fail_without _proper_service | 2 & 3 | Tests to ensure that proper credentials and improper service type cannot succeed |
test_get_endpoint_fail_without _proper_credentials | 2 & 3 | Tests to ensure that improper credentials and proper service type cannot succeed |
test_get_endpoint_with_each _interface | 2 & 3 | Tests to ensure that an interface URL is returned for each supported interface type (i.e. public, internal, & admin) |
test_grant_user_role_to_project | 2 & 3 | Tests to ensure that one can grant a new user’s role to a new project |
create_user_tests.py - CreateUserSuccessTests¶
Test Name | Keystone API | Description |
---|---|---|
test_create_user | 2 & 3 | Tests the creation of a user with minimal configuration settings via the utility functions |
test_create_user_2x | 2 & 3 | Tests the creation of a user 2x and ensure it has been done only once |
test_create_delete_user | 2 & 3 | Tests the creation of a user and ensure clean can be called 2x without exceptions being raised |
test_create_admin_user | 2 & 3 | Tests the creation of a user with an ‘admin’ role |
create_project_tests.py - CreateProjectSuccessTests¶
Test Name | Keystone API | Description |
---|---|---|
test_create_project_bad_domain | 3 | Ensures that keystone v3 clients using the domain ID project setting project creation will fail with an invalid domain id/name |
test_create_project | 2 & 3 | Tests the creation of a project via the OpenStackProject class |
test_create_project_2x | 2 & 3 | Tests the creation of a project a second time via the OpenStackProject class to ensure it is only created once |
test_create_delete_project | 2 & 3 | Tests the creation and deletion of a project via the OpenStackProject class to ensure that clean will not raise an exception |
test_update_quotas | 2 & 3 nova & neutron | Tests the ability to update quota values |
create_project_tests.py - CreateProjectUserTests¶
Test Name | Keystone API | Description |
---|---|---|
test_create_project_sec_grp_one_user | 2 & 3 | Tests the creation of an OpenStack object to a project with a new users and to create a security group |
test_create_project_sec_grp_two_users | 2 & 3 | Tests the creation of an OpenStack object to a project with two new users and to create a security group under each |
glance_utils_tests.py - GlanceUtilsTests¶
Test Name | Glance API | Description |
---|---|---|
test_create_image_minimal_url | 1 | Tests the glance_utils.create_image() function with a URL |
test_create_image_minimal_file | 1 | Tests the glance_utils.create_image() function with a file |
neutron_utils_tests.py - NeutronUtilsNetworkTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_network | 2 | Ensures neutron_utils.create_network() properly creates a network |
test_create_network_empty_name | 2 | Ensures neutron_utils.create_network() raises an exception when the network name is an empty string |
test_create_network_null_name | 2 | Ensures neutron_utils.create_network() raises an exception when the network name is None |
neutron_utils_tests.py - NeutronUtilsSubnetTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_subnet | 2 | Ensures neutron_utils.create_subnet() can properly create an OpenStack subnet object |
test_create_subnet_null_name | 2 | Ensures neutron_utils.create_subnet() raises an exception when the subnet name is None |
test_create_subnet_empty_name | 2 | Ensures neutron_utils.create_subnet() raises an exception when the subnet name is an empty string |
test_create_subnet_null_cidr | 2 | Ensures neutron_utils.create_subnet() raises an exception when the subnet CIDR is None |
test_create_subnet_empty_cidr | 2 | Ensures neutron_utils.create_subnet() raises an exception when the subnet CIDR is an empty string |
neutron_utils_tests.py - NeutronUtilsRouterTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_router_simple | 2 | Ensures neutron_utils.create_router() can properly create a simple OpenStack router object |
test_create_router_with_public_inter face | 2 | Ensures neutron_utils.create_router() can properly create an OpenStack router object with an interface to the external network |
test_create_router_empty_name | 2 | Ensures neutron_utils.create_router() raises an exception when the name is an empty string |
test_create_router_null_name | 2 | Ensures neutron_utils.create_router() raises an exception when the name is None |
test_add_interface_router | 2 | Ensures neutron_utils.add_interface_router() properly adds an interface to another subnet |
test_add_interface_router_null_router | 2 | Ensures neutron_utils.add_interface_router() raises an exception when the router object is None |
test_add_interface_router_null_subnet | 2 | Ensures neutron_utils.add_interface_router() raises an exception when the subnet object is None |
test_create_port | 2 | Ensures neutron_utils.create_port() can properly create an OpenStack port object |
test_create_port_empty_name | 2 | Ensures neutron_utils.create_port() raises an exception when the port name is an empty string |
test_create_port_null_name | 2 | Ensures neutron_utils.create_port() raises an exception when the port name is None |
test_create_port_null_network_object | 2 | Ensures neutron_utils.create_port() raises an exception when the network object is None |
test_create_port_null_ip | 2 | Ensures neutron_utils.create_port() raises an exception when the assigned IP value is None |
test_create_port_invalid_ip | 2 | Ensures neutron_utils.create_port() raises an exception when the assigned IP value is invalid |
test_create_port_invalid_ip_to_subnet | 2 | Ensures neutron_utils.create_port() raises an exception when the assigned IP value is not part of CIDR |
neutron_utils_tests.py - NeutronUtilsSecurityGroupTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_delete_simple_sec_grp | 2 | Ensures that a security group can be created (neutron_utils.create_security_group() and deleted via neutron_utils.delete_security_group() |
test_create_sec_grp_no_name | 2 | Ensures that neutron_utils.create_security_group() raises an exception when attempting to create a security group without a name |
test_create_sec_grp_no_rules | 2 | Ensures that neutron_utils.create_security_group() can create a security group without any rules |
test_create_sec_grp_one_rule | 2 | Ensures that neutron_utils.create_security_group_rule() can add a rule to a security group |
test_get_sec_grp_by_id | 2 | Ensures that neutron_utils.get_security_group_by_id() returns the expected security group |
neutron_utils_tests.py - NeutronUtilsFloatingIpTests¶
Test Name | Neutron API | Description |
---|---|---|
test_floating_ips | 2 | Ensures that a floating IP can be created |
nova_utils_tests.py - NovaUtilsKeypairTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_keypair | 2 | Ensures that a keypair can be properly created via nova_utils.upload_keypair() with a public_key object |
test_create_delete_keypair | 2 | Ensures that a keypair can be properly deleted via nova_utils.delete_keypair() |
test_create_key_from_file | 2 | Ensures that a keypair can be properly created via nova_utils.upload_keypair_file() |
nova_utils_tests.py - NovaUtilsFlavorTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_flavor | 2 | Ensures that a flavor can be properly created via nova_utils.create_flavor() |
test_create_delete_flavor | 2 | Ensures that a flavor can be properly deleted via nova_utils.delete_flavor() |
nova_utils_tests.py - NovaUtilsInstanceTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_instance | 2 | Ensures that a VM instance can be properly created via nova_utils.create_server() |
create_flavor_tests.py - CreateFlavorTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_flavor | 2 | Ensures that the OpenStackFlavor class’s create() method creates an OpenStack flavor object |
test_create_flavor_existing | 2 | Ensures that the OpenStackFlavor class’s create() will not create a flavor with the same name more than once |
test_create_clean_flavor | 2 | Ensures that the OpenStackFlavor class’s clean() method will delete the flavor object |
test_create_delete_flavor | 2 | Ensures that the OpenStackFlavor class’s clean() method will not raise an exception when called and the object no longer exists |
test_create_delete_flavor_all_settings | 2 | Ensures that the OpenStackFlavor class will create a a flavor properly with all supported settings |
heat_utils_tests.py - HeatUtilsCreateSimpleStackTests¶
Test Name | Heat API | Description |
---|---|---|
test_create_stack | 1 | Tests the heat_utils.create_stack() with a test template |
test_create_stack_x2 | 1 | Tests the heat_utils.create_stack() with a test template and attempts to deploy a second time w/o actually deploying any objects |
heat_utils_tests.py - HeatUtilsCreateComplexStackTests¶
Test Name | Heat API | Description |
---|---|---|
test_get_settings_from_stack | 1 | Tests the heat_utils functions that are responsible for reverse engineering settings objects of the types deployed by Heat |
settings_utils_tests.py - SettingsUtilsNetworkingTests¶
Test Name | API | Description |
---|---|---|
test_derive_net_settings_no_subnet | Neutron 2 | Tests to ensure that derived NetworkSettings from an OpenStack network are correct without a subnet |
test_derive_net_settings_two_subnets | Neutron 2 | Tests to ensure that derived NetworkSettings from an OpenStack network are correct with two subnets |
settings_utils_tests.py - SettingsUtilsVmInstTests¶
Test Name | API | Description |
---|---|---|
test_derive_vm_inst_settings | Neutron 2 | Tests to ensure that derived VmInstanceSettings from an OpenStack VM instance is correct |
test_derive_image_settings | Neutron 2 | Tests to ensure that derived ImageSettings from an OpenStack VM instance is correct |
SNAPS Unit Testing¶
The Test Classes¶
FileUtilsTests¶
- testFileIsDirectory - ensures that the expected path is a directory
- testFileNotExist - ensures that a file that does not exist returns False
- testFileExists - ensures that a file that does exist returns True
- testDownloadBadUrl - ensures that an Exception is thrown when attempting to download a file with a bad URL
- testCirrosImageDownload - ensures that the Cirros image can be downloaded
- testReadOSEnvFile - ensures that an OpenStack RC file can be properly parsed
ProxySettingsUnitTests¶
Ensures that all required members are included when constructing a ProxySettings object
OSCredsUnitTests¶
Ensures that all required members are included when constructing a OSCreds object
SecurityGroupRuleSettingsUnitTests¶
Ensures that all required members are included when constructing a SecurityGroupRuleSettings object
SecurityGroupRuleDomainObjectTests¶
Ensures that all required members are included when constructing a SecurityGroupRule domain object
SecurityGroupSettingsUnitTests¶
Ensures that all required members are included when constructing a SecuirtyGroupSettings object
SecurityGroupDomainObjectTests¶
Ensures that all required members are included when constructing a SecurityGroup domain object
ImageSettingsUnitTests¶
Ensures that all required members are included when constructing a ImageSettings object
ImageDomainObjectTests¶
Ensures that all required members are included when constructing a Image domain object
FlavorSettingsUnitTests¶
Ensures that all required members are included when constructing a FlavorSettings object
FlavorDomainObjectTests¶
Ensures that all required members are included when constructing a Flavor domain object
KeypairSettingsUnitTests¶
Ensures that all required members are included when constructing a KeypairSettings object
KeypairDomainObjectTests¶
Ensures that all required members are included when constructing a Keypair domain object
UserSettingsUnitTests¶
Ensures that all required members are included when constructing a UserSettings object
UserDomainObjectTests¶
Ensures that all required members are included when constructing a User domain object
ProjectSettingsUnitTests¶
Ensures that all required members are included when constructing a ProjectSettings object
ProjectDomainObjectTests¶
Ensures that all required members are included when constructing a Project domain object
DomainDomainObjectTests¶
Ensures that all required members are included when constructing a Domain domain object
ComputeQuotasDomainObjectTests¶
Ensures that all required members are included when constructing a ComputeQuotas domain object
NetworkQuotasDomainObjectTests¶
Ensures that all required members are included when constructing a NetworkQuotas domain object
RoleDomainObjectTests¶
Ensures that all required members are included when constructing a Role domain object
NetworkSettingsUnitTests¶
Ensures that all required members are included when constructing a NetworkSettings object
NetworkObjectTests¶
Ensures that all required members are included when constructing a Network domain object
SubnetSettingsUnitTests¶
Ensures that all required members are included when constructing a SubnetSettings object
SubnetObjectTests¶
Ensures that all required members are included when constructing a Subnet domain object
PortSettingsUnitTests¶
Ensures that all required members are included when constructing a PortSettings object
PortDomainObjectTests¶
Ensures that all required members are included when constructing a Port domain object
RouterSettingsUnitTests¶
Ensures that all required members are included when constructing a RouterSettings object
RouterDomainObjectTests¶
Ensures that all required members are included when constructing a Router domain object
InterfaceRouterDomainObjectTests¶
Ensures that all required members are included when constructing a InterfaceRouter domain object
StackSettingsUnitTests¶
Ensures that all required members are included when constructing a StackSettings object
StackDomainObjectTests¶
Ensures that all required members are included when constructing a Stack domain object (for Heat)
ResourceDomainObjectTests¶
Ensures that all required members are included when constructing a Resource domain object (for Heat)
OutputDomainObjectTests¶
Ensures that all required members are included when constructing a Output domain object (for Heat)
FloatingIpSettingsUnitTests¶
Ensures that all required members are included when constructing a FloatingIpSettings object
FloatingIpDomainObjectTests¶
Ensures that all required members are included when constructing a FloatingIp domain object
VmInstanceSettingsUnitTests¶
Ensures that all required members are included when constructing a VmInstanceSettings object
VmInstDomainObjectTests¶
Ensures that all required members are included when constructing a VmInst domain object
SNAPS OpenStack Integration Testing¶
These tests are ones designed to be run within their own dynamically created project along with a newly generated user account and generally require other OpenStack object creators.
The Test Classes¶
create_security_group_tests.py - CreateSecurityGroupTests¶
Test Name | API Versions | Description |
---|---|---|
test_create_group_without_rules | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can create a security group without any rules |
test_create_group_admin_user_to_new _project | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can be created by the admin user and associated with a new project |
test_create_group_new_user_to_admin _project | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can be created by the new user and associated with the admin project |
test_create_delete_group | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class clean() method will not raise an exception should the group be deleted by some other process |
test_create_group_with_one_simple_rule | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can create a security group with a single simple rule |
test_create_group_with_one_complex _rule | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can create a security group with a single complex rule |
test_create_group_with_several_rules | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup class can create a security group with several rules |
test_add_rule | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup#add_rule() method properly creates and associates the new rule |
test_remove_rule_by_id | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup#remove_rule() method properly deletes and disassociates the old rule via its ID |
test_remove_rule_by_setting | Keysone 2 & 3 Neutron 2 | Ensures the OpenStackSecurityGroup#remove_rule() method properly deletes and disassociates the old rule via its setting object |
create_image_tests.py - CreateImageSuccessTests¶
Test Name | Glance API | Description |
---|---|---|
test_create_image_clean_url | 1 & 2 | Ensures the OpenStackImage class can create an image from a download URL location |
test_create_image_clean_url_properties | 1 & 2 | Ensures the OpenStackImage class can create an image from a download URL location with custom properties |
test_create_image_clean_file | 1 & 2 | Ensures the OpenStackImage class can create an image from a locally sourced image file |
test_create_delete_image | 1 & 2 | Ensures the OpenStackImage.clean() method deletes an image and does not raise an exception on subsequent calls to the clean() method |
test_create_same_image | 1 & 2 | Ensures the OpenStackImage.create() method does not create another image when one already exists with the same name |
test_create_same_image_new_settings | 1 & 2 | Tests the creation of an OpenStack image when the image already exists and the configuration only contains the the name. |
create_image_tests.py - CreateImageNegativeTests¶
Test Name | Glance API | Description |
---|---|---|
test_bad_image_name | 1 & 2 | Ensures OpenStackImage.create() results in an Exception being raised when the ImageSettings.name attribute has not been set |
test_bad_image_url | 1 & 2 | Ensures OpenStackImage.create() results in an Exception being raised when the download URL is invalid |
test_bad_image_type | 1 & 2 | Ensures OpenStackImage.create() results in an Exception being raised when the image format is ‘foo’ |
test_bad_image_file | 1 & 2 | Ensures OpenStackImage.create() results in an Exception being raised when the image file does not exist |
create_image_tests.py - CreateMultiPartImageTests¶
Test Name | Glance API | Description |
---|---|---|
test_create_three_part_image_from_url | 1 & 2 | Ensures that a 3-part image can be created when each part is being sourced from URLs |
test_create_three_part_image_from_file _3_creators | 1 & 2 | Ensures that a 3-part image can be created when each part is being sourced from local files and 3 creators are used |
test_create_three_part_image_from_url _3_creators | 1 & 2 | Ensures that a 3-part image can be created when each part is being sourced from a URL and 3 creators are used |
create_keypairs_tests.py - CreateKeypairsTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_keypair_only | 2 | Ensures that a keypair object can be created simply by only configuring a name |
test_create_keypair_large_key | 2 | Ensures that a keypair object can be created with a large key of 10000 bytes |
test_create_delete_keypair | 2 | Ensures that a keypair object is deleted via OpenStackKeypair.clean() and subsequent calls do not result in exceptions |
test_create_keypair_save_pub_only | 2 | Ensures that a keypair object can be created when the only the public key is cached to disk |
test_create_keypair_save_both | 2 | Ensures that a keypair object can be created when both the public and private keys are cached to disk |
test_create_keypair_from_file | 2 | Ensures that a keypair object can be created with an existing public key file |
create_keypairs_tests.py - CreateKeypairsCleanupTests¶
Test Name | Nova API | Description |
---|---|---|
test_create_keypair_gen_files_delete_1 | 2 | Ensures that new keypair files are deleted by default by OpenStackKeypair#clean() |
test_create_keypair_gen_files_delete_2 | 2 | Ensures that new keypair files are deleted by OpenStackKeypair#clean() when the settings delete_on_clean attribute is set to True |
test_create_keypair_gen_files_keep | 2 | Ensures that new keypair files are not deleted by OpenStackKeypair#clean() |
test_create_keypair_exist_files_keep | 2 | Ensures that existing keypair files are not deleted by OpenStackKeypair#clean() |
test_create_keypair_exist_files_delete | 2 | Ensures that existing keypair files are deleted by OpenStackKeypair#clean() |
create_network_tests.py - CreateNetworkSuccessTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_network_without_router | 2 | Ensures that a network can be created via the OpenStackNetwork class without any routers |
test_create_delete_network | 2 | Ensures that a router can be deleted via the OpenStackNetwork.clean() method |
test_create_network_with_router | 2 | Ensures that a network can be created via the OpenStackNetwork class with a router |
test_create_networks_same_name | 2 | Ensures that the OpenStackNetwork.create() method will not create a network with the same name |
test_create_networks_router_admin_user _to_new_project | 2 | Ensures that the networks, subnets, and routers can be create created by an admin user and assigned to a new project ID |
test_create_networks_router_new_user _to_admin_project | 2 | Ensures that the networks, subnets, and routers can be create created by a new admin user and assigned to the ‘admin’ project ID |
create_router_tests.py - CreateRouterSuccessTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_router_vanilla | 2 | Ensures that a router can be created via the OpenStackRouter class with minimal settings |
test_create_router_admin_user_to_new _project | 2 | Ensures that a router can be created by an admin user and assigned to a new project |
test_create_router_new_user_to_admin _project | 2 | Ensures that a router can be created by a new user and assigned to the admin project |
test_create_delete_router | 2 | Ensures that a router can be deleted via the OpenStackRouter.clean() method |
test_create_router_admin_state_false | 2 | Ensures that a router can created with admin_state_up = False |
test_create_router_admin_state_True | 2 | Ensures that a router can created with admin_state_up = True |
test_create_router_private_network | 2 | Ensures that a router port can be created against a private network |
test_create_router_external_network | 2 | Ensures that a router can be created that is connected to both external and private internal networks |
create_router_tests.py - CreateRouterNegativeTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_router_noname | 2 | Ensures that an exception is raised when attempting to create a router without a name |
test_create_router_invalid_gateway_name | 2 | Ensures that an exception is raised when attempting to create a router to an external network that does not exist |
create_stack_tests.py - CreateStackSuccessTests¶
Test Name | Neutron API | Description |
---|---|---|
test_create_stack_template_file | 2 | Ensures that a Heat stack can be created with a file-based Heat template file |
test_create_stack_template_dict | 2 | Ensures that a Heat stack can be created with a dictionary Heat template |
test_create_delete_stack | 2 | Ensures that a Heat stack can be created and deleted while having clean() called 2x without an exception |
test_create_same_stack | 2 | Ensures that a Heat stack with the same name cannot be created 2x |
test_retrieve_network_creators | 2 | Ensures that an OpenStackHeatStack instance can return an OpenStackNetwork instance configured as deployed |
test_retrieve_vm_inst_creators | 2 | Ensures that an OpenStackHeatStack instance can return an OpenStackVmInstance instance configured as deployed |
create_stack_tests.py - CreateComplexStackTests¶
Test Name | Neutron API | Description |
---|---|---|
test_connect_via_ssh_heat_vm | 2 | Ensures that two OpenStackHeatStack instances can return OpenStackVmInstance instances one configured with a floating IP and keypair and can be access via SSH |
create_stack_tests.py - CreateStackNegativeTests¶
Test Name | Neutron API | Description |
---|---|---|
test_missing_dependencies | 2 | Ensures that a Heat template fails to deploy when expected dependencies are missing |
test_bad_stack_file | 2 | Ensures that a Heat template fails to deploy when the Heat template file does not exist |
create_instance_tests.py - CreateInstanceSimpleTests¶
Test Name | API Versions | Description |
---|---|---|
test_create_delete_instance | Nova 2 Neutron 2 | Ensures that the OpenStackVmInstance.clean() method deletes the instance |
create_instance_tests.py - SimpleHealthCheck¶
Test Name | API Versions | Description |
---|---|---|
test_check_vm_ip_dhcp | Nova 2 Neutron 2 | Tests the creation of an OpenStack instance with a single port and it’s assigned IP address |
create_instance_tests.py - CreateInstanceTwoNetTests¶
Test Name | API Versions | Description |
---|---|---|
test_ping_via_router | Nova 2 Neutron 2 | Tests the ability of two VMs on different private overlay networks tied together with a router to ping each other |
create_instance_tests.py - CreateInstanceSingleNetworkTests¶
Test Name | API Versions | Description |
---|---|---|
test_single_port_static | Nova 2 Neutron 2 | Ensures that an instance with a single port/NIC with a static IP can be created |
test_ssh_client_fip_before_active | Nova 2 Neutron 2 | Ensures that an instance can be reached over SSH when the floating IP is assigned prior to the VM becoming ACTIVE |
test_ssh_client_fip_after_active | Nova 2 Neutron 2 | Ensures that an instance can be reached over SSH when the floating IP is assigned after to the VM becoming ACTIVE |
test_ssh_client_fip_second_creator | Nova 2 Neutron 2 | Ensures that an instance can be reached over SSH via a second identical creator object |
create_instance_tests.py - CreateInstancePortManipulationTests¶
Test Name | API Versions | Description |
---|---|---|
test_set_custom_valid_ip_one_subnet | Nova 2 Neutron 2 | Ensures that an instance’s can have a valid static IP is properly assigned |
test_set_custom_invalid_ip_one_subnet | Nova 2 Neutron 2 | Ensures that an instance’s port with an invalid static IP raises an exception |
test_set_custom_valid_mac | Nova 2 Neutron 2 | Ensures that an instance’s port can have a valid MAC address properly assigned |
test_set_custom_invalid_mac | Nova 2 Neutron 2 | Ensures that an instance’s port with an invalid MAC address raises and exception |
test_set_custom_mac_and_ip | Nova 2 Neutron 2 | Ensures that an instance’s port with a valid static IP and MAC are properly assigned |
test_set_allowed_address_pairs | Nova 2 Neutron 2 | Ensures the configured allowed_address_pairs is properly set on a VMs port |
test_set_allowed_address_pairs_bad_mac | Nova 2 Neutron 2 | Ensures the port cannot be created when a bad MAC address format is used in the allowed_address_pairs port attribute |
test_set_allowed_address_pairs_bad_ip | Nova 2 Neutron 2 | Ensures the port cannot be created when a bad IP address format is used in the allowed_address_pairs port attribute |
create_instance_tests.py - CreateInstanceOnComputeHost¶
Test Name | API Versions | Description |
---|---|---|
test_deploy_vm_to_each_compute_node | Nova 2 Neutron 2 | Tests to ensure that one can fire up an instance on each active compute node |
create_instance_tests.py - CreateInstanceFromThreePartImage¶
Test Name | API Versions | Description |
---|---|---|
test_create_delete_instance_from_three_part_image | Nova 2 Neutron 2 | Tests to ensure that one can fire up an instance then delete it when using a 3-part image |
create_instance_tests.py - CreateInstancePubPrivNetTests¶
Test Name | API Versions | Description |
---|---|---|
test_dual_ports_dhcp | Nova 2 Neutron 2 | Ensures that a VM with two ports/NICs can have its second NIC configured via SSH/Ansible after startup |
create_instance_tests.py - InstanceSecurityGroupTests¶
Test Name | API Versions | Description |
---|---|---|
test_add_security_group | Nova 2 Neutron 2 | Ensures that a VM instance can have security group added to it while its running |
test_add_invalid_security_group | Nova 2 Neutron 2 | Ensures that a VM instance does not accept the addition of a security group that no longer exists |
test_remove_security_group | Nova 2 Neutron 2 | Ensures that a VM instance accepts the removal of a security group |
test_remove_security_group_never_added | Nova 2 Neutron 2 | Ensures that a VM instance does not accept the removal of a security group that was never added in the first place |
test_add_same_security_group | Nova 2 Neutron 2 | Ensures that a VM instance does not add a security group that has already been added to the instance |
ansible_utils_tests.py - AnsibleProvisioningTests¶
Test Name | API Versions | Description |
---|---|---|
test_apply_simple_playbook | Nova 2 Neutron 2 | Ensures that an instance assigned with a floating IP will apply a simple Ansible playbook |
test_apply_template_playbook | Nova 2 Neutron 2 | Ensures that an instance assigned with a floating IP will apply a Ansible playbook containing Jinga2 substitution values |