Skip to content

Commit

Permalink
Merge pull request #172 from zancas/test_icontrol_driver_rebased
Browse files Browse the repository at this point in the history
begin migrating tests from driver
  • Loading branch information
jlongstaf authored Jun 29, 2016
2 parents 1f41bc7 + be30fff commit a849d71
Show file tree
Hide file tree
Showing 29 changed files with 886 additions and 33 deletions.
45 changes: 45 additions & 0 deletions devtools/Dockerfiles/functional_isolation_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From ubuntu:16.04

RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get remove -qq --purge nano
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y vim
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tmux
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mtr
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ipython
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y iputils-ping
RUN pip install --upgrade pip
RUN pip install cryptography
RUN pip install hacking
RUN pip install mock
RUN pip install pytest
RUN pip install pytest-cov
RUN pip install paramiko
RUN pip install decorator
RUN pip install -e git+https://github.com/openstack/neutron#egg=neutron
RUN pip install -e git+https://github.com/openstack/neutron-lbaas.git#\
egg=neutron_lbaas
COPY /root_ssh/ /root/.ssh
COPY ./f5-common-python/ /root/devenv/f5-common-python/
RUN pip install /root/devenv/f5-common-python/
COPY ./f5-openstack-test/ /root/devenv/f5-openstack-test/
RUN pip install /root/devenv/f5-openstack-test
COPY ./f5-openstack-agent/ /root/devenv/f5-openstack-agent/
RUN pip install /root/devenv/f5-openstack-agent
COPY ./f5-openstack-lbaasv2-driver/ /root/devenv/f5-openstack-lbaasv2-driver/
RUN pip install /root/devenv/f5-openstack-lbaasv2-driver
COPY ./pytest-symbols/ /root/devenv/pytest-symbols/
RUN pip install /root/devenv/pytest-symbols
COPY ./oslo.log/ /root/devenv/oslo.log/
RUN pip install --upgrade /root/devenv/oslo.log
#WORKDIR /root/devenv/f5-openstack-agent
#RUN pip install -r test-requirements.txt
#RUN py.test --symbols /root/devenv/f5-openstack-agent/devtools/common_service_handler_env.json -s -v /root/devenv/f5-openstack-agent/f5_openstack_agent/lbaasv2/drivers/bigip/test/test__common_service_handler.py
RUN py.test --symbols /root/devenv/f5-openstack-agent/devtools/common_service_handler_env.json -s -v /root/devenv/f5-openstack-agent/test/functional/test_CLUDS.py::test_loadbalancer_CLUDS
11 changes: 11 additions & 0 deletions devtools/Dockerfiles/neutronless_service_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
From test_base:latest

RUN pip install pycallgraph
COPY ./f5-openstack-test/ /root/devenv/f5-openstack-test/
RUN pip install --upgrade /root/devenv/f5-openstack-test
COPY ./f5-openstack-agent/ /root/devenv/f5-openstack-agent/
RUN pip install --upgrade /root/devenv/f5-openstack-agent
COPY ./f5-common-python/ /root/devenv/f5-common-python/
RUN pip install --upgrade /root/devenv/f5-common-python/
VOLUME /root/devenv /root/devenv
RUN py.test --symbols /root/devenv/f5-openstack-agent/devtools/common_service_handler_env.json -v /root/devenv/f5-openstack-agent/test/functional/test_neutron_service_applications.py::test_loadbalancer_CD
37 changes: 37 additions & 0 deletions devtools/Dockerfiles/test_base
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From ubuntu:16.04

RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get remove -qq --purge nano
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y vim
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tmux
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mtr
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ipython
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y iputils-ping
RUN pip install --upgrade pip
RUN pip install cryptography
RUN pip install hacking
RUN pip install mock
RUN pip install pytest
RUN pip install pytest-cov
RUN pip install paramiko
RUN pip install decorator
RUN pip install -e git+https://github.com/openstack/neutron#egg=neutron
RUN pip install -e git+https://github.com/openstack/neutron-lbaas.git#\
egg=neutron_lbaas
COPY ./oslo.log/ /root/devenv/oslo.log/
RUN pip install --upgrade /root/devenv/oslo.log
COPY ./pytest-symbols/ /root/devenv/pytest-symbols/
RUN pip install /root/devenv/pytest-symbols
COPY ./f5-openstack-lbaasv2-driver/ /root/devenv/f5-openstack-lbaasv2-driver/
RUN pip install /root/devenv/f5-openstack-lbaasv2-driver
COPY ./f5-openstack-test/ /root/devenv/f5-openstack-test/
RUN pip install /root/devenv/f5-openstack-test
COPY /root_ssh/ /root/.ssh
18 changes: 18 additions & 0 deletions devtools/common_service_handler_env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"bigip_ip": "10.190.3.68",
"bigip_username": "admin",
"bigip_password": "admin",
"icontrol_hostname": "10.190.3.68",
"icontrol_username": "admin",
"icontrol_password": "admin",
"f5_device_type": "external",
"f5_ha_type": "standalone",
"f5_global_routed_mode": true,
"f5_sync_mode": "replication",
"environment_prefix": "TEST",
"vlan_binding_driver": null,
"l3_binding_driver": null,
"cert_manager": null,
"debug": false,
"f5_parent_ssl_profile": null
}
1 change: 1 addition & 0 deletions devtools/sample_data/service_library/createlb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"subnets": {"6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3": {"name": "testlab-client-v4-subnet", "enable_dhcp": true, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "00000000000000000000000000000000", "dns_nameservers": [], "ipv6_ra_mode": null, "allocation_pools": [{"start": "10.2.2.100", "end": "10.2.2.150"}], "gateway_ip": null, "shared": false, "ip_version": 4, "host_routes": [], "cidr": "10.2.2.0/24", "ipv6_address_mode": null, "id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "subnetpool_id": null}}, "listeners": [], "healthmonitors": [], "members": [], "pools": [], "networks": {"3a1cfb7a-77a6-44af-9ec6-d01f872c3022": {"status": "ACTIVE", "subnets": ["6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "0c4ece58-e66b-4327-8232-ff8cbeebace2"], "name": "testlab-client-network", "provider:physical_network": null, "admin_state_up": true, "tenant_id": "00000000000000000000000000000000", "provider:network_type": "vxlan", "mt": 0, "router:external": false, "vlan_transparent": null, "shared": false, "id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "provider:segmentation_id": 80}}, "loadbalancer": {"vxlan_vteps": ["201.0.36.1", "201.0.28.1", "201.0.35.1"], "provisioning_status": "PENDING_CREATE", "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "00000000000000000000000000000000", "description": "", "admin_state_up": true, "vip_port": {"status": "DOWN", "binding:host_id": "", "name": "loadbalancer-6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "allowed_address_pairs": [], "admin_state_up": false, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "dns_name": null, "extra_dhcp_opts": [], "dns_assignment": [{"hostname": "host-10-2-2-129", "ip_address": "10.2.2.129", "fqdn": "host-10-2-2-129.openstacklocal."}], "binding:vnic_type": "normal", "binding:vif_type": "unbound", "device_owner": "neutron:LOADBALANCERV2", "tenant_id": "00000000000000000000000000000000", "mac_address": "fa:16:3e:5d:c2:e6", "id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "binding:profile": {}, "fixed_ips": [{"subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "ip_address": "10.2.2.129"}], "binding:vif_details": {}, "security_groups": ["a014a6b3-083f-4f63-af3f-3c6d930849ff"], "device_id": "6d7e2ad8-f986-41fe-ab99-e06d73c74d79"}, "gre_vteps": [], "listeners": [], "vip_address": "10.2.2.129", "vip_port_id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "provider": null, "vip_subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "id": "6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "operating_status": "OFFLINE", "name": "testlb_01"}}
1 change: 1 addition & 0 deletions devtools/sample_data/service_library/deletelb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"subnets": {"6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3": {"name": "testlab-client-v4-subnet", "enable_dhcp": true, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "00000000000000000000000000000000", "dns_nameservers": [], "ipv6_ra_mode": null, "allocation_pools": [{"start": "10.2.2.100", "end": "10.2.2.150"}], "gateway_ip": null, "shared": false, "ip_version": 4, "host_routes": [], "cidr": "10.2.2.0/24", "ipv6_address_mode": null, "id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "subnetpool_id": null}}, "listeners": [], "healthmonitors": [], "members": [], "pools": [], "networks": {"3a1cfb7a-77a6-44af-9ec6-d01f872c3022": {"status": "ACTIVE", "subnets": ["6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "0c4ece58-e66b-4327-8232-ff8cbeebace2"], "name": "testlab-client-network", "provider:physical_network": null, "admin_state_up": true, "tenant_id": "00000000000000000000000000000000", "provider:network_type": "vxlan", "mt": 0, "router:external": false, "vlan_transparent": null, "shared": false, "id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "provider:segmentation_id": 80}}, "loadbalancer": {"vxlan_vteps": ["201.0.36.1", "201.0.28.1", "201.0.35.1"], "provisioning_status": "PENDING_DELETE", "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "00000000000000000000000000000000", "description": "as;iofnypq3489", "admin_state_up": true, "vip_port": {"status": "ACTIVE", "binding:host_id": "host-27.int.lineratesystems.com:bb3c558c-379a-5e22-b1f0-42174a72be4d", "name": "loadbalancer-6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "allowed_address_pairs": [], "admin_state_up": true, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "dns_name": "", "extra_dhcp_opts": [], "dns_assignment": [{"hostname": "host-10-2-2-129", "ip_address": "10.2.2.129", "fqdn": "host-10-2-2-129.openstacklocal."}], "binding:vnic_type": "normal", "binding:vif_type": "binding_failed", "device_owner": "network:f5lbaasv2", "tenant_id": "00000000000000000000000000000000", "mac_address": "fa:16:3e:5d:c2:e6", "id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "binding:profile": {}, "fixed_ips": [{"subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "ip_address": "10.2.2.129"}], "binding:vif_details": {}, "security_groups": ["a014a6b3-083f-4f63-af3f-3c6d930849ff"], "device_id": "f197117d-6994-57ff-a10a-290e8628c86c"}, "gre_vteps": [], "listeners": [], "vip_address": "10.2.2.129", "vip_port_id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "provider": "f5networks", "vip_subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "id": "6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "operating_status": "ONLINE", "name": "testlb_01"}}
1 change: 1 addition & 0 deletions devtools/sample_data/service_library/updatelb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"subnets": {"6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3": {"name": "testlab-client-v4-subnet", "enable_dhcp": true, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "1c63f5c18bc9468a9aa542bc7da1fd6d", "dns_nameservers": [], "ipv6_ra_mode": null, "allocation_pools": [{"start": "10.2.2.100", "end": "10.2.2.150"}], "gateway_ip": null, "shared": false, "ip_version": 4, "host_routes": [], "cidr": "10.2.2.0/24", "ipv6_address_mode": null, "id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "subnetpool_id": null}}, "listeners": [], "healthmonitors": [], "members": [], "pools": [], "networks": {"3a1cfb7a-77a6-44af-9ec6-d01f872c3022": {"status": "ACTIVE", "subnets": ["6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "0c4ece58-e66b-4327-8232-ff8cbeebace2"], "name": "testlab-client-network", "provider:physical_network": null, "admin_state_up": true, "tenant_id": "1c63f5c18bc9468a9aa542bc7da1fd6d", "provider:network_type": "vxlan", "mt": 0, "router:external": false, "vlan_transparent": null, "shared": false, "id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "provider:segmentation_id": 80}}, "loadbalancer": {"vxlan_vteps": ["201.0.36.1", "201.0.28.1", "201.0.35.1"], "provisioning_status": "PENDING_UPDATE", "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "tenant_id": "1c63f5c18bc9468a9aa542bc7da1fd6d", "description": "as;iofnypq3489", "admin_state_up": true, "vip_port": {"status": "ACTIVE", "binding:host_id": "host-27.int.lineratesystems.com:bb3c558c-379a-5e22-b1f0-42174a72be4d", "name": "loadbalancer-6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "allowed_address_pairs": [], "admin_state_up": true, "network_id": "3a1cfb7a-77a6-44af-9ec6-d01f872c3022", "dns_name": "", "extra_dhcp_opts": [], "dns_assignment": [{"hostname": "host-10-2-2-129", "ip_address": "10.2.2.129", "fqdn": "host-10-2-2-129.openstacklocal."}], "binding:vnic_type": "normal", "binding:vif_type": "binding_failed", "device_owner": "network:f5lbaasv2", "tenant_id": "1c63f5c18bc9468a9aa542bc7da1fd6d", "mac_address": "fa:16:3e:5d:c2:e6", "id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "binding:profile": {}, "fixed_ips": [{"subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "ip_address": "10.2.2.129"}], "binding:vif_details": {}, "security_groups": ["a014a6b3-083f-4f63-af3f-3c6d930849ff"], "device_id": "f197117d-6994-57ff-a10a-290e8628c86c"}, "gre_vteps": [], "listeners": [], "vip_address": "10.2.2.129", "vip_port_id": "3ecba393-5302-4f85-893f-e67be55e3cdf", "provider": "f5networks", "vip_subnet_id": "6c0a31c8-9bf7-4b2c-b780-6c3a9448c7a3", "id": "6d7e2ad8-f986-41fe-ab99-e06d73c74d79", "operating_status": "ONLINE", "name": "testlb_01"}}
26 changes: 26 additions & 0 deletions devtools/test_env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"include_SNI_test": true,
"lbaas_version": 2,
"auth_url": "http://10.190.4.191:5000/v2.0",
"bigip_ip": "10.190.3.98",
"tenant_name": "testlab",
"tenant_username": "testlab",
"tenant_password": "changeme",
"admin_name": "admin",
"admin_username": "admin",
"admin_password": "changeme",
"bigip_username": "admin",
"bigip_password": "admin",
"guest_username": "centos",
"guest_password": "changeme",
"server_http_port": "8080",
"server_client_ip": "10.2.2.3",
"provider": "f5networks",
"partition_prefix": "Project",
"os_tentant_name": "service",
"os_tenant_id": "",
"os_username": "barbican",
"os_password": "orange",
"os_auth_version": "v3",
"nc_interval": 1
}
4 changes: 2 additions & 2 deletions f5_openstack_agent/lbaasv2/drivers/bigip/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def start(self):
self.manager.run_periodic_tasks,
None,
None
)
) # Hmmm.... "tg"?
super(F5AgentService, self).start()


Expand All @@ -63,7 +63,7 @@ def main():
config.register_root_helper(cfg.CONF)

common_config.init(sys.argv[1:])
config.setup_logging()
config.setup_logging() # alias for common_config.setup_logging()...

mgr = manager.LbaasAgentManager(cfg.CONF)

Expand Down
11 changes: 6 additions & 5 deletions f5_openstack_agent/lbaasv2/drivers/bigip/agent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@

LOG = logging.getLogger(__name__)

# XXX OPTS is used in (at least) agent.py Maybe move/rename to agent.py
OPTS = [
cfg.StrOpt(
'f5_bigip_lbaas_device_driver',
cfg.StrOpt( # XXX should we use this with internal classes?
'f5_bigip_lbaas_device_driver', # XXX maybe remove "device" and "f5"?
default=('f5_openstack_agent.lbaasv2.drivers.bigip.icontrol_driver.'
'iControlDriver'),
help=('The driver used to provision BigIPs')
Expand Down Expand Up @@ -113,7 +114,7 @@
class LogicalServiceCache(object):
"""Manage a cache of known services."""

class Service(object):
class Service(object): # XXX maybe promote/use this class elsewhere?
"""Inner classes used to hold values for weakref lookups."""

def __init__(self, port_id, loadbalancer_id, tenant_id, agent_host):
Expand Down Expand Up @@ -200,8 +201,8 @@ def get_agent_hosts(self):
return agent_hosts.keys()


class LbaasAgentManager(periodic_task.PeriodicTasks):
"""Periodic task that is an endpoing for plugin to agent RPC."""
class LbaasAgentManager(periodic_task.PeriodicTasks): # b --> B
"""Periodic task that is an endpoint for plugin to agent RPC."""

RPC_API_VERSION = '1.0'

Expand Down
Loading

0 comments on commit a849d71

Please sign in to comment.