Added PT to openstack connector. Additional tests included 22/1422/2
authorPablo Montes Moreno <pablo.montesmoreno@telefonica.com>
Thu, 30 Mar 2017 11:22:15 +0000 (13:22 +0200)
committerPablo Montes Moreno <pablo.montesmoreno@telefonica.com>
Fri, 31 Mar 2017 09:45:23 +0000 (11:45 +0200)
Change-Id: I20e32a6a6206709580cf40d8699e59cd13c668fd
Signed-off-by: Pablo Montes Moreno <pablo.montesmoreno@telefonica.com>
12 files changed:
test/RO_tests/passthrough/scenario_p2p_passthrough.yaml [new file with mode: 0644]
test/RO_tests/passthrough/vnfd_1passthrough.yaml [new file with mode: 0644]
test/RO_tests/pmp_sriov_passthrough/scenario_pmp_sriov_passthrough.yaml [new file with mode: 0644]
test/RO_tests/pmp_sriov_passthrough/vnfd_1passthrough.yaml [new file with mode: 0644]
test/RO_tests/pmp_sriov_passthrough/vnfd_1sriov.yaml [new file with mode: 0644]
test/RO_tests/simple_2_vnf/scenario_simple_2_vnf.yaml [new file with mode: 0644]
test/RO_tests/simple_2_vnf/vnfd_linux.yaml [new file with mode: 0644]
test/RO_tests/sriov_passthrough/scenario_p2p_sriov_passthrough.yaml [new file with mode: 0644]
test/RO_tests/sriov_passthrough/vnfd_1passthrough.yaml [new file with mode: 0644]
test/RO_tests/sriov_passthrough/vnfd_1sriov.yaml [new file with mode: 0644]
test/test_RO.py
vimconn_openstack.py

