Add placement policies support
- This patch aims to add support for following placement policies in addition to the default 'affinity' policy: anti-affinity soft-affinity soft-anti-affinity - This patch adds respective functional/unit test cases. To test "anti-affinity" policy on the gate, changed the devstack functional jobs `nodeset` from the default single node to "openstack-two-node". - This patch also adds respective documentation and usage guide for the above added policies. Depends-On: I56a9cf4bb553c8026eec73212a3742d5eab17420 Co-Author: tpatil <tushar.vitthal.patil@gmail.com> Implements: blueprint vdu-affinity-policy Change-Id: I18aaa9d00c8539ccc60cb6e70570dee124df70a3
This commit is contained in:
@@ -46,6 +46,7 @@ User Guide
|
|||||||
vnffg_usage_guide.rst
|
vnffg_usage_guide.rst
|
||||||
vnffg_usage_guide_advanced.rst
|
vnffg_usage_guide_advanced.rst
|
||||||
vnfm_usage_guide.rst
|
vnfm_usage_guide.rst
|
||||||
|
placement_policy_usage_guide.rst
|
||||||
|
|
||||||
Feature Documentation
|
Feature Documentation
|
||||||
---------------------
|
---------------------
|
||||||
|
151
doc/source/user/placement_policy_usage_guide.rst
Normal file
151
doc/source/user/placement_policy_usage_guide.rst
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
..
|
||||||
|
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.
|
||||||
|
|
||||||
|
.. _ref-placement:
|
||||||
|
|
||||||
|
====================
|
||||||
|
VDU Placement policy
|
||||||
|
====================
|
||||||
|
|
||||||
|
Openstack nova server groups can be used to control the affinity and
|
||||||
|
anti-affinity scheduling policy for a group of VDU's. Below placement
|
||||||
|
policies are supported::
|
||||||
|
|
||||||
|
Affinity:
|
||||||
|
The policy that forces Nova to hosts the concerned VDUs in a same
|
||||||
|
hypervisor.
|
||||||
|
|
||||||
|
Anti-Affinity:
|
||||||
|
The policy that forces Nova to hosts the concerned VDUs each
|
||||||
|
in a different hypervisor.
|
||||||
|
|
||||||
|
Soft-Affinity:
|
||||||
|
The policy that forces nova about if it is not possible to
|
||||||
|
schedule some VDUs to the same host then the subsequent VDUs will be
|
||||||
|
scheduled together on another host. In this way operator can express a
|
||||||
|
good-to-have relationship between a group of VDUs.
|
||||||
|
|
||||||
|
Soft-Anti-Affinity:
|
||||||
|
The policy that forces nova about if it is not
|
||||||
|
possible to schedule VDUs on different hosts then VDUs might get
|
||||||
|
scheduled on a same host where another VDUs are running from the same
|
||||||
|
group.
|
||||||
|
|
||||||
|
|
||||||
|
TOSCA schema for placement policy
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Tacker defines TOSCA schema for the placement policy as given below:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
tosca.policies.tacker.Placement:
|
||||||
|
derived_from: tosca.policies.Placement
|
||||||
|
description: Defines policy for placement of VDU's.
|
||||||
|
properties:
|
||||||
|
policy:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: affinity
|
||||||
|
constraints:
|
||||||
|
- valid_values: [ affinity, anti-affinity ]
|
||||||
|
description: Placement policy for target VDU's.
|
||||||
|
strict:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
description: If the policy is not mandatory, set this flag to
|
||||||
|
'false'. Setting this flag to 'false' allows the VDU deployment
|
||||||
|
request to continue even if the nova-scheduler fails to assign
|
||||||
|
compute hosts under the policy.
|
||||||
|
targets:
|
||||||
|
type: list
|
||||||
|
entry_schema:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
description: List of VDU's on which placement policy will be applied.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Sample TOSCA with placement policy
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Following TOSCA snippet shows the placement policy used in VNFD, in which vdu1
|
||||||
|
and vdu2 are already defined VDUs.
|
||||||
|
|
||||||
|
**Affinity policy**
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply my placement policy to my applications servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
||||||
|
|
||||||
|
**Anti-Affinity policy**
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply my placement policy to my applications servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
||||||
|
|
||||||
|
**Soft-Affinity policy**
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: affinity
|
||||||
|
strict: false
|
||||||
|
description: Apply my placement policy to my applications servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
||||||
|
|
||||||
|
**Soft-Anti-Affinity policy**
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: false
|
||||||
|
description: Apply my placement policy to my applications servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
||||||
|
|
||||||
|
|
||||||
|
The ``soft`` flag defines the softness of the placement policy.
|
||||||
|
|
||||||
|
|
||||||
|
Deploying placement TOSCA template using Tacker
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Once OpenStack/Devstack along with Tacker has been successfully installed,
|
||||||
|
deploy a sample placement policy template from location given below:
|
||||||
|
https://github.com/openstack/tacker/blob/master/samples/tosca-templates/vnfd/tosca-placement-policy-anti-affinity.yaml
|
||||||
|
|
||||||
|
Refer the 'Getting Started' link below on how to create a VNFD and deploy a
|
||||||
|
VNF:
|
||||||
|
https://docs.openstack.org/tacker/latest/install/getting_started.html
|
@@ -35,7 +35,7 @@ futurist==1.6.0
|
|||||||
google-auth==1.4.1
|
google-auth==1.4.1
|
||||||
greenlet==0.4.13
|
greenlet==0.4.13
|
||||||
hacking==0.12.0
|
hacking==0.12.0
|
||||||
heat-translator==0.4.0
|
heat-translator==1.1.0
|
||||||
idna==2.6
|
idna==2.6
|
||||||
imagesize==1.0.0
|
imagesize==1.0.0
|
||||||
ipaddress==1.0.19
|
ipaddress==1.0.19
|
||||||
|
15
releasenotes/notes/vdu-affinity-policy-673e4dc7b76ef58f.yaml
Normal file
15
releasenotes/notes/vdu-affinity-policy-673e4dc7b76ef58f.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added placement policy support. Operator can specify below placement
|
||||||
|
policies in addition to `affinity` to VDU's:
|
||||||
|
|
||||||
|
* ``anti-affinity``
|
||||||
|
* ``soft-affinity``
|
||||||
|
* ``soft-anti-affinity``
|
||||||
|
|
||||||
|
Note: There is a known issue in nova that `late anti-affinity check`_ doesn't work
|
||||||
|
in multi-cells environment. So it is highly recommended to deploy nova in single cell
|
||||||
|
environment until this issue is resolved in multi-cells environment.
|
||||||
|
|
||||||
|
.. _`late anti-affinity check`: https://docs.openstack.org/nova/pike/user/cellsv2_layout.html#operations-requiring-upcalls
|
@@ -37,7 +37,7 @@ openstackdocstheme>=1.18.1 # Apache-2.0
|
|||||||
python-neutronclient>=6.7.0 # Apache-2.0
|
python-neutronclient>=6.7.0 # Apache-2.0
|
||||||
python-novaclient>=9.1.0 # Apache-2.0
|
python-novaclient>=9.1.0 # Apache-2.0
|
||||||
tosca-parser>=0.8.1 # Apache-2.0
|
tosca-parser>=0.8.1 # Apache-2.0
|
||||||
heat-translator>=0.4.0 # Apache-2.0
|
heat-translator>=1.1.0 # Apache-2.0
|
||||||
cryptography>=2.1 # BSD/Apache-2.0
|
cryptography>=2.1 # BSD/Apache-2.0
|
||||||
paramiko>=2.0.0 # LGPLv2.1+
|
paramiko>=2.0.0 # LGPLv2.1+
|
||||||
pyroute2>=0.4.21;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
|
pyroute2>=0.4.21;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
|
||||||
|
@@ -0,0 +1,76 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
capabilities:
|
||||||
|
nfv_compute:
|
||||||
|
properties:
|
||||||
|
disk_size: 1 GB
|
||||||
|
mem_size: 512 MB
|
||||||
|
num_cpus: 2
|
||||||
|
properties:
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP1:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
capabilities:
|
||||||
|
nfv_compute:
|
||||||
|
properties:
|
||||||
|
disk_size: 1 GB
|
||||||
|
mem_size: 512 MB
|
||||||
|
num_cpus: 2
|
||||||
|
properties:
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP2:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply anti-affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,164 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: anti-affinity-vdu-insufficient-comp-nodes
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP11:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP12:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP13:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: anti-affinity-vdu-insufficient-comp-nodes
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.medium
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP21:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP22:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP23:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VDU3:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: anti-affinity-vdu-insufficient-comp-nodes
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP31:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
CP32:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
CP33:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL3:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net1
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply anti-affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2, VDU3 ]
|
@@ -0,0 +1,120 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: affinity-vdu
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP11:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP12:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP13:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: affinity-vdu
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.medium
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP21:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP22:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP23:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL3:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net1
|
||||||
|
vendor: Tacker
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,120 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: anti-affinity-vdu-multi-comp-nodes
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP11:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP12:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP13:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: anti-affinity-vdu-multi-comp-nodes
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.medium
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP21:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP22:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP23:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL3:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net1
|
||||||
|
vendor: Tacker
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply anti-affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,163 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: invalid-placement-policy-vdu
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP11:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP12:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
CP13:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: invalid-placement-policy-vdu
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.medium
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP21:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP22:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
CP23:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VDU3:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
name: invalid-placement-policy-vdu
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
flavor: m1.tiny
|
||||||
|
availability_zone: nova
|
||||||
|
mgmt_driver: noop
|
||||||
|
config: |
|
||||||
|
param0: key1
|
||||||
|
param1: key2
|
||||||
|
|
||||||
|
CP31:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
CP32:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
CP33:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL3
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU3
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL3:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net1
|
||||||
|
vendor: Tacker
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: invalid
|
||||||
|
strict: true
|
||||||
|
description: Apply invalid placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2, VDU3 ]
|
126
tacker/tests/functional/vnfm/test_vnf_placement_policy.py
Normal file
126
tacker/tests/functional/vnfm/test_vnf_placement_policy.py
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
# Copyright 2018 NTT DATA
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
from tackerclient.common import exceptions
|
||||||
|
|
||||||
|
from tacker.tests import constants
|
||||||
|
from tacker.tests.functional import base
|
||||||
|
from tacker.tests.utils import read_file
|
||||||
|
|
||||||
|
|
||||||
|
class VnfTestCreate(base.BaseTackerTest):
|
||||||
|
def _test_create_delete_vnf(self, vnf_name, vnfd_name,
|
||||||
|
placement_policy, vdu_name,
|
||||||
|
vnf_expected_status="ACTIVE"):
|
||||||
|
data = dict()
|
||||||
|
data['tosca'] = read_file(vnfd_name + '.yaml')
|
||||||
|
toscal = data['tosca']
|
||||||
|
tosca_arg = {'vnfd': {'name': vnfd_name,
|
||||||
|
'attributes': {'vnfd': toscal}}}
|
||||||
|
|
||||||
|
# Create vnfd with tosca template
|
||||||
|
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
|
||||||
|
self.assertIsNotNone(vnfd_instance)
|
||||||
|
|
||||||
|
# Get vnfd_id
|
||||||
|
vnfd_id = vnfd_instance['vnfd']['id']
|
||||||
|
|
||||||
|
# Add vnfd delete to cleanup job so that if vnf_instance fails to
|
||||||
|
# create then it will be cleaned-up automatically in tearDown()
|
||||||
|
self.addCleanup(self.client.delete_vnfd, vnfd_id)
|
||||||
|
|
||||||
|
vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name': vnf_name}}
|
||||||
|
|
||||||
|
# Create vnf instance
|
||||||
|
vnf_instance = self.client.create_vnf(body=vnf_arg)
|
||||||
|
vnf_id = vnf_instance['vnf']['id']
|
||||||
|
|
||||||
|
# Delete vnf_instance after tearDown
|
||||||
|
self.addCleanup(self.wait_until_vnf_delete, vnf_id,
|
||||||
|
constants.VNF_CIRROS_DELETE_TIMEOUT)
|
||||||
|
self.addCleanup(self.client.delete_vnf, vnf_id)
|
||||||
|
|
||||||
|
self.validate_vnf_instance(vnfd_instance, vnf_instance)
|
||||||
|
|
||||||
|
self.wait_until_vnf_status(
|
||||||
|
vnf_id,
|
||||||
|
vnf_expected_status,
|
||||||
|
constants.VNF_CIRROS_CREATE_TIMEOUT,
|
||||||
|
constants.ACTIVE_SLEEP_TIME)
|
||||||
|
|
||||||
|
# VDU names are random generated names with initials of *vnf_name*.
|
||||||
|
# Search the instance_list with *vdu_name* regular expression
|
||||||
|
opts = {
|
||||||
|
"name": vdu_name
|
||||||
|
}
|
||||||
|
compute_hosts = []
|
||||||
|
vm_statuses = []
|
||||||
|
for server in self.novaclient().servers.list(search_opts=opts):
|
||||||
|
instance_host = getattr(server,
|
||||||
|
"OS-EXT-SRV-ATTR:hypervisor_hostname")
|
||||||
|
vm_statuses.append(getattr(server, "status"))
|
||||||
|
compute_hosts.append(instance_host)
|
||||||
|
|
||||||
|
# check vnf placement policies
|
||||||
|
if placement_policy == 'affinity':
|
||||||
|
# check "compute_hosts" is not empty
|
||||||
|
self.assertTrue(compute_hosts)
|
||||||
|
|
||||||
|
# Get the first compute_host on which VDU is deployed and compare
|
||||||
|
# it with other compute hosts of VDU's
|
||||||
|
compute_host = compute_hosts[0]
|
||||||
|
for vnf in compute_hosts:
|
||||||
|
self.assertEqual(compute_host, vnf)
|
||||||
|
elif placement_policy == 'anti-affinity':
|
||||||
|
if vnf_expected_status == "ERROR":
|
||||||
|
# Check one of the VM should be in "ERROR" status
|
||||||
|
# and instance host should be None.
|
||||||
|
self.assertIn("ERROR", vm_statuses)
|
||||||
|
self.assertIn(None, compute_hosts)
|
||||||
|
else:
|
||||||
|
distinct_comp_hosts = set(compute_hosts)
|
||||||
|
self.assertEqual(len(compute_hosts), len(distinct_comp_hosts))
|
||||||
|
|
||||||
|
def test_create_delete_vnf_with_placement_policy_affinity(self):
|
||||||
|
self._test_create_delete_vnf(
|
||||||
|
vnf_name='test_vnf_with_placement_policy_affinity',
|
||||||
|
vnfd_name='sample-tosca-vnfd-placement-policy-affinity',
|
||||||
|
vdu_name='affinity-vdu',
|
||||||
|
placement_policy='affinity')
|
||||||
|
|
||||||
|
def test_create_delete_vnf_with_placement_policy_anti_affinity(self):
|
||||||
|
self._test_create_delete_vnf(
|
||||||
|
vnf_name='test_vnf_with_placement_policy_anti_affinity',
|
||||||
|
vnfd_name='sample-tosca-vnfd-placement-policy-anti-affinity',
|
||||||
|
vdu_name='anti-affinity-vdu-multi-comp-nodes',
|
||||||
|
placement_policy='anti-affinity')
|
||||||
|
|
||||||
|
def test_vnf_with_policy_anti_affinity_insufficient_comp_nodes(self):
|
||||||
|
self._test_create_delete_vnf(
|
||||||
|
vnf_name='test_vnf_anti_affinity_insufficient_comp_nodes',
|
||||||
|
vnfd_name='sample-tosca-vnfd-anti-affinity-multi-vdu',
|
||||||
|
vdu_name='anti-affinity-vdu-insufficient-comp-nodes',
|
||||||
|
placement_policy='anti-affinity',
|
||||||
|
vnf_expected_status="ERROR")
|
||||||
|
|
||||||
|
def test_vnf_with_placement_policy_invalid(self):
|
||||||
|
exc = self.assertRaises(
|
||||||
|
exceptions.InternalServerError,
|
||||||
|
self._test_create_delete_vnf,
|
||||||
|
vnf_name='test_vnf_with_placement_policy_invalid',
|
||||||
|
vnfd_name='sample-tosca-vnfd-placement-policy-invalid',
|
||||||
|
vdu_name='invalid-placement-policy-vdu',
|
||||||
|
placement_policy='invalid')
|
||||||
|
self.assertIn("[u\'invalid\']", exc.message)
|
||||||
|
self.assertIn("is not an allowed value [anti-affinity, affinity, "
|
||||||
|
"soft-anti-affinity, soft-affinity]", exc.message)
|
@@ -0,0 +1,49 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
description: 'Demo example
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
mgmt_ip-VDU1:
|
||||||
|
value:
|
||||||
|
get_attr: [CP1, fixed_ips, 0, ip_address]
|
||||||
|
mgmt_ip-VDU2:
|
||||||
|
value:
|
||||||
|
get_attr: [CP2, fixed_ips, 0, ip_address]
|
||||||
|
parameters: {}
|
||||||
|
resources:
|
||||||
|
VDU1:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP1}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
VDU2:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP2}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
CP1:
|
||||||
|
properties: {network: net_mgmt, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
CP2:
|
||||||
|
properties: {network: net0, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
my_compute_placement_policy:
|
||||||
|
type: OS::Nova::ServerGroup
|
||||||
|
properties:
|
||||||
|
name: my_compute_placement_policy
|
||||||
|
policies: [affinity]
|
@@ -0,0 +1,49 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
description: 'Demo example
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
mgmt_ip-VDU1:
|
||||||
|
value:
|
||||||
|
get_attr: [CP1, fixed_ips, 0, ip_address]
|
||||||
|
mgmt_ip-VDU2:
|
||||||
|
value:
|
||||||
|
get_attr: [CP2, fixed_ips, 0, ip_address]
|
||||||
|
parameters: {}
|
||||||
|
resources:
|
||||||
|
VDU1:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP1}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
VDU2:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP2}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
CP1:
|
||||||
|
properties: {network: net_mgmt, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
CP2:
|
||||||
|
properties: {network: net0, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
my_compute_placement_policy:
|
||||||
|
type: OS::Nova::ServerGroup
|
||||||
|
properties:
|
||||||
|
name: my_compute_placement_policy
|
||||||
|
policies: [anti-affinity]
|
@@ -0,0 +1,49 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
description: 'Demo example
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
mgmt_ip-VDU1:
|
||||||
|
value:
|
||||||
|
get_attr: [CP1, fixed_ips, 0, ip_address]
|
||||||
|
mgmt_ip-VDU2:
|
||||||
|
value:
|
||||||
|
get_attr: [CP2, fixed_ips, 0, ip_address]
|
||||||
|
parameters: {}
|
||||||
|
resources:
|
||||||
|
VDU1:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP1}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
VDU2:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP2}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
CP1:
|
||||||
|
properties: {network: net_mgmt, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
CP2:
|
||||||
|
properties: {network: net0, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
my_compute_placement_policy:
|
||||||
|
type: OS::Nova::ServerGroup
|
||||||
|
properties:
|
||||||
|
name: my_compute_placement_policy
|
||||||
|
policies: [affinity]
|
@@ -0,0 +1,49 @@
|
|||||||
|
heat_template_version: 2013-05-23
|
||||||
|
description: 'Demo example
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
mgmt_ip-VDU1:
|
||||||
|
value:
|
||||||
|
get_attr: [CP1, fixed_ips, 0, ip_address]
|
||||||
|
mgmt_ip-VDU2:
|
||||||
|
value:
|
||||||
|
get_attr: [CP2, fixed_ips, 0, ip_address]
|
||||||
|
parameters: {}
|
||||||
|
resources:
|
||||||
|
VDU1:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP1}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
VDU2:
|
||||||
|
properties:
|
||||||
|
availability_zone: nova
|
||||||
|
config_drive: false
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
networks:
|
||||||
|
- port: {get_resource: CP2}
|
||||||
|
scheduler_hints:
|
||||||
|
group: {get_resource: my_compute_placement_policy}
|
||||||
|
user_data_format: SOFTWARE_CONFIG
|
||||||
|
type: OS::Nova::Server
|
||||||
|
CP1:
|
||||||
|
properties: {network: net_mgmt, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
CP2:
|
||||||
|
properties: {network: net0, port_security_enabled: false}
|
||||||
|
type: OS::Neutron::Port
|
||||||
|
my_compute_placement_policy:
|
||||||
|
type: OS::Nova::ServerGroup
|
||||||
|
properties:
|
||||||
|
name: my_compute_placement_policy
|
||||||
|
policies: [soft-anti-affinity]
|
@@ -0,0 +1,66 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP1:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP2:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,66 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP1:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP2:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: true
|
||||||
|
description: Apply anti-affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,63 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP1:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP2:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
description: Apply default placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -0,0 +1,66 @@
|
|||||||
|
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||||
|
description: Demo example
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
template_name: sample-tosca-vnfd
|
||||||
|
|
||||||
|
topology_template:
|
||||||
|
node_templates:
|
||||||
|
VDU1:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP1:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL1
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU1
|
||||||
|
|
||||||
|
VDU2:
|
||||||
|
type: tosca.nodes.nfv.VDU.Tacker
|
||||||
|
properties:
|
||||||
|
flavor: m1.tiny
|
||||||
|
image: cirros-0.3.5-x86_64-disk
|
||||||
|
mgmt_driver: noop
|
||||||
|
availability_zone: nova
|
||||||
|
|
||||||
|
CP2:
|
||||||
|
type: tosca.nodes.nfv.CP.Tacker
|
||||||
|
properties:
|
||||||
|
management: true
|
||||||
|
anti_spoofing_protection: false
|
||||||
|
requirements:
|
||||||
|
- virtualLink:
|
||||||
|
node: VL2
|
||||||
|
- virtualBinding:
|
||||||
|
node: VDU2
|
||||||
|
|
||||||
|
VL1:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net_mgmt
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
VL2:
|
||||||
|
type: tosca.nodes.nfv.VL
|
||||||
|
properties:
|
||||||
|
network_name: net0
|
||||||
|
vendor: Tacker
|
||||||
|
|
||||||
|
policies:
|
||||||
|
- my_compute_placement_policy:
|
||||||
|
type: tosca.policies.tacker.Placement
|
||||||
|
properties:
|
||||||
|
policy: anti-affinity
|
||||||
|
strict: false
|
||||||
|
description: Apply anti-affinity placement policy to the application servers
|
||||||
|
targets: [ VDU1, VDU2 ]
|
@@ -323,6 +323,26 @@ class TestOpenStack(base.TestCase):
|
|||||||
'test_tosca_flavor_defaults.yaml',
|
'test_tosca_flavor_defaults.yaml',
|
||||||
'hot_flavor_defaults.yaml')
|
'hot_flavor_defaults.yaml')
|
||||||
|
|
||||||
|
def test_create_tosca_with_placement_policy_anti_affinity(self):
|
||||||
|
self._test_assert_equal_for_tosca_templates(
|
||||||
|
'tosca_placement_policy_anti_affinity.yaml',
|
||||||
|
'hot_placement_policy_anti_affinity.yaml', is_monitor=False)
|
||||||
|
|
||||||
|
def test_create_tosca_with_placement_policy_affinity(self):
|
||||||
|
self._test_assert_equal_for_tosca_templates(
|
||||||
|
'tosca_placement_policy_affinity.yaml',
|
||||||
|
'hot_placement_policy_affinity.yaml', is_monitor=False)
|
||||||
|
|
||||||
|
def test_create_tosca_with_placement_policy_soft_anti_affinity(self):
|
||||||
|
self._test_assert_equal_for_tosca_templates(
|
||||||
|
'tosca_placement_policy_soft_anti_affinity.yaml',
|
||||||
|
'hot_placement_policy_soft_anti_affinity.yaml', is_monitor=False)
|
||||||
|
|
||||||
|
def test_create_tosca_with_placement_policy_default_affinity(self):
|
||||||
|
self._test_assert_equal_for_tosca_templates(
|
||||||
|
'tosca_placement_policy_default_affinity.yaml',
|
||||||
|
'hot_placement_policy_default_affinity.yaml', is_monitor=False)
|
||||||
|
|
||||||
def test_create_tosca_with_flavor_and_capabilities(self):
|
def test_create_tosca_with_flavor_and_capabilities(self):
|
||||||
self._test_assert_equal_for_tosca_templates(
|
self._test_assert_equal_for_tosca_templates(
|
||||||
'test_tosca_flavor_and_capabilities.yaml',
|
'test_tosca_flavor_and_capabilities.yaml',
|
||||||
|
@@ -201,7 +201,21 @@ data_types:
|
|||||||
|
|
||||||
policy_types:
|
policy_types:
|
||||||
tosca.policies.tacker.Placement:
|
tosca.policies.tacker.Placement:
|
||||||
derived_from: tosca.policies.Root
|
derived_from: tosca.policies.Placement
|
||||||
|
description: Defines policy for placement of VDU's.
|
||||||
|
properties:
|
||||||
|
policy:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
constraints:
|
||||||
|
- valid_values: [ affinity, anti-affinity ]
|
||||||
|
default: affinity
|
||||||
|
description: Placement policy for target VDU's.
|
||||||
|
strict:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
description: If the policy is not mandatory, set this flag to 'false'. Setting this flag to 'false' allows the VDU deployment request to continue even if the nova-scheduler fails to assign compute hosts under the policy.
|
||||||
|
|
||||||
tosca.policies.tacker.Failure:
|
tosca.policies.tacker.Failure:
|
||||||
derived_from: tosca.policies.Root
|
derived_from: tosca.policies.Root
|
||||||
|
Reference in New Issue
Block a user