[DEFAULT]
ocloud_global_id = 4e24b97c-8c49-4c4f-b53e-3de5235a4e37
+
smo_register_url = http://127.0.0.1:8090/register
smo_token_data = smo_token_payload
-
[API]
-test = "hello"
[WATCHER]
[DEFAULT]
ocloud_global_id = 4e24b97c-8c49-4c4f-b53e-3de5235a4e37
+
smo_register_url = http://127.0.0.1:8090/register
smo_token_data = ${SMO_TOKEN_DATA}
[API]
- test = "hello"
[WATCHER]
class ResourceType(AgRoot, Serializer):
def __init__(self, typeid: str, name: str, typeEnum: ResourceTypeEnum,
- ocloudid: str, vender: str = '', model: str = '',
+ ocloudid: str, vendor: str = '', model: str = '',
version: str = '',
description: str = '') -> None:
super().__init__()
self.resourceTypeEnum = typeEnum
self.name = name
self.description = description
- self.vender = vender
+ self.vendor = vendor
self.model = model
self.version = version
self.alarmDictionary = {}
+ " id: " + str(fmobj.id)
+ " hash: " + str(fmobj.hash))
with uow:
- logger.debug('+++test alarm dict:' +
- str(len(uow.alarm_dictionaries.list())))
alarm_event_record = uow.alarm_event_records.get(fmobj.id)
if not alarm_event_record:
logger.info("add alarm event record:" + fmobj.name
)
first = res.first()
if first is None:
- resourcetype_id = str(uuid.uuid4())
+ res_type_name = 'pserver_cpu'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
uow.resource_types.add(ResourceType(
resourcetype_id,
- 'pserver_cpu', stxobj.type,
- resourcepool.oCloudId))
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='A CPU resource type of the Physical Server'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parent.resourcePoolId
parent_id = parent.resourceId
gAssetId = '' # TODO: global ID
- description = "A CPU resource of the physical server"
+ description = "%s : A CPU resource of the physical server" % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
)
first = res.first()
if first is None:
- resourcetype_id = str(uuid.uuid4())
+ res_type_name = 'pserver_ethernet'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
uow.resource_types.add(ResourceType(
resourcetype_id,
- 'pserver_ethernet', stxobj.type,
- resourcepool.oCloudId))
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='An Ethernet resource type of Physical Server'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parent.resourcePoolId
parent_id = parent.resourceId
gAssetId = '' # TODO: global ID
- description = "An ethernet resource of the physical server"
+ description = "%s : An ethernet resource of the physical server"\
+ % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
)
first = res.first()
if first is None:
- resourcetype_id = str(uuid.uuid4())
+ res_type_name = 'pserver'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
uow.resource_types.add(ResourceType(
resourcetype_id,
- 'pserver', stxobj.type,
- resourcepool.oCloudId))
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='The Physical Server resource type'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parentid
parent_id = None # the root of the resource has no parent id
gAssetId = '' # TODO: global ID
- description = "A physical server resource"
+ description = "%s : A physical server resource" % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
)
first = res.first()
if first is None:
- resourcetype_id = str(uuid.uuid4())
+ res_type_name = 'pserver_if'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
uow.resource_types.add(ResourceType(
resourcetype_id,
- 'pserver_if', stxobj.type,
- resourcepool.oCloudId))
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='An Interface resource type of Physical Server'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parent.resourcePoolId
parent_id = parent.resourceId
gAssetId = '' # TODO: global ID
- description = "An interface resource of the physical server"
+ description = "%s : An interface resource of the physical server"\
+ % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
resourcetype_id,
'pserver_mem', stxobj.type,
resourcepool.oCloudId))
+ res_type_name = 'pserver_mem'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
+ uow.resource_types.add(ResourceType(
+ resourcetype_id,
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='A Memory resource type of Physical Server'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parent.resourcePoolId
parent_id = parent.resourceId
gAssetId = '' # TODO: global ID
- description = "A memory resource of the physical server"
+ description = "%s : A memory resource of the physical server"\
+ % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
resourcetype_id,
'pserver_if_port', stxobj.type,
resourcepool.oCloudId))
+ res_type_name = 'pserver_if_port'
+ resourcetype_id = str(uuid.uuid3(
+ uuid.NAMESPACE_URL, res_type_name))
+ uow.resource_types.add(ResourceType(
+ resourcetype_id,
+ res_type_name, stxobj.type,
+ resourcepool.oCloudId,
+ description='A Port resource type of Physical Server'))
else:
resourcetype_id = first['resourceTypeId']
resourcepool_id = parent.resourcePoolId
parent_id = parent.resourceId
gAssetId = '' # TODO: global ID
- description = "A port resource of the interface"
+ description = "%s : A port resource of the interface"\
+ % stxobj.name
resource = Resource(stxobj.id, resourcetype_id, resourcepool_id,
stxobj.name, parent_id, gAssetId, stxobj.content,
description)
def create_by(stxobj: StxGenericModel, parentid: str) -> ResourcePool:
content = json.loads(stxobj.content)
- globalcloudId = stxobj.id # to be updated
+ globalLocationId = '' # to be updated
description = "A Resource Pool"
+ location = content['location'] if content['location'] is not None else ''
resourcepool = ResourcePool(stxobj.id, stxobj.name,
- content['location'],
- parentid, globalcloudId, description)
+ location,
+ parentid, globalLocationId, description)
resourcepool.createtime = stxobj.createtime
resourcepool.updatetime = stxobj.updatetime
resourcepool.hash = stxobj.hash
raise MismatchedModel("Mismatched Id")
content = json.loads(stxobj.content)
target.name = stxobj.name
- target.location = content['location']
+ target.location = content['location'] if content['location'] is not None \
+ else ''
target.createtime = stxobj.createtime
target.updatetime = stxobj.updatetime
target.hash = stxobj.hash
ocloud = uow.oclouds.get(data.id)
if ocloud is None:
return
- logger.debug('O-Cloud Global UUID: {}'.format(ocloud.globalcloudId))
+ logger.debug('O-Cloud Global UUID: {}'.format(ocloud.globalCloudId))
ocloud_dict = ocloud.serialize()
if data.notificationEventType == NotificationEventEnum.CREATE:
register_smo(uow, ocloud_dict)
}
callback_data = json.dumps({
- 'globalCloudId': reg_data['globalcloudId'],
+ 'globalCloudId': reg_data['globalCloudId'],
'oCloudId': reg_data['oCloudId'],
'IMS_EP': config.get_api_url(),
'smo_token_data': smo_token_info