def setUp(self): super(SecurityGroupsPolicyTest, self).setUp() self.controller = security_groups.SecurityGroupController() self.rule_ctr = security_groups.SecurityGroupRulesController() self.req = fakes.HTTPRequest.blank('') # Check that everyone is able to perform crud operation on. # security groups. # NOTE(gmann): Nova cannot verify the security groups owner during # nova policy enforcement so will be passing context's project_id # as target to policy and always pass. If requester is not admin # or owner of security groups then neutron will be returning the # appropriate error. self.reader_authorized_contexts = [ self.legacy_admin_context, self.system_admin_context, self.project_admin_context, self.project_member_context, self.project_reader_context, self.project_foo_context, self.other_project_reader_context, self.system_member_context, self.system_reader_context, self.system_foo_context, self.other_project_member_context ] self.reader_unauthorized_contexts = [] self.sys_admin_or_owner_authorized_contexts = ( self.reader_authorized_contexts) self.sys_admin_or_owner_unauthorized_contexts = ( self.reader_unauthorized_contexts)
def setUp(self): super(TestNeutronSecurityGroupRulesTestCase, self).setUp() id1 = '11111111-1111-1111-1111-111111111111' sg_template1 = test_security_groups.security_group_template( security_group_rules=[], id=id1) id2 = '22222222-2222-2222-2222-222222222222' sg_template2 = test_security_groups.security_group_template( security_group_rules=[], id=id2) self.controller_sg = security_groups.SecurityGroupController() neutron = get_client() neutron._fake_security_groups[id1] = sg_template1 neutron._fake_security_groups[id2] = sg_template2
def setUp(self): super(TestNeutronSecurityGroupsOutputTest, self).setUp() fakes.stub_out_nw_api(self) self.controller = security_groups.SecurityGroupController() self.stubs.Set(compute.api.API, 'get', test_security_groups.fake_compute_get) self.stubs.Set(compute.api.API, 'get_all', test_security_groups.fake_compute_get_all) self.stubs.Set(compute.api.API, 'create', test_security_groups.fake_compute_create) self.stubs.Set( neutron_driver.SecurityGroupAPI, 'get_instances_security_groups_bindings', (test_security_groups.fake_get_instances_security_groups_bindings))
def setUp(self): super(TestNeutronSecurityGroupRulesV21, self).setUp() cfg.CONF.set_override('use_neutron', True) self.original_client = neutron_api.get_client neutron_api.get_client = get_client id1 = '11111111-1111-1111-1111-111111111111' sg_template1 = test_security_groups.security_group_template( security_group_rules=[], id=id1) id2 = '22222222-2222-2222-2222-222222222222' sg_template2 = test_security_groups.security_group_template( security_group_rules=[], id=id2) self.controller_sg = security_groups.SecurityGroupController() neutron = get_client() neutron._fake_security_groups[id1] = sg_template1 neutron._fake_security_groups[id2] = sg_template2
def setUp(self): super(TestNeutronSecurityGroupsOutputTest, self).setUp() fakes.stub_out_nw_api(self) self.controller = security_groups.SecurityGroupController() self.stubs.Set(compute.api.API, 'get', test_security_groups.fake_compute_get) self.stubs.Set(compute.api.API, 'get_all', test_security_groups.fake_compute_get_all) self.stubs.Set(compute.api.API, 'create', test_security_groups.fake_compute_create) self.stubs.Set( neutron_driver.SecurityGroupAPI, 'get_instances_security_groups_bindings', (test_security_groups.fake_get_instances_security_groups_bindings)) self.flags(osapi_compute_extension=[ 'nova.api.openstack.compute.contrib.select_extensions' ], osapi_compute_ext_list=['Security_groups'])
def setUp(self): super(TestNeutronSecurityGroupsOutputTest, self).setUp() cfg.CONF.set_override('use_neutron', True) self.original_client = neutron_api.get_client neutron_api.get_client = get_client fakes.stub_out_nw_api(self) self.controller = security_groups.SecurityGroupController() self.stub_out('nova.compute.api.API.get', test_security_groups.fake_compute_get) self.stub_out('nova.compute.api.API.get_all', test_security_groups.fake_compute_get_all) self.stub_out('nova.compute.api.API.create', test_security_groups.fake_compute_create) self.stub_out( 'nova.network.security_group.neutron_driver.SecurityGroupAPI.' 'get_instances_security_groups_bindings', self._fake_get_instances_security_groups_bindings)