diff -Nru horizon-2014.1.100+git201410022310~trusty/ChangeLog horizon-2014.1.100+git201410152002~trusty/ChangeLog --- horizon-2014.1.100+git201410022310~trusty/ChangeLog 2014-10-03 03:10:29.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/ChangeLog 2014-10-16 00:02:54.000000000 +0000 @@ -1,6 +1,7 @@ CHANGES ======= +* Run router dashboard unit tests by default * Bump stable/icehouse next version to 2014.1.4 2014.1.3 diff -Nru horizon-2014.1.100+git201410022310~trusty/debian/changelog horizon-2014.1.100+git201410152002~trusty/debian/changelog --- horizon-2014.1.100+git201410022310~trusty/debian/changelog 2014-10-03 03:11:38.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/debian/changelog 2014-10-16 00:04:11.000000000 +0000 @@ -1,31 +1,34 @@ -horizon (1:2014.1.100+git201410022310~trusty-0ubuntu1) trusty; urgency=medium +horizon (1:2014.1.100+git201410152002~trusty-0ubuntu1) trusty; urgency=medium * Automated Ubuntu testing build: - * [694224c] Bump stable/icehouse next version to 2014.1.4 - * [ad2d428] Rename add_error methods: Django 1.7 conflict - * [8dfe113] Replace Ceilometer ClientException with HTTPException - * [f5e1ff4] Add missing "load url from future" in a container template - * [839c53d] Add OS_REGION_NAME to openrc - * [737fe40] Set the correct min_disk size when creating volume from - image - * [a8eeed9] Allow forms to disable autofill in all browsers - * [e32a00d] Fix endpoint error when running keystone on apache - * [faac9e7] Not able to delete a pseudo-folder via horizon - * [b6d6e15] Set python hash seed to 0 in tox.ini - * [ba908ae] Fix XSS issue with the unordered_list filter - * [9a5894b] Long container names no longer break the page - * [01f2378] Bump stable/icehouse next version to 2014.1.3 - * [c9cb128] TEMPLATE_DIRS must be a tuple - * [95dcdae] Proper port for LBaaS members - * [dc8e46f] Use default_project_id as user project for keystone v3 + * [b14a2ec] Run router dashboard unit tests by default - -- Openstack Ubuntu Testing Bot Thu, 02 Oct 2014 23:10:41 -0400 + -- Openstack Ubuntu Testing Bot Wed, 15 Oct 2014 20:03:15 -0400 -horizon (1:2014.1.2-0ubuntu1.1) UNRELEASED; urgency=medium +horizon (1:2014.1.3-0ubuntu1) trusty; urgency=medium + [ Chris Johnston ] * Fix Ubuntu theme dropdown and confirmation button (LP: #1308651). - -- Chris Johnston Thu, 25 Sep 2014 11:14:48 -0400 + [ Corey Bryant ] + * Resynchronize with stable/icehouse (dc8e46f) (LP: #1377136): + - [ba524b0] template to rely on the the "id" attribute + - [ad2d428] Rename add_error methods: Django 1.7 conflict + - [8dfe113] Replace Ceilometer ClientException with HTTPException + - [f5e1ff4] Add missing "load url from future" in a container template + - [839c53d] Add OS_REGION_NAME to openrc + - [737fe40] Set the correct min_disk size when creating volume from image + - [a8eeed9] Allow forms to disable autofill in all browsers + - [e32a00d] Fix endpoint error when running keystone on apache + - [faac9e7] Not able to delete a pseudo-folder via horizon + - [b6d6e15] Set python hash seed to 0 in tox.ini + - [ba908ae] Fix XSS issue with the unordered_list filter + - [9a5894b] Long container names no longer break the page + - [c9cb128] TEMPLATE_DIRS must be a tuple + - [95dcdae] Proper port for LBaaS members + - [dc8e46f] Use default_project_id as user project for keystone v3 + + -- Chuck Short Mon, 06 Oct 2014 09:00:21 -0400 horizon (1:2014.1.2-0ubuntu1) trusty; urgency=medium diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/api/neutron.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/api/neutron.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/api/neutron.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/api/neutron.py 2014-10-16 00:01:49.000000000 +0000 @@ -863,12 +863,10 @@ # Using this mechanism till a better plugin/sub-plugin detection # mechanism is available. -# Using local_settings to detect if the "router" dashboard -# should be turned on or not. When using specific plugins the -# profile_support can be turned on if needed. +# When using specific plugins the profile_support can be +# turned on if needed to configure and/or use profiles. # Since this is a temporary mechanism used to detect profile_support -# @memorize is not being used. This is mainly used in the run_tests -# environment to detect when to use profile_support neutron APIs. +# @memorize is not being used. # TODO(absubram): Change this config variable check with # subplugin/plugin detection API when it becomes available. def is_port_profiles_supported(): diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/admin/networks/forms.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/admin/networks/forms.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/admin/networks/forms.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/admin/networks/forms.py 2014-10-16 00:01:49.000000000 +0000 @@ -35,7 +35,12 @@ required=False) tenant_id = forms.ChoiceField(label=_("Project")) if api.neutron.is_port_profiles_supported(): - net_profile_id = forms.ChoiceField(label=_("Network Profile")) + widget = None + else: + widget = forms.HiddenInput() + net_profile_id = forms.ChoiceField(label=_("Network Profile"), + required=False, + widget=widget) admin_state = forms.BooleanField(label=_("Admin State"), initial=True, required=False) shared = forms.BooleanField(label=_("Shared"), diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/admin/networks/tests.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/admin/networks/tests.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/admin/networks/tests.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/admin/networks/tests.py 2014-10-16 00:01:49.000000000 +0000 @@ -16,6 +16,7 @@ from django.core.urlresolvers import reverse from django import http +from django.test.utils import override_settings from horizon.workflows import views @@ -151,14 +152,12 @@ @test.create_stubs({api.neutron: ('profile_list',), api.keystone: ('tenant_list',)}) - def test_network_create_get(self): + def test_network_create_get(self, + test_with_profile=False): tenants = self.tenants.list() api.keystone.tenant_list(IsA( http.HttpRequest)).AndReturn([tenants, False]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'network').AndReturn(net_profiles) @@ -169,10 +168,15 @@ self.assertTemplateUsed(res, 'admin/networks/create.html') + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_get_with_profile(self): + self.test_network_create_get(test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'profile_list',), api.keystone: ('tenant_list',)}) - def test_network_create_post(self): + def test_network_create_post(self, + test_with_profile=False): tenants = self.tenants.list() tenant_id = self.tenants.first().id network = self.networks.first() @@ -183,10 +187,7 @@ 'admin_state_up': network.admin_state_up, 'router:external': True, 'shared': True} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -201,7 +202,7 @@ 'admin_state': network.admin_state_up, 'external': True, 'shared': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id url = reverse('horizon:admin:networks:create') res = self.client.post(url, form_data) @@ -209,10 +210,15 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_with_profile(self): + self.test_network_create_post(test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'profile_list',), api.keystone: ('tenant_list',)}) - def test_network_create_post_network_exception(self): + def test_network_create_post_network_exception(self, + test_with_profile=False): tenants = self.tenants.list() tenant_id = self.tenants.first().id network = self.networks.first() @@ -223,10 +229,7 @@ 'admin_state_up': network.admin_state_up, 'router:external': True, 'shared': False} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -241,7 +244,7 @@ 'admin_state': network.admin_state_up, 'external': True, 'shared': False} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id url = reverse('horizon:admin:networks:create') res = self.client.post(url, form_data) @@ -249,6 +252,11 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_network_exception_with_profile(self): + self.test_network_create_post_network_exception(test_with_profile= + True) + @test.create_stubs({api.neutron: ('network_get',)}) def test_network_update_get(self): network = self.networks.first() diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/instances/tests.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/instances/tests.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/instances/tests.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/instances/tests.py 2014-10-16 00:01:49.000000000 +0000 @@ -1107,7 +1107,8 @@ expect_password_fields=True, block_device_mapping_v2=True, custom_flavor_sort=None, - only_one_network=False): + only_one_network=False, + test_with_profile=False): image = self.images.first() api.nova.extension_supported('BlockDeviceMappingV2Boot', @@ -1136,10 +1137,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -1283,7 +1281,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_instance_post(self): + def test_launch_instance_post(self, + test_with_profile=False): flavor = self.flavors.first() image = self.images.first() keypair = self.keypairs.first() @@ -1320,10 +1319,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id port = self.ports.first() @@ -1332,8 +1328,9 @@ 'policy').AndReturn(policy_profiles) api.neutron.port_create( IsA(http.HttpRequest), - network_id=self.networks.first().id, + self.networks.first().id, policy_profile_id=policy_profile_id).AndReturn(port) + nics = [{"port-id": port.id}] cinder.volume_list(IsA(http.HttpRequest)) \ .AndReturn([]) cinder.volume_snapshot_list(IsA(http.HttpRequest)).AndReturn([]) @@ -1372,15 +1369,23 @@ 'network': self.networks.first().id, 'count': 1, 'disk_config': 'AUTO'} + if test_with_profile: + form_data['profile'] = self.policy_profiles.first().id url = reverse('horizon:project:instances:launch') res = self.client.post(url, form_data) self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_instance_post_with_profile(self): + self.test_launch_instance_post(test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', - 'profile_list',), + 'profile_list', + 'port_create',), api.nova: ('extension_supported', 'flavor_list', 'keypair_list', @@ -1390,7 +1395,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_instance_post_boot_from_volume(self): + def test_launch_instance_post_boot_from_volume(self, + test_with_profile=False): flavor = self.flavors.first() keypair = self.keypairs.first() server = self.servers.first() @@ -1430,10 +1436,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id port = self.ports.first() @@ -1442,7 +1445,7 @@ 'policy').AndReturn(policy_profiles) api.neutron.port_create( IsA(http.HttpRequest), - network_id=self.networks.first().id, + self.networks.first().id, policy_profile_id=policy_profile_id).AndReturn(port) nics = [{"port-id": port.id}] cinder.volume_list(IsA(http.HttpRequest)) \ @@ -1483,12 +1486,19 @@ 'network': self.networks.first().id, 'count': 1, 'disk_config': 'AUTO'} + if test_with_profile: + form_data['profile'] = self.policy_profiles.first().id url = reverse('horizon:project:instances:launch') res = self.client.post(url, form_data) self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_instance_post_boot_from_volume_with_profile(self): + self.test_launch_instance_post_boot_from_volume(test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list', @@ -1503,7 +1513,10 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_instance_post_no_images_available_boot_from_volume(self): + def test_launch_instance_post_no_images_available_boot_from_volume( + self, + test_with_profile=False + ): flavor = self.flavors.first() keypair = self.keypairs.first() server = self.servers.first() @@ -1544,10 +1557,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id port = self.ports.first() @@ -1556,7 +1566,7 @@ 'policy').AndReturn(policy_profiles) api.neutron.port_create( IsA(http.HttpRequest), - network_id=self.networks.first().id, + self.networks.first().id, policy_profile_id=policy_profile_id).AndReturn(port) nics = [{"port-id": port.id}] cinder.volume_list(IsA(http.HttpRequest)) \ @@ -1598,12 +1608,20 @@ 'device_name': device_name, 'count': 1, 'disk_config': 'MANUAL'} + if test_with_profile: + form_data['profile'] = self.policy_profiles.first().id url = reverse('horizon:project:instances:launch') res = self.client.post(url, form_data) self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_lnch_inst_post_no_images_avail_boot_from_vol_with_profile(self): + self.test_launch_instance_post_no_images_available_boot_from_volume( + test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list',), @@ -1616,7 +1634,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_instance_post_no_images_available(self): + def test_launch_instance_post_no_images_available(self, + test_with_profile=False): flavor = self.flavors.first() keypair = self.keypairs.first() server = self.servers.first() @@ -1647,10 +1666,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -1688,6 +1704,12 @@ self.assertFormErrors(res, 1, "You must select an image.") self.assertTemplateUsed(res, views.WorkflowView.template_name) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_instance_post_no_images_available_with_profile(self): + self.test_launch_instance_post_no_images_available( + test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list',), @@ -1699,7 +1721,8 @@ 'keypair_list', 'tenant_absolute_limits', 'availability_zone_list',)}) - def test_launch_flavorlist_error(self): + def test_launch_flavorlist_error(self, + test_with_profile=False): api.nova.extension_supported('BlockDeviceMappingV2Boot', IsA(http.HttpRequest)) \ .AndReturn(True) @@ -1722,10 +1745,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -1749,6 +1769,11 @@ self.assertTemplateUsed(res, views.WorkflowView.template_name) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_flavorlist_error_with_profile(self): + self.test_launch_flavorlist_error(test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list', @@ -1762,7 +1787,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_form_keystone_exception(self): + def test_launch_form_keystone_exception(self, + test_with_profile=False): flavor = self.flavors.first() image = self.images.first() keypair = self.keypairs.first() @@ -1799,10 +1825,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() policy_profile_id = self.policy_profiles.first().id port = self.ports.first() @@ -1811,7 +1834,7 @@ 'policy').AndReturn(policy_profiles) api.neutron.port_create( IsA(http.HttpRequest), - network_id=self.networks.first().id, + self.networks.first().id, policy_profile_id=policy_profile_id).AndReturn(port) nics = [{"port-id": port.id}] cinder.volume_list(IgnoreArg()).AndReturn(self.volumes.list()) @@ -1855,11 +1878,18 @@ 'admin_pass': 'password', 'confirm_admin_pass': 'password', 'disk_config': 'AUTO'} + if test_with_profile: + form_data['profile'] = self.policy_profiles.first().id url = reverse('horizon:project:instances:launch') res = self.client.post(url, form_data) self.assertRedirectsNoFollow(res, INDEX_URL) + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_keystone_exception_with_profile(self): + self.test_launch_form_keystone_exception(test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list',), @@ -1872,7 +1902,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def test_launch_form_instance_count_error(self): + def test_launch_form_instance_count_error(self, + test_with_profile=False): flavor = self.flavors.first() image = self.images.first() keypair = self.keypairs.first() @@ -1911,10 +1942,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -1952,6 +1980,11 @@ self.assertContains(res, "greater than or equal to 1") + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_instance_count_error_with_profile(self): + self.test_launch_form_instance_count_error(test_with_profile=True) + @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', 'profile_list',), @@ -1964,7 +1997,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def _test_launch_form_instance_requirement_error(self, image, flavor): + def _test_launch_form_instance_requirement_error(self, image, flavor, + test_with_profile=False): keypair = self.keypairs.first() server = self.servers.first() volume = self.volumes.first() @@ -2001,10 +2035,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -2043,19 +2074,39 @@ msg = "The flavor '%s' is too small" % flavor.name self.assertContains(res, msg) - def test_launch_form_instance_requirement_error_disk(self): + def test_launch_form_instance_requirement_error_disk( + self, + test_with_profile=False + ): flavor = self.flavors.first() image = self.images.first() image.min_ram = flavor.ram image.min_disk = flavor.disk + 1 - self._test_launch_form_instance_requirement_error(image, flavor) + self._test_launch_form_instance_requirement_error(image, flavor, + test_with_profile) - def test_launch_form_instance_requirement_error_ram(self): + def test_launch_form_instance_requirement_error_ram( + self, + test_with_profile=False + ): flavor = self.flavors.first() image = self.images.first() image.min_ram = flavor.ram + 1 image.min_disk = flavor.disk - self._test_launch_form_instance_requirement_error(image, flavor) + self._test_launch_form_instance_requirement_error(image, flavor, + test_with_profile) + + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_instance_requirement_error_disk_with_profile(self): + self.test_launch_form_instance_requirement_error_disk( + test_with_profile=True) + + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_instance_requirement_error_ram_with_profile(self): + self.test_launch_form_instance_requirement_error_ram( + test_with_profile=True) @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list', @@ -2069,7 +2120,8 @@ cinder: ('volume_list', 'volume_snapshot_list',), quotas: ('tenant_quota_usages',)}) - def _test_launch_form_instance_volume_size(self, image, volume_size, msg): + def _test_launch_form_instance_volume_size(self, image, volume_size, msg, + test_with_profile=False): flavor = self.flavors.get(name='m1.massive') keypair = self.keypairs.first() server = self.servers.first() @@ -2105,10 +2157,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -2147,17 +2196,33 @@ res = self.client.post(url, form_data) self.assertContains(res, msg) - def test_launch_form_instance_volume_size_error(self): + def test_launch_form_instance_volume_size_error(self, + test_with_profile=False): image = self.images.get(name='protected_images') volume_size = image.min_disk / 2 msg = ("The Volume size is too small for the '%s' image" % image.name) - self._test_launch_form_instance_volume_size(image, volume_size, msg) + self._test_launch_form_instance_volume_size(image, volume_size, msg, + test_with_profile) - def test_launch_form_instance_non_int_volume_size(self): + def test_launch_form_instance_non_int_volume_size(self, + test_with_profile=False): image = self.images.get(name='protected_images') msg = "Enter a whole number." - self._test_launch_form_instance_volume_size(image, 1.5, msg) + self._test_launch_form_instance_volume_size(image, 1.5, msg, + test_with_profile) + + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_instance_volume_size_error_with_profile(self): + self.test_launch_form_instance_volume_size_error( + test_with_profile=True) + + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_launch_form_instance_non_int_volume_size_with_profile(self): + self.test_launch_form_instance_non_int_volume_size( + test_with_profile=True) @test.create_stubs({api.nova: ('flavor_list', 'server_list', 'tenant_absolute_limits', @@ -2248,7 +2313,8 @@ api.neutron: ('network_list', 'profile_list'), api.glance: ('image_list_detailed',)}) - def test_select_default_keypair_if_only_one(self): + def test_select_default_keypair_if_only_one(self, + test_with_profile=False): keypair = self.keypairs.first() cinder.volume_list(IsA(http.HttpRequest)) \ @@ -2270,10 +2336,7 @@ api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.networks.list()[1:]) - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: policy_profiles = self.policy_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'policy').AndReturn(policy_profiles) @@ -2303,6 +2366,11 @@ html=True, msg_prefix="The default key pair was not selected.") + @test_utils.override_settings( + OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_select_default_keypair_if_only_one_with_profile(self): + self.test_select_default_keypair_if_only_one(test_with_profile=True) + @test.create_stubs({api.network: ('floating_ip_target_get_by_instance', 'tenant_floating_ip_allocate', 'floating_ip_associate', diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py 2014-10-16 00:01:49.000000000 +0000 @@ -566,16 +566,23 @@ help_text=_("Launch instance with" " these networks")) if api.neutron.is_port_profiles_supported(): - profile = forms.ChoiceField(label=_("Policy Profiles"), - required=False, - help_text=_("Launch instance with " - "this policy profile")) + widget = None + else: + widget = forms.HiddenInput() + profile = forms.ChoiceField(label=_("Policy Profiles"), + required=False, + widget=widget, + help_text=_("Launch instance with " + "this policy profile")) def __init__(self, request, *args, **kwargs): super(SetNetworkAction, self).__init__(request, *args, **kwargs) network_list = self.fields["network"].choices if len(network_list) == 1: self.fields['network'].initial = [network_list[0][0]] + if api.neutron.is_port_profiles_supported(): + self.fields['profile'].choices = ( + self.get_policy_profile_choices(request)) class Meta: name = _("Networking") @@ -595,14 +602,19 @@ _('Unable to retrieve networks.')) return network_list - def populate_profile_choices(self, request, context): + def get_policy_profile_choices(self, request): + profile_choices = [('', '')] + for profile in self._get_profiles(request, 'policy'): + profile_choices.append((profile.id, profile.name)) + return profile_choices + + def _get_profiles(self, request, type_p): + profiles = [] try: - profiles = api.neutron.profile_list(request, 'policy') - profile_list = [(profile.id, profile.name) for profile in profiles] + profiles = api.neutron.profile_list(request, type_p) except Exception: - profile_list = [] exceptions.handle(request, _("Unable to retrieve profiles.")) - return profile_list + return profiles class SetNetwork(workflows.Step): diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/networks/tests.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/networks/tests.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/networks/tests.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/networks/tests.py 2014-10-16 00:01:49.000000000 +0000 @@ -16,6 +16,7 @@ from django.core.urlresolvers import reverse from django import http +from django.test.utils import override_settings from django.utils.html import escape from horizon.workflows import views @@ -220,11 +221,9 @@ self.assertEqual(len(ports), 0) @test.create_stubs({api.neutron: ('profile_list',)}) - def test_network_create_get(self): - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + def test_network_create_get(self, + test_with_profile=False): + if test_with_profile: net_profiles = self.net_profiles.list() api.neutron.profile_list(IsA(http.HttpRequest), 'network').AndReturn(net_profiles) @@ -241,16 +240,18 @@ ''] self.assertQuerysetEqual(workflow.steps, expected_objs) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_get_with_profile(self): + self.test_network_create_get(test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'profile_list',)}) - def test_network_create_post(self): + def test_network_create_post(self, + test_with_profile=False): network = self.networks.first() params = {'name': network.name, 'admin_state_up': network.admin_state_up} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -264,7 +265,7 @@ 'admin_state': network.admin_state_up, # subnet 'with_subnet': False} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_no_subnet()) url = reverse('horizon:project:networks:create') @@ -273,18 +274,20 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_with_profile(self): + self.test_network_create_post(test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'subnet_create', 'profile_list',)}) - def test_network_create_post_with_subnet(self): + def test_network_create_post_with_subnet(self, + test_with_profile=False): network = self.networks.first() subnet = self.subnets.first() params = {'name': network.name, 'admin_state_up': network.admin_state_up} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -305,7 +308,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, allocation_pools=[])) url = reverse('horizon:project:networks:create') @@ -314,16 +317,18 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_with_subnet_w_profile(self): + self.test_network_create_post_with_subnet(test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'profile_list',)}) - def test_network_create_post_network_exception(self): + def test_network_create_post_network_exception(self, + test_with_profile=False): network = self.networks.first() params = {'name': network.name, 'admin_state_up': network.admin_state_up} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -337,7 +342,7 @@ 'admin_state': network.admin_state_up, # subnet 'with_subnet': False} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_no_subnet()) url = reverse('horizon:project:networks:create') @@ -346,17 +351,22 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_nw_exception_w_profile(self): + self.test_network_create_post_network_exception( + test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'profile_list')}) - def test_network_create_post_with_subnet_network_exception(self): + def test_network_create_post_with_subnet_network_exception( + self, + test_with_profile=False + ): network = self.networks.first() subnet = self.subnets.first() params = {'name': network.name, 'admin_state_up': network.admin_state_up} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -369,7 +379,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, allocation_pools=[])) url = reverse('horizon:project:networks:create') @@ -378,19 +388,24 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_nw_create_post_w_subnet_nw_exception_w_profile(self): + self.test_network_create_post_with_subnet_network_exception( + test_with_profile=True) + @test.create_stubs({api.neutron: ('network_create', 'network_delete', 'subnet_create', 'profile_list')}) - def test_network_create_post_with_subnet_subnet_exception(self): + def test_network_create_post_with_subnet_subnet_exception( + self, + test_with_profile=False + ): network = self.networks.first() subnet = self.subnets.first() params = {'name': network.name, 'admin_state_up': network.admin_state_up} - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -413,7 +428,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, allocation_pools=[])) url = reverse('horizon:project:networks:create') @@ -422,14 +437,17 @@ self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_nw_create_post_w_subnet_subnet_exception_w_profile(self): + self.test_network_create_post_with_subnet_subnet_exception( + test_with_profile=True) + @test.create_stubs({api.neutron: ('profile_list',)}) - def test_network_create_post_with_subnet_nocidr(self): + def test_network_create_post_with_subnet_nocidr(self, + test_with_profile=False): network = self.networks.first() subnet = self.subnets.first() - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -439,7 +457,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, cidr='', allocation_pools=[])) @@ -449,14 +467,19 @@ self.assertContains(res, escape('Specify "Network Address" or ' 'clear "Create Subnet" checkbox.')) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_nw_create_post_w_subnet_no_cidr_w_profile(self): + self.test_network_create_post_with_subnet_nocidr( + test_with_profile=True) + @test.create_stubs({api.neutron: ('profile_list',)}) - def test_network_create_post_with_subnet_cidr_without_mask(self): + def test_network_create_post_with_subnet_cidr_without_mask( + self, + test_with_profile=False + ): network = self.networks.first() subnet = self.subnets.first() - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -466,7 +489,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, cidr='10.0.0.0', allocation_pools=[])) @@ -476,14 +499,19 @@ expected_msg = "The subnet in the Network Address is too small (/32)." self.assertContains(res, expected_msg) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_nw_create_post_w_subnet_cidr_without_mask_w_profile(self): + self.test_network_create_post_with_subnet_cidr_without_mask( + test_with_profile=True) + @test.create_stubs({api.neutron: ('profile_list',)}) - def test_network_create_post_with_subnet_cidr_inconsistent(self): + def test_network_create_post_with_subnet_cidr_inconsistent( + self, + test_with_profile=False + ): network = self.networks.first() subnet = self.subnets.first() - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -495,7 +523,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, cidr=cidr, allocation_pools=[])) @@ -505,14 +533,19 @@ expected_msg = 'Network Address and IP version are inconsistent.' self.assertContains(res, expected_msg) + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_with_subnet_cidr_inconsistent_w_profile(self): + self.test_network_create_post_with_subnet_cidr_inconsistent( + test_with_profile=True) + @test.create_stubs({api.neutron: ('profile_list',)}) - def test_network_create_post_with_subnet_gw_inconsistent(self): + def test_network_create_post_with_subnet_gw_inconsistent( + self, + test_with_profile=False + ): network = self.networks.first() subnet = self.subnets.first() - # TODO(absubram): Remove if clause and create separate - # test stubs for when profile_support is being used. - # Additionally ensure those are always run even in default setting - if api.neutron.is_port_profiles_supported(): + if test_with_profile: net_profiles = self.net_profiles.list() net_profile_id = self.net_profiles.first().id api.neutron.profile_list(IsA(http.HttpRequest), @@ -524,7 +557,7 @@ form_data = {'net_name': network.name, 'admin_state': network.admin_state_up, 'with_subnet': True} - if api.neutron.is_port_profiles_supported(): + if test_with_profile: form_data['net_profile_id'] = net_profile_id form_data.update(form_data_subnet(subnet, gateway_ip=gateway_ip, allocation_pools=[])) @@ -533,6 +566,11 @@ self.assertContains(res, 'Gateway IP and IP version are inconsistent.') + @override_settings(OPENSTACK_NEUTRON_NETWORK={'profile_support': 'cisco'}) + def test_network_create_post_with_subnet_gw_inconsistent_w_profile(self): + self.test_network_create_post_with_subnet_gw_inconsistent( + test_with_profile=True) + @test.create_stubs({api.neutron: ('network_get',)}) def test_network_update_get(self): network = self.networks.first() diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/networks/workflows.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/networks/workflows.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/project/networks/workflows.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/project/networks/workflows.py 2014-10-16 00:01:49.000000000 +0000 @@ -38,31 +38,36 @@ label=_("Network Name"), required=False) if api.neutron.is_port_profiles_supported(): - net_profile_id = forms.ChoiceField(label=_("Network Profile")) + widget = None + else: + widget = forms.HiddenInput() + net_profile_id = forms.ChoiceField(label=_("Network Profile"), + required=False, + widget=widget) admin_state = forms.BooleanField(label=_("Admin State"), initial=True, required=False) - if api.neutron.is_port_profiles_supported(): - def __init__(self, request, *args, **kwargs): - super(CreateNetworkInfoAction, self).__init__(request, - *args, **kwargs) + def __init__(self, request, *args, **kwargs): + super(CreateNetworkInfoAction, self).__init__(request, + *args, **kwargs) + if api.neutron.is_port_profiles_supported(): self.fields['net_profile_id'].choices = ( self.get_network_profile_choices(request)) - def get_network_profile_choices(self, request): - profile_choices = [('', _("Select a profile"))] - for profile in self._get_profiles(request, 'network'): - profile_choices.append((profile.id, profile.name)) - return profile_choices - - def _get_profiles(self, request, type_p): - try: - profiles = api.neutron.profile_list(request, type_p) - except Exception: - profiles = [] - msg = _('Network Profiles could not be retrieved.') - exceptions.handle(request, msg) - return profiles + def get_network_profile_choices(self, request): + profile_choices = [('', _("Select a profile"))] + for profile in self._get_profiles(request, 'network'): + profile_choices.append((profile.id, profile.name)) + return profile_choices + + def _get_profiles(self, request, type_p): + profiles = [] + try: + profiles = api.neutron.profile_list(request, type_p) + except Exception: + msg = _('Network Profiles could not be retrieved.') + exceptions.handle(request, msg) + return profiles # TODO(absubram): Add ability to view network profile information # in the network detail if a profile is used. @@ -75,10 +80,7 @@ class CreateNetworkInfo(workflows.Step): action_class = CreateNetworkInfoAction - if api.neutron.is_port_profiles_supported(): - contributes = ("net_name", "admin_state", "net_profile_id") - else: - contributes = ("net_name", "admin_state") + contributes = ("net_name", "admin_state", "net_profile_id") class CreateSubnetInfoAction(workflows.Action): diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/dashboard.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/dashboard.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/dashboard.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/dashboard.py 2014-10-16 00:01:49.000000000 +0000 @@ -16,8 +16,6 @@ from django.utils.translation import ugettext_lazy as _ -from openstack_dashboard.api import neutron - import horizon @@ -29,5 +27,4 @@ permissions = ('openstack.roles.admin',) -if neutron.is_port_profiles_supported(): - horizon.register(Router) +horizon.register(Router) diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/nexus1000v/panel.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/nexus1000v/panel.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/nexus1000v/panel.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/nexus1000v/panel.py 2014-10-16 00:01:49.000000000 +0000 @@ -18,7 +18,6 @@ from django.utils.translation import ugettext_lazy as _ import horizon -from openstack_dashboard.api import neutron as neutron from openstack_dashboard.dashboards.router import dashboard @@ -27,5 +26,4 @@ slug = 'nexus1000v' permissions = ('openstack.services.network',) -if neutron.is_port_profiles_supported(): - dashboard.Router.register(Nexus1000v) +dashboard.Router.register(Nexus1000v) diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/nexus1000v/tests.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/nexus1000v/tests.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/dashboards/router/nexus1000v/tests.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/dashboards/router/nexus1000v/tests.py 2014-10-16 00:01:49.000000000 +0000 @@ -32,174 +32,170 @@ return {'physical_network': ''} -# TODO(absubram): Remove if clause and create separate -# test stubs for when profile_support is being used and when not. -# Additionally ensure those are always run even in default setting -if api.neutron.is_port_profiles_supported(): - class Nexus1000vTest(test.BaseAdminViewTests): - @test.create_stubs({api.neutron: ('profile_list', - 'profile_bindings_list'), - api.keystone: ('tenant_list',)}) - def test_index(self): - tenants = self.tenants.list() - net_profiles = self.net_profiles.list() - policy_profiles = self.policy_profiles.list() - net_profile_binding = self.network_profile_binding.list() - policy_profile_binding = self.policy_profile_binding.list() - api.neutron.profile_list(IsA(http.HttpRequest), - 'network').AndReturn(net_profiles) - api.neutron.profile_list(IsA(http.HttpRequest), - 'policy').AndReturn(policy_profiles) - api.neutron.profile_bindings_list( - IsA(http.HttpRequest), - 'network').AndReturn(net_profile_binding) - api.neutron.profile_bindings_list( - IsA(http.HttpRequest), - 'policy').AndReturn(policy_profile_binding) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - self.mox.ReplayAll() - - res = self.client.get(reverse('horizon:router:nexus1000v:index')) - self.assertTemplateUsed(res, 'router/nexus1000v/index.html') - - @test.create_stubs({api.neutron: ('profile_create',), - api.keystone: ('tenant_list',)}) - def test_create_vlan_net_profile(self): - tenants = self.tenants.list() - net_profile = self.net_profiles.first() - params = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'physical_network': net_profile.physical_network, - 'tenant_id': net_profile.project, - # vlan profiles have no sub_type or multicast_ip_range - 'multicast_ip_range': '', - 'sub_type': ''} - - api.neutron.profile_create(IsA(http.HttpRequest), - **params).AndReturn(net_profile) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - self.mox.ReplayAll() - - form_data = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'physical_network': net_profile.physical_network, - 'project': net_profile.project} - form_data.update(form_data_no_overlay()) - url = reverse('horizon:router:nexus1000v:create_network_profile') - res = self.client.post(url, form_data) - - self.assertNoFormErrors(res) - self.assertRedirectsNoFollow(res, - reverse - ('horizon:router:nexus1000v:index')) - - @test.create_stubs({api.neutron: ('profile_create',), - api.keystone: ('tenant_list',)}) - def test_create_overlay_net_profile(self): - tenants = self.tenants.list() - net_profile = self.net_profiles.list()[1] - params = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'multicast_ip_range': net_profile.multicast_ip_range, - 'sub_type': net_profile.sub_type, - 'tenant_id': net_profile.project, - # overlay profiles have no physical_network type - 'physical_network': ''} - - api.neutron.profile_create(IsA(http.HttpRequest), - **params).AndReturn(net_profile) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - self.mox.ReplayAll() - - form_data = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'multicast_ip_range': net_profile.multicast_ip_range, - 'sub_type': net_profile.sub_type, - 'project': net_profile.project} - form_data.update(form_data_overlay()) - url = reverse('horizon:router:nexus1000v:create_network_profile') - res = self.client.post(url, form_data) - - self.assertNoFormErrors(res) - self.assertRedirectsNoFollow(res, - reverse - ('horizon:router:nexus1000v:index')) - - @test.create_stubs({api.neutron: ('profile_create',), - api.keystone: ('tenant_list',)}) - def test_create_overlay_other_net_profile(self): - tenants = self.tenants.list() - net_profile = self.net_profiles.list()[2] - params = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'sub_type': net_profile.other_subtype, - 'tenant_id': net_profile.project, - # overlay 'other' profiles have no multicast_ip_range - # or physical_network type - 'multicast_ip_range': '', - 'physical_network': ''} - - api.neutron.profile_create(IsA(http.HttpRequest), - **params).AndReturn(net_profile) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - self.mox.ReplayAll() - - form_data = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'segment_range': net_profile.segment_range, - 'sub_type': net_profile.sub_type, - 'other_subtype': net_profile.other_subtype, - 'project': net_profile.project} - form_data.update(form_data_overlay()) - url = reverse('horizon:router:nexus1000v:create_network_profile') - res = self.client.post(url, form_data) - - self.assertNoFormErrors(res) - self.assertRedirectsNoFollow(res, - reverse - ('horizon:router:nexus1000v:index')) - - @test.create_stubs({api.neutron: ('profile_create',), - api.keystone: ('tenant_list',)}) - def test_create_trunk_net_profile(self): - tenants = self.tenants.list() - net_profile = self.net_profiles.list()[3] - params = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'sub_type': net_profile.sub_type_trunk, - 'tenant_id': net_profile.project, - # trunk profiles have no multicast_ip_range, - # no segment_range or no physical_network type - 'multicast_ip_range': '', - 'segment_range': '', - 'physical_network': ''} - - api.neutron.profile_create(IsA(http.HttpRequest), - **params).AndReturn(net_profile) - api.keystone.tenant_list( - IsA(http.HttpRequest)).AndReturn([tenants, False]) - self.mox.ReplayAll() - - form_data = {'name': net_profile.name, - 'segment_type': net_profile.segment_type, - 'sub_type_trunk': net_profile.sub_type_trunk, - 'project': net_profile.project} - form_data.update(form_data_no_overlay()) - url = reverse('horizon:router:nexus1000v:create_network_profile') - res = self.client.post(url, form_data) - - self.assertNoFormErrors(res) - self.assertRedirectsNoFollow(res, - reverse - ('horizon:router:nexus1000v:index')) +class Nexus1000vTest(test.BaseAdminViewTests): + @test.create_stubs({api.neutron: ('profile_list', + 'profile_bindings_list'), + api.keystone: ('tenant_list',)}) + def test_index(self): + tenants = self.tenants.list() + net_profiles = self.net_profiles.list() + policy_profiles = self.policy_profiles.list() + net_profile_binding = self.network_profile_binding.list() + policy_profile_binding = self.policy_profile_binding.list() + api.neutron.profile_list(IsA(http.HttpRequest), + 'network').AndReturn(net_profiles) + api.neutron.profile_list(IsA(http.HttpRequest), + 'policy').AndReturn(policy_profiles) + api.neutron.profile_bindings_list( + IsA(http.HttpRequest), + 'network').AndReturn(net_profile_binding) + api.neutron.profile_bindings_list( + IsA(http.HttpRequest), + 'policy').AndReturn(policy_profile_binding) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + self.mox.ReplayAll() + + res = self.client.get(reverse('horizon:router:nexus1000v:index')) + self.assertTemplateUsed(res, 'router/nexus1000v/index.html') + + @test.create_stubs({api.neutron: ('profile_create',), + api.keystone: ('tenant_list',)}) + def test_create_vlan_net_profile(self): + tenants = self.tenants.list() + net_profile = self.net_profiles.first() + params = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'physical_network': net_profile.physical_network, + 'tenant_id': net_profile.project, + # vlan profiles have no sub_type or multicast_ip_range + 'multicast_ip_range': '', + 'sub_type': ''} + + api.neutron.profile_create(IsA(http.HttpRequest), + **params).AndReturn(net_profile) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + self.mox.ReplayAll() + + form_data = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'physical_network': net_profile.physical_network, + 'project': net_profile.project} + form_data.update(form_data_no_overlay()) + url = reverse('horizon:router:nexus1000v:create_network_profile') + res = self.client.post(url, form_data) + + self.assertNoFormErrors(res) + self.assertRedirectsNoFollow(res, + reverse + ('horizon:router:nexus1000v:index')) + + @test.create_stubs({api.neutron: ('profile_create',), + api.keystone: ('tenant_list',)}) + def test_create_overlay_net_profile(self): + tenants = self.tenants.list() + net_profile = self.net_profiles.list()[1] + params = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'multicast_ip_range': net_profile.multicast_ip_range, + 'sub_type': net_profile.sub_type, + 'tenant_id': net_profile.project, + # overlay profiles have no physical_network type + 'physical_network': ''} + + api.neutron.profile_create(IsA(http.HttpRequest), + **params).AndReturn(net_profile) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + self.mox.ReplayAll() + + form_data = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'multicast_ip_range': net_profile.multicast_ip_range, + 'sub_type': net_profile.sub_type, + 'project': net_profile.project} + form_data.update(form_data_overlay()) + url = reverse('horizon:router:nexus1000v:create_network_profile') + res = self.client.post(url, form_data) + + self.assertNoFormErrors(res) + self.assertRedirectsNoFollow(res, + reverse + ('horizon:router:nexus1000v:index')) + + @test.create_stubs({api.neutron: ('profile_create',), + api.keystone: ('tenant_list',)}) + def test_create_overlay_other_net_profile(self): + tenants = self.tenants.list() + net_profile = self.net_profiles.list()[2] + params = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'sub_type': net_profile.other_subtype, + 'tenant_id': net_profile.project, + # overlay 'other' profiles have no multicast_ip_range + # or physical_network type + 'multicast_ip_range': '', + 'physical_network': ''} + + api.neutron.profile_create(IsA(http.HttpRequest), + **params).AndReturn(net_profile) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + self.mox.ReplayAll() + + form_data = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'segment_range': net_profile.segment_range, + 'sub_type': net_profile.sub_type, + 'other_subtype': net_profile.other_subtype, + 'project': net_profile.project} + form_data.update(form_data_overlay()) + url = reverse('horizon:router:nexus1000v:create_network_profile') + res = self.client.post(url, form_data) + + self.assertNoFormErrors(res) + self.assertRedirectsNoFollow(res, + reverse + ('horizon:router:nexus1000v:index')) + + @test.create_stubs({api.neutron: ('profile_create',), + api.keystone: ('tenant_list',)}) + def test_create_trunk_net_profile(self): + tenants = self.tenants.list() + net_profile = self.net_profiles.list()[3] + params = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'sub_type': net_profile.sub_type_trunk, + 'tenant_id': net_profile.project, + # trunk profiles have no multicast_ip_range, + # no segment_range or no physical_network type + 'multicast_ip_range': '', + 'segment_range': '', + 'physical_network': ''} + + api.neutron.profile_create(IsA(http.HttpRequest), + **params).AndReturn(net_profile) + api.keystone.tenant_list( + IsA(http.HttpRequest)).AndReturn([tenants, False]) + self.mox.ReplayAll() + + form_data = {'name': net_profile.name, + 'segment_type': net_profile.segment_type, + 'sub_type_trunk': net_profile.sub_type_trunk, + 'project': net_profile.project} + form_data.update(form_data_no_overlay()) + url = reverse('horizon:router:nexus1000v:create_network_profile') + res = self.client.post(url, form_data) + + self.assertNoFormErrors(res) + self.assertRedirectsNoFollow(res, + reverse + ('horizon:router:nexus1000v:index')) diff -Nru horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/test/settings.py horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/test/settings.py --- horizon-2014.1.100+git201410022310~trusty/openstack_dashboard/test/settings.py 2014-10-03 03:10:03.000000000 +0000 +++ horizon-2014.1.100+git201410152002~trusty/openstack_dashboard/test/settings.py 2014-10-16 00:01:49.000000000 +0000 @@ -47,13 +47,7 @@ 'openstack_dashboard.dashboards.project', 'openstack_dashboard.dashboards.admin', 'openstack_dashboard.dashboards.settings', - # If the profile_support config is turned on in local_settings - # the "router" dashboard will be enabled which can be used to - # create and use profiles with networks and instances. In which case - # using run_tests will require the registration of the "router" dashboard. - # TODO (absubram): Need to make this permanent when a better solution - # for run_tests is implemented to use with and without the n1k sub-plugin. - #'openstack_dashboard.dashboards.router', + 'openstack_dashboard.dashboards.router', ) AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',) @@ -61,14 +55,7 @@ SITE_BRANDING = 'OpenStack' HORIZON_CONFIG = { - 'dashboards': ('project', 'admin', 'settings',), - # If the profile_support config is turned on in local_settings - # the "router" dashboard will be enabled which can be used to - # create and use profiles with networks and instances. In which case - # using run_tests will require the registration of the "router" dashboard. - # TODO (absubram): Need to make this permanent when a better solution - # for run_tests is implemented to use with and without the n1k sub-plugin. - #'dashboards': ('project', 'admin', 'settings', 'router',), + 'dashboards': ('project', 'admin', 'settings', 'router',), 'default_dashboard': 'project', "password_validator": { "regex": '^.{8,18}$', @@ -115,12 +102,6 @@ 'enable_firewall': True, 'enable_quotas': False, # Enabled in specific tests only 'enable_vpn': True, - # If the profile_support config is turned on in local_settings - # the "router" dashboard will be enabled which can be used to - # create and use profiles with networks and instances. In which case - # using run_tests will require the registration of the "router" dashboard. - # TODO (absubram): Need to make this permanent when a better solution - # for run_tests is implemented to use with and without the n1k sub-plugin. 'profile_support': None, #'profile_support': 'cisco' }