In this changeset, I use https://review.openstack.org/#/c/362730/ as an example to make the existing ModelRoot fully graph-based. Change-Id: I3a1ec8674b885d75221035459233722c18972f67 Implements: blueprint graph-based-cluster-model
73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
# -*- encoding: utf-8 -*-
|
|
# Copyright (c) 2017 b<>com
|
|
#
|
|
# Authors: Vincent FRANCOISE <Vincent.FRANCOISE@b-com.com>
|
|
#
|
|
# 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 watcher.decision_engine.model import element
|
|
from watcher.tests import base
|
|
|
|
|
|
class TestElement(base.TestCase):
|
|
|
|
scenarios = [
|
|
("ComputeNode_with_all_fields", dict(
|
|
cls=element.Instance,
|
|
data={
|
|
'uuid': 'FAKE_UUID',
|
|
'state': 'state',
|
|
'hostname': 'hostname',
|
|
'human_id': 'human_id',
|
|
'memory': 111,
|
|
'vcpus': 222,
|
|
'disk': 333,
|
|
'disk_capacity': 444,
|
|
})),
|
|
("ComputeNode_with_some_fields", dict(
|
|
cls=element.Instance,
|
|
data={
|
|
'uuid': 'FAKE_UUID',
|
|
'state': 'state',
|
|
'vcpus': 222,
|
|
'disk': 333,
|
|
'disk_capacity': 444,
|
|
})),
|
|
("Instance_with_all_fields", dict(
|
|
cls=element.Instance,
|
|
data={
|
|
'uuid': 'FAKE_UUID',
|
|
'state': 'state',
|
|
'hostname': 'hostname',
|
|
'human_id': 'human_id',
|
|
'memory': 111,
|
|
'vcpus': 222,
|
|
'disk': 333,
|
|
'disk_capacity': 444,
|
|
})),
|
|
("Instance_with_some_fields", dict(
|
|
cls=element.Instance,
|
|
data={
|
|
'uuid': 'FAKE_UUID',
|
|
'state': 'state',
|
|
'vcpus': 222,
|
|
'disk': 333,
|
|
'disk_capacity': 444,
|
|
})),
|
|
]
|
|
|
|
def test_as_xml_element(self):
|
|
el = self.cls(**self.data)
|
|
el.as_xml_element()
|