Barcelona police say they are treating a man’s knife attack on officers at a city police station as a terrorist incident.