diff --git a/doc/source/devref/vnfd_template_description.rst b/doc/source/devref/vnfd_template_description.rst index 90d973262..acadcf2dd 100644 --- a/doc/source/devref/vnfd_template_description.rst +++ b/doc/source/devref/vnfd_template_description.rst @@ -352,6 +352,8 @@ VDU1 in this order. Also CP1/CP2 are connected to VL1/VL2 respectively. CP1: type: tosca.nodes.nfv.CP.Tacker properties: + mac_address: fa:40:08:a0:de:0a + ip_address: 10.10.1.12 type: vnic anti_spoofing_protection: false management: true @@ -419,6 +421,10 @@ VDU1 in this order. Also CP1/CP2 are connected to VL1/VL2 respectively. | | | | | associated with | | | | | | the CP | +-------------------------+--------+-------+-----------+----------------------+ +| mac_address | No |String | None | The MAC address | ++-------------------------+--------+-------+-----------+----------------------+ +| ip _address | No |String | None | The IP address | ++-------------------------+--------+-------+-----------+----------------------+ :requirements: diff --git a/releasenotes/notes/vnfd-ip-mac-address-c77830611ff1cb89.yaml b/releasenotes/notes/vnfd-ip-mac-address-c77830611ff1cb89.yaml new file mode 100644 index 000000000..854456840 --- /dev/null +++ b/releasenotes/notes/vnfd-ip-mac-address-c77830611ff1cb89.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add mac_address support in CP's properties. diff --git a/samples/tosca-templates/vnfd/tosca-vnfd-mac-ip.yaml b/samples/tosca-templates/vnfd/tosca-vnfd-mac-ip.yaml new file mode 100644 index 000000000..e1c239833 --- /dev/null +++ b/samples/tosca-templates/vnfd/tosca-vnfd-mac-ip.yaml @@ -0,0 +1,45 @@ +tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 + +description: Demo example with key_name + +metadata: + template_name: sample-tosca-vnfd-keyname + +topology_template: + node_templates: + VDU1: + type: tosca.nodes.nfv.VDU.Tacker + capabilities: + nfv_compute: + properties: + num_cpus: 1 + mem_size: 512 MB + disk_size: 1 GB + properties: + image: cirros-0.3.4-x86_64-uec + availability_zone: nova + mgmt_driver: noop + key_name: userKey + config: | + param0: key1 + param1: key2 + + CP1: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + mac_address: 6c:40:08:a0:de:0a + ip_address: 10.10.1.12 + order: 0 + anti_spoofing_protection: false + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU1 + + VL1: + type: tosca.nodes.nfv.VL + properties: + network_name: net1 + vendor: Tacker diff --git a/tacker/tests/unit/vm/infra_drivers/openstack/data/hot_tosca_mac_ip.yaml b/tacker/tests/unit/vm/infra_drivers/openstack/data/hot_tosca_mac_ip.yaml new file mode 100644 index 000000000..0221a9558 --- /dev/null +++ b/tacker/tests/unit/vm/infra_drivers/openstack/data/hot_tosca_mac_ip.yaml @@ -0,0 +1,37 @@ +heat_template_version: 2013-05-23 + +description: > + SecurityGroup Template + +outputs: + mgmt_ip-VDU1: + value: + get_attr: [CP1, fixed_ips, 0, ip_address] + +parameters: {} +resources: + VDU1: + type: OS::Nova::Server + properties: + config_drive: false + flavor: m1.nano + image: {get_resource: VDU1_image} + networks: + - port: + get_resource: CP1 + user_data_format: SOFTWARE_CONFIG + CP1: + type: OS::Neutron::Port + properties: + network: existing_network_1 + port_security_enabled: true + mac_address: fe:1a:29:d9:36:43 + fixed_ips: + - ip_address: 10.10.1.12 + VDU1_image: + type: OS::Glance::Image + properties: + container_format: bare + disk_format: raw + location: http://URL/vRouterVNF.qcow2 + name: vm_image diff --git a/tacker/tests/unit/vm/infra_drivers/openstack/data/test_tosca_mac_ip.yaml b/tacker/tests/unit/vm/infra_drivers/openstack/data/test_tosca_mac_ip.yaml new file mode 100644 index 000000000..0cd5f3fe9 --- /dev/null +++ b/tacker/tests/unit/vm/infra_drivers/openstack/data/test_tosca_mac_ip.yaml @@ -0,0 +1,45 @@ +tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 + +description: SecurityGroup Template + +metadata: + template_name: SecurityGroup + +topology_template: + node_templates: + + VDU1: + type: tosca.nodes.nfv.VDU.Tacker + artifacts: + vm_image: + type: tosca.artifacts.Deployment.Image.VM + file: http://URL/vRouterVNF.qcow2 + properties: + flavor: m1.nano + mgmt_driver: noop + monitoring_policy: + name: ping + actions: + failure: respawn + parameters: + count: 3 + interval: 10 + + CP1: + type: tosca.nodes.nfv.CP.Tacker + properties: + management: true + anti_spoofing_protection: true + mac_address: fe:1a:29:d9:36:43 + ip_address: 10.10.1.12 + requirements: + - virtualLink: + node: VL1 + - virtualBinding: + node: VDU1 + + VL1: + type: tosca.nodes.nfv.VL + properties: + network_name: existing_network_1 + vendor: ACME diff --git a/tacker/tests/unit/vm/infra_drivers/openstack/test_openstack.py b/tacker/tests/unit/vm/infra_drivers/openstack/test_openstack.py index 4dafe065b..ea58e037a 100644 --- a/tacker/tests/unit/vm/infra_drivers/openstack/test_openstack.py +++ b/tacker/tests/unit/vm/infra_drivers/openstack/test_openstack.py @@ -451,3 +451,9 @@ class TestOpenStack(base.TestCase): 'test_tosca_security_groups.yaml', 'hot_tosca_security_groups.yaml' ) + + def test_create_port_with_mac_and_ip(self): + self._test_assert_equal_for_tosca_templates( + 'test_tosca_mac_ip.yaml', + 'hot_tosca_mac_ip.yaml' + ) diff --git a/tacker/vnfm/tosca/lib/tacker_nfv_defs.yaml b/tacker/vnfm/tosca/lib/tacker_nfv_defs.yaml index 5b3ca20ec..48f2d7787 100644 --- a/tacker/vnfm/tosca/lib/tacker_nfv_defs.yaml +++ b/tacker/vnfm/tosca/lib/tacker_nfv_defs.yaml @@ -221,6 +221,9 @@ node_types: tosca.nodes.nfv.CP.Tacker: derived_from: tosca.nodes.nfv.CP properties: + mac_address: + type: string + required: false name: type: string required: false