[VVP] udpating scripts for casablanca 2
[vvp/validation-scripts.git] / ice_validator / tests / test_volume_resource_ids.py
index 3f0acda..9f0d176 100644 (file)
@@ -2,11 +2,11 @@
 # ============LICENSE_START=======================================================
 # org.onap.vvp/validation-scripts
 # ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
 # ===================================================================
 #
 # Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
+# under the Apache License, Version 2.0 (the "License");
 # you may not use this software except in compliance with the License.
 # You may obtain a copy of the License at
 #
@@ -21,7 +21,7 @@
 #
 #
 # Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
 # you may not use this documentation except in compliance with the License.
 # You may obtain a copy of the License at
 #
 #
 
 import re
+
 import pytest
-import yaml
+from tests import cached_yaml as yaml
+
 from .utils.vm_types import get_vm_type_for_nova_server
 
 
@@ -97,9 +99,12 @@ def test_volume_resource_ids(heat_template):
                         v3.get('get_resource'))
                     if not volume_id:
                         continue
-                    volume_id = volume_id.lower()
+                    if isinstance(volume_id, list):
+                        volume_id = volume_id[0].lower()
+                    else:
+                        volume_id = volume_id.lower()
 
-                    if vm_type+"_" not in volume_id:
+                    if vm_type + "_" not in volume_id:
                         invalid_volumes.append(volume_id)
 
         elif v['type'] == 'OS::Cinder::VolumeAttachment':
@@ -137,7 +142,10 @@ def test_volume_resource_ids(heat_template):
                 properties['volume_id'].get('get_resource'))
             if not volume_id:
                 continue
-            volume_id = volume_id.lower()
+            if isinstance(volume_id, list):
+                volume_id = volume_id[0].lower()
+            else:
+                volume_id = volume_id.lower()
 
             # do not test the case when the instance_uuid and
             # volume_id are not defined
@@ -149,14 +157,14 @@ def test_volume_resource_ids(heat_template):
                 if not vm_type:
                     continue
                 vm_type = vm_type.lower()
-                if vm_type+"_" not in volume_id:
+                if vm_type + "_" not in volume_id:
                     invalid_volumes.append(volume_id)
             else:
                 # extract the assumed {vm_type} from volume_id
                 m = volume_pattern.match(volume_id)
                 if m:
                     vm_type = m.group(1).lower()
-                    if vm_type+"_" not in instance_uuid:
+                    if vm_type + "_" not in instance_uuid:
                         invalid_volumes.append(volume_id)
                 else:
                     continue