This question was generated from the IARPA Global Forecasting Challenge. See related news item.
Articles 4 and 5 of the North Atlantic Treaty (underlying NATO) describe the conditions under which NATO should either "consult," or consider itself attacked, upon attack on a member country.
Article 4 was invoked by Turkey in 2015 in response to developments in Syria and by Poland in 2014 in response to developments in Ukraine (The Economist, NATO, Radio Free Europe/Radio Liberty, NATO). Article 5 has been invoked once, by the United States in response to a terrorist attack in 2001 (NATO). NATO has said a cyber attack could trigger Article 5 in the same way as a conventional military assault (The Telegraph).