Comment 4 for bug 1729312

Revision history for this message
david (davidgab) wrote :

Thanks for your support.
I uninstall tosca-parser module then I run pip command (sudo pip install tosca-parser) to re-install it.
I also update the header of my .yaml file as suggested by Bob.
Now I get a new error as described below:
    tosca = ToscaTemplate(path, parsed_params, a_file)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/tosca_template.py", line 101, in __init__
    self.topology_template = self._topology_template()
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/tosca_template.py", line 120, in _topology_template
    None)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/topology_template.py", line 60, in __init__
    self.graph = ToscaGraph(self.nodetemplates)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/tpl_relationship_graph.py", line 19, in __init__
    self._create()
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/tpl_relationship_graph.py", line 40, in _create
    relation = node.relationships
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/nodetemplate.py", line 61, in relationships
    explicit = self._get_explicit_relationship(r, value)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/nodetemplate.py", line 144, in _get_explicit_relationship
    for rtype in self.type_definition.relationship.keys():
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/elements/nodetype.py", line 89, in relationship
    relatednode = NodeType(node_type, self.custom_def)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/elements/nodetype.py", line 30, in __init__
    super(NodeType, self).__init__(ntype, self.NODE_PREFIX, custom_def)
  File "/usr/local/lib/python2.7/dist-packages/toscaparser/elements/statefulentitytype.py", line 38, in __init__
    if entitytype.startswith(self.TOSCA + ":"):
AttributeError: 'NoneType' object has no attribute 'startswith'

Kindly find bellow my .yaml file in case of further information.

tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: This is a basic example for test
topology_template:

  inputs:
    network_name:
      type: string
      default: admin_internal_net
    odl:
      type: string
      default: 157.159.233.40:8181

  node_templates:

    VM1:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 2
           disk_size: 10 GB
           mem_size: 512 MB
        # Guest Operating System properties
        os:
          properties:
            # host Operating System image properties
            architecture: x86_64
            type: sfc_client
            distribution: ubuntu
            version: 14.04

    VM2:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 2
           disk_size: 10 GB
           mem_size: 512 MB
        # Guest Operating System properties
        os:
          properties:
            # host Operating System image properties
            architecture: x86_64
            type: sfc_client
            distribution: ubuntu
            version: 14.04

    VM3:
      type: tosca.nodes.Compute
      capabilities:
        # Host container properties
        host:
         properties:
           num_cpus: 2
           disk_size: 10 GB
           mem_size: 512 MB
        # Guest Operating System properties
        os:
          properties:
            # host Operating System image properties
            architecture: x86_64
            type: sfc_client
            distribution: ubuntu
            version: 14.04

    my_network:
      type: tosca.nodes.network.Network
      properties:
        network_name: { get_input: network_name }

    my_port1:
      type: tosca.nodes.network.Port
      requirements:
        - binding:
            node: VM1
        - link:
            node: my_network

    my_port2:
      type: tosca.nodes.network.Port
      requirements:
        - binding:
            node: VM2
        - link:
            node: my_network

    my_port3:
      type: tosca.nodes.network.Port
      requirements:
        - binding:
            node: VM3
        - link:
            node: my_network

    VNF1:
      type: tosca.nodes.nfv.VNF
      properties:
      attributes:
        type: dpi
        address: 10.100.0.105
        port: 40000
        nsh_aware: true
      requirements:
        - host: VM1

    CP11: #endpoints of VNF1 linked to VL1
      type: tosca.nodes.nfv.CP
      properties:
      attributes:
        IP_address: 10.100.0.105
        interface: ens3
        port: 30000
      requirements:
        - virtualBinding: VNF1
        - virtualLink: VL1

    VNF2:
      type: tosca.nodes.nfv.VNF
      properties:
      attributes:
        type: firewall
        address: 10.100.0.106
        port: 40000
        nsh_aware: true
      requirements:
        - host: VM2

    CP21: #endpoints of VNF2 linked to VL1
      type: tosca.nodes.nfv.CP
      properties:
      attributes:
        IP_address: 10.100.0.106
        interface: ens3
        port: 30000
      requirements:
        - virtualBinding: VNF2
        - virtualLink: VL1

    VNF3:
      type: tosca.nodes.nfv.VNF
      properties:
      attributes:
        type: napt44
        address: 10.100.0.107
        port: 40000
        nsh_aware: true
      requirements:
        - host: VM3

    CP31: #endpoints of VNF3 linked to VL2
      type: tosca.nodes.nfv.CP
      properties:
      attributes:
        IP_address: 10.100.0.107
        port: 30000
        interface: ens3
      requirements:
        - virtualBinding: VNF3
        - virtualLink: VL1

    VL1:
      type: tosca.nodes.nfv.VL
      properties:
        vendor: HP
      attributes:
        type: ip
        transport_type: vxlan-gpe

    Forwarding_path1:
      type: tosca.nodes.nfv.FP
      description: the path (CP11->CP21->CP31)
      properties:
        policy:
      requirements:
        - forwarder: CP11
        - forwarder: CP21
        - forwarder: CP31

  groups:
    VNF_FG1:
      type: tosca.groups.nfv.VNFFG
      description: VNF forwarding graph
      properties:
        vendor:
        version:
        connection_point: [ CP11, CP21, CP31 ]
        dependent_virtual_link: [ VL1 ]
        constituent_vnfs: [ VNF1, VNF2, VNF3 ]
      members: [ Forwarding_path1 ]

  outputs:
    vnf1_ip:
      description: The private IP address of the VNF container1.
      value: { get_attribute: [VM1, private_address] }
    vnf2_ip:
      description: The private IP address of the VNF container2.
      value: { get_attribute: [VM2, private_address] }
    vnf3_ip:
      description: The private IP address of the VNF container3.
      value: { get_attribute: [VM3, private_address] }