diff options
author | Zuul <zuul@review.opendev.org> | 2021-03-01 15:35:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-03-01 15:35:15 +0000 |
commit | 59ffddd2e51123bf54768ec72eb6812070c4d68d (patch) | |
tree | 557b91527329d2fe56832d18b4dce34ddcddac03 | |
parent | 891192ca2b9e118cc05fd6560541bcca5d385370 (diff) | |
parent | f8af1df9e6891d2a676378e433a1d8c363e072e2 (diff) | |
download | python-ironicclient-59ffddd2e51123bf54768ec72eb6812070c4d68d.tar.gz |
Merge "Add tests for 'baremetal port create' command"4.6.1
-rw-r--r-- | ironicclient/tests/functional/osc/v1/test_baremetal_port_create.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ironicclient/tests/functional/osc/v1/test_baremetal_port_create.py b/ironicclient/tests/functional/osc/v1/test_baremetal_port_create.py new file mode 100644 index 0000000..04051f8 --- /dev/null +++ b/ironicclient/tests/functional/osc/v1/test_baremetal_port_create.py @@ -0,0 +1,75 @@ +# Copyright (c) 2016 Mirantis, Inc. +# +# 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 tempest.lib.common.utils import data_utils + +from ironicclient.tests.functional.osc.v1 import base + + +class BaremetalPortCreate(base.TestCase): + """Detailed functional tests for baremetal port create command.""" + + def setUp(self): + super(BaremetalPortCreate, self).setUp() + self.node = self.node_create() + + def test_extras(self): + """Check baremetal port create command with extra data. + + Test steps: + 1) Create port using solitary and multiple --extra arguments. + 2) Check that port successfully created with right extras. + """ + extras = [{'single_extra': 'yes'}, + {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}] + + for extra in extras: + params = self.generate_params('--extra', extra) + port = self.port_create(self.node['uuid'], params=params) + self.assert_dict_is_subset(extra, port['extra']) + + def test_pxe_1_19(self): + """Check baremetal port create command with PXE option. + + Test steps: + 1) Create port using --pxe-enabled argument. + 2) Check that port successfully created with right PXE option. + """ + pxe_values = [True, False] + api_version = ' --os-baremetal-api-version 1.19' + + for value in pxe_values: + port = self.port_create( + self.node['uuid'], + params='--pxe-enabled {0} {1}'.format(value, api_version)) + self.assertEqual(value, port['pxe_enabled']) + + def test_llc_1_19(self): + """Check baremetal port create command with LLC option. + + Test steps: + 1) Create port using --local-link-connection argument. + 2) Check that port successfully created with right LLC data. + """ + fake_port_id = data_utils.rand_name(prefix='ovs-node-') + fake_switch_id = data_utils.rand_mac_address() + llc_value = {"switch_info": "brbm", + "port_id": fake_port_id, + "switch_id": fake_switch_id} + api_version = ' --os-baremetal-api-version 1.19' + + params = self.generate_params('--local-link-connection', llc_value) + port = self.port_create(self.node['uuid'], + params='{0} {1}'.format(params, api_version)) + self.assert_dict_is_subset(llc_value, port['local_link_connection']) |