diff options
author | julien zhang <zhang.jun3g@zte.com.cn> | 2016-06-15 08:15:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-06-15 08:15:21 +0000 |
commit | 793354696202ad4eb98882265b780ed8c1446825 (patch) | |
tree | c3e8b05dd3d9189d13e4de4645b93edfd3bb8971 /tosca2heat/tosca-parser | |
parent | 88d1105828f31eec81546916df55209ce9ab71ea (diff) | |
parent | 0d7b82358f00aa155239355b3bb1f211fa3f799b (diff) |
Merge "Create vRNC test code."
Diffstat (limited to 'tosca2heat/tosca-parser')
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/test_tosca_vRNC.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/test_tosca_vRNC.py b/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/test_tosca_vRNC.py new file mode 100644 index 0000000..46a5e29 --- /dev/null +++ b/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/test_tosca_vRNC.py @@ -0,0 +1,54 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +from toscaparser.tests.base import TestCase +from toscaparser.tosca_template import ToscaTemplate + + +class ToscaVRNCTemplateTest(TestCase): + + '''NFV TOSCA vRNC template.''' + tosca_tpl = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/vRNC/Definitions/vRNC.yaml") + tosca = ToscaTemplate(tosca_tpl) + + def test_version(self): + self.assertEqual(self.tosca.version, + "tosca_simple_profile_for_nfv_1_0_0") + + def test_input(self): + first_input_name = "mm_storage_size" + self.assertEqual(self.tosca.inputs[0].name, first_input_name) + + def test_nodetemplates(self): + expected_node_list = sorted( + ["MM_Active", "MM_Passive", "MM_BlockStorage", + "CM_Active", "CM_Passive", "DM", "LB", + "EXTERMEDIA_Net", "INTERMEDIA_Net", "EMS_Net", "CTRL_Net", + "MM_Port_EMS", "MM_Port_CTRL", "MM_Port_EXTERMEDIA", + "CM_Port_CTRL", "CM_Port_INTERMEDIA", + "DM_Port_CTRL", "DM_Port_INTERMEDIA", + "LB_Port_INTERMEDIA", "LB_Port_EXTERMEDIA", "LB_Port_CTRL"]) + + node_list = sorted([node.name for node in self.tosca.nodetemplates]) + self.assertEqual(node_list, expected_node_list) + + def test_output(self): + expected_output_name = sorted( + ["private_ip_of_CM", "private_ip_of_DM", + "private_ip_of_LB", "private_ip_of_MM"]) + + output_list = sorted([output.name for output in self.tosca.outputs]) + self.assertEqual(output_list, expected_output_name) |