Fault tolerant handling of exceptions thrown by verifyvnfd 03/104103/14
authoryangyan <yangyanyj@chinamobile.com>
Mon, 23 Mar 2020 10:31:16 +0000 (18:31 +0800)
committerYan Yang <yangyanyj@chinamobile.com>
Tue, 24 Mar 2020 09:28:55 +0000 (09:28 +0000)
Change-Id: Ia5c40d7413bac8fec58a7a8253089257ecadf588
Issue-ID: VFC-1651
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
lcm/lcm/pub/verifyvnfd/tests.py
lcm/lcm/pub/verifyvnfd/verifyvnfd.py

index bc0e974..29ce718 100644 (file)
@@ -15,7 +15,6 @@
 import unittest
 from lcm.pub.verifyvnfd import verifyvnfd
 from . import const
-from lcm.pub.exceptions import NFLCMException
 
 
 class VerifyVnfdTest(unittest.TestCase):
@@ -38,7 +37,5 @@ class VerifyVnfdTest(unittest.TestCase):
         self.assertEqual(ret, True)
 
     def test_vnfd_verfify_fail_for_missing_required(self):
-        try:
-            verifyvnfd.verify(const.vnfd_model_miss_required)
-        except NFLCMException as e:
-            self.assertNotEqual(e.args[0], "")
+        ret = verifyvnfd.verify(const.vnfd_model_miss_required)
+        self.assertNotEqual(ret, "")
index 0276c09..abcd959 100644 (file)
@@ -18,7 +18,6 @@ import os
 import six
 import logging
 import jsonschema
-from lcm.pub.exceptions import NFLCMException
 
 logger = logging.getLogger(__name__)
 
@@ -57,5 +56,6 @@ def verify(new_vnfd):
             logger.error("vnfd verify fail,%s" % _format_validation_error(error))
             errors_found.append(_format_validation_error(error))
     if len(errors_found) > 0:
-        raise NFLCMException(errors_found)
+        logger.error(errors_found)
+        return errors_found
     return True