diff --git a/test/RO_tests/passthrough/scenario_p2p_passthrough.yaml b/test/RO_tests/passthrough/scenario_p2p_passthrough.yaml
new file mode 100644 (file)
index 0000000..ed6b53a
--- /dev/null
@@ -0,0 +1,41 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+schema_version:  2
+scenario:
+  name:          p2p_passthrough
+  description:   Network scenario consisting of two machines with a sr-iov interconnected between them
+  vnfs: 
+    passthrough1:                   # vnf/net name in the scenario
+      vnf_name:  passthrough        # VNF name as introduced in OPENMANO DB
+    passthrough2:                   # vnf/net name in the scenario
+      vnf_name:  passthrough        # VNF name as introduced in OPENMANO DB
+  networks: 
+    mgmt:                   # provide a name for this net or connection
+      external:  true
+      interfaces: 
+      - passthrough1:  eth0       # Node and its interface
+      - passthrough2:  eth0       # Node and its interface
+    dataplane:                   # provide a name for this net or connection
+      interfaces: 
+      - passthrough1:  xe0       # Node and its interface
+      - passthrough2:  xe0       # Node and its interface
+
diff --git a/test/RO_tests/passthrough/vnfd_1passthrough.yaml b/test/RO_tests/passthrough/vnfd_1passthrough.yaml
new file mode 100644 (file)
index 0000000..94784d5
--- /dev/null
@@ -0,0 +1,53 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        passthrough
+    description: Machine with EPA and a SR-IOV interface
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              passthrough-VM
+        local_iface_name:  eth0
+        description:       management interface
+    -   name:              xe0
+        type:              data
+        VNFC:              passthrough-VM
+        local_iface_name:  xe0
+        description:       Dataplane interface
+    VNFC:
+    -   name:        passthrough-VM
+        description: Machine with EPA and a SR-IOV interface
+        image name:  centos
+        disk: 20
+        numas: 
+        -   threads: 1          # "cores", "paired-threads", "threads"
+            memory: 1                 # GBytes
+            interfaces:
+            -   name:      xe0
+                vpci:      "0000:00:11.0"
+                dedicated: "yes"         # "yes"(passthrough), "no"(sriov with vlan tags), "yes:sriov"(sriovi, but exclusive and without vlan tag)
+                bandwidth: 1 Gbps
+
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:0a.0"
+
diff --git a/test/RO_tests/pmp_sriov_passthrough/scenario_pmp_sriov_passthrough.yaml b/test/RO_tests/pmp_sriov_passthrough/scenario_pmp_sriov_passthrough.yaml
new file mode 100644 (file)
index 0000000..4b917d9
--- /dev/null
@@ -0,0 +1,50 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+schema_version:  2
+scenario:
+  name:          p2p_sriov_passthrough
+  description:   Network scenario consisting of two machines with a sr-iov interconnected between them
+  vnfs: 
+    sriov1:                   # vnf/net name in the scenario
+      vnf_name:  sriov        # VNF name as introduced in OPENMANO DB
+    passthrough1:                   # vnf/net name in the scenario
+      vnf_name:  passthrough        # VNF name as introduced in OPENMANO DB
+    sriov2:                   # vnf/net name in the scenario
+      vnf_name:  sriov        # VNF name as introduced in OPENMANO DB
+    passthrough2:                   # vnf/net name in the scenario
+      vnf_name:  passthrough        # VNF name as introduced in OPENMANO DB
+
+  networks: 
+    mgmt:                   # provide a name for this net or connection
+      external:  true
+      interfaces: 
+      - sriov1:  eth0       # Node and its interface
+      - passthrough1:  eth0       # Node and its interface
+      - sriov2:  eth0       # Node and its interface
+      - passthrough2:  eth0       # Node and its interface
+    dataplane:                   # provide a name for this net or connection
+      interfaces: 
+      - sriov1:  xe0       # Node and its interface
+      - passthrough1:  xe0       # Node and its interface
+      - sriov2:  xe0       # Node and its interface
+      - passthrough2:  xe0       # Node and its interface
+
diff --git a/test/RO_tests/pmp_sriov_passthrough/vnfd_1passthrough.yaml b/test/RO_tests/pmp_sriov_passthrough/vnfd_1passthrough.yaml
new file mode 100644 (file)
index 0000000..94784d5
--- /dev/null
@@ -0,0 +1,53 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        passthrough
+    description: Machine with EPA and a SR-IOV interface
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              passthrough-VM
+        local_iface_name:  eth0
+        description:       management interface
+    -   name:              xe0
+        type:              data
+        VNFC:              passthrough-VM
+        local_iface_name:  xe0
+        description:       Dataplane interface
+    VNFC:
+    -   name:        passthrough-VM
+        description: Machine with EPA and a SR-IOV interface
+        image name:  centos
+        disk: 20
+        numas: 
+        -   threads: 1          # "cores", "paired-threads", "threads"
+            memory: 1                 # GBytes
+            interfaces:
+            -   name:      xe0
+                vpci:      "0000:00:11.0"
+                dedicated: "yes"         # "yes"(passthrough), "no"(sriov with vlan tags), "yes:sriov"(sriovi, but exclusive and without vlan tag)
+                bandwidth: 1 Gbps
+
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:0a.0"
+
diff --git a/test/RO_tests/pmp_sriov_passthrough/vnfd_1sriov.yaml b/test/RO_tests/pmp_sriov_passthrough/vnfd_1sriov.yaml
new file mode 100644 (file)
index 0000000..e424b02
--- /dev/null
@@ -0,0 +1,53 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        sriov
+    description: Machine with EPA and a SR-IOV interface
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              sriov-VM
+        local_iface_name:  eth0
+        description:       management interface
+    -   name:              xe0
+        type:              data
+        VNFC:              sriov-VM
+        local_iface_name:  xe0
+        description:       Dataplane interface
+    VNFC:
+    -   name:        sriov-VM
+        description: Machine with EPA and a SR-IOV interface
+        image name:  centos
+        disk: 20
+        numas: 
+        -   threads: 1          # "cores", "paired-threads", "threads"
+            memory: 1                 # GBytes
+            interfaces:
+            -   name:      xe0
+                vpci:      "0000:00:11.0"
+                dedicated: "no"         # "yes"(passthrough), "no"(sriov with vlan tags), "yes:sriov"(sriovi, but exclusive and without vlan tag)
+                bandwidth: 1 Gbps
+
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:0a.0"
+
diff --git a/test/RO_tests/simple_2_vnf/scenario_simple_2_vnf.yaml b/test/RO_tests/simple_2_vnf/scenario_simple_2_vnf.yaml
new file mode 100644 (file)
index 0000000..95b338b
--- /dev/null
@@ -0,0 +1,37 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+schema_version:  2
+scenario:
+  name:          simple
+  description:   Simple network scenario consisting of two VNF connected to an external network
+  vnfs: 
+    linux1:                   # vnf/net name in the scenario
+      vnf_name:  linux        # VNF name as introduced in OPENMANO DB
+    linux2:                   # vnf/net name in the scenario
+      vnf_name:  linux        # VNF name as introduced in OPENMANO DB
+  networks: 
+    mgmt:                   # provide a name for this net or connection
+      external:  true
+      interfaces: 
+      - linux1:  eth0       # Node and its interface
+      - linux2:  eth0       # Node and its interface
+
diff --git a/test/RO_tests/simple_2_vnf/vnfd_linux.yaml b/test/RO_tests/simple_2_vnf/vnfd_linux.yaml
new file mode 100644 (file)
index 0000000..47c8498
--- /dev/null
@@ -0,0 +1,42 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        linux
+    description: Single-VM VNF with a traditional cloud VM based on generic Linux OS
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              linux-VM
+        local_iface_name:  eth0
+        description:       General purpose interface
+    VNFC:
+    -   name:        linux-VM
+        description: Generic Linux Virtual Machine
+        #Copy the image to a compute path and edit this path
+        image name:  image_name.qcow2
+        vcpus: 1          # Only for traditional cloud VMs. Number of virtual CPUs (oversubscription is allowed).
+        ram: 1024         # Only for traditional cloud VMs. Memory in MBytes (not from hugepages, oversubscription is allowed)
+        disk: 10
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:11.0"
+        numas: []
diff --git a/test/RO_tests/sriov_passthrough/scenario_p2p_sriov_passthrough.yaml b/test/RO_tests/sriov_passthrough/scenario_p2p_sriov_passthrough.yaml
new file mode 100644 (file)
index 0000000..49d1a2b
--- /dev/null
@@ -0,0 +1,41 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+schema_version:  2
+scenario:
+  name:          p2p_sriov_passthrough
+  description:   Network scenario consisting of two machines with a sr-iov interconnected between them
+  vnfs: 
+    sriov:                   # vnf/net name in the scenario
+      vnf_name:  sriov        # VNF name as introduced in OPENMANO DB
+    passthrough:                   # vnf/net name in the scenario
+      vnf_name:  passthrough        # VNF name as introduced in OPENMANO DB
+  networks: 
+    mgmt:                   # provide a name for this net or connection
+      external:  true
+      interfaces: 
+      - sriov:  eth0       # Node and its interface
+      - passthrough:  eth0       # Node and its interface
+    dataplane:                   # provide a name for this net or connection
+      interfaces: 
+      - sriov:  xe0       # Node and its interface
+      - passthrough:  xe0       # Node and its interface
+
diff --git a/test/RO_tests/sriov_passthrough/vnfd_1passthrough.yaml b/test/RO_tests/sriov_passthrough/vnfd_1passthrough.yaml
new file mode 100644 (file)
index 0000000..94784d5
--- /dev/null
@@ -0,0 +1,53 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        passthrough
+    description: Machine with EPA and a SR-IOV interface
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              passthrough-VM
+        local_iface_name:  eth0
+        description:       management interface
+    -   name:              xe0
+        type:              data
+        VNFC:              passthrough-VM
+        local_iface_name:  xe0
+        description:       Dataplane interface
+    VNFC:
+    -   name:        passthrough-VM
+        description: Machine with EPA and a SR-IOV interface
+        image name:  centos
+        disk: 20
+        numas: 
+        -   threads: 1          # "cores", "paired-threads", "threads"
+            memory: 1                 # GBytes
+            interfaces:
+            -   name:      xe0
+                vpci:      "0000:00:11.0"
+                dedicated: "yes"         # "yes"(passthrough), "no"(sriov with vlan tags), "yes:sriov"(sriovi, but exclusive and without vlan tag)
+                bandwidth: 1 Gbps
+
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:0a.0"
+
diff --git a/test/RO_tests/sriov_passthrough/vnfd_1sriov.yaml b/test/RO_tests/sriov_passthrough/vnfd_1sriov.yaml
new file mode 100644 (file)
index 0000000..e424b02
--- /dev/null
@@ -0,0 +1,53 @@
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+---
+vnf:
+    name:        sriov
+    description: Machine with EPA and a SR-IOV interface
+    external-connections:
+    -   name:              eth0
+        type:              bridge
+        VNFC:              sriov-VM
+        local_iface_name:  eth0
+        description:       management interface
+    -   name:              xe0
+        type:              data
+        VNFC:              sriov-VM
+        local_iface_name:  xe0
+        description:       Dataplane interface
+    VNFC:
+    -   name:        sriov-VM
+        description: Machine with EPA and a SR-IOV interface
+        image name:  centos
+        disk: 20
+        numas: 
+        -   threads: 1          # "cores", "paired-threads", "threads"
+            memory: 1                 # GBytes
+            interfaces:
+            -   name:      xe0
+                vpci:      "0000:00:11.0"
+                dedicated: "no"         # "yes"(passthrough), "no"(sriov with vlan tags), "yes:sriov"(sriovi, but exclusive and without vlan tag)
+                bandwidth: 1 Gbps
+
+        bridge-ifaces:
+        -   name:      eth0
+            vpci:      "0000:00:0a.0"
+
index 3da3c31..dd69c2a 100755 (executable)
@@ -49,13 +49,14 @@ global test_directory
 global scenario_test_folder
 global test_image_name
 global management_network
