Check if the test flag is set

Formulas should support running with the `test=True` setting.
This allows for making non-intrusive checks. Although the test
flag does not guarantee that it behaves correctly with nested
dependencies (since saltstack does not support any staging method)
it might be fixed to at least don't make any changes to the state.

Closes-Bug: PROD-34962
Change-Id: I5b317093c305487f39ed1e3513f70a11a17e2425
diff --git a/_states/neutronv2.py b/_states/neutronv2.py
index 7bfa7fb..85e9c3c 100644
--- a/_states/neutronv2.py
+++ b/_states/neutronv2.py
@@ -9,6 +9,9 @@
 
 
 def _neutronv2_call(fname, *args, **kwargs):
+    if __opts__.get('test') and not any(x for x in ['_get_', '_list'] if x in fname):
+        return {'changes': 'neutronv2 state {} to be called with {} {}'.format(
+            fname, args, kwargs), 'result': None}
     return __salt__['neutronv2.{}'.format(fname)](*args, **kwargs)