Forbid pxeboot network deletion

Updated the list of network types that are checked prior to network
deletion. This disallows pxeboot type network to be deleted after
initial system config.

Enable the unit test to ensure semantic check forbids pxeboot network
delete.

Closes-Bug: 1859855

Change-Id: I9a9d25abadc1e4f0cade2a4efef3c8adf3f0262b
Signed-off-by: Thomas Gao <Thomas.Gao@windriver.com>
This commit is contained in:
Thomas Gao 2020-01-27 15:12:43 -05:00
parent 75d131f296
commit fb20b0ef5c
2 changed files with 1 additions and 3 deletions

View File

@ -366,6 +366,7 @@ class NetworkController(rest.RestController):
network['type'] in [constants.NETWORK_TYPE_MGMT,
constants.NETWORK_TYPE_OAM,
constants.NETWORK_TYPE_CLUSTER_HOST,
constants.NETWORK_TYPE_PXEBOOT,
constants.NETWORK_TYPE_CLUSTER_POD,
constants.NETWORK_TYPE_CLUSTER_SERVICE]:
msg = _("Cannot delete type {} network {} after initial "

View File

@ -9,7 +9,6 @@ Tests for the API / network / methods.
"""
import mock
import unittest
from six.moves import http_client
from oslo_utils import uuidutils
@ -352,8 +351,6 @@ class TestDelete(NetworkTestCase):
def test_delete_pxeboot(self):
self._test_delete_allowed(constants.NETWORK_TYPE_PXEBOOT)
# See https://bugs.launchpad.net/starlingx/+bug/1859855
@unittest.expectedFailure
def test_delete_pxeboot_after_initial_config(self):
self._test_delete_after_initial_config_not_allowed(
constants.NETWORK_TYPE_PXEBOOT