+global manual
 
 def check_instance_scenario_active(uuid):
     instance = client.get_instance(uuid=uuid)
 
     for net in instance['nets']:
         status = net['status']
-        if status != 'ACTIVE':
+        if status != 'BUILD':
             return (False, status)
 
     for vnf in instance['vnfs']:
@@ -456,6 +457,10 @@ class descriptor_based_scenario_test(unittest.TestCase):
                                                            scenario_test_folder)
         self.__class__.test_index += 1
 
+        if manual:
+            raw_input('Scenario has been deployed. Perform manual check and press any key to resume')
+            return
+
         keep_waiting = 50
         instance_active = False
         while(keep_waiting):
@@ -518,6 +523,7 @@ if __name__=="__main__":
                       default=default_logger_file)
     parser.add_option('--list-tests', help='List all available tests', dest='list-tests', action="store_true",
                       default=False)
+    parser.add_option('-m', '--manual-check', help='Pause execution once deployed to allow manual checking of the deployed instance scenario', dest='manual', action="store_true", default=False)
     parser.add_option('--test', '--tests', help='Specify the tests to run', dest='tests', default=None)
 
     #Mandatory arguments
@@ -593,6 +599,7 @@ if __name__=="__main__":
     # set test image name and management network
     test_image_name = options.__dict__['image-name']
     management_network = options.__dict__['mgmt-net']
