'Verify the default security group rules is disabled.'

@decorators.attr(type='slow')
@test.requires_ext(service='network', extension='port-security')
@decorators.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c')
@test.services('compute', 'network')
def test_port_security_disable_security_group(self):

    new_tenant = self.primary_tenant
    name = 'server-{tenant}-gen-1'.format(tenant=new_tenant.creds.tenant_name)
    name = data_utils.rand_name(name)
    server = self._create_server(name, new_tenant, [new_tenant.security_groups['default']])
    access_point_ssh = self._connect_to_access_point(new_tenant)
    server_id = server['id']
    port_id = self.os_admin.ports_client.list_ports(device_id=server_id)['ports'][0]['id']
    try:
        self.ports_client.update_port(port_id, port_security_enabled=True, security_groups=[])
        self.check_remote_connectivity(source=access_point_ssh, dest=self._get_server_ip(server), should_succeed=False)
        self.ports_client.update_port(port_id, port_security_enabled=False, security_groups=[])
        self.check_remote_connectivity(source=access_point_ssh, dest=self._get_server_ip(server))
    except Exception:
        self._log_console_output_for_all_tenants()
        raise
