From 3be0b2a647d8791486ee320d4e76569e87fd2126 Mon Sep 17 00:00:00 2001 From: Pablo Montes Moreno Date: Thu, 30 Mar 2017 13:22:15 +0200 Subject: [PATCH] Added PT to openstack connector. Additional tests included Change-Id: I20e32a6a6206709580cf40d8699e59cd13c668fd Signed-off-by: Pablo Montes Moreno --- .../passthrough/scenario_p2p_passthrough.yaml | 41 ++++++++++ .../passthrough/vnfd_1passthrough.yaml | 53 +++++++++++++ .../scenario_pmp_sriov_passthrough.yaml | 50 +++++++++++++ .../vnfd_1passthrough.yaml | 53 +++++++++++++ .../pmp_sriov_passthrough/vnfd_1sriov.yaml | 53 +++++++++++++ .../simple_2_vnf/scenario_simple_2_vnf.yaml | 37 ++++++++++ test/RO_tests/simple_2_vnf/vnfd_linux.yaml | 42 +++++++++++ .../scenario_p2p_sriov_passthrough.yaml | 41 ++++++++++ .../sriov_passthrough/vnfd_1passthrough.yaml | 53 +++++++++++++ .../sriov_passthrough/vnfd_1sriov.yaml | 53 +++++++++++++ test/test_RO.py | 9 ++- vimconn_openstack.py | 74 ++++++++++--------- 12 files changed, 524 insertions(+), 35 deletions(-) create mode 100644 test/RO_tests/passthrough/scenario_p2p_passthrough.yaml create mode 100644 test/RO_tests/passthrough/vnfd_1passthrough.yaml create mode 100644 test/RO_tests/pmp_sriov_passthrough/scenario_pmp_sriov_passthrough.yaml create mode 100644 test/RO_tests/pmp_sriov_passthrough/vnfd_1passthrough.yaml create mode 100644 test/RO_tests/pmp_sriov_passthrough/vnfd_1sriov.yaml create mode 100644 test/RO_tests/simple_2_vnf/scenario_simple_2_vnf.yaml create mode 100644 test/RO_tests/simple_2_vnf/vnfd_linux.yaml create mode 100644 test/RO_tests/sriov_passthrough/scenario_p2p_sriov_passthrough.yaml create mode 100644 test/RO_tests/sriov_passthrough/vnfd_1passthrough.yaml create mode 100644 test/RO_tests/sriov_passthrough/vnfd_1sriov.yaml diff --git a/test/RO_tests/passthrough/scenario_p2p_passthrough.yaml b/test/RO_tests/passthrough/scenario_p2p_passthrough.yaml new file mode 100644 index 00000000..ed6b53a4 --- /dev/null +++ b/test/RO_tests/passthrough/scenario_p2p_passthrough.yaml @@ -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 index 00000000..94784d5d --- /dev/null +++ b/test/RO_tests/passthrough/vnfd_1passthrough.yaml @@ -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 index 00000000..4b917d9f --- /dev/null +++ b/test/RO_tests/pmp_sriov_passthrough/scenario_pmp_sriov_passthrough.yaml @@ -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 index 00000000..94784d5d --- /dev/null +++ b/test/RO_tests/pmp_sriov_passthrough/vnfd_1passthrough.yaml @@ -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 index 00000000..e424b027 --- /dev/null +++ b/test/RO_tests/pmp_sriov_passthrough/vnfd_1sriov.yaml @@ -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 index 00000000..95b338b0 --- /dev/null +++ b/test/RO_tests/simple_2_vnf/scenario_simple_2_vnf.yaml @@ -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 index 00000000..47c84984 --- /dev/null +++ b/test/RO_tests/simple_2_vnf/vnfd_linux.yaml @@ -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 index 00000000..49d1a2be --- /dev/null +++ b/test/RO_tests/sriov_passthrough/scenario_p2p_sriov_passthrough.yaml @@ -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 index 00000000..94784d5d --- /dev/null +++ b/test/RO_tests/sriov_passthrough/vnfd_1passthrough.yaml @@ -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 index 00000000..e424b027 --- /dev/null +++ b/test/RO_tests/sriov_passthrough/vnfd_1sriov.yaml @@ -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/test_RO.py b/test/test_RO.py index 3da3c314..dd69c2a7 100755 --- a/test/test_RO.py +++ b/test/test_RO.py @@ -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 = [] diff --git a/vimconn_openstack.py b/vimconn_openstack.py index 9b9a2c0f..35cffaea 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -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"="