+    manual = options.__dict__['manual']
 
     #Create the list of tests to be run
     descriptor_based_tests = []
index 9b9a2c0..35cffae 100644 (file)
@@ -552,10 +552,10 @@ class vimconnector(vimconn.vimconnector):
                             elif 'threads' in numa:
                                 vcpus = numa['threads']
                                 numa_properties["hw:cpu_policy"] = "isolated"
-                            for interface in numa.get("interfaces",() ):
-                                if interface["dedicated"]=="yes":
-                                    raise vimconn.vimconnException("Passthrough interfaces are not supported for the openstack connector", http_code=vimconn.HTTP_Service_Unavailable)
-                                #TODO, add the key 'pci_passthrough:alias"="<label at config>:<number ifaces>"' when a way to connect it is available
+                            for interface in numa.get("interfaces",() ):
+                                if interface["dedicated"]=="yes":
+                                    raise vimconn.vimconnException("Passthrough interfaces are not supported for the openstack connector", http_code=vimconn.HTTP_Service_Unavailable)
+                                #TODO, add the key 'pci_passthrough:alias"="<label at config>:<number ifaces>"' when a way to connect it is available
                                 
                 #create flavor                 
                 new_flavor=self.nova.flavors.create(name, 
@@ -733,35 +733,39 @@ class vimconnector(vimconn.vimconnector):
             for net in net_list:
                 if not net.get("net_id"): #skip non connected iface
                     continue
-                if net["type"]=="virtual" or net["type"]=="VF":
-                    port_dict={
-                        "network_id": net["net_id"],
-                        "name": net.get("name"),
-                        "admin_state_up": True
-                    }    
-                    if net["type"]=="virtual":
-                        if "vpci" in net:
-                            metadata_vpci[ net["net_id"] ] = [[ net["vpci"], "" ]]
-                    else: # for VF
-                        if "vpci" in net:
-                            if "VF" not in metadata_vpci:
-                                metadata_vpci["VF"]=[]
-                            metadata_vpci["VF"].append([ net["vpci"], "" ])
-                        port_dict["binding:vnic_type"]="direct"
-                    if not port_dict["name"]:
-                        port_dict["name"]=name
-                    if net.get("mac_address"):
-                        port_dict["mac_address"]=net["mac_address"]
-                    if net.get("port_security") == False:
-                        port_dict["port_security_enabled"]=net["port_security"]
-                    new_port = self.neutron.create_port({"port": port_dict })
-                    net["mac_adress"] = new_port["port"]["mac_address"]
-                    net["vim_id"] = new_port["port"]["id"]
-                    net["ip"] = new_port["port"].get("fixed_ips", [{}])[0].get("ip_address")
-                    net_list_vim.append({"port-id": new_port["port"]["id"]})
-                else:   # for PF
-                    self.logger.warn("new_vminstance: Warning, can not connect a passthrough interface ")
-                    #TODO insert this when openstack consider passthrough ports as openstack neutron ports
+
+                port_dict={
+                    "network_id": net["net_id"],
+                    "name": net.get("name"),
+                    "admin_state_up": True
+                }
+                if net["type"]=="virtual":
+                    if "vpci" in net:
+                        metadata_vpci[ net["net_id"] ] = [[ net["vpci"], "" ]]
+                elif net["type"]=="VF": # for VF
+                    if "vpci" in net:
+                        if "VF" not in metadata_vpci:
+                            metadata_vpci["VF"]=[]
+                        metadata_vpci["VF"].append([ net["vpci"], "" ])
+                    port_dict["binding:vnic_type"]="direct"
+                else: #For PT
+                    if "vpci" in net:
+                        if "PF" not in metadata_vpci:
+                            metadata_vpci["PF"]=[]
+                        metadata_vpci["PF"].append([ net["vpci"], "" ])
+                    port_dict["binding:vnic_type"]="direct-physical"
+                if not port_dict["name"]:
+                    port_dict["name"]=name
+                if net.get("mac_address"):
+                    port_dict["mac_address"]=net["mac_address"]
+                if net.get("port_security") == False:
+                    port_dict["port_security_enabled"]=net["port_security"]
+                new_port = self.neutron.create_port({"port": port_dict })
+                net["mac_adress"] = new_port["port"]["mac_address"]
+                net["vim_id"] = new_port["port"]["id"]
+                net["ip"] = new_port["port"].get("fixed_ips", [{}])[0].get("ip_address")
+                net_list_vim.append({"port-id": new_port["port"]["id"]})
+
                 if net.get('floating_ip', False):
                     net['exit_on_floating_ip_error'] = True
                     external_network.append(net)
@@ -1139,8 +1143,10 @@ class vimconnector(vimconn.vimconnector):
                             # interface["pci"] = pci[:-4] + "00." + str(int(pci[-1]) % 2)
                             interface["pci"] = pci
                         interface["vlan"] = None
+                        #if network is of type vlan and port is of type direct (sr-iov) then set vlan id
                         network = self.neutron.show_network(port["network_id"])
-                        if network['network'].get('provider:network_type') == 'vlan':
+                        if network['network'].get('provider:network_type') == 'vlan' and \
+                            port.get("binding:vnic_type") == "direct":
                             interface["vlan"] = network['network'].get('provider:segmentation_id')
                         ips=[]
                         #look for floating ip address