[WiP] Add negative tests for VIF attach/detach operations

Change-Id: I657fbecd37ceec424da6182507f324b653288857
This commit is contained in:
Kyrylo Romanenko 2024-01-19 05:24:44 +04:00
parent 227a519fc9
commit 5dbef21cb3
1 changed files with 25 additions and 0 deletions

View File

@ -413,6 +413,31 @@ class TestNodesVif(base.BaseBaremetalTest):
self.client.vif_detach(self.node['uuid'], self.nport_id)
@decorators.attr(type='negative')
@decorators.idempotent_id('628350f8-4498-4204-b546-f3c01b93c7e3')
def test_vif_already_attached_on_internal_info(self):
"""Negative test for duplicated attachment/detachment of VIFs.
Test steps:
1) Create chassis and node in setUp.
2) Create port for the node.
3) Attach VIF to the node.
4) Try to attach the same VIF to the node.
5) Detach VIF from the node.
6) Try to detach the same VIF from the node.
"""
self.useFixture(
api_microversion_fixture.APIMicroversionFixture('1.28'))
_, self.port = self.create_port(self.node['uuid'],
data_utils.rand_mac_address())
self.client.vif_attach(self.node['uuid'], self.nport_id)
_, body = self.client.vif_list(self.node['uuid'])
self.assertEqual({'vifs': [{'id': self.nport_id}]}, body)
self.assertRaises(lib_exc.Conflict, self.client.vif_attach,
self.node['uuid'], self.nport_id)
self.client.vif_detach(self.node['uuid'], self.nport_id)
self.assertRaises(lib_exc.BadRequest, self.client.vif_detach,
self.node['uuid'], self.nport_id)
class TestHardwareInterfaces(base.BaseBaremetalTest):