def test_create_network_profile_on_vsm_error(self):
        data = self.get_test_network_profile_dict(segment_type='vxlan',
                                                  sub_type='enhanced')
        new_net_prof_name = data["network_profile"]["name"]
        mocked_ex = mock.MagicMock(side_effect=n1kv_exc.VSMError(
            reason='Internal VSM error'))
        with mock.patch(n1kv_client.__name__ +
                        ".Client.create_network_segment_pool", mocked_ex):
            self.create_assert_network_profile_failure(
                data=data,
                expected_status=webob.exc.HTTPInternalServerError.code)
        # list all network profiles
        netprofs = self.list_resource(
            resource='network_profiles',
            tenant_id=self.admin_tenant
        )
        # assert that the network profile created is cleaned up on neutron
        # when creation on VSM fails
        self.assertNotIn(
            needle=new_net_prof_name,
            haystack=[d["name"] for d in netprofs["network_profiles"]])
Test a network profile creation when the operation fails on VSM.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/ml2/drivers/cisco/n1kv/test_network_profile_service.py/TestN1KVMechDriverNetworkProfiles.test_create_network_profile_on_vsm_error