Comment 4 for bug 1731166

Revision history for this message
Wenzhi Liang (wzhliang) wrote :

I was able to reproduce it easily with the nfv example.

So I made the following change:

diff --git a/toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml b/toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml
index 365d70e..869fe96 100644
--- a/toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml
+++ b/toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml
@@ -23,7 +23,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 # Node Templates.
 ##########################################################################
 node_types:
- tosca.nodes.nfv.VNF:
+ nfv.tosca.nodes.VNF:
     derived_from: tosca.nodes.Root # Or should this be its own top - level type?
     properties:
       id:
diff --git a/toscaparser/extensions/nfv/tests/data/tosca_helloworld_nfv.yaml b/toscaparser/extensions/nfv/tests/data/tosca_helloworld_nfv.yaml
index 6afa9f0..da885d1 100644
--- a/toscaparser/extensions/nfv/tests/data/tosca_helloworld_nfv.yaml
+++ b/toscaparser/extensions/nfv/tests/data/tosca_helloworld_nfv.yaml
@@ -8,7 +8,7 @@ metadata:
 topology_template:
   node_templates:
     VNF1:
- type: tosca.nodes.nfv.VNF
+ type: nfv.tosca.nodes.VNF
       properties:
         id: vnf1
         vendor: acmetelco
diff --git a/toscaparser/extensions/nfv/tests/test_tosca_nfv_tpl.py b/toscaparser/extensions/nfv/tests/test_tosca_nfv_tpl.py
index b166d83..8d896ba 100644
--- a/toscaparser/extensions/nfv/tests/test_tosca_nfv_tpl.py
+++ b/toscaparser/extensions/nfv/tests/test_tosca_nfv_tpl.py

Here the exception the above change caused when running test:

 InvalidTypeError: Type "nfv.tosca.nodes.VNF" is not a valid type.
  File test_tosca_nfv_tpl.py, line 18, in <module>
   class ToscaNFVTemplateTest():
  File test_tosca_nfv_tpl.py, line 24, in ToscaNFVTemplateTest
   tosca = ToscaTemplate(tosca_tpl)
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/tosca_template.py, line 101, in __init__
   self.topology_template = self._topology_template()
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/tosca_template.py, line 120, in _topology_template
   None)
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/topology_template.py, line 57, in __init__
   self.nodetemplates = self._nodetemplates()
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/topology_template.py, line 92, in _nodetemplates
   self.rel_types)
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/nodetemplate.py, line 43, in __init__
   custom_def)
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/entity_template.py, line 52, in __init__
   if type is not None else None
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/elements/nodetype.py, line 30, in __init__
   super(NodeType, self).__init__(ntype, self.NODE_PREFIX, custom_def)
  File /Users/wliang/tmp/translator/venv/lib/python3.6/site-packages/toscaparser/elements/statefulentitytype.py, line 51, in __init__
   InvalidTypeError(what=entitytype))