c839626925a96f11d07bda8b8f23f3be6260a453
[parser.git] / tosca2heat / tosca-parser / toscaparser / extensions / nfv / tests / test_tosca_vRNC.py
1 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
2 #    not use this file except in compliance with the License. You may obtain
3 #    a copy of the License at
4 #
5 #         http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #    Unless required by applicable law or agreed to in writing, software
8 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 #    License for the specific language governing permissions and limitations
11 #    under the License.
12
13 import os
14
15 from toscaparser.tests.base import TestCase
16 from toscaparser.tosca_template import ToscaTemplate
17
18
19 class ToscaVRNCTemplateTest(TestCase):
20
21     '''NFV TOSCA vRNC template.'''
22     tosca_tpl = os.path.join(
23         os.path.dirname(os.path.abspath(__file__)),
24         "data/vRNC/Definitions/vRNC.yaml")
25     tosca = ToscaTemplate(tosca_tpl)
26
27     def test_version(self):
28         self.assertEqual(self.tosca.version,
29                          "tosca_simple_profile_for_nfv_1_0_0")
30
31     def test_input(self):
32         first_input_name = "mm_storage_size"
33         self.assertEqual(self.tosca.inputs[0].name, first_input_name)
34
35     def test_nodetemplates(self):
36         expected_node_list = sorted(
37             ["MM_Active", "MM_Passive", "MM_BlockStorage",
38              "MM_Active_Host", "MM_Passive_Host",
39              "CM_Active", "CM_Passive", "DM", "LB",
40              "CM_Active_Host", "CM_Passive_Host", "DM_Host", "LB_Host",
41              "EXTERMEDIA_Net", "INTERMEDIA_Net", "EMS_Net", "CTRL_Net",
42              "MM_Active_Port_EMS", "MM_Active_Port_CTRL",
43              "MM_Active_Port_EXTERMEDIA", "MM_Active_Port_INTERMEDIA",
44              "MM_Passive_Port_EMS", "MM_Passive_Port_CTRL",
45              "MM_Passive_Port_EXTERMEDIA", "MM_Passive_Port_INTERMEDIA",
46              "CM_Active_Port_CTRL", "CM_Active_Port_INTERMEDIA",
47              "CM_Passive_Port_CTRL", "CM_Passive_Port_INTERMEDIA",
48              "DM_Port_CTRL", "DM_Port_INTERMEDIA",
49              "LB_Port_INTERMEDIA", "LB_Port_EXTERMEDIA", "LB_Port_CTRL"])
50
51         node_list = sorted([node.name for node in self.tosca.nodetemplates])
52         self.assertEqual(node_list, expected_node_list)
53
54     def test_output(self):
55         expected_output_name = sorted(
56             ["private_ip_of_CM", "private_ip_of_DM",
57              "private_ip_of_LB", "private_ip_of_MM"])
58
59         output_list = sorted([output.name for output in self.tosca.outputs])
60         self.assertEqual(output_list, expected_output_name)